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

Public Member Functions

 ProtoDUNEAnalCosmicTree (fhicl::ParameterSet const &p)
 
 ProtoDUNEAnalCosmicTree (ProtoDUNEAnalCosmicTree const &)=delete
 
 ProtoDUNEAnalCosmicTree (ProtoDUNEAnalCosmicTree &&)=delete
 
ProtoDUNEAnalCosmicTreeoperator= (ProtoDUNEAnalCosmicTree const &)=delete
 
ProtoDUNEAnalCosmicTreeoperator= (ProtoDUNEAnalCosmicTree &&)=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::ProtoDUNEDataUtils dataUtil
 
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 ProtoDUNEAnalCosmicTree_module.cc.

Constructor & Destructor Documentation

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

Definition at line 160 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Member Function Documentation

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

Implements art::EDAnalyzer.

Definition at line 225 of file ProtoDUNEAnalCosmicTree_module.cc.

225  {
226 
227  // Initialise tree parameters
228  Initialise();
229 
230  fRun = evt.run();
231  fSubRun = evt.subRun();
232  fevent = evt.id().event();
233  art::Timestamp ts = evt.time();
234  if (ts.timeHigh() == 0){
235  TTimeStamp ts2(ts.timeLow());
236  fTimeStamp = ts2.AsDouble();
237  }
238  else{
239  TTimeStamp ts2(ts.timeHigh(), ts.timeLow());
240  fTimeStamp = ts2.AsDouble();
241  }
242 
243  // Get number of active fembs
244  int allactivefembs = 0;
245  if(!evt.isRealData()){
246  allactivefembs = 120;
247  for(int k=0; k < 6; k++)
248  fNactivefembs[0] = 20;
249  }
250  else{
251  for(int k=0; k < 6; k++){
253  allactivefembs += fNactivefembs[k];
254  }
255  }
256 
257  //trmom.SetMinLength(100);
258 
259  // For cosmics only save events if the all fembs are active
260  if(allactivefembs != 120) return;
261 
263 
264 }
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
int GetNActiveFembsForAPA(art::Event const &evt, int apa) const
Get number of active fembs in an APA.
unsigned int subRun
Definition: DataStructs.h:638
TCEvent evt
Definition: DataStructs.cxx:7
void protoana::ProtoDUNEAnalCosmicTree::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 176 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Reimplemented from art::EDAnalyzer.

Definition at line 266 of file ProtoDUNEAnalCosmicTree_module.cc.

266  {
267 
268 }
void protoana::ProtoDUNEAnalCosmicTree::FillCosmicsTree ( art::Event const &  evt)
private

Definition at line 270 of file ProtoDUNEAnalCosmicTree_module.cc.

