13 #include "Geometry/LocalTransformation.h" 14 #include "CoreUtils/ServiceUtil.h" 19 #include "CLHEP/Units/SystemOfUnits.h" 20 #include "CLHEP/Random/RandGauss.h" 21 #include "CLHEP/Random/RandBinomial.h" 23 #include "TGeoManager.h" 32 fGeo = gar::providerFrom<geo::GeometryGAr>();
34 fDetProp = gar::providerFrom<detinfo::DetectorPropertiesService>();
89 MF_LOG_DEBUG(
"ECALReadoutSimStandardAlg") <<
"DoDigitization()";
94 float energy = it->Energy();
95 float time = it->Time();
99 std::array<double, 3> point = {
x,
y, z};
110 if(
nullptr != digihit) {
114 <<
"Could not digitize the simulated hit " << it;
122 MF_LOG_DEBUG(
"ECALReadoutSimStandardAlg") <<
"DoTileDigitization()";
125 float new_time = time;
131 std::pair< std::array<double, 3>,
bool > calc_pos = this->
CalculatePosition(x, y, z, cID);
133 if ( calc_pos.second ) {
137 std::array<double, 3>
pos = calc_pos.first;
141 MF_LOG_DEBUG(
"ECALReadoutSimStandardAlg") <<
"Tile digihit " << digihit
142 <<
" with cellID " << cID
143 <<
" has energy " <<
static_cast<unsigned int>(new_energy)
144 <<
" time " << new_time <<
" ns" 145 <<
" pos (" << pos[0] <<
", " << pos[1] <<
", " << pos[2] <<
")";
153 MF_LOG_DEBUG(
"ECALReadoutSimStandardAlg") <<
"DoStripDigitization()";
162 std::pair< std::array<double, 3>,
bool > calc_pos = this->
CalculatePosition(x, y, z, cID);
164 if ( calc_pos.second ) {
168 std::array<double, 3>
pos = calc_pos.first;
173 MF_LOG_DEBUG(
"ECALReadoutSimStandardAlg") <<
"Strip digihit " << digihit
174 <<
" with cellID " << cID
175 <<
" has energy " <<
static_cast<unsigned int>(new_energy)
176 <<
" time (" << times.first <<
", " << times.second <<
")" 177 <<
" pos (" << pos[0] <<
", " << pos[1] <<
", " << pos[2] <<
")";
185 MF_LOG_DEBUG(
"ECALReadoutSimStandardAlg") <<
"DoPhotonStatistics()";
186 CLHEP::RandBinomial BinomialRand(
fEngine);
188 TVector3 point(x, y, z);
198 float sat_pixel = 0.;
208 float smeared_px_noise = smeared_px;
216 if(smeared_px_noise > 0)
228 MF_LOG_DEBUG(
"ECALReadoutSimStandardAlg") <<
"DoTimeSmearing()";
229 CLHEP::RandGauss GausRand(
fEngine);
237 MF_LOG_DEBUG(
"ECALReadoutSimStandardAlg") <<
"AddElectronicNoise()";
240 CLHEP::RandGauss GausRand(
fEngine);
241 float smeared_energy = energy + GausRand.shoot(0.,
fDetProp->
NoisePx());
242 return smeared_energy;
251 std::array<double, 3> point = {
x,
y, z};
254 std::array<double, 3> pointLocal;
259 std::array<double, 3> point_back;
265 std::string base_node_name = nodename.substr(0, nodename.find(
"_layer_") + 9);
266 std::string base_new_node_name = newnodename.substr(0, newnodename.find(
"_layer_") + 9);
268 if( base_new_node_name != base_node_name ){
269 MF_LOG_DEBUG(
"ECALReadoutSimStandardAlg") <<
"CalculatePosition()" 270 <<
" isTile " <<
fGeo->
isTile(point, cID) <<
"\n" 272 <<
" Local Point before new position ( " << pointLocal[0] <<
", " << pointLocal[1] <<
", " << pointLocal[2] <<
" ) in node " << nodename <<
"\n" 273 <<
" Local Point after new position ( " << pointLocal_back[0] <<
", " << pointLocal_back[1] <<
", " << pointLocal_back[2] <<
" ) in node " << newnodename <<
"\n" 274 <<
" Dropping the hit ";
280 return std::make_pair(point_back, drop);
287 std::array<double, 3> point = {
x,
y, z};
288 std::array<double, 3> pointLocal;
296 float time1 = time + times.first;
297 float time2 = time + times.second;
303 return std::make_pair(smeared_time1, smeared_time2);
TGeoNode * FindNode(T const &x, T const &y, T const &z) const
TGeoManager * fGeoManager
virtual double SiPMGain() const =0
bool WorldToLocal(std::array< double, 3 > const &world, std::array< double, 3 > &local, gar::geo::LocalTransformation< TGeoHMatrix > &trans) const
float GetSensVolumeThickness(const TVector3 &point) const
float const & Time() const
bool fSaturation
flag for sipm saturation or not
void reconfigure(fhicl::ParameterSet const &pset)
void PrepareAlgo(const std::vector< art::Ptr< sdp::CaloDeposit > > &hitVector)
CLHEP::HepRandomEngine & fEngine
random number engine
virtual double IntercalibrationFactor() const =0
static constexpr double MeV
double getStripLength(const std::array< double, 3 > &point, const gar::raw::CellID_t &cID) const
const detinfo::DetectorProperties * fDetProp
detector properties
virtual double EffectivePixel() const =0
raw::CaloRawDigit * DoTileDigitization(float x, float y, float z, float energy, float time, raw::CellID_t cID) const
virtual double ADCSaturation() const =0
virtual ~ECALReadoutSimStandardAlg()
bool fAddNoise
flag to add noise or not
bool isTile(const std::array< double, 3 > &point, const gar::raw::CellID_t &cID) const
virtual double NoisePx() const =0
std::array< double, 3 > GetPosition(const TGeoNode *node, const gar::raw::CellID_t &cID) const
static constexpr double GeV
T get(std::string const &key) const
virtual double LightYield() const =0
bool LocalToWorld(std::array< double, 3 > const &local, std::array< double, 3 > &world, gar::geo::LocalTransformation< TGeoHMatrix > const &trans) const
TGeoManager * ROOTGeoManager() const
Access to the ROOT geometry description manager.
Definition of basic calo raw digits.
std::pair< std::array< double, 3 >, bool > CalculatePosition(float x, float y, float z, raw::CellID_t cID) const
Detector simulation of raw signals on wires.
virtual double MeVtoMIP() const =0
General GArSoft Utilities.
ECALReadoutSimStandardAlg(CLHEP::HepRandomEngine &engine, fhicl::ParameterSet const &pset)
std::vector< raw::CaloRawDigit * > m_DigitHitVec
vector of digitized hits
std::unique_ptr< util::SiPMUtils > fSiPMUtils
used for the SiPM saturation
virtual double TimeResolution() const =0
float DoTimeSmearing(float time) const
bool fTimeSmearing
flag for time smearing or not
float DoPhotonStatistics(float x, float y, float z, float energy) const
std::pair< float, float > CalculateLightPropagation(const std::array< double, 3 > &point, const std::array< double, 3 > &local, const gar::raw::CellID_t &cID) const
std::pair< float, float > DoLightPropagation(float x, float y, float z, float time, raw::CellID_t cID) const
art framework interface to geometry description
std::vector< const sdp::CaloDeposit * > m_SimCaloHitVec
used to store the simulated hits
float AddElectronicNoise(float energy) const
gar::geo::GeometryCore const * fGeo
geometry information
raw::CaloRawDigit * DoStripDigitization(float x, float y, float z, float energy, float time, raw::CellID_t cID) const