28 DataMixingMuonWorker::DataMixingMuonWorker() { }
32 label_(ps.getParameter<std::
string>(
"Label"))
86 LogDebug(
"DataMixingMuonWorker")<<
"===============> adding MC signals for "<<e.
id();
102 for (DLayerIt = DTdigis->begin(); DLayerIt != DTdigis->end(); ++DLayerIt) {
104 const DTLayerId& layerId = (*DLayerIt).first;
126 for (RLayerIt = RPCdigis->begin(); RLayerIt != RPCdigis->end(); ++RLayerIt) {
128 const RPCDetId& layerId = (*RLayerIt).first;
155 for (CSLayerIt = CSCStripdigis->begin(); CSLayerIt != CSCStripdigis->end(); ++CSLayerIt) {
157 const CSCDetId& layerId = (*CSLayerIt).first;
190 for (CWLayerIt = CSCWiredigis->begin(); CWLayerIt != CSCWiredigis->end(); ++CWLayerIt) {
192 const CSCDetId& layerId = (*CWLayerIt).first;
222 for (CWLayerIt = CSCComparatordigis->begin(); CWLayerIt != CSCComparatordigis->end(); ++CWLayerIt) {
224 const CSCDetId& layerId = (*CWLayerIt).first;
240 LogDebug(
"DataMixingMuonWorker") <<
"\n===============> adding pileups from event "<<ep->
id()<<
" for bunchcrossing "<<bcr;
248 std::shared_ptr<Wrapper<DTDigiCollection>
const> DTDigisPTR =
256 for (DTLayerIt = DTDigis->begin(); DTLayerIt != DTDigis->end(); ++DTLayerIt) {
258 const DTLayerId& layerId = (*DTLayerIt).first;
274 std::shared_ptr<Wrapper<RPCDigiCollection>
const> RPCDigisPTR =
282 for (RPCLayerIt = RPCDigis->begin(); RPCLayerIt != RPCDigis->end(); ++RPCLayerIt) {
284 const RPCDetId& layerId = (*RPCLayerIt).first;
299 std::shared_ptr<Wrapper<CSCStripDigiCollection>
const> CSCStripDigisPTR =
302 if(CSCStripDigisPTR ) {
307 for (CSCStripLayerIt = CSCStripDigis->begin(); CSCStripLayerIt != CSCStripDigis->end(); ++CSCStripLayerIt) {
309 const CSCDetId& layerId = (*CSCStripLayerIt).first;
330 std::shared_ptr<Wrapper<CSCWireDigiCollection>
const> CSCWireDigisPTR =
333 if(CSCWireDigisPTR ) {
338 for (CSCWireLayerIt = CSCWireDigis->begin(); CSCWireLayerIt != CSCWireDigis->end(); ++CSCWireLayerIt) {
340 const CSCDetId& layerId = (*CSCWireLayerIt).first;
355 std::shared_ptr<Wrapper<CSCComparatorDigiCollection>
const> CSCComparatorDigisPTR =
358 if(CSCComparatorDigisPTR ) {
363 for (CSCComparatorLayerIt = CSCComparatorDigis->begin(); CSCComparatorLayerIt != CSCComparatorDigis->end(); ++CSCComparatorLayerIt) {
365 const CSCDetId& layerId = (*CSCComparatorLayerIt).first;
392 const DTLayerId& layerId = (*DLayerIt).first;
398 DTDigiMerge->put(range, layerId);
407 const RPCDetId& layerId = (*RLayerIt).first;
412 RPCDigiMerge->put(range, layerId);
420 const CSCDetId& layerId = (*CSLayerIt).first;
425 std::vector<CSCStripDigi> NewDigiList;
427 std::vector<int> StripList;
428 std::vector<CSCStripDigiCollection::const_iterator> StripPointer;
432 StripList.push_back( (*dtdigi).getStrip() );
433 StripPointer.push_back( dtdigi );
437 std::vector<int> DuplicateList;
439 std::vector<CSCStripDigiCollection::const_iterator>::const_iterator StripPtr = StripPointer.begin();
441 for( std::vector<int>::const_iterator istrip = StripList.begin(); istrip !=StripList.end(); ++istrip) {
443 const int CurrentStrip = *(istrip);
445 if(CurrentStrip > PrevStrip) {
446 PrevStrip = CurrentStrip;
449 dupl_count =
std::count(StripList.begin(), StripList.end(), CurrentStrip);
451 std::vector<int>::const_iterator
duplicate = istrip;
453 std::vector<CSCStripDigiCollection::const_iterator>::const_iterator DuplPointer = StripPtr;
455 for( ; duplicate!=StripList.end(); ++
duplicate) {
456 if( (*duplicate) == CurrentStrip ) {
460 DuplicateList.push_back(CurrentStrip);
462 std::vector<int> pileup_adc = (**DuplPointer).getADCCounts();
463 std::vector<int> signal_adc = (**StripPtr).getADCCounts();
465 std::vector<int>::const_iterator minplace;
467 minplace = std::min_element(pileup_adc.begin(), pileup_adc.end());
469 int minvalue = (*minplace);
471 std::vector<int> new_adc;
473 std::vector<int>::const_iterator newsig = signal_adc.begin();
475 for(std::vector<int>::const_iterator ibin = pileup_adc.begin(); ibin!=pileup_adc.end(); ++ibin) {
476 new_adc.push_back((*newsig)+(*ibin)-minvalue);
482 NewDigiList.push_back(newDigi);
487 else { NewDigiList.push_back(**StripPtr); }
494 check =
std::count(DuplicateList.begin(), DuplicateList.end(), CurrentStrip);
495 if(check == 0) NewDigiList.push_back(**StripPtr);
502 CSCStripDigiMerge->put(stripRange, layerId);
510 const CSCDetId& layerId = (*CWLayerIt).first;
515 CSCWireDigiMerge->put(range, layerId);
524 const CSCDetId& layerId = (*CCLayerIt).first;
529 CSCComparatorDigiMerge->put(range, layerId);
540 e.
put( DTDigiMerge );
541 e.
put( RPCDigiMerge );
T getParameter(std::string const &) const
void addMuonSignals(const edm::Event &e)
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_
static const boost::regex duplicate("duplicateIOV[[:print:]]+?[S|s]ince[=| ]([[:alnum:]]+?);.*")
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
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
static void check(Principal const &p, std::string const &id, edm::ModuleCallingContext const *mcc)
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_