270  {
271 
272  unsigned int npfParticles = pfpUtil.GetNumberPrimaryPFParticle(evt,fPFParticleTag);
273 
274  if(npfParticles == 0){
275  std::cout << "WARNING::No PfParticles found! Skipping event!" << std::endl;
276  return;
277  }
278 
279  // Do not process more than NMAXCOSMICPARTICLES
280  if(fNCOSMICS >= NMAXCOSMICPARTICLES) return;
281 
282  // Get all PFParticles
283  auto recoParticles = evt.getValidHandle<std::vector<recob::PFParticle>>(fPFParticleTag);
284 
285  for(unsigned int i = 0; i < recoParticles->size(); i++){
286  recob::PFParticle* pfparticle = const_cast<recob::PFParticle*>(&(recoParticles->at(i)));
287  //const recob::PFParticle* pfparticle = &(recoParticles->at(i));
288 
289  // Only consider primary particles
290  if(!pfparticle->IsPrimary()) continue;
291 
292  // Do not consider beam particles
293  if(pfpUtil.IsBeamParticle(*pfparticle, evt, fPFParticleTag)) continue;
294 
295  // Get the T0 for this pfParticle
296  std::vector<anab::T0> pfT0vec = pfpUtil.GetPFParticleT0(*pfparticle,evt,fPFParticleTag);
297  //if(pfT0vec.empty()) continue;
298 
299  const recob::Track* thisTrack = pfpUtil.GetPFParticleTrack(*pfparticle,evt,fPFParticleTag,fTrackerTag);
300  const recob::Shower* thisShower = pfpUtil.GetPFParticleShower(*pfparticle,evt,fPFParticleTag,fShowerTag);
301 
302  // Do not save very short cosmic tracks
303  if(thisTrack != 0x0 && thisTrack->Length() < fMinimumTrackLength) continue;
304  if(thisShower != 0x0 && thisShower->Length() < fMinimumTrackLength) continue;
305 
306  // Pandora's BDT beam-cosmic score
308 
309  // NHits associated with this pfParticle
311 
312  if(!pfT0vec.empty())
313  fcosmicT0[fNCOSMICS] = pfT0vec[0].Time();
314 
315  // Check if it is clear cosmic
317 
318  if(thisTrack != 0x0){
321  fcosmicID[fNCOSMICS] = thisTrack->ParticleId();
322  fcosmicTheta[fNCOSMICS] = thisTrack->Theta();
323  fcosmicPhi[fNCOSMICS] = thisTrack->Phi();
324  fcosmicLength[fNCOSMICS] = thisTrack->Length();
325  //fcosmicMomentum[fNCOSMICS] = thisTrack->StartMomentum();
326  //fcosmicEndMomentum[fNCOSMICS] = thisTrack->EndMomentum();
327  fcosmicEndPosition[fNCOSMICS][0] = thisTrack->Trajectory().End().X();
328  fcosmicEndPosition[fNCOSMICS][1] = thisTrack->Trajectory().End().Y();
329  fcosmicEndPosition[fNCOSMICS][2] = thisTrack->Trajectory().End().Z();
330  fcosmicStartPosition[fNCOSMICS][0] = thisTrack->Trajectory().Start().X();
331  fcosmicStartPosition[fNCOSMICS][1] = thisTrack->Trajectory().Start().Y();
332  fcosmicStartPosition[fNCOSMICS][2] = thisTrack->Trajectory().Start().Z();
333  fcosmicEndDirection[fNCOSMICS][0] = thisTrack->Trajectory().EndDirection().X();
334  fcosmicEndDirection[fNCOSMICS][1] = thisTrack->Trajectory().EndDirection().Y();
335  fcosmicEndDirection[fNCOSMICS][2] = thisTrack->Trajectory().EndDirection().Z();
336  fcosmicStartDirection[fNCOSMICS][0] = thisTrack->Trajectory().StartDirection().X();
337  fcosmicStartDirection[fNCOSMICS][1] = thisTrack->Trajectory().StartDirection().Y();
338  fcosmicStartDirection[fNCOSMICS][2] = thisTrack->Trajectory().StartDirection().Z();
339 
342 
343  // Calorimetry
344  std::vector<anab::Calorimetry> calovector = trackUtil.GetRecoTrackCalorimetry(*thisTrack, evt, fTrackerTag, fCalorimetryTag);
345  if(calovector.size() != 3)
346  std::cerr << "WARNING::Calorimetry vector size for cosmic is = " << calovector.size() << std::endl;
347 
348  for(size_t k = 0; k < calovector.size() && k<3; k++){
349  int plane = calovector[k].PlaneID().Plane;
350  if(plane < 0) continue;
351  if(plane > 2) continue;
352  fcosmicKineticEnergy[fNCOSMICS][plane] = calovector[k].KineticEnergy();
353  fcosmicRange[fNCOSMICS][plane] = calovector[k].Range();
354  fcosmicTrkPitchC[fNCOSMICS][plane] = calovector[k].TrkPitchC();
355  }
356 
357  // PID
358  std::vector<anab::ParticleID> pids = trackUtil.GetRecoTrackPID(*thisTrack, evt, fTrackerTag, fParticleIDTag);
359  if(pids.size() != 3)
360  std::cerr << "WARNING::PID vector size for primary is = " << pids.size() << std::endl;
361 
362  for(size_t k = 0; k < pids.size() && k<3; k++){
363  int plane = pids[k].PlaneID().Plane;
364  if(plane < 0) continue;
365  if(plane > 2) continue;
366  fcosmicPID_Pdg[fNCOSMICS][plane] = pids[plane].Pdg();
367  fcosmicPID_Ndf[fNCOSMICS][plane] = pids[plane].Ndf();
368  fcosmicPID_MinChi2[fNCOSMICS][plane] = pids[plane].MinChi2();
369  fcosmicPID_DeltaChi2[fNCOSMICS][plane] = pids[plane].DeltaChi2();
370  fcosmicPID_Chi2Proton[fNCOSMICS][plane] = pids[plane].Chi2Proton();
371  fcosmicPID_Chi2Kaon[fNCOSMICS][plane] = pids[plane].Chi2Kaon();
372  fcosmicPID_Chi2Pion[fNCOSMICS][plane] = pids[plane].Chi2Pion();
373  fcosmicPID_Chi2Muon[fNCOSMICS][plane] = pids[plane].Chi2Muon();
374  fcosmicPID_MissingE[fNCOSMICS][plane] = pids[plane].MissingE();
375  fcosmicPID_MissingEavg[fNCOSMICS][plane] = pids[plane].MissingEavg();
376  fcosmicPID_PIDA[fNCOSMICS][plane] = pids[plane].PIDA();
377  }
378 
379  }
380  else if(thisShower != 0x0){
383 
384  fcosmicID[fNCOSMICS] = thisShower->ID();
385  fcosmicLength[fNCOSMICS] = thisShower->Length();
387  fcosmicOpeningAngle[fNCOSMICS] = thisShower->OpenAngle();
388  fcosmicStartPosition[fNCOSMICS][0] = thisShower->ShowerStart().X();
389  fcosmicStartPosition[fNCOSMICS][1] = thisShower->ShowerStart().Y();
390  fcosmicStartPosition[fNCOSMICS][2] = thisShower->ShowerStart().Z();
391  fcosmicStartDirection[fNCOSMICS][0] = thisShower->Direction().X();
392  fcosmicStartDirection[fNCOSMICS][1] = thisShower->Direction().Y();
393  fcosmicStartDirection[fNCOSMICS][2] = thisShower->Direction().Z();
394  }
395  else{
396  std::cout << "INFO::Cosmic pfParticle is not track or shower. Skip!" << std::endl;
397  continue;
398  }
399 
400  // Increment number of cosmic tracks
401  fNCOSMICS++;
402 
403  }
404 
405  fPandoraCosmics->Fill();
406 
407 }
double fcosmicMomentumByRangeMuon[NMAXCOSMICPARTICLES]
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.
double fcosmicPID_Chi2Kaon[NMAXCOSMICPARTICLES][3]
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.
protoana::ProtoDUNEPFParticleUtils pfpUtil
double fcosmicPID_Chi2Proton[NMAXCOSMICPARTICLES][3]
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 fcosmicStartPosition[NMAXCOSMICPARTICLES][3]
double fcosmicPID_MinChi2[NMAXCOSMICPARTICLES][3]
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.
double fcosmicPID_PIDA[NMAXCOSMICPARTICLES][3]
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...
double fcosmicKineticEnergy[NMAXCOSMICPARTICLES][3]
double fcosmicStartDirection[NMAXCOSMICPARTICLES][3]
const int NMAXCOSMICPARTICLES
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 fcosmicMomentumByRangeProton[NMAXCOSMICPARTICLES]
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 fcosmicEndDirection[NMAXCOSMICPARTICLES][3]
double OpenAngle() const
Definition: Shower.h:202
double fcosmicPID_MissingE[NMAXCOSMICPARTICLES][3]
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
double fcosmicEndPosition[NMAXCOSMICPARTICLES][3]
Vector_t EndDirection() const
Returns the direction of the trajectory at the last point.
double fcosmicPID_MissingEavg[NMAXCOSMICPARTICLES][3]
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].
double fcosmicPID_DeltaChi2[NMAXCOSMICPARTICLES][3]
TCEvent evt
Definition: DataStructs.cxx:7
unsigned int GetNumberPrimaryPFParticle(art::Event const &evt, const std::string particleLabel) const
Get the number of primary PFParticles.
double fcosmicPID_Chi2Muon[NMAXCOSMICPARTICLES][3]
double fcosmicTrkPitchC[NMAXCOSMICPARTICLES][3]
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].
double fcosmicPID_Chi2Pion[NMAXCOSMICPARTICLES][3]
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::ProtoDUNEAnalCosmicTree::Initialise ( )
private

