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")),
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();
96 assert(stripdet != 0);
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());
227 std::vector< edm::DetSet<SiStripDigi> > vSiStripDigi;
237 for(SiGlobalIndex::const_iterator IDet =
SiHitStorage_.begin();
240 uint32_t detID = IDet->first;
248 int formerStrip = -1;
254 OneDetectorMap::const_iterator iLocalchk;
255 OneDetectorMap::const_iterator iLocal = LocalMap.begin();
256 for(;iLocal != LocalMap.end(); ++iLocal) {
258 currentStrip = iLocal->strip();
260 if (currentStrip == formerStrip) {
261 ADCSum+=iLocal->adc();
265 Signals.insert( std::make_pair(formerStrip, ADCSum));
274 formerStrip = currentStrip;
275 ADCSum = iLocal->adc();
279 if((++iLocalchk) == LocalMap.end()) {
281 Signals.insert( std::make_pair(formerStrip, ADCSum));
290 signals_.insert( std::make_pair( detID, Signals));
296 for(TrackingGeometry::DetUnitContainer::const_iterator iu =
pDD->detUnits().begin(); iu !=
pDD->detUnits().end(); iu ++){
311 std::vector<float> detAmpl(numStrips, 0.);
313 for(
const auto& amp : *theSignal) {
314 detAmpl[amp.first] = amp.second;
320 for(
int strip =0; strip < numStrips; ++strip)
if(badChannels[strip]) detAmpl[strip] = 0.;
328 for(
unsigned int iv = 0; iv!=detAmpl.size(); iv++) {
329 float signal = detAmpl[iv];
331 float gainValue = gainHandle->getStripGain(iv, detGainRange);
333 detAmpl[iv] = signal;
345 int RefStrip = int(numStrips/2.);
346 while(RefStrip<numStrips&&badChannels[RefStrip]){
349 if(RefStrip<numStrips){
350 float noiseRMS = noiseHandle->getNoise(RefStrip,detNoiseRange);
351 float gainValue = gainHandle->getStripGain(RefStrip, detGainRange);
369 vSiStripDigi.push_back(SSD);
376 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.
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
std::string SiStripDigiCollectionDM_
std::vector< SiStripDigi > OneDetectorMap