18 #include "canvas/Persistency/Common/FindManyP.h" 63 Name(
"ClusterModuleLabel"),
64 Comment(
"input tag for the clusters to be dumped")
67 Name(
"OutputCategory"),
68 Comment(
"name of the category used for message facility output"),
73 Comment(
"number of hits per line (0 suppresses hit dumping)"),
102 template <
typename T>
103 size_t StringLength(
const T&
value) {
104 std::ostringstream sstr;
106 return sstr.str().length();
129 = evt.
getValidHandle<std::vector<recob::Cluster>>(ClusterInputTag);
132 art::FindManyP<recob::Hit> HitAssn(Clusters, evt, ClusterInputTag);
135 <<
"The event contains " << Clusters->size() <<
" '" 136 << ClusterInputTag.
encode() <<
"' clusters";
138 unsigned int iCluster = 0;
139 std::vector<size_t> HitBuffer(
fHitsPerLine), LastBuffer;
141 decltype(
auto) ClusterHits = HitAssn.at(iCluster);
145 <<
"Cluster #" << (iCluster++) <<
" from " << ClusterHits.size()
151 std::vector<size_t> HitIndices;
153 HitIndices.push_back(pHit.key());
154 std::sort(HitIndices.begin(), HitIndices.end());
156 unsigned int Padding = ::StringLength(HitIndices.back());
161 hend = HitIndices.end();
162 size_t RangeStart = *iHit, RangeStop = RangeStart;
163 std::ostringstream output_line;
164 size_t nItemsInLine = 0;
165 while (++iHit != hend) {
167 if (*iHit == RangeStop + 1) {
173 if (RangeStart == RangeStop) {
174 output_line <<
" " <<
std::setw(Padding) << RangeStart;
178 char fill = (RangeStart + 1 == RangeStop)?
' ':
'-';
179 output_line <<
" " <<
std::setw(Padding) << RangeStart
186 RangeStart = RangeStop = *iHit;
199 line_out <<
" " << output_line.str();
200 if (RangeStart == RangeStop)
201 line_out <<
" " <<
std::setw(Padding) << RangeStart;
203 char fill = (RangeStart + 1 == RangeStop)?
' ':
'-';
204 line_out <<
" " <<
std::setw(Padding) << RangeStart
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
void cluster(In first, In last, Out result, Pred *pred)
Reconstruction base classes.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
ChannelGroupService::Name Name
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
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Q_EXPORT QTSManip setw(int w)
fhicl::Atom< std::string > OutputCategory
Declaration of signal hit object.
void analyze(const art::Event &evt)
Does the printing.
std::string fOutputCategory
category for LogInfo output
Q_EXPORT QTSManip setfill(int f)
DumpClusters(Parameters const &config)
Default constructor.