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 build for ME0
37  // -> ignore hits from station 0
38  if (id.station() == 0)
39  continue;
40 
41  // same chamber (no restriction on the roll number)
42  if (id.region() != theRegion or id.station() != theStation or id.chamber() != theChamber)
43  continue;
44 
45  // all coincidences detIDs will have layer=1
46  if (id.layer() != 1)
47  continue;
48 
49  // find all corresponding ids with layer 2 and same roll that differs at most maxDeltaRoll_
50  for (unsigned int roll = id.roll() - maxDeltaRoll_; roll <= id.roll() + maxDeltaRoll_; ++roll) {
51  GEMDetId co_id(id.region(), id.ring(), id.station(), 2, id.chamber(), roll);
52 
53  auto co_pads_range = in_pads->get(co_id);
54 
55  // empty range = no possible coincidence pads
56  if (co_pads_range.first == co_pads_range.second)
57  continue;
58 
59  // now let's correlate the pads in two layers of this partition
60  const auto& pads_range = (*det_range).second;
61  for (auto p = pads_range.first; p != pads_range.second; ++p) {
62  for (auto co_p = co_pads_range.first; co_p != co_pads_range.second; ++co_p) {
63  // check the match in pad
64  if ((unsigned)std::abs(p->pad() - co_p->pad()) > maxDeltaPad_)
65  continue;
66 
67  // check the match in BX
68  if ((unsigned)std::abs(p->bx() - co_p->bx()) > maxDeltaBX_)
69  continue;
70 
71  // make a new coincidence pad digi
72  gemCoPadV.push_back(GEMCoPadDigi(id.roll(), *p, *co_p));
73  }
74  }
75  }
76  }
77  return gemCoPadV;
78 }
79 
80 std::vector<GEMCoPadDigi> GEMCoPadProcessor::run(const GEMPadDigiClusterCollection* in_clusters) {
81  std::unique_ptr<GEMPadDigiCollection> out_pads(new GEMPadDigiCollection());
82  declusterize(in_clusters, *out_pads);
83  return run(out_pads.get());
84 }
85 
86 const std::vector<GEMCoPadDigi>& GEMCoPadProcessor::readoutCoPads() const { return gemCoPadV; }
87 
89  GEMPadDigiCollection& out_pads) const {
90  for (auto detUnitIt = in_clusters->begin(); detUnitIt != in_clusters->end(); ++detUnitIt) {
91  const GEMDetId& id = (*detUnitIt).first;
92  const auto& range = (*detUnitIt).second;
93  for (auto digiIt = range.first; digiIt != range.second; ++digiIt) {
94  for (const auto& p : digiIt->pads()) {
95  out_pads.insertDigi(id, GEMPadDigi(p, digiIt->bx()));
96  }
97  }
98  }
99 }
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
MessageLogger.h
GEMCoPadProcessor::maxDeltaPad_
unsigned int maxDeltaPad_
Definition: GEMCoPadProcessor.h:56
GEMPadDigi
Definition: GEMPadDigi.h:15
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
GEMCoPadProcessor::declusterize
void declusterize(const GEMPadDigiClusterCollection *, GEMPadDigiCollection &) const
Definition: GEMCoPadProcessor.cc:88
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
GEMCoPadDigi
Definition: GEMCoPadDigi.h:16
edm::ParameterSet
Definition: ParameterSet.h:36
GEMDetId
Definition: GEMDetId.h:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
GEMCoPadProcessor::readoutCoPads
const std::vector< GEMCoPadDigi > & readoutCoPads() const
Definition: GEMCoPadProcessor.cc:86
GEMCoPadProcessor::maxDeltaRoll_
unsigned int maxDeltaRoll_
Definition: GEMCoPadProcessor.h:58
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
HLT_2018_cff.region
region
Definition: HLT_2018_cff.py:81479
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
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