32 auto hitsAssociatedWith(
60 size_t iAssociatedCluster = 0;
64 if (iAssociatedCluster == cluster.
key())
return hits;
69 throw std::runtime_error
83 : fUseArea( config.UseArea() )
85 , fElectronLifetime( 1e10 )
89 if ( recombParams.modelIsModBox()) {
94 else if ( recombParams.modelIsBirks()) {
99 else if ( recombParams.modelIsConstant()) {
104 throw std::runtime_error
105 (
"Unsupported recombination mode: '" + recombParams.Model() +
"'" );
109 throw std::runtime_error(
"Energy correction based on hit peak amplitude not implemented yet.");
137 double const dEdx = 2.3;
153 if (clusters.empty())
return {};
159 std::vector<double> clusterEnergies;
161 clusterEnergies.resize
162 (
geom->
TPC(refTPC).
Nplanes(), std::numeric_limits<double>::lowest());
164 if ( clusters.size() > clusterEnergies.size() ) {
165 mf::LogError(
"LinearEnergyAlg") << clusters.size() <<
" clusters for " 166 << clusterEnergies.size() <<
" wire planes!";
171 auto const plane = cluster->
Plane();
172 if (plane != refTPC) {
173 throw std::runtime_error(
175 +
" is expected on TPC " + std::string(refTPC)
176 +
" but is found on plane " + std::string(plane)
183 (*cluster, hitsAssociatedWith(cluster, hitsPerCluster));
185 auto const planeNo = plane.Plane;
186 if (clusterEnergies[planeNo] >= 0.) {
188 <<
"Warning! two or more clusters share plane " 189 << plane <<
"! (the last with energy " << E
190 <<
", the previous " << clusterEnergies[planeNo] <<
" GeV)";
192 clusterEnergies[planeNo] =
E;
196 return clusterEnergies;
210 throw std::logic_error
211 (
"Unexpected! recombination model in RecombinationCorrection()");
224 double dQdx = std::log ( Alpha + Beta * dEdx ) / ( Beta *
kWion );
239 double dQdx = ( A3t/
kWion ) / ( K3t / Efield * dEdx + 1);
static const std::string Constant
geo::GeometryCore const * geom
Pointer to the geometry to be used.
Algorithm(s) calculating energy.
unsigned int Nplanes() const
Number of planes in this tpc.
std::vector< double > CalculateEnergy(std::vector< art::Ptr< recob::Cluster >> const &clusters, art::Assns< recob::Cluster, recob::Hit > const &hitsPerCluster) const
Calculates the energy of the shower.
double RecombinationCorrection(double dEdx) const
TODO: make it more flexible.
fhicl::Table< RecombinationConfig > Recombination
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
geo::PlaneID Plane() const
Returns the plane ID this cluster lies on.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
Cluster finding and building.
double BirksInverse(double dEdx) const
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
auto associated_groups(A const &assns)
Helper functions to access associations in order.
static const std::string Birks
double CalculateClusterEnergy(recob::Cluster const &cluster, BeginHitIter beginHit, EndHitIter endHit) const
Calculates the energy of a single cluster.
double ModBoxInverse(double dEdx) const
detinfo::DetectorClocks const * detc
Pointer to the detector clock.
static constexpr double kWion
ionization potenial in LAr, 23.6 eV = 1e, Wion in GeV/e
The data type to uniquely identify a TPC.
ModBoxParameters recombModBoxParams
Parameters for recombination box model; filled only when this model is selected.
virtual double Density(double temperature) const =0
Returns argon density at a given temperature.
Definition of data types for geometry description.
detinfo::DetectorProperties const * detp
Pointer to the detector property.
Detector simulation of raw signals on wires.
float PeakTime() const
Time of the signal peak, in tick units.
ConstantRecombParameters recombConstParams
Parameters for constant recombination factor; filled only when this model is selected.
std::string to_string(Flag_t< Storage > const flag)
Convert a flag into a stream (shows its index).
ID_t ID() const
Identifier of this cluster.
Helper functions to access associations in order.
LinearEnergyAlg(Config const &config)
Constructor with configuration validation.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
BirksParameters recombBirksParams
Parameters for recombination Birks model; filled only when this model is selected.
static const std::string ModBox
TPCGeo const & TPC(unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified TPC.
virtual double TPCTick2TrigTime(double tick) const =0
Converts a TPC time (in ticks) into a trigger time [µs].
2D representation of charge deposited in the TDC/wire plane
virtual double Efield(unsigned int planegap=0) const =0
Returns the nominal electric field in the specified volume.
virtual double ElectronLifetime() const =0
Returns the attenuation constant for ionization electrons.
double CalculateHitEnergy(recob::Hit const &hit) const
Returns the corrected energy from the hit.