DualPhaseOpHitDumper_module.cc
Go to the documentation of this file.
1 #include <functional> // std::greater
2 
3 //ROOT includes
4 #include "TH1I.h"
5 #include "TH1F.h"
6 #include "TH2F.h"
7 #include "TTree.h"
8 #include "TMath.h"
9 #include "TGeoMatrix.h" // TGeoHMatrix
10 
11 // LArSoft libraries
12 
13 //LArSoft includes
15 
18 
21 
23 #include "lardataobj/RawData/raw.h"
30 
33 
37 
38 //ART includes
45 #include "art_root_io/TFileDirectory.h"
46 #include "art_root_io/TFileService.h"
49 #include "canvas/Persistency/Common/FindMany.h"
50 #include "canvas/Persistency/Common/FindManyP.h"
51 #include "canvas/Persistency/Common/FindOneP.h"
52 #include "fhiclcpp/ParameterSet.h"
54 
56 std::map<PType, std::string> PTypeString{
57  {kUnknown,"Unknown"},
58  {kSign ,"Sign" },
59  {kAr39 ,"Ar39" },
60  {kNeut ,"Neut" },
61  {kKryp ,"Kryp" },
62  {kRdon ,"Rdon" },
63  {kAr42 ,"Ar42" }};
64 
65 
67 
68 public:
69  explicit DualPhaseOpHitDumper(fhicl::ParameterSet const & p);
70 
75 
76  void analyze(art::Event const & evt) override;
77  void reconfigure(fhicl::ParameterSet const & p);
78  void beginJob() override;
79  void endJob() override;
80 
81 private:
82 
83  void ResetVariables();
84  void FillMyMaps ( std::map< int, simb::MCParticle> &MyMap,
85  art::FindManyP<simb::MCParticle> Assn,
86  art::Handle< std::vector<simb::MCTruth> > Hand,
87  std::map<int, int>* indexMap=nullptr);
88  PType WhichParType( int TrID );
89  bool InMyMap ( int TrID, std::map< int, simb::MCParticle> ParMap );
90  void FillTruth(const art::FindManyP<simb::MCParticle> Assn,
91  const art::Handle<std::vector<simb::MCTruth>>& Hand,
92  const PType type) ;
93  void SaveNeighbourADC(int channel,
94  art::Handle< std::vector<raw::RawDigit> >rawDigitsVecHandle,
95  std::set<int> badChannels,
96  recob::Hit const& hits);
97 
98 
99 
103 
105 
107  std::string fSIGNLabel ; std::map< int, simb::MCParticle > SignParts;
108  std::string fAr39Label ; std::map< int, simb::MCParticle > Ar39Parts;
109  std::string fNeutLabel ; std::map< int, simb::MCParticle > NeutParts;
110  std::string fKrypLabel ; std::map< int, simb::MCParticle > KrypParts;
111  std::string fRdonLabel ; std::map< int, simb::MCParticle > RdonParts;
112  std::string fAr42Label ; std::map< int, simb::MCParticle > Ar42Parts;
113  std::map<int, const simb::MCParticle*> truthmap;
114  // Which SignEY interaction (if any) caused this true track ID?
115  std::map<int, int> trkIDToMarleyIndex;
116 
117  // Mapping from track ID to particle type, for use in WhichParType()
118  std::map<int, PType> trkIDToPType;
119 
121  bool fSavePDS;
122 
123  TTree* fAnaTree;
124 
125  int Run;
126  int SubRun;
127  int Event;
128 
129  std::vector<int> PDS_OpHit_OpChannel ;
130  std::vector<double> PDS_OpHit_X ;
131  std::vector<double> PDS_OpHit_Y ;
132  std::vector<double> PDS_OpHit_Z ;
133  std::vector<double> PDS_OpHit_PeakTimeAbs ;
134  std::vector<double> PDS_OpHit_PeakTime ;
135  std::vector<unsigned short> PDS_OpHit_Frame ;
136  std::vector<double> PDS_OpHit_Width ;
137  std::vector<double> PDS_OpHit_Area ;
138  std::vector<double> PDS_OpHit_Amplitude ;
139  std::vector<double> PDS_OpHit_PE ;
140  std::vector<double> PDS_OpHit_FastToTotal ;
141  std::vector<int> PDS_OpHit_True_GenType ;
142  std::vector<int> PDS_OpHit_True_Index ;
143  std::vector<double> PDS_OpHit_True_Energy ;
144  std::vector<int> PDS_OpHit_True_TrackID ;
145  std::vector<int> PDS_OpHit_True_GenTypeAll;
146  std::vector<double> PDS_OpHit_True_EnergyAll ;
147  std::vector<int> PDS_OpHit_True_TrackIDAll;
148  std::vector<int> PDS_OpHit_True_IndexAll ;
149 
150  std::vector<int> True_Bck_Mode ;
151  std::vector<double> True_Bck_VertX ;
152  std::vector<double> True_Bck_VertY ;
153  std::vector<double> True_Bck_VertZ ;
154  std::vector<double> True_Bck_Time ;
155  std::vector<double> True_Bck_Energy ;
156  std::vector<int> True_Bck_PDG ;
157  std::vector<int> True_Bck_ID ;
158 
165 
166 
171 
172 };
173 
175 {
176  this->reconfigure(p);
177 }
178 
179 
181 {
182  fOpHitModuleLabel = p.get<std::string>("OpHitModuleLabel" );
183 
184 
185 
186  fGEANTLabel = p.get<std::string> ("GEANT4Label" );
187  fSIGNLabel = p.get<std::string> ("SIGNALLabel" );
188  fAr39Label = p.get<std::string> ("Argon39Label" );
189  fNeutLabel = p.get<std::string> ("NeutronLabel" );
190  fKrypLabel = p.get<std::string> ("KryptonLabel" );
191  fRdonLabel = p.get<std::string> ("RadonLabel" );
192  fAr42Label = p.get<std::string> ("Argon42Label" );
193 
194  fSaveTruth = p.get<bool>("SaveTruth",0);
195  fSavePDS = p.get<bool>("SavePDS",1);
196 
197  std::cout << "Reconfigured " << this->processName() << " with "
198  << " SaveNeighbourADCs: " << std::boolalpha
199  << " SaveTruth: " << std::boolalpha << fSaveTruth
200  << " SaveIDEs: " << std::boolalpha << std::endl;
201 }
202 
203 
205 {
206  trkIDToPType.clear();
207 
208  SignParts.clear(); Ar39Parts.clear();
209  NeutParts.clear(); KrypParts.clear(); RdonParts.clear();
210  Ar42Parts.clear();
211 
212  Run = SubRun = Event = -1;
213 
214  TotGen_Sign = TotGen_Ar39 = 0;
216  TotGen_Ar42 = 0;
217 
218 
219  PDS_OpHit_OpChannel .clear();
220  PDS_OpHit_X .clear();
221  PDS_OpHit_Y .clear();
222  PDS_OpHit_Z .clear();
223  PDS_OpHit_PeakTimeAbs .clear();
224  PDS_OpHit_PeakTime .clear();
225  PDS_OpHit_Frame .clear();
226  PDS_OpHit_Width .clear();
227  PDS_OpHit_Area .clear();
228  PDS_OpHit_Amplitude .clear();
229  PDS_OpHit_PE .clear();
230  PDS_OpHit_FastToTotal .clear();
231  PDS_OpHit_True_GenType .clear();
232  PDS_OpHit_True_Index .clear();
233  PDS_OpHit_True_Energy .clear();
234  PDS_OpHit_True_TrackID .clear();
236  PDS_OpHit_True_EnergyAll .clear();
238  PDS_OpHit_True_IndexAll .clear();
239 
240  True_Bck_Mode .clear();
241  True_Bck_VertX .clear();
242  True_Bck_VertY .clear();
243  True_Bck_VertZ .clear();
244  True_Bck_Time .clear();
245  True_Bck_Energy .clear();
246  True_Bck_PDG .clear();
247  True_Bck_ID .clear();
248 
249 
250 }
251 
252 
254 {
256 
257 
258  fAnaTree = tfs->make<TTree>("OpHitDumpTree","OpHitDumper analysis tree");
259 
260  fAnaTree->Branch("Run" , &Run , "Run/I" );
261  fAnaTree->Branch("SubRun" , &SubRun , "SubRun/I" );
262  fAnaTree->Branch("Event" , &Event , "Event/I" );
263 
264 
265  if (fSavePDS) {
266  fAnaTree->Branch("PDS_OpHit_OpChannel" , &PDS_OpHit_OpChannel );
267  fAnaTree->Branch("PDS_OpHit_X" , &PDS_OpHit_X );
268  fAnaTree->Branch("PDS_OpHit_Y" , &PDS_OpHit_Y );
269  fAnaTree->Branch("PDS_OpHit_Z" , &PDS_OpHit_Z );
270  fAnaTree->Branch("PDS_OpHit_PeakTimeAbs" , &PDS_OpHit_PeakTimeAbs );
271  fAnaTree->Branch("PDS_OpHit_PeakTime" , &PDS_OpHit_PeakTime );
272  fAnaTree->Branch("PDS_OpHit_Frame" , &PDS_OpHit_Frame );
273  fAnaTree->Branch("PDS_OpHit_Width" , &PDS_OpHit_Width );
274  fAnaTree->Branch("PDS_OpHit_Area" , &PDS_OpHit_Area );
275  fAnaTree->Branch("PDS_OpHit_Amplitude" , &PDS_OpHit_Amplitude );
276  fAnaTree->Branch("PDS_OpHit_PE" , &PDS_OpHit_PE );
277  fAnaTree->Branch("PDS_OpHit_FastToTotal" , &PDS_OpHit_FastToTotal );
278  fAnaTree->Branch("PDS_OpHit_True_GenType" , &PDS_OpHit_True_GenType );
279  fAnaTree->Branch("PDS_OpHit_True_Energy" , &PDS_OpHit_True_Energy );
280  fAnaTree->Branch("PDS_OpHit_True_TrackID" , &PDS_OpHit_True_TrackID );
281  fAnaTree->Branch("PDS_OpHit_True_GenTypeAll", &PDS_OpHit_True_GenTypeAll);
282  fAnaTree->Branch("PDS_OpHit_True_EnergyAll" , &PDS_OpHit_True_EnergyAll );
283  fAnaTree->Branch("PDS_OpHit_True_TrackIDAll", &PDS_OpHit_True_TrackIDAll);
284  fAnaTree->Branch("PDS_OpHit_True_IndexAll" , &PDS_OpHit_True_IndexAll );
285  }
286 
287  fAnaTree->Branch("True_Bck_Mode" , &True_Bck_Mode );
288  fAnaTree->Branch("True_Bck_VertX" , &True_Bck_VertX );
289  fAnaTree->Branch("True_Bck_VertY" , &True_Bck_VertY );
290  fAnaTree->Branch("True_Bck_VertZ" , &True_Bck_VertZ );
291  fAnaTree->Branch("True_Bck_Time" , &True_Bck_Time );
292  fAnaTree->Branch("True_Bck_Energy" , &True_Bck_Energy );
293  fAnaTree->Branch("True_Bck_PDG" , &True_Bck_PDG );
294  fAnaTree->Branch("True_Bck_ID" , &True_Bck_ID );
295 
296 
297 
298  fAnaTree->Branch("TotGen_Sign", &TotGen_Sign, "TotGen_Sign/I");
299  fAnaTree->Branch("TotGen_Ar39", &TotGen_Ar39, "TotGen_Ar39/I");
300  fAnaTree->Branch("TotGen_Neut", &TotGen_Neut, "TotGen_Neut/I");
301  fAnaTree->Branch("TotGen_Kryp", &TotGen_Kryp, "TotGen_Kryp/I");
302  fAnaTree->Branch("TotGen_Rdon", &TotGen_Rdon, "TotGen_Rdon/I");
303  fAnaTree->Branch("TotGen_Ar42", &TotGen_Ar42, "TotGen_Ar42/I");
304 
305 
306 }
307 
308 
310 {
311  ResetVariables();
312 
313  Run = evt.run();
314  SubRun = evt.subRun();
315  Event = evt.event();
316 
317  //GET INFORMATION ABOUT THE DETECTOR'S GEOMETRY.
318  auto const* geo = lar::providerFrom<geo::Geometry>();
319 
320  //LIFT OUT THE SignEY PARTICLES.
321  //auto SignTrue = evt.getValidHandle<std::vector<simb::MCTruth> >(fSIGNLabel);
322 
323  auto SignTrue = evt.getHandle< std::vector<simb::MCTruth> >(fSIGNLabel);
324  if (SignTrue) {
325  art::FindManyP<simb::MCParticle> SignAssn(SignTrue,evt,fGEANTLabel);
326 
327  FillMyMaps( SignParts, SignAssn, SignTrue );
328  TotGen_Sign = SignParts.size();
329  std::cout << "Found " << TotGen_Sign << " signal tracks" << std::endl;
330  if(fSaveTruth) FillTruth(SignAssn , SignTrue , kSign );
331  }
332 
333  auto Ar39True = evt.getHandle< std::vector<simb::MCTruth> >(fAr39Label);
334  if (Ar39True) {
335  art::FindManyP<simb::MCParticle> Ar39Assn(Ar39True,evt,fGEANTLabel);
336  FillMyMaps( Ar39Parts, Ar39Assn, Ar39True );
337  TotGen_Ar39 = Ar39Parts.size();
338  if(fSaveTruth) FillTruth(Ar39Assn, Ar39True, kAr39);
339  }
340 
341  auto NeutTrue = evt.getHandle< std::vector<simb::MCTruth> >(fNeutLabel);
342  if (NeutTrue) {
343  art::FindManyP<simb::MCParticle> NeutAssn(NeutTrue,evt,fGEANTLabel);
344  FillMyMaps( NeutParts, NeutAssn, NeutTrue );
345  TotGen_Neut = NeutParts.size();
346  if(fSaveTruth) FillTruth(NeutAssn, NeutTrue, kNeut);
347  }
348 
349  auto KrypTrue = evt.getHandle< std::vector<simb::MCTruth> >(fKrypLabel);
350  if (KrypTrue) {
351  art::FindManyP<simb::MCParticle> KrypAssn(KrypTrue,evt,fGEANTLabel);
352  FillMyMaps( KrypParts, KrypAssn, KrypTrue );
353  TotGen_Kryp = KrypParts.size();
354  if(fSaveTruth) FillTruth(KrypAssn, KrypTrue, kKryp);
355  }
356 
357  auto RdonTrue = evt.getHandle< std::vector<simb::MCTruth> >(fRdonLabel);
358  if (RdonTrue) {
359  art::FindManyP<simb::MCParticle> RdonAssn(RdonTrue,evt,fGEANTLabel);
360  FillMyMaps( RdonParts, RdonAssn, RdonTrue );
361  TotGen_Rdon = RdonParts.size();
362  if(fSaveTruth) FillTruth(RdonAssn, RdonTrue, kRdon);
363  }
364 
365  auto Ar42True = evt.getHandle< std::vector<simb::MCTruth> >(fAr42Label);
366  if (Ar42True) {
367  art::FindManyP<simb::MCParticle> Ar42Assn(Ar42True,evt,fGEANTLabel);
368  FillMyMaps( Ar42Parts, Ar42Assn, Ar42True );
369  TotGen_Ar42 = Ar42Parts.size();
370  if(fSaveTruth) FillTruth(Ar42Assn, Ar42True, kAr42);
371  }
372 
373  std::vector<simb::MCParticle> allTruthParts;
374  for(auto& it: SignParts)
375  allTruthParts.push_back(it.second);
376  for(auto& it: Ar39Parts)
377  allTruthParts.push_back(it.second);
378  for(auto& it: NeutParts)
379  allTruthParts.push_back(it.second);
380  for(auto& it: KrypParts)
381  allTruthParts.push_back(it.second);
382  for(auto& it: RdonParts)
383  allTruthParts.push_back(it.second);
384  for(auto& it: Ar42Parts)
385  allTruthParts.push_back(it.second);
386 
387  std::map<PType, std::map< int, simb::MCParticle >&> PTypeToMap{
388  {kSign, SignParts},
389  {kAr39, Ar39Parts},
390  {kAr42, Ar42Parts},
391  {kNeut, NeutParts},
392  {kKryp, KrypParts},
393  {kRdon, RdonParts}
394  };
395 
396  std::map<PType,std::set<int>> PTypeToTrackID;
397 
398  for(auto const& it : PTypeToMap){
399  const PType p=it.first;
400  auto const& m=it.second;
401  for(auto const& it2 : m){
402  trkIDToPType.insert(std::make_pair(it2.first, p)); //std::cout << "Inserting trackID " << it2.first <<" to PType " << p << " inn trkIDToPType map. " << std::endl;
403  PTypeToTrackID[p].insert(it2.first);
404  }
405  }
406 
407  std::cout << "THE EVENTS NUMBER IS: " << Event << std::endl;
408 
409  if (fSavePDS) {
410 
411  std::vector<art::Ptr<recob::OpHit> > ophitlist;
412  std::map<PType, std::vector<art::Ptr<recob::OpHit> > > map_of_ophit;
413 
414  auto OpHitHandle = evt.getHandle< std::vector< recob::OpHit > >(fOpHitModuleLabel);
415  if (OpHitHandle) {
416  art::fill_ptr_vector(ophitlist, OpHitHandle);
417 
418  std::cout << "There are " << ophitlist.size() << " optical hits in the event." << std::endl;
419 
420  for(size_t i = 0; i < ophitlist.size(); ++i)
421  {
422 
423  std::vector<sim::TrackSDP> vec_tracksdp = pbt_serv->OpHitToTrackSDPs(ophitlist.at(i));
424  PType gen = kUnknown;
425 // std::cout << "Analyizing hit " << i << " " << vec_tracksdp.size()<< std::endl;
426 
427 
428  std::sort(vec_tracksdp.begin(), vec_tracksdp.end(),
429  [](const sim::TrackSDP& a, const sim::TrackSDP& b) -> bool { return a.energyFrac > b.energyFrac; });
430 
431  for (size_t iSDP=0; iSDP<vec_tracksdp.size(); ++iSDP) {
432  PDS_OpHit_True_TrackIDAll.push_back(vec_tracksdp[iSDP].trackID);
433  PDS_OpHit_True_GenTypeAll.push_back(WhichParType(vec_tracksdp[iSDP].trackID));
434  PDS_OpHit_True_EnergyAll .push_back(vec_tracksdp[iSDP].energy);
435  PDS_OpHit_True_IndexAll .push_back((int)i);
436  }
437 
438  if (vec_tracksdp.size()>0){
439 
440  //std::cout << "track assing to this hit " << vec_tracksdp[0].trackID << " " <<WhichParType(vec_tracksdp[0].trackID) << " " << pi_serv->TrackIdToParticle(vec_tracksdp[0].trackID).TrackId()<< std::endl;
441  //int MainTrID = vec_tracksdp[0].trackID;
442  PDS_OpHit_True_TrackID.push_back(pi_serv->TrackIdToParticle(vec_tracksdp[0].trackID).TrackId());
443  gen = WhichParType(pi_serv->TrackIdToParticle(vec_tracksdp[0].trackID).TrackId());
444  PDS_OpHit_True_GenType.push_back(gen);
445  PDS_OpHit_True_Energy .push_back(vec_tracksdp[0].energy);
446  } else {
447 
448  //std::cout << "NO track assing to this hit!!!! " << std::endl;
449  PDS_OpHit_True_TrackID.push_back(-1);
450  PDS_OpHit_True_GenType.push_back(kUnknown);
451  PDS_OpHit_True_Energy .push_back(-1);
452  }
453 
454  map_of_ophit[gen].push_back(ophitlist.at(i));
455 
456  double xyz_optdet[3]={0,0,0};
457  double xyz_world [3]={0,0,0};
458 
459  geo->OpDetGeoFromOpChannel(ophitlist[i]->OpChannel()).LocalToWorld(xyz_optdet,xyz_world);
460  PDS_OpHit_OpChannel .push_back(ophitlist[i]->OpChannel());
461  PDS_OpHit_X .push_back(xyz_world[0]);
462  PDS_OpHit_Y .push_back(xyz_world[1]);
463  PDS_OpHit_Z .push_back(xyz_world[2]);
464  PDS_OpHit_PeakTimeAbs .push_back(ophitlist[i]->PeakTimeAbs());
465  PDS_OpHit_PeakTime .push_back(ophitlist[i]->PeakTime());
466  PDS_OpHit_Frame .push_back(ophitlist[i]->Frame());
467  PDS_OpHit_Width .push_back(ophitlist[i]->Width());
468  PDS_OpHit_Area .push_back(ophitlist[i]->Area());
469  PDS_OpHit_Amplitude .push_back(ophitlist[i]->Amplitude());
470  PDS_OpHit_PE .push_back(ophitlist[i]->PE());
471  PDS_OpHit_FastToTotal .push_back(ophitlist[i]->FastToTotal());
472  }
473  std::cerr << "Total of:" << std::endl;
474  std::cerr << " - Othe : " << map_of_ophit[kUnknown].size() << " opt hits" << std::endl;
475  std::cerr << " - Sign : " << TotGen_Sign << " true parts\t| " << map_of_ophit[kSign].size() << " opt hits" << std::endl;
476  std::cerr << " - Ar39 : " << TotGen_Ar39 << " true parts\t| " << map_of_ophit[kAr39].size() << " opt hits" << std::endl;
477  std::cerr << " - Neut : " << TotGen_Neut << " true parts\t| " << map_of_ophit[kNeut].size() << " opt hits" << std::endl;
478  std::cerr << " - Kryp : " << TotGen_Kryp << " true parts\t| " << map_of_ophit[kKryp].size() << " opt hits" << std::endl;
479  std::cerr << " - Rdon : " << TotGen_Rdon << " true parts\t| " << map_of_ophit[kRdon].size() << " opt hits" << std::endl;
480  std::cerr << " - Ar42 : " << TotGen_Ar42 << " true parts\t| " << map_of_ophit[kAr42].size() << " opt hits" << std::endl;
481  }
482  else {
483  mf::LogWarning("DualPhaseOpHitDumperModule") << "Requested to save optical hits, but cannot load any ophits";
484  }
485  }
486 
487 
488 
489 
490  std::cout << "True_Bck_Mode.size() " << True_Bck_Mode.size() << std::endl;
491  fAnaTree->Fill();
492 }
493 
494 void DualPhaseOpHitDumper::FillTruth(const art::FindManyP<simb::MCParticle> Assn,
495  const art::Handle<std::vector<simb::MCTruth>>& Hand,
496  const PType type) {
497 
498  for(size_t i1=0; i1<Hand->size(); ++i1) {
499  for ( size_t i2=0; i2 < Assn.at(i1).size(); ++i2 ) {
500  const simb::MCParticle ThisPar = (*Assn.at(i1).at(i2));
501  True_Bck_Mode .push_back(type);
502  True_Bck_VertX .push_back(ThisPar.Vx());
503  True_Bck_VertY .push_back(ThisPar.Vy());
504  True_Bck_VertZ .push_back(ThisPar.Vz());
505  True_Bck_Time .push_back(ThisPar.T());
506  True_Bck_Energy.push_back(ThisPar.E());
507  True_Bck_PDG .push_back(ThisPar.PdgCode());
508  True_Bck_ID .push_back(ThisPar.TrackId());
509  }
510  }
511 }
512 
513 
514 // auto SignTrue = evt.getHandle< std::vector<simb::MCTruth> >(fSIGNLabel);
515 // if (SignTrue) {
516 // art::FindManyP<simb::MCParticle> SignAssn(SignTrue,evt,fGEANTLabel);
517 
518 
519 void DualPhaseOpHitDumper::FillMyMaps(std::map< int, simb::MCParticle> &MyMap,
520  art::FindManyP<simb::MCParticle> Assn,
521  art::Handle< std::vector<simb::MCTruth> > Hand,
522  std::map<int, int>* indexMap) {
523  for ( size_t L1=0; L1 < Hand->size(); ++L1 ) {
524  //std::cout << "Eve particle " << L1 << " " << Hand->at(L1).NParticles() << std::endl;
525  //for(int i=0;i<Hand->at(L1).NParticles();i++) std::cout << Hand->at(L1).GetParticle(i).TrackId() << " " << Hand->at(L1).GetParticle(i).PdgCode() << std::endl;
526  for ( size_t L2=0; L2 < Assn.at(L1).size(); ++L2 ) {
527  const simb::MCParticle ThisPar = (*Assn.at(L1).at(L2));
528  MyMap[ThisPar.TrackId()] = ThisPar; //std::cout << ThisPar.TrackId() << "trackID added to MyMap, PDG: " << ThisPar.PdgCode() <<std::endl;
529  if(indexMap) indexMap->insert({ThisPar.TrackId(), L1});
530  }
531  }
532  return;
533 }
534 
535 
537 {
538  PType ThisPType = kUnknown;
539  auto const& it=trkIDToPType.find(TrID);
540  if(it!=trkIDToPType.end()){
541  ThisPType=it->second;
542  }
543  return ThisPType;
544 
545 }
546 
547 
548 bool DualPhaseOpHitDumper::InMyMap( int TrID, std::map< int, simb::MCParticle> ParMap )
549 {
551  ParIt = ParMap.find( TrID );
552  if ( ParIt != ParMap.end() ) {
553  return true;
554  } else
555  return false;
556 }
557 
558 //......................................................
559 
560 
561 
563 {
564  std::cout << firstCatch << " " << secondCatch << " " << thirdCatch << std::endl;
565 }
566 
double E(const int i=0) const
Definition: MCParticle.h:233
std::string const & processName() const
Definition: Observer.cc:68
std::vector< double > True_Bck_VertX
intermediate_table::iterator iterator
Index OpChannel(Index detNum, Index channel)
std::map< int, simb::MCParticle > RdonParts
std::vector< double > True_Bck_VertY
int PdgCode() const
Definition: MCParticle.h:212
art::ServiceHandle< cheat::ParticleInventoryService > pi_serv
std::map< PType, std::string > PTypeString
std::vector< double > PDS_OpHit_Width
EventNumber_t event() const
Definition: DataViewImpl.cc:85
std::map< int, const simb::MCParticle * > truthmap
std::vector< int > PDS_OpHit_OpChannel
std::vector< double > PDS_OpHit_Z
std::vector< int > PDS_OpHit_True_GenType
std::vector< double > PDS_OpHit_PeakTime
Handle< PROD > getHandle(SelectorBase const &) const
Definition: DataViewImpl.h:382
std::string string
Definition: nybbler.cc:12
void FillTruth(const art::FindManyP< simb::MCParticle > Assn, const art::Handle< std::vector< simb::MCTruth >> &Hand, const PType type)
std::vector< unsigned short > PDS_OpHit_Frame
std::vector< double > PDS_OpHit_True_Energy
DualPhaseOpHitDumper(fhicl::ParameterSet const &p)
double Width(Resonance_t res)
resonance width (GeV)
std::vector< double > True_Bck_VertZ
std::map< int, simb::MCParticle > Ar42Parts
std::vector< double > PDS_OpHit_Amplitude
uint8_t channel
Definition: CRTFragment.hh:201
std::vector< double > PDS_OpHit_Area
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
std::map< int, simb::MCParticle > NeutParts
art framework interface to geometry description
int TrackId() const
Definition: MCParticle.h:210
art::ServiceHandle< cheat::PhotonBackTrackerService > pbt_serv
void analyze(art::Event const &evt) override
std::vector< int > PDS_OpHit_True_IndexAll
art::ServiceHandle< cheat::BackTrackerService > bt_serv
simb::MCParticle TrackIdToParticle(int const id) const
std::vector< int > PDS_OpHit_True_Index
std::vector< double > True_Bck_Energy
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
std::map< int, simb::MCParticle > SignParts
Local-to-world transformations with LArSoft geometry vectors.
std::vector< int > PDS_OpHit_True_TrackIDAll
std::vector< double > PDS_OpHit_FastToTotal
const double a
T get(std::string const &key) const
Definition: ParameterSet.h:271
float energyFrac
fraction of OpHit energy from the particle with this trackID
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &opHit_P)
void SaveNeighbourADC(int channel, art::Handle< std::vector< raw::RawDigit > >rawDigitsVecHandle, std::set< int > badChannels, recob::Hit const &hits)
double T(const int i=0) const
Definition: MCParticle.h:224
art::ServiceHandle< geo::Geometry > geo
std::vector< double > PDS_OpHit_True_EnergyAll
p
Definition: test.py:223
SubRunNumber_t subRun() const
Definition: DataViewImpl.cc:78
gen
Definition: demo.py:24
bool InMyMap(int TrID, std::map< int, simb::MCParticle > ParMap)
RunNumber_t run() const
Definition: DataViewImpl.cc:71
void reconfigure(fhicl::ParameterSet const &p)
Encapsulate the geometry of a wire.
Ionization photons from a Geant4 track.
double Vx(const int i=0) const
Definition: MCParticle.h:221
Declaration of signal hit object.
std::vector< int > PDS_OpHit_True_TrackID
std::vector< double > True_Bck_Time
std::vector< double > PDS_OpHit_PeakTimeAbs
Stores extra MC truth information that is recorded when generating events using a time-dependent supe...
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
void FillMyMaps(std::map< int, simb::MCParticle > &MyMap, art::FindManyP< simb::MCParticle > Assn, art::Handle< std::vector< simb::MCTruth > > Hand, std::map< int, int > *indexMap=nullptr)
double Vz(const int i=0) const
Definition: MCParticle.h:223
static bool * b
Definition: config.cpp:1043
Definitions of geometry vector data types.
Declaration of basic channel signal object.
std::vector< double > PDS_OpHit_PE
std::vector< double > PDS_OpHit_X
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
Tools and modules for checking out the basics of the Monte Carlo.
TCEvent evt
Definition: DataStructs.cxx:7
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
DualPhaseOpHitDumper & operator=(DualPhaseOpHitDumper const &)=delete
std::map< int, int > trkIDToMarleyIndex
LArSoft geometry interface.
Definition: ChannelGeo.h:16
std::map< int, simb::MCParticle > KrypParts
std::map< int, simb::MCParticle > Ar39Parts
double Vy(const int i=0) const
Definition: MCParticle.h:222
std::vector< int > PDS_OpHit_True_GenTypeAll
QTextStream & endl(QTextStream &s)
std::map< int, PType > trkIDToPType
std::vector< double > PDS_OpHit_Y