13 using namespace rpctechnicaltrigger;
20 : m_maxBxWindow{3}, m_debug{
false} {
21 m_ptr_rpcGeom = &rpcGeom;
22 m_ptr_digiColl = &digiColl;
24 m_lbin = std::make_unique<RBCLinkBoardGLSignal>(&m_data);
49 std::cout <<
"looping over digis 1 ..." << std::endl;
51 auto digiItr = detUnit.second.first;
52 int bx = (*digiItr).bx();
56 std::cout <<
"RBCProcessRPCDigis> found a bx bigger than max allowed: " << bx << std::endl;
61 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>((*m_ptr_rpcGeom)->roll(
id));
65 std::cout <<
"RBCProcessRPCDigis: roll is forward" << std::endl;
69 int wheel = roll->
id().
ring();
74 int rollid =
id.roll();
76 int digipos = (station * 100) + (layer * 10) + rollid;
78 if ((wheel == -1 || wheel == 0 || wheel == 1) && station == 2 && layer == 1)
79 digipos = 30000 + digipos;
80 if ((wheel == -2 || wheel == 2) && station == 2 && layer == 2)
81 digipos = 30000 + digipos;
83 if ((wheel == -1 || wheel == 0 || wheel == 1) && station == 2 && layer == 2)
84 digipos = 20000 + digipos;
85 if ((wheel == -2 || wheel == 2) && station == 2 && layer == 1)
86 digipos = 20000 + digipos;
89 std::cout <<
"Bx: " << bx <<
'\t' <<
"Wheel: " << wheel <<
'\t' <<
"Sector: " << sector <<
'\t'
90 <<
"Station: " << station <<
'\t' <<
"Layer: " << layer <<
'\t' <<
"B-Layer: " << blayer <<
'\t'
91 <<
"Roll id: " << rollid <<
'\t' <<
"Digi at: " << digipos <<
'\n';
98 std::cout <<
"Found a new Bx: " << bx << std::endl;
101 setDigiAt(sector, digipos, wheelData[(wheel + 2)]);
103 setDigiAt(sector, digipos, (*itr).second[(wheel + 2)]);
109 (*wheelCounter).second.incrementSector(sector);
112 std::cout <<
"looping over digis 2 ..." << std::endl;
128 std::cout <<
"RBCProcessRPCDigis: DataSize: " <<
m_data.size() <<
" ndigis " << ndigis << std::endl;
131 wheelCounter.second.evalCounters();
133 wheelCounter.second.printSummary();
148 constexpr
int maxWheels = 5;
149 constexpr
int maxRbcBrds = 6;
151 dataVec.reserve(maxWheels);
152 for (
int i = 0;
i < maxWheels; ++
i) {
153 auto&
block = dataVec.emplace_back();
157 for (
int j = 0;
j < maxRbcBrds; ++
j) {
160 block.m_orsignals[
j].input_sec[0].reset();
161 block.m_orsignals[
j].input_sec[1].reset();
162 block.m_orsignals[
j].needmapping =
false;
163 block.m_orsignals[
j].hasData =
false;
168 std::cout <<
"initialize: completed" << std::endl;
173 int bx = vecData.first;
177 bxsign = (bx /
abs(bx));
181 for (
auto&
item : vecData.second) {
182 for (
int k = 0;
k < 6; ++
k) {
183 int code = bxsign * (1000000 *
abs(bx) + 10000 *
item.wheelIdx() + 100 *
item.m_sec1[
k] + 1 *
item.m_sec2[
k]);
186 signal->needmapping =
false;
189 m_data.emplace(code, signal);
194 if (
m_debug and not m_vecDataperBx.empty())
195 std::cout <<
"builddata: completed. size of data: " <<
m_data.size() << std::endl;
203 blayer = ((_station - 1) * 2) + _layer;
205 blayer = _station + 2;
225 for (pos = 0; pos < 6; ++pos) {
226 if (block.
m_sec1[pos] == sector || block.
m_sec2[pos] == sector)
241 std::cout <<
"setDigiAt completed" << std::endl;
247 std::cout <<
"Bitpos: " << bitpos << std::endl;
248 signals.set(bitpos,
true);
252 std::cout <<
"RBCProcessRPCDigis> Output starts" << std::endl;
258 std::cout <<
"RBCProcessRPCDigis> Output ends" << std::endl;
constexpr std::array< int, 6 > s_sec2id
void setInputBit(std::bitset< 15 > &, int)
std::array< int, 6 > m_sec1
constexpr std::array< int, 6 > s_sec1id
void initialize(std::vector< RPCData > &) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
constexpr std::array< int, 5 > s_wheelid
constexpr std::array< uint8_t, layerIndexSize > layer
std::map< int, std::vector< RPCData > > m_vecDataperBx
Abs< T >::type abs(const T &t)
const std::map< int, int > s_layermap
std::map< int, RBCInput * > m_data
const edm::Handle< RPCDigiCollection > * m_ptr_digiColl
RBCProcessRPCDigis(const edm::ESHandle< RPCGeometry > &, const edm::Handle< RPCDigiCollection > &)
Standard constructor.
std::map< int, l1trigger::Counters > m_digiCounters
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
void setDigiAt(int, int, RPCData &)
std::array< RBCInput, 6 > m_orsignals
int getBarrelLayer(const int &, const int &)
~RBCProcessRPCDigis() override
Destructor.
std::array< int, 6 > m_sec2