341 std::map<int, std::bitset<6>> DeadAPVList;
365 uint32_t detID = IDet->first;
373 OneDetectorMap::const_iterator iLocal = LocalMap.begin();
374 for (; iLocal != LocalMap.end(); ++iLocal) {
375 uint16_t currentStrip = iLocal->strip();
376 float signal =
float(iLocal->adc());
377 if (iLocal->adc() == 1022)
379 if (iLocal->adc() == 1023)
384 float ReSignal = signal * signal / 9.0;
386 RawDigi NewRawDigi = std::make_pair(currentStrip, ReSignal);
388 LocalRawMap.push_back(NewRawDigi);
397 int NumberOfBxBetweenHIPandEvent = 1
e3;
402 bool HasAtleastOneAffectedAPV =
false;
403 while (!HasAtleastOneAffectedAPV) {
404 for (
int bx = floor(300.0 / 25.0); bx > 0; bx--) {
405 float temp = CLHEP::RandFlat::shoot(engine) < 0.5 ? 1 : 0;
406 if (temp == 1 && bx < NumberOfBxBetweenHIPandEvent) {
407 NumberOfBxBetweenHIPandEvent = bx;
408 HasAtleastOneAffectedAPV =
true;
413 APVMap::const_iterator iAPVchk;
414 uint32_t formerID = 0;
416 std::bitset<6> NewAPVBits;
419 currentID = iAPV->first;
421 if (currentID == formerID) {
422 for (
int ibit = 0; ibit < 6; ++ibit) {
423 NewAPVBits[ibit] = NewAPVBits[ibit] || (iAPV->second)[ibit];
426 DeadAPVList[currentID] = NewAPVBits;
428 formerID = currentID;
429 NewAPVBits = iAPV->second;
434 DeadAPVList[currentID] = NewAPVBits;
443 std::vector<edm::DetSet<SiStripDigi>> vSiStripDigi;
453 uint32_t detID = IDet->first;
461 int formerStrip = -1;
467 OneDetectorRawMap::const_iterator iLocalchk;
468 OneDetectorRawMap::const_iterator iLocal = LocalMap.begin();
469 for (; iLocal != LocalMap.end(); ++iLocal) {
470 currentStrip = iLocal->first;
472 if (currentStrip == formerStrip) {
474 ADCSum += iLocal->second;
476 if (formerStrip != -1) {
477 Signals.insert(std::make_pair(formerStrip, ADCSum));
480 formerStrip = currentStrip;
481 ADCSum = iLocal->second;
485 if ((++iLocalchk) == LocalMap.end()) {
486 Signals.insert(std::make_pair(formerStrip, ADCSum));
490 signals_.insert(std::make_pair(detID, Signals));
498 if (sgd !=
nullptr) {
509 std::vector<float> detAmpl(numStrips, 0.);
511 for (
const auto& amp : *theSignal) {
512 detAmpl[amp.first] = amp.second;
520 if (badChannels[
strip])
525 std::bitset<6>& bs = DeadAPVList[detID];
531 1 - NumberOfBxBetweenHIPandEvent / floor(300.0 / 25.0);
532 float randomX = CLHEP::RandFlat::shoot(engine);
533 float scalingValue = (randomX - Shift) * 10.0 / 7.0 - 3.0 / 7.0;
536 if (!badChannels[
strip] && bs[
strip / 128] == 1) {
537 detAmpl[
strip] *= scalingValue > 0 ? scalingValue : 0.0;
566 size_t firstChannelWithSignal = 0;
567 size_t lastChannelWithSignal = numStrips;
570 std::vector<float> noiseRMSv;
572 noiseRMSv.insert(noiseRMSv.begin(), numStrips, 0.);
574 if (!badChannels[
strip]) {
575 float gainValue = gainHandle->
getStripGain(strip, detGainRange);
581 int RefStrip =
int(numStrips / 2.);
582 while (RefStrip < numStrips &&
583 badChannels[RefStrip]) {
586 if (RefStrip < numStrips) {
587 float RefgainValue = gainHandle->
getStripGain(RefStrip, detGainRange);
591 detAmpl, firstChannelWithSignal, lastChannelWithSignal, numStrips, RefnoiseRMS, engine);
597 theSiDigitalConverter->convert(detAmpl, gainHandle, detID), digis, detID, noiseHandle, thresholdHandle);
602 vSiStripDigi.push_back(SSD);
609 edm::LogInfo(
"PreMixingSiStripWorker") <<
"total # Merged strips: " << vSiStripDigi.size();
std::map< unsigned int, std::vector< bool > > allBadChannels
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::unique_ptr< SiTrivialDigitalConverter > theSiDigitalConverter
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
edm::ESHandle< TrackerGeometry > pDD
constexpr uint32_t rawId() const
get the raw id
SiGlobalIndex SiHitStorage_
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
static float getNoise(uint16_t strip, const Range &range)
Container::value_type value_type
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
std::vector< SiStripDigi > OneDetectorMap
std::string SiStripDigiCollectionDM_
const SignalMapType * getSignal(uint32_t detID) const
std::unique_ptr< SiGaussianTailNoiseAdder > theSiNoiseAdder
std::pair< ContainerIterator, ContainerIterator > Range
DetId geographicalId() const
The label of this GeomDet.
bool APVSaturationFromHIP_
std::unique_ptr< SiStripFedZeroSuppression > theSiZeroSuppress
SiGlobalRawIndex SiRawDigis_
APVMap theAffectedAPVmap_
std::pair< uint16_t, Amplitude > RawDigi
const Range getRange(const uint32_t detID) const
StreamID streamID() const
std::vector< RawDigi > OneDetectorRawMap
std::pair< ContainerIterator, ContainerIterator > Range
std::map< int, Amplitude > SignalMapType
const SiStripApvGain::Range getRange(uint32_t detID) const
SiDigitalConverter::DigitalVecType DigitalVecType