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

Public Member Functions

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

Private Member Functions

void Initialise ()
 
void FillCosmicsTree (art::Event const &evt)
 

Private Attributes

protoana::ProtoDUNEPFParticleUtils pfpUtil
 
protoana::ProtoDUNETrackUtils trackUtil
 
protoana::ProtoDUNETruthUtils truthUtil
 
trkf::TrackMomentumCalculator trmom
 
const art::InputTag fBeamModuleLabel
 
std::string fCalorimetryTag
 
std::string fParticleIDTag
 
std::string fTrackerTag
 
std::string fShowerTag
 
std::string fPFParticleTag
 
std::string fGeneratorTag
 
double fMinimumTrackLength
 
TTree * fPandoraCosmics
 
int fRun
 
int fSubRun
 
int fevent
 
double fTimeStamp
 
int fNactivefembs [6]
 
int fNCOSMICS
 
int fcosmicIsClear [NMAXCOSMICPARTICLES]
 
int fcosmicNHits [NMAXCOSMICPARTICLES]
 
double fcosmicBDTScore [NMAXCOSMICPARTICLES]
 
int fiscosmictrack [NMAXCOSMICPARTICLES]
 
int fiscosmicshower [NMAXCOSMICPARTICLES]
 
double fcosmicID [NMAXCOSMICPARTICLES]
 
double fcosmicTheta [NMAXCOSMICPARTICLES]
 
double fcosmicPhi [NMAXCOSMICPARTICLES]
 
double fcosmicLength [NMAXCOSMICPARTICLES]
 
double fcosmicMomentumByRangeMuon [NMAXCOSMICPARTICLES]
 
double fcosmicMomentumByRangeProton [NMAXCOSMICPARTICLES]
 
int fcosmicShowerBestPlane [NMAXCOSMICPARTICLES]
 
double fcosmicOpeningAngle [NMAXCOSMICPARTICLES]
 
double fcosmicEndPosition [NMAXCOSMICPARTICLES][3]
 
double fcosmicStartPosition [NMAXCOSMICPARTICLES][3]
 
double fcosmicEndDirection [NMAXCOSMICPARTICLES][3]
 
double fcosmicStartDirection [NMAXCOSMICPARTICLES][3]
 
double fcosmicKineticEnergy [NMAXCOSMICPARTICLES][3]
 
double fcosmicRange [NMAXCOSMICPARTICLES][3]
 
double fcosmicTrkPitchC [NMAXCOSMICPARTICLES][3]
 
double fcosmicT0 [NMAXCOSMICPARTICLES]
 
int fcosmicPID_Pdg [NMAXCOSMICPARTICLES][3]
 
int fcosmicPID_Ndf [NMAXCOSMICPARTICLES][3]
 
double fcosmicPID_MinChi2 [NMAXCOSMICPARTICLES][3]
 
double fcosmicPID_DeltaChi2 [NMAXCOSMICPARTICLES][3]
 
double fcosmicPID_Chi2Proton [NMAXCOSMICPARTICLES][3]
 
double fcosmicPID_Chi2Kaon [NMAXCOSMICPARTICLES][3]
 
double fcosmicPID_Chi2Pion [NMAXCOSMICPARTICLES][3]
 
double fcosmicPID_Chi2Muon [NMAXCOSMICPARTICLES][3]
 
double fcosmicPID_MissingE [NMAXCOSMICPARTICLES][3]
 
double fcosmicPID_MissingEavg [NMAXCOSMICPARTICLES][3]
 
double fcosmicPID_PIDA [NMAXCOSMICPARTICLES][3]
 

Additional Inherited Members

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

Detailed Description

Definition at line 65 of file ProtoDUNEDPAnalCosmicTree_module.cc.

Constructor & Destructor Documentation

protoana::ProtoDUNEDPAnalCosmicTree::ProtoDUNEDPAnalCosmicTree ( fhicl::ParameterSet const &  p)
explicit

Definition at line 159 of file ProtoDUNEDPAnalCosmicTree_module.cc.

