Public Member Functions | Private Member Functions | Private Attributes | List of all members
DualPhaseOpHitDumper Class Reference
Inheritance diagram for DualPhaseOpHitDumper:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 DualPhaseOpHitDumper (fhicl::ParameterSet const &p)
 
 DualPhaseOpHitDumper (DualPhaseOpHitDumper const &)=delete
 
 DualPhaseOpHitDumper (DualPhaseOpHitDumper &&)=delete
 
DualPhaseOpHitDumperoperator= (DualPhaseOpHitDumper const &)=delete
 
DualPhaseOpHitDumperoperator= (DualPhaseOpHitDumper &&)=delete
 
void analyze (art::Event const &evt) override
 
void reconfigure (fhicl::ParameterSet const &p)
 
void beginJob () override
 
void endJob () override
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

void ResetVariables ()
 
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)
 
PType WhichParType (int TrID)
 
bool InMyMap (int TrID, std::map< int, simb::MCParticle > ParMap)
 
void FillTruth (const art::FindManyP< simb::MCParticle > Assn, const art::Handle< std::vector< simb::MCTruth >> &Hand, const PType type)
 
void SaveNeighbourADC (int channel, art::Handle< std::vector< raw::RawDigit > >rawDigitsVecHandle, std::set< int > badChannels, recob::Hit const &hits)
 

Private Attributes

int firstCatch
 
int secondCatch
 
int thirdCatch
 
std::string fOpHitModuleLabel
 
std::string fGEANTLabel
 
std::string fSIGNLabel
 
std::map< int, simb::MCParticleSignParts
 
std::string fAr39Label
 
std::map< int, simb::MCParticleAr39Parts
 
std::string fNeutLabel
 
std::map< int, simb::MCParticleNeutParts
 
std::string fKrypLabel
 
std::map< int, simb::MCParticleKrypParts
 
std::string fRdonLabel
 
std::map< int, simb::MCParticleRdonParts
 
std::string fAr42Label
 
std::map< int, simb::MCParticleAr42Parts
 
std::map< int, const simb::MCParticle * > truthmap
 
std::map< int, int > trkIDToMarleyIndex
 
std::map< int, PTypetrkIDToPType
 
bool fSaveTruth
 
bool fSavePDS
 
TTree * fAnaTree
 
int Run
 
int SubRun
 
int Event
 
std::vector< int > PDS_OpHit_OpChannel
 
std::vector< double > PDS_OpHit_X
 
std::vector< double > PDS_OpHit_Y
 
std::vector< double > PDS_OpHit_Z
 
std::vector< double > PDS_OpHit_PeakTimeAbs
 
std::vector< double > PDS_OpHit_PeakTime
 
std::vector< unsigned short > PDS_OpHit_Frame
 
std::vector< double > PDS_OpHit_Width
 
std::vector< double > PDS_OpHit_Area
 
std::vector< double > PDS_OpHit_Amplitude
 
std::vector< double > PDS_OpHit_PE
 
std::vector< double > PDS_OpHit_FastToTotal
 
std::vector< int > PDS_OpHit_True_GenType
 
std::vector< int > PDS_OpHit_True_Index
 
std::vector< double > PDS_OpHit_True_Energy
 
std::vector< int > PDS_OpHit_True_TrackID
 
std::vector< int > PDS_OpHit_True_GenTypeAll
 
std::vector< double > PDS_OpHit_True_EnergyAll
 
std::vector< int > PDS_OpHit_True_TrackIDAll
 
std::vector< int > PDS_OpHit_True_IndexAll
 
std::vector< int > True_Bck_Mode
 
std::vector< double > True_Bck_VertX
 
std::vector< double > True_Bck_VertY
 
std::vector< double > True_Bck_VertZ
 
std::vector< double > True_Bck_Time
 
std::vector< double > True_Bck_Energy
 
std::vector< int > True_Bck_PDG
 
std::vector< int > True_Bck_ID
 
int TotGen_Sign
 
