CMS 3D CMS Logo

GEMCoPadProcessor.cc
Go to the documentation of this file.
2 
4 #include <algorithm>
5 #include <set>
6 
7 //----------------
8 // Constructors --
9 //----------------
10 
12  unsigned station,
13  unsigned chamber,
14  const edm::ParameterSet& config) :
15  theEndcap(endcap), theStation(station), theChamber(chamber)
16 {
17  // Verbosity level, set to 0 (no print) by default.
18  infoV = config.getParameter<unsigned int>("verbosity");
19  maxDeltaPadGE11_ = config.getParameter<unsigned int>("maxDeltaPadGE11");
20  maxDeltaPadGE21_ = config.getParameter<unsigned int>("maxDeltaPadGE21");
21  maxDeltaRollGE11_ = config.getParameter<unsigned int>("maxDeltaRollGE11");
22  maxDeltaRollGE21_ = config.getParameter<unsigned int>("maxDeltaRollGE21");
23  maxDeltaBX_ = config.getParameter<unsigned int>("maxDeltaBX");
24 }
25 
28 {
29  infoV = 0;
30  maxDeltaPadGE11_ = 0;
31  maxDeltaPadGE21_ = 0;
34  maxDeltaBX_ = 0;
35 }
36 
37 void
39 {
40  gemCoPadV.clear();
41 }
42 
43 std::vector<GEMCoPadDigi>
45 {
46  const int region((theEndcap == 1) ? 1: -1);
47 
48  clear();
49  // Build coincidences
50  for (auto det_range = in_pads->begin(); det_range != in_pads->end(); ++det_range) {
51  const auto& pads_range1 = (*det_range).second;
52  for (auto p = pads_range1.first; p != pads_range1.second; ++p) {
53  }
54 
55  const GEMDetId& id = (*det_range).first;
56  // same chamber (no restriction on the roll number)
57  if (id.region() != region or
58  id.station() != theStation or
59  id.chamber() != theChamber) continue;
60 
61  // all coincidences detIDs will have layer=1
62  if (id.layer() != 1) continue;
63 
64  // find all corresponding ids with layer 2 and same roll number
65  // or a roll number that differs at most +/-1
66 
67  for (int roll = id.roll() - 1; roll <= id.roll() +1; ++roll){
68 
69  GEMDetId co_id(id.region(), id.ring(), id.station(), 2, id.chamber(), roll);
70 
71  auto co_pads_range = in_pads->get(co_id);
72  // empty range = no possible coincidence pads
73  if (co_pads_range.first == co_pads_range.second) continue;
74 
75  // now let's correlate the pads in two layers of this partition
76  const auto& pads_range = (*det_range).second;
77  for (auto p = pads_range.first; p != pads_range.second; ++p) {
78  for (auto co_p = co_pads_range.first; co_p != co_pads_range.second; ++co_p) {
79 
80  const unsigned int deltaPad(std::abs(p->pad() - co_p->pad()));
81  // check the match in pad
82  if ((theStation==1 and deltaPad > maxDeltaPadGE11_) or
83  (theStation==2 and deltaPad > maxDeltaPadGE21_)) continue;
84 
85  // check the match in BX
86  if ((unsigned)std::abs(p->bx() - co_p->bx()) > maxDeltaBX_) continue;
87 
88  // make a new coincidence pad digi
89  gemCoPadV.push_back(GEMCoPadDigi(id.roll(),*p,*co_p));
90  }
91  }
92  }
93  }
94  return gemCoPadV;
95 }
96 
97 std::vector<GEMCoPadDigi>
99 {
100  std::unique_ptr<GEMPadDigiCollection> out_pads(new GEMPadDigiCollection());
101  declusterize(in_clusters, *out_pads);
102  return run(out_pads.get());
103 }
104 
105 
106 const std::vector<GEMCoPadDigi>&
108 {
109  return gemCoPadV;
110 }
111 
112 void
114  GEMPadDigiCollection& out_pads)
115 {
117  for (detUnitIt = in_clusters->begin();detUnitIt != in_clusters->end(); ++detUnitIt) {
118  const GEMDetId& id = (*detUnitIt).first;
119  const GEMPadDigiClusterCollection::Range& range = (*detUnitIt).second;
120  for (GEMPadDigiClusterCollection::const_iterator digiIt = range.first; digiIt!=range.second; ++digiIt) {
121  for (auto p: digiIt->pads()){
122  out_pads.insertDigi(id, GEMPadDigi(p, digiIt->bx()));
123  }
124  }
125  }
126 }
T getParameter(std::string const &) const
std::vector< GEMCoPadDigi > run(const GEMPadDigiCollection *)
void declusterize(const GEMPadDigiClusterCollection *, GEMPadDigiCollection &)
Definition: config.py:1
unsigned int maxDeltaRollGE21_
std::vector< GEMCoPadDigi > gemCoPadV
unsigned int maxDeltaPadGE21_
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
unsigned int maxDeltaPadGE11_
unsigned int maxDeltaBX_
MuonDigiCollection< GEMDetId, GEMPadDigi > GEMPadDigiCollection
std::vector< GEMPadDigiCluster >::const_iterator const_iterator
std::pair< const_iterator, const_iterator > Range
unsigned int maxDeltaRollGE11_
const std::vector< GEMCoPadDigi > & readoutCoPads()