160  :
161  EDAnalyzer(p),
162  //dataUtil(p.get<fhicl::ParameterSet>("DataUtils")),
163  fBeamModuleLabel(p.get< art::InputTag >("BeamModuleLabel")),
164  fCalorimetryTag(p.get<std::string>("CalorimetryTag")),
165  fParticleIDTag(p.get<std::string>("ParticleIDTag")),
166  fTrackerTag(p.get<std::string>("TrackerTag")),
167  fShowerTag(p.get<std::string>("ShowerTag")),
168  fPFParticleTag(p.get<std::string>("PFParticleTag")),
169  fGeneratorTag(p.get<std::string>("GeneratorTag")),
170  fMinimumTrackLength(p.get<double>("MinimumTrackLength"))
171 {
172 
173 }
std::string string
Definition: nybbler.cc:12
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
p
Definition: test.py:223
protoana::ProtoDUNEDPAnalCosmicTree::ProtoDUNEDPAnalCosmicTree ( ProtoDUNEDPAnalCosmicTree const &  )
delete
protoana::ProtoDUNEDPAnalCosmicTree::ProtoDUNEDPAnalCosmicTree ( ProtoDUNEDPAnalCosmicTree &&  )
delete

Member Function Documentation

void protoana::ProtoDUNEDPAnalCosmicTree::analyze ( art::Event const &  evt)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 224 of file ProtoDUNEDPAnalCosmicTree_module.cc.

224  {
225 
226  // Initialise tree parameters
227  Initialise();
228 
229  fRun = evt.run();
230  fSubRun = evt.subRun();
231  fevent = evt.id().event();
232  art::Timestamp ts = evt.time();
233  if (ts.timeHigh() == 0){
234  TTimeStamp ts2(ts.timeLow());
235  fTimeStamp = ts2.AsDouble();
236  }
237  else{
238  TTimeStamp ts2(ts.timeHigh(), ts.timeLow());
239  fTimeStamp = ts2.AsDouble();
240  }
241 
243 
244 }
constexpr std::uint32_t timeLow() const
Definition: Timestamp.h:29
unsigned int event
Definition: DataStructs.h:636
unsigned int run
Definition: DataStructs.h:637
constexpr std::uint32_t timeHigh() const
Definition: Timestamp.h:34
unsigned int subRun
Definition: DataStructs.h:638
TCEvent evt
Definition: DataStructs.cxx:7
void protoana::ProtoDUNEDPAnalCosmicTree::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 175 of file ProtoDUNEDPAnalCosmicTree_module.cc.

