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

Prints the content of all the tracks on screen. More...

Inheritance diagram for recob::DumpTracks:

Classes

struct  Config
 Configuration object. More...
 

Public Types

using Parameters = art::EDAnalyzer::Table< Config >
 

Public Member Functions

 DumpTracks (Parameters const &config)
 Default constructor. More...
 
void analyze (const art::Event &evt)
 Does the printing. More...
 

Private Member Functions

void DumpTrack (unsigned int iTrack, recob::Track const &track) const
 Dumps information about the specified track. More...
 

Private Attributes

art::InputTag fTrackModuleLabel
 name of module that produced the tracks More...
 
std::string fOutputCategory
 category for LogInfo output More...
 
unsigned int fPrintWayPoints
 number of printed way points More...
 
bool fPrintNHits
 prints the number of associated hits More...
 
bool fPrintNSpacePoints
 prints the number of associated space points More...
 
bool fPrintNParticles
 prints the number of associated PFParticles More...
 
bool fPrintHits
 prints the index of associated hits More...
 
bool fPrintSpacePoints
 prints the index of associated space points More...
 
bool fPrintParticles
 prints the index of associated PFParticles More...
 

Detailed Description

Prints the content of all the tracks on screen.

This analyser prints the content of all the tracks into the LogInfo/LogVerbatim stream. The associated objects are printed only if they were produced with the same input tag as the tracks.

Configuration parameters

Definition at line 228 of file DumpTracks_module.cc.

Member Typedef Documentation

using recob::DumpTracks::Parameters = art::EDAnalyzer::Table<Config>

Definition at line 278 of file DumpTracks_module.cc.

Constructor & Destructor Documentation

recob::DumpTracks::DumpTracks ( Parameters const &  config)
explicit

Default constructor.

Definition at line 312 of file DumpTracks_module.cc.

313  : EDAnalyzer (config)
314  , fTrackModuleLabel (config().TrackModuleLabel())
315  , fOutputCategory (config().OutputCategory())
316  , fPrintWayPoints (config().WayPoints())
317  , fPrintNHits (config().HitAssociations())
318  , fPrintNSpacePoints(config().SpacePointAssociations())
319  , fPrintNParticles (config().ParticleAssociations())
320  , fPrintHits (config().PrintHits())
321  , fPrintSpacePoints (config().PrintSpacePoints())
322  , fPrintParticles (config().ParticleAssociations())
323  {}
bool fPrintNSpacePoints
prints the number of associated space points
BEGIN_PROLOG pandoraGausReCaloCryo0 TrackModuleLabel
art::InputTag fTrackModuleLabel
name of module that produced the tracks
bool fPrintNHits
prints the number of associated hits
bool fPrintHits
prints the index of associated hits
bool fPrintNParticles
prints the number of associated PFParticles
std::string fOutputCategory
category for LogInfo output
bool fPrintParticles
prints the index of associated PFParticles
bool fPrintSpacePoints
prints the index of associated space points
unsigned int fPrintWayPoints
number of printed way points

Member Function Documentation

void recob::DumpTracks::analyze ( const art::Event &  evt)

Does the printing.

Definition at line 326 of file DumpTracks_module.cc.

326  {
327 
328  // fetch the data to be dumped on screen
329  auto Tracks
330  = evt.getValidHandle<std::vector<recob::Track>>(fTrackModuleLabel);
331 
332  mf::LogInfo(fOutputCategory)
333  << "The event contains " << Tracks->size() << " '"
334  << fTrackModuleLabel.encode() << "'tracks";
335 
336  std::unique_ptr<art::FindManyP<recob::Hit>> pHits(
337  fPrintNHits?
338  new art::FindManyP<recob::Hit>(Tracks, evt, fTrackModuleLabel):
339  nullptr
340  );
341  if (pHits && !pHits->isValid()) {
342  throw art::Exception(art::errors::ProductNotFound)
343  << "No hit associated with '" << fTrackModuleLabel.encode()
344  << "' tracks.\n";
345  }
346 
347  std::unique_ptr<art::FindManyP<recob::SpacePoint>> pSpacePoints(
349  new art::FindManyP<recob::SpacePoint>(Tracks, evt, fTrackModuleLabel):
350  nullptr
351  );
352  if (pSpacePoints && !pSpacePoints->isValid()) {
353  throw art::Exception(art::errors::ProductNotFound)
354  << "No space point associated with '" << fTrackModuleLabel.encode()
355  << "' tracks.\n";
356  }
357 
358  std::unique_ptr<art::FindManyP<recob::PFParticle>> pPFParticles(
360  new art::FindManyP<recob::PFParticle>(Tracks, evt, fTrackModuleLabel):
361  nullptr
362  );
363  if (pPFParticles && !pPFParticles->isValid()) {
364  throw art::Exception(art::errors::ProductNotFound)
365  << "No particle-flow particle associated with '"
366  << fTrackModuleLabel.encode() << "' tracks.\n";
367  }
368 
369  for (unsigned int iTrack = 0; iTrack < Tracks->size(); ++iTrack) {
370  const recob::Track& track = Tracks->at(iTrack);
371 
372  // print track information
373  DumpTrack(iTrack, track);
374 
375  mf::LogVerbatim log(fOutputCategory);
376  if (pHits || pSpacePoints || pPFParticles) {
377  log << "\n associated with:";
378  if (pHits)
379  log << " " << pHits->at(iTrack).size() << " hits;";
380  if (pSpacePoints)
381  log << " " << pSpacePoints->at(iTrack).size() << " space points;";
382  if (pPFParticles)
383  log << " " << pPFParticles->at(iTrack).size() << " PF particles;";
384  } // if we have any association
385 
386  if (pHits && fPrintHits) {
387  const auto& Hits = pHits->at(iTrack);
388  log << "\n hit indices (" << Hits.size() << "):\n";
389  PrintAssociatedIndexTable(log, Hits, 10 /* 10 hits per line */, " ");
390  } // if print individual hits
391 
392  if (pSpacePoints && fPrintSpacePoints) {
393  const auto& SpacePoints = pSpacePoints->at(iTrack);
394  log << "\n space point IDs (" << SpacePoints.size() << "):\n";
395  PrintAssociatedIDTable
396  (log, SpacePoints, 10 /* 10 hits per line */, " ");
397  } // if print individual space points
398 
399  if (pPFParticles && fPrintParticles) {
400  const auto& PFParticles = pPFParticles->at(iTrack);
401  log << "\n particle indices (" << PFParticles.size() << "):\n";
402  // currently a particle has no ID
403  PrintAssociatedIndexTable
404  (log, PFParticles, 10 /* 10 hits per line */, " ");
405  } // if print individual particles
406  } // for tracks
407  } // DumpTracks::analyze()
void DumpTrack(unsigned int iTrack, recob::Track const &track) const
Dumps information about the specified track.
bool fPrintNSpacePoints
prints the number of associated space points
Definition: Data.h:32
process_name use argoneut_mc_hitfinder track
art::InputTag fTrackModuleLabel
name of module that produced the tracks
bool fPrintNHits
prints the number of associated hits
bool fPrintHits
prints the index of associated hits
art::PtrVector< recob::Hit > Hits
bool fPrintNParticles
prints the number of associated PFParticles
std::string fOutputCategory
category for LogInfo output
TCEvent evt
Definition: DataStructs.cxx:8
bool fPrintParticles
prints the index of associated PFParticles
bool fPrintSpacePoints
prints the index of associated space points
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a &quot;fitted&quot; track:
void recob::DumpTracks::DumpTrack ( unsigned int  iTrack,
recob::Track const &  track 
) const
private

