29 DataMixingSiStripMCDigiWorker::DataMixingSiStripMCDigiWorker() { }
34 label_(ps.getParameter<std::
string>(
"Label")),
35 gainLabel(ps.getParameter<std::
string>(
"Gain")),
36 peakMode(ps.getParameter<bool>(
"APVpeakmode")),
37 theThreshold(ps.getParameter<double>(
"NoiseSigmaThreshold")),
38 theElectronPerADC(ps.getParameter<double>( peakMode ?
"electronPerAdcPeak" :
"electronPerAdcDec" )),
39 theFedAlgo(ps.getParameter<int>(
"FedAlgorithm")),
40 geometryType(ps.getParameter<std::
string>(
"GeometryType")),
63 <<
"SiStripDigitizer requires the RandomNumberGeneratorService\n"
64 "which is not present in the psiguration file. You must add the service\n"
65 "in the configuration file or remove the modules that require it.";
84 for(
auto iu =
pDD->detUnits().begin(); iu !=
pDD->detUnits().end(); ++iu) {
85 unsigned int detId = (*iu)->geographicalId().rawId();
93 assert(stripdet != 0);
114 badChannels.insert(badChannels.begin(), numStrips,
false);
134 for (; DSViter!=input->end();DSViter++){
137 LogDebug(
"DataMixingSiStripMCDigiWorker") <<
"Processing DetID " << DSViter->id;
141 LocalMap.
reserve((DSViter->data).size());
142 LocalMap.insert(LocalMap.end(),(DSViter->data).
begin(),(DSViter->data).
end());
154 LogDebug(
"DataMixingSiStripMCDigiWorker") <<
"\n===============> adding pileups from event "<<ep->
id()<<
" for bunchcrossing "<<bcr;
158 boost::shared_ptr<Wrapper<edm::DetSetVector<SiStripDigi> >
const> inputPTR =
173 for (; DSViter!=input->
end();DSViter++){
176 LogDebug(
"DataMixingSiStripMCDigiWorker") <<
"Pileups: Processing DetID " << DSViter->id;
181 SiGlobalIndex::const_iterator itest;
187 LocalMap = itest->second;
198 LocalMap.
reserve((DSViter->data).size());
224 std::vector< edm::DetSet<SiStripDigi> > vSiStripDigi;
234 for(SiGlobalIndex::const_iterator IDet =
SiHitStorage_.begin();
237 uint32_t detID = IDet->first;
245 int formerStrip = -1;
251 OneDetectorMap::const_iterator iLocalchk;
252 OneDetectorMap::const_iterator iLocal = LocalMap.begin();
253 for(;iLocal != LocalMap.end(); ++iLocal) {
255 currentStrip = iLocal->strip();
257 if (currentStrip == formerStrip) {
258 ADCSum+=iLocal->adc();
262 Signals.insert( std::make_pair(formerStrip, ADCSum));
272 formerStrip = currentStrip;
273 ADCSum = iLocal->adc();
277 if((++iLocalchk) == LocalMap.end()) {
279 Signals.insert( std::make_pair(formerStrip, ADCSum));
289 signals_.insert( std::make_pair( detID, Signals));
295 for(TrackingGeometry::DetUnitContainer::const_iterator iu =
pDD->detUnits().begin(); iu !=
pDD->detUnits().end(); iu ++){
309 std::vector<float> detAmpl(numStrips, 0.);
311 for(
const auto& amp : *theSignal) {
312 detAmpl[amp.first] = amp.second;
318 for(
int strip =0; strip < numStrips; ++strip)
if(badChannels[strip]) detAmpl[strip] = 0.;
326 for(
unsigned int iv = 0; iv!=detAmpl.size(); iv++) {
327 float signal = detAmpl[iv];
329 float gainValue = gainHandle->getStripGain(iv, detGainRange);
331 detAmpl[iv] = signal;
344 int RefStrip = int(numStrips/2.);
345 while(RefStrip<numStrips&&badChannels[RefStrip]){
348 if(RefStrip<numStrips){
349 float noiseRMS = noiseHandle->getNoise(RefStrip,detNoiseRange);
350 float gainValue = gainHandle->getStripGain(RefStrip, detGainRange);
368 vSiStripDigi.push_back(SSD);
375 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< 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
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.
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