61 Name(
"ClusterModuleLabel"),
62 Comment(
"input tag for the clusters to be dumped")};
64 Name(
"OutputCategory"),
65 Comment(
"name of the category used for message facility output"),
69 Comment(
"number of hits per line (0 suppresses hit dumping)"),
96 size_t StringLength(
const T&
value)
98 std::ostringstream sstr;
100 return sstr.str().length();
122 auto Clusters = evt.
getValidHandle<std::vector<recob::Cluster>>(ClusterInputTag);
128 << ClusterInputTag.
encode() <<
"' clusters";
130 unsigned int iCluster = 0;
131 std::vector<size_t> HitBuffer(
fHitsPerLine), LastBuffer;
133 decltype(
auto) ClusterHits = HitAssn.at(iCluster);
137 <<
"Cluster #" << (iCluster++) <<
" from " << ClusterHits.size() <<
" hits: " <<
cluster;
141 std::vector<size_t> HitIndices;
143 HitIndices.push_back(pHit.key());
144 std::sort(HitIndices.begin(), HitIndices.end());
146 unsigned int Padding = ::StringLength(HitIndices.back());
151 size_t RangeStart = *iHit, RangeStop = RangeStart;
152 std::ostringstream output_line;
153 size_t nItemsInLine = 0;
154 while (++iHit != hend) {
156 if (*iHit == RangeStop + 1) { ++RangeStop; }
160 if (RangeStart == RangeStop) {
161 output_line <<
" " << std::setw(Padding) << RangeStart;
165 char fill = (RangeStart + 1 == RangeStop) ?
' ' :
'-';
166 output_line <<
" " << std::setw(Padding) << RangeStart << fill << fill
167 << std::setw(Padding) << std::setfill(fill) << RangeStop
168 << std::setfill(
' ');
172 RangeStart = RangeStop = *iHit;
185 line_out <<
" " << output_line.str();
186 if (RangeStart == RangeStop)
187 line_out <<
" " << std::setw(Padding) << RangeStart;
189 char fill = (RangeStart + 1 == RangeStop) ?
' ' :
'-';
190 line_out <<
" " << std::setw(Padding) << RangeStart << fill << fill << std::setw(Padding)
191 << std::setfill(fill) << RangeStop;
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
Reconstruction base classes.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Declaration of signal hit object.
Prints the content of all the clusters on screen.
Set of hits with a 2D structure.
Cluster finding and building.
EDAnalyzer(fhicl::ParameterSet const &pset)
unsigned int fHitsPerLine
hits per line in the output
fhicl::Atom< art::InputTag > ClusterModuleLabel
#define DEFINE_ART_MODULE(klass)
fhicl::Atom< unsigned int > HitsPerLine
art::InputTag fClusterModuleLabel
tag of the cluster data product
void fill(const art::PtrVector< recob::Hit > &hits, int only_plane)
Declaration of cluster object.
fhicl::Atom< std::string > OutputCategory
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
void analyze(const art::Event &evt)
Does the printing.
std::string fOutputCategory
category for LogInfo output
DumpClusters(Parameters const &config)
Default constructor.