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

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

Inheritance diagram for hit::DumpHits:

Classes

struct  Config
 

Public Types

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

Public Member Functions

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

Private Attributes

art::InputTag fHitsModuleLabel
 name of module that produced the hits More...
 
std::string fOutputCategory
 category for LogInfo output More...
 
bool bCheckRawDigits
 check associations with raw digits More...
 
bool bCheckWires
 check associations with wires More...
 

Detailed Description

Prints the content of all the hits on screen.

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

Configuration parameters

Definition at line 46 of file DumpHits_module.cc.

Member Typedef Documentation

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

Definition at line 78 of file DumpHits_module.cc.

Constructor & Destructor Documentation

hit::DumpHits::DumpHits ( Parameters const &  config)
explicit

Default constructor.

Definition at line 121 of file DumpHits_module.cc.

122  : EDAnalyzer (config)
123  , fHitsModuleLabel (config().HitModuleLabel())
124  , fOutputCategory (config().OutputCategory())
125  , bCheckRawDigits (config().CheckRawDigitAssociation())
126  , bCheckWires (config().CheckWireAssociation())
127  {}
art::InputTag fHitsModuleLabel
name of module that produced the hits
std::string fOutputCategory
category for LogInfo output
bool bCheckWires
check associations with wires
bool bCheckRawDigits
check associations with raw digits

Member Function Documentation

void hit::DumpHits::analyze ( const art::Event &  evt)

Does the printing.

Definition at line 131 of file DumpHits_module.cc.

131  {
132 
133  // fetch the data to be dumped on screen
134  auto Hits = evt.getValidHandle<std::vector<recob::Hit>>(fHitsModuleLabel);
135 
136  mf::LogInfo(fOutputCategory)
137  << "The event contains " << Hits->size() << " '"
138  << fHitsModuleLabel.encode() << "' hits";
139 
140  std::unique_ptr<art::FindOne<raw::RawDigit>> HitToRawDigit;
141  if (bCheckRawDigits) {
142  HitToRawDigit.reset
143  (new art::FindOne<raw::RawDigit>(Hits, evt, fHitsModuleLabel));
144  if (!HitToRawDigit->isValid()) {
145  throw art::Exception(art::errors::ProductNotFound)
146  << "DumpHits: can't find associations between raw digits and hits from '"
147  << fHitsModuleLabel << "'";
148  }
149  } // if check raw digits
150 
151  std::unique_ptr<art::FindOne<recob::Wire>> HitToWire;
152  if (bCheckWires) {
153  HitToWire.reset(new art::FindOne<recob::Wire>(Hits, evt, fHitsModuleLabel));
154  if (!HitToWire->isValid()) {
155  throw art::Exception(art::errors::ProductNotFound)
156  << "DumpHits: can't find associations between wires and hits from '"
157  << fHitsModuleLabel << "'";
158  }
159  } // if check wires
160 
161  unsigned int iHit = 0;
162  for (const recob::Hit& hit: *Hits) {
163 
164  // print a header for the cluster
165  mf::LogVerbatim(fOutputCategory)
166  << "Hit #" << iHit << ": " << hit;
167 
168  if (HitToRawDigit) {
169  raw::ChannelID_t assChannelID = HitToRawDigit->at(iHit).ref().Channel();
170  if (assChannelID != hit.Channel()) {
171  throw art::Exception(art::errors::DataCorruption)
172  << "Hit #" << iHit << " on channel " << hit.Channel()
173  << " is associated with raw digit on channel " << assChannelID
174  << "!!";
175  } // mismatch
176  } // raw digit check
177 
178  if (HitToWire) {
179  raw::ChannelID_t assChannelID = HitToWire->at(iHit).ref().Channel();
180  if (assChannelID != hit.Channel()) {
181  throw art::Exception(art::errors::DataCorruption)
182  << "Hit #" << iHit << " on channel " << hit.Channel()
183  << " is associated with wire on channel " << assChannelID
184  << "!!";
185  } // mismatch
186  } // wire check
187 
188  ++iHit;
189  } // for hits
190 
191  } // DumpHits::analyze()
art::InputTag fHitsModuleLabel
name of module that produced the hits
std::string fOutputCategory
category for LogInfo output
process_name hit
Definition: cheaterreco.fcl:51
details::FindAllP< recob::Hit, recob::Wire > HitToWire
Query object connecting a hit to a wire.
Definition: HitUtils.h:56
art::PtrVector< recob::Hit > Hits
bool bCheckWires
check associations with wires
bool bCheckRawDigits
check associations with raw digits
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
TCEvent evt
Definition: DataStructs.cxx:8
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28

Member Data Documentation

bool hit::DumpHits::bCheckRawDigits
private

check associations with raw digits

Definition at line 91 of file DumpHits_module.cc.

bool hit::DumpHits::bCheckWires
private

check associations with wires

Definition at line 92 of file DumpHits_module.cc.

art::InputTag hit::DumpHits::fHitsModuleLabel
private

name of module that produced the hits

Definition at line 89 of file DumpHits_module.cc.

std::string hit::DumpHits::fOutputCategory
private

category for LogInfo output

Definition at line 90 of file DumpHits_module.cc.


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