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  : theRegion(region), theStation(station), theChamber(chamber) {
13  // Verbosity level, set to 0 (no print) by default.
14  infoV = copad.getParameter<unsigned int>("verbosity");
15  maxDeltaPad_ = copad.getParameter<unsigned int>("maxDeltaPad");
16  maxDeltaRoll_ = copad.getParameter<unsigned int>("maxDeltaRoll");
17  maxDeltaBX_ = copad.getParameter<unsigned int>("maxDeltaBX");
18 }
19 
20 GEMCoPadProcessor::GEMCoPadProcessor() : theRegion(1), theStation(1), theChamber(1) {
21  infoV = 0;
22  maxDeltaPad_ = 0;
23  maxDeltaRoll_ = 0;
24  maxDeltaBX_ = 0;
25 }
26 
28 
29 std::vector<GEMCoPadDigi> GEMCoPadProcessor::run(const GEMPadDigiCollection* in_pads) {
30  clear();
31 
32  // Build coincidences
33  for (auto det_range = in_pads->begin(); det_range != in_pads->end(); ++det_range) {
34  const GEMDetId& id = (*det_range).first;
35 
36  // coincidence pads are not built for ME0
37  if (id.isME0())
38  continue;
39 
40  // same chamber (no restriction on the roll number)
41  if (id.region() != theRegion or id.station() != theStation or id.chamber() != theChamber)
42  continue;
43 
44  // all coincidences detIDs will have layer=1
45  if (id.layer() != 1)
46  continue;
47 
48  // find all corresponding ids with layer 2 and same roll that differs at most maxDeltaRoll_
49  for (unsigned int roll = id.roll() - maxDeltaRoll_; roll <= id.roll() + maxDeltaRoll_; ++roll) {
50  GEMDetId co_id(id.region(), id.ring(), id.station(), 2, id.chamber(), roll);
51 
52  auto co_pads_range = in_pads->get(co_id);
53 
54  // empty range = no possible coincidence pads
55  if (co_pads_range.first == co_pads_range.second)
56  continue;
57 
58  // now let's correlate the pads in two layers of this partition
59  const auto& pads_range = (*det_range).second;
60  for (auto p = pads_range.first; p != pads_range.second; ++p) {
61  // ignore 16-partition GE2/1 pads
62  if (id.isGE21() and p->nPartitions() == GEMPadDigi::GE21SplitStrip)
63  continue;
64 
65  // only consider valid pads
66  if (!p->isValid())
67  continue;
68 
69  for (auto co_p = co_pads_range.first; co_p != co_pads_range.second; ++co_p) {
70  // only consider valid pads
71  if (!co_p->isValid())
72  continue;
73 
74  // check the match in pad
75  if ((unsigned)std::abs(p->pad() - co_p->pad()) > maxDeltaPad_)
76  continue;
77 
78  // check the match in BX
79  if ((unsigned)std::abs(p->bx() - co_p->bx()) > maxDeltaBX_)
80  continue;
81 
82  // make a new coincidence pad digi
83  gemCoPadV.push_back(GEMCoPadDigi(id.roll(), *p, *co_p));
84  }
85  }
86  }
87  }
88  return gemCoPadV;
89 }
90 
91 std::vector<GEMCoPadDigi> GEMCoPadProcessor::run(const GEMPadDigiClusterCollection* in_clusters) {
92  std::unique_ptr<GEMPadDigiCollection> out_pads(new GEMPadDigiCollection());
93  declusterize(in_clusters, *out_pads);
94  return run(out_pads.get());
95 }
96 
97 const std::vector<GEMCoPadDigi>& GEMCoPadProcessor::readoutCoPads() const { return gemCoPadV; }
98 
100  GEMPadDigiCollection& out_pads) const {
101  for (auto detUnitIt = in_clusters->begin(); detUnitIt != in_clusters->end(); ++detUnitIt) {
102  const GEMDetId& id = (*detUnitIt).first;
103  const auto& range = (*detUnitIt).second;
104  for (auto digiIt = range.first; digiIt != range.second; ++digiIt) {
105  // coincidence pads are not built for ME0
106  if (id.isME0())
107  continue;
108 
109  // same chamber (no restriction on the roll number)
110  if (id.region() != theRegion or id.station() != theStation or id.chamber() != theChamber)
111  continue;
112 
113  // ignore 16-partition GE2/1 pads
114  if (id.isGE21() and digiIt->nPartitions() == GEMPadDigiCluster::GE21SplitStrip)
115  continue;
116 
117  // only consider valid clusters
118  if (!digiIt->isValid())
119  continue;
120 
121  for (const auto& p : digiIt->pads()) {
122  out_pads.insertDigi(id, GEMPadDigi(p, digiIt->bx()));
123  }
124  }
125  }
126 }
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
MessageLogger.h
GEMCoPadProcessor::maxDeltaPad_
unsigned int maxDeltaPad_
Definition: GEMCoPadProcessor.h:56
GEMPadDigi
Definition: GEMPadDigi.h:17
GEMCoPadProcessor.h
relativeConstraints.station
station
Definition: relativeConstraints.py:67
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
GEMPadDigiCollection
MuonDigiCollection< GEMDetId, GEMPadDigi > GEMPadDigiCollection
Definition: GEMPadDigiCollection.h:13
GEMCoPadProcessor::clear
void clear()
Definition: GEMCoPadProcessor.cc:27
GEMCoPadProcessor::theRegion
const int theRegion
Definition: GEMCoPadProcessor.h:47
GEMCoPadProcessor::run
std::vector< GEMCoPadDigi > run(const GEMPadDigiCollection *)
Definition: GEMCoPadProcessor.cc:29
GEMPadDigi::GE21SplitStrip
Definition: GEMPadDigi.h:22
GEMCoPadProcessor::declusterize
void declusterize(const GEMPadDigiClusterCollection *, GEMPadDigiCollection &) const
Definition: GEMCoPadProcessor.cc:99
GEMCoPadProcessor::theChamber
const int theChamber
Definition: GEMCoPadProcessor.h:49
GEMCoPadProcessor::theStation
const int theStation
Definition: GEMCoPadProcessor.h:48
GEMPadDigiCollection
GEMCoPadProcessor::gemCoPadV
std::vector< GEMCoPadDigi > gemCoPadV
Definition: GEMCoPadProcessor.h:61
GEMCoPadProcessor::GEMCoPadProcessor
GEMCoPadProcessor()
Definition: GEMCoPadProcessor.cc:20
GEMPadDigiClusterCollection
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
GEMCoPadDigi
Definition: GEMCoPadDigi.h:16
edm::ParameterSet
Definition: ParameterSet.h:47
GEMDetId
Definition: GEMDetId.h:18
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88271
GEMCoPadProcessor::readoutCoPads
const std::vector< GEMCoPadDigi > & readoutCoPads() const
Definition: GEMCoPadProcessor.cc:97
GeomDetEnumerators::isME0
bool isME0(GeomDetEnumerators::SubDetector m)
Definition: GeomDetEnumerators.cc:96
GEMCoPadProcessor::maxDeltaRoll_
unsigned int maxDeltaRoll_
Definition: GEMCoPadProcessor.h:58
GEMPadDigiCluster::GE21SplitStrip
Definition: GEMPadDigiCluster.h:24
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
or
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
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
GEMCoPadProcessor::maxDeltaBX_
unsigned int maxDeltaBX_
Definition: GEMCoPadProcessor.h:57
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
GEMCoPadProcessor::infoV
unsigned int infoV
Definition: GEMCoPadProcessor.h:55