27 DataMixingMuonWorker::DataMixingMuonWorker() { }
31 label_(ps.getParameter<std::
string>(
"Label"))
85 LogDebug(
"DataMixingMuonWorker")<<
"===============> adding MC signals for "<<e.
id();
101 for (DLayerIt = DTdigis->begin(); DLayerIt != DTdigis->end(); ++DLayerIt) {
103 const DTLayerId& layerId = (*DLayerIt).first;
125 for (RLayerIt = RPCdigis->begin(); RLayerIt != RPCdigis->end(); ++RLayerIt) {
127 const RPCDetId& layerId = (*RLayerIt).first;
154 for (CSLayerIt = CSCStripdigis->begin(); CSLayerIt != CSCStripdigis->end(); ++CSLayerIt) {
156 const CSCDetId& layerId = (*CSLayerIt).first;
189 for (CWLayerIt = CSCWiredigis->begin(); CWLayerIt != CSCWiredigis->end(); ++CWLayerIt) {
191 const CSCDetId& layerId = (*CWLayerIt).first;
221 for (CWLayerIt = CSCComparatordigis->begin(); CWLayerIt != CSCComparatordigis->end(); ++CWLayerIt) {
223 const CSCDetId& layerId = (*CWLayerIt).first;
239 LogDebug(
"DataMixingMuonWorker") <<
"\n===============> adding pileups from event "<<ep->
id()<<
" for bunchcrossing "<<bcr;
247 boost::shared_ptr<Wrapper<DTDigiCollection>
const> DTDigisPTR =
255 for (DTLayerIt = DTDigis->begin(); DTLayerIt != DTDigis->end(); ++DTLayerIt) {
257 const DTLayerId& layerId = (*DTLayerIt).first;
273 boost::shared_ptr<Wrapper<RPCDigiCollection>
const> RPCDigisPTR =
281 for (RPCLayerIt = RPCDigis->begin(); RPCLayerIt != RPCDigis->end(); ++RPCLayerIt) {
283 const RPCDetId& layerId = (*RPCLayerIt).first;
298 boost::shared_ptr<Wrapper<CSCStripDigiCollection>
const> CSCStripDigisPTR =
301 if(CSCStripDigisPTR ) {
306 for (CSCStripLayerIt = CSCStripDigis->begin(); CSCStripLayerIt != CSCStripDigis->end(); ++CSCStripLayerIt) {
308 const CSCDetId& layerId = (*CSCStripLayerIt).first;
329 boost::shared_ptr<Wrapper<CSCWireDigiCollection>
const> CSCWireDigisPTR =
332 if(CSCWireDigisPTR ) {
337 for (CSCWireLayerIt = CSCWireDigis->begin(); CSCWireLayerIt != CSCWireDigis->end(); ++CSCWireLayerIt) {
339 const CSCDetId& layerId = (*CSCWireLayerIt).first;
354 boost::shared_ptr<Wrapper<CSCComparatorDigiCollection>
const> CSCComparatorDigisPTR =
357 if(CSCComparatorDigisPTR ) {
362 for (CSCComparatorLayerIt = CSCComparatorDigis->begin(); CSCComparatorLayerIt != CSCComparatorDigis->end(); ++CSCComparatorLayerIt) {
364 const CSCDetId& layerId = (*CSCComparatorLayerIt).first;
391 const DTLayerId& layerId = (*DLayerIt).first;
397 DTDigiMerge->put(range, layerId);
406 const RPCDetId& layerId = (*RLayerIt).first;
411 RPCDigiMerge->put(range, layerId);
419 const CSCDetId& layerId = (*CSLayerIt).first;
424 std::vector<CSCStripDigi> NewDigiList;
426 std::vector<int> StripList;
427 std::vector<CSCStripDigiCollection::const_iterator> StripPointer;
431 StripList.push_back( (*dtdigi).getStrip() );
432 StripPointer.push_back( dtdigi );
436 std::vector<int> DuplicateList;
438 std::vector<CSCStripDigiCollection::const_iterator>::const_iterator StripPtr = StripPointer.begin();
440 for( std::vector<int>::const_iterator istrip = StripList.begin(); istrip !=StripList.end(); ++istrip) {
442 const int CurrentStrip = *(istrip);
444 if(CurrentStrip > PrevStrip) {
445 PrevStrip = CurrentStrip;
448 dupl_count =
std::count(StripList.begin(), StripList.end(), CurrentStrip);
450 std::vector<int>::const_iterator duplicate = istrip;
452 std::vector<CSCStripDigiCollection::const_iterator>::const_iterator DuplPointer = StripPtr;
454 for( ; duplicate!=StripList.end(); ++duplicate) {
455 if( (*duplicate) == CurrentStrip ) {
459 DuplicateList.push_back(CurrentStrip);
461 std::vector<int> pileup_adc = (**DuplPointer).getADCCounts();
462 std::vector<int> signal_adc = (**StripPtr).getADCCounts();
464 std::vector<int>::const_iterator minplace;
466 minplace = std::min_element(pileup_adc.begin(), pileup_adc.end());
468 int minvalue = (*minplace);
470 std::vector<int> new_adc;
472 std::vector<int>::const_iterator newsig = signal_adc.begin();
474 for(std::vector<int>::const_iterator ibin = pileup_adc.begin(); ibin!=pileup_adc.end(); ++ibin) {
475 new_adc.push_back((*newsig)+(*ibin)-minvalue);
481 NewDigiList.push_back(newDigi);
486 else { NewDigiList.push_back(**StripPtr); }
493 check =
std::count(DuplicateList.begin(), DuplicateList.end(), CurrentStrip);
494 if(check == 0) NewDigiList.push_back(**StripPtr);
501 CSCStripDigiMerge->put(stripRange, layerId);
509 const CSCDetId& layerId = (*CWLayerIt).first;
514 CSCWireDigiMerge->put(range, layerId);
523 const CSCDetId& layerId = (*CCLayerIt).first;
528 CSCComparatorDigiMerge->put(range, layerId);
539 e.
put( DTDigiMerge );
540 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_
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_
edm::EDGetTokenT< CSCWireDigiCollection > CSCWireDigiToken_
CSCComparatorDigiCollection * OurCSCComparatorDigis_
edm::InputTag CSCCompPileInputTag_
std::vector< CSCStripDigi >::const_iterator const_iterator
T const * product() const
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_