From 311c7cda2e64bb2d0c75148bdf90b609b5954936 Mon Sep 17 00:00:00 2001 From: Matthew Date: Mon, 1 May 2017 11:44:09 +0200 Subject: [PATCH] Revert "Merge pull request #15458 from mdhildreth/HIPPreMix80X" This reverts commit ff83b4754c878333ca6cdc4f9bd5119ecf12449f, reversing changes made to 0125196b589633a3c00814f3bd4eff1de7279b9e. --- .../src/classes_def_others.xml | 1 - .../src/classes_def_vector.xml | 2 - .../StdDictionaries/src/classes_others.h | 1 - .../StdDictionaries/src/classes_vector.h | 1 - .../WrappedStdDictionaries/src/classes.h | 4 - .../src/classes_def.xml | 1 - .../python/SimGeneral_EventContent_cff.py | 1 - .../plugins/DataMixingSiStripMCDigiWorker.cc | 167 ++---------------- .../plugins/DataMixingSiStripMCDigiWorker.h | 14 -- .../python/mixOne_simraw_on_sim_cfi.py | 9 +- .../MixingModule/plugins/MixingModule.cc | 89 ++++------ .../python/SiStripSimParameters_cfi.py | 5 +- .../plugins/SiStripDigitizer.cc | 37 ++-- .../plugins/SiStripDigitizer.h | 21 +-- .../plugins/SiStripDigitizerAlgorithm.cc | 148 ++++------------ .../plugins/SiStripDigitizerAlgorithm.h | 18 +- 16 files changed, 101 insertions(+), 418 deletions(-) diff --git a/DataFormats/StdDictionaries/src/classes_def_others.xml b/DataFormats/StdDictionaries/src/classes_def_others.xml index 5750c17092c27..3f8cdf20739cc 100644 --- a/DataFormats/StdDictionaries/src/classes_def_others.xml +++ b/DataFormats/StdDictionaries/src/classes_def_others.xml @@ -5,7 +5,6 @@ - diff --git a/DataFormats/StdDictionaries/src/classes_def_vector.xml b/DataFormats/StdDictionaries/src/classes_def_vector.xml index 3a3cdab182c0e..4d94ffd12626d 100644 --- a/DataFormats/StdDictionaries/src/classes_def_vector.xml +++ b/DataFormats/StdDictionaries/src/classes_def_vector.xml @@ -43,6 +43,4 @@ - - diff --git a/DataFormats/StdDictionaries/src/classes_others.h b/DataFormats/StdDictionaries/src/classes_others.h index ac63e138aa1f0..4b491075ec494 100644 --- a/DataFormats/StdDictionaries/src/classes_others.h +++ b/DataFormats/StdDictionaries/src/classes_others.h @@ -15,7 +15,6 @@ namespace DataFormats_StdDictionaries { std::allocator ashort; std::basic_string bschar; std::bidirectional_iterator_tag bidirectiter; - std::bitset<6> dummybitset6; std::bitset<7> dummybitset7; std::bitset<15> dummybitset15; std::deque dummy18; diff --git a/DataFormats/StdDictionaries/src/classes_vector.h b/DataFormats/StdDictionaries/src/classes_vector.h index 507891f8892ca..f498a9f39941b 100644 --- a/DataFormats/StdDictionaries/src/classes_vector.h +++ b/DataFormats/StdDictionaries/src/classes_vector.h @@ -65,6 +65,5 @@ namespace DataFormats_StdDictionaries { std::vector::iterator itus; std::vector::iterator itvp; std::vector dummyVCPtr; - std::vector > > v_p_i_b; }; } diff --git a/DataFormats/WrappedStdDictionaries/src/classes.h b/DataFormats/WrappedStdDictionaries/src/classes.h index 0b1669bbde36a..05a0bfb284016 100644 --- a/DataFormats/WrappedStdDictionaries/src/classes.h +++ b/DataFormats/WrappedStdDictionaries/src/classes.h @@ -6,7 +6,6 @@ #include #include #include -#include namespace DataFormats_WrappedStdDictionaries { struct dictionary { @@ -40,8 +39,6 @@ namespace DataFormats_WrappedStdDictionaries { edm::Wrapper > dummy19; - edm::Wrapper> dummybitset; - edm::Wrapper > dymmywp1; edm::Wrapper > dymmywp2; edm::Wrapper > dymmywp2_1; @@ -89,6 +86,5 @@ namespace DataFormats_WrappedStdDictionaries { edm::Wrapper dummyw13; edm::Wrapper dummyw14; edm::Wrapper dummyw15; - edm::Wrapper > > > v_p_i_b; }; } diff --git a/DataFormats/WrappedStdDictionaries/src/classes_def.xml b/DataFormats/WrappedStdDictionaries/src/classes_def.xml index 26ba03f5cc394..cd554c57aee27 100644 --- a/DataFormats/WrappedStdDictionaries/src/classes_def.xml +++ b/DataFormats/WrappedStdDictionaries/src/classes_def.xml @@ -52,5 +52,4 @@ - diff --git a/SimGeneral/Configuration/python/SimGeneral_EventContent_cff.py b/SimGeneral/Configuration/python/SimGeneral_EventContent_cff.py index b54b4557b21da..14aa2be3b0f01 100644 --- a/SimGeneral/Configuration/python/SimGeneral_EventContent_cff.py +++ b/SimGeneral/Configuration/python/SimGeneral_EventContent_cff.py @@ -11,7 +11,6 @@ SimGeneralRAW = cms.PSet( outputCommands = cms.untracked.vstring('keep CrossingFramePlaybackInfoNew_*_*_*', 'keep PileupSummaryInfos_*_*_*', - 'keep int6stdbitsetstdpairs_*_AffectedAPVList_*', 'keep int_*_bunchSpacing_*') ) #RECO content diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.cc b/SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.cc index 341a3679a1975..fd9ea6621c207 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.cc +++ b/SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.cc @@ -17,7 +17,6 @@ #include "CondFormats/SiStripObjects/interface/SiStripBadStrip.h" #include "CalibTracker/Records/interface/SiStripDependentRecords.h" // -#include "CLHEP/Random/RandFlat.h" // #include "DataMixingSiStripMCDigiWorker.h" @@ -35,11 +34,9 @@ namespace edm edm::ConsumesCollector && iC) : label_(ps.getParameter("Label")), gainLabel(ps.getParameter("Gain")), - SingleStripNoise(ps.getParameter("SingleStripNoise")), peakMode(ps.getParameter("APVpeakmode")), theThreshold(ps.getParameter("NoiseSigmaThreshold")), theElectronPerADC(ps.getParameter( peakMode ? "electronPerAdcPeak" : "electronPerAdcDec" )), - APVSaturationFromHIP_(ps.getParameter("APVSaturationFromHIP")), theFedAlgo(ps.getParameter("FedAlgorithm_PM")), geometryType(ps.getParameter("GeometryType")), theSiZeroSuppress(new SiStripFedZeroSuppression(theFedAlgo)), @@ -56,14 +53,7 @@ namespace edm SiStripPileInputTag_ = ps.getParameter("SiStripPileInputTag"); SiStripDigiCollectionDM_ = ps.getParameter("SiStripDigiCollectionDM"); - SistripAPVListDM_= ps.getParameter("SiStripAPVListDM"); - - if(APVSaturationFromHIP_) { - SistripAPVLabelSig_ = ps.getParameter("SistripAPVLabelSig"); - SiStripAPVPileInputTag_ = ps.getParameter("SistripAPVPileInputTag"); - iC.consumes< std::vector> > >(SistripAPVLabelSig_); - } iC.consumes>(SistripLabelSig_); // clear local storage for this event SiHitStorage_.clear(); @@ -107,6 +97,8 @@ namespace edm DMinitializeDetUnit(stripdet, iSetup); } } + + } @@ -121,12 +113,8 @@ namespace edm SiStripBadStrip::Range detBadStripRange = deadChannelHandle->getRange(detId); //storing the bad strip of the the module. the module is not removed but just signal put to 0 std::vector& badChannels = allBadChannels[detId]; - std::vector& hipChannels = allHIPChannels[detId]; badChannels.clear(); badChannels.insert(badChannels.begin(), numStrips, false); - hipChannels.clear(); - hipChannels.insert(hipChannels.begin(), numStrips, false); - for(SiStripBadStrip::ContainerIterator it = detBadStripRange.first; it != detBadStripRange.second; ++it) { SiStripBadStrip::data fs = deadChannelHandle->decode(*it); for(int strip = fs.firstStrip; strip < fs.firstStrip + fs.range; ++strip) badChannels[strip] = true; @@ -160,20 +148,6 @@ namespace edm } } - - // keep here for future reference. In current implementation, HIP killing is done once in PU file - /* if(APVSaturationFromHIP_) { - Handle> > > APVinput; - - if( e.getByLabel(SistripAPVLabelSig_,APVinput) ) { - - std::vector> >::const_iterator entry = APVinput->begin(); - for( ; entry != APVinput->end(); entry++) { - theAffectedAPVmap_.insert(APVMap::value_type(entry->first, entry->second)); - } - } - } */ - } // end of addSiStripSignals @@ -230,21 +204,6 @@ namespace edm SiHitStorage_.insert( SiGlobalIndex::value_type( DSViter->id, LocalMap ) ); } } - - if(APVSaturationFromHIP_) { - std::shared_ptr> > > const> inputAPVPTR = - getProductByTag< std::vector> > >(*ep, SiStripAPVPileInputTag_, mcc); - - if(inputAPVPTR) { - - const std::vector> > *APVinput = const_cast< std::vector> > * >(inputAPVPTR->product()); - - std::vector> >::const_iterator entry = APVinput->begin(); - for( ; entry != APVinput->end(); entry++) { - theAffectedAPVmap_.insert( APVMap::value_type(entry->first, entry->second )); - } - } - } } } @@ -263,13 +222,6 @@ namespace edm iSetup.get().get(thresholdHandle); iSetup.get().get(pedestalHandle); - edm::Service rng; - CLHEP::HepRandomEngine* engine = &rng->getEngine(e.streamID()); - - std::map< int,std::bitset<6>> DeadAPVList; - DeadAPVList.clear(); - - // First, have to convert all ADC counts to raw pulse heights so that values can be added properly // In PreMixing, pulse heights are saved with ADC = sqrt(9.0*PulseHeight) - have to undo. @@ -323,57 +275,7 @@ namespace edm SiRawDigis_.insert( SiGlobalRawIndex::value_type( detID, LocalRawMap ) ); } - // If we are killing APVs, merge list of dead ones before we digitize - - int NumberOfBxBetweenHIPandEvent=1e3; - - if(APVSaturationFromHIP_) { - - // calculate affected BX parameter - - bool HasAtleastOneAffectedAPV=false; - while(!HasAtleastOneAffectedAPV){ - for(int bx=floor(300.0/25.0);bx>0;bx--){ //Reminder: make these numbers not hard coded!! - float temp=CLHEP::RandFlat::shoot(engine)<0.5?1:0; - if(temp==1 && bx NewAPVBits; - - for(APVMap::const_iterator iAPV = theAffectedAPVmap_.begin(); - iAPV != theAffectedAPVmap_.end(); ++iAPV) { - - currentID = iAPV->first; - - if (currentID == formerID) { // we have to OR these - for( int ibit=0; ibit<6; ++ibit){ - NewAPVBits[ibit] = NewAPVBits[ibit]||(iAPV->second)[ibit]; - } - } - else { - DeadAPVList[currentID]=NewAPVBits; - //save pointers for next iteration - formerID = currentID; - NewAPVBits = iAPV->second; - } - - iAPVchk = iAPV; - if((++iAPVchk) == theAffectedAPVmap_.end()) { //make sure not to lose the last one - DeadAPVList[currentID]=NewAPVBits; - } - } - - } - // - - // Ok, done with merging raw signals and APVs - now add signals on duplicate strips + // Ok, done with merging raw signals - now add signals on duplicate strips // collection of Digis to put in the event std::vector< edm::DetSet > vSiStripDigi; @@ -422,7 +324,8 @@ namespace edm } iLocalchk = iLocal; - if((++iLocalchk) == LocalMap.end()) { //make sure not to lose the last one + if((++iLocalchk) == LocalMap.end()) { //make sure not to lose the last one + Signals.insert( std::make_pair(formerStrip, ADCSum)); } } @@ -457,28 +360,7 @@ namespace edm //removing signal from the dead (and HIP effected) strips std::vector& badChannels = allBadChannels[detID]; - - for(int strip =0; strip < numStrips; ++strip) { - if(badChannels[strip]) detAmpl[strip] = 0.; - } - - if(APVSaturationFromHIP_) { - std::bitset<6> & bs=DeadAPVList[detID]; - - if(bs.any()){ - // Here below is the scaling function which describes the evolution of the baseline (i.e. how the charge is suppressed). - // This must be replaced as soon as we have a proper modeling of the baseline evolution from VR runs - float Shift=1-NumberOfBxBetweenHIPandEvent/floor(300.0/25.0); //Reminder: make these numbers not hardcoded!! - float randomX=CLHEP::RandFlat::shoot(engine); - float scalingValue=(randomX-Shift)*10.0/7.0-3.0/7.0; - - for(int strip =0; strip < numStrips; ++strip) { - if(!badChannels[strip] && bs[strip/128]==1){ - detAmpl[strip] *=scalingValue>0?scalingValue:0.0; - } - } - } - } + for(int strip =0; strip < numStrips; ++strip) if(badChannels[strip]) detAmpl[strip] = 0.; SiStripNoises::Range detNoiseRange = noiseHandle->getRange(detID); SiStripApvGain::Range detGainRange = gainHandle->getRange(detID); @@ -506,32 +388,17 @@ namespace edm size_t firstChannelWithSignal = 0; size_t lastChannelWithSignal = numStrips; - if(SingleStripNoise){ - // std::cout<<"In SSN, detId="< noiseRMSv; - noiseRMSv.clear(); - noiseRMSv.insert(noiseRMSv.begin(),numStrips,0.); - for(int strip=0; strip< numStrips; ++strip){ - if(!badChannels[strip]){ - float gainValue = gainHandle->getStripGain(strip, detGainRange); - noiseRMSv[strip] = (noiseHandle->getNoise(strip,detNoiseRange))* theElectronPerADC/gainValue; - //std::cout<<": gainValue: "<addNoiseVR(detAmpl, noiseRMSv, engine); - } else { - int RefStrip = int(numStrips/2.); - while(RefStripgetStripGain(RefStrip, detGainRange); - float RefnoiseRMS = noiseHandle->getNoise(RefStrip,detNoiseRange) *theElectronPerADC/RefgainValue; - - theSiNoiseAdder->addNoise(detAmpl,firstChannelWithSignal,lastChannelWithSignal,numStrips,RefnoiseRMS, engine); - //std::cout<<": RefgainValue: "<getNoise(RefStrip,detNoiseRange); + float gainValue = gainHandle->getStripGain(RefStrip, detGainRange); + edm::Service rng; + CLHEP::HepRandomEngine* engine = &rng->getEngine(e.streamID()); + theSiNoiseAdder->addNoise(detAmpl,firstChannelWithSignal,lastChannelWithSignal,numStrips,noiseRMS*theElectronPerADC/gainValue,engine); + } DigitalVecType digis; theSiZeroSuppress->suppress(theSiDigitalConverter->convert(detAmpl, gainHandle, detID), digis, detID,noiseHandle,thresholdHandle); diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.h b/SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.h index 0b217e134e6a1..327ec390e5ee1 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.h +++ b/SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.h @@ -78,11 +78,6 @@ namespace edm edm::InputTag SiStripPileInputTag_ ; // InputTag for pileup strips std::string SiStripDigiCollectionDM_ ; // secondary name to be given to new SiStrip digis - edm::InputTag SistripAPVLabelSig_; // where to find vector of dead APVs - edm::InputTag SiStripAPVPileInputTag_; - std::string SistripAPVListDM_; // output tag - - // typedef float Amplitude; @@ -115,21 +110,14 @@ namespace edm signalMaps signals_; - // to keep track of dead APVs from HIP interactions - typedef std::multimap< uint32_t, std::bitset<6> > APVMap; - - APVMap theAffectedAPVmap_; - // for noise adding: std::string label_; std::string gainLabel; - bool SingleStripNoise; bool peakMode; double theThreshold; double theElectronPerADC; - bool APVSaturationFromHIP_; int theFedAlgo; std::string geometryType; @@ -141,8 +129,6 @@ namespace edm // bad channels for each detector ID std::map > allBadChannels; - // channels killed by HIP interactions for each detector ID - std::map > allHIPChannels; // first and last channel wit signal for each detector ID std::map firstChannelsWithSignal; std::map lastChannelsWithSignal; diff --git a/SimGeneral/DataMixingModule/python/mixOne_simraw_on_sim_cfi.py b/SimGeneral/DataMixingModule/python/mixOne_simraw_on_sim_cfi.py index 9f1d7cd791f43..e3a934fcdf422 100644 --- a/SimGeneral/DataMixingModule/python/mixOne_simraw_on_sim_cfi.py +++ b/SimGeneral/DataMixingModule/python/mixOne_simraw_on_sim_cfi.py @@ -175,12 +175,7 @@ CSCStripDigiSimLinkPileInputTag = cms.InputTag("simMuonCSCDigis","MuonCSCStripDigiSimLinks"), CSCWireDigiSimLinkPileInputTag = cms.InputTag("simMuonCSCDigis","MuonCSCWireDigiSimLinks"), - # Dead APV Vector - SistripAPVPileInputTag = cms.InputTag("mix","AffectedAPVList"), - SistripAPVLabelSig = cms.InputTag("mix","AffectedAPVList"), - - # Note: elements with "@MIXING" in the input tag are generated by - # running Raw2Digi in the input step on the Secondary input stream + # EBPileInputTag = cms.InputTag("ecalDigis","ebDigis","@MIXING"), EEPileInputTag = cms.InputTag("ecalDigis","eeDigis","@MIXING"), ESPileInputTag = cms.InputTag("ecalPreshowerDigis","","@MIXING"), @@ -232,7 +227,7 @@ RPCDigiSimLinkDM = cms.string('RPCDigiSimLink'), CSCStripDigiSimLinkDM = cms.string('MuonCSCStripDigiSimLinks'), CSCWireDigiSimLinkDM = cms.string('MuonCSCWireDigiSimLinks'), - SiStripAPVListDM = cms.string('SiStripAPVList'), + # # Calorimeter Digis diff --git a/SimGeneral/MixingModule/plugins/MixingModule.cc b/SimGeneral/MixingModule/plugins/MixingModule.cc index 02f8bafe8caf7..326096f83936b 100644 --- a/SimGeneral/MixingModule/plugins/MixingModule.cc +++ b/SimGeneral/MixingModule/plugins/MixingModule.cc @@ -326,7 +326,6 @@ namespace edm { adjuster->doOffset(bunchSpace_, bunchCrossing, eventPrincipal, &moduleCallingContext, eventId, vertexOffset); } PileUpEventPrincipal pep(eventPrincipal, &moduleCallingContext, bunchCrossing); - accumulateEvent(pep, setup, streamID); for (auto const& worker : workers_) { @@ -379,61 +378,6 @@ namespace edm { } - // pre-populate Pileup information - // necessary for luminosity-dependent effects during hit accumulation - - std::vector numInteractionList; - std::vector bunchCrossingList; - std::vector TrueInteractionList; - std::vector eventInfoList; // will be empty if we pre-populate, but it's not used in digitizers - - if(!playback_) { - - //Makin' a list: Basically, we don't care about the "other" sources at this point. - for (int bunchCrossing=minBunch_;bunchCrossing<=maxBunch_;++bunchCrossing) { - bunchCrossingList.push_back(bunchCrossing); - if(!inputSources_[0] || !inputSources_[0]->doPileUp(0)) { - numInteractionList.push_back(0); - TrueInteractionList.push_back(0); - } - else { - numInteractionList.push_back(PileupList[bunchCrossing-minBunch_]); - TrueInteractionList.push_back((TrueNumInteractions_)[bunchCrossing-minBunch_]); - } - } - } - else{ // have to read PU information from playback info - for (int bunchIdx = minBunch_; bunchIdx <= maxBunch_; ++bunchIdx) { - - for (size_t readSrcIdx=0; readSrcIdx const& playEventID = oldFormatPlaybackInfo_H->getStartEventId(readSrcIdx, bunchIdx); - size_t numberOfEvents = playEventID.size(); - if(readSrcIdx == 0) { - PileupList.push_back(numberOfEvents); - TrueNumInteractions_.push_back(numberOfEvents); - } - } else { - size_t numberOfEvents = playbackInfo_H->getNumberOfEvents(bunchIdx, readSrcIdx); - if(readSrcIdx == 0) { - PileupList.push_back(numberOfEvents); - TrueNumInteractions_.push_back(numberOfEvents); - } - } - } - } - } - - for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) { - (*accItr)->StorePileupInformation( bunchCrossingList, - numInteractionList, - TrueInteractionList, - eventInfoList, - bunchSpace_); - } - - // for (int bunchIdx = minBunch_; bunchIdx <= maxBunch_; ++bunchIdx) { // std::cout << " bunch ID, Pileup, True " << bunchIdx << " " << PileupList[bunchIdx-minBunch_] << " " << TrueNumInteractions_[bunchIdx-minBunch_] << std::endl; //} @@ -508,8 +452,9 @@ namespace edm { (*accItr)->finalizeBunchCrossing(e, setup, bunchIdx); } } - // Save playback information + + std::vector eventInfoList; for (auto const item : recordEventID) { eventInfoList.emplace_back(item.eventID()); } @@ -519,7 +464,33 @@ namespace edm { // Keep track of pileup accounting... - std::unique_ptr PileupMixing_; + std::auto_ptr PileupMixing_; + + std::vector numInteractionList; + std::vector bunchCrossingList; + std::vector TrueInteractionList; + + //Makin' a list: Basically, we don't care about the "other" sources at this point. + for (int bunchCrossing=minBunch_;bunchCrossing<=maxBunch_;++bunchCrossing) { + bunchCrossingList.push_back(bunchCrossing); + if(!inputSources_[0] || !inputSources_[0]->doPileUp(0)) { + numInteractionList.push_back(0); + TrueInteractionList.push_back(0); + } + else { + numInteractionList.push_back(PileupList[bunchCrossing-minBunch_]); + TrueInteractionList.push_back((TrueNumInteractions_)[bunchCrossing-minBunch_]); + } + } + + for(Accumulators::const_iterator accItr = digiAccumulators_.begin(), accEnd = digiAccumulators_.end(); accItr != accEnd; ++accItr) { + (*accItr)->StorePileupInformation( bunchCrossingList, + numInteractionList, + TrueInteractionList, + eventInfoList, + bunchSpace_); + } + PileupMixing_ = std::auto_ptr(new PileupMixingContent(bunchCrossingList, numInteractionList, @@ -527,7 +498,7 @@ namespace edm { eventInfoList, bunchSpace_)); - e.put(std::move(PileupMixing_)); + e.put(PileupMixing_); // we have to do the ToF transformation for PSimHits once all pileup has been added for (unsigned int ii=0;ii >(VRDigi).setBranchAlias(alias + VRDigi); mixMod.produces >(PRDigi).setBranchAlias(alias + PRDigi); mixMod.produces >().setBranchAlias(alias + "siStripDigiSimLink"); - mixMod.produces>>>("AffectedAPVList").setBranchAlias(alias + "AffectedAPV"); for(auto const& trackerContainer : trackerContainers) { edm::InputTag tag(hitsProducer, trackerContainer); iC.consumes >(edm::InputTag(hitsProducer, trackerContainer)); @@ -153,10 +152,6 @@ void SiStripDigitizer::accumulateStripHits(edm::Handle > hS iSetup.get().get(tTopoHand); const TrackerTopology *tTopo=tTopoHand.product(); - //Re-compute luminosity for accumulation for HIP effects - PileupInfo_ = getEventPileupInfo(); - theDigiAlgo->calculateInstlumiScale(PileupInfo_); - // Step A: Get Inputs for(auto const& trackerContainer : trackerContainers) { edm::Handle > simHits; @@ -181,7 +176,7 @@ void SiStripDigitizer::initializeEvent(edm::Event const& iEvent, edm::EventSetup // indices used to create the digi-sim link (if configured to do so) rather than starting // from zero for each crossing. crossingSimHitIndexOffset_.clear(); - theAffectedAPVvector.clear(); + // Step A: Get Inputs if(useConfFromDB){ @@ -225,8 +220,8 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& std::vector > theDigiVector; std::vector > theRawDigiVector; - std::unique_ptr< edm::DetSetVector > pOutputDigiSimLink( new edm::DetSetVector ); - + std::auto_ptr< edm::DetSetVector > pOutputDigiSimLink( new edm::DetSetVector ); + // Step B: LOOP on StripGeomDetUnit theDigiVector.reserve(10000); theDigiVector.clear(); @@ -243,7 +238,7 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& edm::DetSet collectorRaw((*iu)->geographicalId().rawId()); edm::DetSet collectorLink((*iu)->geographicalId().rawId()); theDigiAlgo->digitize(collectorZS,collectorRaw,collectorLink,sgd, - gainHandle,thresholdHandle,noiseHandle,pedestalHandle,theAffectedAPVvector,randomEngine(iEvent.streamID())); + gainHandle,thresholdHandle,noiseHandle,pedestalHandle, randomEngine(iEvent.streamID())); if(zeroSuppression){ if(collectorZS.data.size()>0){ theDigiVector.push_back(collectorZS); @@ -257,21 +252,19 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& } } } + if(zeroSuppression){ // Step C: create output collection - std::unique_ptr > output_virginraw(new edm::DetSetVector()); - std::unique_ptr > output_scopemode(new edm::DetSetVector()); - std::unique_ptr > output_processedraw(new edm::DetSetVector()); - std::unique_ptr > output(new edm::DetSetVector(theDigiVector) ); - std::unique_ptr>> > AffectedAPVList(new std::vector>>(theAffectedAPVvector)); - + std::auto_ptr > output_virginraw(new edm::DetSetVector()); + std::auto_ptr > output_scopemode(new edm::DetSetVector()); + std::auto_ptr > output_processedraw(new edm::DetSetVector()); + std::auto_ptr > output(new edm::DetSetVector(theDigiVector) ); // Step D: write output to file - iEvent.put(std::move(output), ZSDigi); - iEvent.put(std::move(output_scopemode), SCDigi); - iEvent.put(std::move(output_virginraw), VRDigi); - iEvent.put(std::move(output_processedraw), PRDigi); - iEvent.put(std::move(AffectedAPVList),"AffectedAPVList"); - if( makeDigiSimLinks_ ) iEvent.put(std::move(pOutputDigiSimLink)); // The previous EDProducer didn't name this collection so I won't either + iEvent.put(output, ZSDigi); + iEvent.put(output_scopemode, SCDigi); + iEvent.put(output_virginraw, VRDigi); + iEvent.put(output_processedraw, PRDigi); + if( makeDigiSimLinks_ ) iEvent.put( pOutputDigiSimLink ); // The previous EDProducer didn't name this collection so I won't either }else{ // Step C: create output collection std::auto_ptr > output_virginraw(new edm::DetSetVector(theRawDigiVector)); @@ -283,7 +276,7 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& iEvent.put(output_scopemode, SCDigi); iEvent.put(output_virginraw, VRDigi); iEvent.put(output_processedraw, PRDigi); - if( makeDigiSimLinks_ ) iEvent.put( std::move(pOutputDigiSimLink) ); // The previous EDProducer didn't name this collection so I won't either + if( makeDigiSimLinks_ ) iEvent.put( pOutputDigiSimLink ); // The previous EDProducer didn't name this collection so I won't either } } diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h index e3ab0ad5dd44f..999ee8e78cc64 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h @@ -5,9 +5,8 @@ #include #include #include -#include + #include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" -#include "SimDataFormats/PileupSummaryInfo/interface/PileupMixingContent.h" #include "FWCore/Framework/interface/ESHandle.h" class TrackerTopology; @@ -53,16 +52,6 @@ class SiStripDigitizer : public DigiAccumulatorMixMod { virtual void accumulate(edm::Event const& e, edm::EventSetup const& c) override; virtual void accumulate(PileUpEventPrincipal const& e, edm::EventSetup const& c, edm::StreamID const&) override; virtual void finalizeEvent(edm::Event& e, edm::EventSetup const& c) override; - - virtual void StorePileupInformation( std::vector &numInteractionList, - std::vector &bunchCrossingList, - std::vector &TrueInteractionList, - std::vector &eventInfoList, int bunchSpacing){ - PileupInfo_ = new PileupMixingContent(numInteractionList, bunchCrossingList, TrueInteractionList, eventInfoList, bunchSpacing); - } - - virtual PileupMixingContent* getEventPileupInfo() { return PileupInfo_; } - private: void accumulateStripHits(edm::Handle >, const TrackerTopology *tTopo, size_t globalSimHitIndex, const unsigned int tofBin, CLHEP::HepRandomEngine*); @@ -82,9 +71,7 @@ class SiStripDigitizer : public DigiAccumulatorMixMod { const std::string geometryType; const bool useConfFromDB; const bool zeroSuppression; - const bool makeDigiSimLinks_; - - ///< Whether or not to create the association to sim truth collection. Set in configuration. + const bool makeDigiSimLinks_; ///< Whether or not to create the association to sim truth collection. Set in configuration. /** @brief Offset to add to the index of each sim hit to account for which crossing it's in. * * I need to know what each sim hit index will be when the hits from all crossing frames are merged into @@ -101,10 +88,6 @@ class SiStripDigitizer : public DigiAccumulatorMixMod { edm::ESHandle pSetup; std::map detectorUnits; std::vector randomEngines_; - std::vector>> theAffectedAPVvector; - - PileupMixingContent* PileupInfo_; - }; #endif diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc index c2a1163674c2e..70658118db03c 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc @@ -37,7 +37,7 @@ SiStripDigitizerAlgorithm::SiStripDigitizerAlgorithm(const edm::ParameterSet& co cmnRMStob(conf.getParameter("cmnRMStob")), cmnRMStid(conf.getParameter("cmnRMStid")), cmnRMStec(conf.getParameter("cmnRMStec")), - APVSaturationProbScaling_(conf.getParameter("APVSaturationProbScaling")), + APVSaturationProb(conf.getParameter("APVSaturationProb")), makeDigiSimLinks_(conf.getUntrackedParameter("makeDigiSimLinks", false)), peakMode(conf.getParameter("APVpeakmode")), noise(conf.getParameter("Noise")), @@ -71,14 +71,13 @@ SiStripDigitizerAlgorithm::SiStripDigitizerAlgorithm(const edm::ParameterSet& co else LogDebug("SiStripDigitizerAlgorithm")<<" SingleStripNoise: OFF"; if(CommonModeNoise) LogDebug("SiStripDigitizerAlgorithm")<<" CommonModeNoise: ON"; else LogDebug("SiStripDigitizerAlgorithm")<<" CommonModeNoise: OFF"; - if(PreMixing_ && APVSaturationFromHIP) throw cms::Exception("PreMixing does not work with HIP loss simulation yet"); } SiStripDigitizerAlgorithm::~SiStripDigitizerAlgorithm(){ } void -SiStripDigitizerAlgorithm::initializeDetUnit(StripGeomDetUnit const * det, const edm::EventSetup& iSetup){ +SiStripDigitizerAlgorithm::initializeDetUnit(StripGeomDetUnit const * det, const edm::EventSetup& iSetup) { edm::ESHandle deadChannelHandle; iSetup.get().get(deadChannelHandle); @@ -96,11 +95,6 @@ SiStripDigitizerAlgorithm::initializeDetUnit(StripGeomDetUnit const * det, const } firstChannelsWithSignal[detId] = numStrips; lastChannelsWithSignal[detId]= 0; - - // if(APVSaturationFromHIP){ - // std::bitset<6> &bs=SiStripTrackerAffectedAPVMap[detId]; - // if(bs.any())theAffectedAPVvector.push_back(std::make_pair(detId,bs)); - //} } void @@ -109,11 +103,6 @@ SiStripDigitizerAlgorithm::initializeEvent(const edm::EventSetup& iSetup) { // This should be clear by after all calls to digitize(), but I might as well make sure associationInfoForDetId_.clear(); - APVSaturationProb_ = APVSaturationProbScaling_; // reset probability - SiStripTrackerAffectedAPVMap.clear(); - FirstLumiCalc_ = true; - FirstDigitize_ = true; - //get gain noise pedestal lorentzAngle from ES handle edm::ESHandle pdt; iSetup.getData(pdt); @@ -137,6 +126,7 @@ SiStripDigitizerAlgorithm::accumulateSimHits(std::vector::const_iterato unsigned int detID = det->geographicalId().rawId(); int numStrips = (det->specificTopology()).nstrips(); + std::vector& badChannels = allBadChannels[detID]; size_t thisFirstChannelWithSignal = numStrips; size_t thisLastChannelWithSignal = 0; @@ -166,7 +156,34 @@ SiStripDigitizerAlgorithm::accumulateSimHits(std::vector::const_iterato size_t localLastChannel = 0; // process the hit theSiHitDigitizer->processHit(&*simHitIter, *det, bfield, langle, locAmpl, localFirstChannel, localLastChannel, tTopo, engine); - + + //APV Killer to simulate HIP effect + //------------------------------------------------------ + + if(APVSaturationFromHIP&&!zeroSuppression){ + int pdg_id = simHitIter->particleType(); + particle = pdt->particle(pdg_id); + if(particle != NULL){ + float charge = particle->charge(); + bool isHadron = particle->isHadron(); + if(charge!=0 && isHadron){ + if(CLHEP::RandFlat::shoot(engine) < APVSaturationProb){ + int FirstAPV = localFirstChannel/128; + int LastAPV = localLastChannel/128; + //std::cout << "-------------------HIP--------------" << std::endl; + //std::cout << "Killing APVs " << FirstAPV << " - " < localFirstChannel) thisFirstChannelWithSignal = localFirstChannel; if(thisLastChannelWithSignal < localLastChannel) thisLastChannelWithSignal = localLastChannel; @@ -201,44 +218,6 @@ SiStripDigitizerAlgorithm::accumulateSimHits(std::vector::const_iterato if(lastChannelsWithSignal[detID] < thisLastChannelWithSignal) lastChannelsWithSignal[detID] = thisLastChannelWithSignal; } -//============================================================================ -void SiStripDigitizerAlgorithm::calculateInstlumiScale(PileupMixingContent* puInfo){ - //Instlumi scalefactor calculating for dynamic inefficiency - - if (puInfo && FirstLumiCalc_) { - - const std::vector bunchCrossing = puInfo->getMix_bunchCrossing(); - const std::vector TrueInteractionList = puInfo->getMix_TrueInteractions(); - const int bunchSpacing = puInfo->getMix_bunchSpacing(); - - double RevFreq = 11245.; - double minBXsec = 70.0E-27; // use 70mb as an approximation - double Bunch = 2100.; // 2016 value - if (bunchSpacing == 50) Bunch = Bunch/2.; - - int pui = 0, p = 0; - std::vector::const_iterator pu; - std::vector::const_iterator pu0 = bunchCrossing.end(); - - for (pu=bunchCrossing.begin(); pu!=bunchCrossing.end(); ++pu) { - if (*pu==0) { - pu0 = pu; - p = pui; - } - pui++; - } - if (pu0!=bunchCrossing.end()) { // found the in-time interaction - double Tintr = TrueInteractionList.at(p); - double instLumi = Bunch*Tintr*RevFreq/minBXsec; - APVSaturationProb_ = instLumi/6.0E33; - } - FirstLumiCalc_ = false; - } -} - -//============================================================================ - - void SiStripDigitizerAlgorithm::digitize( edm::DetSet& outdigi, @@ -249,7 +228,6 @@ SiStripDigitizerAlgorithm::digitize( edm::ESHandle & thresholdHandle, edm::ESHandle & noiseHandle, edm::ESHandle & pedestalHandle, - std::vector>> & theAffectedAPVvector, CLHEP::HepRandomEngine* engine) { unsigned int detID = det->geographicalId().rawId(); int numStrips = (det->specificTopology()).nstrips(); @@ -265,69 +243,7 @@ SiStripDigitizerAlgorithm::digitize( //removing signal from the dead (and HIP effected) strips std::vector& badChannels = allBadChannels[detID]; - - for(int strip =0; strip < numStrips; ++strip) { - if(badChannels[strip]) {detAmpl[strip] = 0.;} - } - - if(APVSaturationFromHIP){ - - //Implementation of the proper charge scaling function. Need consider resaturation effect: - //The probability map gives the probability that at least one HIP happened during the last N bunch crossings (cfr APV recovery time). - //The impact on the charge depends on the clostest HIP occurance (in terms of bunch crossing). - //The function discribing the APV recovery is therefore the weighted average function which takes into account all possibilities of HIP occurances across the last bx's. - - // do this step here because we now have access to luminosity information - if(FirstDigitize_) { - - for(std::map::iterator iter = mapOfAPVprobabilities.begin(); iter != mapOfAPVprobabilities.end(); ++iter){ - std::bitset<6> bs; - for(int Napv=0;Napv<6;Napv++){ - float cursor=CLHEP::RandFlat::shoot(engine); - bs[Napv]=cursor < iter->second*APVSaturationProb_ ? 1:0; //APVSaturationProb has been scaled by PU luminosity - } - SiStripTrackerAffectedAPVMap[iter->first]=bs; - } - - NumberOfBxBetweenHIPandEvent=1e3; - bool HasAtleastOneAffectedAPV=false; - while(!HasAtleastOneAffectedAPV){ - for(int bx=floor(300.0/25.0);bx>0;bx--){ //Reminder: make these numbers not hard coded!! - float temp=CLHEP::RandFlat::shoot(engine)<0.5?1:0; - if(temp==1 && bx & bs=SiStripTrackerAffectedAPVMap[detID]; - - if(bs.any()){ - // store this information so it can be saved to the event later - theAffectedAPVvector.push_back(std::make_pair(detID,bs)); - - if(!PreMixing_) { - - // Here below is the scaling function which describes the evolution of the baseline (i.e. how the charge is suppressed). - // This must be replaced as soon as we have a proper modeling of the baseline evolution from VR runs - float Shift=1-NumberOfBxBetweenHIPandEvent/floor(300.0/25.0); //Reminder: make these numbers not hardcoded!! - float randomX=CLHEP::RandFlat::shoot(engine); - float scalingValue=(randomX-Shift)*10.0/7.0-3.0/7.0; - - for(int strip =0; strip < numStrips; ++strip) { - if(!badChannels[strip] && bs[strip/128]==1){ - detAmpl[strip] *=scalingValue>0?scalingValue:0.0; - } - } - } - } - } - - + for(int strip =0; strip < numStrips; ++strip) if(badChannels[strip]) detAmpl[strip] = 0.; SiStripNoises::Range detNoiseRange = noiseHandle->getRange(detID); SiStripApvGain::Range detGainRange = gainHandle->getRange(detID); diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.h b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.h index 06018abf6251e..6a955ed12d032 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.h +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.h @@ -13,7 +13,6 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "SimDataFormats/TrackingHit/interface/PSimHit.h" -#include "SimDataFormats/PileupSummaryInfo/interface/PileupMixingContent.h" #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/Common/interface/DetSet.h" #include "DataFormats/SiStripDigi/interface/SiStripDigi.h" @@ -34,9 +33,6 @@ #include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h" #include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h" -#include -#include - class TrackerTopology; namespace edm { @@ -87,11 +83,8 @@ class SiStripDigitizerAlgorithm { edm::ESHandle&, edm::ESHandle&, edm::ESHandle&, - std::vector>> & theAffectedAPVvector, CLHEP::HepRandomEngine*); - void calculateInstlumiScale(PileupMixingContent* puInfo); - // ParticleDataTable void setParticleDataTable(const ParticleDataTable * pardt) { theSiHitDigitizer->setParticleDataTable(pardt); @@ -105,7 +98,7 @@ class SiStripDigitizerAlgorithm { const double cmnRMStob; const double cmnRMStid; const double cmnRMStec; - const double APVSaturationProbScaling_; + const double APVSaturationProb; const bool makeDigiSimLinks_; //< Whether or not to create the association to sim truth collection. Set in configuration. const bool peakMode; const bool noise; @@ -128,10 +121,6 @@ class SiStripDigitizerAlgorithm { const ParticleDataTable * pdt; const ParticleData * particle; - - double APVSaturationProb_; - bool FirstLumiCalc_; - bool FirstDigitize_; const std::unique_ptr theSiHitDigitizer; const std::unique_ptr theSiPileUpSignals; @@ -164,11 +153,6 @@ class SiStripDigitizerAlgorithm { /// Structure that holds the information on the SimTrack contributions. Only filled if makeDigiSimLinks_ is true. AssociationInfoForDetId associationInfoForDetId_; - std::ifstream APVProbaFile; - std::map < int , float> mapOfAPVprobabilities; - std::map < int , std::bitset<6> > SiStripTrackerAffectedAPVMap; - int NumberOfBxBetweenHIPandEvent; - }; #endif