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 -
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);
232 std::vector<float> noiseRMSv;
234 noiseRMSv.insert(noiseRMSv.begin(),
numStrips, 0.);
238 if (!badChannels[strip])
244 while (RefStrip < numStrips &&
245 badChannels[RefStrip]) {
248 if (RefStrip < numStrips) {
251 if (!badChannels[strip])
252 noiseRMSv[
strip] = noiseRMS;
268 }
else if (SubDet == 4) {
270 }
else if (SubDet == 5) {
272 }
else if (SubDet == 6) {
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;
343 if (fraction >= threshold) {
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;
395 if (fraction >= threshold) {
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(),
void push_link(const DigitalVecType &, const HitToDigisMapType &, const HitCounterToDigisMapType &, const std::vector< float > &, unsigned int)
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void addNoise(std::vector< float > &, size_t &, size_t &, int, float, CLHEP::HepRandomEngine *) const override
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
constexpr uint32_t rawId() const
get the raw id
std::pair< ContainerIterator, ContainerIterator > Range
void suppress(const std::vector< SiStripDigi > &in, std::vector< SiStripDigi > &selectedSignal, uint32_t detId, edm::ESHandle< SiStripNoises > &, edm::ESHandle< SiStripThreshold > &)
const ParticleDataTable * pdt
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
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
float getPed(const uint16_t &strip, const Range &range) const
void addNoiseVR(std::vector< float > &, std::vector< float > &, CLHEP::HepRandomEngine *) const override
SiTrivialDigitalConverter * theSiDigitalConverter
static float getNoise(uint16_t strip, const Range &range)
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
void addCMNoise(std::vector< float > &, float, std::vector< bool > &, CLHEP::HepRandomEngine *) const override
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
void addPedestals(std::vector< float > &, std::vector< float > &) const override
DigitalVecType convert(const std::vector< float > &, edm::ESHandle< SiStripGain > &, unsigned int detid) override
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
const Range getRange(const uint32_t detID) const
DigitalRawVecType convertRaw(const std::vector< float > &, edm::ESHandle< SiStripGain > &, unsigned int detid) override
const Range getRange(const uint32_t detID) const
std::pair< ContainerIterator, ContainerIterator > Range
bool APVSaturationFromHIP
DigiSimLinkPileUpSignals::HitToDigisMapType HitToDigisMapType
DigiSimLinkPileUpSignals * theDigiSimLinkPileUpSignals
double theTOFCutForDeconvolution
const Range getRange(const uint32_t &detID) const
std::vector< float > locAmpl
std::pair< ContainerIterator, ContainerIterator > Range
void addBaselineShift(std::vector< float > &, std::vector< bool > &) const override
data decode(const unsigned int &value) const
std::map< int, std::vector< std::pair< const PSimHit *, int > >, std::less< int > > HitCounterToDigisMapType
const SiStripApvGain::Range getRange(uint32_t detID) const