int TotGen_Ar39
 
int TotGen_Neut
 
int TotGen_Kryp
 
int TotGen_Rdon
 
int TotGen_Ar42
 
art::ServiceHandle< geo::Geometrygeo
 
art::ServiceHandle< cheat::BackTrackerServicebt_serv
 
art::ServiceHandle< cheat::ParticleInventoryServicepi_serv
 
art::ServiceHandle< cheat::PhotonBackTrackerServicepbt_serv
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 66 of file DualPhaseOpHitDumper_module.cc.

Constructor & Destructor Documentation

DualPhaseOpHitDumper::DualPhaseOpHitDumper ( fhicl::ParameterSet const &  p)
explicit

Definition at line 174 of file DualPhaseOpHitDumper_module.cc.

174  :EDAnalyzer(p)
175 {
176  this->reconfigure(p);
177 }
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
p
Definition: test.py:223
void reconfigure(fhicl::ParameterSet const &p)
DualPhaseOpHitDumper::DualPhaseOpHitDumper ( DualPhaseOpHitDumper const &  )
delete
DualPhaseOpHitDumper::DualPhaseOpHitDumper ( DualPhaseOpHitDumper &&  )
delete

Member Function Documentation

void DualPhaseOpHitDumper::analyze ( art::Event const &  evt)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 309 of file DualPhaseOpHitDumper_module.cc.

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 }
Index OpChannel(Index detNum, Index channel)
std::map< int, simb::MCParticle > RdonParts
art::ServiceHandle< cheat::ParticleInventoryService > pi_serv
std::vector< double > PDS_OpHit_Width
unsigned int event
Definition: DataStructs.h:636
std::vector< int > PDS_OpHit_OpChannel
unsigned int run
Definition: DataStructs.h:637
std::vector< double > PDS_OpHit_Z
std::vector< int > PDS_OpHit_True_GenType
std::vector< double > PDS_OpHit_PeakTime
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
double Width(Resonance_t res)
resonance width (GeV)
std::map< int, simb::MCParticle > Ar42Parts
std::vector< double > PDS_OpHit_Amplitude
std::vector< double > PDS_OpHit_Area
std::map< int, simb::MCParticle > NeutParts
int TrackId() const
Definition: MCParticle.h:210
art::ServiceHandle< cheat::PhotonBackTrackerService > pbt_serv
std::vector< int > PDS_OpHit_True_IndexAll
simb::MCParticle TrackIdToParticle(int const id) const
std::map< int, simb::MCParticle > SignParts
std::vector< int > PDS_OpHit_True_TrackIDAll
std::vector< double > PDS_OpHit_FastToTotal
const double a
float energyFrac
fraction of OpHit energy from the particle with this trackID
std::vector< sim::TrackSDP > OpHitToTrackSDPs(art::Ptr< recob::OpHit > const &opHit_P)
std::vector< double > PDS_OpHit_True_EnergyAll
p
Definition: test.py:223
gen
Definition: demo.py:24
Ionization photons from a Geant4 track.
std::vector< int > PDS_OpHit_True_TrackID
std::vector< double > PDS_OpHit_PeakTimeAbs
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)
static bool * b
Definition: config.cpp:1043
unsigned int subRun
Definition: DataStructs.h:638
std::vector< double > PDS_OpHit_PE
std::vector< double > PDS_OpHit_X
TCEvent evt
Definition: DataStructs.cxx:7
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
LArSoft geometry interface.
Definition: ChannelGeo.h:16
std::map< int, simb::MCParticle > KrypParts
std::map< int, simb::MCParticle > Ar39Parts
std::vector< int > PDS_OpHit_True_GenTypeAll
QTextStream & endl(QTextStream &s)
std::map< int, PType > trkIDToPType
std::vector< double > PDS_OpHit_Y
void DualPhaseOpHitDumper::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 253 of file DualPhaseOpHitDumper_module.cc.

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 }
std::vector< double > True_Bck_VertX
std::vector< double > True_Bck_VertY
std::vector< double > PDS_OpHit_Width
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
std::vector< unsigned short > PDS_OpHit_Frame
std::vector< double > PDS_OpHit_True_Energy
std::vector< double > True_Bck_VertZ
std::vector< double > PDS_OpHit_Amplitude
std::vector< double > PDS_OpHit_Area
std::vector< int > PDS_OpHit_True_IndexAll
std::vector< double > True_Bck_Energy
std::vector< int > PDS_OpHit_True_TrackIDAll
std::vector< double > PDS_OpHit_FastToTotal
std::vector< double > PDS_OpHit_True_EnergyAll
std::vector< int > PDS_OpHit_True_TrackID
std::vector< double > True_Bck_Time
std::vector< double > PDS_OpHit_PeakTimeAbs
std::vector< double > PDS_OpHit_PE
std::vector< double > PDS_OpHit_X
std::vector< int > PDS_OpHit_True_GenTypeAll
std::vector< double > PDS_OpHit_Y
void DualPhaseOpHitDumper::endJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 562 of file DualPhaseOpHitDumper_module.cc.