Definition at line 409 of file ProtoDUNEAnalCosmicTree_module.cc.

409  {
410 
411  fRun = -999;
412  fSubRun = -999;
413  fevent = -999;
414  fTimeStamp = -999.0;
415  for(int k=0; k < 5; k++)
416  fNactivefembs[k] = -999;
417 
418  // Cosmics tree
419  fNCOSMICS = 0;
420  for(int k=0; k < NMAXCOSMICPARTICLES; k++){
421  fcosmicIsClear[k] = -999;
422  fcosmicNHits[k] = -999;
423  fcosmicBDTScore[k] = -999.0;
424  fiscosmictrack[k] = -999;
425  fiscosmicshower[k] = -999;
426  fcosmicID[k] = -999;
427  fcosmicTheta[k] = -999.0;
428  fcosmicPhi[k] = -999.0;
429  fcosmicLength[k] = -999.0;
430  //fcosmicMomentum[k] = -999.0;
431  //fcosmicEndMomentum[k] = -999.0;
432  fcosmicMomentumByRangeMuon[k] = -999.0;
434  fcosmicT0[k] = -999.0;
435  fcosmicShowerBestPlane[k] = -999.0;
436  fcosmicOpeningAngle[k] = -999.0;
437 
438  for(int l=0; l < 3; l++){
439  fcosmicEndPosition[k][l] = -999.0;
440  fcosmicStartPosition[k][l] = -999.0;
441  fcosmicEndDirection[k][l] = -999.0;
442  fcosmicStartDirection[k][l] = -999.0;
443  fcosmicKineticEnergy[k][l] = -999.0;
444  fcosmicRange[k][l] = -999.0;
445  fcosmicTrkPitchC[k][l] = -999.0;
446 
447  fcosmicPID_Pdg[k][l] = -999.0;
448  fcosmicPID_Ndf[k][l] = -999.0;
449  fcosmicPID_MinChi2[k][l] = -999.0;
450  fcosmicPID_DeltaChi2[k][l] = -999.0;
451  fcosmicPID_Chi2Proton[k][l] = -999.0;
452  fcosmicPID_Chi2Kaon[k][l] = -999.0;
453  fcosmicPID_Chi2Pion[k][l] = -999.0;
454  fcosmicPID_Chi2Muon[k][l] = -999.0;
455  fcosmicPID_MissingE[k][l] = -999.0;
456  fcosmicPID_MissingEavg[k][l] = -999.0;
457  fcosmicPID_PIDA[k][l] = -999.0;
458  }
459  }
460 
461 }
double fcosmicMomentumByRangeMuon[NMAXCOSMICPARTICLES]
double fcosmicPID_Chi2Kaon[NMAXCOSMICPARTICLES][3]
double fcosmicPID_Chi2Proton[NMAXCOSMICPARTICLES][3]
double fcosmicStartPosition[NMAXCOSMICPARTICLES][3]
double fcosmicPID_MinChi2[NMAXCOSMICPARTICLES][3]
double fcosmicPID_PIDA[NMAXCOSMICPARTICLES][3]
double fcosmicKineticEnergy[NMAXCOSMICPARTICLES][3]
double fcosmicStartDirection[NMAXCOSMICPARTICLES][3]
static QStrList * l
Definition: config.cpp:1044
const int NMAXCOSMICPARTICLES
double fcosmicMomentumByRangeProton[NMAXCOSMICPARTICLES]
double fcosmicEndDirection[NMAXCOSMICPARTICLES][3]
double fcosmicPID_MissingE[NMAXCOSMICPARTICLES][3]
double fcosmicEndPosition[NMAXCOSMICPARTICLES][3]
double fcosmicPID_MissingEavg[NMAXCOSMICPARTICLES][3]
double fcosmicPID_DeltaChi2[NMAXCOSMICPARTICLES][3]
double fcosmicPID_Chi2Muon[NMAXCOSMICPARTICLES][3]
double fcosmicTrkPitchC[NMAXCOSMICPARTICLES][3]
double fcosmicPID_Chi2Pion[NMAXCOSMICPARTICLES][3]
ProtoDUNEAnalCosmicTree& protoana::ProtoDUNEAnalCosmicTree::operator= ( ProtoDUNEAnalCosmicTree const &  )
delete
ProtoDUNEAnalCosmicTree& protoana::ProtoDUNEAnalCosmicTree::operator= ( ProtoDUNEAnalCosmicTree &&  )
delete

