14 #include "CLHEP/Random/RandPoissonQ.h" 26 HighFidelityPreMix(HighFidelity),
56 photonTimeMap::iterator channelPhotons;
62 const unsigned int size(signal.
size());
64 for (
unsigned int i(0);
i !=
size; ++
i) {
97 auto& phot = photI->second;
98 for (
int i = 0;
i < signal.
size(); ++
i) {
99 unsigned int photons(signal[
i] + 0.5);
110 unsigned int photons(signal + 0.5);
123 LogDebug(
"HcalSiPMHitResponse") <<
" fCtoGeV: " << pars.fCtoGeV(
id)
124 <<
" samplingFactor: " << pars.samplingFactor(
id)
125 <<
" photoelectronsToAnalog: " << pars.photoelectronsToAnalog(
id)
126 <<
" simHitToPhotoelectrons: " << pars.simHitToPhotoelectrons(
id);
127 LogDebug(
"HcalSiPMHitResponse") <<
" energy: " <<
hit.energy() <<
" photons: " <<
photons <<
" time: " <<
time;
128 LogDebug(
"HcalSiPMHitResponse") <<
" timePhase: " << pars.timePhase() <<
" tof: " << tof
129 <<
" binOfMaximum: " << pars.binOfMaximum() <<
" phaseShift: " <<
thePhaseShift_;
133 LogDebug(
"HcalSiPMHitResponse") <<
" corrected tzero: " << tzero_bin <<
'\n';
136 unsigned signalShape = pars.signalShape(
id);
137 for (
unsigned int pe(0); pe <
photons; ++pe) {
139 t_bin =
int(t_pe *
invdt + tzero_bin + 0.5);
140 LogDebug(
"HcalSiPMHitResponse") <<
"t_pe: " << t_pe <<
" t_pe + tzero: " << (t_pe + tzero_bin *
dt)
141 <<
" t_bin: " << t_bin <<
'\n';
150 for (std::vector<DetId>::const_iterator idItr =
theDetIds->begin(); idItr !=
theDetIds->end(); ++idItr) {
162 unsigned int sumnoisePE(0);
163 for (
int tprecise(0); tprecise < nPreciseBins; ++tprecise) {
164 int noisepe = CLHEP::RandPoissonQ::shoot(engine, dc_pe_avg);
175 sumnoisePE += noisepe;
181 LogDebug(
"HcalSiPMHitResponse") <<
" total noise (PEs): " << sumnoisePE;
198 CLHEP::HepRandomEngine* engine) {
207 int sampleBin(0), preciseBin(0);
210 double hitPixels(0.), elapsedTime(0.);
216 const int nptb = photonTimeBins.size();
218 for (
auto i = 0;
i < nptb; ++
i)
220 for (
int tbin(0); tbin < nptb; ++tbin) {
221 pe = photonTimeBins[tbin];
225 sampleBin = preciseBin /
nbins;
228 signal[sampleBin] += pe;
235 LogDebug(
"HcalSiPMHitResponse") <<
" elapsedTime: " << elapsedTime <<
" sampleBin: " << sampleBin
236 <<
" preciseBin: " << preciseBin <<
" pe: " << pe <<
" hitPixels: " << hitPixels;
238 signal[sampleBin] += hitPixels;
247 for (
auto i = tbin;
i < nptb; ++
i) {
248 auto itdiff =
i - tbin;
249 if (itdiff == sipmPulseShape.nBins())
251 auto shape = sipmPulseShape[itdiff];
252 auto pulseBit =
shape * hitPixels;
261 for (
auto i = 0;
i < nptb; ++
i) {
262 auto iSampleBin =
i /
nbins;
263 signal[iSampleBin] += sum[
i];
269 for (
auto i = 0;
i < nptb; ++
i) {
271 LogDebug(
"HcalSiPMHitResponse") <<
i <<
' ' << iSampleBin <<
' ' << signal[iSampleBin] <<
' '
int size() const
get the size
const std::vector< DetId > * theDetIds
void finalizeHits(CLHEP::HepRandomEngine *) override
Finalize hits.
void setSaturationPars(const std::vector< float > &pars)
constexpr bool isNotFinite(T x)
virtual int getReadoutFrameSize(const DetId &id) const
int pixels(const DetId &detId) const
Main class for Parameters in different subdetectors.
double sipmCrossTalk(const DetId &detId) const
virtual void addPEnoise(CLHEP::HepRandomEngine *engine)
double analogSignalAmplitude(const DetId &id, float energy, const CaloSimParameters ¶meters, CLHEP::HepRandomEngine *) const
virtual CaloSamples makeBlankSignal(const DetId &detId) const
bool doSiPMSmearing() const
Creates electronics signals from hits.
DetId id() const
get the (generic) id
double hitCells(CLHEP::HepRandomEngine *, unsigned int pes, double tempDiff=0., double photonTime=0.)
void setNCells(int nCells)
virtual bool keepBlank() const
double sipmDarkCurrentuA(const DetId &detId) const
int preciseSize() const
get the size
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
void add(const PCaloHit &hit, CLHEP::HepRandomEngine *) override
process a single SimHit
void setCrossTalk(double xtalk)
virtual void setDetIds(const std::vector< DetId > &detIds)
virtual bool accepts(const PCaloHit &hit) const =0
unsigned int signalShape(const DetId &detId) const
static constexpr float invDeltaTSiPM_
std::vector< unsigned int > photonTimeHist
~HcalSiPMHitResponse() override
const CaloVSimParameterMap * theParameterMap
static double generatePhotonTime(CLHEP::HepRandomEngine *engine, unsigned int signalShape)
void initializeHits() override
Initialize hits.
virtual CaloSamples makeSiPMSignal(DetId const &id, photonTimeHist const &photons, CLHEP::HepRandomEngine *)
double timeOfFlight(const DetId &detId) const
float & preciseAtMod(int i)
mutable function to access precise samples
virtual void add(const PCaloHit &hit, CLHEP::HepRandomEngine *)
process a single SimHit
std::map< int, HcalSiPMShape > shapeMap
static const double tzero[3]
HcalSiPMHitResponse(const CaloVSimParameterMap *parameterMap, const CaloShapes *shapes, bool PreMix1=false, bool HighFidelity=true)
const CaloVHitFilter * theHitFilter
photonTimeMap precisionTimedPhotons
void setPreciseSize(unsigned int size)
double photoelectronsToAnalog(const DetId &detId) const override
std::vector< float > sipmNonlinearity(const DetId &detId) const
static constexpr int BUNCHSPACE