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 ring,
14  unsigned chamber,
15  const edm::ParameterSet& copad) :
16  theEndcap(endcap), theStation(station), theRing(ring), theChamber(chamber)
17 {
18  // Verbosity level, set to 0 (no print) by default.
19  infoV = copad.getParameter<unsigned int>("verbosity");
20  maxDeltaPadGE11_ = copad.getParameter<unsigned int>("maxDeltaPadGE11");
21  maxDeltaPadGE21_ = copad.getParameter<unsigned int>("maxDeltaPadGE21");
22  maxDeltaBX_ = copad.getParameter<unsigned int>("maxDeltaBX");
23 }
24 
26  theEndcap(1), theStation(1), theRing(1), theChamber(1)
27 {
28  infoV = 0;
29  maxDeltaPadGE11_ = 0;
30  maxDeltaPadGE21_ = 0;
31  maxDeltaBX_ = 0;
32 }
33 
34 void
36 {
37  gemCoPadV.clear();
38 }
39 
40 std::vector<GEMCoPadDigi>
42 {
43  const int region((theEndcap == 1) ? 1: -1);
44 
45  // Build coincidences
46  for (auto det_range = in_pads->begin(); det_range != in_pads->end(); ++det_range) {
47  const GEMDetId& id = (*det_range).first;
48 
49  // same chamber (no restriction on the roll number)
50  if (id.region() != region or id.station() != theStation or
51  id.ring() != theRing or id.chamber() != theChamber) continue;
52 
53  // all coincidences detIDs will have layer=1
54  if (id.layer() != 1) continue;
55 
56  // find the corresponding id with layer=2 and same roll number
57  GEMDetId co_id(id.region(), id.ring(), id.station(), 2, id.chamber(), id.roll());
58 
59  auto co_pads_range = in_pads->get(co_id);
60  // empty range = no possible coincidence pads
61  if (co_pads_range.first == co_pads_range.second) continue;
62 
63  // now let's correlate the pads in two layers of this partition
64  const auto& pads_range = (*det_range).second;
65  for (auto p = pads_range.first; p != pads_range.second; ++p) {
66  for (auto co_p = co_pads_range.first; co_p != co_pads_range.second; ++co_p) {
67 
68  const unsigned int deltaPad(std::abs(p->pad() - co_p->pad()));
69  // check the match in pad
70  if ((theStation==1 and deltaPad > maxDeltaPadGE11_) or
71  (theStation==2 and deltaPad > maxDeltaPadGE21_)) continue;
72 
73  // check the match in BX
74  if ((unsigned)std::abs(p->bx() - co_p->bx()) > maxDeltaBX_) continue;
75 
76  // make a new coincidence pad digi
77  gemCoPadV.push_back(GEMCoPadDigi(id.roll(),*p,*co_p));
78  }
79  }
80  }
81  return gemCoPadV;
82 }
83 
84 std::vector<GEMCoPadDigi>
86 {
87  std::unique_ptr<GEMPadDigiCollection> out_pads(new GEMPadDigiCollection());
88  declusterize(in_clusters, *out_pads);
89  return run(out_pads.get());
90 }
91 
92 
93 const std::vector<GEMCoPadDigi>&
95 {
96  return gemCoPadV;
97 }
98 
99 void
101  GEMPadDigiCollection& out_pads)
102 {
104  for (detUnitIt = in_clusters->begin();detUnitIt != in_clusters->end(); ++detUnitIt) {
105  const GEMDetId& id = (*detUnitIt).first;
106  const GEMPadDigiClusterCollection::Range& range = (*detUnitIt).second;
107  for (GEMPadDigiClusterCollection::const_iterator digiIt = range.first; digiIt!=range.second; ++digiIt) {
108  for (auto p: digiIt->pads()){
109  out_pads.insertDigi(id, GEMPadDigi(p, digiIt->bx()));
110  }
111  }
112  }
113 }
T getParameter(std::string const &) const
std::vector< GEMCoPadDigi > run(const GEMPadDigiCollection *)
void declusterize(const GEMPadDigiClusterCollection *, GEMPadDigiCollection &)
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
const std::vector< GEMCoPadDigi > & readoutCoPads()