27 DataMixingMuonWorker::DataMixingMuonWorker() { }
31 label_(ps.getParameter<std::
string>(
"Label"))
72 LogDebug(
"DataMixingMuonWorker")<<
"===============> adding MC signals for "<<e.
id();
88 for (DLayerIt = DTdigis->begin(); DLayerIt != DTdigis->end(); ++DLayerIt) {
90 const DTLayerId& layerId = (*DLayerIt).first;
112 for (RLayerIt = RPCdigis->begin(); RLayerIt != RPCdigis->end(); ++RLayerIt) {
114 const RPCDetId& layerId = (*RLayerIt).first;
141 for (CSLayerIt = CSCStripdigis->begin(); CSLayerIt != CSCStripdigis->end(); ++CSLayerIt) {
143 const CSCDetId& layerId = (*CSLayerIt).first;
176 for (CWLayerIt = CSCWiredigis->begin(); CWLayerIt != CSCWiredigis->end(); ++CWLayerIt) {
178 const CSCDetId& layerId = (*CWLayerIt).first;
208 for (CWLayerIt = CSCComparatordigis->begin(); CWLayerIt != CSCComparatordigis->end(); ++CWLayerIt) {
210 const CSCDetId& layerId = (*CWLayerIt).first;
226 LogDebug(
"DataMixingMuonWorker") <<
"\n===============> adding pileups from event "<<ep->
id()<<
" for bunchcrossing "<<bcr;
234 boost::shared_ptr<Wrapper<DTDigiCollection>
const> DTDigisPTR =
242 for (DTLayerIt = DTDigis->begin(); DTLayerIt != DTDigis->end(); ++DTLayerIt) {
244 const DTLayerId& layerId = (*DTLayerIt).first;
260 boost::shared_ptr<Wrapper<RPCDigiCollection>
const> RPCDigisPTR =
268 for (RPCLayerIt = RPCDigis->begin(); RPCLayerIt != RPCDigis->end(); ++RPCLayerIt) {
270 const RPCDetId& layerId = (*RPCLayerIt).first;
285 boost::shared_ptr<Wrapper<CSCStripDigiCollection>
const> CSCStripDigisPTR =
288 if(CSCStripDigisPTR ) {
293 for (CSCStripLayerIt = CSCStripDigis->begin(); CSCStripLayerIt != CSCStripDigis->end(); ++CSCStripLayerIt) {
295 const CSCDetId& layerId = (*CSCStripLayerIt).first;
316 boost::shared_ptr<Wrapper<CSCWireDigiCollection>
const> CSCWireDigisPTR =
319 if(CSCWireDigisPTR ) {
324 for (CSCWireLayerIt = CSCWireDigis->begin(); CSCWireLayerIt != CSCWireDigis->end(); ++CSCWireLayerIt) {
326 const CSCDetId& layerId = (*CSCWireLayerIt).first;
341 boost::shared_ptr<Wrapper<CSCComparatorDigiCollection>
const> CSCComparatorDigisPTR =
344 if(CSCComparatorDigisPTR ) {
349 for (CSCComparatorLayerIt = CSCComparatorDigis->begin(); CSCComparatorLayerIt != CSCComparatorDigis->end(); ++CSCComparatorLayerIt) {
351 const CSCDetId& layerId = (*CSCComparatorLayerIt).first;
378 const DTLayerId& layerId = (*DLayerIt).first;
384 DTDigiMerge->put(range, layerId);
393 const RPCDetId& layerId = (*RLayerIt).first;
398 RPCDigiMerge->put(range, layerId);
406 const CSCDetId& layerId = (*CSLayerIt).first;
411 std::vector<CSCStripDigi> NewDigiList;
413 std::vector<int> StripList;
414 std::vector<CSCStripDigiCollection::const_iterator> StripPointer;
418 StripList.push_back( (*dtdigi).getStrip() );
419 StripPointer.push_back( dtdigi );
423 std::vector<int> DuplicateList;
425 std::vector<CSCStripDigiCollection::const_iterator>::const_iterator StripPtr = StripPointer.begin();
427 for( std::vector<int>::const_iterator istrip = StripList.begin(); istrip !=StripList.end(); ++istrip) {
429 const int CurrentStrip = *(istrip);
431 if(CurrentStrip > PrevStrip) {
432 PrevStrip = CurrentStrip;
435 dupl_count =
std::count(StripList.begin(), StripList.end(), CurrentStrip);
437 std::vector<int>::const_iterator duplicate = istrip;
439 std::vector<CSCStripDigiCollection::const_iterator>::const_iterator DuplPointer = StripPtr;
441 for( ; duplicate!=StripList.end(); ++duplicate) {
442 if( (*duplicate) == CurrentStrip ) {
446 DuplicateList.push_back(CurrentStrip);
448 std::vector<int> pileup_adc = (**DuplPointer).getADCCounts();
449 std::vector<int> signal_adc = (**StripPtr).getADCCounts();
451 std::vector<int>::const_iterator minplace;
453 minplace = std::min_element(pileup_adc.begin(), pileup_adc.end());
455 int minvalue = (*minplace);
457 std::vector<int> new_adc;
459 std::vector<int>::const_iterator newsig = signal_adc.begin();
461 for(std::vector<int>::const_iterator ibin = pileup_adc.begin(); ibin!=pileup_adc.end(); ++ibin) {
462 new_adc.push_back((*newsig)+(*ibin)-minvalue);
468 NewDigiList.push_back(newDigi);
473 else { NewDigiList.push_back(**StripPtr); }
480 check =
std::count(DuplicateList.begin(), DuplicateList.end(), CurrentStrip);
481 if(check == 0) NewDigiList.push_back(**StripPtr);
488 CSCStripDigiMerge->put(stripRange, layerId);
496 const CSCDetId& layerId = (*CWLayerIt).first;
501 CSCWireDigiMerge->put(range, layerId);
510 const CSCDetId& layerId = (*CCLayerIt).first;
515 CSCComparatorDigiMerge->put(range, layerId);
526 e.
put( DTDigiMerge );
527 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 *)
edm::InputTag DTDigiTagSig_
EventID const & id() const
edm::InputTag CSCwiredigi_collectionSig_
MuonDigiCollection< CSCDetId, CSCStripDigi > CSCStripDigiCollection
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::InputTag CSCWirePileInputTag_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
RPCDigiCollection * OurRPCDigis_
CSCWireDigiCollection * OurCSCWireDigis_
MuonDigiCollection< CSCDetId, CSCWireDigi > CSCWireDigiCollection
static void check(Principal const &p, std::string const &id, edm::ModuleCallingContext const *mcc)
edm::InputTag RPCDigiTagSig_
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
void putMuon(edm::Event &e)
std::string CSCComparatorDigiCollectionDM_
std::string CSCStripDigiCollectionDM_
edm::InputTag CSCstripdigi_collectionSig_