175  {
176 
178 
179  fPandoraCosmics = tfs->make<TTree>("PandoraCosmics", "Cosmic tracks reconstructed with Pandora");
180  fPandoraCosmics->Branch("run", &fRun, "run/I");
181  fPandoraCosmics->Branch("subrun", &fSubRun, "subrun/I");
182  fPandoraCosmics->Branch("event", &fevent, "event/I");
183  fPandoraCosmics->Branch("timestamp", &fTimeStamp, "timestamp/D");
184  fPandoraCosmics->Branch("Nactivefembs", &fNactivefembs, "Nactivefembs[5]/I");
185  fPandoraCosmics->Branch("NCOSMICS", &fNCOSMICS, "NCOSMICS/I");
186  fPandoraCosmics->Branch("cosmicIsClear", &fcosmicIsClear, "cosmicIsClear[NCOSMICS]/I");
187  fPandoraCosmics->Branch("cosmicBDTScore", &fcosmicBDTScore, "cosmicBDTScore[NCOSMICS]/D");
188  fPandoraCosmics->Branch("cosmicNHits", &fcosmicNHits, "cosmicNHits[NCOSMICS]/I");
189  fPandoraCosmics->Branch("iscosmictrack", &fiscosmictrack, "iscosmictrack[NCOSMICS]/I");
190  fPandoraCosmics->Branch("iscosmicshower", &fiscosmicshower, "iscosmicshower[NCOSMICS]/I");
191  fPandoraCosmics->Branch("cosmicID", &fcosmicID, "cosmicID[NCOSMICS]/I");
192  fPandoraCosmics->Branch("cosmicTheta", &fcosmicTheta, "cosmicTheta[NCOSMICS]/D");
193  fPandoraCosmics->Branch("cosmicPhi", &fcosmicPhi, "cosmicPhi[NCOSMICS]/D");
194  fPandoraCosmics->Branch("cosmicLength", &fcosmicLength, "cosmicLength[NCOSMICS]/D");
195  //fPandoraCosmics->Branch("cosmicMomentum", &fcosmicMomentum, "cosmicMomentum[NCOSMICS]/D");
196  //fPandoraCosmics->Branch("cosmicEndMomentum", &fcosmicEndMomentum, "cosmicEndMomentum[NCOSMICS]/D");
197  fPandoraCosmics->Branch("cosmicOpeningAngle", &fcosmicOpeningAngle, "cosmicOpeningAngle[NCOSMICS]/D");
198  fPandoraCosmics->Branch("cosmicShowerBestPlane", &fcosmicShowerBestPlane, "cosmicShowerBestPlane[NCOSMICS]/I");
199  fPandoraCosmics->Branch("cosmicEndPosition", &fcosmicEndPosition, "cosmicEndPosition[NCOSMICS][3]/D");
200  fPandoraCosmics->Branch("cosmicStartPosition", &fcosmicStartPosition, "cosmicStartPosition[NCOSMICS][3]/D");
201  fPandoraCosmics->Branch("cosmicEndDirection", &fcosmicEndDirection, "cosmicEndDirection[NCOSMICS][3]/D");
202  fPandoraCosmics->Branch("cosmicStartDirection", &fcosmicStartDirection, "cosmicStartDirection[NCOSMICS][3]/D");
203  fPandoraCosmics->Branch("cosmicMomentumByRangeMuon", &fcosmicMomentumByRangeMuon, "cosmicMomentumByRangeMuon[NCOSMICS]/D");
204  fPandoraCosmics->Branch("cosmicMomentumByRangeProton", &fcosmicMomentumByRangeProton, "cosmicMomentumByRangeProton[NCOSMICS]/D");
205  fPandoraCosmics->Branch("cosmicKineticEnergy", &fcosmicKineticEnergy, "cosmicKineticEnergy[NCOSMICS][3]/D");
206  fPandoraCosmics->Branch("cosmicRange", &fcosmicRange, "cosmicRange[NCOSMICS][3]/D");
207  fPandoraCosmics->Branch("cosmicTrkPitchC", &fcosmicTrkPitchC, "cosmicTrkPitchC[NCOSMICS][3]/D");
208  fPandoraCosmics->Branch("cosmicT0", &fcosmicT0, "cosmicT0[NCOSMICS]/D");
209 
210  fPandoraCosmics->Branch("cosmicPID_Pdg", &fcosmicPID_Pdg, "cosmicPID_Pdg[NCOSMICS][3]/I");
211  fPandoraCosmics->Branch("cosmicPID_Ndf", &fcosmicPID_Ndf, "cosmicPID_Ndf[NCOSMICS][3]/I");
212  fPandoraCosmics->Branch("cosmicPID_MinChi2", &fcosmicPID_MinChi2, "cosmicPID_MinChi2[NCOSMICS][3]/D");
213  fPandoraCosmics->Branch("cosmicPID_DeltaChi2", &fcosmicPID_DeltaChi2, "cosmicPID_DeltaChi2[NCOSMICS][3]/D");
214  fPandoraCosmics->Branch("cosmicPID_Chi2Proton", &fcosmicPID_Chi2Proton, "cosmicPID_Chi2Proton[NCOSMICS][3]/D");
215  fPandoraCosmics->Branch("cosmicPID_Chi2Kaon", &fcosmicPID_Chi2Kaon, "cosmicPID_Chi2Kaon[NCOSMICS][3]/D");
216  fPandoraCosmics->Branch("cosmicPID_Chi2Pion", &fcosmicPID_Chi2Pion, "cosmicPID_Chi2Pion[NCOSMICS][3]/D");
217  fPandoraCosmics->Branch("cosmicPID_Chi2Muon", &fcosmicPID_Chi2Muon, "cosmicPID_Chi2Muon[NCOSMICS][3]/D");
218  fPandoraCosmics->Branch("cosmicPID_MissingE", &fcosmicPID_MissingE, "cosmicPID_MissingE[NCOSMICS][3]/D");
219  fPandoraCosmics->Branch("cosmicPID_MissingEavg", &fcosmicPID_MissingEavg, "cosmicPID_MissingEavg[NCOSMICS][3]/D");
220  fPandoraCosmics->Branch("cosmicPID_PIDA", &fcosmicPID_PIDA, "cosmicPID_PIDA[NCOSMICS][3]/D");
221 
222 }
void protoana::ProtoDUNEDPAnalCosmicTree::endJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 246 of file ProtoDUNEDPAnalCosmicTree_module.cc.

