All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
SimDigitalToEnergy.cc
Go to the documentation of this file.
1 #include "SimDigitalToEnergy.h"
2 
3 #include <cassert>
4 
5 #include <EVENT/CalorimeterHit.h>
6 
7 using namespace lcio ;
8 using namespace marlin ;
9 
11 
13  : RealisticCaloReco::Processor("SimDigitalToEnergy")
14 {
15  _description = "This processor transforms the threshold value of digitized SDHCAL CalorimeterHits into energy" ;
16 
17  std::vector<float> energyCoefficients = {0.4f} ;
18  registerProcessorParameter("EnergyCalibration" ,
19  "Threshold to Energy correspondace" ,
21  energyCoefficients) ;
22 }
23 
25 {
26  //to avoid crash
27  _calibrCoeff.push_back(0) ;
28  _calLayers.push_back(0) ;
29 
31  assert( _energyCoefficients.size() > 0 ) ;
32 }
33 
34 float SimDigitalToEnergy::reconstructEnergy(const CalorimeterHit* hit)
35 {
36  float threshold = hit->getEnergy() - 1.0f ;
37 
38  if ( threshold < 0 )
39  return 0.f ;
40 
41  unsigned int iCoeff = static_cast<unsigned int>( threshold ) ;
42  if ( iCoeff >= _energyCoefficients.size() )
43  return _energyCoefficients.at( _energyCoefficients.size()-1 ) ;
44  else
45  return _energyCoefficients.at( iCoeff ) ;
46 }
47 
std::vector< float > _energyCoefficients
SimDigitalToEnergy aSimDigitalToEnergy
std::vector< float > _calibrCoeff
virtual float reconstructEnergy(const CalorimeterHit *hit)
virtual void init()
std::vector< int > _calLayers