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)";
83 CLHEP::HepRandomEngine* engine) {
93 std::vector<bool> badChannels;
95 badChannels.insert(badChannels.begin(),
numStrips,
false);
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);
235 std::vector<float> noiseRMSv;
237 noiseRMSv.insert(noiseRMSv.begin(),
numStrips, 0.);
241 if (!badChannels[
strip])
248 badChannels[RefStrip]) {
254 if (!badChannels[
strip])
255 noiseRMSv[
strip] = noiseRMS;
285 std::vector<float> vPeds;
287 vPeds.insert(vPeds.begin(),
numStrips, 0.);
291 if (!badChannels[
strip])
296 if (!badChannels[
strip])
319 const std::vector<float>& afterNoise,
320 unsigned int detID) {
322 for (DigitalVecType::const_iterator
i =
digis.begin();
i !=
digis.end();
i++) {
325 HitToDigisMapType::const_iterator mi(htd.find(
i->strip()));
328 HitCounterToDigisMapType::const_iterator cmi(hctd.find(
i->strip()));
329 std::map<const PSimHit*, Amplitude> totalAmplitudePerSimHit;
330 for (
std::vector<std::pair<const PSimHit*, Amplitude> >::const_iterator simul = (*mi).second.begin();
331 simul != (*mi).second.end();
333 totalAmplitudePerSimHit[(*simul).first] += (*simul).second;
337 double totalAmplitude1 = afterNoise[(*mi).first];
341 for (std::map<const PSimHit*, Amplitude>::const_iterator iter = totalAmplitudePerSimHit.begin();
342 iter != totalAmplitudePerSimHit.end();
345 float fraction = (*iter).second / totalAmplitude1;
350 for (
std::vector<std::pair<const PSimHit*, int> >::const_iterator simcount = (*cmi).second.begin();
351 simcount != (*cmi).second.end();
353 if ((*iter).first == (*simcount).first)
354 sim_counter = (*simcount).second;
357 ((*iter).first)->trackId(),
359 ((*iter).first)->eventId(),
369 const std::vector<float>& afterNoise,
370 unsigned int detID) {
373 for (DigitalRawVecType::const_iterator
i =
digis.begin();
i !=
digis.end();
i++) {
377 HitToDigisMapType::const_iterator mi(htd.find(nstrip));
378 HitCounterToDigisMapType::const_iterator cmi(hctd.find(nstrip));
381 std::map<const PSimHit*, Amplitude> totalAmplitudePerSimHit;
382 for (
std::vector<std::pair<const PSimHit*, Amplitude> >::const_iterator simul = (*mi).second.begin();
383 simul != (*mi).second.end();
385 totalAmplitudePerSimHit[(*simul).first] += (*simul).second;
389 double totalAmplitude1 = afterNoise[(*mi).first];
392 int sim_counter_raw = 0;
393 for (std::map<const PSimHit*, Amplitude>::const_iterator iter = totalAmplitudePerSimHit.begin();
394 iter != totalAmplitudePerSimHit.end();
397 float fraction = (*iter).second / totalAmplitude1;
403 for (
std::vector<std::pair<const PSimHit*, int> >::const_iterator simcount = (*cmi).second.begin();
404 simcount != (*cmi).second.end();
406 if ((*iter).first == (*simcount).first)
407 sim_counter_raw = (*simcount).second;
410 ((*iter).first)->trackId(),
412 ((*iter).first)->eventId(),
void push_link(const DigitalVecType &, const HitToDigisMapType &, const HitCounterToDigisMapType &, const std::vector< float > &, unsigned int)
T getParameter(std::string const &) const
const Range getRange(const uint32_t &detID) const
SiHitDigitizer * theSiHitDigitizer
DigitalRawVecType rawdigis
SiStripFedZeroSuppression * theSiZeroSuppress
size_t firstChannelWithSignal
std::vector< unsigned int >::const_iterator ContainerIterator
void addBaselineShift(std::vector< float > &, std::vector< bool > &) const override
const SiStripApvGain::Range getRange(uint32_t detID) const
std::pair< ContainerIterator, ContainerIterator > Range
DigitalRawVecType const & convertRaw(const std::vector< float > &, const SiStripGain *, unsigned int detid) override
const ParticleDataTable * pdt
const Range getRange(const uint32_t detID) const
void addNoise(std::vector< float > &, size_t &, size_t &, int, float, CLHEP::HepRandomEngine *) const override
void push_link_raw(const DigitalRawVecType &, const HitToDigisMapType &, const HitCounterToDigisMapType &, const std::vector< float > &, unsigned int)
SiDigitalConverter::DigitalRawVecType DigitalRawVecType
float getPed(const uint16_t &strip, const Range &range) const
SiDigitalConverter::DigitalVecType DigitalVecType
static std::string const input
std::vector< StripDigiSimLink > link_coll
T getUntrackedParameter(std::string const &, T const &) const
SiTrivialDigitalConverter * theSiDigitalConverter
static float getNoise(uint16_t strip, const Range &range)
T const * product() const
std::map< int, std::vector< std::pair< const PSimHit *, Amplitude > >, std::less< int > > HitToDigisMapType
virtual void add(const std::vector< float > &locAmpl, const size_t &firstChannelWithSignal, const size_t &lastChannelWithSignal, const PSimHit *hit, const int &counter)
void run(edm::DetSet< SiStripDigi > &, edm::DetSet< SiStripRawDigi > &, const std::vector< std::pair< const PSimHit *, int > > &, StripGeomDetUnit const *, GlobalVector, float, edm::ESHandle< SiStripGain > &, edm::ESHandle< SiStripThreshold > &, edm::ESHandle< SiStripNoises > &, edm::ESHandle< SiStripPedestals > &, edm::ESHandle< SiStripBadStrip > &, const TrackerTopology *tTopo, CLHEP::HepRandomEngine *)
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
std::vector< float > detAmpl
SiGaussianTailNoiseAdder * theSiNoiseAdder
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
std::pair< ContainerIterator, ContainerIterator > Range
size_t lastChannelWithSignal
DetId geographicalId() const
The label of this GeomDet.
DigiSimLinkPileUpSignals::HitCounterToDigisMapType HitCounterToDigisMapType
void processHit(const PSimHit *, const StripGeomDetUnit &, GlobalVector, float, std::vector< float > &, size_t &, size_t &, const TrackerTopology *tTopo, CLHEP::HepRandomEngine *)
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
DigiSimLinkAlgorithm(const edm::ParameterSet &conf)
const Plane & surface() const
The nominal surface of the GeomDet.
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
const ParticleData * particle
constexpr uint32_t rawId() const
get the raw id
void suppress(const std::vector< SiStripDigi > &in, std::vector< SiStripDigi > &selectedSignal, uint32_t detId, const SiStripNoises &, const SiStripThreshold &)
const HitToDigisMapType & dumpLink() const
void addPedestals(std::vector< float > &, std::vector< float > &) const override
const Range getRange(const uint32_t detID) const
DigitalVecType const & convert(const std::vector< float > &, const SiStripGain *, unsigned int detid) override
std::pair< ContainerIterator, ContainerIterator > Range
void addCMNoise(std::vector< float > &, float, std::vector< bool > &, CLHEP::HepRandomEngine *) const override
bool APVSaturationFromHIP
DigiSimLinkPileUpSignals::HitToDigisMapType HitToDigisMapType
data decode(const unsigned int &value) const
DigiSimLinkPileUpSignals * theDigiSimLinkPileUpSignals
double theTOFCutForDeconvolution
std::vector< float > locAmpl
std::pair< ContainerIterator, ContainerIterator > Range
void addNoiseVR(std::vector< float > &, std::vector< float > &, CLHEP::HepRandomEngine *) const override
const HitCounterToDigisMapType & dumpCounterLink() const
std::map< int, std::vector< std::pair< const PSimHit *, int > >, std::less< int > > HitCounterToDigisMapType