563 {
564  std::cout << firstCatch << " " << secondCatch << " " << thirdCatch << std::endl;
565 }
QTextStream & endl(QTextStream &s)
void DualPhaseOpHitDumper::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 
)
private

Definition at line 519 of file DualPhaseOpHitDumper_module.cc.

522  {
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 }
int TrackId() const
Definition: MCParticle.h:210
void DualPhaseOpHitDumper::FillTruth ( const art::FindManyP< simb::MCParticle Assn,
const art::Handle< std::vector< simb::MCTruth >> &  Hand,
const PType  type 
)
private

Definition at line 494 of file DualPhaseOpHitDumper_module.cc.

496  {
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 }
double E(const int i=0) const
Definition: MCParticle.h:233
std::vector< double > True_Bck_VertX
std::vector< double > True_Bck_VertY
int PdgCode() const
Definition: MCParticle.h:212
std::vector< double > True_Bck_VertZ
int TrackId() const
Definition: MCParticle.h:210
std::vector< double > True_Bck_Energy
double T(const int i=0) const
Definition: MCParticle.h:224
double Vx(const int i=0) const
Definition: MCParticle.h:221
std::vector< double > True_Bck_Time
double Vz(const int i=0) const
Definition: MCParticle.h:223
double Vy(const int i=0) const
Definition: MCParticle.h:222
bool DualPhaseOpHitDumper::InMyMap ( int  TrID,
std::map< int, simb::MCParticle ParMap 
)
private

Definition at line 548 of file DualPhaseOpHitDumper_module.cc.

549 {
551  ParIt = ParMap.find( TrID );
552  if ( ParIt != ParMap.end() ) {
553  return true;
554  } else
555  return false;
556 }
intermediate_table::iterator iterator
DualPhaseOpHitDumper& DualPhaseOpHitDumper::operator= ( DualPhaseOpHitDumper const &  )
delete
DualPhaseOpHitDumper& DualPhaseOpHitDumper::operator= ( DualPhaseOpHitDumper &&  )
delete
void DualPhaseOpHitDumper::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 180 of file DualPhaseOpHitDumper_module.cc.

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 }
std::string const & processName() const
Definition: Observer.cc:68
std::string string
Definition: nybbler.cc:12
p
Definition: test.py:223
QTextStream & endl(QTextStream &s)
void DualPhaseOpHitDumper::ResetVariables ( )
private

