CMS 3D CMS Logo

PreMixingCSCWorker.cc
Go to the documentation of this file.
4 
8 
9 // Specialize put for CSC strip
10 template <>
12  auto merged = std::make_unique<CSCStripDigiCollection>();
13  for (const auto &elem : *accumulated_) {
14  // The layerId
15  const CSCDetId &layerId = elem.first;
16 
17  // Get the iterators over the digis associated with this LayerId
18  const CSCStripDigiCollection::Range &range = elem.second;
19 
20  std::vector<CSCStripDigi> NewDigiList;
21 
22  std::vector<int> StripList;
23  std::vector<CSCStripDigiCollection::const_iterator> StripPointer;
24 
25  for (CSCStripDigiCollection::const_iterator dtdigi = range.first; dtdigi != range.second; ++dtdigi) {
26  StripList.push_back((*dtdigi).getStrip());
27  StripPointer.push_back(dtdigi);
28  }
29 
30  int PrevStrip = -1;
31  std::vector<int> DuplicateList;
32 
33  std::vector<CSCStripDigiCollection::const_iterator>::const_iterator StripPtr = StripPointer.begin();
34 
35  for (std::vector<int>::const_iterator istrip = StripList.begin(); istrip != StripList.end(); ++istrip) {
36  const int CurrentStrip = *(istrip);
37 
38  if (CurrentStrip > PrevStrip) {
39  PrevStrip = CurrentStrip;
40 
41  int dupl_count;
42  dupl_count = std::count(StripList.begin(), StripList.end(), CurrentStrip);
43  if (dupl_count > 1) {
44  std::vector<int>::const_iterator duplicate = istrip;
45  ++duplicate;
46  std::vector<CSCStripDigiCollection::const_iterator>::const_iterator DuplPointer = StripPtr;
47  ++DuplPointer;
48  for (; duplicate != StripList.end(); ++duplicate) {
49  if ((*duplicate) == CurrentStrip) {
50  DuplicateList.push_back(CurrentStrip);
51 
52  std::vector<int> pileup_adc = (**DuplPointer).getADCCounts();
53  std::vector<int> signal_adc = (**StripPtr).getADCCounts();
54 
55  std::vector<int>::const_iterator minplace;
56 
57  minplace = std::min_element(pileup_adc.begin(), pileup_adc.end());
58 
59  int minvalue = (*minplace);
60 
61  std::vector<int> new_adc;
62 
63  std::vector<int>::const_iterator newsig = signal_adc.begin();
64 
65  for (std::vector<int>::const_iterator ibin = pileup_adc.begin(); ibin != pileup_adc.end(); ++ibin) {
66  new_adc.push_back((*newsig) + (*ibin) - minvalue);
67 
68  ++newsig;
69  }
70 
71  CSCStripDigi newDigi(CurrentStrip, new_adc);
72  NewDigiList.push_back(newDigi);
73  }
74  ++DuplPointer;
75  }
76  } else {
77  NewDigiList.push_back(**StripPtr);
78  }
79  } // if strips monotonically increasing... Haven't hit duplicates yet
80  else { // reached end of signal digis, or there was no overlap
81  PrevStrip = 1000; // now into pileup signals, stop looking forward for
82  // duplicates
83 
84  // check if this digi was in the duplicate list
85  int check;
86  check = std::count(DuplicateList.begin(), DuplicateList.end(), CurrentStrip);
87  if (check == 0)
88  NewDigiList.push_back(**StripPtr);
89  }
90  ++StripPtr;
91  }
92 
93  CSCStripDigiCollection::Range stripRange(NewDigiList.begin(), NewDigiList.end());
94 
95  merged->put(stripRange, layerId);
96  }
97 
98  iEvent.put(std::move(merged), collectionDM_);
99  accumulated_.reset();
100 }
101 
102 // CSC has three digi collections
104 public:
106  : stripWorker_(ps.getParameter<edm::ParameterSet>("strip"), producesCollector, iC),
107  wireWorker_(ps.getParameter<edm::ParameterSet>("wire"), producesCollector, iC),
108  comparatorWorker_(ps.getParameter<edm::ParameterSet>("comparator"), producesCollector, iC) {}
109  ~PreMixingCSCWorker() override = default;
110 
111  void initializeEvent(edm::Event const &iEvent, edm::EventSetup const &iSetup) override {}
112 
113  void addSignals(edm::Event const &iEvent, edm::EventSetup const &iSetup) override {
114  stripWorker_.addSignals(iEvent, iSetup);
115  wireWorker_.addSignals(iEvent, iSetup);
117  }
118 
119  void addPileups(PileUpEventPrincipal const &pep, edm::EventSetup const &iSetup) override {
120  stripWorker_.addPileups(pep, iSetup);
121  wireWorker_.addPileups(pep, iSetup);
122  comparatorWorker_.addPileups(pep, iSetup);
123  }
124 
126  edm::EventSetup const &iSetup,
127  std::vector<PileupSummaryInfo> const &ps,
128  int bunchSpacing) override {
132  }
133 
134 private:
138 };
139 
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
PreMixingMuonWorker::collectionDM_
std::string collectionDM_
Definition: PreMixingMuonWorker.h:39
edm
HLT enums.
Definition: AlignableModifier.h:19
PileUpEventPrincipal
Definition: PileUpEventPrincipal.h:19
ProducesCollector.h
MuonDigiCollection::const_iterator
std::vector< DigiType >::const_iterator const_iterator
Definition: MuonDigiCollection.h:94
PreMixingCSCWorker::stripWorker_
PreMixingMuonWorker< CSCStripDigiCollection > stripWorker_
Definition: PreMixingCSCWorker.cc:135
PreMixingCSCWorker::addSignals
void addSignals(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
Definition: PreMixingCSCWorker.cc:113
PreMixingMuonWorker.h
RPCNoise_example.check
check
Definition: RPCNoise_example.py:71
PreMixingCSCWorker::PreMixingCSCWorker
PreMixingCSCWorker(const edm::ParameterSet &ps, edm::ProducesCollector producesCollector, edm::ConsumesCollector &&iC)
Definition: PreMixingCSCWorker.cc:105
PreMixingCSCWorker
Definition: PreMixingCSCWorker.cc:103
PreMixingCSCWorker::initializeEvent
void initializeEvent(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
Definition: PreMixingCSCWorker.cc:111
PreMixingCSCWorker::put
void put(edm::Event &iEvent, edm::EventSetup const &iSetup, std::vector< PileupSummaryInfo > const &ps, int bunchSpacing) override
Definition: PreMixingCSCWorker.cc:125
PreMixingMuonWorker::addPileups
void addPileups(PileUpEventPrincipal const &pep, edm::EventSetup const &iSetup) override
Definition: PreMixingMuonWorker.h:63
PreMixingCSCWorker::wireWorker_
PreMixingMuonWorker< CSCWireDigiCollection > wireWorker_
Definition: PreMixingCSCWorker.cc:136
PreMixingMuonWorker< CSCStripDigiCollection >
PreMixingMuonWorker::addSignals
void addSignals(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
Definition: PreMixingMuonWorker.h:55
edm::ParameterSet
Definition: ParameterSet.h:36
PreMixingMuonWorker::accumulated_
std::unique_ptr< DigiCollection > accumulated_
Definition: PreMixingMuonWorker.h:41
ParameterSet
Definition: Functions.h:16
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
CSCDetId
Definition: CSCDetId.h:26
PreMixingCSCWorker::addPileups
void addPileups(PileUpEventPrincipal const &pep, edm::EventSetup const &iSetup) override
Definition: PreMixingCSCWorker.cc:119
iEvent
int iEvent
Definition: GenABIO.cc:224
CSCStripDigiCollection.h
edm::EventSetup
Definition: EventSetup.h:57
PreMixingCSCWorker::~PreMixingCSCWorker
~PreMixingCSCWorker() override=default
PreMixingWorkerFactory.h
CSCStripDigi
Definition: CSCStripDigi.h:17
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ProducesCollector
Definition: ProducesCollector.h:43
PreMixingMuonWorker::put
void put(edm::Event &iEvent, edm::EventSetup const &iSetup, std::vector< PileupSummaryInfo > const &ps, int bunchSpacing) override
Definition: PreMixingMuonWorker.h:27
DEFINE_PREMIXING_WORKER
#define DEFINE_PREMIXING_WORKER(TYPE)
Definition: PreMixingWorkerFactory.h:16
MuonDigiCollection::Range
std::pair< const_iterator, const_iterator > Range
Definition: MuonDigiCollection.h:95
CSCComparatorDigiCollection.h
PreMixingCSCWorker::comparatorWorker_
PreMixingMuonWorker< CSCComparatorDigiCollection > comparatorWorker_
Definition: PreMixingCSCWorker.cc:137
PreMixingWorker
Definition: PreMixingWorker.h:14
CSCWireDigiCollection.h
edm::Event
Definition: Event.h:73
edm::ConsumesCollector
Definition: ConsumesCollector.h:39