21 DataMixingMuonWorker::DataMixingMuonWorker() {}
25 : label_(ps.getParameter<
std::
string>(
"Label"))
74 LogDebug(
"DataMixingMuonWorker") <<
"===============> adding MC signals for " <<
e.id();
90 for (DLayerIt = DTdigis->begin(); DLayerIt != DTdigis->end(); ++DLayerIt) {
92 const DTLayerId &layerId = (*DLayerIt).first;
113 for (RLayerIt = RPCdigis->begin(); RLayerIt != RPCdigis->end(); ++RLayerIt) {
115 const RPCDetId &layerId = (*RLayerIt).first;
140 for (CSLayerIt = CSCStripdigis->begin(); CSLayerIt != CSCStripdigis->end(); ++CSLayerIt) {
142 const CSCDetId &layerId = (*CSLayerIt).first;
174 for (CWLayerIt = CSCWiredigis->begin(); CWLayerIt != CSCWiredigis->end(); ++CWLayerIt) {
176 const CSCDetId &layerId = (*CWLayerIt).first;
205 for (CWLayerIt = CSCComparatordigis->begin(); CWLayerIt != CSCComparatordigis->end(); ++CWLayerIt) {
207 const CSCDetId &layerId = (*CWLayerIt).first;
220 unsigned int eventNr,
222 LogDebug(
"DataMixingMuonWorker") <<
"\n===============> adding pileups from event " <<
ep->id()
223 <<
" for bunchcrossing " << bcr;
232 std::shared_ptr<Wrapper<DTDigiCollection>
const> DTDigisPTR =
239 for (DTLayerIt = DTDigis->begin(); DTLayerIt != DTDigis->end(); ++DTLayerIt) {
241 const DTLayerId &layerId = (*DTLayerIt).first;
254 std::shared_ptr<Wrapper<RPCDigiCollection>
const> RPCDigisPTR =
261 for (RPCLayerIt = RPCDigis->begin(); RPCLayerIt != RPCDigis->end(); ++RPCLayerIt) {
263 const RPCDetId &layerId = (*RPCLayerIt).first;
277 std::shared_ptr<Wrapper<CSCStripDigiCollection>
const> CSCStripDigisPTR =
280 if (CSCStripDigisPTR) {
284 for (CSCStripLayerIt = CSCStripDigis->begin(); CSCStripLayerIt != CSCStripDigis->end(); ++CSCStripLayerIt) {
286 const CSCDetId &layerId = (*CSCStripLayerIt).first;
308 std::shared_ptr<Wrapper<CSCWireDigiCollection>
const> CSCWireDigisPTR =
311 if (CSCWireDigisPTR) {
315 for (CSCWireLayerIt = CSCWireDigis->begin(); CSCWireLayerIt != CSCWireDigis->end(); ++CSCWireLayerIt) {
317 const CSCDetId &layerId = (*CSCWireLayerIt).first;
331 std::shared_ptr<Wrapper<CSCComparatorDigiCollection>
const> CSCComparatorDigisPTR =
334 if (CSCComparatorDigisPTR) {
339 for (CSCComparatorLayerIt = CSCComparatorDigis->begin(); CSCComparatorLayerIt != CSCComparatorDigis->end();
340 ++CSCComparatorLayerIt) {
342 const CSCDetId &layerId = (*CSCComparatorLayerIt).first;
365 const DTLayerId &layerId = (*DLayerIt).first;
370 DTDigiMerge->put(
range, layerId);
378 const RPCDetId &layerId = (*RLayerIt).first;
383 RPCDigiMerge->put(
range, layerId);
390 const CSCDetId &layerId = (*CSLayerIt).first;
395 std::vector<CSCStripDigi> NewDigiList;
397 std::vector<int> StripList;
398 std::vector<CSCStripDigiCollection::const_iterator> StripPointer;
402 StripList.push_back((*dtdigi).getStrip());
403 StripPointer.push_back(dtdigi);
407 std::vector<int> DuplicateList;
409 std::vector<CSCStripDigiCollection::const_iterator>::const_iterator StripPtr = StripPointer.begin();
411 for (std::vector<int>::const_iterator istrip = StripList.begin(); istrip != StripList.end(); ++istrip) {
412 const int CurrentStrip = *(istrip);
414 if (CurrentStrip > PrevStrip) {
415 PrevStrip = CurrentStrip;
418 dupl_count =
std::count(StripList.begin(), StripList.end(), CurrentStrip);
419 if (dupl_count > 1) {
420 std::vector<int>::const_iterator duplicate = istrip;
422 std::vector<CSCStripDigiCollection::const_iterator>::const_iterator DuplPointer = StripPtr;
424 for (; duplicate != StripList.end(); ++duplicate) {
425 if ((*duplicate) == CurrentStrip) {
430 DuplicateList.push_back(CurrentStrip);
432 std::vector<int> pileup_adc = (**DuplPointer).getADCCounts();
433 std::vector<int> signal_adc = (**StripPtr).getADCCounts();
435 std::vector<int>::const_iterator minplace;
437 minplace = std::min_element(pileup_adc.begin(), pileup_adc.end());
439 int minvalue = (*minplace);
441 std::vector<int> new_adc;
443 std::vector<int>::const_iterator newsig = signal_adc.begin();
445 for (std::vector<int>::const_iterator ibin = pileup_adc.begin(); ibin != pileup_adc.end(); ++ibin) {
446 new_adc.push_back((*newsig) + (*ibin) - minvalue);
452 NewDigiList.push_back(newDigi);
457 NewDigiList.push_back(**StripPtr);
466 check =
std::count(DuplicateList.begin(), DuplicateList.end(), CurrentStrip);
468 NewDigiList.push_back(**StripPtr);
475 CSCStripDigiMerge->put(stripRange, layerId);
482 const CSCDetId &layerId = (*CWLayerIt).first;
487 CSCWireDigiMerge->put(
range, layerId);
495 const CSCDetId &layerId = (*CCLayerIt).first;
500 CSCComparatorDigiMerge->put(
range, layerId);
void addMuonSignals(const edm::Event &e)
T getParameter(std::string const &) const
std::string DTDigiCollectionDM_
void addMuonPileups(const int bcr, const edm::EventPrincipal *, unsigned int EventId, ModuleCallingContext const *)
edm::InputTag DTDigiTagSig_
T const * product() const
edm::InputTag CSCwiredigi_collectionSig_
MuonDigiCollection< CSCDetId, CSCStripDigi > CSCStripDigiCollection
edm::EDGetTokenT< RPCDigiCollection > RPCDigiPToken_
edm::EDGetTokenT< CSCStripDigiCollection > CSCStripDigiPToken_
virtual ~DataMixingMuonWorker()
CSCStripDigiCollection * OurCSCStripDigis_
DTDigiCollection * OurDTDigis_
MuonDigiCollection< CSCDetId, CSCComparatorDigi > CSCComparatorDigiCollection
edm::InputTag DTPileInputTag_
edm::InputTag CSCStripPileInputTag_
MuonDigiCollection< RPCDetId, RPCDigi > RPCDigiCollection
std::string RPCDigiCollectionDM_
edm::EDGetTokenT< DTDigiCollection > DTDigiPToken_
edm::EDGetTokenT< RPCDigiCollection > RPCDigiToken_
edm::EDGetTokenT< DTDigiCollection > DTDigiToken_
edm::InputTag CSCWirePileInputTag_
RPCDigiCollection * OurRPCDigis_
CSCWireDigiCollection * OurCSCWireDigis_
MuonDigiCollection< CSCDetId, CSCWireDigi > CSCWireDigiCollection
edm::EDGetTokenT< CSCStripDigiCollection > CSCStripDigiToken_
edm::EDGetTokenT< CSCComparatorDigiCollection > CSCCompDigiToken_
edm::InputTag RPCDigiTagSig_
edm::EDGetTokenT< CSCWireDigiCollection > CSCWireDigiToken_
std::pair< const_iterator, const_iterator > Range
CSCComparatorDigiCollection * OurCSCComparatorDigis_
edm::InputTag CSCCompPileInputTag_
std::vector< DigiType >::const_iterator const_iterator
static void check(T const &p, std::string const &id, SelectedProducts const &iProducts, bool iVerbose)
edm::InputTag RPCPileInputTag_
std::string CSCWireDigiCollectionDM_
MuonDigiCollection< DTLayerId, DTDigi > DTDigiCollection
edm::InputTag CSCCompdigi_collectionSig_
edm::EDGetTokenT< CSCComparatorDigiCollection > CSCCompDigiPToken_
void putMuon(edm::Event &e)
std::string CSCComparatorDigiCollectionDM_
std::string CSCStripDigiCollectionDM_
edm::EDGetTokenT< CSCWireDigiCollection > CSCWireDigiPToken_
edm::InputTag CSCstripdigi_collectionSig_