All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
lar_pandora::PFParticleCosmicAna Class Reference

PFParticleCosmicAna class. More...

Inheritance diagram for lar_pandora::PFParticleCosmicAna:

Public Member Functions

 PFParticleCosmicAna (fhicl::ParameterSet const &pset)
 Constructor. More...
 
virtual ~PFParticleCosmicAna ()
 Destructor. More...
 
void beginJob ()
 
void endJob ()
 
void analyze (const art::Event &evt)
 
void reconfigure (fhicl::ParameterSet const &pset)
 

Private Member Functions

void FillRecoTree (const PFParticlesToHits &recoParticlesToHits, const PFParticlesToTracks &recoParticlesToTracks, const TracksToCosmicTags &recoTracksToCosmicTags)
 Fill event-level variables using input maps between reconstructed objects. More...
 
void FillTrueTree (const HitVector &hitVector, const HitsToMCParticles &trueHitsToParticles, const HitsToPFParticles &recoHitsToParticles, const MCParticlesToMCTruth &particlesToTruth, const PFParticlesToTracks &particlesToTracks, const TracksToCosmicTags &tracksToCosmicTags)
 Fill track-level variables using input maps between reconstructed objects. More...
 
float GetCosmicScore (const art::Ptr< recob::PFParticle > particle, const PFParticlesToTracks &recoParticlesToTracks, const TracksToCosmicTags &recoTracksToCosmicTags) const
 Get cosmic score for a PFParticle using track-level information. More...
 

Private Attributes

TTree * m_pRecoTree
 
TTree * m_pTrueTree
 
int m_run
 
int m_event
 
int m_index
 
int m_self
 
int m_pdgCode
 
int m_isTrackLike
 
int m_isPrimary
 
float m_cosmicScore
 
int m_nTracks
 
int m_nHits
 
float m_trackVtxX
 
float m_trackVtxY
 
float m_trackVtxZ
 
float m_trackEndX
 
float m_trackEndY
 
float m_trackEndZ
 
float m_trackVtxDirX
 
float m_trackVtxDirY
 
float m_trackVtxDirZ
 
float m_trackEndDirX
 
float m_trackEndDirY
 
float m_trackEndDirZ
 
float m_trackLength
 
float m_trackWidthX
 
float m_trackWidthY
 
float m_trackWidthZ
 
float m_trackVtxDeltaYZ
 
float m_trackEndDeltaYZ
 
int m_trackVtxContained
 
int m_trackEndContained
 
int m_nNeutrinoHits
 
int m_nNeutrinoHitsFullyTagged
 
int m_nNeutrinoHitsSemiTagged
 
int m_nNeutrinoHitsNotTagged
 
int m_nNeutrinoHitsNotReconstructed
 
int m_nNeutrinoHitsReconstructed
 
int m_nCosmicHits
 
int m_nCosmicHitsFullyTagged
 
int m_nCosmicHitsSemiTagged
 
int m_nCosmicHitsNotTagged
 
int m_nCosmicHitsNotReconstructed
 
int m_nCosmicHitsReconstructed
 
std::string m_hitfinderLabel
 
std::string m_trackfitLabel
 
std::string m_particleLabel
 
std::string m_cosmicLabel
 
std::string m_geantModuleLabel
 
bool m_useDaughterPFParticles
 
bool m_useDaughterMCParticles
 
double m_cosmicContainmentCut
 

Detailed Description

PFParticleCosmicAna class.

Definition at line 24 of file PFParticleCosmicAna_module.cc.

Constructor & Destructor Documentation

lar_pandora::PFParticleCosmicAna::PFParticleCosmicAna ( fhicl::ParameterSet const &  pset)

Constructor.

Parameters
pset

Definition at line 170 of file PFParticleCosmicAna_module.cc.

170  : art::EDAnalyzer(pset)
171 {
172  this->reconfigure(pset);
173 }
void reconfigure(fhicl::ParameterSet const &pset)
lar_pandora::PFParticleCosmicAna::~PFParticleCosmicAna ( )
virtual

Destructor.

Definition at line 177 of file PFParticleCosmicAna_module.cc.

178 {
179 }

Member Function Documentation

void lar_pandora::PFParticleCosmicAna::analyze ( const art::Event &  evt)

Definition at line 264 of file PFParticleCosmicAna_module.cc.