Dumps information about the specified track.

Definition at line 412 of file DumpTracks_module.cc.

413  {
414  // print a header for the track
415  const unsigned int nPoints = track.NumberTrajectoryPoints();
416  mf::LogVerbatim log(fOutputCategory);
417  log
418  << "Track #" << iTrack << " ID: " << track.ID()
419  << std::fixed << std::setprecision(3)
420  << " theta: " << track.Theta() << " rad, phi: " << track.Phi()
421  << " rad, length: " << track.Length() << " cm"
422  << "\n start at: ( " << track.Vertex().X()
423  << " ; " << track.Vertex().Y()
424  << " ; " << track.Vertex().Z()
425  << " ), direction: ( " << track.VertexDirection().X()
426  << " ; " << track.VertexDirection().Y()
427  << " ; " << track.VertexDirection().Z() << " )"
428  << "\n end at: ( " << track.End().X()
429  << " ; " << track.End().Y()
430  << " ; " << track.End().Z()
431  << " ), direction: ( " << track.EndDirection().X()
432  << " ; " << track.EndDirection().Y()
433  << " ; " << track.EndDirection().Z()
434  << " )"
435  << "\n with "
436  << nPoints << " trajectory points";
437 
438  if (fPrintWayPoints > 0) {
439  // print up to 10 (actually, 8 or 9) way points
440  log << "\n passes through:";
441  unsigned int skip = std::max(nPoints / fPrintWayPoints, 1U);
442  unsigned int iPoint = 0;
443  while ((iPoint += skip) < nPoints) {
444  const auto& point = track.LocationAtPoint(iPoint);
445  log << "\n [#" << iPoint << "] ("
446  << point.X() << ", " << point.Y() << ", " << point.Z()
447  << ")";
448  } // while (iPoint)
449  } // if print way points
450  } // DumpTracks::DumpTrack()
process_name use argoneut_mc_hitfinder track
std::string fOutputCategory
category for LogInfo output
unsigned int fPrintWayPoints
number of printed way points

Member Data Documentation

std::string recob::DumpTracks::fOutputCategory
private

category for LogInfo output

Definition at line 289 of file DumpTracks_module.cc.

bool recob::DumpTracks::fPrintHits
private

prints the index of associated hits

Definition at line 295 of file DumpTracks_module.cc.

bool recob::DumpTracks::fPrintNHits
private

prints the number of associated hits

Definition at line 292 of file DumpTracks_module.cc.

bool recob::DumpTracks::fPrintNParticles
private

prints the number of associated PFParticles

Definition at line 294 of file DumpTracks_module.cc.

bool recob::DumpTracks::fPrintNSpacePoints
private

prints the number of associated space points

Definition at line 293 of file DumpTracks_module.cc.

bool recob::DumpTracks::fPrintParticles
private

prints the index of associated PFParticles

Definition at line 297 of file DumpTracks_module.cc.

bool recob::DumpTracks::fPrintSpacePoints
private

prints the index of associated space points

Definition at line 296 of file DumpTracks_module.cc.

unsigned int recob::DumpTracks::fPrintWayPoints
private

number of printed way points

Definition at line 290 of file DumpTracks_module.cc.

art::InputTag recob::DumpTracks::fTrackModuleLabel
private

name of module that produced the tracks

Definition at line 288 of file DumpTracks_module.cc.


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