15 #include "CLHEP/Random/RandFlat.h"
17 #define CBOLTZ (1.38E-23)
18 #define e_SI (1.6E-19)
45 LogDebug(
"StripDigiInfo") <<
"APVs running in peak mode (poor time resolution)";
48 LogDebug(
"StripDigiInfo") <<
"APVs running in deconvolution mode (good time resolution)";
73 const std::vector<std::pair<const PSimHit*, int> >&
input,
83 CLHEP::HepRandomEngine* engine) {
93 std::vector<bool> badChannels;
95 badChannels.insert(badChannels.begin(),
numStrips,
false);
98 fs = deadChannelHandle->
decode(*it);
100 badChannels[
strip] =
true;
114 std::vector<std::pair<const PSimHit*, int> >::const_iterator simHitIter =
input.begin();
115 std::vector<std::pair<const PSimHit*, int> >::const_iterator simHitIterEnd =
input.end();
117 for (; simHitIter != simHitIterEnd; ++simHitIter) {
121 if (std::fabs(((*simHitIter).first)->tof() -
cosmicShift -
138 bool isHadron =
particle->isHadron();
139 if (
charge != 0 && isHadron) {
143 std::cout <<
"-------------------HIP--------------" << std::endl;
144 std::cout <<
"Killing APVs " << FirstAPV <<
" - " << LastAPV <<
" " << detID << std::endl;
146 badChannels[
strip] =
true;
175 if (badChannels[
strip])
186 badChannels[RefStrip]) {
190 float noiseRMS = noiseHandle->
getNoise(RefStrip, detNoiseRange);
191 float gainValue = gainHandle->
getStripGain(RefStrip, detGainRange);
232 std::vector<float> noiseRMSv;
234 noiseRMSv.insert(noiseRMSv.begin(),
numStrips, 0.);
238 if (!badChannels[
strip])
245 badChannels[RefStrip]) {
251 if (!badChannels[
strip])
252 noiseRMSv[
strip] = noiseRMS;
282 std::vector<float> vPeds;
284 vPeds.insert(vPeds.begin(),
numStrips, 0.);
288 if (!badChannels[
strip])
293 if (!badChannels[
strip])
316 const std::vector<float>& afterNoise,
317 unsigned int detID) {
319 for (DigitalVecType::const_iterator
i =
digis.begin();
i !=
digis.end();
i++) {
322 HitToDigisMapType::const_iterator mi(htd.find(
i->strip()));
325 HitCounterToDigisMapType::const_iterator cmi(hctd.find(
i->strip()));
326 std::map<const PSimHit*, Amplitude> totalAmplitudePerSimHit;
327 for (std::vector<std::pair<const PSimHit*, Amplitude> >::const_iterator simul = (*mi).second.begin();
328 simul != (*mi).second.end();
330 totalAmplitudePerSimHit[(*simul).first] += (*simul).second;
334 double totalAmplitude1 = afterNoise[(*mi).first];
338 for (std::map<const PSimHit*, Amplitude>::const_iterator iter = totalAmplitudePerSimHit.begin();
339 iter != totalAmplitudePerSimHit.end();
342 float fraction = (*iter).second / totalAmplitude1;
347 for (std::vector<std::pair<const PSimHit*, int> >::const_iterator simcount = (*cmi).second.begin();
348 simcount != (*cmi).second.end();
350 if ((*iter).first == (*simcount).first)
351 sim_counter = (*simcount).second;
354 ((*iter).first)->trackId(),
356 ((*iter).first)->eventId(),
366 const std::vector<float>& afterNoise,
367 unsigned int detID) {
370 for (DigitalRawVecType::const_iterator
i =
digis.begin();
i !=
digis.end();
i++) {
374 HitToDigisMapType::const_iterator mi(htd.find(nstrip));
375 HitCounterToDigisMapType::const_iterator cmi(hctd.find(nstrip));
378 std::map<const PSimHit*, Amplitude> totalAmplitudePerSimHit;
379 for (std::vector<std::pair<const PSimHit*, Amplitude> >::const_iterator simul = (*mi).second.begin();
380 simul != (*mi).second.end();
382 totalAmplitudePerSimHit[(*simul).first] += (*simul).second;
386 double totalAmplitude1 = afterNoise[(*mi).first];
389 int sim_counter_raw = 0;
390 for (std::map<const PSimHit*, Amplitude>::const_iterator iter = totalAmplitudePerSimHit.begin();
391 iter != totalAmplitudePerSimHit.end();
394 float fraction = (*iter).second / totalAmplitude1;
400 for (std::vector<std::pair<const PSimHit*, int> >::const_iterator simcount = (*cmi).second.begin();
401 simcount != (*cmi).second.end();
403 if ((*iter).first == (*simcount).first)
404 sim_counter_raw = (*simcount).second;
407 ((*iter).first)->trackId(),
409 ((*iter).first)->eventId(),