Definition at line 204 of file DualPhaseOpHitDumper_module.cc.

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 }
std::vector< double > True_Bck_VertX
std::map< int, simb::MCParticle > RdonParts
std::vector< double > True_Bck_VertY
std::vector< double > PDS_OpHit_Width
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
std::vector< unsigned short > PDS_OpHit_Frame
std::vector< double > PDS_OpHit_True_Energy
std::vector< double > True_Bck_VertZ
std::map< int, simb::MCParticle > Ar42Parts
std::vector< double > PDS_OpHit_Amplitude
std::vector< double > PDS_OpHit_Area
std::map< int, simb::MCParticle > NeutParts
std::vector< int > PDS_OpHit_True_IndexAll
std::vector< int > PDS_OpHit_True_Index
std::vector< double > True_Bck_Energy
std::map< int, simb::MCParticle > SignParts
std::vector< int > PDS_OpHit_True_TrackIDAll
std::vector< double > PDS_OpHit_FastToTotal
std::vector< double > PDS_OpHit_True_EnergyAll
std::vector< int > PDS_OpHit_True_TrackID
std::vector< double > True_Bck_Time
std::vector< double > PDS_OpHit_PeakTimeAbs
std::vector< double > PDS_OpHit_PE
std::vector< double > PDS_OpHit_X
std::map< int, simb::MCParticle > KrypParts
std::map< int, simb::MCParticle > Ar39Parts
std::vector< int > PDS_OpHit_True_GenTypeAll
std::map< int, PType > trkIDToPType
std::vector< double > PDS_OpHit_Y
void DualPhaseOpHitDumper::SaveNeighbourADC ( int  channel,
art::Handle< std::vector< raw::RawDigit > >  rawDigitsVecHandle,
std::set< int >  badChannels,
recob::Hit const &  hits 
)
private
PType DualPhaseOpHitDumper::WhichParType ( int  TrID)
private

Definition at line 536 of file DualPhaseOpHitDumper_module.cc.

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 }
std::map< int, PType > trkIDToPType

Member Data Documentation

std::map< int, simb::MCParticle > DualPhaseOpHitDumper::Ar39Parts
private

Definition at line 108 of file DualPhaseOpHitDumper_module.cc.

std::map< int, simb::MCParticle > DualPhaseOpHitDumper::Ar42Parts
private

Definition at line 112 of file DualPhaseOpHitDumper_module.cc.

art::ServiceHandle<cheat::BackTrackerService> DualPhaseOpHitDumper::bt_serv
private

Definition at line 168 of file DualPhaseOpHitDumper_module.cc.

int DualPhaseOpHitDumper::Event
private

Definition at line 127 of file DualPhaseOpHitDumper_module.cc.

TTree* DualPhaseOpHitDumper::fAnaTree
private

Definition at line 123 of file DualPhaseOpHitDumper_module.cc.

std::string DualPhaseOpHitDumper::fAr39Label
private

Definition at line 108 of file DualPhaseOpHitDumper_module.cc.

std::string DualPhaseOpHitDumper::fAr42Label
private

Definition at line 112 of file DualPhaseOpHitDumper_module.cc.

std::string DualPhaseOpHitDumper::fGEANTLabel
private

Definition at line 106 of file DualPhaseOpHitDumper_module.cc.

int DualPhaseOpHitDumper::firstCatch
private

Definition at line 100 of file DualPhaseOpHitDumper_module.cc.

std::string DualPhaseOpHitDumper::fKrypLabel
private

Definition at line 110 of file DualPhaseOpHitDumper_module.cc.

std::string DualPhaseOpHitDumper::fNeutLabel
private

Definition at line 109 of file DualPhaseOpHitDumper_module.cc.

std::string DualPhaseOpHitDumper::fOpHitModuleLabel
private

Definition at line 104 of file DualPhaseOpHitDumper_module.cc.

std::string DualPhaseOpHitDumper::fRdonLabel
private

Definition at line 111 of file DualPhaseOpHitDumper_module.cc.

bool DualPhaseOpHitDumper::fSavePDS
private

Definition at line 121 of file DualPhaseOpHitDumper_module.cc.

bool DualPhaseOpHitDumper::fSaveTruth
private

Definition at line 120 of file DualPhaseOpHitDumper_module.cc.

std::string DualPhaseOpHitDumper::fSIGNLabel
private

