31 #include "canvas/Persistency/Common/FindManyP.h" 37 #include "art_root_io/TFileService.h" 44 #include "TLorentzVector.h" 93 bool Has(std::vector<int> v,
int i)
const;
97 double GetEdepAttenuatedMC(
art::Event const & e)
const;
99 double GetEdepEM_MC(
art::Event const & e)
const;
101 double GetEdepEMAttenuated_MC(
art::Event const & e)
const;
107 const std::vector< recob::Hit > & hits)
const;
113 double GetEdepHitsMeV(
const std::vector< recob::Hit > & hits)
const;
155 fCalorimetryAlg(p.
get<
fhicl::ParameterSet>(
"CalorimetryAlg"))
175 fTree = tfs->make<TTree>(
"calibration",
"calibration tree");
214 for (
auto const&
p : *particleHandle)
217 if ((
p.Process() ==
"primary") && flag)
220 fEkGen = (std::sqrt(
p.P()*
p.P() +
p.Mass()*
p.Mass()) -
p.Mass()) * 1000;
252 for (
size_t c = 0;
c < clListHandle->size(); ++
c)
281 if (simchannelHandle)
283 for (
auto const&
channel : (*simchannelHandle) )
288 auto const& timeSlices =
channel.TDCIDEMap();
289 for (
auto const& timeSlice : timeSlices )
292 auto const& energyDeposits = timeSlice.second;
294 for (
auto const& energyDeposit : energyDeposits )
296 energy += energyDeposit.energy;
311 if (simchannelHandle)
313 for (
auto const&
channel : (*simchannelHandle) )
318 auto const& timeSlices =
channel.TDCIDEMap();
319 for (
auto const& timeSlice : timeSlices )
322 auto const& energyDeposits = timeSlice.second;
324 for (
auto const& energyDeposit : energyDeposits )
342 if (simchannelHandle)
344 for (
auto const&
channel : (*simchannelHandle) )
349 auto const& timeSlices =
channel.TDCIDEMap();
350 for (
auto const& timeSlice : timeSlices )
353 auto const& energyDeposits = timeSlice.second;
355 for (
auto const& energyDeposit : energyDeposits )
357 double energy = energyDeposit.energy;
358 int trackID = energyDeposit.trackID;
364 else if (trackID > 0)
378 if (!pdg) pdg = particle.
PdgCode();
381 if ((pdg == 11) || (pdg == -11) || (pdg == 22)) enEM +=
energy;
398 if (simchannelHandle)
400 for (
auto const&
channel : (*simchannelHandle) )
405 auto const& timeSlices =
channel.TDCIDEMap();
406 for (
auto const& timeSlice : timeSlices )
409 auto const& energyDeposits = timeSlice.second;
411 for (
auto const& energyDeposit : energyDeposits )
414 int trackID = energyDeposit.trackID;
420 else if (trackID > 0)
434 if (!pdg) pdg = particle.
PdgCode();
437 if ((pdg == 11) || (pdg == -11) || (pdg == 22)) enEM +=
energy;
469 const std::vector< recob::Hit > & hits)
const 471 if (!hits.size())
return 0.0;
474 for (
size_t h = 0;
h < hits.size(); ++
h)
476 unsigned short plane = hits[
h].WireID().Plane;
479 double dqadc = hits[
h].Integral();
480 if (!std::isnormal(dqadc) || (dqadc < 0))
continue;
484 double tdrift = hits[
h].PeakTime();
488 if (!std::isnormal(dq) || (dq < 0))
continue;
498 if (!hits.size())
return 0.0;
501 for (
size_t h = 0;
h < hits.size(); ++
h)
503 unsigned short plane = hits[
h].WireID().Plane;
506 double dqadc = hits[
h].Integral();
507 if (!std::isnormal(dqadc) || (dqadc < 0))
continue;
512 if (!std::isnormal(dq) || (dq < 0))
continue;
524 if (!hits.size())
return 0.0;
527 for (
size_t h = 0;
h < hits.size(); ++
h)
529 unsigned short plane = hits[
h]->WireID().Plane;
532 double dqadc = hits[
h]->Integral();
533 if (!std::isnormal(dqadc) || (dqadc < 0))
continue;
537 double tdrift = hits[
h]->PeakTime();
541 if (!std::isnormal(dq) || (dq < 0))
continue;
551 for (
auto c : v)
if (
c == i)
return true;
double GetEdepAttenuatedMC(art::Event const &e) const
def analyze(root, level, gtrees, gbranches, doprint)
double GetEdepMC(art::Event const &e) const
Store parameters for running LArG4.
std::string fSimulationLabel
Container of LAr voxel information.
Handle< PROD > getHandle(SelectorBase const &) const
void analyze(art::Event const &e) override
void reconfigure(fhicl::ParameterSet const &p)
art framework interface to geometry description
double GetEdepHits(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const std::vector< recob::Hit > &hits) const
void beginRun(const art::Run &run) override
double ElectronsFromADCArea(double area, unsigned short plane) const
double GetEdepEMAttenuated_MC(art::Event const &e) const
Encapsulates the information we want store for a voxel.
#define DEFINE_ART_MODULE(klass)
virtual void reconfigure(fhicl::ParameterSet const &pset)
T get(std::string const &key) const
geo::GeometryCore const * fGeometry
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
General LArSoft Utilities.
Description of geometry of one entire detector.
bHitInfo(size_t i, double x, double e, int w)
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
EdepCal(fhicl::ParameterSet const &p)
Declaration of signal hit object.
Contains all timing reference information for the detector.
calo::CalorimetryAlg fCalorimetryAlg
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
EventNumber_t event() const
Access the description of detector geometry.
std::string fClusterModuleLabel
double GetEdepHitsMeV(const std::vector< recob::Hit > &hits) const
auto const & get(AssnsNode< L, R, D > const &r)
double LifetimeCorrection(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double time, double T0=0) const
Collection of Physical constants used in LArSoft.
std::unordered_map< int, const simb::MCParticle * > fParticleMap
double GetEdepEM_MC(art::Event const &e) const
std::string fHitsModuleLabel
bool Has(std::vector< int > v, int i) const
double GeVToElectrons() const