23 DataMixingMuonWorker::DataMixingMuonWorker() { }
27 label_(ps.getParameter<
std::
string>(
"Label"))
81 LogDebug(
"DataMixingMuonWorker")<<
"===============> adding MC signals for "<<e.
id();
97 for (DLayerIt = DTdigis->begin(); DLayerIt != DTdigis->end(); ++DLayerIt) {
99 const DTLayerId& layerId = (*DLayerIt).first;
121 for (RLayerIt = RPCdigis->begin(); RLayerIt != RPCdigis->end(); ++RLayerIt) {
123 const RPCDetId& layerId = (*RLayerIt).first;
150 for (CSLayerIt = CSCStripdigis->begin(); CSLayerIt != CSCStripdigis->end(); ++CSLayerIt) {
152 const CSCDetId& layerId = (*CSLayerIt).first;
185 for (CWLayerIt = CSCWiredigis->begin(); CWLayerIt != CSCWiredigis->end(); ++CWLayerIt) {
187 const CSCDetId& layerId = (*CWLayerIt).first;
217 for (CWLayerIt = CSCComparatordigis->begin(); CWLayerIt != CSCComparatordigis->end(); ++CWLayerIt) {
219 const CSCDetId& layerId = (*CWLayerIt).first;
235 LogDebug(
"DataMixingMuonWorker") <<
"\n===============> adding pileups from event "<<ep->
id()<<
" for bunchcrossing "<<bcr;
243 std::shared_ptr<Wrapper<DTDigiCollection>
const> DTDigisPTR =
251 for (DTLayerIt = DTDigis->begin(); DTLayerIt != DTDigis->end(); ++DTLayerIt) {
253 const DTLayerId& layerId = (*DTLayerIt).first;
269 std::shared_ptr<Wrapper<RPCDigiCollection>
const> RPCDigisPTR =
277 for (RPCLayerIt = RPCDigis->begin(); RPCLayerIt != RPCDigis->end(); ++RPCLayerIt) {
279 const RPCDetId& layerId = (*RPCLayerIt).first;
294 std::shared_ptr<Wrapper<CSCStripDigiCollection>
const> CSCStripDigisPTR =
297 if(CSCStripDigisPTR ) {
302 for (CSCStripLayerIt = CSCStripDigis->begin(); CSCStripLayerIt != CSCStripDigis->end(); ++CSCStripLayerIt) {
304 const CSCDetId& layerId = (*CSCStripLayerIt).first;
325 std::shared_ptr<Wrapper<CSCWireDigiCollection>
const> CSCWireDigisPTR =
328 if(CSCWireDigisPTR ) {
333 for (CSCWireLayerIt = CSCWireDigis->begin(); CSCWireLayerIt != CSCWireDigis->end(); ++CSCWireLayerIt) {
335 const CSCDetId& layerId = (*CSCWireLayerIt).first;
350 std::shared_ptr<Wrapper<CSCComparatorDigiCollection>
const> CSCComparatorDigisPTR =
353 if(CSCComparatorDigisPTR ) {
358 for (CSCComparatorLayerIt = CSCComparatorDigis->begin(); CSCComparatorLayerIt != CSCComparatorDigis->end(); ++CSCComparatorLayerIt) {
360 const CSCDetId& layerId = (*CSCComparatorLayerIt).first;
387 const DTLayerId& layerId = (*DLayerIt).first;
393 DTDigiMerge->put(range, layerId);
402 const RPCDetId& layerId = (*RLayerIt).first;
407 RPCDigiMerge->put(range, layerId);
415 const CSCDetId& layerId = (*CSLayerIt).first;
420 std::vector<CSCStripDigi> NewDigiList;
422 std::vector<int> StripList;
423 std::vector<CSCStripDigiCollection::const_iterator> StripPointer;
427 StripList.push_back( (*dtdigi).getStrip() );
428 StripPointer.push_back( dtdigi );
432 std::vector<int> DuplicateList;
434 std::vector<CSCStripDigiCollection::const_iterator>::const_iterator StripPtr = StripPointer.begin();
436 for( std::vector<int>::const_iterator istrip = StripList.begin(); istrip !=StripList.end(); ++istrip) {
438 const int CurrentStrip = *(istrip);
440 if(CurrentStrip > PrevStrip) {
441 PrevStrip = CurrentStrip;
444 dupl_count =
std::count(StripList.begin(), StripList.end(), CurrentStrip);
446 std::vector<int>::const_iterator duplicate = istrip;
448 std::vector<CSCStripDigiCollection::const_iterator>::const_iterator DuplPointer = StripPtr;
450 for( ; duplicate!=StripList.end(); ++duplicate) {
451 if( (*duplicate) == CurrentStrip ) {
455 DuplicateList.push_back(CurrentStrip);
457 std::vector<int> pileup_adc = (**DuplPointer).getADCCounts();
458 std::vector<int> signal_adc = (**StripPtr).getADCCounts();
460 std::vector<int>::const_iterator minplace;
462 minplace = std::min_element(pileup_adc.begin(), pileup_adc.end());
464 int minvalue = (*minplace);
466 std::vector<int> new_adc;
468 std::vector<int>::const_iterator newsig = signal_adc.begin();
470 for(std::vector<int>::const_iterator ibin = pileup_adc.begin(); ibin!=pileup_adc.end(); ++ibin) {
471 new_adc.push_back((*newsig)+(*ibin)-minvalue);
477 NewDigiList.push_back(newDigi);
482 else { NewDigiList.push_back(**StripPtr); }
489 check =
std::count(DuplicateList.begin(), DuplicateList.end(), CurrentStrip);
490 if(check == 0) NewDigiList.push_back(**StripPtr);
497 CSCStripDigiMerge->put(stripRange, layerId);
505 const CSCDetId& layerId = (*CWLayerIt).first;
510 CSCWireDigiMerge->put(range, layerId);
519 const CSCDetId& layerId = (*CCLayerIt).first;
524 CSCComparatorDigiMerge->put(range, layerId);
T getParameter(std::string const &) const
void addMuonSignals(const edm::Event &e)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::string DTDigiCollectionDM_
void addMuonPileups(const int bcr, const edm::EventPrincipal *, unsigned int EventId, ModuleCallingContext const *)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::InputTag DTDigiTagSig_
EventID const & id() 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_
T const * product() const
edm::EDGetTokenT< CSCWireDigiCollection > CSCWireDigiToken_
CSCComparatorDigiCollection * OurCSCComparatorDigis_
edm::InputTag CSCCompPileInputTag_
std::vector< CSCStripDigi >::const_iterator const_iterator
edm::InputTag RPCPileInputTag_
std::string CSCWireDigiCollectionDM_
MuonDigiCollection< DTLayerId, DTDigi > DTDigiCollection
edm::InputTag CSCCompdigi_collectionSig_
std::pair< const_iterator, const_iterator > Range
edm::EDGetTokenT< CSCComparatorDigiCollection > CSCCompDigiPToken_
void putMuon(edm::Event &e)
std::string CSCComparatorDigiCollectionDM_
std::string CSCStripDigiCollectionDM_
edm::EDGetTokenT< CSCWireDigiCollection > CSCWireDigiPToken_
edm::InputTag CSCstripdigi_collectionSig_
static void check(T const &p, std::string const &id, SelectedProducts const &iProducts)