Definition at line 107 of file DualPhaseOpHitDumper_module.cc.

art::ServiceHandle<geo::Geometry> DualPhaseOpHitDumper::geo
private

Definition at line 167 of file DualPhaseOpHitDumper_module.cc.

std::map< int, simb::MCParticle > DualPhaseOpHitDumper::KrypParts
private

Definition at line 110 of file DualPhaseOpHitDumper_module.cc.

std::map< int, simb::MCParticle > DualPhaseOpHitDumper::NeutParts
private

Definition at line 109 of file DualPhaseOpHitDumper_module.cc.

art::ServiceHandle<cheat::PhotonBackTrackerService> DualPhaseOpHitDumper::pbt_serv
private

Definition at line 170 of file DualPhaseOpHitDumper_module.cc.

std::vector<double> DualPhaseOpHitDumper::PDS_OpHit_Amplitude
private

Definition at line 138 of file DualPhaseOpHitDumper_module.cc.

std::vector<double> DualPhaseOpHitDumper::PDS_OpHit_Area
private

Definition at line 137 of file DualPhaseOpHitDumper_module.cc.

std::vector<double> DualPhaseOpHitDumper::PDS_OpHit_FastToTotal
private

Definition at line 140 of file DualPhaseOpHitDumper_module.cc.

std::vector<unsigned short> DualPhaseOpHitDumper::PDS_OpHit_Frame
private

Definition at line 135 of file DualPhaseOpHitDumper_module.cc.

std::vector<int> DualPhaseOpHitDumper::PDS_OpHit_OpChannel
private

Definition at line 129 of file DualPhaseOpHitDumper_module.cc.

std::vector<double> DualPhaseOpHitDumper::PDS_OpHit_PE
private

Definition at line 139 of file DualPhaseOpHitDumper_module.cc.

std::vector<double> DualPhaseOpHitDumper::PDS_OpHit_PeakTime
private

Definition at line 134 of file DualPhaseOpHitDumper_module.cc.

std::vector<double> DualPhaseOpHitDumper::PDS_OpHit_PeakTimeAbs
private

Definition at line 133 of file DualPhaseOpHitDumper_module.cc.

std::vector<double> DualPhaseOpHitDumper::PDS_OpHit_True_Energy
private

Definition at line 143 of file DualPhaseOpHitDumper_module.cc.

std::vector<double> DualPhaseOpHitDumper::PDS_OpHit_True_EnergyAll
private

Definition at line 146 of file DualPhaseOpHitDumper_module.cc.

std::vector<int> DualPhaseOpHitDumper::PDS_OpHit_True_GenType
private

Definition at line 141 of file DualPhaseOpHitDumper_module.cc.

std::vector<int> DualPhaseOpHitDumper::PDS_OpHit_True_GenTypeAll
private

Definition at line 145 of file DualPhaseOpHitDumper_module.cc.

std::vector<int> DualPhaseOpHitDumper::PDS_OpHit_True_Index
private

Definition at line 142 of file DualPhaseOpHitDumper_module.cc.

std::vector<int> DualPhaseOpHitDumper::PDS_OpHit_True_IndexAll
private

Definition at line 148 of file DualPhaseOpHitDumper_module.cc.

std::vector<int> DualPhaseOpHitDumper::PDS_OpHit_True_TrackID
private

Definition at line 144 of file DualPhaseOpHitDumper_module.cc.

std::vector<int> DualPhaseOpHitDumper::PDS_OpHit_True_TrackIDAll
private

Definition at line 147 of file DualPhaseOpHitDumper_module.cc.

std::vector<double> DualPhaseOpHitDumper::PDS_OpHit_Width
private

Definition at line 136 of file DualPhaseOpHitDumper_module.cc.

std::vector<double> DualPhaseOpHitDumper::PDS_OpHit_X
private

Definition at line 130 of file DualPhaseOpHitDumper_module.cc.

std::vector<double> DualPhaseOpHitDumper::PDS_OpHit_Y
private