Member Data Documentation

protoana::ProtoDUNEDataUtils protoana::ProtoDUNEAnalCosmicTree::dataUtil
private

Definition at line 84 of file ProtoDUNEAnalCosmicTree_module.cc.

const art::InputTag protoana::ProtoDUNEAnalCosmicTree::fBeamModuleLabel
private

Definition at line 99 of file ProtoDUNEAnalCosmicTree_module.cc.

std::string protoana::ProtoDUNEAnalCosmicTree::fCalorimetryTag
private

Definition at line 100 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 121 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 137 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 135 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 124 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 119 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 139 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 127 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 130 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 131 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 120 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 133 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 126 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 150 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 152 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 151 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 149 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 148 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 147 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 153 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 154 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 146 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 145 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 155 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 140 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 132 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 138 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 136 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 143 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 125 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 141 of file ProtoDUNEAnalCosmicTree_module.cc.

int protoana::ProtoDUNEAnalCosmicTree::fevent
private

Definition at line 113 of file ProtoDUNEAnalCosmicTree_module.cc.

std::string protoana::ProtoDUNEAnalCosmicTree::fGeneratorTag
private

Definition at line 105 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 123 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 122 of file ProtoDUNEAnalCosmicTree_module.cc.

double protoana::ProtoDUNEAnalCosmicTree::fMinimumTrackLength
private