265 {
266  std::cout << " *** PFParticleCosmicAna::analyze(...) *** " << std::endl;
267 
268  //
269  // Note: I've made this is MicroBooNE-only module
270  //
271 
272  m_run = evt.run();
273  m_event = evt.id().event();
274 
275  std::cout << " Run: " << m_run << std::endl;
276  std::cout << " Event: " << m_event << std::endl;
277 
278 
279  // Collect True Particles
280  // ======================
281  HitVector hitVector;
282  MCTruthToMCParticles truthToParticles;
283  MCParticlesToMCTruth particlesToTruth;
284  MCParticlesToHits trueParticlesToHits;
285  HitsToMCParticles trueHitsToParticles;
286 
288  LArPandoraHelper::CollectMCParticles(evt, m_geantModuleLabel, truthToParticles, particlesToTruth);
289  LArPandoraHelper::BuildMCParticleHitMaps(evt, m_geantModuleLabel, hitVector, trueParticlesToHits, trueHitsToParticles,
291 
292 
293  // Collect Reco Particles
294  // ======================
295  PFParticleVector recoParticleVector;
296  PFParticlesToHits recoParticlesToHits;
297  HitsToPFParticles recoHitsToParticles;
298 
300  LArPandoraHelper::BuildPFParticleHitMaps(evt, m_particleLabel, m_particleLabel, recoParticlesToHits, recoHitsToParticles,
302 
303  std::cout << " PFParticles: " << recoParticleVector.size() << std::endl;
304 
305 
306  // Collect Reco Tracks
307  // ===================
308  TrackVector recoTrackVector;
309  PFParticlesToTracks recoParticlesToTracks;
310  LArPandoraHelper::CollectTracks(evt, m_trackfitLabel, recoTrackVector, recoParticlesToTracks);
311 
312 
313  // Collect Cosmic Tags
314  // =====================
315  CosmicTagVector recoCosmicTagVector;
316  TracksToCosmicTags recoTracksToCosmicTags;
317  LArPandoraHelper::CollectCosmicTags(evt, m_cosmicLabel, recoCosmicTagVector, recoTracksToCosmicTags);
318 
319 
320  // Analyse Reconstructed Particles
321  // ===============================
322  this->FillRecoTree(recoParticlesToHits, recoParticlesToTracks, recoTracksToCosmicTags);
323 
324 
325  // Analyse True Hits
326  // =================
327  this->FillTrueTree(hitVector, trueHitsToParticles, recoHitsToParticles, particlesToTruth, recoParticlesToTracks, recoTracksToCosmicTags);
328 }
static void BuildPFParticleHitMaps(const PFParticleVector &particleVector, const PFParticlesToSpacePoints &particlesToSpacePoints, const SpacePointsToHits &spacePointsToHits, PFParticlesToHits &particlesToHits, HitsToPFParticles &hitsToParticles, const DaughterMode daughterMode=kUseDaughters)
Build mapping between PFParticles and Hits using PFParticle/SpacePoint/Hit maps.
std::map< art::Ptr< recob::Hit >, art::Ptr< simb::MCParticle > > HitsToMCParticles
unsigned int event
Definition: DataStructs.h:634
unsigned int run
Definition: DataStructs.h:635
void FillTrueTree(const HitVector &hitVector, const HitsToMCParticles &trueHitsToParticles, const HitsToPFParticles &recoHitsToParticles, const MCParticlesToMCTruth &particlesToTruth, const PFParticlesToTracks &particlesToTracks, const TracksToCosmicTags &tracksToCosmicTags)
Fill track-level variables using input maps between reconstructed objects.
std::map< art::Ptr< simb::MCParticle >, art::Ptr< simb::MCTruth > > MCParticlesToMCTruth
std::vector< art::Ptr< anab::CosmicTag > > CosmicTagVector
std::map< art::Ptr< recob::PFParticle >, TrackVector > PFParticlesToTracks
std::map< art::Ptr< recob::Track >, CosmicTagVector > TracksToCosmicTags
std::map< art::Ptr< simb::MCParticle >, HitVector > MCParticlesToHits
std::vector< art::Ptr< recob::PFParticle > > PFParticleVector
std::map< art::Ptr< simb::MCTruth >, MCParticleVector > MCTruthToMCParticles
std::map< art::Ptr< recob::PFParticle >, HitVector > PFParticlesToHits
std::vector< art::Ptr< recob::Track > > TrackVector
static void CollectTracks(const art::Event &evt, const std::string &label, TrackVector &trackVector, PFParticlesToTracks &particlesToTracks)
Collect the reconstructed PFParticles and associated Tracks from the ART event record.
static void CollectPFParticles(const art::Event &evt, const std::string &label, PFParticleVector &particleVector)
Collect the reconstructed PFParticles from the ART event record.
void FillRecoTree(const PFParticlesToHits &recoParticlesToHits, const PFParticlesToTracks &recoParticlesToTracks, const TracksToCosmicTags &recoTracksToCosmicTags)
Fill event-level variables using input maps between reconstructed objects.
static void CollectHits(const art::Event &evt, const std::string &label, HitVector &hitVector)
Collect the reconstructed Hits from the ART event record.
std::vector< art::Ptr< recob::Hit > > HitVector
std::map< art::Ptr< recob::Hit >, art::Ptr< recob::PFParticle > > HitsToPFParticles
TCEvent evt
Definition: DataStructs.cxx:8
static void BuildMCParticleHitMaps(const art::Event &evt, const HitVector &hitVector, const SimChannelVector &simChannelVector, HitsToTrackIDEs &hitsToTrackIDEs)
Collect the links from reconstructed hits to their true energy deposits.
static void CollectMCParticles(const art::Event &evt, const std::string &label, MCParticleVector &particleVector)
Collect a vector of MCParticle objects from the ART event record.
BEGIN_PROLOG could also be cout
static void CollectCosmicTags(const art::Event &evt, const std::string &label, CosmicTagVector &cosmicTagVector, TracksToCosmicTags &tracksToCosmicTags)
Collect a vector of cosmic tags from the ART event record.
void lar_pandora::PFParticleCosmicAna::beginJob ( )

Definition at line 199 of file PFParticleCosmicAna_module.cc.

200 {
201  mf::LogDebug("LArPandora") << " *** PFParticleCosmicAna::beginJob() *** " << std::endl;
202 
203  //
204  art::ServiceHandle<art::TFileService const> tfs;
205 
206  m_pRecoTree = tfs->make<TTree>("recoTree", "LAr Cosmic Reco Tree");
207  m_pRecoTree->Branch("run", &m_run, "run/I");
208  m_pRecoTree->Branch("event", &m_event, "event/I");
209  m_pRecoTree->Branch("index", &m_index, "index/I");
210  m_pRecoTree->Branch("self", &m_self, "self/I");
211  m_pRecoTree->Branch("pdgCode", &m_pdgCode, "pdgCode/I");
212  m_pRecoTree->Branch("isTrackLike", &m_isTrackLike, "isTrackLike/I");
213  m_pRecoTree->Branch("isPrimary", &m_isPrimary, "isPrimary/I");
214  m_pRecoTree->Branch("cosmicScore", &m_cosmicScore, "cosmicScore/F");
215  m_pRecoTree->Branch("trackVtxX", &m_trackVtxX, "trackVtxX/F");
216  m_pRecoTree->Branch("trackVtxY", &m_trackVtxY, "trackVtxY/F");
217  m_pRecoTree->Branch("trackVtxZ", &m_trackVtxZ, "trackVtxZ/F");
218  m_pRecoTree->Branch("trackEndX", &m_trackEndX, "trackEndX/F");
219  m_pRecoTree->Branch("trackEndY", &m_trackEndY, "trackEndY/F");
220  m_pRecoTree->Branch("trackEndZ", &m_trackEndZ, "trackEndZ/F");
221  m_pRecoTree->Branch("trackVtxDirX", &m_trackVtxDirX, "trackVtxDirX/F");
222  m_pRecoTree->Branch("trackVtxDirY", &m_trackVtxDirY, "trackVtxDirY/F");
223  m_pRecoTree->Branch("trackVtxDirZ", &m_trackVtxDirZ, "trackVtxDirZ/F");
224  m_pRecoTree->Branch("trackEndDirX", &m_trackEndDirX, "trackEndDirX/F");
225  m_pRecoTree->Branch("trackEndDirY", &m_trackEndDirY, "trackEndDirY/F");
226  m_pRecoTree->Branch("trackEndDirZ", &m_trackEndDirZ, "trackEndDirZ/F");
227  m_pRecoTree->Branch("trackLength", &m_trackLength, "trackLength/F");
228  m_pRecoTree->Branch("trackWidthX", &m_trackWidthX, "trackWidthX/F");
229  m_pRecoTree->Branch("trackWidthY", &m_trackWidthY, "trackWidthY/F");
230  m_pRecoTree->Branch("trackWidthZ", &m_trackWidthZ, "trackWidthZ/F");
231  m_pRecoTree->Branch("trackVtxDeltaYZ", &m_trackVtxDeltaYZ, "trackVtxDeltaYZ/F");
232  m_pRecoTree->Branch("trackEndDeltaYZ", &m_trackEndDeltaYZ, "trackEndDeltaYZ/F");
233  m_pRecoTree->Branch("trackVtxContained", &m_trackVtxContained, "trackVtxContained/I");
234  m_pRecoTree->Branch("trackEndContained", &m_trackEndContained, "trackEndContained/I");
235  m_pRecoTree->Branch("nTracks", &m_nTracks, "nTracks/I");
236  m_pRecoTree->Branch("nHits", &m_nHits, "nHits/I");
237 
238  m_pTrueTree = tfs->make<TTree>("trueTree", "LAr Cosmic True Tree");
239  m_pTrueTree->Branch("run", &m_run, "run/I");
240  m_pTrueTree->Branch("event", &m_event, "event/I");
241  m_pTrueTree->Branch("nHits", &m_nHits, "nHits/I");
242  m_pTrueTree->Branch("nNeutrinoHits", &m_nNeutrinoHits, "nNeutrinoHits/I");
243  m_pTrueTree->Branch("nNeutrinoHitsFullyTagged", &m_nNeutrinoHitsFullyTagged, "nNeutrinoHitsFullyTagged/I");
244  m_pTrueTree->Branch("nNeutrinoHitsSemiTagged", &m_nNeutrinoHitsSemiTagged, "nNeutrinoHitsSemiTagged/I");
245  m_pTrueTree->Branch("nNeutrinoHitsNotTagged", &m_nNeutrinoHitsNotTagged, "nNeutrinoHitsNotTagged/I");
246  m_pTrueTree->Branch("nNeutrinoHitsNotReconstructed", &m_nNeutrinoHitsNotReconstructed, "nNeutrinoHitsNotReconstructed/I");
247  m_pTrueTree->Branch("nNeutrinoHitsReconstructed", &m_nNeutrinoHitsReconstructed, "nNeutrinoHitsReconstructed/I");
248  m_pTrueTree->Branch("nCosmicHits", &m_nCosmicHits, "nCosmicHits/I");
249  m_pTrueTree->Branch("nCosmicHitsFullyTagged", &m_nCosmicHitsFullyTagged, "nCosmicHitsFullyTagged/I");
250  m_pTrueTree->Branch("nCosmicHitsSemiTagged", &m_nCosmicHitsSemiTagged, "nCosmicHitsSemiTagged/I");
251  m_pTrueTree->Branch("nCosmicHitsNotTagged", &m_nCosmicHitsNotTagged, "nCosmicHitsNotTagged/I");
252  m_pTrueTree->Branch("nCosmicHitsNotReconstructed", &m_nCosmicHitsNotReconstructed, "nCosmicHitsNotReconstructed/I");
253  m_pTrueTree->Branch("nCosmicHitsReconstructed", &m_nCosmicHitsReconstructed, "nCosmicHitsReconstructed/I");
254 }
art::ServiceHandle< art::TFileService > tfs
void lar_pandora::PFParticleCosmicAna::endJob ( )

Definition at line 258 of file PFParticleCosmicAna_module.cc.

259 {
260 }
void lar_pandora::PFParticleCosmicAna::FillRecoTree ( const PFParticlesToHits recoParticlesToHits,
const PFParticlesToTracks recoParticlesToTracks,
const TracksToCosmicTags recoTracksToCosmicTags 
)
private

Fill event-level variables using input maps between reconstructed objects.

Parameters
recoParticlesToHitsmapping from particles to hits
recoParticlesToTracksmapping from particles to tracks
recoTracksToCosmicTagsmapping from tracks to cosmic tags

Definition at line 332 of file PFParticleCosmicAna_module.cc.

334 {
335  // Set up Geometry Service
336  // =======================
337  art::ServiceHandle<geo::Geometry const> theGeometry;
338 
339  const double xmin(0.0);
340  const double xmax(2.0 * theGeometry->DetHalfWidth());
341  const double ymin(-theGeometry->DetHalfHeight());
342  const double ymax(+theGeometry->DetHalfHeight());
343  const double zmin(0.0);
344  const double zmax(theGeometry->DetLength());
345  const double xyzCut(m_cosmicContainmentCut);
346 
347  m_index = 0;
348 
349  m_self = 0;
350  m_pdgCode = 0;
351  m_isTrackLike = 0;
352  m_isPrimary = 0;
353  m_cosmicScore = 0.f;
354 
355  m_trackVtxX = 0.f;
356  m_trackVtxY = 0.f;
357  m_trackVtxZ = 0.f;
358  m_trackEndX = 0.f;
359  m_trackEndY = 0.f;
360  m_trackEndZ = 0.f;
361  m_trackVtxDirX = 0.f;
362  m_trackVtxDirY = 0.f;
363  m_trackVtxDirZ = 0.f;
364  m_trackEndDirX = 0.f;
365  m_trackEndDirY = 0.f;
366  m_trackEndDirZ = 0.f;
367  m_trackLength = 0.f;
368  m_trackWidthX = 0.f;
369  m_trackWidthY = 0.f;
370  m_trackWidthZ = 0.f;
371  m_trackVtxDeltaYZ = 0.f;
372  m_trackEndDeltaYZ = 0.f;
373 
376 
377  m_nTracks = 0;
378  m_nHits = 0;
379 
380  // Loop over Reco Particles
381  // ========================
382  for (PFParticlesToHits::const_iterator iter1 = recoParticlesToHits.begin(), iterEnd1 = recoParticlesToHits.end();
383  iter1 != iterEnd1; ++iter1)
384  {
385  const art::Ptr<recob::PFParticle> recoParticle = iter1->first;
386 
387  const HitVector &hitVector = iter1->second;
388  if (hitVector.empty())
389  continue;
390 
391  PFParticlesToTracks::const_iterator iter2 = recoParticlesToTracks.find(recoParticle);
392  if (recoParticlesToTracks.end() == iter2)
393  continue;
394 
395  const TrackVector &trackVector = iter2->second;
396  if (trackVector.empty())
397  continue;
398 
399  m_nHits = hitVector.size();
400  m_nTracks = trackVector.size();
401 
402  m_self = recoParticle->Self();
403  m_pdgCode = recoParticle->PdgCode();
404  m_isPrimary = recoParticle->IsPrimary();
406  m_cosmicScore = this->GetCosmicScore(recoParticle, recoParticlesToTracks, recoTracksToCosmicTags);
407 
408  m_trackVtxX = 0.f;
409  m_trackVtxY = 0.f;
410  m_trackVtxZ = 0.f;
411  m_trackEndX = 0.f;
412  m_trackEndY = 0.f;
413  m_trackEndZ = 0.f;
414  m_trackVtxDirX = 0.f;
415  m_trackVtxDirY = 0.f;
416  m_trackVtxDirZ = 0.f;
417  m_trackEndDirX = 0.f;
418  m_trackEndDirY = 0.f;
419  m_trackEndDirZ = 0.f;
420  m_trackLength = 0.f;
421  m_trackWidthX = 0.f;
422  m_trackWidthY = 0.f;
423  m_trackWidthZ = 0.f;
424  m_trackVtxDeltaYZ = 0.f;
425  m_trackEndDeltaYZ = 0.f;
426 
429 
430  for (TrackVector::const_iterator iter3 = trackVector.begin(), iterEnd3 = trackVector.end(); iter3 != iterEnd3; ++iter3)
431  {
432  const art::Ptr<recob::Track> track = *iter3;
433  const float trackLength(track->Length());
434 
435  if (trackLength < m_trackLength)
436  continue;
437 
438  m_trackLength = trackLength;
439 
440  const auto &trackVtxPosition = track->Vertex();
441  const auto &trackVtxDirection = track->VertexDirection();
442  const auto &trackEndPosition = track->End();
443  const auto &trackEndDirection = track->EndDirection();
444 
445  m_trackVtxX = trackVtxPosition.x();
446  m_trackVtxY = trackVtxPosition.y();
447  m_trackVtxZ = trackVtxPosition.z();
448  m_trackVtxDirX = trackVtxDirection.x();
449  m_trackVtxDirY = trackVtxDirection.y();
450  m_trackVtxDirZ = trackVtxDirection.z();
451  m_trackEndX = trackEndPosition.x();
452  m_trackEndY = trackEndPosition.y();
453  m_trackEndZ = trackEndPosition.z();
454  m_trackEndDirX = trackEndDirection.x();
455  m_trackEndDirY = trackEndDirection.y();
456  m_trackEndDirZ = trackEndDirection.z();
457 
458  m_trackWidthX = std::fabs(m_trackEndX - m_trackVtxX);
459  m_trackWidthY = std::fabs(m_trackEndY - m_trackVtxY);
460  m_trackWidthZ = std::fabs(m_trackEndZ - m_trackVtxZ);
461 
462  m_trackVtxDeltaYZ = std::min((ymax - m_trackVtxY), std::min((m_trackVtxZ - zmin), (zmax - m_trackVtxZ)));
463  m_trackEndDeltaYZ = std::min((m_trackEndY - ymin), std::min((m_trackEndZ - zmin), (zmax - m_trackEndZ)));
464 
465  m_trackVtxContained = ((m_trackVtxX > xmin + xyzCut && m_trackVtxX < xmax - xyzCut) &&
466  (m_trackVtxY > ymin + xyzCut && m_trackVtxY < ymax - xyzCut) &&
467  (m_trackVtxZ > zmin + xyzCut && m_trackVtxZ < zmax - xyzCut));
468  m_trackEndContained = ((m_trackEndX > xmin + xyzCut && m_trackEndX < xmax - xyzCut) &&
469  (m_trackEndY > ymin + xyzCut && m_trackEndY < ymax - xyzCut) &&
470  (m_trackEndZ > zmin + xyzCut && m_trackEndZ < zmax - xyzCut));
471  }
472 
473  std::cout << " PFParticle: [" << m_index << "] nHits=" << m_nHits
474  << ", nTracks=" << m_nTracks << ", cosmicScore=" << m_cosmicScore << std::endl;
475 
476  m_pRecoTree->Fill();
477  ++m_index;
478  }
479 }
process_name use argoneut_mc_hitfinder track
process_name pandoraGausCryo1 vertexChargeCryo1 vertexStubCryo1 xmin
std::vector< art::Ptr< recob::Track > > TrackVector
std::vector< art::Ptr< recob::Hit > > HitVector
float GetCosmicScore(const art::Ptr< recob::PFParticle > particle, const PFParticlesToTracks &recoParticlesToTracks, const TracksToCosmicTags &recoTracksToCosmicTags) const
Get cosmic score for a PFParticle using track-level information.
static bool IsTrack(const art::Ptr< recob::PFParticle > particle)
Determine whether a particle has been reconstructed as track-like.
BEGIN_PROLOG could also be cout
void lar_pandora::PFParticleCosmicAna::FillTrueTree ( const HitVector hitVector,
const HitsToMCParticles trueHitsToParticles,
const HitsToPFParticles recoHitsToParticles,
const MCParticlesToMCTruth particlesToTruth,
const PFParticlesToTracks particlesToTracks,
const TracksToCosmicTags tracksToCosmicTags 
)
private

Fill track-level variables using input maps between reconstructed objects.

Parameters
hitVectorinput vector of reconstructed hits
trueHitsToParticlesmapping between true hits and particles
recoHitsToParticlesmapping between reconstructed hits and particles
particlesToTruthmapping between MC particles and MC truth
particlesToTracksmapping between reconstructed particles and tracks
tracksToCosmicTagsmapping between reconstructed tracks and cosmic tags

Definition at line 483 of file PFParticleCosmicAna_module.cc.

486 {
487  m_nHits = 0;
488 
489  m_nNeutrinoHits = 0;
495 
496  m_nCosmicHits = 0;
502 
503  for (HitVector::const_iterator iter2 = hitVector.begin(), iterEnd2 = hitVector.end(); iter2 != iterEnd2; ++iter2)
504  {
505  const art::Ptr<recob::Hit> hit = *iter2;
506 
507  HitsToMCParticles::const_iterator iter3 = trueHitsToParticles.find(hit);
508  if (trueHitsToParticles.end() == iter3)
509  continue;
510 
511  const art::Ptr<simb::MCParticle> trueParticle = iter3->second;
512 
513  MCParticlesToMCTruth::const_iterator iter4 = particlesToTruth.find(trueParticle);
514  if (particlesToTruth.end() == iter4)
515  throw cet::exception("LArPandora") << " PFParticleCosmicAna::analyze --- Found a true particle without any ancestry information ";
516 
517  const art::Ptr<simb::MCTruth> truth = iter4->second;
518 
519  float cosmicScore(-0.2);
520 
521  HitsToPFParticles::const_iterator iter5 = recoHitsToParticles.find(hit);
522  if (recoHitsToParticles.end() != iter5)
523  {
524  const art::Ptr<recob::PFParticle> particle = iter5->second;
525  cosmicScore = this->GetCosmicScore(particle, particlesToTracks, tracksToCosmicTags);
526  }
527 
528  ++m_nHits;
529 
530  if (truth->NeutrinoSet())
531  {
532  ++m_nNeutrinoHits;
533 
534  if (cosmicScore >= 0) ++m_nNeutrinoHitsReconstructed;
536 
537  if (cosmicScore > 0.51) ++m_nNeutrinoHitsFullyTagged;
538  else if ( cosmicScore > 0.39) ++m_nNeutrinoHitsSemiTagged;
540  }
541  else
542  {
543  ++m_nCosmicHits;
544 
545  if (cosmicScore >= 0) ++m_nCosmicHitsReconstructed;
547 
548  if (cosmicScore > 0.51) ++m_nCosmicHitsFullyTagged;
549  else if ( cosmicScore > 0.39) ++m_nCosmicHitsSemiTagged;
550  else ++m_nCosmicHitsNotTagged;
551  }
552  }
553 
554  m_pTrueTree->Fill();
555 }
process_name hit
Definition: cheaterreco.fcl:51
float GetCosmicScore(const art::Ptr< recob::PFParticle > particle, const PFParticlesToTracks &recoParticlesToTracks, const TracksToCosmicTags &recoTracksToCosmicTags) const
Get cosmic score for a PFParticle using track-level information.
float lar_pandora::PFParticleCosmicAna::GetCosmicScore ( const art::Ptr< recob::PFParticle particle,
const PFParticlesToTracks recoParticlesToTracks,
const TracksToCosmicTags recoTracksToCosmicTags 
) const
private

Get cosmic score for a PFParticle using track-level information.

Parameters
particleinput reconstructed particle
recoParticlesToTracksmapping between reconstructed particles and tracks
recoTracksToCosmicTagsmapping between reconstructed tracks and cosmic tags

Definition at line 559 of file PFParticleCosmicAna_module.cc.

561 {
562  float cosmicScore(0.f);
563 
564  // Get cosmic tags associated with this particle
565  PFParticlesToTracks::const_iterator iter2 = recoParticlesToTracks.find(particle);
566  if (recoParticlesToTracks.end() != iter2)
567  {
568  for (TrackVector::const_iterator iter3 = iter2->second.begin(), iterEnd3 = iter2->second.end(); iter3 != iterEnd3; ++iter3)
569  {
570  const art::Ptr<recob::Track> track = *iter3;
571 
572  TracksToCosmicTags::const_iterator iter4 = recoTracksToCosmicTags.find(track);
573  if (recoTracksToCosmicTags.end() != iter4)
574  {
575  for (CosmicTagVector::const_iterator iter5 = iter4->second.begin(), iterEnd5 = iter4->second.end();
576  iter5 != iterEnd5; ++iter5)
577  {
578  const art::Ptr<anab::CosmicTag> cosmicTag = *iter5;
579  if (cosmicTag->CosmicScore() > cosmicScore)
580  cosmicScore = cosmicTag->CosmicScore();
581  }
582  }
583  }
584  }
585 
586  return cosmicScore;
587 }
process_name use argoneut_mc_hitfinder track
void lar_pandora::PFParticleCosmicAna::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 183 of file PFParticleCosmicAna_module.cc.

184 {
185  m_cosmicLabel = pset.get<std::string>("CosmicTagModule","cosmictagger");
186  m_particleLabel = pset.get<std::string>("PFParticleModule","pandora");
187  m_trackfitLabel = pset.get<std::string>("TrackFitModule","trackfit");
188  m_hitfinderLabel = pset.get<std::string>("HitFinderModule","gaushit");
189  m_geantModuleLabel = pset.get<std::string>("GeantModule","largeant");
190 
191  m_useDaughterPFParticles = pset.get<bool>("UseDaughterPFParticles",true);
192  m_useDaughterMCParticles = pset.get<bool>("UseDaughterMCParticles",true);
193 
194  m_cosmicContainmentCut = pset.get<double>("CosmicContainmentCut",5.0);
195 }

Member Data Documentation

double lar_pandora::PFParticleCosmicAna::m_cosmicContainmentCut
private

Definition at line 139 of file PFParticleCosmicAna_module.cc.

std::string lar_pandora::PFParticleCosmicAna::m_cosmicLabel
private

Definition at line 133 of file PFParticleCosmicAna_module.cc.

float lar_pandora::PFParticleCosmicAna::m_cosmicScore
private

Definition at line 90 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_event
private

Definition at line 83 of file PFParticleCosmicAna_module.cc.

std::string lar_pandora::PFParticleCosmicAna::m_geantModuleLabel
private

Definition at line 134 of file PFParticleCosmicAna_module.cc.

std::string lar_pandora::PFParticleCosmicAna::m_hitfinderLabel
private

Definition at line 130 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_index
private

Definition at line 84 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_isPrimary
private

Definition at line 89 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_isTrackLike
private

Definition at line 88 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_nCosmicHits
private

Definition at line 123 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_nCosmicHitsFullyTagged
private

Definition at line 124 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_nCosmicHitsNotReconstructed
private

Definition at line 127 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_nCosmicHitsNotTagged
private

Definition at line 126 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_nCosmicHitsReconstructed
private

Definition at line 128 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_nCosmicHitsSemiTagged
private

Definition at line 125 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_nHits
private

Definition at line 92 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_nNeutrinoHits
private

Definition at line 116 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_nNeutrinoHitsFullyTagged
private

Definition at line 117 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_nNeutrinoHitsNotReconstructed
private

Definition at line 120 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_nNeutrinoHitsNotTagged
private

Definition at line 119 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_nNeutrinoHitsReconstructed
private

Definition at line 121 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_nNeutrinoHitsSemiTagged
private

Definition at line 118 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_nTracks
private

Definition at line 91 of file PFParticleCosmicAna_module.cc.

std::string lar_pandora::PFParticleCosmicAna::m_particleLabel
private

Definition at line 132 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_pdgCode
private

Definition at line 87 of file PFParticleCosmicAna_module.cc.

TTree* lar_pandora::PFParticleCosmicAna::m_pRecoTree
private

Definition at line 79 of file PFParticleCosmicAna_module.cc.

TTree* lar_pandora::PFParticleCosmicAna::m_pTrueTree
private

Definition at line 80 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_run
private

Definition at line 82 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_self
private

Definition at line 86 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_trackEndContained
private

Definition at line 114 of file PFParticleCosmicAna_module.cc.

float lar_pandora::PFParticleCosmicAna::m_trackEndDeltaYZ
private

Definition at line 111 of file PFParticleCosmicAna_module.cc.

float lar_pandora::PFParticleCosmicAna::m_trackEndDirX
private

Definition at line 103 of file PFParticleCosmicAna_module.cc.

float lar_pandora::PFParticleCosmicAna::m_trackEndDirY
private

Definition at line 104 of file PFParticleCosmicAna_module.cc.

float lar_pandora::PFParticleCosmicAna::m_trackEndDirZ
private

Definition at line 105 of file PFParticleCosmicAna_module.cc.

float lar_pandora::PFParticleCosmicAna::m_trackEndX
private

Definition at line 97 of file PFParticleCosmicAna_module.cc.

float lar_pandora::PFParticleCosmicAna::m_trackEndY
private

Definition at line 98 of file PFParticleCosmicAna_module.cc.

float lar_pandora::PFParticleCosmicAna::m_trackEndZ
private

Definition at line 99 of file PFParticleCosmicAna_module.cc.

std::string lar_pandora::PFParticleCosmicAna::m_trackfitLabel
private

Definition at line 131 of file PFParticleCosmicAna_module.cc.

float lar_pandora::PFParticleCosmicAna::m_trackLength
private

Definition at line 106 of file PFParticleCosmicAna_module.cc.

int lar_pandora::PFParticleCosmicAna::m_trackVtxContained
private

Definition at line 113 of file PFParticleCosmicAna_module.cc.

float lar_pandora::PFParticleCosmicAna::m_trackVtxDeltaYZ
private

Definition at line 110 of file PFParticleCosmicAna_module.cc.

float lar_pandora::PFParticleCosmicAna::m_trackVtxDirX
private

Definition at line 100 of file PFParticleCosmicAna_module.cc.

float lar_pandora::PFParticleCosmicAna::m_trackVtxDirY
private

Definition at line 101 of file PFParticleCosmicAna_module.cc.

float lar_pandora::PFParticleCosmicAna::m_trackVtxDirZ
private

Definition at line 102 of file PFParticleCosmicAna_module.cc.

float lar_pandora::PFParticleCosmicAna::m_trackVtxX
private

Definition at line 94 of file PFParticleCosmicAna_module.cc.

float lar_pandora::PFParticleCosmicAna::m_trackVtxY
private

Definition at line 95 of file PFParticleCosmicAna_module.cc.

float lar_pandora::PFParticleCosmicAna::m_trackVtxZ
private

Definition at line 96 of file PFParticleCosmicAna_module.cc.

float lar_pandora::PFParticleCosmicAna::m_trackWidthX
private

Definition at line 107 of file PFParticleCosmicAna_module.cc.

float lar_pandora::PFParticleCosmicAna::m_trackWidthY
private

Definition at line 108 of file PFParticleCosmicAna_module.cc.

float lar_pandora::PFParticleCosmicAna::m_trackWidthZ
private

Definition at line 109 of file PFParticleCosmicAna_module.cc.

bool lar_pandora::PFParticleCosmicAna::m_useDaughterMCParticles
private

Definition at line 137 of file PFParticleCosmicAna_module.cc.

bool lar_pandora::PFParticleCosmicAna::m_useDaughterPFParticles
private

Definition at line 136 of file PFParticleCosmicAna_module.cc.


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