-
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
|
||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| int NBlips = LarBlips.size(); | ||||||||||||||||||||||||||||||
| for(int iBlip=0; iBlip<NBlips; iBlip++) | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| blip::Blip CurrentBlip = LarBlips[iBlip]; | ||||||||||||||||||||||||||||||
|
PetrilloAtWork marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||
| 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 ) | ||||||||||||||||||||||||||||||
|
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. LarBlip is not modified, so it needs to be declared constant:
Suggested change
Also, since the function is dealing only with
Contributor
Author
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. Updated this and hitCluster functions |
||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| //CAF_Blip.truthBlip = LarBlip.truth; | ||||||||||||||||||||||||||||||
|
PetrilloAtWork marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||
| CAF_Blip.truthBlip.ID = LarBlip.truth.ID; | ||||||||||||||||||||||||||||||
| CAF_Blip.truthBlip.Cryostat =LarBlip.truth.Cryostat; | ||||||||||||||||||||||||||||||
| CAF_Blip.truthBlip.TPC =LarBlip.truth.TPC; | ||||||||||||||||||||||||||||||
| CAF_Blip.truthBlip.Time =LarBlip.truth.Time; | ||||||||||||||||||||||||||||||
| CAF_Blip.truthBlip.TimeTick =LarBlip.truth.TimeTick; | ||||||||||||||||||||||||||||||
| CAF_Blip.truthBlip.DriftTime =LarBlip.truth.DriftTime; | ||||||||||||||||||||||||||||||
| CAF_Blip.truthBlip.Energy =LarBlip.truth.Energy; | ||||||||||||||||||||||||||||||
| CAF_Blip.truthBlip.DepElectrons =LarBlip.truth.DepElectrons; | ||||||||||||||||||||||||||||||
| CAF_Blip.truthBlip.NumElectrons =LarBlip.truth.NumElectrons; | ||||||||||||||||||||||||||||||
| CAF_Blip.truthBlip.LeadG4ID =LarBlip.truth.LeadG4ID; | ||||||||||||||||||||||||||||||
| CAF_Blip.truthBlip.LeadG4Index =LarBlip.truth.LeadG4Index; | ||||||||||||||||||||||||||||||
| CAF_Blip.truthBlip.LeadG4PDG =LarBlip.truth.LeadG4PDG; | ||||||||||||||||||||||||||||||
| CAF_Blip.truthBlip.LeadCharge =LarBlip.truth.LeadCharge; | ||||||||||||||||||||||||||||||
| CAF_Blip.truthBlip.Position =LarBlip.truth.Position; | ||||||||||||||||||||||||||||||
|
PetrilloAtWork marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||
| CAF_Blip.truthBlip.Energy = CAF_Blip.truthBlip.Energy/1000.; //convert to GeV | ||||||||||||||||||||||||||||||
|
PetrilloAtWork marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| void FillBlipRealtedHitCluster(blip::Blip& LarBlip, caf::SRBlip &CAF_Blip) | ||||||||||||||||||||||||||||||
|
PetrilloAtWork marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| int NumPlanes = sizeof(LarBlip.clusters)/sizeof(LarBlip.clusters[0]); | ||||||||||||||||||||||||||||||
|
PetrilloAtWork marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||
| for(int iPlane=0; iPlane<NumPlanes; iPlane++) | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].ID = LarBlip.clusters[iPlane].ID; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].isValid = LarBlip.clusters[iPlane].isValid; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].CenterChan = LarBlip.clusters[iPlane].CenterChan; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].CenterWire = LarBlip.clusters[iPlane].CenterWire; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].isTruthMatched = LarBlip.clusters[iPlane].isTruthMatched; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].isMerged = LarBlip.clusters[iPlane].isMerged; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].isMatched = LarBlip.clusters[iPlane].isMatched; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].DeadWireSep = LarBlip.clusters[iPlane].DeadWireSep; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].Cryostat = LarBlip.clusters[iPlane].Cryostat; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].TPC = LarBlip.clusters[iPlane].TPC; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].Plane = LarBlip.clusters[iPlane].Plane; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].NHits = LarBlip.clusters[iPlane].NHits; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].NWires = LarBlip.clusters[iPlane].NWires; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].ADCs = LarBlip.clusters[iPlane].ADCs; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].Amplitude = LarBlip.clusters[iPlane].Amplitude; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].Charge = LarBlip.clusters[iPlane].Charge; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].SigmaCharge = LarBlip.clusters[iPlane].SigmaCharge; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].TimeTick = LarBlip.clusters[iPlane].TimeTick; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].Time = LarBlip.clusters[iPlane].Time; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].StartHitTime = LarBlip.clusters[iPlane].StartHitTime; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].EndHitTime = LarBlip.clusters[iPlane].EndHitTime; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].StartTime = LarBlip.clusters[iPlane].StartTime; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].EndTime = LarBlip.clusters[iPlane].EndTime; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].Timespan = LarBlip.clusters[iPlane].Timespan; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].RMS = LarBlip.clusters[iPlane].RMS; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].StartWire = LarBlip.clusters[iPlane].StartWire; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].EndWire = LarBlip.clusters[iPlane].EndWire; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].NPulseTrainHits = LarBlip.clusters[iPlane].NPulseTrainHits; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].GoodnessOfFit = LarBlip.clusters[iPlane].GoodnessOfFit; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].BlipID = LarBlip.clusters[iPlane].BlipID; | ||||||||||||||||||||||||||||||
| CAF_Blip.clusters[iPlane].EdepID = LarBlip.clusters[iPlane].EdepID; | ||||||||||||||||||||||||||||||
| //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); | ||||||||||||||||||||||||||||||
|
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. I recommend to use the appropriate
Suggested change
If this function is changed as recommended above to work on a single cluster, this becomes less wordy and more readable:
Suggested change
same for the next three lines; in fact, you could even write a specific function and use it repeatedly:
Suggested change
etc. |
||||||||||||||||||||||||||||||
| for(auto Wire : LarBlip.clusters[iPlane].Wires) CAF_Blip.clusters[iPlane].Wires.push_back(Wire); | ||||||||||||||||||||||||||||||
| for(auto Chan : LarBlip.clusters[iPlane].Chans) CAF_Blip.clusters[iPlane].Chans.push_back(Chan); | ||||||||||||||||||||||||||||||
| for(auto G4ID : LarBlip.clusters[iPlane].G4IDs) CAF_Blip.clusters[iPlane].G4IDs.push_back(G4ID); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #ifndef CAF_FILLBLIP_H | ||
|
PetrilloAtWork marked this conversation as resolved.
|
||
| #define CAF_FILLBLIP_H | ||
| #include<iostream> | ||
|
PetrilloAtWork marked this conversation as resolved.
Outdated
|
||
| #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); | ||
|
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. In both these functions one of the operands (the first one, I'd wage) must be declared |
||
| } | ||
|
|
||
| #endif | ||
Uh oh!
There was an error while loading. Please reload this page.