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:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Classes

struct  Config
 Configuration object. More...
 

Public Types

using Parameters = art::EDAnalyzer::Table< Config >
 
- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 DumpTracks (Parameters const &config)
 Default constructor. More...
 
void analyze (const art::Event &evt)
 Does the printing. More...
 
- 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 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...
 

Additional Inherited Members

- 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

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

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
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
art::InputTag fTrackModuleLabel
name of module that produced the tracks
bool fPrintNHits
prints the number of associated hits
static Config * config
Definition: config.cpp:1054
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 
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()) {
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()) {
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()) {
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 
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
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::string encode() const
Definition: InputTag.cc:97
art::InputTag fTrackModuleLabel
name of module that produced the tracks
bool fPrintNHits
prints the number of associated hits
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
reference at(size_type n)
Definition: PtrVector.h:359
size_type size() const
Definition: PtrVector.h:302
bool fPrintHits
prints the index of associated hits
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
art::PtrVector< recob::Hit > 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
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
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();
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()
Q_EXPORT QTSManip setprecision(int p)
Definition: qtextstream.h:343
static int max(int a, int b)
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: