CMS 3D CMS Logo

GEMCoPadProcessor.cc
Go to the documentation of this file.
3 
4 #include <algorithm>
5 #include <set>
6 
7 //----------------
8 // Constructors --
9 //----------------
10 
12  unsigned station,
13  unsigned chamber,
14  const edm::ParameterSet& copad) :
15  theEndcap(endcap), theStation(station), theChamber(chamber)
16 {
17  // Verbosity level, set to 0 (no print) by default.
18  infoV = copad.getParameter<unsigned int>("verbosity");
19  maxDeltaPad_ = copad.getParameter<unsigned int>("maxDeltaPad");
20  maxDeltaRoll_ = copad.getParameter<unsigned int>("maxDeltaRoll");
21  maxDeltaBX_ = copad.getParameter<unsigned int>("maxDeltaBX");
22 }
23 
26 {
27  infoV = 0;
28  maxDeltaPad_ = 0;
29  maxDeltaRoll_ = 0;
30  maxDeltaBX_ = 0;
31 }
32 
33 void
35 {
36  gemCoPadV.clear();
37 }
38 
39 std::vector<GEMCoPadDigi>
41 {
42  const int region((theEndcap == 1) ? 1: -1);
43 
44  // Build coincidences
45  for (auto det_range = in_pads->begin(); det_range != in_pads->end(); ++det_range) {
46  const GEMDetId& id = (*det_range).first;
47 
48  // same chamber (no restriction on the roll number)
49  if (id.region() != region or
50  id.station() != theStation or
51  id.chamber() != theChamber) continue;
52 
53  // all coincidences detIDs will have layer=1
54  if (id.layer() != 1) continue;
55 
56  // find all corresponding ids with layer 2 and same roll that differs at most maxDeltaRoll_
57  for (unsigned int roll = id.roll() - maxDeltaRoll_; roll <= id.roll() + maxDeltaRoll_; ++roll){
58 
59  GEMDetId co_id(id.region(), id.ring(), id.station(), 2, id.chamber(), roll);
60 
61  auto co_pads_range = in_pads->get(co_id);
62 
63  // empty range = no possible coincidence pads
64  if (co_pads_range.first == co_pads_range.second) continue;
65 
66  // now let's correlate the pads in two layers of this partition
67  const auto& pads_range = (*det_range).second;
68  for (auto p = pads_range.first; p != pads_range.second; ++p) {
69  for (auto co_p = co_pads_range.first; co_p != co_pads_range.second; ++co_p) {
70 
71  // check the match in pad
72  if ((unsigned)std::abs(p->pad() - co_p->pad()) > maxDeltaPad_) continue;
73 
74  // check the match in BX
75  if ((unsigned)std::abs(p->bx() - co_p->bx()) > maxDeltaBX_) continue;
76 
77  // make a new coincidence pad digi
78  gemCoPadV.push_back(GEMCoPadDigi(id.roll(),*p,*co_p));
79  }
80  }
81  }
82  }
83  return gemCoPadV;
84 }
85 
86 std::vector<GEMCoPadDigi>
88 {
89  std::unique_ptr<GEMPadDigiCollection> out_pads(new GEMPadDigiCollection());
90  declusterize(in_clusters, *out_pads);
91  return run(out_pads.get());
92 }
93 
94 
95 const std::vector<GEMCoPadDigi>&
97 {
98  return gemCoPadV;
99 }
100 
101 void
103  GEMPadDigiCollection& out_pads) const
104 {
105  for (auto detUnitIt = in_clusters->begin();detUnitIt != in_clusters->end(); ++detUnitIt) {
106  const GEMDetId& id = (*detUnitIt).first;
107  const auto& range = (*detUnitIt).second;
108  for (auto digiIt = range.first; digiIt!=range.second; ++digiIt) {
109  for (const auto& p: digiIt->pads()){
110  out_pads.insertDigi(id, GEMPadDigi(p, digiIt->bx()));
111  }
112  }
113  }
114 }
T getParameter(std::string const &) const
std::vector< GEMCoPadDigi > run(const GEMPadDigiCollection *)
const std::vector< GEMCoPadDigi > & readoutCoPads() const
std::vector< GEMCoPadDigi > gemCoPadV
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void declusterize(const GEMPadDigiClusterCollection *, GEMPadDigiCollection &) const
unsigned int maxDeltaBX_
MuonDigiCollection< GEMDetId, GEMPadDigi > GEMPadDigiCollection
unsigned int maxDeltaPad_
unsigned int maxDeltaRoll_