246  {
247 
248 }
void protoana::ProtoDUNEDPAnalCosmicTree::FillCosmicsTree ( art::Event const &  evt)
private

Definition at line 250 of file ProtoDUNEDPAnalCosmicTree_module.cc.

250  {
251 
252  unsigned int npfParticles = pfpUtil.GetNumberPrimaryPFParticle(evt,fPFParticleTag);
253 
254  if(npfParticles == 0){
255  std::cout << "WARNING::No PfParticles found! Skipping event!" << std::endl;
256  return;
257  }
258 
259  // Do not process more than NMAXCOSMICPARTICLES
260  if(fNCOSMICS > NMAXCOSMICPARTICLES) return;
261 
262  // Get all PFParticles
263  auto recoParticles = evt.getValidHandle<std::vector<recob::PFParticle>>(fPFParticleTag);
264 
265  for(unsigned int i = 0; i < recoParticles->size(); i++){
266  recob::PFParticle* pfparticle = const_cast<recob::PFParticle*>(&(recoParticles->at(i)));
267  //const recob::PFParticle* pfparticle = &(recoParticles->at(i));
268 
269  // Only consider primary particles
270  if(!pfparticle->IsPrimary()) continue;
271 
272  // Do not consider beam particles
273  if(pfpUtil.IsBeamParticle(*pfparticle, evt, fPFParticleTag)) continue;
274 
275  // Get the T0 for this pfParticle
276  std::vector<anab::T0> pfT0vec = pfpUtil.GetPFParticleT0(*pfparticle,evt,fPFParticleTag);
277  //if(pfT0vec.empty()) continue;
278 
279  const recob::Track* thisTrack = pfpUtil.GetPFParticleTrack(*pfparticle,evt,fPFParticleTag,fTrackerTag);
280  const recob::Shower* thisShower = pfpUtil.GetPFParticleShower(*pfparticle,evt,fPFParticleTag,fShowerTag);
281 
282  // Do not save very short cosmic tracks
283  if(thisTrack != 0x0 && thisTrack->Length() < fMinimumTrackLength) continue;
284  if(thisShower != 0x0 && thisShower->Length() < fMinimumTrackLength) continue;
285 
286  // Pandora's BDT beam-cosmic score
288 
289  // NHits associated with this pfParticle
291 
292  if(!pfT0vec.empty())
293  fcosmicT0[fNCOSMICS] = pfT0vec[0].Time();
294 
295  // Check if it is clear cosmic
297 
298  if(thisTrack != 0x0){
301  fcosmicID[fNCOSMICS] = thisTrack->ParticleId();
302  fcosmicTheta[fNCOSMICS] = thisTrack->Theta();
303  fcosmicPhi[fNCOSMICS] = thisTrack->Phi();
304  fcosmicLength[fNCOSMICS] = thisTrack->Length();
305  //fcosmicMomentum[fNCOSMICS] = thisTrack->StartMomentum();
306  //fcosmicEndMomentum[fNCOSMICS] = thisTrack->EndMomentum();
307  fcosmicEndPosition[fNCOSMICS][0] = thisTrack->Trajectory().End().X();
308  fcosmicEndPosition[fNCOSMICS][1] = thisTrack->Trajectory().End().Y();
309  fcosmicEndPosition[fNCOSMICS][2] = thisTrack->Trajectory().End().Z();
310  fcosmicStartPosition[fNCOSMICS][0] = thisTrack->Trajectory().Start().X();
311  fcosmicStartPosition[fNCOSMICS][1] = thisTrack->Trajectory().Start().Y();
312  fcosmicStartPosition[fNCOSMICS][2] = thisTrack->Trajectory().Start().Z();
313  fcosmicEndDirection[fNCOSMICS][0] = thisTrack->Trajectory().EndDirection().X();
314  fcosmicEndDirection[fNCOSMICS][1] = thisTrack->Trajectory().EndDirection().Y();
315  fcosmicEndDirection[fNCOSMICS][2] = thisTrack->Trajectory().EndDirection().Z();
316  fcosmicStartDirection[fNCOSMICS][0] = thisTrack->Trajectory().StartDirection().X();
317  fcosmicStartDirection[fNCOSMICS][1] = thisTrack->Trajectory().StartDirection().Y();
318  fcosmicStartDirection[fNCOSMICS][2] = thisTrack->Trajectory().StartDirection().Z();
319 
322 
323  // Calorimetry
324  std::vector<anab::Calorimetry> calovector = trackUtil.GetRecoTrackCalorimetry(*thisTrack, evt, fTrackerTag, fCalorimetryTag);
325  if(calovector.size() != 3)
326  std::cerr << "WARNING::Calorimetry vector size for cosmic is = " << calovector.size() << std::endl;
327 
328  for(size_t k = 0; k < calovector.size() && k<3; k++){
329  int plane = calovector[k].PlaneID().Plane;
330  if(plane < 0) continue;
331  if(plane > 2) continue;
332  fcosmicKineticEnergy[fNCOSMICS][plane] = calovector[k].KineticEnergy();
333  fcosmicRange[fNCOSMICS][plane] = calovector[k].Range();
334  fcosmicTrkPitchC[fNCOSMICS][plane] = calovector[k].TrkPitchC();
335  }
336 
337  // PID
338  std::vector<anab::ParticleID> pids = trackUtil.GetRecoTrackPID(*thisTrack, evt, fTrackerTag, fParticleIDTag);
339  if(pids.size() != 3)
340  std::cerr << "WARNING::PID vector size for primary is = " << pids.size() << std::endl;
341 
342  for(size_t k = 0; k < pids.size() && k<3; k++){
343  int plane = pids[k].PlaneID().Plane;
344  if(plane < 0) continue;
345  if(plane > 2) continue;
346  fcosmicPID_Pdg[fNCOSMICS][plane] = pids[plane].Pdg();
347  fcosmicPID_Ndf[fNCOSMICS][plane] = pids[plane].Ndf();
348  fcosmicPID_MinChi2[fNCOSMICS][plane] = pids[plane].MinChi2();
349  fcosmicPID_DeltaChi2[fNCOSMICS][plane] = pids[plane].DeltaChi2();
350  fcosmicPID_Chi2Proton[fNCOSMICS][plane] = pids[plane].Chi2Proton();
351  fcosmicPID_Chi2Kaon[fNCOSMICS][plane] = pids[plane].Chi2Kaon();
352  fcosmicPID_Chi2Pion[fNCOSMICS][plane] = pids[plane].Chi2Pion();
353  fcosmicPID_Chi2Muon[fNCOSMICS][plane] = pids[plane].Chi2Muon();
354  fcosmicPID_MissingE[fNCOSMICS][plane] = pids[plane].MissingE();
355  fcosmicPID_MissingEavg[fNCOSMICS][plane] = pids[plane].MissingEavg();
356  fcosmicPID_PIDA[fNCOSMICS][plane] = pids[plane].PIDA();
357  }
358 
359  }
360  else if(thisShower != 0x0){
363 
364  fcosmicID[fNCOSMICS] = thisShower->ID();
365  fcosmicLength[fNCOSMICS] = thisShower->Length();
367  fcosmicOpeningAngle[fNCOSMICS] = thisShower->OpenAngle();
368  fcosmicStartPosition[fNCOSMICS][0] = thisShower->ShowerStart().X();
369  fcosmicStartPosition[fNCOSMICS][1] = thisShower->ShowerStart().Y();
370  fcosmicStartPosition[fNCOSMICS][2] = thisShower->ShowerStart().Z();
371  fcosmicStartDirection[fNCOSMICS][0] = thisShower->Direction().X();
372  fcosmicStartDirection[fNCOSMICS][1] = thisShower->Direction().Y();
373  fcosmicStartDirection[fNCOSMICS][2] = thisShower->Direction().Z();
374  }
375  else{
376  std::cout << "INFO::Cosmic pfParticle is not track or shower. Skip!" << std::endl;
377  continue;
378  }
379 
380  // Increment number of cosmic tracks
381  fNCOSMICS++;
382 
383  }
384 
385  fPandoraCosmics->Fill();
386 
387 }
int best_plane() const
Definition: Shower.h:200
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.
bool IsBeamParticle(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Use the pandora metadata to tell us if this is a beam particle or not.
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.
const int NMAXCOSMICPARTICLES
double Length() const
Definition: Shower.h:201
int ParticleId() const
Definition: Track.h:171
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.
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.
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.
bool IsClearCosmic(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Pandora tags and removes clear cosmics before slicing, so check if this particle is a clear cosmic...
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
double Phi() const
Definition: Track.h:178
double Length(size_t p=0) const
Access to various track properties.
Definition: Track.h:167
double Theta() const
Access to spherical or geographical angles at vertex or at any point.
Definition: Track.h:176
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 OpenAngle() const
Definition: Shower.h:202
bool IsPrimary() const
Returns whether the particle is the root of the flow.
Definition: PFParticle.h:86
const TVector3 & Direction() const
Definition: Shower.h:189
Vector_t EndDirection() const
Returns the direction of the trajectory at the last point.
Hierarchical representation of particle flow.
Definition: PFParticle.h:44
Point_t const & End() const
Returns the position of the last valid point of the trajectory [cm].
TCEvent evt
Definition: DataStructs.cxx:7
unsigned int GetNumberPrimaryPFParticle(art::Event const &evt, const std::string particleLabel) const
Get the number of primary PFParticles.
Vector_t StartDirection() const
Returns the direction of the trajectory at the first point.
Point_t const & Start() const
Returns the position of the first valid point of the trajectory [cm].
int ID() const
Definition: Shower.h:187
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.
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
double GetTrackMomentum(double trkrange, int pdg) const
QTextStream & endl(QTextStream &s)
void protoana::ProtoDUNEDPAnalCosmicTree::Initialise ( )
private

Definition at line 389 of file ProtoDUNEDPAnalCosmicTree_module.cc.

389  {
390 
391  fRun = -999;
392  fSubRun = -999;
393  fevent = -999;
394  fTimeStamp = -999.0;
395  for(int k=0; k < 5; k++)
396  fNactivefembs[k] = -999;
397 
398  // Cosmics tree
399  fNCOSMICS = 0;
400  for(int k=0; k < NMAXCOSMICPARTICLES; k++){
401  fcosmicIsClear[k] = -999;
402  fcosmicNHits[k] = -999;
403  fcosmicBDTScore[k] = -999.0;
404  fiscosmictrack[k] = -999;
405  fiscosmicshower[k] = -999;
406  fcosmicID[k] = -999;
407  fcosmicTheta[k] = -999.0;
408  fcosmicPhi[k] = -999.0;
409  fcosmicLength[k] = -999.0;
410  //fcosmicMomentum[k] = -999.0;
411  //fcosmicEndMomentum[k] = -999.0;
412  fcosmicMomentumByRangeMuon[k] = -999.0;
414  fcosmicT0[k] = -999.0;
415  fcosmicShowerBestPlane[k] = -999.0;
416  fcosmicOpeningAngle[k] = -999.0;
417 
418  for(int l=0; l < 3; l++){
419  fcosmicEndPosition[k][l] = -999.0;
420  fcosmicStartPosition[k][l] = -999.0;
421  fcosmicEndDirection[k][l] = -999.0;
422  fcosmicStartDirection[k][l] = -999.0;
423  fcosmicKineticEnergy[k][l] = -999.0;
424  fcosmicRange[k][l] = -999.0;
425  fcosmicTrkPitchC[k][l] = -999.0;
426 
427  fcosmicPID_Pdg[k][l] = -999.0;
428  fcosmicPID_Ndf[k][l] = -999.0;
429  fcosmicPID_MinChi2[k][l] = -999.0;
430  fcosmicPID_DeltaChi2[k][l] = -999.0;
431  fcosmicPID_Chi2Proton[k][l] = -999.0;
432  fcosmicPID_Chi2Kaon[k][l] = -999.0;
433  fcosmicPID_Chi2Pion[k][l] = -999.0;
434  fcosmicPID_Chi2Muon[k][l] = -999.0;
435  fcosmicPID_MissingE[k][l] = -999.0;
436  fcosmicPID_MissingEavg[k][l] = -999.0;
437  fcosmicPID_PIDA[k][l] = -999.0;
438  }
439  }
440 
441 }
const int NMAXCOSMICPARTICLES
static QStrList * l
Definition: config.cpp:1044
ProtoDUNEDPAnalCosmicTree& protoana::ProtoDUNEDPAnalCosmicTree::operator= ( ProtoDUNEDPAnalCosmicTree const &  )
delete
ProtoDUNEDPAnalCosmicTree& protoana::ProtoDUNEDPAnalCosmicTree::operator= ( ProtoDUNEDPAnalCosmicTree &&  )
delete

Member Data Documentation

const art::InputTag protoana::ProtoDUNEDPAnalCosmicTree::fBeamModuleLabel
private

Definition at line 98 of file ProtoDUNEDPAnalCosmicTree_module.cc.

std::string protoana::ProtoDUNEDPAnalCosmicTree::fCalorimetryTag
private

Definition at line 99 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicBDTScore[NMAXCOSMICPARTICLES]
private

Definition at line 120 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicEndDirection[NMAXCOSMICPARTICLES][3]
private

Definition at line 136 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicEndPosition[NMAXCOSMICPARTICLES][3]
private

Definition at line 134 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicID[NMAXCOSMICPARTICLES]
private

Definition at line 123 of file ProtoDUNEDPAnalCosmicTree_module.cc.

int protoana::ProtoDUNEDPAnalCosmicTree::fcosmicIsClear[NMAXCOSMICPARTICLES]
private

Definition at line 118 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicKineticEnergy[NMAXCOSMICPARTICLES][3]
private

Definition at line 138 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicLength[NMAXCOSMICPARTICLES]
private

Definition at line 126 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicMomentumByRangeMuon[NMAXCOSMICPARTICLES]
private

Definition at line 129 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicMomentumByRangeProton[NMAXCOSMICPARTICLES]
private

Definition at line 130 of file ProtoDUNEDPAnalCosmicTree_module.cc.

int protoana::ProtoDUNEDPAnalCosmicTree::fcosmicNHits[NMAXCOSMICPARTICLES]
private

Definition at line 119 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicOpeningAngle[NMAXCOSMICPARTICLES]
private

Definition at line 132 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicPhi[NMAXCOSMICPARTICLES]
private

Definition at line 125 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicPID_Chi2Kaon[NMAXCOSMICPARTICLES][3]
private

Definition at line 149 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicPID_Chi2Muon[NMAXCOSMICPARTICLES][3]
private

Definition at line 151 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicPID_Chi2Pion[NMAXCOSMICPARTICLES][3]
private

Definition at line 150 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicPID_Chi2Proton[NMAXCOSMICPARTICLES][3]
private

Definition at line 148 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicPID_DeltaChi2[NMAXCOSMICPARTICLES][3]
private

Definition at line 147 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicPID_MinChi2[NMAXCOSMICPARTICLES][3]
private

Definition at line 146 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicPID_MissingE[NMAXCOSMICPARTICLES][3]
private

Definition at line 152 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicPID_MissingEavg[NMAXCOSMICPARTICLES][3]
private

Definition at line 153 of file ProtoDUNEDPAnalCosmicTree_module.cc.

int protoana::ProtoDUNEDPAnalCosmicTree::fcosmicPID_Ndf[NMAXCOSMICPARTICLES][3]
private

Definition at line 145 of file ProtoDUNEDPAnalCosmicTree_module.cc.

int protoana::ProtoDUNEDPAnalCosmicTree::fcosmicPID_Pdg[NMAXCOSMICPARTICLES][3]
private

Definition at line 144 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicPID_PIDA[NMAXCOSMICPARTICLES][3]
private

Definition at line 154 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicRange[NMAXCOSMICPARTICLES][3]
private

Definition at line 139 of file ProtoDUNEDPAnalCosmicTree_module.cc.

int protoana::ProtoDUNEDPAnalCosmicTree::fcosmicShowerBestPlane[NMAXCOSMICPARTICLES]
private

Definition at line 131 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicStartDirection[NMAXCOSMICPARTICLES][3]
private

Definition at line 137 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicStartPosition[NMAXCOSMICPARTICLES][3]
private

Definition at line 135 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicT0[NMAXCOSMICPARTICLES]
private

Definition at line 142 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicTheta[NMAXCOSMICPARTICLES]
private

Definition at line 124 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fcosmicTrkPitchC[NMAXCOSMICPARTICLES][3]
private

Definition at line 140 of file ProtoDUNEDPAnalCosmicTree_module.cc.

int protoana::ProtoDUNEDPAnalCosmicTree::fevent
private

Definition at line 112 of file ProtoDUNEDPAnalCosmicTree_module.cc.

std::string protoana::ProtoDUNEDPAnalCosmicTree::fGeneratorTag
private

Definition at line 104 of file ProtoDUNEDPAnalCosmicTree_module.cc.

int protoana::ProtoDUNEDPAnalCosmicTree::fiscosmicshower[NMAXCOSMICPARTICLES]
private

Definition at line 122 of file ProtoDUNEDPAnalCosmicTree_module.cc.

int protoana::ProtoDUNEDPAnalCosmicTree::fiscosmictrack[NMAXCOSMICPARTICLES]
private

Definition at line 121 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fMinimumTrackLength
private

Definition at line 105 of file ProtoDUNEDPAnalCosmicTree_module.cc.

int protoana::ProtoDUNEDPAnalCosmicTree::fNactivefembs[6]
private

Definition at line 114 of file ProtoDUNEDPAnalCosmicTree_module.cc.

int protoana::ProtoDUNEDPAnalCosmicTree::fNCOSMICS
private

Definition at line 117 of file ProtoDUNEDPAnalCosmicTree_module.cc.

TTree* protoana::ProtoDUNEDPAnalCosmicTree::fPandoraCosmics
private

Definition at line 107 of file ProtoDUNEDPAnalCosmicTree_module.cc.

std::string protoana::ProtoDUNEDPAnalCosmicTree::fParticleIDTag
private

Definition at line 100 of file ProtoDUNEDPAnalCosmicTree_module.cc.

std::string protoana::ProtoDUNEDPAnalCosmicTree::fPFParticleTag
private

Definition at line 103 of file ProtoDUNEDPAnalCosmicTree_module.cc.

int protoana::ProtoDUNEDPAnalCosmicTree::fRun
private

Definition at line 110 of file ProtoDUNEDPAnalCosmicTree_module.cc.

std::string protoana::ProtoDUNEDPAnalCosmicTree::fShowerTag
private

Definition at line 102 of file ProtoDUNEDPAnalCosmicTree_module.cc.

int protoana::ProtoDUNEDPAnalCosmicTree::fSubRun
private

Definition at line 111 of file ProtoDUNEDPAnalCosmicTree_module.cc.

double protoana::ProtoDUNEDPAnalCosmicTree::fTimeStamp
private

Definition at line 113 of file ProtoDUNEDPAnalCosmicTree_module.cc.

std::string protoana::ProtoDUNEDPAnalCosmicTree::fTrackerTag
private

Definition at line 101 of file ProtoDUNEDPAnalCosmicTree_module.cc.

protoana::ProtoDUNEPFParticleUtils protoana::ProtoDUNEDPAnalCosmicTree::pfpUtil
private

Definition at line 84 of file ProtoDUNEDPAnalCosmicTree_module.cc.

protoana::ProtoDUNETrackUtils protoana::ProtoDUNEDPAnalCosmicTree::trackUtil
private

Definition at line 85 of file ProtoDUNEDPAnalCosmicTree_module.cc.

trkf::TrackMomentumCalculator protoana::ProtoDUNEDPAnalCosmicTree::trmom
private

Definition at line 89 of file ProtoDUNEDPAnalCosmicTree_module.cc.

protoana::ProtoDUNETruthUtils protoana::ProtoDUNEDPAnalCosmicTree::truthUtil
private

Definition at line 86 of file ProtoDUNEDPAnalCosmicTree_module.cc.


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