-
Notifications
You must be signed in to change notification settings - Fork 36
Feature/adding blip to caf #603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
18b28ec
daa5c8e
8dfaab0
23c5909
6ec65f7
3812b04
f830082
e4cc10e
0c62419
97b9db8
44e03a4
a44f4c6
b6b0f4f
ddda71a
05878a3
3b3e41b
fe6e410
19f6c92
bd6ecab
271cf7b
5062c12
221712e
41428d5
6521093
99c3c0e
f41b6b8
761904f
274f91f
22cc848
a509692
ebc6432
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,104 @@ | ||||||||||||||||||||||||||||||
| #include "sbncode/CAFMaker/FillBlip.h" | ||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for putting in a separate file, FillReco is getting unwieldy. |
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| namespace caf | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| void FillBlip( const std::vector<blip::Blip>& LarBlips, std::vector<caf::SRBlip>& CAF_Blips) | ||||||||||||||||||||||||||||||
PetrilloAtWork marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| int NBlips = LarBlips.size(); | ||||||||||||||||||||||||||||||
| for(int iBlip=0; iBlip<NBlips; iBlip++) | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| blip::Blip CurrentBlip = LarBlips[iBlip]; | ||||||||||||||||||||||||||||||
PetrilloAtWork marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||
| caf::SRBlip NewBlip; | ||||||||||||||||||||||||||||||
| NewBlip.ID = CurrentBlip.ID; | ||||||||||||||||||||||||||||||
| NewBlip.isValid = CurrentBlip.isValid; | ||||||||||||||||||||||||||||||
| NewBlip.Cryostat = CurrentBlip.Cryostat; | ||||||||||||||||||||||||||||||
| NewBlip.TPC = CurrentBlip.TPC; | ||||||||||||||||||||||||||||||
| NewBlip.NPlanes = CurrentBlip.NPlanes; | ||||||||||||||||||||||||||||||
| NewBlip.MaxWireSpan = CurrentBlip.MaxWireSpan; | ||||||||||||||||||||||||||||||
| NewBlip.TimeTick = CurrentBlip.TimeTick; | ||||||||||||||||||||||||||||||
| NewBlip.Time = CurrentBlip.Time; | ||||||||||||||||||||||||||||||
| NewBlip.Charge = CurrentBlip.Charge; | ||||||||||||||||||||||||||||||
| NewBlip.Energy = CurrentBlip.Energy/1000.; //convert to GeV | ||||||||||||||||||||||||||||||
| NewBlip.EnergyESTAR = CurrentBlip.EnergyESTAR/1000.; //convert to GeV | ||||||||||||||||||||||||||||||
| NewBlip.EnergyPSTAR = CurrentBlip.EnergyPSTAR/1000.; //convert to GeV | ||||||||||||||||||||||||||||||
| NewBlip.ProxTrkDist = CurrentBlip.ProxTrkDist; | ||||||||||||||||||||||||||||||
| NewBlip.ProxTrkID = CurrentBlip.ProxTrkID; | ||||||||||||||||||||||||||||||
| NewBlip.inCylinder = CurrentBlip.inCylinder; | ||||||||||||||||||||||||||||||
| NewBlip.Position = CurrentBlip.Position; | ||||||||||||||||||||||||||||||
| NewBlip.SigmaYZ = CurrentBlip.SigmaYZ; | ||||||||||||||||||||||||||||||
| NewBlip.dX = CurrentBlip.dX; | ||||||||||||||||||||||||||||||
| NewBlip.dYZ = CurrentBlip.dYZ; | ||||||||||||||||||||||||||||||
| if(CurrentBlip.truth.ID >= 0 ) //MC Blip | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| FillMCTruthBlip( CurrentBlip, NewBlip ); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| FillBlipRealtedHitCluster( CurrentBlip, NewBlip ); | ||||||||||||||||||||||||||||||
| CAF_Blips.push_back(NewBlip); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| void FillMCTruthBlip( blip::Blip& LarBlip, caf::SRBlip &CAF_Blip ) | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
| void FillMCTruthBlip( blip::Blip& LarBlip, caf::SRBlip &CAF_Blip ) | |
| void FillMCTruthBlip( blip::Blip const& LarBlip, caf::SRBlip &CAF_Blip ) |
Also, since the function is dealing only with LarBlip.truth and CAF_Blip.truthBlip, the arguments should be these two rather than LarBlip and CAF_Blip.
Same argument name comment as above, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated this and hitCluster functions
PetrilloAtWork marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
PetrilloAtWork marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
PetrilloAtWork marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
PetrilloAtWork marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
PetrilloAtWork marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend to use the appropriate std::vector member function, assign():
| //These are sets that need to become vectors so we need to do some loops | |
| for(auto HitID : LarBlip.clusters[iPlane].HitIDs) CAF_Blip.clusters[iPlane].HitIDs.push_back(HitID); | |
| // These are sets that need to become vectors | |
| CAF_Blip.clusters[iPlane].HitIDs.assign(begin(LarBlip.clusters[iPlane].HitIDs), end(LarBlip.clusters[iPlane].HitIDs)); |
If this function is changed as recommended above to work on a single cluster, this becomes less wordy and more readable:
| //These are sets that need to become vectors so we need to do some loops | |
| for(auto HitID : LarBlip.clusters[iPlane].HitIDs) CAF_Blip.clusters[iPlane].HitIDs.push_back(HitID); | |
| // These are sets that need to become vectors | |
| CAFcluster.HitIDs.assign(begin(LArCluster.HitIDs), end(LArCluster.HitIDs)); |
same for the next three lines; in fact, you could even write a specific function and use it repeatedly:
| //These are sets that need to become vectors so we need to do some loops | |
| for(auto HitID : LarBlip.clusters[iPlane].HitIDs) CAF_Blip.clusters[iPlane].HitIDs.push_back(HitID); | |
| // These are sets that need to become vectors | |
| auto copyToVector = [](auto& dest, auto const& src) | |
| { dest.assign(begin(src), end(src)); }; | |
| copyToVector(CAF_Blip.clusters[iPlane].HitIDs, LarBlip.clusters[iPlane].HitIDs); |
etc.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #ifndef CAF_FILLBLIP_H | ||
PetrilloAtWork marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| #define CAF_FILLBLIP_H | ||
| #include<iostream> | ||
PetrilloAtWork marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| #include "sbnanaobj/StandardRecord/SRBlip.h" | ||
| #include "sbnobj/SBND/Blip/BlipDataTypes.h" | ||
|
|
||
| #include <vector> | ||
|
|
||
| namespace caf | ||
| { | ||
|
|
||
| void FillBlip( const std::vector<blip::Blip>& LarBlips, std::vector<caf::SRBlip>& CAF_Blips); | ||
| void FillMCTruthBlip(blip::Blip& LarBlip, caf::SRBlip& CAF_Blip ); | ||
| void FillBlipRealtedHitCluster(blip::Blip& LarBlip, caf::SRBlip& CAF_Blip); | ||
|
||
| } | ||
|
|
||
| #endif | ||
Uh oh!
There was an error while loading. Please reload this page.