-
Notifications
You must be signed in to change notification settings - Fork 35
Light Calorimetry: add sim energy deposit info and light calo info into cafs #619
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
ee878b1
9d14dd5
c771df6
3fe86e7
19250d1
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 |
|---|---|---|
|
|
@@ -97,6 +97,7 @@ | |
| #include "lardataobj/RecoBase/MCSFitResult.h" | ||
| #include "lardataobj/RecoBase/Cluster.h" | ||
| #include "lardataobj/AnalysisBase/MVAOutput.h" | ||
| #include "lardataobj/Simulation/SimEnergyDeposit.h" | ||
|
|
||
| #include "nusimdata/SimulationBase/MCFlux.h" | ||
| #include "nusimdata/SimulationBase/MCTruth.h" | ||
|
|
@@ -120,6 +121,7 @@ | |
| #include "sbnobj/Common/Reco/OpT0FinderResult.h" | ||
| #include "sbnobj/SBND/CRT/CRTVeto.hh" | ||
| #include "sbnobj/Common/Reco/CorrectedOpFlashTiming.h" | ||
| #include "sbnobj/Common/Reco/LightCalo.h" | ||
| #include "sbnobj/SBND/Timing/TimingInfo.hh" | ||
| #include "sbnobj/SBND/Timing/FrameShiftInfo.hh" | ||
|
|
||
|
|
@@ -1443,6 +1445,15 @@ void CAFMaker::produce(art::Event& evt) noexcept { | |
| art::fill_ptr_vector(simchannels, simchannel_handle); | ||
| } | ||
|
|
||
| // get sim energy deposits if they're there | ||
| ::art::Handle<std::vector<sim::SimEnergyDeposit>> sed_handle; | ||
| GetByLabelStrict(evt, fParams.SimEnergyDepositLabel().encode(), sed_handle); | ||
|
|
||
| std::vector<art::Ptr<sim::SimEnergyDeposit>> seds; | ||
| if (sed_handle.isValid()){ | ||
| art::fill_ptr_vector(seds, sed_handle); | ||
| } | ||
|
|
||
| art::Handle<std::vector<simb::MCFlux>> mcflux_handle; | ||
| GetByLabelStrict(evt, std::string("generator"), mcflux_handle); | ||
|
|
||
|
|
@@ -1637,6 +1648,34 @@ void CAFMaker::produce(art::Event& evt) noexcept { | |
| } // end for fm | ||
| } // end for i (mctruths) | ||
|
|
||
|
|
||
| if (!isRealData && sed_handle.isValid()){ | ||
| art::ServiceHandle<cheat::ParticleInventoryService> pi_serv; | ||
|
|
||
| srtruthbranch.dep.reserve(mctruths.size()); | ||
| for (size_t n=0; n<mctruths.size();n++){ | ||
| SRTrueDeposit init; | ||
|
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. Is the name
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. I could go either way about it, not sure that I feel very strongly as long as you think it's documented well in the corresponding header. It may be confusing if one expects it to be exactly what's in |
||
| init.electrons = 0; | ||
| init.photons = 0; | ||
| init.energy = 0; | ||
| srtruthbranch.dep.push_back(init); | ||
| } | ||
|
|
||
| for (size_t n_dep=0; n_dep < seds.size(); n_dep++){ | ||
| auto sed = seds[n_dep]; | ||
| const auto trackID = sed->TrackID(); | ||
|
|
||
| art::Ptr<simb::MCTruth> mctruth = pi_serv->TrackIdToMCTruth_P(trackID); | ||
| auto it = std::find(mctruths.begin(), mctruths.end(), mctruth); | ||
| if (it == mctruths.end()) continue; | ||
|
|
||
| auto idx = std::distance(mctruths.begin(), it); | ||
| srtruthbranch.dep.at(idx).energy += sed->Energy()*1e-3; // GeV | ||
| srtruthbranch.dep.at(idx).photons += sed->NumPhotons(); | ||
| srtruthbranch.dep.at(idx).electrons += sed->NumElectrons(); | ||
| } | ||
| } | ||
|
|
||
| // get the number of events generated in the gen stage | ||
| unsigned n_gen_evt = 0; | ||
| for (const art::ProcessConfiguration &process: evt.processHistory()) { | ||
|
|
@@ -2049,6 +2088,13 @@ void CAFMaker::produce(art::Event& evt) noexcept { | |
| if (fmCorrectedOpFlash.isValid()) | ||
| slcCorrectedOpFlash = fmCorrectedOpFlash.at(0); | ||
|
|
||
| art::FindOneP<sbn::LightCalo> foLightCalo = | ||
| FindOnePStrict<sbn::LightCalo>(sliceList,evt, | ||
| fParams.LightCaloLabel() + slice_tag_suff); | ||
| const sbn::LightCalo *slcLightCalo = nullptr; | ||
| if (foLightCalo.isValid()) { | ||
| slcLightCalo = foLightCalo.at(0).get(); | ||
| } | ||
|
|
||
| art::FindOneP<lcvn::Result> foCVNResult = | ||
| FindOnePStrict<lcvn::Result>(sliceList, evt, | ||
|
|
@@ -2308,6 +2354,7 @@ void CAFMaker::produce(art::Event& evt) noexcept { | |
| FillSliceCRUMBS(slcCRUMBS, recslc); | ||
| FillSliceOpT0Finder(slcOpT0, recslc); | ||
| FillSliceBarycenter(slcHits, slcSpacePoints, recslc); | ||
| FillSliceLightCalo(slcLightCalo, recslc); | ||
| FillTPCPMTBarycenterMatch(barycenterMatch, recslc); | ||
| FillCorrectedOpFlashTiming(slcCorrectedOpFlash, recslc); | ||
| FillCVNScores(cvnResult, recslc); | ||
|
|
||
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.
What's the motivation for explicitly naming the process name as "G4"? Are we expecting scenarios where multiple fcl processes have created SimEnergyDeposits? Definitely not asking for a change here as this is nice and fcl flexible. Just interested in why this came up!
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.
Hmm, no particular reason. I think I had paralleled the syntax for the trigger emulation in the same file!