-
Notifications
You must be signed in to change notification settings - Fork 35
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
base: develop
Are you sure you want to change the base?
Changes from all commits
18b28ec
daa5c8e
8dfaab0
23c5909
6ec65f7
3812b04
f830082
e4cc10e
0c62419
97b9db8
44e03a4
a44f4c6
b6b0f4f
ddda71a
05878a3
3b3e41b
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 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -20,6 +20,7 @@ | |||||||||||
| #include "sbncode/CAFMaker/FillExposure.h" | ||||||||||||
| #include "sbncode/CAFMaker/FillTrigger.h" | ||||||||||||
| #include "sbncode/CAFMaker/Utils.h" | ||||||||||||
| #include "sbncode/CAFMaker/FillBlip.h" | ||||||||||||
|
|
||||||||||||
| // C/C++ includes | ||||||||||||
| #include <fenv.h> | ||||||||||||
|
|
@@ -1928,6 +1929,18 @@ void CAFMaker::produce(art::Event& evt) noexcept { | |||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| //Fill blips. art::handle for blips and then call fill blips for each one. Make a vector to hold all of them. I handle for loop in Fill blip | ||||||||||||
| art::Handle<std::vector<blip::Blip>> blipHandle; | ||||||||||||
| std::vector<caf::SRBlip> srblips; | ||||||||||||
| if(evt.getByLabel( fParams.fBlipTag(), blipHandle)) //fill SR blips | ||||||||||||
| { | ||||||||||||
| FillBlip( (*blipHandle), srblips); | ||||||||||||
|
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. Parentheses are redundant here. Just saying.
Suggested change
(this is a suggestion) |
||||||||||||
| //for(int i=0; i<int(*(blipHandle)->size()); i++) | ||||||||||||
| // { | ||||||||||||
| // auto LarBlips = (*(blipHandle))[i]; | ||||||||||||
| // FillBlip( (LarBlips) , srblips); | ||||||||||||
| // } | ||||||||||||
|
Comment on lines
+1938
to
+1942
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. Please remove obsolete, commented out code:
Suggested change
|
||||||||||||
| } | ||||||||||||
| // collect the TPC slices | ||||||||||||
| std::vector<art::Ptr<recob::Slice>> slices; | ||||||||||||
| std::vector<std::string> slice_tag_suffixes; | ||||||||||||
|
|
@@ -2605,6 +2618,7 @@ void CAFMaker::produce(art::Event& evt) noexcept { | |||||||||||
| rec.sbnd_crt_veto = srsbndcrtveto; | ||||||||||||
| rec.opflashes = srflashes; | ||||||||||||
| rec.nopflashes = srflashes.size(); | ||||||||||||
| rec.blips = srblips; | ||||||||||||
| rec.sbnd_frames = srsbndframeshiftinfo; | ||||||||||||
| rec.sbnd_timings = srsbndtiminginfo; | ||||||||||||
| rec.soft_trig = srsbndsofttrig; | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,99 @@ | ||||||||||||||
| #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) | ||||||||||||||
|
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. Having a consistent variable naming style would be good too (e.g. |
||||||||||||||
| { | ||||||||||||||
| int NBlips = LarBlips.size(); | ||||||||||||||
| for(int iBlip=0; iBlip<NBlips; iBlip++) | ||||||||||||||
| { | ||||||||||||||
| blip::Blip CurrentBlip = LarBlips[iBlip]; | ||||||||||||||
|
Comment on lines
+7
to
+10
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 think this is equivalent to using a range-for loop:
Suggested change
This avoids copies ( |
||||||||||||||
| 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.SetXYZ(CurrentBlip.Position.X(), CurrentBlip.Position.Y(), CurrentBlip.Position.Z()); | ||||||||||||||
| 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 |
||||||||||||||
| { | ||||||||||||||
| 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.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.SetXYZ(LarBlip.truth.Position.X(), LarBlip.truth.Position.Y(), LarBlip.truth.Position.Z()); | ||||||||||||||
| CAF_Blip.truthBlip.energy = CAF_Blip.truthBlip.energy/1000.; //convert to GeV | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| 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. Pass clusters to this function rather than the full blip objects, since clusters are the only object this function concerns with. |
||||||||||||||
| { | ||||||||||||||
| int NumPlanes = sizeof(LarBlip.clusters)/sizeof(LarBlip.clusters[0]); | ||||||||||||||
|
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. Since you defined a |
||||||||||||||
| 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].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].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); | ||||||||||||||
| 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 | ||||||||||||||||||
|
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. It would be good to add a standard header with file name, brief description and author identification, like in:
Suggested change
The same holds for the |
||||||||||||||||||
| #define CAF_FILLBLIP_H | ||||||||||||||||||
| #include<iostream> | ||||||||||||||||||
|
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. Unused header:
Suggested change
|
||||||||||||||||||
| #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); | ||||||||||||||||||
|
Comment on lines
+13
to
+14
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 | ||||||||||||||||||
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.
Conform to the existing alignment (
[CO-02]).