30 DataMixingSiStripMCDigiWorker::DataMixingSiStripMCDigiWorker() { }
35 label_(ps.getParameter<std::
string>(
"Label")),
36 gainLabel(ps.getParameter<std::
string>(
"Gain")),
37 peakMode(ps.getParameter<bool>(
"APVpeakmode")),
38 theThreshold(ps.getParameter<double>(
"NoiseSigmaThreshold")),
39 theElectronPerADC(ps.getParameter<double>( peakMode ?
"electronPerAdcPeak" :
"electronPerAdcDec" )),
40 theFedAlgo(ps.getParameter<int>(
"FedAlgorithm_PM")),
41 geometryType(ps.getParameter<std::
string>(
"GeometryType")),
64 <<
"SiStripDigitizer requires the RandomNumberGeneratorService\n"
65 "which is not present in the psiguration file. You must add the service\n"
66 "in the configuration file or remove the modules that require it.";
86 for(
auto iu =
pDD->detUnits().begin(); iu !=
pDD->detUnits().end(); ++iu) {
87 unsigned int detId = (*iu)->geographicalId().rawId();
117 badChannels.insert(badChannels.begin(), numStrips,
false);
137 for (; DSViter!=input->end();DSViter++){
140 LogDebug(
"DataMixingSiStripMCDigiWorker") <<
"Processing DetID " << DSViter->id;
144 LocalMap.
reserve((DSViter->data).size());
145 LocalMap.insert(LocalMap.end(),(DSViter->data).
begin(),(DSViter->data).
end());
157 LogDebug(
"DataMixingSiStripMCDigiWorker") <<
"\n===============> adding pileups from event "<<ep->
id()<<
" for bunchcrossing "<<bcr;
161 std::shared_ptr<Wrapper<edm::DetSetVector<SiStripDigi> >
const> inputPTR =
176 for (; DSViter!=input->
end();DSViter++){
179 LogDebug(
"DataMixingSiStripMCDigiWorker") <<
"Pileups: Processing DetID " << DSViter->id;
184 SiGlobalIndex::const_iterator itest;
190 LocalMap = itest->second;
201 LocalMap.
reserve((DSViter->data).size());
245 for(SiGlobalIndex::const_iterator IDet =
SiHitStorage_.begin();
248 uint32_t detID = IDet->first;
256 OneDetectorMap::const_iterator iLocal = LocalMap.begin();
257 for(;iLocal != LocalMap.end(); ++iLocal) {
259 uint16_t currentStrip = iLocal->strip();
260 float signal = float(iLocal->adc());
261 if(iLocal->adc() == 1022) signal = 1500.;
262 if(iLocal->adc() == 1023) signal = 3000.;
266 float ReSignal = signal*signal/9.0;
268 RawDigi NewRawDigi = std::make_pair(currentStrip,ReSignal);
270 LocalRawMap.push_back(NewRawDigi);
281 std::vector< edm::DetSet<SiStripDigi> > vSiStripDigi;
290 for(SiGlobalRawIndex::const_iterator IDet =
SiRawDigis_.begin();
293 uint32_t detID = IDet->first;
301 int formerStrip = -1;
307 OneDetectorRawMap::const_iterator iLocalchk;
308 OneDetectorRawMap::const_iterator iLocal = LocalMap.begin();
309 for(;iLocal != LocalMap.end(); ++iLocal) {
311 currentStrip = iLocal->first;
313 if (currentStrip == formerStrip) {
315 ADCSum+=iLocal->second ;
319 Signals.insert( std::make_pair(formerStrip, ADCSum));
322 formerStrip = currentStrip;
323 ADCSum = iLocal->second;
327 if((++iLocalchk) == LocalMap.end()) {
329 Signals.insert( std::make_pair(formerStrip, ADCSum));
333 signals_.insert( std::make_pair( detID, Signals));
339 for(TrackingGeometry::DetUnitContainer::const_iterator iu =
pDD->detUnits().begin(); iu !=
pDD->detUnits().end(); iu ++){
354 std::vector<float> detAmpl(numStrips, 0.);
356 for(
const auto& amp : *theSignal) {
357 detAmpl[amp.first] = amp.second;
363 for(
int strip =0; strip < numStrips; ++strip)
if(badChannels[strip]) detAmpl[strip] = 0.;
388 size_t firstChannelWithSignal = 0;
389 size_t lastChannelWithSignal = numStrips;
391 int RefStrip = int(numStrips/2.);
392 while(RefStrip<numStrips&&badChannels[RefStrip]){
395 if(RefStrip<numStrips){
396 float noiseRMS = noiseHandle->getNoise(RefStrip,detNoiseRange);
397 float gainValue = gainHandle->getStripGain(RefStrip, detGainRange);
415 vSiStripDigi.push_back(SSD);
422 LogInfo(
"DataMixingSiStripMCDigiWorker") <<
"total # Merged strips: " << vSiStripDigi.size() ;
T getParameter(std::string const &) const
void addSiStripSignals(const edm::Event &e)
std::map< unsigned int, size_t > firstChannelsWithSignal
edm::InputTag SiStripPileInputTag_
std::map< int, Amplitude > SignalMapType
std::vector< RawDigi > OneDetectorRawMap
std::vector< unsigned int >::const_iterator ContainerIterator
edm::ESHandle< TrackerGeometry > pDD
SiGlobalIndex SiHitStorage_
std::pair< uint16_t, Amplitude > RawDigi
EventID const & id() const
virtual void initializeEvent(const edm::Event &e, edm::EventSetup const &iSetup)
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
edm::InputTag SistripLabelSig_
virtual ~DataMixingSiStripMCDigiWorker()
static std::string const input
SiDigitalConverter::DigitalVecType DigitalVecType
uint32_t rawId() const
get the raw id
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
void addSiStripPileups(const int bcr, const edm::EventPrincipal *, unsigned int EventId, ModuleCallingContext const *)
std::pair< ContainerIterator, ContainerIterator > Range
void DMinitializeDetUnit(StripGeomDetUnit const *det, const edm::EventSetup &iSetup)
DetId geographicalId() const
The label of this GeomDet.
Container::value_type value_type
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::unique_ptr< SiGaussianTailNoiseAdder > theSiNoiseAdder
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
iterator end()
Return the off-the-end iterator.
unsigned short firstStrip
const SignalMapType * getSignal(uint32_t detID) const
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &) const =0
Use this engine in event methods.
void insert(detset const &s)
Insert the given DetSet.
std::map< unsigned int, std::vector< bool > > allBadChannels
std::pair< ContainerIterator, ContainerIterator > Range
std::unique_ptr< SiTrivialDigitalConverter > theSiDigitalConverter
StreamID streamID() const
std::unique_ptr< SiStripFedZeroSuppression > theSiZeroSuppress
iterator begin()
Return an iterator to the first DetSet.
volatile std::atomic< bool > shutdown_flag false
std::map< unsigned int, size_t > lastChannelsWithSignal
std::pair< ContainerIterator, ContainerIterator > Range
void putSiStrip(edm::Event &e, edm::EventSetup const &iSetup)
collection_type::const_iterator const_iterator
SiGlobalRawIndex SiRawDigis_
std::string SiStripDigiCollectionDM_
std::vector< SiStripDigi > OneDetectorMap