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

Prints the content of all the ParticleFlow particles on screen. More...

Inheritance diagram for recob::DumpPFParticles:

Classes

struct  Config
 

Public Types

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

Public Member Functions

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

Private Member Functions

void MakePFParticleGraph (art::Event const &event, art::ValidHandle< std::vector< recob::PFParticle >> const &handle) const
 

Static Private Member Functions

static std::string DotFileName (art::EventID const &evtID, art::Provenance const &prodInfo)
 

Private Attributes

art::InputTag fInputTag
 input tag of the PFParticle product More...
 
std::string fOutputCategory
 category for LogInfo output More...
 
bool fPrintHexFloats
 whether to print floats in base 16 More...
 
unsigned int fMaxDepth
 maximum generation to print (0: only primaries) More...
 
bool fMakeEventGraphs
 whether to create one DOT file per event More...
 

Detailed Description

Prints the content of all the ParticleFlow particles on screen.

This analyser prints the content of all the ParticleFlow particles into the LogInfo/LogVerbatim stream.

Configuration parameters

Particle connection graphs

When MakeParticleGraphs configuration option is activated, a file is created for each event, that contains the particle flow tree in GraphViz format. The GraphViz dot command can be used to render it into a PDF, SVG, EPS or one of the many supported bitmap formats. The typical command to use is:

dot -Tpdf -oPMTrk.pdf PMTrk.dot

A bash command to convert all files into a OutputFormat format:

OutputFormat='pdf'
for DotFile in *.dot ; do
  OutputFile="${DotFile%.dot}.${OutputFormat}"
  [[ "$OutputFile" -ot "$DotFile" ]] || continue # up to date already
  echo "${DotFile} => ${OutputFile} ..."
  dot -T"$OutputFormat" -o"$OutputFile" "$DotFile" || break
done

which will also skip files already converted.

The output shows one cell ("node") per particle. The format of the node follows these prescriptions:

The relations between particles in the flow are represented by connecting lines ("edges"). Connection information is redundant: the parent particle should have the daughter in the daughter list, and the daughter should have the parent particle referenced as such. Since the connection is usually from two sources, there are usually two arrow heads, each one close to the particle that provides information on that connection; all arrow heads point from parent to daughter.

If you are trying to interpret an existing diagram, the following list is more direct to the point. Nodes: represent particles (see above for the label content)

Connecting lines ("edges"):

Definition at line 131 of file DumpPFParticles_module.cc.

Member Typedef Documentation

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

Definition at line 168 of file DumpPFParticles_module.cc.

Constructor & Destructor Documentation

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

Default constructor.

Definition at line 1118 of file DumpPFParticles_module.cc.

1119  : EDAnalyzer(config)
1120  , fInputTag(config().PFModuleLabel())
1121  , fOutputCategory(config().OutputCategory())
1122  , fPrintHexFloats(config().PrintHexFloats())
1123  , fMaxDepth(std::numeric_limits<unsigned int>::max())
1124  , fMakeEventGraphs(config().MakeParticleGraphs())
1125  {
1126  // here we are handling the optional configuration key as it had just a
1127  // default value
1128  if (!config().MaxDepth(fMaxDepth))
1129  fMaxDepth = std::numeric_limits<unsigned int>::max();
1130  }
std::string fOutputCategory
category for LogInfo output
unsigned int fMaxDepth
maximum generation to print (0: only primaries)
bool fMakeEventGraphs
whether to create one DOT file per event
art::InputTag fInputTag
input tag of the PFParticle product
bool fPrintHexFloats
whether to print floats in base 16

Member Function Documentation

void recob::DumpPFParticles::analyze ( const art::Event &  evt)
overridevirtual

Does the printing.

Definition at line 1174 of file DumpPFParticles_module.cc.

