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(
"MuIDReadoutSimStandardAlg") <<
"DoDigitization()";
94 float energy = it->Energy();
95 float time = it->Time();
103 if(
nullptr != digihit) {
107 <<
"Could not digitize the simulated hit " << it;
115 MF_LOG_DEBUG(
"MuIDReadoutSimStandardAlg") <<
"DoStripDigitization()";
124 std::pair< std::array<double, 3>,
bool > calc_pos = this->
CalculatePosition(x, y, z, cID);
126 if ( calc_pos.second ) {
130 std::array<double, 3>
pos = calc_pos.first;
135 MF_LOG_DEBUG(
"MuIDReadoutSimStandardAlg") <<
"Strip digihit " << digihit
136 <<
" with cellID " << cID
137 <<
" has energy " <<
static_cast<unsigned int>(new_energy)
138 <<
" time (" << times.first <<
", " << times.second <<
")" 139 <<
" pos (" << pos[0] <<
", " << pos[1] <<
", " << pos[2] <<
")";
147 MF_LOG_DEBUG(
"MuIDReadoutSimStandardAlg") <<
"DoPhotonStatistics()";
148 CLHEP::RandBinomial BinomialRand(
fEngine);
150 TVector3 point(x, y, z);
160 float sat_pixel = 0.;
170 float smeared_px_noise = smeared_px;
178 if(smeared_px_noise > 0)
190 MF_LOG_DEBUG(
"MuIDReadoutSimStandardAlg") <<
"DoTimeSmearing()";
191 CLHEP::RandGauss GausRand(
fEngine);
199 MF_LOG_DEBUG(
"MuIDReadoutSimStandardAlg") <<
"AddElectronicNoise()";
202 CLHEP::RandGauss GausRand(
fEngine);
203 float smeared_energy = energy + GausRand.shoot(0.,
fDetProp->
NoisePx());
204 return smeared_energy;
213 std::array<double, 3> point = {
x,
y, z};
216 std::array<double, 3> pointLocal;
221 std::array<double, 3> point_back;
227 std::string base_node_name = nodename.substr(0, nodename.find(
"_layer_") + 9);
228 std::string base_new_node_name = newnodename.substr(0, newnodename.find(
"_layer_") + 9);
230 if( base_new_node_name != base_node_name ){
231 MF_LOG_DEBUG(
"MuIDReadoutSimStandardAlg") <<
"CalculatePosition()" 233 <<
" Local Point before new position ( " << pointLocal[0] <<
", " << pointLocal[1] <<
", " << pointLocal[2] <<
" ) in node " << nodename <<
"\n" 234 <<
" Local Point after new position ( " << pointLocal_back[0] <<
", " << pointLocal_back[1] <<
", " << pointLocal_back[2] <<
" ) in node " << newnodename <<
"\n" 235 <<
" Dropping the hit ";
241 return std::make_pair(point_back, drop);
248 std::array<double, 3> point = {
x,
y, z};
249 std::array<double, 3> pointLocal;
257 float time1 = time + times.first;
258 float time2 = time + times.second;
264 return std::make_pair(smeared_time1, smeared_time2);
TGeoNode * FindNode(T const &x, T const &y, T const &z) const
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
std::vector< raw::CaloRawDigit * > m_DigitHitVec
vector of digitized hits
float DoPhotonStatistics(float x, float y, float z, float energy) const
MuIDReadoutSimStandardAlg(CLHEP::HepRandomEngine &engine, fhicl::ParameterSet const &pset)
CLHEP::HepRandomEngine & fEngine
random number engine
virtual double IntercalibrationFactor() const =0
static constexpr double MeV
std::pair< float, float > DoLightPropagation(float x, float y, float z, float time, raw::CellID_t cID) const
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
virtual ~MuIDReadoutSimStandardAlg()
virtual double ADCSaturation() const =0
bool fAddNoise
flag to add noise or not
virtual double NoisePx() const =0
std::vector< const sdp::CaloDeposit * > m_SimCaloHitVec
used to store the simulated hits
std::array< double, 3 > GetPosition(const TGeoNode *node, const gar::raw::CellID_t &cID) const
void reconfigure(fhicl::ParameterSet const &pset)
std::pair< std::array< double, 3 >, bool > CalculatePosition(float x, float y, float z, raw::CellID_t cID) const
float DoTimeSmearing(float time) const
std::unique_ptr< util::SiPMUtils > fSiPMUtils
used for the SiPM saturation
static constexpr double GeV
T get(std::string const &key) const
TGeoManager * fGeoManager
virtual double LightYield() const =0
raw::CaloRawDigit * DoStripDigitization(float x, float y, float z, float energy, float time, raw::CellID_t cID) const
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.
Detector simulation of raw signals on wires.
virtual double MeVtoMIP() const =0
General GArSoft Utilities.
void PrepareAlgo(const std::vector< art::Ptr< sdp::CaloDeposit > > &hitVector)
virtual double TimeResolution() const =0
bool fTimeSmearing
flag for time smearing or not
std::pair< float, float > CalculateLightPropagation(const std::array< double, 3 > &point, const std::array< double, 3 > &local, const gar::raw::CellID_t &cID) const
art framework interface to geometry description
float AddElectronicNoise(float energy) const
gar::geo::GeometryCore const * fGeo
geometry information