Definition at line 131 of file DualPhaseOpHitDumper_module.cc.

std::vector<double> DualPhaseOpHitDumper::PDS_OpHit_Z
private

Definition at line 132 of file DualPhaseOpHitDumper_module.cc.

art::ServiceHandle<cheat::ParticleInventoryService> DualPhaseOpHitDumper::pi_serv
private

Definition at line 169 of file DualPhaseOpHitDumper_module.cc.

std::map< int, simb::MCParticle > DualPhaseOpHitDumper::RdonParts
private

Definition at line 111 of file DualPhaseOpHitDumper_module.cc.

int DualPhaseOpHitDumper::Run
private

Definition at line 125 of file DualPhaseOpHitDumper_module.cc.

int DualPhaseOpHitDumper::secondCatch
private

Definition at line 101 of file DualPhaseOpHitDumper_module.cc.

std::map< int, simb::MCParticle > DualPhaseOpHitDumper::SignParts
private

Definition at line 107 of file DualPhaseOpHitDumper_module.cc.

int DualPhaseOpHitDumper::SubRun
private

Definition at line 126 of file DualPhaseOpHitDumper_module.cc.

int DualPhaseOpHitDumper::thirdCatch
private

Definition at line 102 of file DualPhaseOpHitDumper_module.cc.

int DualPhaseOpHitDumper::TotGen_Ar39
private

Definition at line 160 of file DualPhaseOpHitDumper_module.cc.

int DualPhaseOpHitDumper::TotGen_Ar42
private

Definition at line 164 of file DualPhaseOpHitDumper_module.cc.

int DualPhaseOpHitDumper::TotGen_Kryp
private

Definition at line 162 of file DualPhaseOpHitDumper_module.cc.

int DualPhaseOpHitDumper::TotGen_Neut
private

Definition at line 161 of file DualPhaseOpHitDumper_module.cc.

int DualPhaseOpHitDumper::TotGen_Rdon
private

Definition at line 163 of file DualPhaseOpHitDumper_module.cc.

int DualPhaseOpHitDumper::TotGen_Sign
private

Definition at line 159 of file DualPhaseOpHitDumper_module.cc.

std::map<int, int> DualPhaseOpHitDumper::trkIDToMarleyIndex
private

Definition at line 115 of file DualPhaseOpHitDumper_module.cc.

std::map<int, PType> DualPhaseOpHitDumper::trkIDToPType
private

Definition at line 118 of file DualPhaseOpHitDumper_module.cc.

std::vector<double> DualPhaseOpHitDumper::True_Bck_Energy
private

Definition at line 155 of file DualPhaseOpHitDumper_module.cc.

std::vector<int> DualPhaseOpHitDumper::True_Bck_ID
private

Definition at line 157 of file DualPhaseOpHitDumper_module.cc.

std::vector<int> DualPhaseOpHitDumper::True_Bck_Mode
private

Definition at line 150 of file DualPhaseOpHitDumper_module.cc.

std::vector<int> DualPhaseOpHitDumper::True_Bck_PDG
private

Definition at line 156 of file DualPhaseOpHitDumper_module.cc.

std::vector<double> DualPhaseOpHitDumper::True_Bck_Time
private

Definition at line 154 of file DualPhaseOpHitDumper_module.cc.

std::vector<double> DualPhaseOpHitDumper::True_Bck_VertX
private

Definition at line 151 of file DualPhaseOpHitDumper_module.cc.

std::vector<double> DualPhaseOpHitDumper::True_Bck_VertY
private

Definition at line 152 of file DualPhaseOpHitDumper_module.cc.

std::vector<double> DualPhaseOpHitDumper::True_Bck_VertZ
private

Definition at line 153 of file DualPhaseOpHitDumper_module.cc.

std::map<int, const simb::MCParticle*> DualPhaseOpHitDumper::truthmap
private

Definition at line 113 of file DualPhaseOpHitDumper_module.cc.


The documentation for this class was generated from the following file: