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 =
236 const DTDigiCollection *DTDigis = const_cast<DTDigiCollection *>(DTDigisPTR->product());
239 for (DTLayerIt = DTDigis->begin(); DTLayerIt != DTDigis->end(); ++DTLayerIt) {
241 const DTLayerId &layerId = (*DTLayerIt).first;
254 std::shared_ptr<Wrapper<RPCDigiCollection>
const> RPCDigisPTR =
258 const RPCDigiCollection *RPCDigis = const_cast<RPCDigiCollection *>(RPCDigisPTR->product());
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) {
281 const CSCStripDigiCollection *CSCStripDigis = const_cast<CSCStripDigiCollection *>(CSCStripDigisPTR->product());
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) {
312 const CSCWireDigiCollection *CSCWireDigis = const_cast<CSCWireDigiCollection *>(CSCWireDigisPTR->product());
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) {
336 const_cast<CSCComparatorDigiCollection *>(CSCComparatorDigisPTR->product());
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);