138 art::Handle<std::vector<recob::Hit>> hitListHandle;
139 std::vector<art::Ptr<recob::Hit>> hitlist;
140 if (
evt.getByLabel(
fHitModuleLabel, hitListHandle)) art::fill_ptr_vector(hitlist, hitListHandle);
142 art::Handle<std::vector<sim::SimChannel>> scListHandle;
143 std::vector<art::Ptr<sim::SimChannel>> simchanlist;
145 art::fill_ptr_vector(simchanlist, scListHandle);
147 art::Handle<std::vector<recob::Shower>> showerListHandle;
148 std::vector<art::Ptr<recob::Shower>> showerlist;
150 art::fill_ptr_vector(showerlist, showerListHandle);
152 art::Handle<std::vector<simb::MCTruth>> mctruthListHandle;
153 std::vector<art::Ptr<simb::MCTruth>> mclist;
155 art::fill_ptr_vector(mclist, mctruthListHandle);
160 if (showerListHandle.isValid()) {
161 nshws = showerlist.size();
163 for (
int i = 0; i < std::min(
int(showerlist.size()),
kMaxShowers); ++i) {
164 shwid[i] = showerlist[i]->ID();
165 shwdcosx[i] = showerlist[i]->Direction().X();
166 shwdcosy[i] = showerlist[i]->Direction().Y();
167 shwdcosz[i] = showerlist[i]->Direction().Z();
168 shwstartx[i] = showerlist[i]->ShowerStart().X();
169 shwstarty[i] = showerlist[i]->ShowerStart().Y();
170 shwstartz[i] = showerlist[i]->ShowerStart().Z();
171 for (
size_t j = 0; j < (showerlist[i]->dEdx()).
size(); ++j) {
172 shwdedx[i][j] = showerlist[i]->dEdx()[j];
179 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(
evt);
182 art::Ptr<simb::MCTruth> mctruth = mclist[0];
183 if (mctruth->NeutrinoSet()) {
185 nuPDG_truth = mctruth->GetNeutrino().Nu().PdgCode();
189 if (showerlist.size()) {
191 std::vector<art::Ptr<recob::Hit>> showerhits = shwfm.at(0);
193 const simb::MCParticle* particle;
194 double tmpEfrac = 0.0;
195 double tmpEcomplet = 0;
196 truthMatcher(clockData, hitlist, showerhits, particle, tmpEfrac, tmpEcomplet);
198 std::cout <<
"shower pdg: " << particle->PdgCode() <<
" efrac " << tmpEfrac << std::endl;
float shwstartx[kMaxShowers]
double shwdedx[kMaxShowers][2]
void truthMatcher(detinfo::DetectorClocksData const &clockData, std::vector< art::Ptr< recob::Hit >> all_hits, std::vector< art::Ptr< recob::Hit >> shower_hits, const simb::MCParticle *&MCparticle, double &Efrac, double &Ecomplet)
int shwbestplane[kMaxShowers]
std::size_t size(FixedBins< T, C > const &) noexcept
float shwdcosz[kMaxShowers]
float shwstarty[kMaxShowers]
constexpr int kMaxShowers
std::string fHitModuleLabel
std::string fDigitModuleLabel
float shwdcosy[kMaxShowers]
std::string fShowerModuleLabel
float shwdcosx[kMaxShowers]
float shwstartz[kMaxShowers]
std::string fGenieGenModuleLabel
BEGIN_PROLOG could also be cout