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);
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 -
123 ((*simHitIter).first)->energyLoss() > 0) {
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])
184 int RefStrip = int(numStrips / 2.);
185 while (RefStrip < numStrips &&
186 badChannels[RefStrip]) {
189 if (RefStrip < numStrips) {
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])
247 while (RefStrip < numStrips &&
248 badChannels[RefStrip]) {
251 if (RefStrip < numStrips) {
252 float noiseRMS = noiseHandle->getNoise(RefStrip, detNoiseRange) *
theElectronPerADC;
254 if (!badChannels[strip])
255 noiseRMSv[
strip] = noiseRMS;
271 }
else if (SubDet == 4) {
273 }
else if (SubDet == 5) {
275 }
else if (SubDet == 6) {
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;
346 if (fraction >= threshold) {
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;
398 if (fraction >= threshold) {
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)
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
T getUntrackedParameter(std::string const &, T const &) const
SiHitDigitizer * theSiHitDigitizer
DigitalRawVecType rawdigis
SiStripFedZeroSuppression * theSiZeroSuppress
size_t firstChannelWithSignal
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
std::vector< unsigned int >::const_iterator ContainerIterator
void addBaselineShift(std::vector< float > &, std::vector< bool > &) const override
constexpr uint32_t rawId() const
get the raw id
std::pair< ContainerIterator, ContainerIterator > Range
const ParticleDataTable * pdt
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
void addNoise(std::vector< float > &, size_t &, size_t &, int, float, CLHEP::HepRandomEngine *) const override
const Plane & surface() const
The nominal surface of the GeomDet.
void push_link_raw(const DigitalRawVecType &, const HitToDigisMapType &, const HitCounterToDigisMapType &, const std::vector< float > &, unsigned int)
SiDigitalConverter::DigitalRawVecType DigitalRawVecType
SiDigitalConverter::DigitalVecType DigitalVecType
static std::string const input
std::vector< StripDigiSimLink > link_coll
DigitalVecType convert(const std::vector< float > &, const SiStripGain *, unsigned int detid) override
DigitalRawVecType convertRaw(const std::vector< float > &, const SiStripGain *, unsigned int detid) override
SiTrivialDigitalConverter * theSiDigitalConverter
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 *)
std::vector< float > detAmpl
SiGaussianTailNoiseAdder * theSiNoiseAdder
const HitToDigisMapType & dumpLink() const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::pair< ContainerIterator, ContainerIterator > Range
DetId geographicalId() const
The label of this GeomDet.
size_t lastChannelWithSignal
const HitCounterToDigisMapType & dumpCounterLink() const
DigiSimLinkPileUpSignals::HitCounterToDigisMapType HitCounterToDigisMapType
void processHit(const PSimHit *, const StripGeomDetUnit &, GlobalVector, float, std::vector< float > &, size_t &, size_t &, const TrackerTopology *tTopo, CLHEP::HepRandomEngine *)
DigiSimLinkAlgorithm(const edm::ParameterSet &conf)
const ParticleData * particle
unsigned short firstStrip
void suppress(const std::vector< SiStripDigi > &in, std::vector< SiStripDigi > &selectedSignal, uint32_t detId, const SiStripNoises &, const SiStripThreshold &)
T const * product() const
T getParameter(std::string const &) const
void addPedestals(std::vector< float > &, std::vector< float > &) const override
std::pair< ContainerIterator, ContainerIterator > Range
void addCMNoise(std::vector< float > &, float, std::vector< bool > &, CLHEP::HepRandomEngine *) const override
bool APVSaturationFromHIP
DigiSimLinkPileUpSignals::HitToDigisMapType HitToDigisMapType
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
std::map< int, std::vector< std::pair< const PSimHit *, int > >, std::less< int > > HitCounterToDigisMapType