ProtoDUNEAnalTree_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: ProtoDUNEAnalTree
3 // File: ProtoDUNEAnalTree_module.cc
4 //
5 // Extract protoDUNE useful information, do a first pre-selection and save output to a flat tree
6 //
7 // Some parts are copied from the beam module example
8 //
9 // Georgios Christodoulou - georgios.christodoulou at cern.ch
10 //
11 ////////////////////////////////////////////////////////////////////////
12 
19 #include "art_root_io/TFileService.h"
21 #include "canvas/Persistency/Common/FindManyP.h"
22 #include "fhiclcpp/ParameterSet.h"
24 
40 
43 
44 #include "dune/DuneObj/ProtoDUNEBeamEvent.h"
49 #include "dune/Protodune/singlephase/DataUtils/ProtoDUNEDataUtils.h"
51 
52 // ROOT includes
53 #include "TTree.h"
54 #include "TFile.h"
55 #include "TString.h"
56 #include "TTimeStamp.h"
57 
58 // C++ Includes
59 #include <stdio.h>
60 #include <stdlib.h>
61 #include <fstream>
62 #include <string>
63 #include <sstream>
64 #include <cmath>
65 #include <algorithm>
66 #include <iostream>
67 #include <vector>
68 
69 // Maximum number of beam particles to save
70 const int NMAXDAUGTHERS = 15;
71 const int NMAXTRUTHDAUGTHERS = 30;
72 
73 namespace protoana {
74  class ProtoDUNEAnalTree;
75 }
76 
77 // -----------------------------------------------------------------------------
79 public:
80 
81  explicit ProtoDUNEAnalTree(fhicl::ParameterSet const & p);
82 
83  ProtoDUNEAnalTree(ProtoDUNEAnalTree const &) = delete;
87 
88  virtual void beginJob() override;
89  virtual void endJob() override;
90 
91  void beginRun(const art::Run& run) override;
92 
93  // Required functions.
94  void analyze(art::Event const & evt) override;
95 
96 private:
97 
98  // Helper utility functions
105 
106  // Track momentum algorithm calculates momentum based on track range
108 
109  // Geometry
111 
112  // Initialise tree variables
113  void Initialise();
114 
115  // Fill configuration tree
116  void FillConfigTree();
117 
118  bool FillPrimaryBeamParticle(art::Event const & evt);
119  void FillPrimaryPFParticle(art::Event const & evt,
120  detinfo::DetectorClocksData const& clockData,
121  const recob::PFParticle* particle);
122  void FillPrimaryDaughterPFParticle(art::Event const & evt,
123  detinfo::DetectorClocksData const& clockData,
124  const recob::PFParticle* daughterParticle, int daughterID);
126  detinfo::DetectorClocksData const& clockData,
127  const recob::PFParticle* gdaughterParticle,
128  int daughterID, int gdaughterID);
129 
130  // fcl parameters
139  int fVerbose;
140 
141  // Define configuration tree
142  TTree *fConfigTree;
143 
144  int fNAPAs;
147  int fNTPCs;
149  int fNPlanes;
150  double fActiveTPCBoundsX[2];
151  double fActiveTPCBoundsY[2];
152  double fActiveTPCBoundsZ[2];
153 
154  // Beam track tree
155  TTree *fBeamTrack;
156 
157  // Primary reco track/showers tree
158  TTree *fPandoraBeam;
159 
160  // Reco daughters tree
162 
163  // Reco granddaughters tree
165 
166  int fRun;
167  int fSubRun;
168  int fevent;
169  double fTimeStamp;
171 
172  // Beam track
175  double ftof;
176  double ftof_expElec;
177  double ftof_expMuon;
178  double ftof_expPion;
179  double ftof_expKaon;
180  double ftof_expProt;
181  double ftof_expDeut;
183  double fcerenkovTime[2];
184  double fcerenkovPressure[2];
187  double fbeamtrackPos[4];
188  double fbeamtrackDir[3];
192 
193  // Check what the beam track will do in the detector. The beam track couldn't be the same with the primary beam PFParticle.
206 
215 
232 
249 
250  // Reconstructed tracks/showers
252  double fprimaryVertex[3];
258  double fprimaryPhi;
274  double fprimaryRange[3];
275  double fprimaryTrkPitchC[3];
277  double fprimaryT0;
279 
290  double fprimaryPID_PIDA[3];
291 
319 
336 
353 
354  // Daughters from primary
356  double fdaughterVertex[3];
381 
393 
409 
437 
449 
465 
466 };
467 
468 // -----------------------------------------------------------------------------
470  :
471  EDAnalyzer(p),
472  dataUtil(p.get<fhicl::ParameterSet>("DataUtils")),
473  beamlineUtil(p.get<fhicl::ParameterSet>("BeamLineUtils")),
474  fBeamModuleLabel(p.get< art::InputTag >("BeamModuleLabel")),
475  fCalorimetryTag(p.get<std::string>("CalorimetryTag")),
476  fParticleIDTag(p.get<std::string>("ParticleIDTag")),
477  fTrackerTag(p.get<std::string>("TrackerTag")),
478  fShowerTag(p.get<std::string>("ShowerTag")),
479  fPFParticleTag(p.get<std::string>("PFParticleTag")),
480  fGeneratorTag(p.get<std::string>("GeneratorTag")),
481  fSimulationTag(p.get<std::string>("SimulationTag")),
482  fVerbose(p.get<int>("Verbose"))
483 {
484 
485 }
486 
487 // -----------------------------------------------------------------------------
489 
490 }
491 
492 // -----------------------------------------------------------------------------
494 
495  // Initialise tree parameters
496  Initialise();
497 
498  fRun = evt.run();
499  fSubRun = evt.subRun();
500  fevent = evt.id().event();
501  art::Timestamp ts = evt.time();
502  if (ts.timeHigh() == 0){
503  TTimeStamp ts2(ts.timeLow());
504  fTimeStamp = ts2.AsDouble();
505  }
506  else{
507  TTimeStamp ts2(ts.timeHigh(), ts.timeLow());
508  fTimeStamp = ts2.AsDouble();
509  }
510 
511  // Get number of active fembs
512  if(!evt.isRealData()){
513  for(int k=0; k < 6; k++)
514  fNactivefembs[k] = 20;
515  }
516  else{
517  for(int k=0; k < 6; k++)
519  }
520 
521  // Fill beam track info
522  bool isbeamTriggerEvent = FillPrimaryBeamParticle(evt);
523  // If this is not a beam trigger then do not save
524  if(!isbeamTriggerEvent) return;
525 
526  /*
527  // Now we want to access the output from Pandora. This comes in the form of particle flow objects (recob::PFParticle).
528  // The primary PFParticles are those we want to consider and these PFParticles then have a hierarchy of daughters that
529  // describe the whole interaction of a given primary particle
530  //
531  // / daughter track / grand-daughter track
532  // / /
533  // primary track / /
534  // ---------------- ---- daughter track ----- grand-daughter track
535  // \
536  // /\-
537  // /\\-- daughter shower
538  //
539  // The above primary PFParticle will have links to three daughter particles, two track-like and one shower-like
540  */
541 
542  //trmom.SetMinLength(100);
543 
544  // Get all of the PFParticles, by default from the "pandora" product
545  auto recoParticles = evt.getValidHandle<std::vector<recob::PFParticle>>(fPFParticleTag);
546  //std::cout << "All primary pfParticles = " << pfpUtil.GetNumberPrimaryPFParticle(evt,fPFParticleTag) << std::endl;
547 
548  // We'd like to find the beam particle. Pandora tries to do this for us, so let's use the PFParticle utility
549  // to look for it. Pandora reconstructs slices containing one (or sometimes more) primary PFParticles. These
550  // are tagged as either beam or cosmic for ProtoDUNE. This function automatically considers only those
551  // PFParticles considered as primary
552  std::vector<const recob::PFParticle*> pfParticles = pfpUtil.GetPFParticlesFromBeamSlice(evt,fPFParticleTag);
553  fNpfParticles = pfParticles.size();
554 
555  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService>()->DataFor(evt);
556 
557  // We can now look at these particles
558  for(const recob::PFParticle* particle : pfParticles){
559 
560  FillPrimaryPFParticle(evt, clockData, particle);
561 
562  // Find the particle vertex. We need the tracker tag here because we need to do a bit of
563  // additional work if the PFParticle is track-like to find the vertex.
564  const TVector3 vtx = pfpUtil.GetPFParticleVertex(*particle,evt,fPFParticleTag,fTrackerTag);
565  fprimaryVertex[0] = vtx.X(); fprimaryVertex[1] = vtx.Y(); fprimaryVertex[2] = vtx.Z();
566 
567  // Now we can look for the interaction point of the particle if one exists, i.e where the particle
568  // scatters off an argon nucleus. Shower-like objects won't have an interaction point, so we can
569  // check this by making sure we get a sensible position
570  const TVector3 interactionVtx = pfpUtil.GetPFParticleSecondaryVertex(*particle,evt,fPFParticleTag,fTrackerTag);
571  fdaughterVertex[0] = interactionVtx.X(); fdaughterVertex[1] = interactionVtx.Y(); fdaughterVertex[2] = interactionVtx.Z();
572 
573  // Maximum number of daugthers to be processed
574  if(particle->NumDaughters() > NMAXDAUGTHERS)
575  std::cout << "INFO::Number of daughters is " << particle->NumDaughters() << ". Only the first NMAXDAUGTHERS are processed." << std::endl;
576 
577  // Let's get the daughter PFParticles... we can do this simply without the utility
578  for(const int daughterID : particle->Daughters()){
579  // Daughter ID is the element of the original recoParticle vector
580  const recob::PFParticle *daughterParticle = &(recoParticles->at(daughterID));
581  //std::cout << "Daughter " << daughterID << " has " << daughterParticle->NumDaughters() << " daughters" << std::endl;
582 
583  // Fill tree with daughter info
584  FillPrimaryDaughterPFParticle(evt, clockData, daughterParticle, daughterID);
585 
586  // Get the secondary vertex from daughter interactions
587  const TVector3 secinteractionVtx = pfpUtil.GetPFParticleSecondaryVertex(*daughterParticle,evt,fPFParticleTag,fTrackerTag);
588  fgranddaughterVertex[fNDAUGHTERS][0] = secinteractionVtx.X(); fgranddaughterVertex[fNDAUGHTERS][1] = secinteractionVtx.Y(); fgranddaughterVertex[fNDAUGHTERS][2] = secinteractionVtx.Z();
589 
590  for(const int gdaughterID : daughterParticle->Daughters()){
591  FillPrimaryGrandDaughterPFParticle(evt, clockData, daughterParticle, gdaughterID, daughterID);
592 
593  // Only process NMAXDAUGTHERS
594  if(fNGRANDDAUGHTERS > NMAXDAUGTHERS) break;
595  }
596 
597  // Only process NMAXDAUGTHERS
598  if(fNDAUGHTERS > NMAXDAUGTHERS) break;
599 
600  }
601 
602  // For now only consider the first primary track. Need a proper treatment if more than one primary particles are found.
603  break;
604  }
605 
606  // Fill trees
607  fPandoraBeam->Fill();
608  fBeamTrack->Fill();
609  fDaughterTree->Fill();
610  fGrandDaughterTree->Fill();
611 
612 }
613 
614 // -----------------------------------------------------------------------------
616 
617 }
618 
619 // -----------------------------------------------------------------------------
621 
622  bool beamTriggerEvent = false;
623  // If this event is MC then we can check what the true beam particle is
624  if(!evt.isRealData()){
625  // Firstly we need to get the list of MCTruth objects from the generator. The standard protoDUNE
626  // simulation has fGeneratorTag = "generator"
627  auto mcTruths = evt.getValidHandle<std::vector<simb::MCTruth>>(fGeneratorTag);
628  fbeamtrack_truth_Origin = (*mcTruths)[0].Origin();
629  fbeamNTracks = 1;
630 
631  // mcTruths is basically a pointer to an std::vector of simb::MCTruth objects. There should only be one
632  // of these, so we pass the first element into the function to get the good particle
633  const simb::MCParticle* geantGoodParticle = truthUtil.GetGeantGoodParticle((*mcTruths)[0],evt);
634 
635  if(geantGoodParticle != 0x0){
636 
637  beamTriggerEvent = true;
638  fbeamtrigger = 12;
639  fbeamtrackPos[0] = geantGoodParticle->Vx();
640  fbeamtrackPos[1] = geantGoodParticle->Vy();
641  fbeamtrackPos[2] = geantGoodParticle->Vz();
642  fbeamtrackPos[3] = geantGoodParticle->T();
643  fbeamtrackMomentum = geantGoodParticle->P();
644  fbeamtrackEnergy = geantGoodParticle->E();
645  fbeamtrackPdg = geantGoodParticle->PdgCode();
646  fbeamtrackID = geantGoodParticle->TrackId();
647 
648  fbeamtrack_truth_EndPos[0] = geantGoodParticle->EndX();
649  fbeamtrack_truth_EndPos[1] = geantGoodParticle->EndY();
650  fbeamtrack_truth_EndPos[2] = geantGoodParticle->EndZ();
651  fbeamtrack_truth_EndPos[3] = geantGoodParticle->EndT();
652  fbeamtrack_truth_Momentum[0] = geantGoodParticle->Px();
653  fbeamtrack_truth_Momentum[1] = geantGoodParticle->Py();
654  fbeamtrack_truth_Momentum[2] = geantGoodParticle->Pz();
655  fbeamtrack_truth_Momentum[3] = geantGoodParticle->E();
656  fbeamtrack_truth_Pt = geantGoodParticle->Pt();
657  fbeamtrack_truth_Mass = geantGoodParticle->Mass();
658  fbeamtrack_truth_Theta = geantGoodParticle->Momentum().Theta();
659  fbeamtrack_truth_Phi = geantGoodParticle->Momentum().Phi();
660  fbeamtrack_truth_TotalLength = geantGoodParticle->Trajectory().TotalLength();
661  fbeamtrack_truth_KinEnergy = std::sqrt(geantGoodParticle->P()*geantGoodParticle->P() + geantGoodParticle->Mass()*geantGoodParticle->Mass()) - geantGoodParticle->Mass();
662  //fbeamtrack_truth_Process = int(geantGoodParticle->Trajectory().ProcessToKey(geantGoodParticle->Process()));
663  //fbeamtrack_truth_EndProcess = int(geantGoodParticle->Trajectory().ProcessToKey(geantGoodParticle->EndProcess()));
666  // Truth Pdg may not be the same as the beam PID.
667  fbeamtrack_truth_Pdg = geantGoodParticle->PdgCode();
668  // Get the position and kinematics in the TPC active volume
670  if(trajintpcactivevol > 0){
671  fbeamtrack_truth_Pos_InTPCActive[0] = geantGoodParticle->Vx(trajintpcactivevol);
672  fbeamtrack_truth_Pos_InTPCActive[1] = geantGoodParticle->Vy(trajintpcactivevol);
673  fbeamtrack_truth_Pos_InTPCActive[2] = geantGoodParticle->Vz(trajintpcactivevol);
674  fbeamtrack_truth_Pos_InTPCActive[3] = geantGoodParticle->T(trajintpcactivevol);
675  fbeamtrack_truth_Momentum_InTPCActive[0] = geantGoodParticle->Px(trajintpcactivevol);
676  fbeamtrack_truth_Momentum_InTPCActive[1] = geantGoodParticle->Py(trajintpcactivevol);
677  fbeamtrack_truth_Momentum_InTPCActive[2] = geantGoodParticle->Pz(trajintpcactivevol);
678  fbeamtrack_truth_Momentum_InTPCActive[3] = geantGoodParticle->E(trajintpcactivevol);
679  fbeamtrack_truth_P_InTPCActive = geantGoodParticle->P(trajintpcactivevol);
680  fbeamtrack_truth_Pt_InTPCActive = geantGoodParticle->Pt(trajintpcactivevol);
681  fbeamtrack_truth_Theta_InTPCActive = geantGoodParticle->Momentum(trajintpcactivevol).Theta();
682  fbeamtrack_truth_Phi_InTPCActive = geantGoodParticle->Momentum(trajintpcactivevol).Phi();
684  fbeamtrack_truth_KinEnergy_InTPCActive = std::sqrt(geantGoodParticle->P(trajintpcactivevol)*geantGoodParticle->P(trajintpcactivevol) + geantGoodParticle->Mass()*geantGoodParticle->Mass()) - geantGoodParticle->Mass();
685  //unsigned int ntrajpoints = geantGoodParticle->NumberTrajectoryPoints();
686  }
687 
688  // If this beam particle has interacted in the detector, find its daugthers.
689  std::vector<art::Ptr<simb::MCParticle> > mcbeampartilelist;
690  auto mcbeamHandle = evt.getHandle<std::vector<simb::MCParticle> >(fSimulationTag);
691  if (mcbeamHandle) art::fill_ptr_vector(mcbeampartilelist, mcbeamHandle);
692 
693  for(size_t p=0; p < mcbeampartilelist.size(); p++){
694  auto & beamprim_mcparticle = mcbeampartilelist[p];
695  if(beamprim_mcparticle->Mother() == geantGoodParticle->TrackId()){
696  fbeamtrack_truthdaughter_TrackId[fbeamtrack_truth_NDAUGTHERS] = beamprim_mcparticle->TrackId();
697  fbeamtrack_truthdaughter_Pdg[fbeamtrack_truth_NDAUGTHERS] = beamprim_mcparticle->PdgCode();
698  fbeamtrack_truthdaughter_Mother[fbeamtrack_truth_NDAUGTHERS] = beamprim_mcparticle->Mother();
703  fbeamtrack_truthdaughter_EndPosition[fbeamtrack_truth_NDAUGTHERS][0] = beamprim_mcparticle->EndX();
704  fbeamtrack_truthdaughter_EndPosition[fbeamtrack_truth_NDAUGTHERS][1] = beamprim_mcparticle->EndY();
705  fbeamtrack_truthdaughter_EndPosition[fbeamtrack_truth_NDAUGTHERS][2] = beamprim_mcparticle->EndZ();
706  fbeamtrack_truthdaughter_EndPosition[fbeamtrack_truth_NDAUGTHERS][3] = beamprim_mcparticle->EndT();
707  fbeamtrack_truthdaughter_P[fbeamtrack_truth_NDAUGTHERS] = beamprim_mcparticle->P();
708  fbeamtrack_truthdaughter_Momentum[fbeamtrack_truth_NDAUGTHERS][0] = beamprim_mcparticle->Px();
709  fbeamtrack_truthdaughter_Momentum[fbeamtrack_truth_NDAUGTHERS][1] = beamprim_mcparticle->Py();
710  fbeamtrack_truthdaughter_Momentum[fbeamtrack_truth_NDAUGTHERS][2] = beamprim_mcparticle->Pz();
711  fbeamtrack_truthdaughter_Momentum[fbeamtrack_truth_NDAUGTHERS][3] = beamprim_mcparticle->E();
712  fbeamtrack_truthdaughter_Pt[fbeamtrack_truth_NDAUGTHERS] = beamprim_mcparticle->Pt();
713  fbeamtrack_truthdaughter_Mass[fbeamtrack_truth_NDAUGTHERS] = beamprim_mcparticle->Mass();
714  fbeamtrack_truthdaughter_EndMomentum[fbeamtrack_truth_NDAUGTHERS][0] = beamprim_mcparticle->EndPx();
715  fbeamtrack_truthdaughter_EndMomentum[fbeamtrack_truth_NDAUGTHERS][1] = beamprim_mcparticle->EndPy();
716  fbeamtrack_truthdaughter_EndMomentum[fbeamtrack_truth_NDAUGTHERS][2] = beamprim_mcparticle->EndPz();
717  fbeamtrack_truthdaughter_EndMomentum[fbeamtrack_truth_NDAUGTHERS][3] = beamprim_mcparticle->EndE();
718  fbeamtrack_truthdaughter_Theta[fbeamtrack_truth_NDAUGTHERS] = beamprim_mcparticle->Momentum().Theta();
719  fbeamtrack_truthdaughter_Phi[fbeamtrack_truth_NDAUGTHERS] = beamprim_mcparticle->Momentum().Phi();
720  fbeamtrack_truthdaughter_TotalLength[fbeamtrack_truth_NDAUGTHERS] = beamprim_mcparticle->Trajectory().TotalLength();
723 
726 
727  if(truthUtil.GetProcessKey(beamprim_mcparticle->EndProcess()) == 30){ // Decay particle
728  for(size_t pp=0; pp < mcbeampartilelist.size(); pp++){
729  auto & decay_beamprim_mcparticle = mcbeampartilelist[pp];
730  if(decay_beamprim_mcparticle->Mother() == beamprim_mcparticle->TrackId()){
731  fbeamtrack_truthdecaydaughter_TrackId[fbeamtrack_truth_NDECAYDAUGTHERS] = decay_beamprim_mcparticle->TrackId();
732  fbeamtrack_truthdecaydaughter_Pdg[fbeamtrack_truth_NDECAYDAUGTHERS] = decay_beamprim_mcparticle->PdgCode();
733  fbeamtrack_truthdecaydaughter_Mother[fbeamtrack_truth_NDECAYDAUGTHERS] = decay_beamprim_mcparticle->Mother();
738  fbeamtrack_truthdecaydaughter_EndPosition[fbeamtrack_truth_NDECAYDAUGTHERS][0] = decay_beamprim_mcparticle->EndX();
739  fbeamtrack_truthdecaydaughter_EndPosition[fbeamtrack_truth_NDECAYDAUGTHERS][1] = decay_beamprim_mcparticle->EndY();
740  fbeamtrack_truthdecaydaughter_EndPosition[fbeamtrack_truth_NDECAYDAUGTHERS][2] = decay_beamprim_mcparticle->EndZ();
741  fbeamtrack_truthdecaydaughter_EndPosition[fbeamtrack_truth_NDECAYDAUGTHERS][3] = decay_beamprim_mcparticle->EndT();
742  fbeamtrack_truthdecaydaughter_P[fbeamtrack_truth_NDECAYDAUGTHERS] = decay_beamprim_mcparticle->P();
743  fbeamtrack_truthdecaydaughter_Momentum[fbeamtrack_truth_NDECAYDAUGTHERS][0] = decay_beamprim_mcparticle->Px();
744  fbeamtrack_truthdecaydaughter_Momentum[fbeamtrack_truth_NDECAYDAUGTHERS][1] = decay_beamprim_mcparticle->Py();
745  fbeamtrack_truthdecaydaughter_Momentum[fbeamtrack_truth_NDECAYDAUGTHERS][2] = decay_beamprim_mcparticle->Pz();
747  fbeamtrack_truthdecaydaughter_Pt[fbeamtrack_truth_NDECAYDAUGTHERS] = decay_beamprim_mcparticle->Pt();
748  fbeamtrack_truthdecaydaughter_Mass[fbeamtrack_truth_NDECAYDAUGTHERS] = decay_beamprim_mcparticle->Mass();
749  fbeamtrack_truthdecaydaughter_EndMomentum[fbeamtrack_truth_NDECAYDAUGTHERS][0] = decay_beamprim_mcparticle->EndPx();
750  fbeamtrack_truthdecaydaughter_EndMomentum[fbeamtrack_truth_NDECAYDAUGTHERS][1] = decay_beamprim_mcparticle->EndPy();
751  fbeamtrack_truthdecaydaughter_EndMomentum[fbeamtrack_truth_NDECAYDAUGTHERS][2] = decay_beamprim_mcparticle->EndPz();
752  fbeamtrack_truthdecaydaughter_EndMomentum[fbeamtrack_truth_NDECAYDAUGTHERS][3] = decay_beamprim_mcparticle->EndE();
753  fbeamtrack_truthdecaydaughter_Theta[fbeamtrack_truth_NDECAYDAUGTHERS] = decay_beamprim_mcparticle->Momentum().Theta();
754  fbeamtrack_truthdecaydaughter_Phi[fbeamtrack_truth_NDECAYDAUGTHERS] = decay_beamprim_mcparticle->Momentum().Phi();
755  fbeamtrack_truthdecaydaughter_TotalLength[fbeamtrack_truth_NDECAYDAUGTHERS] = decay_beamprim_mcparticle->Trajectory().TotalLength();
758 
761  }
762  }
763  } // decay particle
764 
765  }
766 
767  } // mc particle vector
768 
769  } // beam geant particle found
770  } // is mc
771  else{ // data
772  // For data we can see if this event comes from a beam trigger
773  beamTriggerEvent = dataUtil.IsBeamTrigger(evt);
774 
775  std::vector< art::Ptr<beam::ProtoDUNEBeamEvent> > beaminfo;
776  auto pdbeamHandle = evt.getHandle< std::vector<beam::ProtoDUNEBeamEvent> >(fBeamModuleLabel);
777  if (pdbeamHandle) art::fill_ptr_vector(beaminfo, pdbeamHandle);
778 
779  fbeamNTracks = (int)beaminfo.size();
780  // For now only consider events with one beam track only
781  if(fbeamNTracks != 1) return false;
782 
783  for(unsigned int i = 0; i < beaminfo.size(); ++i){
784  fBIAndTimingMatched = beaminfo[i]->CheckIsMatched();
785  fbeamtrigger = beaminfo[i]->GetTimingTrigger();
786  fbeamtrackPos[3] = (double)beaminfo[i]->GetRDTimestamp();
787 
788  // If ToF is 0-3 there was a good match corresponding to the different pair-wise combinations of the upstream and downstream channels
789  if(beaminfo[i]->GetTOFChan() >= 0)
790  ftof = beaminfo[i]->GetTOF();
791 
792  // Get Cerenkov
793  if(beaminfo[i]->GetBITrigger() == 1){
794  fcerenkovStatus[0] = beaminfo[i]->GetCKov0Status();
795  fcerenkovStatus[1] = beaminfo[i]->GetCKov1Status();
796  fcerenkovTime[0] = beaminfo[i]->GetCKov0Time();
797  fcerenkovTime[1] = beaminfo[i]->GetCKov1Time();
798  fcerenkovPressure[0] = beaminfo[i]->GetCKov0Pressure();
799  fcerenkovPressure[1] = beaminfo[i]->GetCKov1Pressure();
800  }
801 
802  // Beam particle could have more than one tracks - for now take the first one, need to do this properly
803  auto & tracks = beaminfo[i]->GetBeamTracks();
804  if(!tracks.empty()){
805  fbeamtrackPos[0] = tracks[0].End().X();
806  fbeamtrackPos[1] = tracks[0].End().Y();
807  fbeamtrackPos[2] = tracks[0].End().Z();
808  fbeamtrackDir[0] = tracks[0].StartDirection().X();
809  fbeamtrackDir[1] = tracks[0].StartDirection().Y();
810  fbeamtrackDir[2] = tracks[0].StartDirection().Z();
811  }
812 
813  // Beam momentum
814  auto & beammom = beaminfo[i]->GetRecoBeamMomenta();
815  if(!beammom.empty()){
816  fbeamtrackMomentum = beammom[0];
817  ftof_expElec = beamlineUtil.ComputeTOF(11, beammom[0]);
818  ftof_expMuon = beamlineUtil.ComputeTOF(13, beammom[0]);
819  ftof_expPion = beamlineUtil.ComputeTOF(211, beammom[0]);
820  ftof_expKaon = beamlineUtil.ComputeTOF(321, beammom[0]);
821  ftof_expProt = beamlineUtil.ComputeTOF(2212, beammom[0]);
822  ftof_expDeut = beamlineUtil.ComputeTOF(1000010020, beammom[0]);
823  }
824 
825  // For now only take the first beam particle - need to add some criteria if more than one are found
826  break;
827 
828  }
829  }
830 
831  return beamTriggerEvent;
832 
833 }
834 
835 // -----------------------------------------------------------------------------
837  detinfo::DetectorClocksData const& clockData,
838  const recob::PFParticle* particle)
839 {
840  // Pandora's BDT beam-cosmic score
842 
843  // NHits associated with this pfParticle
845 
846  // Earliest hit peak time
848 
849  // Get the T0 for this pfParticle
850  std::vector<anab::T0> pfT0vec = pfpUtil.GetPFParticleT0(*particle,evt,fPFParticleTag);
851  if(!pfT0vec.empty())
852  fprimaryT0 = pfT0vec[0].Time();
853 
854  //mf::LogWarning("ProtoDUNEAnalTree") << " Getting MC Particle failed. Ignore if you run on data. " << std::endl;
855  //std::vector<art::Ptr<simb::MCParticle> > mcpartilelist;
856  //auto mcHandle = evt.getHandle<std::vector<simb::MCParticle> >(fSimulationTag);
857  //if (mcHandle) art::fill_ptr_vector(mcpartilelist, mcHandle);
858 
859  // "particle" is the pointer to our beam particle. The recob::Track or recob::Shower object
860  // of this particle might be more helpful. These return null pointers if not track-like / shower-like
861  const recob::Track* thisTrack = pfpUtil.GetPFParticleTrack(*particle, evt,fPFParticleTag,fTrackerTag);
862  const recob::Shower* thisShower = pfpUtil.GetPFParticleShower(*particle,evt,fPFParticleTag,fShowerTag);
863 
864  const simb::MCParticle* mcparticle = NULL;
865 
866  if(thisTrack != 0x0){
867  fprimaryIstrack = 1;
868  fprimaryIsshower = 0;
869  fprimaryID = thisTrack->ParticleId();
870  fprimaryTheta = thisTrack->Theta();
871  fprimaryPhi = thisTrack->Phi();
872  fprimaryLength = thisTrack->Length();
873  fprimaryMomentum = thisTrack->StartMomentum();
874  fprimaryEndMomentum = thisTrack->EndMomentum();
875  fprimaryEndPosition[0] = thisTrack->Trajectory().End().X();
876  fprimaryEndPosition[1] = thisTrack->Trajectory().End().Y();
877  fprimaryEndPosition[2] = thisTrack->Trajectory().End().Z();
878  fprimaryStartPosition[0] = thisTrack->Trajectory().Start().X();
879  fprimaryStartPosition[1] = thisTrack->Trajectory().Start().Y();
880  fprimaryStartPosition[2] = thisTrack->Trajectory().Start().Z();
881  fprimaryEndDirection[0] = thisTrack->Trajectory().EndDirection().X();
882  fprimaryEndDirection[1] = thisTrack->Trajectory().EndDirection().Y();
883  fprimaryEndDirection[2] = thisTrack->Trajectory().EndDirection().Z();
884  fprimaryStartDirection[0] = thisTrack->Trajectory().StartDirection().X();
885  fprimaryStartDirection[1] = thisTrack->Trajectory().StartDirection().Y();
886  fprimaryStartDirection[2] = thisTrack->Trajectory().StartDirection().Z();
887 
890 
891  // Calorimetry
892  std::vector<anab::Calorimetry> calovector = trackUtil.GetRecoTrackCalorimetry(*thisTrack, evt, fTrackerTag, fCalorimetryTag);
893  if(calovector.size() != 3 && fVerbose > 0)
894  std::cerr << "WARNING::Calorimetry vector size for primary is = " << calovector.size() << std::endl;
895 
896  for(size_t k = 0; k < calovector.size() && k<3; k++){
897  int plane = calovector[k].PlaneID().Plane;
898  if(plane < 0) continue;
899  if(plane > 2) continue;
900  fprimaryKineticEnergy[plane] = calovector[k].KineticEnergy();
901  fprimaryRange[plane] = calovector[k].Range();
902  fprimaryTrkPitchC[plane] = calovector[k].TrkPitchC();
903  }
904 
905  // PID
906  std::vector<anab::ParticleID> pids = trackUtil.GetRecoTrackPID(*thisTrack, evt, fTrackerTag, fParticleIDTag);
907  if(pids.size() != 3 && fVerbose > 0)
908  std::cerr << "WARNING::PID vector size for primary is = " << pids.size() << std::endl;
909 
910  for(size_t k = 0; k < pids.size() && k<3; k++){
911  int plane = pids[k].PlaneID().Plane;
912  if(plane < 0) continue;
913  if(plane > 2) continue;
914  fprimaryPID_Pdg[plane] = pids[plane].Pdg();
915  fprimaryPID_Ndf[plane] = pids[plane].Ndf();
916  fprimaryPID_MinChi2[plane] = pids[plane].MinChi2();
917  fprimaryPID_DeltaChi2[plane] = pids[plane].DeltaChi2();
918  fprimaryPID_Chi2Proton[plane] = pids[plane].Chi2Proton();
919  fprimaryPID_Chi2Kaon[plane] = pids[plane].Chi2Kaon();
920  fprimaryPID_Chi2Pion[plane] = pids[plane].Chi2Pion();
921  fprimaryPID_Chi2Muon[plane] = pids[plane].Chi2Muon();
922  fprimaryPID_MissingE[plane] = pids[plane].MissingE();
923  fprimaryPID_MissingEavg[plane] = pids[plane].MissingEavg();
924  fprimaryPID_PIDA[plane] = pids[plane].PIDA();
925  }
926 
927  // Get the true mc particle
928  //const simb::MCParticle* mcparticle = truthUtil.GetMCParticleFromRecoTrack(*thisTrack, evt, fTrackerTag);
929  mcparticle = truthUtil.GetMCParticleFromRecoTrack(clockData, *thisTrack, evt, fTrackerTag);
930  } // end is track
931  else if(thisShower != 0x0){
932  fprimaryIstrack = 0;
933  fprimaryIsshower = 1;
934 
935  fprimaryID = thisShower->ID();
936  fprimaryLength = thisShower->Length();
937  fprimaryShowerBestPlane = thisShower->best_plane();
938  fprimaryOpeningAngle = thisShower->OpenAngle();
939  fprimaryStartPosition[0] = thisShower->ShowerStart().X();
940  fprimaryStartPosition[1] = thisShower->ShowerStart().Y();
941  fprimaryStartPosition[2] = thisShower->ShowerStart().Z();
942  fprimaryStartDirection[0] = thisShower->Direction().X();
943  fprimaryStartDirection[1] = thisShower->Direction().Y();
944  fprimaryStartDirection[2] = thisShower->Direction().Z();
945  for(size_t k = 0; k < (thisShower->Energy()).size() && k<3; k++)
946  fprimaryShowerEnergy[k] = thisShower->Energy()[k];
947  for(size_t k = 0; k < (thisShower->MIPEnergy()).size() && k<3; k++)
948  fprimaryShowerMIPEnergy[k] = thisShower->MIPEnergy()[k];
949  for(size_t k = 0; k < (thisShower->dEdx()).size() && k<3; k++)
950  fprimaryShowerdEdx[k] = thisShower->dEdx()[k];
951 
952  //const simb::MCParticle* mcparticle = truthUtil.GetMCParticleFromRecoShower(*thisShower, evt, fShowerTag);
953  mcparticle = truthUtil.GetMCParticleFromRecoShower(clockData, *thisShower, evt, fShowerTag);
954  } // end is shower
955  else{
956  if(fVerbose > 0){
957  std::cout << "INFO::Primary pfParticle is not track or shower!" << std::endl;
958  }
959  return;
960  }
961 
962  if(mcparticle != 0x0){
963  fprimary_truth_Origin = pi_service->TrackIdToMCTruth_P(mcparticle->TrackId())->Origin();
964  fprimary_truth_TrackId = mcparticle->TrackId();
965  fprimary_truth_Pdg = mcparticle->PdgCode();
966  fprimary_truth_Mother = mcparticle->Mother();
967  fprimary_truth_StartPosition[0] = mcparticle->Vx();
968  fprimary_truth_StartPosition[1] = mcparticle->Vy();
969  fprimary_truth_StartPosition[2] = mcparticle->Vz();
970  fprimary_truth_StartPosition[3] = mcparticle->T();
971  fprimary_truth_EndPosition[0] = mcparticle->EndX();
972  fprimary_truth_EndPosition[1] = mcparticle->EndY();
973  fprimary_truth_EndPosition[2] = mcparticle->EndZ();
974  fprimary_truth_EndPosition[3] = mcparticle->EndT();
975  fprimary_truth_P = mcparticle->P();
976  fprimary_truth_Momentum[0] = mcparticle->Px();
977  fprimary_truth_Momentum[1] = mcparticle->Py();
978  fprimary_truth_Momentum[2] = mcparticle->Pz();
979  fprimary_truth_Momentum[3] = mcparticle->E();
980  fprimary_truth_Pt = mcparticle->Pt();
981  fprimary_truth_Mass = mcparticle->Mass();
982  fprimary_truth_EndMomentum[0] = mcparticle->EndPx();
983  fprimary_truth_EndMomentum[1] = mcparticle->EndPy();
984  fprimary_truth_EndMomentum[2] = mcparticle->EndPz();
985  fprimary_truth_EndMomentum[3] = mcparticle->EndE();
986  fprimary_truth_Theta = mcparticle->Momentum().Theta();
987  fprimary_truth_Phi = mcparticle->Momentum().Phi();
988  //fprimary_truth_NDaughters = mcparticle->NumberDaughters();
994  fprimary_truth_EkinAtVertex = truthUtil.GetKinEnergyAtVertex(*mcparticle,lastpointEloss);
995 
996  // Get the position and kinematics in the TPC active volume
998  if(trajintpcactivevol > 0){
999  fprimary_truth_Pos_InTPCActive[0] = mcparticle->Vx(trajintpcactivevol);
1000  fprimary_truth_Pos_InTPCActive[1] = mcparticle->Vy(trajintpcactivevol);
1001  fprimary_truth_Pos_InTPCActive[2] = mcparticle->Vz(trajintpcactivevol);
1002  fprimary_truth_Pos_InTPCActive[3] = mcparticle->T(trajintpcactivevol);
1003  fprimary_truth_Momentum_InTPCActive[0] = mcparticle->Px(trajintpcactivevol);
1004  fprimary_truth_Momentum_InTPCActive[1] = mcparticle->Py(trajintpcactivevol);
1005  fprimary_truth_Momentum_InTPCActive[2] = mcparticle->Pz(trajintpcactivevol);
1006  fprimary_truth_Momentum_InTPCActive[3] = mcparticle->E(trajintpcactivevol);
1007  fprimary_truth_P_InTPCActive = mcparticle->P(trajintpcactivevol);
1008  fprimary_truth_Pt_InTPCActive = mcparticle->Pt(trajintpcactivevol);
1009  fprimary_truth_Theta_InTPCActive = mcparticle->Momentum(trajintpcactivevol).Theta();
1010  fprimary_truth_Phi_InTPCActive = mcparticle->Momentum(trajintpcactivevol).Phi();
1012  fprimary_truth_KinEnergy_InTPCActive = std::sqrt(mcparticle->P(trajintpcactivevol)*mcparticle->P(trajintpcactivevol) + mcparticle->Mass()*mcparticle->Mass()) - mcparticle->Mass();
1013  }
1014 
1017  else
1019 
1020  // If this beam particle has interacted in the detector, find its daugthers.
1021  std::vector<art::Ptr<simb::MCParticle> > mcprimarypartilelist;
1022  auto mcprimaryHandle = evt.getHandle<std::vector<simb::MCParticle> >(fSimulationTag);
1023  if (mcprimaryHandle) art::fill_ptr_vector(mcprimarypartilelist, mcprimaryHandle);
1024 
1025  for(size_t p=0; p < mcprimarypartilelist.size(); p++){
1026  auto & primary_mcparticle = mcprimarypartilelist[p];
1027 
1028  if(primary_mcparticle->Mother() == mcparticle->TrackId()){
1029  fprimary_truthdaughter_TrackId[fprimary_truth_NDAUGTHERS] = primary_mcparticle->TrackId();
1030  fprimary_truthdaughter_Pdg[fprimary_truth_NDAUGTHERS] = primary_mcparticle->PdgCode();
1031  fprimary_truthdaughter_Mother[fprimary_truth_NDAUGTHERS] = primary_mcparticle->Mother();
1032  fprimary_truthdaughter_StartPosition[fprimary_truth_NDAUGTHERS][0] = primary_mcparticle->Vx();
1033  fprimary_truthdaughter_StartPosition[fprimary_truth_NDAUGTHERS][1] = primary_mcparticle->Vy();
1034  fprimary_truthdaughter_StartPosition[fprimary_truth_NDAUGTHERS][2] = primary_mcparticle->Vz();
1036  fprimary_truthdaughter_EndPosition[fprimary_truth_NDAUGTHERS][0] = primary_mcparticle->EndX();
1037  fprimary_truthdaughter_EndPosition[fprimary_truth_NDAUGTHERS][1] = primary_mcparticle->EndY();
1038  fprimary_truthdaughter_EndPosition[fprimary_truth_NDAUGTHERS][2] = primary_mcparticle->EndZ();
1039  fprimary_truthdaughter_EndPosition[fprimary_truth_NDAUGTHERS][3] = primary_mcparticle->EndT();
1040  fprimary_truthdaughter_P[fprimary_truth_NDAUGTHERS] = primary_mcparticle->P();
1041  fprimary_truthdaughter_Momentum[fprimary_truth_NDAUGTHERS][0] = primary_mcparticle->Px();
1042  fprimary_truthdaughter_Momentum[fprimary_truth_NDAUGTHERS][1] = primary_mcparticle->Py();
1043  fprimary_truthdaughter_Momentum[fprimary_truth_NDAUGTHERS][2] = primary_mcparticle->Pz();
1044  fprimary_truthdaughter_Momentum[fprimary_truth_NDAUGTHERS][3] = primary_mcparticle->E();
1045  fprimary_truthdaughter_Pt[fprimary_truth_NDAUGTHERS] = primary_mcparticle->Pt();
1046  fprimary_truthdaughter_Mass[fprimary_truth_NDAUGTHERS] = primary_mcparticle->Mass();
1047  fprimary_truthdaughter_EndMomentum[fprimary_truth_NDAUGTHERS][0] = primary_mcparticle->EndPx();
1048  fprimary_truthdaughter_EndMomentum[fprimary_truth_NDAUGTHERS][1] = primary_mcparticle->EndPy();
1049  fprimary_truthdaughter_EndMomentum[fprimary_truth_NDAUGTHERS][2] = primary_mcparticle->EndPz();
1050  fprimary_truthdaughter_EndMomentum[fprimary_truth_NDAUGTHERS][3] = primary_mcparticle->EndE();
1051  fprimary_truthdaughter_Theta[fprimary_truth_NDAUGTHERS] = primary_mcparticle->Momentum().Theta();
1052  fprimary_truthdaughter_Phi[fprimary_truth_NDAUGTHERS] = primary_mcparticle->Momentum().Phi();
1053  fprimary_truthdaughter_TotalLength[fprimary_truth_NDAUGTHERS] = primary_mcparticle->Trajectory().TotalLength();
1056 
1059 
1060  if(truthUtil.GetProcessKey(primary_mcparticle->EndProcess()) == 30){ // Decay particle
1061  for(size_t pp=0; pp < mcprimarypartilelist.size(); pp++){
1062  auto & decay_primary_mcparticle = mcprimarypartilelist[pp];
1063 
1064  if(decay_primary_mcparticle->Mother() == primary_mcparticle->TrackId()){
1065  fprimary_truthdecaydaughter_TrackId[fprimary_truth_NDECAYDAUGTHERS] = decay_primary_mcparticle->TrackId();
1066  fprimary_truthdecaydaughter_Pdg[fprimary_truth_NDECAYDAUGTHERS] = decay_primary_mcparticle->PdgCode();
1067  fprimary_truthdecaydaughter_Mother[fprimary_truth_NDECAYDAUGTHERS] = decay_primary_mcparticle->Mother();
1072  fprimary_truthdecaydaughter_EndPosition[fprimary_truth_NDECAYDAUGTHERS][0] = decay_primary_mcparticle->EndX();
1073  fprimary_truthdecaydaughter_EndPosition[fprimary_truth_NDECAYDAUGTHERS][1] = decay_primary_mcparticle->EndY();
1074  fprimary_truthdecaydaughter_EndPosition[fprimary_truth_NDECAYDAUGTHERS][2] = decay_primary_mcparticle->EndZ();
1075  fprimary_truthdecaydaughter_EndPosition[fprimary_truth_NDECAYDAUGTHERS][3] = decay_primary_mcparticle->EndT();
1076  fprimary_truthdecaydaughter_P[fprimary_truth_NDECAYDAUGTHERS] = decay_primary_mcparticle->P();
1077  fprimary_truthdecaydaughter_Momentum[fprimary_truth_NDECAYDAUGTHERS][0] = decay_primary_mcparticle->Px();
1078  fprimary_truthdecaydaughter_Momentum[fprimary_truth_NDECAYDAUGTHERS][1] = decay_primary_mcparticle->Py();
1079  fprimary_truthdecaydaughter_Momentum[fprimary_truth_NDECAYDAUGTHERS][2] = decay_primary_mcparticle->Pz();
1080  fprimary_truthdecaydaughter_Momentum[fprimary_truth_NDECAYDAUGTHERS][3] = decay_primary_mcparticle->E();
1081  fprimary_truthdecaydaughter_Pt[fprimary_truth_NDECAYDAUGTHERS] = decay_primary_mcparticle->Pt();
1082  fprimary_truthdecaydaughter_Mass[fprimary_truth_NDECAYDAUGTHERS] = decay_primary_mcparticle->Mass();
1083  fprimary_truthdecaydaughter_EndMomentum[fprimary_truth_NDECAYDAUGTHERS][0] = decay_primary_mcparticle->EndPx();
1084  fprimary_truthdecaydaughter_EndMomentum[fprimary_truth_NDECAYDAUGTHERS][1] = decay_primary_mcparticle->EndPy();
1085  fprimary_truthdecaydaughter_EndMomentum[fprimary_truth_NDECAYDAUGTHERS][2] = decay_primary_mcparticle->EndPz();
1086  fprimary_truthdecaydaughter_EndMomentum[fprimary_truth_NDECAYDAUGTHERS][3] = decay_primary_mcparticle->EndE();
1087  fprimary_truthdecaydaughter_Theta[fprimary_truth_NDECAYDAUGTHERS] = decay_primary_mcparticle->Momentum().Theta();
1088  fprimary_truthdecaydaughter_Phi[fprimary_truth_NDECAYDAUGTHERS] = decay_primary_mcparticle->Momentum().Phi();
1089  fprimary_truthdecaydaughter_TotalLength[fprimary_truth_NDECAYDAUGTHERS] = decay_primary_mcparticle->Trajectory().TotalLength();
1092 
1095  }
1096  }
1097  } // decay particle
1098  }
1099  }
1100 
1101  if(fVerbose > 1){
1102  std::cout << "INFO::Process = " << (mcparticle->Process()).c_str() << " , End process = " << (mcparticle->EndProcess()).c_str()
1103  << " , track ID = " << mcparticle->TrackId()
1104  << std::endl;
1105  }
1106  }
1107  else{
1108  if(fVerbose > 0){
1109  std::cout << "INFO::No MCParticle for primary found!" << std::endl;
1110  }
1111  }
1112 
1113 }
1114 
1115 // -----------------------------------------------------------------------------
1117  detinfo::DetectorClocksData const& clockData,
1118  const recob::PFParticle* daughterParticle,
1119  int daughterID){
1120 
1121  const recob::Track* daughterTrack = pfpUtil.GetPFParticleTrack(*daughterParticle,evt, fPFParticleTag,fTrackerTag);
1122  const recob::Shower* daughterShower = pfpUtil.GetPFParticleShower(*daughterParticle,evt,fPFParticleTag,fShowerTag);
1123  const simb::MCParticle* mcdaughterparticle = NULL;
1124 
1125  if(daughterTrack != 0x0){
1128  fdaughterTheta[fNDAUGHTERS] = daughterTrack->Theta();
1129  fdaughterPhi[fNDAUGHTERS] = daughterTrack->Phi();
1130  fdaughterLength[fNDAUGHTERS] = daughterTrack->Length();
1131  fdaughterMomentum[fNDAUGHTERS] = daughterTrack->StartMomentum();
1132  fdaughterEndMomentum[fNDAUGHTERS] = daughterTrack->EndMomentum();
1133  fdaughterStartPosition[fNDAUGHTERS][0] = daughterTrack->Trajectory().Start().X();
1134  fdaughterStartPosition[fNDAUGHTERS][1] = daughterTrack->Trajectory().Start().Y();
1135  fdaughterStartPosition[fNDAUGHTERS][2] = daughterTrack->Trajectory().Start().Z();
1136  fdaughterEndPosition[fNDAUGHTERS][0] = daughterTrack->Trajectory().End().X();
1137  fdaughterEndPosition[fNDAUGHTERS][1] = daughterTrack->Trajectory().End().Y();
1138  fdaughterEndPosition[fNDAUGHTERS][2] = daughterTrack->Trajectory().End().Z();
1139  fdaughterStartDirection[fNDAUGHTERS][0] = daughterTrack->Trajectory().StartDirection().X();
1140  fdaughterStartDirection[fNDAUGHTERS][1] = daughterTrack->Trajectory().StartDirection().Y();
1141  fdaughterStartDirection[fNDAUGHTERS][2] = daughterTrack->Trajectory().StartDirection().Z();
1142  fdaughterEndDirection[fNDAUGHTERS][0] = daughterTrack->Trajectory().EndDirection().X();
1143  fdaughterEndDirection[fNDAUGHTERS][1] = daughterTrack->Trajectory().EndDirection().Y();
1144  fdaughterEndDirection[fNDAUGHTERS][2] = daughterTrack->Trajectory().EndDirection().Z();
1145 
1148 
1149  // Calorimetry
1150  std::vector<anab::Calorimetry> daughtercalovector = trackUtil.GetRecoTrackCalorimetry(*daughterTrack, evt, fTrackerTag, fCalorimetryTag);
1151  if(daughtercalovector.size() != 3 && fVerbose > 0)
1152  std::cerr << "WARNING::Calorimetry vector size for daughter is = " << daughtercalovector.size() << std::endl;
1153 
1154  for(size_t k = 0; k < daughtercalovector.size() && k<3; k++){
1155  int plane = daughtercalovector[k].PlaneID().Plane;
1156  if(plane < 0) continue;
1157  if(plane > 2) continue;
1158  fdaughterKineticEnergy[fNDAUGHTERS][plane] = daughtercalovector[k].KineticEnergy();
1159  fdaughterRange[fNDAUGHTERS][plane] = daughtercalovector[k].Range();
1160  fdaughterTrkPitchC[fNDAUGHTERS][plane] = daughtercalovector[k].TrkPitchC();
1161  }
1162 
1163  // PID
1164  std::vector<anab::ParticleID> daughterpids = trackUtil.GetRecoTrackPID(*daughterTrack, evt, fTrackerTag, fParticleIDTag);
1165  if(daughterpids.size() != 3 && fVerbose > 0)
1166  std::cerr << "WARNING::PID vector size for daughter is = " << daughterpids.size() << std::endl;
1167 
1168  for(size_t k = 0; k < daughterpids.size() && k<3; k++){
1169  int plane = daughterpids[k].PlaneID().Plane;
1170  if(plane < 0) continue;
1171  if(plane > 2) continue;
1172  fdaughterPID_Pdg[fNDAUGHTERS][plane] = daughterpids[plane].Pdg();
1173  fdaughterPID_Ndf[fNDAUGHTERS][plane] = daughterpids[plane].Ndf();
1174  fdaughterPID_MinChi2[fNDAUGHTERS][plane] = daughterpids[plane].MinChi2();
1175  fdaughterPID_DeltaChi2[fNDAUGHTERS][plane] = daughterpids[plane].DeltaChi2();
1176  fdaughterPID_Chi2Proton[fNDAUGHTERS][plane] = daughterpids[plane].Chi2Proton();
1177  fdaughterPID_Chi2Kaon[fNDAUGHTERS][plane] = daughterpids[plane].Chi2Kaon();
1178  fdaughterPID_Chi2Pion[fNDAUGHTERS][plane] = daughterpids[plane].Chi2Pion();
1179  fdaughterPID_Chi2Muon[fNDAUGHTERS][plane] = daughterpids[plane].Chi2Muon();
1180  fdaughterPID_MissingE[fNDAUGHTERS][plane] = daughterpids[plane].MissingE();
1181  fdaughterPID_MissingEavg[fNDAUGHTERS][plane] = daughterpids[plane].MissingEavg();
1182  fdaughterPID_PIDA[fNDAUGHTERS][plane] = daughterpids[plane].PIDA();
1183  }
1184 
1185  // Get the true mc particle
1186  //const simb::MCParticle* mcdaughterparticle = truthUtil.GetMCParticleFromRecoTrack(*daughterTrack, evt, fTrackerTag);
1187  mcdaughterparticle = truthUtil.GetMCParticleFromRecoTrack(clockData, *daughterTrack, evt, fTrackerTag);
1188  }
1189  else if(daughterShower != 0x0){
1192  fdaughterLength[fNDAUGHTERS] = daughterShower->Length();
1193  fdaughterShowerBestPlane[fNDAUGHTERS] = daughterShower->best_plane();
1194  fdaughterOpeningAngle[fNDAUGHTERS] = daughterShower->OpenAngle();
1195  fdaughterStartPosition[fNDAUGHTERS][0] = daughterShower->ShowerStart().X();
1196  fdaughterStartPosition[fNDAUGHTERS][1] = daughterShower->ShowerStart().Y();
1197  fdaughterStartPosition[fNDAUGHTERS][2] = daughterShower->ShowerStart().Z();
1198  fdaughterStartDirection[fNDAUGHTERS][0] = daughterShower->Direction().X();
1199  fdaughterStartDirection[fNDAUGHTERS][1] = daughterShower->Direction().Y();
1200  fdaughterStartDirection[fNDAUGHTERS][2] = daughterShower->Direction().Z();
1201  for(size_t k = 0; k < (daughterShower->Energy()).size() && k<3; k++)
1202  fdaughterShowerEnergy[fNDAUGHTERS][k] = daughterShower->Energy()[k];
1203  for(size_t k = 0; k < (daughterShower->MIPEnergy()).size() && k<3; k++)
1204  fdaughterShowerMIPEnergy[fNDAUGHTERS][k] = daughterShower->MIPEnergy()[k];
1205  for(size_t k = 0; k < (daughterShower->dEdx()).size() && k<3; k++)
1206  fdaughterShowerdEdx[fNDAUGHTERS][k] = daughterShower->dEdx()[k];
1207 
1208  // Get the true mc particle
1209  //const simb::MCParticle* mcdaughterparticle = truthUtil.GetMCParticleFromRecoShower(*daughterShower, evt, fShowerTag);
1210  mcdaughterparticle = truthUtil.GetMCParticleFromRecoShower(clockData, *daughterShower, evt, fShowerTag);
1211  }
1212  else{
1213  if(fVerbose > 0){
1214  std::cout << "INFO::Daughter pfParticle is not track or shower!" << std::endl;
1215  }
1216  //return;
1217  }
1218 
1219  fdaughterID[fNDAUGHTERS] = daughterID;
1220  // NHits associated with this pfParticle
1222  // T0
1223  std::vector<anab::T0> pfdaughterT0vec = pfpUtil.GetPFParticleT0(*daughterParticle,evt,fPFParticleTag);
1224  if(!pfdaughterT0vec.empty())
1225  fdaughterT0[fNDAUGHTERS] = pfdaughterT0vec[0].Time();
1226 
1227  if(mcdaughterparticle != 0x0){
1228  fdaughter_truth_TrackId[fNDAUGHTERS] = mcdaughterparticle->TrackId();
1229  fdaughter_truth_Pdg[fNDAUGHTERS] = mcdaughterparticle->PdgCode();
1230  fdaughter_truth_Mother[fNDAUGHTERS] = mcdaughterparticle->Mother();
1231  fdaughter_truth_StartPosition[fNDAUGHTERS][0] = mcdaughterparticle->Vx();
1232  fdaughter_truth_StartPosition[fNDAUGHTERS][1] = mcdaughterparticle->Vy();
1233  fdaughter_truth_StartPosition[fNDAUGHTERS][2] = mcdaughterparticle->Vz();
1234  fdaughter_truth_StartPosition[fNDAUGHTERS][3] = mcdaughterparticle->T();
1235  fdaughter_truth_EndPosition[fNDAUGHTERS][0] = mcdaughterparticle->EndX();
1236  fdaughter_truth_EndPosition[fNDAUGHTERS][1] = mcdaughterparticle->EndY();
1237  fdaughter_truth_EndPosition[fNDAUGHTERS][2] = mcdaughterparticle->EndZ();
1238  fdaughter_truth_EndPosition[fNDAUGHTERS][3] = mcdaughterparticle->EndT();
1239  fdaughter_truth_P[fNDAUGHTERS] = mcdaughterparticle->P();
1240  fdaughter_truth_Momentum[fNDAUGHTERS][0] = mcdaughterparticle->Px();
1241  fdaughter_truth_Momentum[fNDAUGHTERS][1] = mcdaughterparticle->Py();
1242  fdaughter_truth_Momentum[fNDAUGHTERS][2] = mcdaughterparticle->Pz();
1243  fdaughter_truth_Momentum[fNDAUGHTERS][3] = mcdaughterparticle->E();
1244  fdaughter_truth_Pt[fNDAUGHTERS] = mcdaughterparticle->Pt();
1245  fdaughter_truth_Mass[fNDAUGHTERS] = mcdaughterparticle->Mass();
1246  fdaughter_truth_EndMomentum[fNDAUGHTERS][0] = mcdaughterparticle->EndPx();
1247  fdaughter_truth_EndMomentum[fNDAUGHTERS][1] = mcdaughterparticle->EndPy();
1248  fdaughter_truth_EndMomentum[fNDAUGHTERS][2] = mcdaughterparticle->EndPz();
1249  fdaughter_truth_EndMomentum[fNDAUGHTERS][3] = mcdaughterparticle->EndE();
1250  fdaughter_truth_Theta[fNDAUGHTERS] = mcdaughterparticle->Momentum().Theta();
1251  fdaughter_truth_Phi[fNDAUGHTERS] = mcdaughterparticle->Momentum().Phi();
1255  }
1256  else{
1257  if(fVerbose > 0){
1258  std::cout << "INFO::No MCParticle for daughter found!" << std::endl;
1259  }
1260  }
1261 
1262  // Increment counter
1263  fNDAUGHTERS++;
1264 
1265 }
1266 
1267 // -----------------------------------------------------------------------------
1269  detinfo::DetectorClocksData const& clockData,
1270  const recob::PFParticle* gdaughterParticle, int daughterID, int gdaughterID){
1271 
1272  const recob::Track* gdaughterTrack = pfpUtil.GetPFParticleTrack(*gdaughterParticle,evt, fPFParticleTag,fTrackerTag);
1273  const recob::Shower* gdaughterShower = pfpUtil.GetPFParticleShower(*gdaughterParticle,evt,fPFParticleTag,fShowerTag);
1274  const simb::MCParticle* mcdaughterparticle = NULL;
1275 
1276  if(gdaughterTrack != 0x0){
1279  fgranddaughterTheta[fNGRANDDAUGHTERS] = gdaughterTrack->Theta();
1280  fgranddaughterPhi[fNGRANDDAUGHTERS] = gdaughterTrack->Phi();
1281  fgranddaughterLength[fNGRANDDAUGHTERS] = gdaughterTrack->Length();
1284  fgranddaughterStartPosition[fNGRANDDAUGHTERS][0] = gdaughterTrack->Trajectory().Start().X();
1285  fgranddaughterStartPosition[fNGRANDDAUGHTERS][1] = gdaughterTrack->Trajectory().Start().Y();
1286  fgranddaughterStartPosition[fNGRANDDAUGHTERS][2] = gdaughterTrack->Trajectory().Start().Z();
1287  fgranddaughterEndPosition[fNGRANDDAUGHTERS][0] = gdaughterTrack->Trajectory().End().X();
1288  fgranddaughterEndPosition[fNGRANDDAUGHTERS][1] = gdaughterTrack->Trajectory().End().Y();
1289  fgranddaughterEndPosition[fNGRANDDAUGHTERS][2] = gdaughterTrack->Trajectory().End().Z();
1296 
1299 
1300  // Calorimetry
1301  std::vector<anab::Calorimetry> daughtercalovector = trackUtil.GetRecoTrackCalorimetry(*gdaughterTrack, evt, fTrackerTag, fCalorimetryTag);
1302  if(daughtercalovector.size() != 3 && fVerbose > 0)
1303  std::cerr << "WARNING::Calorimetry vector size for grand-daughter is = " << daughtercalovector.size() << std::endl;
1304 
1305  for(size_t k = 0; k < daughtercalovector.size() && k<3; k++){
1306  int plane = daughtercalovector[k].PlaneID().Plane;
1307  if(plane < 0) continue;
1308  if(plane > 2) continue;
1309  fgranddaughterKineticEnergy[fNGRANDDAUGHTERS][plane] = daughtercalovector[k].KineticEnergy();
1310  fgranddaughterRange[fNGRANDDAUGHTERS][plane] = daughtercalovector[k].Range();
1311  fgranddaughterTrkPitchC[fNGRANDDAUGHTERS][plane] = daughtercalovector[k].TrkPitchC();
1312  }
1313 
1314  // PID
1315  std::vector<anab::ParticleID> daughterpids = trackUtil.GetRecoTrackPID(*gdaughterTrack, evt, fTrackerTag, fParticleIDTag);
1316  if(daughterpids.size() != 3 && fVerbose > 0)
1317  std::cerr << "WARNING::PID vector size for grand-daughter is = " << daughterpids.size() << std::endl;
1318 
1319  for(size_t k = 0; k < daughterpids.size() && k<3; k++){
1320  int plane = daughterpids[k].PlaneID().Plane;
1321  if(plane < 0) continue;
1322  if(plane > 2) continue;
1323  fgranddaughterPID_Pdg[fNGRANDDAUGHTERS][plane] = daughterpids[plane].Pdg();
1324  fgranddaughterPID_Ndf[fNGRANDDAUGHTERS][plane] = daughterpids[plane].Ndf();
1325  fgranddaughterPID_MinChi2[fNGRANDDAUGHTERS][plane] = daughterpids[plane].MinChi2();
1326  fgranddaughterPID_DeltaChi2[fNGRANDDAUGHTERS][plane] = daughterpids[plane].DeltaChi2();
1327  fgranddaughterPID_Chi2Proton[fNGRANDDAUGHTERS][plane] = daughterpids[plane].Chi2Proton();
1328  fgranddaughterPID_Chi2Kaon[fNGRANDDAUGHTERS][plane] = daughterpids[plane].Chi2Kaon();
1329  fgranddaughterPID_Chi2Pion[fNGRANDDAUGHTERS][plane] = daughterpids[plane].Chi2Pion();
1330  fgranddaughterPID_Chi2Muon[fNGRANDDAUGHTERS][plane] = daughterpids[plane].Chi2Muon();
1331  fgranddaughterPID_MissingE[fNGRANDDAUGHTERS][plane] = daughterpids[plane].MissingE();
1332  fgranddaughterPID_MissingEavg[fNGRANDDAUGHTERS][plane] = daughterpids[plane].MissingEavg();
1333  fgranddaughterPID_PIDA[fNGRANDDAUGHTERS][plane] = daughterpids[plane].PIDA();
1334  }
1335 
1336  // Get the true mc particle
1337  //const simb::MCParticle* mcdaughterparticle = truthUtil.GetMCParticleFromRecoTrack(*gdaughterTrack, evt, fTrackerTag);
1338  mcdaughterparticle = truthUtil.GetMCParticleFromRecoTrack(clockData, *gdaughterTrack, evt, fTrackerTag);
1339  }
1340  else if(gdaughterShower != 0x0){
1343  fgranddaughterLength[fNGRANDDAUGHTERS] = gdaughterShower->Length();
1346  fgranddaughterStartPosition[fNGRANDDAUGHTERS][0] = gdaughterShower->ShowerStart().X();
1347  fgranddaughterStartPosition[fNGRANDDAUGHTERS][1] = gdaughterShower->ShowerStart().Y();
1348  fgranddaughterStartPosition[fNGRANDDAUGHTERS][2] = gdaughterShower->ShowerStart().Z();
1349  fgranddaughterStartDirection[fNGRANDDAUGHTERS][0] = gdaughterShower->Direction().X();
1350  fgranddaughterStartDirection[fNGRANDDAUGHTERS][1] = gdaughterShower->Direction().Y();
1351  fgranddaughterStartDirection[fNGRANDDAUGHTERS][2] = gdaughterShower->Direction().Z();
1352  for(size_t k = 0; k < (gdaughterShower->Energy()).size() && k<3; k++)
1353  fgranddaughterShowerEnergy[fNGRANDDAUGHTERS][k] = gdaughterShower->Energy()[k];
1354  for(size_t k = 0; k < (gdaughterShower->MIPEnergy()).size() && k<3; k++)
1356  for(size_t k = 0; k < (gdaughterShower->dEdx()).size() && k<3; k++)
1357  fgranddaughterShowerdEdx[fNGRANDDAUGHTERS][k] = gdaughterShower->dEdx()[k];
1358 
1359  // Get the true mc particle
1360  //const simb::MCParticle* mcdaughterparticle = truthUtil.GetMCParticleFromRecoShower(*gdaughterShower, evt, fShowerTag);
1361  mcdaughterparticle = truthUtil.GetMCParticleFromRecoShower(clockData, *gdaughterShower, evt, fShowerTag);
1362  }
1363  else{
1364  if(fVerbose > 0){
1365  std::cout << "INFO::GrandDaughter pfParticle is not track or shower!" << std::endl;
1366  }
1367  //return;
1368  }
1369 
1370  fgranddaughterID[fNGRANDDAUGHTERS] = gdaughterID;
1372  // NHits associated with this pfParticle
1374  // T0
1375  std::vector<anab::T0> pfdaughterT0vec = pfpUtil.GetPFParticleT0(*gdaughterParticle,evt,fPFParticleTag);
1376  if(!pfdaughterT0vec.empty())
1377  fgranddaughterT0[fNGRANDDAUGHTERS] = pfdaughterT0vec[0].Time();
1378 
1379  if(mcdaughterparticle != 0x0){
1380  fgranddaughter_truth_TrackId[fNGRANDDAUGHTERS] = mcdaughterparticle->TrackId();
1381  fgranddaughter_truth_Pdg[fNGRANDDAUGHTERS] = mcdaughterparticle->PdgCode();
1382  fgranddaughter_truth_Mother[fNGRANDDAUGHTERS] = mcdaughterparticle->Mother();
1383  fgranddaughter_truth_StartPosition[fNGRANDDAUGHTERS][0] = mcdaughterparticle->Vx();
1384  fgranddaughter_truth_StartPosition[fNGRANDDAUGHTERS][1] = mcdaughterparticle->Vy();
1385  fgranddaughter_truth_StartPosition[fNGRANDDAUGHTERS][2] = mcdaughterparticle->Vz();
1386  fgranddaughter_truth_StartPosition[fNGRANDDAUGHTERS][3] = mcdaughterparticle->T();
1387  fgranddaughter_truth_EndPosition[fNGRANDDAUGHTERS][0] = mcdaughterparticle->EndX();
1388  fgranddaughter_truth_EndPosition[fNGRANDDAUGHTERS][1] = mcdaughterparticle->EndY();
1389  fgranddaughter_truth_EndPosition[fNGRANDDAUGHTERS][2] = mcdaughterparticle->EndZ();
1390  fgranddaughter_truth_EndPosition[fNGRANDDAUGHTERS][3] = mcdaughterparticle->EndT();
1391  fgranddaughter_truth_P[fNGRANDDAUGHTERS] = mcdaughterparticle->P();
1392  fgranddaughter_truth_Momentum[fNGRANDDAUGHTERS][0] = mcdaughterparticle->Px();
1393  fgranddaughter_truth_Momentum[fNGRANDDAUGHTERS][1] = mcdaughterparticle->Py();
1394  fgranddaughter_truth_Momentum[fNGRANDDAUGHTERS][2] = mcdaughterparticle->Pz();
1395  fgranddaughter_truth_Momentum[fNGRANDDAUGHTERS][3] = mcdaughterparticle->E();
1396  fgranddaughter_truth_Pt[fNGRANDDAUGHTERS] = mcdaughterparticle->Pt();
1397  fgranddaughter_truth_Mass[fNGRANDDAUGHTERS] = mcdaughterparticle->Mass();
1398  fgranddaughter_truth_EndMomentum[fNGRANDDAUGHTERS][0] = mcdaughterparticle->EndPx();
1399  fgranddaughter_truth_EndMomentum[fNGRANDDAUGHTERS][1] = mcdaughterparticle->EndPy();
1400  fgranddaughter_truth_EndMomentum[fNGRANDDAUGHTERS][2] = mcdaughterparticle->EndPz();
1401  fgranddaughter_truth_EndMomentum[fNGRANDDAUGHTERS][3] = mcdaughterparticle->EndE();
1402  fgranddaughter_truth_Theta[fNGRANDDAUGHTERS] = mcdaughterparticle->Momentum().Theta();
1403  fgranddaughter_truth_Phi[fNGRANDDAUGHTERS] = mcdaughterparticle->Momentum().Phi();
1407  }
1408  else{
1409  if(fVerbose > 0){
1410  std::cout << "INFO::No MCParticle for granddaughter found!" << std::endl;
1411  }
1412  }
1413 
1414  // Increment counter
1415  fNGRANDDAUGHTERS++;
1416 
1417 }
1418 
1419 // -----------------------------------------------------------------------------
1421 
1423  fNTPCs = fGeometry->NTPC();
1425  fNPlanes = fGeometry->Nplanes();
1427  if(fNAPAs > 0)
1429 
1430  fActiveTPCBoundsX[0] = fActiveTPCBoundsY[0] = fActiveTPCBoundsZ[0] = 1000000.0;
1431  fActiveTPCBoundsX[1] = fActiveTPCBoundsY[1] = fActiveTPCBoundsZ[1] = -1000000.0;
1432 
1433  if(fVerbose > 0){
1434  std::cout << "Detector Name: " << fGeometry->DetectorName() << std::endl;
1435  std::cout << "GDML file: " << fGeometry->GDMLFile() << std::endl;
1436  }
1437 
1438  for (geo::TPCGeo const& TPC: fGeometry->IterateTPCs()) {
1439  // get center in world coordinates
1440  double origin[3] = {0.};
1441  double center[3] = {0.};
1442  TPC.LocalToWorld(origin, center);
1443  double tpc[3] = {TPC.HalfWidth(), TPC.HalfHeight(), 0.5*TPC.Length() };
1444  if(center[0] - tpc[0] < fActiveTPCBoundsX[0]) fActiveTPCBoundsX[0] = center[0] - tpc[0];
1445  if(center[0] + tpc[0] > fActiveTPCBoundsX[1]) fActiveTPCBoundsX[1] = center[0] + tpc[0];
1446  if(center[1] - tpc[1] < fActiveTPCBoundsY[0]) fActiveTPCBoundsY[0] = center[1] - tpc[1];
1447  if(center[1] + tpc[1] > fActiveTPCBoundsY[1]) fActiveTPCBoundsY[1] = center[1] + tpc[1];
1448  if(center[2] - tpc[2] < fActiveTPCBoundsZ[0]) fActiveTPCBoundsZ[0] = center[2] - tpc[2];
1449  if(center[2] + tpc[2] > fActiveTPCBoundsZ[1]) fActiveTPCBoundsZ[1] = center[2] + tpc[2];
1450  }
1451 
1452  fConfigTree->Fill();
1453 
1454 }
1455 
1456 // -----------------------------------------------------------------------------
1458 
1460 
1461  // Configuration Tree
1462  fConfigTree = tfs->make<TTree>("Config", "Configuration Tree");
1463  fConfigTree->Branch("NAPAs", &fNAPAs, "NAPAs/I");
1464  fConfigTree->Branch("NChansPerAPA", &fNChansPerAPA, "NChansPerAPA/I");
1465  fConfigTree->Branch("NCryostats", &fNCryostats, "NCryostats/I");
1466  fConfigTree->Branch("NTPCs", &fNTPCs, "NTPCs/I");
1467  fConfigTree->Branch("NChannels", &fNChannels, "NChannels/I");
1468  fConfigTree->Branch("NPlanes", &fNPlanes, "NPlanes/I");
1469  fConfigTree->Branch("ActiveTPCBoundsX", &fActiveTPCBoundsX, "ActiveTPCBoundsX[2]/D");
1470  fConfigTree->Branch("ActiveTPCBoundsY", &fActiveTPCBoundsY, "ActiveTPCBoundsY[2]/D");
1471  fConfigTree->Branch("ActiveTPCBoundsZ", &fActiveTPCBoundsZ, "ActiveTPCBoundsZ[2]/D");
1472 
1473  // Fill configuration tree
1474  FillConfigTree();
1475 
1476  fBeamTrack = tfs->make<TTree>("BeamTrack", "Beam track tree");
1477  fBeamTrack->Branch("run", &fRun, "run/I");
1478  fBeamTrack->Branch("subrun", &fSubRun, "subrun/I");
1479  fBeamTrack->Branch("event", &fevent, "event/I");
1480  fBeamTrack->Branch("beamNTracks", &fbeamNTracks, "beamNTracks/I");
1481  fBeamTrack->Branch("beamtrigger", &fbeamtrigger, "beamtrigger/I");
1482  fBeamTrack->Branch("tof", &ftof, "tof/D");
1483  fBeamTrack->Branch("tof_expElec", &ftof_expElec, "tof_expElec/D");
1484  fBeamTrack->Branch("tof_expMuon", &ftof_expMuon, "tof_expMuon/D");
1485  fBeamTrack->Branch("tof_expPion", &ftof_expPion, "tof_expPion/D");
1486  fBeamTrack->Branch("tof_expKaon", &ftof_expKaon, "tof_expKaon/D");
1487  fBeamTrack->Branch("tof_expProt", &ftof_expProt, "tof_expProt/D");
1488  fBeamTrack->Branch("tof_expDeut", &ftof_expDeut, "tof_expDeut/D");
1489  fBeamTrack->Branch("cerenkovStatus", &fcerenkovStatus, "cerenkovStatus[2]/I");
1490  fBeamTrack->Branch("cerenkovTime", &fcerenkovTime, "cerenkovTime[2]/D");
1491  fBeamTrack->Branch("cerenkovPressure", &fcerenkovPressure, "cerenkovPressure[2]/D");
1492  fBeamTrack->Branch("beamtrackMomentum", &fbeamtrackMomentum, "beamtrackMomentum/D");
1493  fBeamTrack->Branch("beamtrackEnergy", &fbeamtrackEnergy, "beamtrackEnergy/D");
1494  fBeamTrack->Branch("beamtrackPos", &fbeamtrackPos, "beamtrackPos[4]/D");
1495  fBeamTrack->Branch("beamtrackDir", &fbeamtrackDir, "beamtrackDir[3]/D");
1496  fBeamTrack->Branch("BIAndTimingMatched", &fBIAndTimingMatched, "BIAndTimingMatched/I");
1497 
1498  fBeamTrack->Branch("beamtrack_truth_Origin", &fbeamtrack_truth_Origin, "beamtrack_truth_Origin/I");
1499  fBeamTrack->Branch("beamtrackPdg", &fbeamtrackPdg, "beamtrackPdg/I");
1500  fBeamTrack->Branch("beamtrackID", &fbeamtrackID, "beamtrackID/I");
1501  fBeamTrack->Branch("beamtrack_truth_EndPos", &fbeamtrack_truth_EndPos, "beamtrack_truth_EndPos[4]/D");
1502  fBeamTrack->Branch("beamtrack_truth_Momentum", &fbeamtrack_truth_Momentum, "beamtrack_truth_Momentum[4]/D");
1503  fBeamTrack->Branch("beamtrack_truth_KinEnergy", &fbeamtrack_truth_KinEnergy, "beamtrack_truth_KinEnergy/D");
1504  fBeamTrack->Branch("beamtrack_truth_Pt", &fbeamtrack_truth_Pt, "beamtrack_truth_Pt/D");
1505  fBeamTrack->Branch("beamtrack_truth_Mass", &fbeamtrack_truth_Mass, "beamtrack_truth_Mass/D");
1506  fBeamTrack->Branch("beamtrack_truth_Theta", &fbeamtrack_truth_Theta, "beamtrack_truth_Theta/D");
1507  fBeamTrack->Branch("beamtrack_truth_Phi", &fbeamtrack_truth_Phi, "beamtrack_truth_Phi/D");
1508  fBeamTrack->Branch("beamtrack_truth_TotalLength", &fbeamtrack_truth_TotalLength, "beamtrack_truth_TotalLength/D");
1509  fBeamTrack->Branch("beamtrack_truth_Process", &fbeamtrack_truth_Process, "beamtrack_truth_Process/I");
1510  fBeamTrack->Branch("beamtrack_truth_EndProcess", &fbeamtrack_truth_EndProcess, "beamtrack_truth_EndProcess/I");
1511  fBeamTrack->Branch("beamtrack_truth_Pdg", &fbeamtrack_truth_Pdg, "beamtrack_truth_Pdg/I");
1512  fBeamTrack->Branch("beamtrack_truth_NDAUGTHERS", &fbeamtrack_truth_NDAUGTHERS, "beamtrack_truth_NDAUGTHERS/I");
1513  fBeamTrack->Branch("beamtrack_truth_NDECAYDAUGTHERS", &fbeamtrack_truth_NDECAYDAUGTHERS, "beamtrack_truth_NDECAYDAUGTHERS/I");
1514  fBeamTrack->Branch("beamtrack_truth_Pos_InTPCActive", &fbeamtrack_truth_Pos_InTPCActive, "beamtrack_truth_Pos_InTPCActive[4]/D");
1515  fBeamTrack->Branch("beamtrack_truth_Momentum_InTPCActive", &fbeamtrack_truth_Momentum_InTPCActive, "beamtrack_truth_Momentum_InTPCActive[4]/D");
1516  fBeamTrack->Branch("beamtrack_truth_P_InTPCActive", &fbeamtrack_truth_P_InTPCActive, "beamtrack_truth_P_InTPCActive/D");
1517  fBeamTrack->Branch("beamtrack_truth_Pt_InTPCActive", &fbeamtrack_truth_Pt_InTPCActive, "beamtrack_truth_Pt_InTPCActive/D");
1518  fBeamTrack->Branch("beamtrack_truth_Theta_InTPCActive", &fbeamtrack_truth_Theta_InTPCActive, "beamtrack_truth_Theta_InTPCActive/D");
1519  fBeamTrack->Branch("beamtrack_truth_Phi_InTPCActive", &fbeamtrack_truth_Phi_InTPCActive, "beamtrack_truth_Phi_InTPCActive/D");
1520  fBeamTrack->Branch("beamtrack_truth_TotalLength_InTPCActive", &fbeamtrack_truth_TotalLength_InTPCActive, "beamtrack_truth_TotalLength_InTPCActive/D");
1521  fBeamTrack->Branch("beamtrack_truth_KinEnergy_InTPCActive", &fbeamtrack_truth_KinEnergy_InTPCActive, "beamtrack_truth_KinEnergy_InTPCActive/D");
1522 
1523  fBeamTrack->Branch("beamtrack_truthdaughter_TrackId", &fbeamtrack_truthdaughter_TrackId, "beamtrack_truthdaughter_TrackId[beamtrack_truth_NDAUGTHERS]/I");
1524  fBeamTrack->Branch("beamtrack_truthdaughter_Pdg", &fbeamtrack_truthdaughter_Pdg, "beamtrack_truthdaughter_Pdg[beamtrack_truth_NDAUGTHERS]/I");
1525  fBeamTrack->Branch("beamtrack_truthdaughter_Mother", &fbeamtrack_truthdaughter_Mother, "beamtrack_truthdaughter_Mother[beamtrack_truth_NDAUGTHERS]/I");
1526  fBeamTrack->Branch("beamtrack_truthdaughter_StartPosition", &fbeamtrack_truthdaughter_StartPosition, "beamtrack_truthdaughter_StartPosition[beamtrack_truth_NDAUGTHERS][4]/D");
1527  fBeamTrack->Branch("beamtrack_truthdaughter_EndPosition", &fbeamtrack_truthdaughter_EndPosition, "beamtrack_truthdaughter_EndPosition[beamtrack_truth_NDAUGTHERS][4]/D");
1528  fBeamTrack->Branch("beamtrack_truthdaughter_P", &fbeamtrack_truthdaughter_P, "beamtrack_truthdaughter_P[beamtrack_truth_NDAUGTHERS]/D");
1529  fBeamTrack->Branch("beamtrack_truthdaughter_Momentum", &fbeamtrack_truthdaughter_Momentum, "beamtrack_truthdaughter_Momentum[beamtrack_truth_NDAUGTHERS][4]/D");
1530  fBeamTrack->Branch("beamtrack_truthdaughter_EndMomentum", &fbeamtrack_truthdaughter_EndMomentum, "beamtrack_truthdaughter_EndMomentum[beamtrack_truth_NDAUGTHERS][4]/D");
1531  fBeamTrack->Branch("beamtrack_truthdaughter_Pt", &fbeamtrack_truthdaughter_Pt, "beamtrack_truthdaughter_Pt[beamtrack_truth_NDAUGTHERS]/D");
1532  fBeamTrack->Branch("beamtrack_truthdaughter_Mass", &fbeamtrack_truthdaughter_Mass, "beamtrack_truthdaughter_Mass[beamtrack_truth_NDAUGTHERS]/D");
1533  fBeamTrack->Branch("beamtrack_truthdaughter_Theta", &fbeamtrack_truthdaughter_Theta, "beamtrack_truthdaughter_Theta[beamtrack_truth_NDAUGTHERS]/D");
1534  fBeamTrack->Branch("beamtrack_truthdaughter_Phi", &fbeamtrack_truthdaughter_Phi, "beamtrack_truthdaughter_Phi[beamtrack_truth_NDAUGTHERS]/D");
1535  fBeamTrack->Branch("beamtrack_truthdaughter_TotalLength", &fbeamtrack_truthdaughter_TotalLength, "beamtrack_truthdaughter_TotalLength[beamtrack_truth_NDAUGTHERS]/D");
1536  fBeamTrack->Branch("beamtrack_truthdaughter_Process", &fbeamtrack_truthdaughter_Process, "beamtrack_truthdaughter_Process[beamtrack_truth_NDAUGTHERS]/I");
1537  fBeamTrack->Branch("beamtrack_truthdaughter_EndProcess", &fbeamtrack_truthdaughter_EndProcess, "beamtrack_truthdaughter_EndProcess[beamtrack_truth_NDAUGTHERS]/I");
1538 
1539  fBeamTrack->Branch("beamtrack_truthdecaydaughter_TrackId", &fbeamtrack_truthdecaydaughter_TrackId, "beamtrack_truthdecaydaughter_TrackId[beamtrack_truth_NDECAYDAUGTHERS]/I");
1540  fBeamTrack->Branch("beamtrack_truthdecaydaughter_Pdg", &fbeamtrack_truthdecaydaughter_Pdg, "beamtrack_truthdecaydaughter_Pdg[beamtrack_truth_NDECAYDAUGTHERS]/I");
1541  fBeamTrack->Branch("beamtrack_truthdecaydaughter_Mother", &fbeamtrack_truthdecaydaughter_Mother, "beamtrack_truthdecaydaughter_Mother[beamtrack_truth_NDECAYDAUGTHERS]/I");
1542  fBeamTrack->Branch("beamtrack_truthdecaydaughter_StartPosition", &fbeamtrack_truthdecaydaughter_StartPosition, "beamtrack_truthdecaydaughter_StartPosition[beamtrack_truth_NDECAYDAUGTHERS][4]/D");
1543  fBeamTrack->Branch("beamtrack_truthdecaydaughter_EndPosition", &fbeamtrack_truthdecaydaughter_EndPosition, "beamtrack_truthdecaydaughter_EndPosition[beamtrack_truth_NDECAYDAUGTHERS][4]/D");
1544  fBeamTrack->Branch("beamtrack_truthdecaydaughter_P", &fbeamtrack_truthdecaydaughter_P, "beamtrack_truthdecaydaughter_P[beamtrack_truth_NDECAYDAUGTHERS]/D");
1545  fBeamTrack->Branch("beamtrack_truthdecaydaughter_Momentum", &fbeamtrack_truthdecaydaughter_Momentum, "beamtrack_truthdecaydaughter_Momentum[beamtrack_truth_NDECAYDAUGTHERS][4]/D");
1546  fBeamTrack->Branch("beamtrack_truthdecaydaughter_EndMomentum", &fbeamtrack_truthdecaydaughter_EndMomentum, "beamtrack_truthdecaydaughter_EndMomentum[beamtrack_truth_NDECAYDAUGTHERS][4]/D");
1547  fBeamTrack->Branch("beamtrack_truthdecaydaughter_Pt", &fbeamtrack_truthdecaydaughter_Pt, "beamtrack_truthdecaydaughter_Pt[beamtrack_truth_NDECAYDAUGTHERS]/D");
1548  fBeamTrack->Branch("beamtrack_truthdecaydaughter_Mass", &fbeamtrack_truthdecaydaughter_Mass, "beamtrack_truthdecaydaughter_Mass[beamtrack_truth_NDECAYDAUGTHERS]/D");
1549  fBeamTrack->Branch("beamtrack_truthdecaydaughter_Theta", &fbeamtrack_truthdecaydaughter_Theta, "beamtrack_truthdecaydaughter_Theta[beamtrack_truth_NDECAYDAUGTHERS]/D");
1550  fBeamTrack->Branch("beamtrack_truthdecaydaughter_Phi", &fbeamtrack_truthdecaydaughter_Phi, "beamtrack_truthdecaydaughter_Phi[beamtrack_truth_NDECAYDAUGTHERS]/D");
1551  fBeamTrack->Branch("beamtrack_truthdecaydaughter_TotalLength", &fbeamtrack_truthdecaydaughter_TotalLength, "beamtrack_truthdecaydaughter_TotalLength[beamtrack_truth_NDECAYDAUGTHERS]/D");
1552  fBeamTrack->Branch("beamtrack_truthdecaydaughter_Process", &fbeamtrack_truthdecaydaughter_Process, "beamtrack_truthdecaydaughter_Process[beamtrack_truth_NDECAYDAUGTHERS]/I");
1553  fBeamTrack->Branch("beamtrack_truthdecaydaughter_EndProcess", &fbeamtrack_truthdecaydaughter_EndProcess, "beamtrack_truthdecaydaughter_EndProcess[beamtrack_truth_NDECAYDAUGTHERS]/I");
1554 
1555  // Analysis tree
1556  fPandoraBeam = tfs->make<TTree>("ReconstructedBeamEvents", "Reconstructed Beam events");
1557  fPandoraBeam->Branch("run", &fRun, "run/I");
1558  fPandoraBeam->Branch("subrun", &fSubRun, "subrun/I");
1559  fPandoraBeam->Branch("event", &fevent, "event/I");
1560  fPandoraBeam->Branch("timestamp", &fTimeStamp, "timestamp/D");
1561  fPandoraBeam->Branch("Nactivefembs", &fNactivefembs, "Nactivefembs[5]/I");
1562  fPandoraBeam->Branch("NpfParticles", &fNpfParticles, "NpfParticles/I");
1563  fPandoraBeam->Branch("primaryEarliestHitPeakTim", &fprimaryEarliestHitPeakTime, "primaryEarliestHitPeakTim/D");
1564  fPandoraBeam->Branch("primaryVertex", &fprimaryVertex, "primaryVertex[3]/D");
1565  fPandoraBeam->Branch("primaryIstrack", &fprimaryIstrack, "primaryIstrack/I");
1566  fPandoraBeam->Branch("primaryIsshower", &fprimaryIsshower, "primaryIsshower/I");
1567  fPandoraBeam->Branch("primaryBDTScore", &fprimaryBDTScore, "primaryBDTScore/D");
1568  fPandoraBeam->Branch("primaryNHits", &fprimaryNHits, "primaryNHits/I");
1569  fPandoraBeam->Branch("primaryTheta", &fprimaryTheta, "primaryTheta/D");
1570  fPandoraBeam->Branch("primaryPhi", &fprimaryPhi, "primaryPhi/D");
1571  fPandoraBeam->Branch("primaryLength", &fprimaryLength, "primaryLength/D");
1572  fPandoraBeam->Branch("primaryMomentum", &fprimaryMomentum, "primaryMomentum/D");
1573  fPandoraBeam->Branch("primaryEndMomentum", &fprimaryEndMomentum, "primaryEndMomentum/D");
1574  fPandoraBeam->Branch("primaryEndPosition", &fprimaryEndPosition, "primaryEndPosition[3]/D");
1575  fPandoraBeam->Branch("primaryStartPosition", &fprimaryStartPosition, "primaryStartPosition[3]/D");
1576  fPandoraBeam->Branch("primaryEndDirection", &fprimaryEndDirection, "primaryEndDirection[3]/D");
1577  fPandoraBeam->Branch("primaryStartDirection", &fprimaryStartDirection, "primaryStartDirection[3]/D");
1578  fPandoraBeam->Branch("primaryOpeningAngle", &fprimaryOpeningAngle, "primaryOpeningAngle/D");
1579  fPandoraBeam->Branch("primaryID", &fprimaryID, "primaryID/I");
1580  fPandoraBeam->Branch("primaryShowerBestPlane", &fprimaryShowerBestPlane, "primaryShowerBestPlane/I");
1581  fPandoraBeam->Branch("primaryShowerEnergy", &fprimaryShowerEnergy, "primaryShowerEnergy[3]/I");
1582  fPandoraBeam->Branch("primaryShowerMIPEnergy", &fprimaryShowerMIPEnergy, "primaryShowerMIPEnergy[3]/I");
1583  fPandoraBeam->Branch("primaryShowerdEdx", &fprimaryShowerdEdx, "primaryShowerdEdx[3]/I");
1584  fPandoraBeam->Branch("primaryMomentumByRangeProton", &fprimaryMomentumByRangeProton, "primaryMomentumByRangeProton/D");
1585  fPandoraBeam->Branch("primaryMomentumByRangeMuon", &fprimaryMomentumByRangeMuon, "primaryMomentumByRangeMuon/D");
1586  fPandoraBeam->Branch("primaryKineticEnergy", &fprimaryKineticEnergy, "primaryKineticEnergy[3]/D");
1587  fPandoraBeam->Branch("primaryRange", &fprimaryRange, "primaryRange[3]/D");
1588  fPandoraBeam->Branch("primaryTrkPitchC", &fprimaryTrkPitchC, "primaryTrkPitchC[3]/D");
1589  fPandoraBeam->Branch("primaryT0", &fprimaryT0, "primaryT0/D");
1590  fPandoraBeam->Branch("primaryPID_Pdg", &fprimaryPID_Pdg, "primaryPID_Pdg[3]/I");
1591  fPandoraBeam->Branch("primaryPID_Ndf", &fprimaryPID_Ndf, "primaryPID_Ndf[3]/I");
1592  fPandoraBeam->Branch("primaryPID_MinChi2", &fprimaryPID_MinChi2, "primaryPID_MinChi2[3]/D");
1593  fPandoraBeam->Branch("primaryPID_DeltaChi2", &fprimaryPID_DeltaChi2, "primaryPID_DeltaChi2[3]/D");
1594  fPandoraBeam->Branch("primaryPID_Chi2Proton", &fprimaryPID_Chi2Proton, "primaryPID_Chi2Proton[3]/D");
1595  fPandoraBeam->Branch("primaryPID_Chi2Kaon", &fprimaryPID_Chi2Kaon, "primaryPID_Chi2Kaon[3]/D");
1596  fPandoraBeam->Branch("primaryPID_Chi2Pion", &fprimaryPID_Chi2Pion, "primaryPID_Chi2Pion[3]/D");
1597  fPandoraBeam->Branch("primaryPID_Chi2Muon", &fprimaryPID_Chi2Muon, "primaryPID_Chi2Muon[3]/D");
1598  fPandoraBeam->Branch("primaryPID_MissingE", &fprimaryPID_MissingE, "primaryPID_MissingE[3]/D");
1599  fPandoraBeam->Branch("primaryPID_MissingEavg", &fprimaryPID_MissingEavg, "primaryPID_MissingEavg[3]/D");
1600  fPandoraBeam->Branch("primaryPID_PIDA", &fprimaryPID_PIDA, "primaryPID_PIDA[3]/D");
1601 
1602  fPandoraBeam->Branch("primary_truth_Origin", &fprimary_truth_Origin, "primary_truth_Origin/I");
1603  fPandoraBeam->Branch("primary_truth_TrackId", &fprimary_truth_TrackId, "primary_truth_TrackId/I");
1604  fPandoraBeam->Branch("primary_truth_Pdg", &fprimary_truth_Pdg, "primary_truth_Pdg/I");
1605  fPandoraBeam->Branch("primary_truth_Mother", &fprimary_truth_Mother, "primary_truth_Mother/I");
1606  fPandoraBeam->Branch("primary_truth_StartPosition", &fprimary_truth_StartPosition, "primary_truth_StartPosition[4]/D");
1607  fPandoraBeam->Branch("primary_truth_EndPosition", &fprimary_truth_EndPosition, "primary_truth_EndPosition[4]/D");
1608  fPandoraBeam->Branch("primary_truth_Momentum", &fprimary_truth_Momentum, "primary_truth_Momentum[4]/D");
1609  fPandoraBeam->Branch("primary_truth_EndMomentum", &fprimary_truth_EndMomentum, "primary_truth_EndMomentum[4]/D");
1610  fPandoraBeam->Branch("primary_truth_P", &fprimary_truth_P, "primary_truth_P/D");
1611  fPandoraBeam->Branch("primary_truth_Pt", &fprimary_truth_Pt, "primary_truth_Pt/D");
1612  fPandoraBeam->Branch("primary_truth_Mass", &fprimary_truth_Mass, "primary_truth_Mass/D");
1613  fPandoraBeam->Branch("primary_truth_Theta", &fprimary_truth_Theta, "primary_truth_Theta/D");
1614  fPandoraBeam->Branch("primary_truth_Phi", &fprimary_truth_Phi, "primary_truth_Phi/D");
1615  fPandoraBeam->Branch("primary_truth_TotalLength", &fprimary_truth_TotalLength, "primary_truth_TotalLength/D");
1616  fPandoraBeam->Branch("primary_truth_Process", &fprimary_truth_Process, "primary_truth_Process/I");
1617  fPandoraBeam->Branch("primary_truth_EndProcess", &fprimary_truth_EndProcess, "primary_truth_EndProcess/I");
1618  fPandoraBeam->Branch("primary_truth_Isbeammatched", &fprimary_truth_Isbeammatched, "primary_truth_Isbeammatched/I");
1619 
1620  fPandoraBeam->Branch("primary_truth_EkinAtVertex_notcorrected", &fprimary_truth_EkinAtVertex_notcorrected, "primary_truth_EkinAtVertex_notcorrected/D");
1621  fPandoraBeam->Branch("primary_truth_EkinAtVertex", &fprimary_truth_EkinAtVertex, "primary_truth_EkinAtVertex/D");
1622  fPandoraBeam->Branch("primary_truth_Pos_InTPCActive", &fprimary_truth_Pos_InTPCActive, "primary_truth_Pos_InTPCActive[4]/D");
1623  fPandoraBeam->Branch("primary_truth_Momentum_InTPCActive", &fprimary_truth_Momentum_InTPCActive, "primary_truth_Momentum_InTPCActive[4]/D");
1624  fPandoraBeam->Branch("primary_truth_P_InTPCActive", &fprimary_truth_P_InTPCActive, "primary_truth_P_InTPCActive/D");
1625  fPandoraBeam->Branch("primary_truth_Pt_InTPCActive", &fprimary_truth_Pt_InTPCActive, "primary_truth_Pt_InTPCActive/D");
1626  fPandoraBeam->Branch("primary_truth_Theta_InTPCActive", &fprimary_truth_Theta_InTPCActive, "primary_truth_Theta_InTPCActive/D");
1627  fPandoraBeam->Branch("primary_truth_Phi_InTPCActive", &fprimary_truth_Phi_InTPCActive, "primary_truth_Phi_InTPCActive/D");
1628  fPandoraBeam->Branch("primary_truth_TotalLength_InTPCActive", &fprimary_truth_TotalLength_InTPCActive, "primary_truth_TotalLength_InTPCActive/D");
1629  fPandoraBeam->Branch("primary_truth_KinEnergy_InTPCActive", &fprimary_truth_KinEnergy_InTPCActive, "primary_truth_KinEnergy_InTPCActive/D");
1630 
1631  fPandoraBeam->Branch("primary_truth_NDAUGTHERS", &fprimary_truth_NDAUGTHERS, "primary_truth_NDAUGTHERS/I");
1632  fPandoraBeam->Branch("primary_truth_NDECAYDAUGTHERS", &fprimary_truth_NDECAYDAUGTHERS, "primary_truth_NDECAYDAUGTHERS/I");
1633  fPandoraBeam->Branch("primary_truthdaughter_TrackId", &fprimary_truthdaughter_TrackId, "primary_truthdaughter_TrackId[primary_truth_NDAUGTHERS]/I");
1634  fPandoraBeam->Branch("primary_truthdaughter_Pdg", &fprimary_truthdaughter_Pdg, "primary_truthdaughter_Pdg[primary_truth_NDAUGTHERS]/I");
1635  fPandoraBeam->Branch("primary_truthdaughter_Mother", &fprimary_truthdaughter_Mother, "primary_truthdaughter_Mother[primary_truth_NDAUGTHERS]/I");
1636  fPandoraBeam->Branch("primary_truthdaughter_StartPosition", &fprimary_truthdaughter_StartPosition, "primary_truthdaughter_StartPosition[primary_truth_NDAUGTHERS][4]/D");
1637  fPandoraBeam->Branch("primary_truthdaughter_EndPosition", &fprimary_truthdaughter_EndPosition, "primary_truthdaughter_EndPosition[primary_truth_NDAUGTHERS][4]/D");
1638  fPandoraBeam->Branch("primary_truthdaughter_P", &fprimary_truthdaughter_P, "primary_truthdaughter_P[primary_truth_NDAUGTHERS]/D");
1639  fPandoraBeam->Branch("primary_truthdaughter_Momentum", &fprimary_truthdaughter_Momentum, "primary_truthdaughter_Momentum[primary_truth_NDAUGTHERS][4]/D");
1640  fPandoraBeam->Branch("primary_truthdaughter_EndMomentum", &fprimary_truthdaughter_EndMomentum, "primary_truthdaughter_EndMomentum[primary_truth_NDAUGTHERS][4]/D");
1641  fPandoraBeam->Branch("primary_truthdaughter_Pt", &fprimary_truthdaughter_Pt, "primary_truthdaughter_Pt[primary_truth_NDAUGTHERS]/D");
1642  fPandoraBeam->Branch("primary_truthdaughter_Mass", &fprimary_truthdaughter_Mass, "primary_truthdaughter_Mass[primary_truth_NDAUGTHERS]/D");
1643  fPandoraBeam->Branch("primary_truthdaughter_Theta", &fprimary_truthdaughter_Theta, "primary_truthdaughter_Theta[primary_truth_NDAUGTHERS]/D");
1644  fPandoraBeam->Branch("primary_truthdaughter_Phi", &fprimary_truthdaughter_Phi, "primary_truthdaughter_Phi[primary_truth_NDAUGTHERS]/D");
1645  fPandoraBeam->Branch("primary_truthdaughter_TotalLength", &fprimary_truthdaughter_TotalLength, "primary_truthdaughter_TotalLength[primary_truth_NDAUGTHERS]/D");
1646  fPandoraBeam->Branch("primary_truthdaughter_Process", &fprimary_truthdaughter_Process, "primary_truthdaughter_Process[primary_truth_NDAUGTHERS]/I");
1647  fPandoraBeam->Branch("primary_truthdaughter_EndProcess", &fprimary_truthdaughter_EndProcess, "primary_truthdaughter_EndProcess[primary_truth_NDAUGTHERS]/I");
1648 
1649  fPandoraBeam->Branch("primary_truthdecaydaughter_TrackId", &fprimary_truthdecaydaughter_TrackId, "primary_truthdecaydaughter_TrackId[primary_truth_NDAUGTHERS]/I");
1650  fPandoraBeam->Branch("primary_truthdecaydaughter_Pdg", &fprimary_truthdecaydaughter_Pdg, "primary_truthdecaydaughter_Pdg[primary_truth_NDAUGTHERS]/I");
1651  fPandoraBeam->Branch("primary_truthdecaydaughter_Mother", &fprimary_truthdecaydaughter_Mother, "primary_truthdecaydaughter_Mother[primary_truth_NDAUGTHERS]/I");
1652  fPandoraBeam->Branch("primary_truthdecaydaughter_StartPosition", &fprimary_truthdecaydaughter_StartPosition, "primary_truthdecaydaughter_StartPosition[primary_truth_NDAUGTHERS][4]/D");
1653  fPandoraBeam->Branch("primary_truthdecaydaughter_EndPosition", &fprimary_truthdecaydaughter_EndPosition, "primary_truthdecaydaughter_EndPosition[primary_truth_NDAUGTHERS][4]/D");
1654  fPandoraBeam->Branch("primary_truthdecaydaughter_P", &fprimary_truthdecaydaughter_P, "primary_truthdecaydaughter_P[primary_truth_NDAUGTHERS]/D");
1655  fPandoraBeam->Branch("primary_truthdecaydaughter_Momentum", &fprimary_truthdecaydaughter_Momentum, "primary_truthdecaydaughter_Momentum[primary_truth_NDAUGTHERS][4]/D");
1656  fPandoraBeam->Branch("primary_truthdecaydaughter_EndMomentum", &fprimary_truthdecaydaughter_EndMomentum, "primary_truthdecaydaughter_EndMomentum[primary_truth_NDAUGTHERS][4]/D");
1657  fPandoraBeam->Branch("primary_truthdecaydaughter_Pt", &fprimary_truthdecaydaughter_Pt, "primary_truthdecaydaughter_Pt[primary_truth_NDAUGTHERS]/D");
1658  fPandoraBeam->Branch("primary_truthdecaydaughter_Mass", &fprimary_truthdecaydaughter_Mass, "primary_truthdecaydaughter_Mass[primary_truth_NDAUGTHERS]/D");
1659  fPandoraBeam->Branch("primary_truthdecaydaughter_Theta", &fprimary_truthdecaydaughter_Theta, "primary_truthdecaydaughter_Theta[primary_truth_NDAUGTHERS]/D");
1660  fPandoraBeam->Branch("primary_truthdecaydaughter_Phi", &fprimary_truthdecaydaughter_Phi, "primary_truthdecaydaughter_Phi[primary_truth_NDAUGTHERS]/D");
1661  fPandoraBeam->Branch("primary_truthdecaydaughter_TotalLength", &fprimary_truthdecaydaughter_TotalLength, "primary_truthdecaydaughter_TotalLength[primary_truth_NDAUGTHERS]/D");
1662  fPandoraBeam->Branch("primary_truthdecaydaughter_Process", &fprimary_truthdecaydaughter_Process, "primary_truthdecaydaughter_Process[primary_truth_NDAUGTHERS]/I");
1663  fPandoraBeam->Branch("primary_truthdecaydaughter_EndProcess", &fprimary_truthdecaydaughter_EndProcess, "primary_truthdecaydaughter_EndProcess[primary_truth_NDAUGTHERS]/I");
1664 
1665  fDaughterTree = tfs->make<TTree>("ReconstructedDaughters", "Reconstructed Daughters");
1666  fDaughterTree->Branch("NDAUGHTERS", &fNDAUGHTERS, "NDAUGHTERS/I");
1667  fDaughterTree->Branch("daughterVertex", &fdaughterVertex, "daughterVertex[3]/D");
1668  fDaughterTree->Branch("daughterIstrack", &fdaughterIstrack, "daughterIstrack[NDAUGHTERS]/I");
1669  fDaughterTree->Branch("daughterIsshower", &fdaughterIsshower, "daughterIsshower[NDAUGHTERS]/I");
1670  fDaughterTree->Branch("daughterNHits", &fdaughterNHits, "daughterNHits[NDAUGHTERS]/I");
1671  fDaughterTree->Branch("daughterTheta", &fdaughterTheta, "daughterTheta[NDAUGHTERS]/D");
1672  fDaughterTree->Branch("daughterPhi", &fdaughterPhi, "daughterPhi[NDAUGHTERS]/D");
1673  fDaughterTree->Branch("daughterLength", &fdaughterLength, "daughterLength[NDAUGHTERS]/D");
1674  fDaughterTree->Branch("daughterMomentum", &fdaughterMomentum, "daughterMomentum[NDAUGHTERS]/D");
1675  fDaughterTree->Branch("daughterEndMomentum", &fdaughterEndMomentum, "daughterEndMomentum[NDAUGHTERS]/D");
1676  fDaughterTree->Branch("daughterEndPosition", &fdaughterEndPosition, "daughterEndPosition[NDAUGHTERS][3]/D");
1677  fDaughterTree->Branch("daughterStartPosition", &fdaughterStartPosition, "daughterStartPosition[NDAUGHTERS][3]/D");
1678  fDaughterTree->Branch("daughterStartDirection", &fdaughterStartDirection, "daughterStartDirection[NDAUGHTERS][3]/D");
1679  fDaughterTree->Branch("daughterEndDirection", &fdaughterEndDirection, "daughterEndDirection[NDAUGHTERS][3]/D");
1680  fDaughterTree->Branch("daughterOpeningAngle", &fdaughterOpeningAngle, "daughterOpeningAngle[NDAUGHTERS]/D");
1681  fDaughterTree->Branch("daughterShowerBestPlane", &fdaughterShowerBestPlane, "daughterShowerBestPlane[NDAUGHTERS]/I");
1682  fDaughterTree->Branch("daughterShowerEnergy", &fdaughterShowerEnergy, "daughterShowerEnergy[NDAUGHTERS][3]/D");
1683  fDaughterTree->Branch("daughterShowerMIPEnergy", &fdaughterShowerMIPEnergy, "daughterShowerMIPEnergy[NDAUGHTERS][3]/D");
1684  fDaughterTree->Branch("daughterShowerdEdx", &fdaughterShowerdEdx, "daughterShowerdEdx[NDAUGHTERS][3]/D");
1685  fDaughterTree->Branch("daughterMomentumByRangeProton", &fdaughterMomentumByRangeProton, "daughterMomentumByRangeProton[NDAUGHTERS]/D");
1686  fDaughterTree->Branch("daughterMomentumByRangeMuon", &fdaughterMomentumByRangeMuon, "daughterMomentumByRangeMuon[NDAUGHTERS]/D");
1687  fDaughterTree->Branch("daughterKineticEnergy", &fdaughterKineticEnergy, "daughterKineticEnergy[NDAUGHTERS][3]/D");
1688  fDaughterTree->Branch("daughterRange", &fdaughterRange, "daughterRange[NDAUGHTERS][3]/D");
1689  fDaughterTree->Branch("daughterTrkPitchC", &fdaughterTrkPitchC, "daughterTrkPitchC[NDAUGHTERS][3]/D");
1690  fDaughterTree->Branch("daughterID", &fdaughterID, "daughterID[NDAUGHTERS]/I");
1691  fDaughterTree->Branch("daughterT0", &fdaughterT0, "daughterT0[NDAUGHTERS]/D");
1692 
1693  fDaughterTree->Branch("daughterPID_Pdg", &fdaughterPID_Pdg, "daughterPID_Pdg[NDAUGHTERS][3]/I");
1694  fDaughterTree->Branch("daughterPID_Ndf", &fdaughterPID_Ndf, "daughterPID_Ndf[NDAUGHTERS][3]/I");
1695  fDaughterTree->Branch("daughterPID_MinChi2", &fdaughterPID_MinChi2, "daughterPID_MinChi2[NDAUGHTERS][3]/D");
1696  fDaughterTree->Branch("daughterPID_DeltaChi2", &fdaughterPID_DeltaChi2, "daughterPID_DeltaChi2[NDAUGHTERS][3]/D");
1697  fDaughterTree->Branch("daughterPID_Chi2Proton", &fdaughterPID_Chi2Proton, "daughterPID_Chi2Proton[NDAUGHTERS][3]/D");
1698  fDaughterTree->Branch("daughterPID_Chi2Kaon", &fdaughterPID_Chi2Kaon, "daughterPID_Chi2Kaon[NDAUGHTERS][3]/D");
1699  fDaughterTree->Branch("daughterPID_Chi2Pion", &fdaughterPID_Chi2Pion, "daughterPID_Chi2Pion[NDAUGHTERS][3]/D");
1700  fDaughterTree->Branch("daughterPID_Chi2Muon", &fdaughterPID_Chi2Muon, "daughterPID_Chi2Muon[NDAUGHTERS][3]/D");
1701  fDaughterTree->Branch("daughterPID_MissingE", &fdaughterPID_MissingE, "daughterPID_MissingE[NDAUGHTERS][3]/D");
1702  fDaughterTree->Branch("daughterPID_MissingEavg", &fdaughterPID_MissingEavg, "daughterPID_MissingEavg[NDAUGHTERS][3]/D");
1703  fDaughterTree->Branch("daughterPID_PIDA", &fdaughterPID_PIDA, "daughterPID_PIDA[NDAUGHTERS][3]/D");
1704 
1705  fDaughterTree->Branch("daughter_truth_TrackId", &fdaughter_truth_TrackId, "daughter_truth_TrackId[NDAUGHTERS]/I");
1706  fDaughterTree->Branch("daughter_truth_Pdg", &fdaughter_truth_Pdg, "daughter_truth_Pdg[NDAUGHTERS]/I");
1707  fDaughterTree->Branch("daughter_truth_Mother", &fdaughter_truth_Mother, "daughter_truth_Mother[NDAUGHTERS]/I");
1708  fDaughterTree->Branch("daughter_truth_StartPosition", &fdaughter_truth_StartPosition, "daughter_truth_StartPosition[NDAUGHTERS][4]/D");
1709  fDaughterTree->Branch("daughter_truth_EndPosition", &fdaughter_truth_EndPosition, "daughter_truth_EndPosition[NDAUGHTERS][4]/D");
1710  fDaughterTree->Branch("daughter_truth_Momentum", &fdaughter_truth_Momentum, "daughter_truth_Momentum[NDAUGHTERS][4]/D");
1711  fDaughterTree->Branch("daughter_truth_EndMomentum", &fdaughter_truth_EndMomentum, "daughter_truth_EndMomentum[NDAUGHTERS][4]/D");
1712  fDaughterTree->Branch("daughter_truth_P", &fdaughter_truth_P, "daughter_truth_P[NDAUGHTERS]/D");
1713  fDaughterTree->Branch("daughter_truth_Pt", &fdaughter_truth_Pt, "daughter_truth_Pt[NDAUGHTERS]/D");
1714  fDaughterTree->Branch("daughter_truth_Mass", &fdaughter_truth_Mass, "daughter_truth_Mass[NDAUGHTERS]/D");
1715  fDaughterTree->Branch("daughter_truth_Theta", &fdaughter_truth_Theta, "daughter_truth_Theta[NDAUGHTERS]/D");
1716  fDaughterTree->Branch("daughter_truth_Phi", &fdaughter_truth_Phi, "daughter_truth_Phi[NDAUGHTERS]/D");
1717  fDaughterTree->Branch("daughter_truth_TotalLength", &fdaughter_truth_TotalLength, "daughter_truth_TotalLength[NDAUGHTERS]/D");
1718  fDaughterTree->Branch("daughter_truth_Process", &fdaughter_truth_Process, "daughter_truth_Process[NDAUGHTERS]/I");
1719  fDaughterTree->Branch("daughter_truth_EndProcess", &fdaughter_truth_EndProcess, "daughter_truth_EndProcess[NDAUGHTERS]/I");
1720 
1721  fGrandDaughterTree = tfs->make<TTree>("ReconstructedGrandDaughters", "Reconstructed GrandDaughters");
1722  fGrandDaughterTree->Branch("NDAUGHTERS", &fNDAUGHTERS, "NDAUGHTERS/I");
1723  fGrandDaughterTree->Branch("NGRANDDAUGHTERS", &fNGRANDDAUGHTERS, "NGRANDDAUGHTERS/I");
1724  fGrandDaughterTree->Branch("granddaughterVertex", &fgranddaughterVertex, "granddaughterVertex[NDAUGHTERS][3]/D");
1725  fGrandDaughterTree->Branch("granddaughterIstrack", &fgranddaughterIstrack, "granddaughterIstrack[NGRANDDAUGHTERS]/I");
1726  fGrandDaughterTree->Branch("granddaughterIsshower", &fgranddaughterIsshower, "granddaughterIsshower[NGRANDDAUGHTERS]/I");
1727  fGrandDaughterTree->Branch("granddaughterNHits", &fgranddaughterNHits, "granddaughterNHits[NGRANDDAUGHTERS]/I");
1728  fGrandDaughterTree->Branch("granddaughterTheta", &fgranddaughterTheta, "granddaughterTheta[NGRANDDAUGHTERS]/D");
1729  fGrandDaughterTree->Branch("granddaughterPhi", &fgranddaughterPhi, "granddaughterPhi[NGRANDDAUGHTERS]/D");
1730  fGrandDaughterTree->Branch("granddaughterLength", &fgranddaughterLength, "granddaughterLength[NGRANDDAUGHTERS]/D");
1731  fGrandDaughterTree->Branch("granddaughterMomentum", &fgranddaughterMomentum, "granddaughterMomentum[NGRANDDAUGHTERS]/D");
1732  fGrandDaughterTree->Branch("granddaughterEndMomentum", &fgranddaughterEndMomentum, "granddaughterEndMomentum[NGRANDDAUGHTERS]/D");
1733  fGrandDaughterTree->Branch("granddaughterEndPosition", &fgranddaughterEndPosition, "granddaughterEndPosition[NGRANDDAUGHTERS][3]/D");
1734  fGrandDaughterTree->Branch("granddaughterStartPosition", &fgranddaughterStartPosition, "granddaughterStartPosition[NGRANDDAUGHTERS][3]/D");
1735  fGrandDaughterTree->Branch("granddaughterStartDirection", &fgranddaughterStartDirection, "granddaughterStartDirection[NGRANDDAUGHTERS][3]/D");
1736  fGrandDaughterTree->Branch("granddaughterEndDirection", &fgranddaughterEndDirection, "granddaughterEndDirection[NGRANDDAUGHTERS][3]/D");
1737  fGrandDaughterTree->Branch("granddaughterOpeningAngle", &fgranddaughterOpeningAngle, "granddaughterOpeningAngle[NGRANDDAUGHTERS]/D");
1738  fGrandDaughterTree->Branch("granddaughterShowerBestPlane", &fgranddaughterShowerBestPlane, "granddaughterShowerBestPlane[NGRANDDAUGHTERS]/I");
1739  fGrandDaughterTree->Branch("granddaughterShowerEnergy", &fgranddaughterShowerEnergy, "granddaughterShowerEnergy[NGRANDDAUGHTERS][3]/D");
1740  fGrandDaughterTree->Branch("granddaughterShowerMIPEnergy", &fgranddaughterShowerMIPEnergy, "granddaughterShowerMIPEnergy[NGRANDDAUGHTERS][3]/D");
1741  fGrandDaughterTree->Branch("granddaughterShowerdEdx", &fgranddaughterShowerdEdx, "granddaughterShowerdEdx[NGRANDDAUGHTERS][3]/D");
1742  fGrandDaughterTree->Branch("granddaughterMomentumByRangeProton", &fgranddaughterMomentumByRangeProton, "granddaughterMomentumByRangeProton[NGRANDDAUGHTERS]/D");
1743  fGrandDaughterTree->Branch("granddaughterMomentumByRangeMuon", &fgranddaughterMomentumByRangeMuon, "granddaughterMomentumByRangeMuon[NGRANDDAUGHTERS]/D");
1744  fGrandDaughterTree->Branch("granddaughterKineticEnergy", &fgranddaughterKineticEnergy, "granddaughterKineticEnergy[NGRANDDAUGHTERS][3]/D");
1745  fGrandDaughterTree->Branch("granddaughterRange", &fgranddaughterRange, "granddaughterRange[NGRANDDAUGHTERS][3]/D");
1746  fGrandDaughterTree->Branch("granddaughterTrkPitchC", &fgranddaughterTrkPitchC, "granddaughterTrkPitchC[NGRANDDAUGHTERS][3]/D");
1747  fGrandDaughterTree->Branch("granddaughterID", &fgranddaughterID, "granddaughterID[NGRANDDAUGHTERS]/I");
1748  fGrandDaughterTree->Branch("granddaughterMotherID", &fgranddaughterMotherID, "granddaughterMotherID[NGRANDDAUGHTERS]/I");
1749  fGrandDaughterTree->Branch("granddaughterT0", &fgranddaughterT0, "granddaughterT0[NGRANDDAUGHTERS]/D");
1750 
1751  fGrandDaughterTree->Branch("granddaughterPID_Pdg", &fgranddaughterPID_Pdg, "granddaughterPID_Pdg[NGRANDDAUGHTERS][3]/I");
1752  fGrandDaughterTree->Branch("granddaughterPID_Ndf", &fgranddaughterPID_Ndf, "granddaughterPID_Ndf[NGRANDDAUGHTERS][3]/I");
1753  fGrandDaughterTree->Branch("granddaughterPID_MinChi2", &fgranddaughterPID_MinChi2, "granddaughterPID_MinChi2[NGRANDDAUGHTERS][3]/D");
1754  fGrandDaughterTree->Branch("granddaughterPID_DeltaChi2", &fgranddaughterPID_DeltaChi2, "granddaughterPID_DeltaChi2[NGRANDDAUGHTERS][3]/D");
1755  fGrandDaughterTree->Branch("granddaughterPID_Chi2Proton", &fgranddaughterPID_Chi2Proton, "granddaughterPID_Chi2Proton[NGRANDDAUGHTERS][3]/D");
1756  fGrandDaughterTree->Branch("granddaughterPID_Chi2Kaon", &fgranddaughterPID_Chi2Kaon, "granddaughterPID_Chi2Kaon[NGRANDDAUGHTERS][3]/D");
1757  fGrandDaughterTree->Branch("granddaughterPID_Chi2Pion", &fgranddaughterPID_Chi2Pion, "granddaughterPID_Chi2Pion[NGRANDDAUGHTERS][3]/D");
1758  fGrandDaughterTree->Branch("granddaughterPID_Chi2Muon", &fgranddaughterPID_Chi2Muon, "granddaughterPID_Chi2Muon[NGRANDDAUGHTERS][3]/D");
1759  fGrandDaughterTree->Branch("granddaughterPID_MissingE", &fgranddaughterPID_MissingE, "granddaughterPID_MissingE[NGRANDDAUGHTERS][3]/D");
1760  fGrandDaughterTree->Branch("granddaughterPID_MissingEavg", &fgranddaughterPID_MissingEavg, "granddaughterPID_MissingEavg[NGRANDDAUGHTERS][3]/D");
1761  fGrandDaughterTree->Branch("granddaughterPID_PIDA", &fgranddaughterPID_PIDA, "granddaughterPID_PIDA[NGRANDDAUGHTERS][3]/D");
1762 
1763  fGrandDaughterTree->Branch("granddaughter_truth_TrackId", &fgranddaughter_truth_TrackId, "granddaughter_truth_TrackId[NGRANDDAUGHTERS]/I");
1764  fGrandDaughterTree->Branch("granddaughter_truth_Pdg", &fgranddaughter_truth_Pdg, "granddaughter_truth_Pdg[NGRANDDAUGHTERS]/I");
1765  fGrandDaughterTree->Branch("granddaughter_truth_Mother", &fgranddaughter_truth_Mother, "granddaughter_truth_Mother[NGRANDDAUGHTERS]/I");
1766  fGrandDaughterTree->Branch("granddaughter_truth_StartPosition", &fgranddaughter_truth_StartPosition, "granddaughter_truth_StartPosition[NGRANDDAUGHTERS][4]/D");
1767  fGrandDaughterTree->Branch("granddaughter_truth_EndPosition", &fgranddaughter_truth_EndPosition, "granddaughter_truth_EndPosition[NGRANDDAUGHTERS][4]/D");
1768  fGrandDaughterTree->Branch("granddaughter_truth_Momentum", &fgranddaughter_truth_Momentum, "granddaughter_truth_Momentum[NGRANDDAUGHTERS][4]/D");
1769  fGrandDaughterTree->Branch("granddaughter_truth_EndMomentum", &fgranddaughter_truth_EndMomentum, "granddaughter_truth_EndMomentum[NGRANDDAUGHTERS][4]/D");
1770  fGrandDaughterTree->Branch("granddaughter_truth_P", &fgranddaughter_truth_P, "granddaughter_truth_P[NGRANDDAUGHTERS]/D");
1771  fGrandDaughterTree->Branch("granddaughter_truth_Pt", &fgranddaughter_truth_Pt, "granddaughter_truth_Pt[NGRANDDAUGHTERS]/D");
1772  fGrandDaughterTree->Branch("granddaughter_truth_Mass", &fgranddaughter_truth_Mass, "granddaughter_truth_Mass[NGRANDDAUGHTERS]/D");
1773  fGrandDaughterTree->Branch("granddaughter_truth_Theta", &fgranddaughter_truth_Theta, "granddaughter_truth_Theta[NGRANDDAUGHTERS]/D");
1774  fGrandDaughterTree->Branch("granddaughter_truth_Phi", &fgranddaughter_truth_Phi, "granddaughter_truth_Phi[NGRANDDAUGHTERS]/D");
1775  fGrandDaughterTree->Branch("granddaughter_truth_TotalLength", &fgranddaughter_truth_TotalLength, "granddaughter_truth_TotalLength[NGRANDDAUGHTERS]/D");
1776  fGrandDaughterTree->Branch("granddaughter_truth_Process", &fgranddaughter_truth_Process, "granddaughter_truth_Process[NGRANDDAUGHTERS]/I");
1777  fGrandDaughterTree->Branch("granddaughter_truth_EndProcess", &fgranddaughter_truth_EndProcess, "granddaughter_truth_EndProcess[NGRANDDAUGHTERS]/I");
1778 
1779 }
1780 
1781 // -----------------------------------------------------------------------------
1783 
1784  fRun = -999;
1785  fSubRun = -999;
1786  fevent = -999;
1787  fTimeStamp = -999.0;
1788  fNpfParticles = 0;
1789  for(int k=0; k < 5; k++)
1790  fNactivefembs[k] = -999;
1791 
1792  for(int k=0; k < 3; k++){
1793  fprimaryVertex[k] = -999.0;
1794  fdaughterVertex[k] = -999.0;
1795  fprimaryEndPosition[k] = -999.0;
1796  fprimaryStartPosition[k] = -999.0;
1797  fprimaryEndDirection[k] = -999.0;
1798  fprimaryStartDirection[k] = -999.0;
1799  fprimaryKineticEnergy[k] = -999.0;
1800  fprimaryRange[k] = -999.0;
1801  fprimaryTrkPitchC[k] = -999.0;
1802 
1803  fprimaryPID_Pdg[k] = -999.0;
1804  fprimaryPID_Ndf[k] = -999.0;
1805  fprimaryPID_MinChi2[k] = -999.0;
1806  fprimaryPID_DeltaChi2[k] = -999.0;
1807  fprimaryPID_Chi2Proton[k] = -999.0;
1808  fprimaryPID_Chi2Kaon[k] = -999.0;
1809  fprimaryPID_Chi2Pion[k] = -999.0;
1810  fprimaryPID_Chi2Muon[k] = -999.0;
1811  fprimaryPID_MissingE[k] = -999.0;
1812  fprimaryPID_MissingEavg[k] = -999.0;
1813  fprimaryPID_PIDA[k] = -999.0;
1814  }
1815 
1816  fbeamtrack_truth_Origin = -999;
1817  fbeamtrigger = -999;
1818  ftof = -999.0;
1819  fbeamNTracks = -999;
1820  ftof_expElec = -999.0;
1821  ftof_expMuon = -999.0;
1822  ftof_expPion = -999.0;
1823  ftof_expKaon = -999.0;
1824  ftof_expProt = -999.0;
1825  ftof_expDeut = -999.0;
1826  for(int k=0; k < 2; k++){
1827  fcerenkovPressure[k] = -999.0;
1828  fcerenkovTime[k] = -999.0;
1829  fcerenkovStatus[k] = -999;
1830  }
1831  fbeamtrackMomentum = -999.0;
1832  fbeamtrackEnergy = 999.0;
1833  fbeamtrackPdg = -999;
1834  fbeamtrackID = -999;
1835  fbeamtrack_truth_Pt = -999.0;
1836  fbeamtrack_truth_Mass = -999.0;
1837  fbeamtrack_truth_Theta = -999.0;
1838  fbeamtrack_truth_Phi = -999.0;
1840  fbeamtrack_truth_KinEnergy = -999.0;
1847 
1848  for(int l=0; l < 3; l++){
1849  fbeamtrackPos[l] = -999.0;
1850  fbeamtrackDir[l] = -999.0;
1851  }
1852  for(int l=0; l < 4; l++){
1853  fbeamtrack_truth_EndPos[l] = -999.0;
1854  fbeamtrack_truth_Momentum[l] = -999.0;
1857  }
1860  for(int k=0; k < NMAXTRUTHDAUGTHERS; k++){
1864  fbeamtrack_truthdaughter_P[k] = -999.0;
1865  fbeamtrack_truthdaughter_Pt[k] = -999.0;
1866  fbeamtrack_truthdaughter_Mass[k] = -999.0;
1868  fbeamtrack_truthdaughter_Phi[k] = -999.0;
1872 
1884  for(int l=0; l < 4; l++){
1889 
1894  }
1895  }
1896 
1897  fprimaryIstrack = 0;
1898  fprimaryIsshower = 0;
1899 
1900  fprimaryBDTScore = -999.0;
1901  fprimaryNHits = -999;
1902  fprimaryTheta = -999.0;
1903  fprimaryPhi = -999.0;
1904  fprimaryLength = -999.0;
1905  fprimaryMomentum = -999.0;
1906  fprimaryEndMomentum = -999.0;
1907  fprimaryOpeningAngle = -999.0;
1908  fprimaryShowerBestPlane = -999;
1909  fprimaryID = -999;
1911  fprimaryMomentumByRangeMuon = -999.0;
1912  fprimaryT0 = -999.0;
1913  fprimaryEarliestHitPeakTime = -999.0;
1914 
1915  fprimary_truth_Origin = -999;
1916  fprimary_truth_TrackId = -999;
1917  fprimary_truth_Pdg = -999;
1918  fprimary_truth_Mother = -999;
1919  fprimary_truth_P = -999.0;
1920  fprimary_truth_Pt = -999.0;
1921  fprimary_truth_Mass = -999.0;
1922  fprimary_truth_Theta = -999.0;
1923  fprimary_truth_Phi = -999.0;
1924  fprimary_truth_Process = -999;
1927 
1928  for(int l=0; l < 4; l++){
1929  fprimary_truth_StartPosition[l] = -999.0;
1930  fprimary_truth_EndPosition[l] = -999.0;
1931  fprimary_truth_Momentum[l] = -999.0;
1932  fprimary_truth_EndMomentum[l] = -999.0;
1935  }
1936  for(int l=0; l < 3; l++){
1937  fprimaryShowerEnergy[l] = -999;
1938  fprimaryShowerMIPEnergy[l] = -999;
1939  fprimaryShowerdEdx[l] = -999;
1940  }
1941 
1944  for(int k=0; k < NMAXTRUTHDAUGTHERS; k++){
1946  fprimary_truthdaughter_Pdg[k] = -999;
1948  fprimary_truthdaughter_P[k] = -999.0;
1949  fprimary_truthdaughter_Pt[k] = -999.0;
1950  fprimary_truthdaughter_Mass[k] = -999.0;
1951  fprimary_truthdaughter_Theta[k] = -999.0;
1952  fprimary_truthdaughter_Phi[k] = -999.0;
1956 
1960  fprimary_truthdecaydaughter_P[k] = -999.0;
1968  for(int l=0; l < 4; l++){
1971  fprimary_truthdaughter_Momentum[k][l] = -999.0;
1973 
1978  }
1979  }
1980 
1981  fNDAUGHTERS = 0;
1982  fNGRANDDAUGHTERS = 0;
1983  for(int k=0; k < NMAXDAUGTHERS; k++){
1984  fdaughterIstrack[k] = -999;
1985  fdaughterIsshower[k] = -999;
1986  fdaughterNHits[k] = -999;
1987  fdaughterTheta[k] = -999.0;
1988  fdaughterPhi[k] = -999.0;
1989  fdaughterLength[k] = -999.0;
1990  fdaughterMomentum[k] = -999.0;
1991  fdaughterEndMomentum[k] = -999.0;
1992  for(int l=0; l < 3; l++){
1993  fdaughterEndPosition[k][l] = -999.0;
1994  fdaughterStartPosition[k][l] = -999.0;
1995  fdaughterEndDirection[k][l] = -999.0;
1996  fdaughterStartDirection[k][l] = -999.0;
1997  fdaughterKineticEnergy[k][l] = -999.0;
1998  fdaughterRange[k][l] = -999.0;
1999  fdaughterTrkPitchC[k][l] = -999.0;
2000 
2001  fdaughterPID_Pdg[k][l] = -999.0;
2002  fdaughterPID_Ndf[k][l] = -999.0;
2003  fdaughterPID_MinChi2[k][l] = -999.0;
2004  fdaughterPID_DeltaChi2[k][l] = -999.0;
2005  fdaughterPID_Chi2Proton[k][l] = -999.0;
2006  fdaughterPID_Chi2Kaon[k][l] = -999.0;
2007  fdaughterPID_Chi2Pion[k][l] = -999.0;
2008  fdaughterPID_Chi2Muon[k][l] = -999.0;
2009  fdaughterPID_MissingE[k][l] = -999.0;
2010  fdaughterPID_MissingEavg[k][l] = -999.0;
2011  fdaughterPID_PIDA[k][l] = -999.0;
2012  fgranddaughterVertex[k][l] = -999.0;
2013 
2014  fdaughterShowerEnergy[k][l] = -999;
2015  fdaughterShowerMIPEnergy[k][l] = -999;
2016  fdaughterShowerdEdx[k][l] = -999;
2017  }
2018  fdaughterOpeningAngle[k] = -999.0;
2019  fdaughterShowerBestPlane[k] = -999;
2021  fdaughterMomentumByRangeMuon[k] = -999.0;
2022  fdaughterID[k] = -999;
2023  fdaughterT0[k] = -999;
2024 
2025  fdaughter_truth_TrackId[k] = -999;
2026  fdaughter_truth_Pdg[k] = -999;
2027  fdaughter_truth_Mother[k] = -999;
2028  fdaughter_truth_P[k] = -999.0;
2029  fdaughter_truth_Pt[k] = -999.0;
2030  fdaughter_truth_Mass[k] = -999.0;
2031  fdaughter_truth_Theta[k] = -999.0;
2032  fdaughter_truth_Phi[k] = -999.0;
2033  fdaughter_truth_Process[k] = -999;
2034  fdaughter_truth_TotalLength[k] = -999.0;
2035  for(int l=0; l < 4; l++){
2036  fdaughter_truth_StartPosition[k][l] = -999.0;
2037  fdaughter_truth_EndPosition[k][l] = -999.0;
2038  fdaughter_truth_Momentum[k][l] = -999.0;
2039  fdaughter_truth_EndMomentum[k][l] = -999.0;
2040  }
2041 
2042  // Grand-daugthers
2043  fgranddaughterIstrack[k] = -999;
2044  fgranddaughterIsshower[k] = -999;
2045  fgranddaughterNHits[k] = -999;
2046  fgranddaughterTheta[k] = -999.0;
2047  fgranddaughterPhi[k] = -999.0;
2048  fgranddaughterLength[k] = -999.0;
2049  fgranddaughterMomentum[k] = -999.0;
2050  fgranddaughterEndMomentum[k] = -999.0;
2051  for(int l=0; l < 3; l++){
2052  fgranddaughterEndPosition[k][l] = -999.0;
2053  fgranddaughterStartPosition[k][l] = -999.0;
2054  fgranddaughterEndDirection[k][l] = -999.0;
2055  fgranddaughterStartDirection[k][l] = -999.0;
2056  fgranddaughterKineticEnergy[k][l] = -999.0;
2057  fgranddaughterRange[k][l] = -999.0;
2058  fgranddaughterTrkPitchC[k][l] = -999.0;
2059 
2060  fgranddaughterPID_Pdg[k][l] = -999.0;
2061  fgranddaughterPID_Ndf[k][l] = -999.0;
2062  fgranddaughterPID_MinChi2[k][l] = -999.0;
2063  fgranddaughterPID_DeltaChi2[k][l] = -999.0;
2064  fgranddaughterPID_Chi2Proton[k][l] = -999.0;
2065  fgranddaughterPID_Chi2Kaon[k][l] = -999.0;
2066  fgranddaughterPID_Chi2Pion[k][l] = -999.0;
2067  fgranddaughterPID_Chi2Muon[k][l] = -999.0;
2068  fgranddaughterPID_MissingE[k][l] = -999.0;
2069  fgranddaughterPID_MissingEavg[k][l] = -999.0;
2070  fgranddaughterPID_PIDA[k][l] = -999.0;
2071 
2072  fgranddaughterShowerEnergy[k][l] = -999;
2074  fgranddaughterShowerdEdx[k][l] = -999;
2075  }
2076  fgranddaughterOpeningAngle[k] = -999.0;
2080  fgranddaughterID[k] = -999;
2081  fgranddaughterMotherID[k] = -999;
2082  fgranddaughterT0[k] = -999;
2083 
2085  fgranddaughter_truth_Pdg[k] = -999;
2087  fgranddaughter_truth_P[k] = -999.0;
2088  fgranddaughter_truth_Pt[k] = -999.0;
2089  fgranddaughter_truth_Mass[k] = -999.0;
2090  fgranddaughter_truth_Theta[k] = -999.0;
2091  fgranddaughter_truth_Phi[k] = -999.0;
2094  for(int l=0; l < 4; l++){
2097  fgranddaughter_truth_Momentum[k][l] = -999.0;
2099  }
2100 
2101  }
2102 
2103 
2104 }
2105 
double E(const int i=0) const
Definition: MCParticle.h:233
double fdaughterStartDirection[NMAXDAUGTHERS][3]
int best_plane() const
Definition: Shower.h:200
double fdaughterPID_MissingE[NMAXDAUGTHERS][3]
double fprimary_truthdecaydaughter_Mass[NMAXTRUTHDAUGTHERS]
Store parameters for running LArG4.
double fgranddaughterShowerMIPEnergy[NMAXDAUGTHERS][3]
void FillPrimaryGrandDaughterPFParticle(art::Event const &evt, detinfo::DetectorClocksData const &clockData, const recob::PFParticle *gdaughterParticle, int daughterID, int gdaughterID)
const std::vector< size_t > & Daughters() const
Returns the collection of daughter particles.
Definition: PFParticle.h:114
const TVector3 & ShowerStart() const
Definition: Shower.h:192
std::vector< anab::ParticleID > GetRecoTrackPID(const recob::Track &track, art::Event const &evt, const std::string trackModule, const std::string pidModule) const
Get the PID from a given track.
int fprimary_truthdaughter_Mother[NMAXTRUTHDAUGTHERS]
double EndMomentum() const
Definition: Track.h:144
int PdgCode() const
Definition: MCParticle.h:212
constexpr std::uint32_t timeLow() const
Definition: Timestamp.h:29
int fprimary_truthdecaydaughter_Mother[NMAXTRUTHDAUGTHERS]
double Py(const int i=0) const
Definition: MCParticle.h:231
std::vector< anab::T0 > GetPFParticleT0(const recob::PFParticle &particle, art::Event const &evt, std::string particleLabel) const
Get the T0(s) from a given PFParticle.
double fbeamtrack_truthdaughter_Pt[NMAXTRUTHDAUGTHERS]
double fgranddaughter_truth_Phi[NMAXDAUGTHERS]
double fprimary_truthdecaydaughter_Pt[NMAXTRUTHDAUGTHERS]
double fbeamtrack_truthdaughter_Mass[NMAXTRUTHDAUGTHERS]
const simb::MCParticle * GetGeantGoodParticle(const simb::MCTruth &genTruth, const art::Event &evt) const
int fprimary_truthdaughter_Pdg[NMAXTRUTHDAUGTHERS]
double fgranddaughterPID_DeltaChi2[NMAXDAUGTHERS][3]
int fbeamtrack_truthdecaydaughter_Process[NMAXTRUTHDAUGTHERS]
double fdaughterOpeningAngle[NMAXDAUGTHERS]
double EndE() const
Definition: MCParticle.h:244
double EndZ() const
Definition: MCParticle.h:228
int fgranddaughterShowerBestPlane[NMAXDAUGTHERS]
double fprimary_truthdaughter_Phi[NMAXTRUTHDAUGTHERS]
int fbeamtrack_truthdecaydaughter_Pdg[NMAXTRUTHDAUGTHERS]
double Length() const
Definition: Shower.h:201
int ParticleId() const
Definition: Track.h:171
double fdaughter_truth_EndPosition[NMAXDAUGTHERS][4]
const recob::Shower * GetPFParticleShower(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string showerLabel) const
Get the shower associated to this particle. Returns a null pointer if not found.
double fgranddaughter_truth_P[NMAXDAUGTHERS]
double fdaughter_truth_EndMomentum[NMAXDAUGTHERS][4]
Handle< PROD > getHandle(SelectorBase const &) const
Definition: DataViewImpl.h:382
std::string string
Definition: nybbler.cc:12
const simb::MCTrajectory & Trajectory() const
Definition: MCParticle.h:253
void FillPrimaryDaughterPFParticle(art::Event const &evt, detinfo::DetectorClocksData const &clockData, const recob::PFParticle *daughterParticle, int daughterID)
int Mother() const
Definition: MCParticle.h:213
const recob::TrackTrajectory & Trajectory() const
Access to the stored recob::TrackTrajectory.
Definition: Track.h:98
std::vector< anab::Calorimetry > GetRecoTrackCalorimetry(const recob::Track &track, art::Event const &evt, const std::string trackModule, const std::string caloModule) const
Get the Calorimetry(s) from a given reco track.
constexpr std::uint32_t timeHigh() const
Definition: Timestamp.h:34
double Mass() const
Definition: MCParticle.h:239
double fgranddaughterShowerEnergy[NMAXDAUGTHERS][3]
Geometry information for a single TPC.
Definition: TPCGeo.h:38
const std::vector< const recob::Hit * > GetPFParticleHits(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Get the hits associated to the PFParticle.
const std::vector< double > & Energy() const
Definition: Shower.h:195
double Px(const int i=0) const
Definition: MCParticle.h:230
art::ServiceHandle< cheat::ParticleInventoryService > pi_service
const TVector3 GetPFParticleVertex(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string trackLabel) const
Function to find the interaction vertex of a primary PFParticle.
int fgranddaughter_truth_Process[NMAXDAUGTHERS]
int fbeamtrack_truthdaughter_EndProcess[NMAXTRUTHDAUGTHERS]
double fgranddaughterPID_Chi2Proton[NMAXDAUGTHERS][3]
double fprimary_truthdaughter_StartPosition[NMAXTRUTHDAUGTHERS][4]
double fdaughterMomentumByRangeProton[NMAXDAUGTHERS]
STL namespace.
double fbeamtrack_truthdaughter_P[NMAXTRUTHDAUGTHERS]
double fdaughterShowerdEdx[NMAXDAUGTHERS][3]
double fgranddaughterShowerdEdx[NMAXDAUGTHERS][3]
double fbeamtrack_truthdecaydaughter_EndMomentum[NMAXTRUTHDAUGTHERS][4]
double fbeamtrack_truthdecaydaughter_P[NMAXTRUTHDAUGTHERS]
double fgranddaughterPID_PIDA[NMAXDAUGTHERS][3]
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
void beginRun(const art::Run &run) override
double fgranddaughterPID_MissingEavg[NMAXDAUGTHERS][3]
const double GetPFParticleEarliestHitPeakTime(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Get the earliest hit peak time.
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
std::string Process() const
Definition: MCParticle.h:215
double fprimary_truthdecaydaughter_StartPosition[NMAXTRUTHDAUGTHERS][4]
double fprimary_truthdaughter_TotalLength[NMAXTRUTHDAUGTHERS]
Particle class.
double EndY() const
Definition: MCParticle.h:227
double fdaughterPID_DeltaChi2[NMAXDAUGTHERS][3]
double fprimary_truthdecaydaughter_Momentum[NMAXTRUTHDAUGTHERS][4]
int fprimary_truthdaughter_Process[NMAXTRUTHDAUGTHERS]
double fgranddaughterRange[NMAXDAUGTHERS][3]
double fdaughterEndMomentum[NMAXDAUGTHERS]
static QStrList * l
Definition: config.cpp:1044
void FillPrimaryPFParticle(art::Event const &evt, detinfo::DetectorClocksData const &clockData, const recob::PFParticle *particle)
double fgranddaughterTrkPitchC[NMAXDAUGTHERS][3]
art framework interface to geometry description
double fprimary_truthdaughter_Mass[NMAXTRUTHDAUGTHERS]
Definition: Run.h:17
int TrackId() const
Definition: MCParticle.h:210
double fprimary_truthdecaydaughter_Theta[NMAXTRUTHDAUGTHERS]
double GetKinEnergyAtVertex(const simb::MCParticle &mcpart, double kinene_lastpoint=0.0)
unsigned int Nchannels() const
Returns the number of TPC readout channels in the detector.
double GetDepEnergyAtLastTrajPoint(const simb::MCParticle &mcpart, double tpcactiveXlow, double tpcactiveXhigh, double tpcactiveYlow, double tpcactiveYhigh, double tpcactiveZlow, double tpcactiveZhigh)
double GetMCParticleLengthInTPCActiveVolume(const simb::MCParticle &mcpart, double tpcactiveXlow, double tpcactiveXhigh, double tpcactiveYlow, double tpcactiveYhigh, double tpcactiveZlow, double tpcactiveZhigh)
double fgranddaughterPID_Chi2Kaon[NMAXDAUGTHERS][3]
double fgranddaughterVertex[NMAXDAUGTHERS][3]
double fdaughter_truth_StartPosition[NMAXDAUGTHERS][4]
double fbeamtrack_truthdaughter_TotalLength[NMAXTRUTHDAUGTHERS]
int fprimary_truthdecaydaughter_Pdg[NMAXTRUTHDAUGTHERS]
double fdaughter_truth_Pt[NMAXDAUGTHERS]
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
ProtoDUNEAnalTree & operator=(ProtoDUNEAnalTree const &)=delete
std::string GDMLFile() const
Returns the full directory path to the GDML file source.
int fgranddaughter_truth_EndProcess[NMAXDAUGTHERS]
bool isRealData() const
double fdaughterEndDirection[NMAXDAUGTHERS][3]
double fgranddaughterMomentumByRangeProton[NMAXDAUGTHERS]
double fprimary_truthdaughter_Pt[NMAXTRUTHDAUGTHERS]
double fbeamtrack_truthdaughter_Momentum[NMAXTRUTHDAUGTHERS][4]
double Pt(const int i=0) const
Definition: MCParticle.h:236
double fgranddaughter_truth_StartPosition[NMAXDAUGTHERS][4]
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
double Phi() const
Definition: Track.h:178
int fprimary_truthdecaydaughter_TrackId[NMAXTRUTHDAUGTHERS]
double fbeamtrack_truthdecaydaughter_Momentum[NMAXTRUTHDAUGTHERS][4]
double Length(size_t p=0) const
Access to various track properties.
Definition: Track.h:167
double fdaughter_truth_Momentum[NMAXDAUGTHERS][4]
int fbeamtrack_truthdaughter_TrackId[NMAXTRUTHDAUGTHERS]
double fdaughter_truth_TotalLength[NMAXDAUGTHERS]
Timestamp time() const
const std::vector< double > & dEdx() const
Definition: Shower.h:203
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
const std::vector< double > & MIPEnergy() const
Definition: Shower.h:198
std::string EndProcess() const
Definition: MCParticle.h:216
double fgranddaughter_truth_Momentum[NMAXDAUGTHERS][4]
double fbeamtrack_truthdaughter_EndMomentum[NMAXTRUTHDAUGTHERS][4]
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
double fbeamtrack_truthdaughter_StartPosition[NMAXTRUTHDAUGTHERS][4]
double EndPz() const
Definition: MCParticle.h:243
int fprimary_truthdecaydaughter_Process[NMAXTRUTHDAUGTHERS]
double fbeamtrack_truthdaughter_Phi[NMAXTRUTHDAUGTHERS]
IteratorBox< TPC_iterator,&GeometryCore::begin_TPC,&GeometryCore::end_TPC > IterateTPCs() const
Enables ranged-for loops on all TPCs of the detector.
const art::Ptr< simb::MCTruth > & TrackIdToMCTruth_P(int id) const
double Theta() const
Access to spherical or geographical angles at vertex or at any point.
Definition: Track.h:176
double fdaughterPID_Chi2Muon[NMAXDAUGTHERS][3]
double P(const int i=0) const
Definition: MCParticle.h:234
const recob::Track * GetPFParticleTrack(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string trackLabel) const
Get the track associated to this particle. Returns a null pointer if not found.
double fdaughterPID_Chi2Proton[NMAXDAUGTHERS][3]
double fdaughterShowerMIPEnergy[NMAXDAUGTHERS][3]
int fbeamtrack_truthdecaydaughter_EndProcess[NMAXTRUTHDAUGTHERS]
bool FillPrimaryBeamParticle(art::Event const &evt)
double fgranddaughterPID_Chi2Muon[NMAXDAUGTHERS][3]
double OpenAngle() const
Definition: Shower.h:202
double fprimary_truthdecaydaughter_P[NMAXTRUTHDAUGTHERS]
int fbeamtrack_truthdecaydaughter_TrackId[NMAXTRUTHDAUGTHERS]
double T(const int i=0) const
Definition: MCParticle.h:224
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
double fdaughterPID_MinChi2[NMAXDAUGTHERS][3]
p
Definition: test.py:223
int fprimary_truthdaughter_EndProcess[NMAXTRUTHDAUGTHERS]
double fgranddaughter_truth_EndPosition[NMAXDAUGTHERS][4]
double fdaughterTrkPitchC[NMAXDAUGTHERS][3]
SubRunNumber_t subRun() const
Definition: DataViewImpl.cc:78
trkf::TrackMomentumCalculator trmom
double fbeamtrack_truthdecaydaughter_TotalLength[NMAXTRUTHDAUGTHERS]
const simb::MCParticle * GetMCParticleFromRecoTrack(detinfo::DetectorClocksData const &clockData, const recob::Track &track, art::Event const &evt, std::string trackModule) const
const std::vector< const recob::PFParticle * > GetPFParticlesFromBeamSlice(art::Event const &evt, const std::string particleLabel) const
Return the pointers for the PFParticles in the beam slice. Returns an empty vector is no beam slice w...
const TVector3 & Direction() const
Definition: Shower.h:189
int fgranddaughter_truth_Mother[NMAXDAUGTHERS]
RunNumber_t run() const
Definition: DataViewImpl.cc:71
double EndT() const
Definition: MCParticle.h:229
int fgranddaughterPID_Pdg[NMAXDAUGTHERS][3]
double fgranddaughterOpeningAngle[NMAXDAUGTHERS]
Description of geometry of one entire detector.
double fgranddaughter_truth_Theta[NMAXDAUGTHERS]
double fbeamtrack_truthdecaydaughter_EndPosition[NMAXTRUTHDAUGTHERS][4]
Definition of data types for geometry description.
double fgranddaughter_truth_Pt[NMAXDAUGTHERS]
double fgranddaughterMomentum[NMAXDAUGTHERS]
double fdaughterMomentumByRangeMuon[NMAXDAUGTHERS]
protoana::ProtoDUNEPFParticleUtils pfpUtil
double fbeamtrack_truthdaughter_EndPosition[NMAXTRUTHDAUGTHERS][4]
protoana::ProtoDUNEDataUtils dataUtil
double fprimary_truthdaughter_Momentum[NMAXTRUTHDAUGTHERS][4]
int fbeamtrack_truthdaughter_Process[NMAXTRUTHDAUGTHERS]
void analyze(art::Event const &evt) override
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
double fdaughter_truth_Mass[NMAXDAUGTHERS]
Vector_t EndDirection() const
Returns the direction of the trajectory at the last point.
double fgranddaughterEndMomentum[NMAXDAUGTHERS]
Definition: tracks.py:1
double fgranddaughterEndDirection[NMAXDAUGTHERS][3]
double fprimary_truthdecaydaughter_TotalLength[NMAXTRUTHDAUGTHERS]
double Vx(const int i=0) const
Definition: MCParticle.h:221
double fdaughterPID_MissingEavg[NMAXDAUGTHERS][3]
double fdaughterEndPosition[NMAXDAUGTHERS][3]
Declaration of signal hit object.
double fdaughterShowerEnergy[NMAXDAUGTHERS][3]
double StartMomentum() const
Definition: Track.h:143
double fbeamtrack_truthdecaydaughter_Phi[NMAXTRUTHDAUGTHERS]
Hierarchical representation of particle flow.
Definition: PFParticle.h:44
double fbeamtrack_truthdecaydaughter_Mass[NMAXTRUTHDAUGTHERS]
Contains all timing reference information for the detector.
double EndPy() const
Definition: MCParticle.h:242
double fprimary_truthdaughter_EndPosition[NMAXTRUTHDAUGTHERS][4]
int GetNActiveFembsForAPA(art::Event const &evt, int apa) const
Get number of active fembs in an APA.
double fdaughterRange[NMAXDAUGTHERS][3]
double TotalLength() const
protoana::ProtoDUNETruthUtils truthUtil
double ComputeTOF(int pdg, double momentum)
double fdaughter_truth_Theta[NMAXDAUGTHERS]
int fbeamtrack_truthdaughter_Pdg[NMAXTRUTHDAUGTHERS]
Point_t const & End() const
Returns the position of the last valid point of the trajectory [cm].
const TLorentzVector & Momentum(const int i=0) const
Definition: MCParticle.h:220
def center(depos, point)
Definition: depos.py:117
double fprimary_truthdecaydaughter_Phi[NMAXTRUTHDAUGTHERS]
int fgranddaughterPID_Ndf[NMAXDAUGTHERS][3]
double Pz(const int i=0) const
Definition: MCParticle.h:232
Provides recob::Track data product.
double fdaughterPID_PIDA[NMAXDAUGTHERS][3]
double Vz(const int i=0) const
Definition: MCParticle.h:223
double fgranddaughterPID_MinChi2[NMAXDAUGTHERS][3]
double fprimary_truthdaughter_Theta[NMAXTRUTHDAUGTHERS]
const int NMAXTRUTHDAUGTHERS
double fgranddaughterEndPosition[NMAXDAUGTHERS][3]
double fprimary_truthdaughter_P[NMAXTRUTHDAUGTHERS]
int fprimary_truthdaughter_TrackId[NMAXTRUTHDAUGTHERS]
double fprimary_truthdecaydaughter_EndMomentum[NMAXTRUTHDAUGTHERS][4]
int GetFirstTrajectoryPointInTPCActiveVolume(const simb::MCParticle &mcpart, double tpcactiveXlow, double tpcactiveXhigh, double tpcactiveYlow, double tpcactiveYhigh, double tpcactiveZlow, double tpcactiveZhigh)
const TVector3 GetPFParticleSecondaryVertex(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string trackLabel) const
Function to find the secondary interaction vertex of a primary PFParticle.
EventNumber_t event() const
Definition: EventID.h:116
double fprimary_truthdecaydaughter_EndPosition[NMAXTRUTHDAUGTHERS][4]
double fgranddaughterStartPosition[NMAXDAUGTHERS][3]
Access the description of detector geometry.
const int NMAXDAUGTHERS
double EndPx() const
Definition: MCParticle.h:241
double fdaughterPID_Chi2Kaon[NMAXDAUGTHERS][3]
int fprimary_truthdecaydaughter_EndProcess[NMAXTRUTHDAUGTHERS]
protoana::ProtoDUNEBeamlineUtils beamlineUtil
double fgranddaughterTheta[NMAXDAUGTHERS]
TCEvent evt
Definition: DataStructs.cxx:7
const simb::MCParticle * GetMCParticleFromRecoShower(detinfo::DetectorClocksData const &clockData, const recob::Shower &shower, art::Event const &evt, std::string showerModule) const
auto const & get(AssnsNode< L, R, D > const &r)
Definition: AssnsNode.h:115
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
double fdaughterStartPosition[NMAXDAUGTHERS][3]
double fgranddaughterKineticEnergy[NMAXDAUGTHERS][3]
double fbeamtrack_truthdecaydaughter_StartPosition[NMAXTRUTHDAUGTHERS][4]
double EndX() const
Definition: MCParticle.h:226
double fbeamtrack_truthdecaydaughter_Theta[NMAXTRUTHDAUGTHERS]
double fgranddaughterStartDirection[NMAXDAUGTHERS][3]
Vector_t StartDirection() const
Returns the direction of the trajectory at the first point.
int fgranddaughter_truth_TrackId[NMAXDAUGTHERS]
Point_t const & Start() const
Returns the position of the first valid point of the trajectory [cm].
double fgranddaughter_truth_Mass[NMAXDAUGTHERS]
double fbeamtrack_truthdecaydaughter_Pt[NMAXTRUTHDAUGTHERS]
double fdaughterKineticEnergy[NMAXDAUGTHERS][3]
ProtoDUNEAnalTree(fhicl::ParameterSet const &p)
int fbeamtrack_truthdaughter_Mother[NMAXTRUTHDAUGTHERS]
double fgranddaughterMomentumByRangeMuon[NMAXDAUGTHERS]
double fgranddaughter_truth_TotalLength[NMAXDAUGTHERS]
int ID() const
Definition: Shower.h:187
int fbeamtrack_truthdecaydaughter_Mother[NMAXTRUTHDAUGTHERS]
double fdaughterPID_Chi2Pion[NMAXDAUGTHERS][3]
float GetBeamCosmicScore(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Access the BDT output used to decide if a slice is beam-like or cosmic-like.
double fdaughter_truth_Phi[NMAXDAUGTHERS]
EventID id() const
Definition: Event.cc:34
double Vy(const int i=0) const
Definition: MCParticle.h:222
double fbeamtrack_truthdaughter_Theta[NMAXTRUTHDAUGTHERS]
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
Definition: Track.h:49
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:227
double GetTrackMomentum(double trkrange, int pdg) const
int GetProcessKey(std::string process)
QTextStream & endl(QTextStream &s)
bool IsBeamTrigger(art::Event const &evt) const
protoana::ProtoDUNETrackUtils trackUtil
double fprimary_truthdaughter_EndMomentum[NMAXTRUTHDAUGTHERS][4]
double fgranddaughter_truth_EndMomentum[NMAXDAUGTHERS][4]
geo::GeometryCore const * fGeometry
double fgranddaughterPID_Chi2Pion[NMAXDAUGTHERS][3]
double fgranddaughterPID_MissingE[NMAXDAUGTHERS][3]
double fgranddaughterLength[NMAXDAUGTHERS]