1174  {
1175 
1176  //
1177  // collect all the available information
1178  //
1179  // fetch the data to be dumped on screen
1180  art::ValidHandle<std::vector<recob::PFParticle>> PFParticles
1181  = evt.getValidHandle<std::vector<recob::PFParticle>>(fInputTag);
1182 
1183  if (fMakeEventGraphs)
1184  MakePFParticleGraph(evt, PFParticles);
1185 
1186  art::FindOne<recob::Vertex> const ParticleVertices
1187  (PFParticles, evt, fInputTag);
1188  art::FindMany<recob::Track> const ParticleTracks
1189  (PFParticles, evt, fInputTag);
1190  art::FindMany<recob::Cluster> const ParticleClusters
1191  (PFParticles, evt, fInputTag);
1192  art::FindMany<recob::Seed> const ParticleSeeds
1193  (PFParticles, evt, fInputTag);
1194  art::FindMany<recob::SpacePoint> const ParticleSpacePoints
1195  (PFParticles, evt, fInputTag);
1196  art::FindMany<recob::PCAxis> const ParticlePCAxes
1197  (PFParticles, evt, fInputTag);
1198 
1199  size_t const nParticles = PFParticles->size();
1200  mf::LogVerbatim(fOutputCategory) << "Event " << evt.id()
1201  << " contains " << nParticles << " particles from '"
1202  << fInputTag.encode() << "'";
1203 
1204  // prepare the dumper
1205  ParticleDumper::PrintOptions_t options;
1206  options.hexFloats = fPrintHexFloats;
1207  options.maxDepth = fMaxDepth;
1208  options.streamName = fOutputCategory;
1209  ParticleDumper dumper(*PFParticles, options);
1210  if (ParticleVertices.isValid()) dumper.SetVertices(&ParticleVertices);
1211  else mf::LogPrint("DumpPFParticles") << "WARNING: vertex information not available";
1212  if (ParticleTracks.isValid()) dumper.SetTracks(&ParticleTracks);
1213  else mf::LogPrint("DumpPFParticles") << "WARNING: track information not available";
1214  if (ParticleClusters.isValid()) dumper.SetClusters(&ParticleClusters);
1215  else mf::LogPrint("DumpPFParticles") << "WARNING: cluster information not available";
1216  if (ParticleSeeds.isValid()) dumper.SetSeeds(&ParticleSeeds);
1217  else mf::LogPrint("DumpPFParticles") << "WARNING: seed information not avaialble";
1218  if (ParticleSpacePoints.isValid())
1219  dumper.SetSpacePoints(&ParticleSpacePoints);
1220  else {
1221  mf::LogPrint("DumpPFParticles")
1222  << "WARNING: space point information not available";
1223  }
1224  if (ParticlePCAxes.isValid())
1225  dumper.SetPCAxes(&ParticlePCAxes);
1226  else {
1227  mf::LogPrint("DumpPFParticles")
1228  << "WARNING: principal component axis not available";
1229  }
1230  dumper.DumpAllParticles(" ");
1231 
1232  mf::LogVerbatim(fOutputCategory) << "\n"; // two empty lines
1233 
1234  } // DumpPFParticles::analyze()
std::string fOutputCategory
category for LogInfo output
unsigned int fMaxDepth
maximum generation to print (0: only primaries)
bool fMakeEventGraphs
whether to create one DOT file per event
then echo echo For and will not be changed by echo further linking echo echo B echo The symbol is in the uninitialized data multiple common symbols may appear with the echo same name If the symbol is defined the common echo symbols are treated as undefined references For more echo details on common see the discussion of warn common echo in *Note Linker options
void MakePFParticleGraph(art::Event const &event, art::ValidHandle< std::vector< recob::PFParticle >> const &handle) const
art::InputTag fInputTag
input tag of the PFParticle product
TCEvent evt
Definition: DataStructs.cxx:8
bool fPrintHexFloats
whether to print floats in base 16
std::string recob::DumpPFParticles::DotFileName ( art::EventID const &  evtID,
art::Provenance const &  prodInfo 
)
staticprivate

Definition at line 1135 of file DumpPFParticles_module.cc.

1136  {
1137  return prodInfo.processName()
1138  + '_' + prodInfo.moduleLabel()
1139  + '_' + prodInfo.productInstanceName()
1140  + "_Run" + std::to_string(evtID.run())
1141  + "_Subrun" + std::to_string(evtID.subRun())
1142  + "_Event" + std::to_string(evtID.event())
1143  + "_particles.dot";
1144  } // DumpPFParticles::DotFileName()
std::string to_string(WindowPattern const &pattern)
void recob::DumpPFParticles::MakePFParticleGraph ( art::Event const &  event,
art::ValidHandle< std::vector< recob::PFParticle >> const &  handle 
) const
private

Definition at line 1148 of file DumpPFParticles_module.cc.

1151  {
1152  art::EventID const eventID = event.id();
1153  std::string fileName = DotFileName(eventID, *(handle.provenance()));
1154  std::ofstream outFile(fileName); // overwrite by default
1155 
1156  outFile
1157  << "// " << fileName
1158  << "\n// "
1159  << "\n// Created for run " << eventID.run()
1160  << " subrun " << eventID.subRun()
1161  << " event " << eventID.event()
1162  << "\n// "
1163  << "\n// dump of " << handle->size() << " particles"
1164  << "\n// "
1165  << std::endl;
1166 
1167  PFParticleGraphMaker graphMaker;
1168  graphMaker.MakeGraph(outFile, *handle);
1169 
1170  } // DumpPFParticles::MakePFParticleGraph()
TString outFile
static std::string DotFileName(art::EventID const &evtID, art::Provenance const &prodInfo)

Member Data Documentation

art::InputTag recob::DumpPFParticles::fInputTag
private

input tag of the PFParticle product

Definition at line 178 of file DumpPFParticles_module.cc.

bool recob::DumpPFParticles::fMakeEventGraphs
private

whether to create one DOT file per event

Definition at line 182 of file DumpPFParticles_module.cc.

unsigned int recob::DumpPFParticles::fMaxDepth
private

maximum generation to print (0: only primaries)

Definition at line 181 of file DumpPFParticles_module.cc.

std::string recob::DumpPFParticles::fOutputCategory
private

category for LogInfo output

Definition at line 179 of file DumpPFParticles_module.cc.

bool recob::DumpPFParticles::fPrintHexFloats
private

whether to print floats in base 16

Definition at line 180 of file DumpPFParticles_module.cc.


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