Definition at line 106 of file ProtoDUNEAnalCosmicTree_module.cc.

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

Definition at line 115 of file ProtoDUNEAnalCosmicTree_module.cc.

int protoana::ProtoDUNEAnalCosmicTree::fNCOSMICS
private

Definition at line 118 of file ProtoDUNEAnalCosmicTree_module.cc.

TTree* protoana::ProtoDUNEAnalCosmicTree::fPandoraCosmics
private

Definition at line 108 of file ProtoDUNEAnalCosmicTree_module.cc.

std::string protoana::ProtoDUNEAnalCosmicTree::fParticleIDTag
private

Definition at line 101 of file ProtoDUNEAnalCosmicTree_module.cc.

std::string protoana::ProtoDUNEAnalCosmicTree::fPFParticleTag
private

Definition at line 104 of file ProtoDUNEAnalCosmicTree_module.cc.

int protoana::ProtoDUNEAnalCosmicTree::fRun
private

Definition at line 111 of file ProtoDUNEAnalCosmicTree_module.cc.

std::string protoana::ProtoDUNEAnalCosmicTree::fShowerTag
private

Definition at line 103 of file ProtoDUNEAnalCosmicTree_module.cc.

int protoana::ProtoDUNEAnalCosmicTree::fSubRun
private

Definition at line 112 of file ProtoDUNEAnalCosmicTree_module.cc.

double protoana::ProtoDUNEAnalCosmicTree::fTimeStamp
private

Definition at line 114 of file ProtoDUNEAnalCosmicTree_module.cc.

std::string protoana::ProtoDUNEAnalCosmicTree::fTrackerTag
private

Definition at line 102 of file ProtoDUNEAnalCosmicTree_module.cc.

protoana::ProtoDUNEPFParticleUtils protoana::ProtoDUNEAnalCosmicTree::pfpUtil
private

Definition at line 85 of file ProtoDUNEAnalCosmicTree_module.cc.

protoana::ProtoDUNETrackUtils protoana::ProtoDUNEAnalCosmicTree::trackUtil
private

Definition at line 86 of file ProtoDUNEAnalCosmicTree_module.cc.

trkf::TrackMomentumCalculator protoana::ProtoDUNEAnalCosmicTree::trmom
private

Definition at line 90 of file ProtoDUNEAnalCosmicTree_module.cc.

protoana::ProtoDUNETruthUtils protoana::ProtoDUNEAnalCosmicTree::truthUtil
private

Definition at line 87 of file ProtoDUNEAnalCosmicTree_module.cc.


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