28 DataMixingSiStripMCDigiWorker::DataMixingSiStripMCDigiWorker() { }
32 label_(ps.getParameter<std::
string>(
"Label")),
33 gainLabel(ps.getParameter<std::
string>(
"Gain")),
34 peakMode(ps.getParameter<bool>(
"APVpeakmode")),
35 theThreshold(ps.getParameter<double>(
"NoiseSigmaThreshold")),
36 theElectronPerADC(ps.getParameter<double>( peakMode ?
"electronPerAdcPeak" :
"electronPerAdcDec" )),
37 theFedAlgo(ps.getParameter<int>(
"FedAlgorithm")),
38 geometryType(ps.getParameter<std::
string>(
"GeometryType")),
60 <<
"SiStripDigitizer requires the RandomNumberGeneratorService\n"
61 "which is not present in the psiguration file. You must add the service\n"
62 "in the configuration file or remove the modules that require it.";
83 for(TrackingGeometry::DetUnitContainer::const_iterator iu =
pDD->detUnits().begin(); iu !=
pDD->detUnits().end(); ++iu) {
84 unsigned int detId = (*iu)->geographicalId().rawId();
92 assert(stripdet != 0);
113 badChannels.insert(badChannels.begin(), numStrips,
false);
133 for (; DSViter!=input->end();DSViter++){
136 LogDebug(
"DataMixingSiStripMCDigiWorker") <<
"Processing DetID " << DSViter->id;
140 LocalMap.reserve((DSViter->data).size());
141 LocalMap.
insert(LocalMap.end(),(DSViter->data).
begin(),(DSViter->data).
end());
153 LogDebug(
"DataMixingSiStripMCDigiWorker") <<
"\n===============> adding pileups from event "<<ep->
id()<<
" for bunchcrossing "<<bcr;
157 boost::shared_ptr<Wrapper<edm::DetSetVector<SiStripDigi> >
const> inputPTR =
172 for (; DSViter!=input->
end();DSViter++){
175 LogDebug(
"DataMixingSiStripMCDigiWorker") <<
"Pileups: Processing DetID " << DSViter->id;
180 SiGlobalIndex::const_iterator itest;
186 LocalMap = itest->second;
197 LocalMap.reserve((DSViter->data).size());
223 std::vector< edm::DetSet<SiStripDigi> > vSiStripDigi;
233 for(SiGlobalIndex::const_iterator IDet =
SiHitStorage_.begin();
236 uint32_t detID = IDet->first;
244 int formerStrip = -1;
250 OneDetectorMap::const_iterator iLocalchk;
251 OneDetectorMap::const_iterator iLocal = LocalMap.begin();
252 for(;iLocal != LocalMap.end(); ++iLocal) {
254 currentStrip = iLocal->strip();
256 if (currentStrip == formerStrip) {
257 ADCSum+=iLocal->adc();
261 Signals.insert( std::make_pair(formerStrip, ADCSum));
271 formerStrip = currentStrip;
272 ADCSum = iLocal->adc();
276 if((++iLocalchk) == LocalMap.end()) {
278 Signals.insert( std::make_pair(formerStrip, ADCSum));
288 signals_.insert( std::make_pair( detID, Signals));
294 for(TrackingGeometry::DetUnitContainer::const_iterator iu =
pDD->detUnits().begin(); iu !=
pDD->detUnits().end(); iu ++){
308 std::vector<float> detAmpl(numStrips, 0.);
310 for(
const auto& amp : *theSignal) {
311 detAmpl[amp.first] = amp.second;
317 for(
int strip =0; strip < numStrips; ++strip)
if(badChannels[strip]) detAmpl[strip] = 0.;
325 for(
unsigned int iv = 0; iv!=detAmpl.size(); iv++) {
326 float signal = detAmpl[iv];
328 float gainValue = gainHandle->getStripGain(iv, detGainRange);
330 detAmpl[iv] = signal;
343 int RefStrip = int(numStrips/2.);
344 while(RefStrip<numStrips&&badChannels[RefStrip]){
347 if(RefStrip<numStrips){
348 float noiseRMS = noiseHandle->getNoise(RefStrip,detNoiseRange);
349 float gainValue = gainHandle->getStripGain(RefStrip, detGainRange);
365 vSiStripDigi.push_back(SSD);
372 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
void DMinitializeDetUnit(StripGeomDetUnit *det, const edm::EventSetup &iSetup)
std::vector< unsigned int >::const_iterator ContainerIterator
edm::ESHandle< TrackerGeometry > pDD
SiGlobalIndex SiHitStorage_
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
DetId geographicalId() const
The label of this GeomDet.
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...
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.
CLHEP::HepRandomEngine * rndEngine
unsigned short firstStrip
const SignalMapType * getSignal(uint32_t detID) const
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
std::unique_ptr< SiStripFedZeroSuppression > theSiZeroSuppress
iterator begin()
Return an iterator to the first DetSet.
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
std::string SiStripDigiCollectionDM_
std::vector< SiStripDigi > OneDetectorMap