17 #include "art_root_io/TFileService.h" 18 #include "canvas/Persistency/Common/FindManyP.h" 58 float & fraction,
bool & foundEmParent)
const;
85 fEventTree = tfs->make<TTree>(
"EventTree",
"event by event info");
89 fClusterTree = tfs->make<TTree>(
"ClusterTree",
"cluster by cluster info");
112 for (
size_t i = 0; i < cluHandle->size(); ++i)
114 fNHits = cluHandle->at(i).NHits();
124 else {
mf::LogWarning(
"ClusterCounter4") <<
"No matcched particle??"; }
129 <<
"NHits() = " <<
fNHits <<
", assn size = " << hitsFromClusters.at(i).size()
130 <<
" SummedADC() = " << cluHandle->at(i).SummedADC() <<
", sum hits adc = " <<
fAdcSum;
139 float & fraction,
bool & foundEmParent)
const 143 foundEmParent =
false;
147 std::unordered_map<int, double> trkIDE;
148 for (
auto const &
h : hits)
152 trkIDE[ide.trackID] += ide.energy;
157 double tot_e = 0, max_e = 0;
158 for (
auto const & contrib : trkIDE)
160 tot_e += contrib.second;
161 if (contrib.second > max_e)
163 max_e = contrib.second;
164 best_id = contrib.first;
168 if ((max_e > 0) && (tot_e > 0))
173 foundEmParent =
true;
176 fraction = max_e / tot_e;
178 else {
mf::LogWarning(
"ClusterCounter4") <<
"No energy deposits??"; }
186 for (
auto const &
h : hits)
188 sum +=
h->SummedADC();
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
ClusterCounter4 & operator=(ClusterCounter4 const &)=delete
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
const simb::MCParticle * TrackIdToParticle_P(int id) const
void analyze(art::Event const &e) override
art::InputTag fClusterModuleLabel
EDAnalyzer(fhicl::ParameterSet const &pset)
float sumAdc(const std::vector< art::Ptr< recob::Hit > > &hits) const
const simb::MCParticle * getTruthParticle(detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit > > &hits, float &fraction, bool &foundEmParent) const
ClusterCounter4(fhicl::ParameterSet const &p)
#define DEFINE_ART_MODULE(klass)
T get(std::string const &key) 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
EventNumber_t event() const