16 #include "art_root_io/TFileService.h" 17 #include "canvas/Persistency/Common/FindManyP.h" 42 Name(
"ClusterModuleLabel"),
43 Comment(
"tag of cluster producer")
48 Comment(
"minimum size of clusters")
74 float & fraction,
bool & foundEmParent)
const;
101 fEventTree = tfs->make<TTree>(
"EventTree",
"event by event info");
105 fClusterTree = tfs->make<TTree>(
"ClusterTree",
"cluster by cluster info");
128 for (
size_t i = 0; i < cluHandle->size(); ++i)
130 fNHits = cluHandle->at(i).NHits();
140 else {
mf::LogWarning(
"ClusterCounter") <<
"No matcched particle??"; }
145 <<
"NHits() = " <<
fNHits <<
", assn size = " << hitsFromClusters.at(i).size()
146 <<
" SummedADC() = " << cluHandle->at(i).SummedADC() <<
", sum hits adc = " <<
fAdcSum;
155 float & fraction,
bool & foundEmParent)
const 159 foundEmParent =
false;
163 std::unordered_map<int, double> trkIDE;
164 for (
auto const &
h : hits)
168 trkIDE[ide.trackID] += ide.energy;
173 double tot_e = 0, max_e = 0;
174 for (
auto const & contrib : trkIDE)
176 tot_e += contrib.second;
177 if (contrib.second > max_e)
179 max_e = contrib.second;
180 best_id = contrib.first;
184 if ((max_e > 0) && (tot_e > 0))
189 foundEmParent =
true;
192 fraction = max_e / tot_e;
194 else {
mf::LogWarning(
"ClusterCounter") <<
"No energy deposits??"; }
202 for (
auto const &
h : hits)
204 sum +=
h->SummedADC();
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
const simb::MCParticle * TrackIdToParticle_P(int id) const
fhicl::Atom< art::InputTag > ClusterModuleLabel
ChannelGroupService::Name Name
EDAnalyzer(fhicl::ParameterSet const &pset)
void analyze(art::Event const &e) override
ClusterCounter & operator=(ClusterCounter const &)=delete
art::InputTag fClusterModuleLabel
#define DEFINE_ART_MODULE(klass)
float sumAdc(const std::vector< art::Ptr< recob::Hit > > &hits) const
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Declaration of signal hit object.
Contains all timing reference information for the detector.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
fhicl::Atom< size_t > MinSize
EventNumber_t event() const
const simb::MCParticle * getTruthParticle(detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit > > &hits, float &fraction, bool &foundEmParent) const
ClusterCounter(Parameters const &config)