20 CaloHitResponse(parameterMap, shapes), theSiPM(), theRecoveryTime(250.),
21 TIMEMULT(1), Y11RANGE(80.), Y11MAX(0.04), Y11TIMETORISE(16.65),
38 photonTimeMap::iterator channelPhotons;
43 channelPhotons->second));
46 const unsigned int size ( signal.
size() ) ;
48 for(
unsigned int i ( 0 ) ;
i !=
size ; ++
i ) {
49 keep = keep || signal[
i] > 1.e-7 ;
56 if (keep)
add(signal);
66 (*oldSignal) += signal;
76 unsigned int photons(signal + 0.5);
82 std::pair<DetId, photonTimeHist >(
id,
84 pars.readoutFrameSize(), 0)
89 LogDebug(
"HcalSiPMHitResponse") << id;
90 LogDebug(
"HcalSiPMHitResponse") <<
" fCtoGeV: " << pars.fCtoGeV(
id)
91 <<
" samplingFactor: " << pars.samplingFactor(
id)
92 <<
" photoelectronsToAnalog: " << pars.photoelectronsToAnalog(
id)
93 <<
" simHitToPhotoelectrons: " << pars.simHitToPhotoelectrons(
id);
95 <<
" photons: " << photons
99 LogDebug(
"HcalSiPMHitResponse") <<
" corrected time: " <<
time;
100 LogDebug(
"HcalSiPMHitResponse") <<
" timePhase: " << pars.timePhase()
102 <<
" binOfMaximum: " << pars.binOfMaximum()
110 tzero +=
BUNCHSPACE*pars.binOfMaximum() + 50.;
111 LogDebug(
"HcalSiPMHitResponse") <<
" corrected tzero: " << tzero <<
'\n';
114 for (
unsigned int pe(0); pe<
photons; ++pe) {
117 LogDebug(
"HcalSiPMHitResponse") <<
"t_pe: " << t_pe <<
" t_pe + tzero: " << (t_pe+
tzero)
118 <<
" t_bin: " << t_bin <<
'\n';
127 typedef std::multiset <const PCaloHit *, PCaloHitCompareTimes>
SortedHitSet;
129 std::map< DetId, SortedHitSet > sortedhits;
131 hitItr != hits.
end(); ++hitItr) {
135 DetId id(hitItr->id());
136 if (sortedhits.find(
id)==sortedhits.end())
137 sortedhits.insert(std::pair<DetId, SortedHitSet>(
id, SortedHitSet()));
138 sortedhits[id].insert(&(*hitItr));
141 int pixelIntegral, oldIntegral;
143 for (std::map<DetId, SortedHitSet>::iterator
i = sortedhits.begin();
144 i!=sortedhits.end(); ++
i) {
146 for (SortedHitSet::iterator itr =
i->second.begin();
147 itr !=
i->second.end(); ++itr) {
150 oldIntegral = pixelIntegral;
189 int photons =
static_cast<int>(signal + 0.5);
192 signal = double(pixels);
203 double binTime =
tzero;
206 result[
bin] += (*shape)(binTime)*signal;
223 int sampleBin(0), preciseBin(0);
226 double hitPixels(0.), elapsedTime(0.);
227 unsigned int sumPE(0);
232 std::list< std::pair<double, double> > pulses;
233 std::list< std::pair<double, double> >::iterator pulse;
234 double timeDiff, pulseBit;
236 for (
unsigned int pt(0);
pt < photons.size(); ++
pt) {
243 sumHits += hitPixels;
251 pulses.push_back( std::pair<double, double>(elapsedTime, hitPixels) );
253 signal[sampleBin] += hitPixels;
264 pulse = pulses.begin();
265 while (pulse != pulses.end()) {
266 timeDiff = elapsedTime - pulse->first;
267 pulseBit = sipmPulseShape(timeDiff)*pulse->second;
273 signal[sampleBin] += pulseBit;
275 if (sipmPulseShape(timeDiff) < 1
e-6)
276 pulse = pulses.erase(pulse);
294 double diffNorm)
const {
313 return exp(-0.0635-0.1518*t)*
pow(t, 2.528)/2485.9;
virtual void initializeHits()
Initialize hits.
A general implementation for the response of a SiPM.
virtual bool keepBlank() const
Electronic response of the preamp.
std::multiset< PCaloHit, PCaloHitCompareTimes > SortedHitSet
static double Y11TimePDF(double t)
int preciseSize() const
get the size
Main class for Parameters in different subdetectors.
CLHEP::RandFlat * theRndFlat
virtual double delay(const PCaloHit &hit) const =0
double timePhase() const
the adjustment you need to apply to get the signal where you want it
int getIntegral(double time)
Creates electronics signals from hits.
virtual void differentiatePreciseSamples(CaloSamples &samples, double diffNorm=1.0) const
void setNCells(int nCells)
bool doSiPMSmearing() const
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
virtual bool accepts(const PCaloHit &hit) const =0
void initRandomEngine(CLHEP::HepRandomEngine &engine)
double timeOfFlight(const DetId &detId) const
float preciseDeltaT() const
double generatePhotonTime() const
double analogSignalAmplitude(const DetId &id, float energy, const CaloSimParameters ¶meters) const
int readoutFrameSize() const
for now, the LinearFrames and trhe digis will be one-to-one.
const CaloVHitCorrection * theHitCorrection
Integral< F, X >::type integral(const F &f)
HcalTDCParameters theTDCParams
AnalogSignalMap theAnalogSignalMap
std::vector< unsigned int > photonTimeHist
virtual CaloSamples makeBlankSignal(const DetId &detId) const
float const Y11TIMETORISE
const CaloShapes * theShapes
virtual void setRandomEngine(CLHEP::HepRandomEngine &engine)
const CaloVSimParameterMap * theParameterMap
int size() const
get the size
HcalSiPMHitResponse(const CaloVSimParameterMap *parameterMap, const CaloShapes *shapes)
CaloSamples * findSignal(const DetId &detId)
users can look for the signal for a given cell
float & preciseAtMod(int i)
mutable function to access precise samples
virtual int hitCells(unsigned int photons, unsigned int integral=0) const
virtual void run(MixCollection< PCaloHit > &hits)
Complete cell digitization.
virtual void finalizeHits()
Finalize hits.
static const double tzero[3]
virtual void add(const PCaloHit &hit)
process a single SimHit
const CaloVHitFilter * theHitFilter
virtual void setRandomEngine(CLHEP::HepRandomEngine &engine)
DetId id() const
get the (generic) id
photonTimeMap precisionTimedPhotons
void addToHistory(double time, int pixels)
tuple size
Write out results.
Power< A, B >::type pow(const A &a, const B &b)
virtual const CaloVShape * shape(const DetId &detId) const
virtual ~HcalSiPMHitResponse()
virtual CaloSamples makeSiPMSignal(const DetId &id, const PCaloHit &hit, int &integral) const