14 using namespace rpctechnicaltrigger;
18 m_ptr_rpcGeom = &rpcGeom;
19 m_ptr_digiSimLink = &digiSimLink;
21 m_lbin = std::make_unique<RBCLinkBoardGLSignal>(&m_data);
40 for (m_linkItr = (*m_ptr_digiSimLink)->begin(); m_linkItr != (*m_ptr_digiSimLink)->end(); ++m_linkItr) {
41 for (m_digiItr = m_linkItr->data.begin(); m_digiItr != m_linkItr->data.end(); ++m_digiItr) {
43 std::cout <<
"looping over digis 1 ..." << std::endl;
45 int bx = (*m_digiItr).getBx();
47 if (
abs(bx) >= m_maxBxWindow) {
49 std::cout <<
"RBCProcessRPCSimDigis> found a bx bigger than max allowed: " << bx << std::endl;
53 uint32_t detid = m_digiItr->getDetUnitId();
55 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>((*m_ptr_rpcGeom)->roll(
id));
59 std::cout <<
"RBCProcessRPCSimDigis: roll is forward" << std::endl;
63 int wheel = roll->
id().
ring();
67 int blayer = getBarrelLayer(layer, station);
68 int rollid =
id.roll();
70 int digipos = (station * 100) + (layer * 10) + rollid;
72 if ((wheel == -1 || wheel == 0 || wheel == 1) && station == 2 && layer == 1)
73 digipos = 30000 + digipos;
74 if ((wheel == -2 || wheel == 2) && station == 2 && layer == 2)
75 digipos = 30000 + digipos;
77 if ((wheel == -1 || wheel == 0 || wheel == 1) && station == 2 && layer == 2)
78 digipos = 20000 + digipos;
79 if ((wheel == -2 || wheel == 2) && station == 2 && layer == 1)
80 digipos = 20000 + digipos;
83 std::cout <<
"Bx: " << bx <<
'\t' <<
"Wheel: " << wheel <<
'\t' <<
"Sector: " << sector <<
'\t'
84 <<
"Station: " << station <<
'\t' <<
"Layer: " << layer <<
'\t' <<
"B-Layer: " << blayer <<
'\t'
85 <<
"Roll id: " << rollid <<
'\t' <<
"Digi at: " << digipos <<
'\n';
88 auto itr = m_vecDataperBx.find(bx);
90 if (itr == m_vecDataperBx.end()) {
92 std::cout <<
"Found a new Bx: " << bx << std::endl;
93 auto& wheelData = m_vecDataperBx[
bx];
95 auto&
block = wheelData[(wheel + 2)];
96 setDigiAt(sector, digipos,
block);
98 auto&
block = (*itr).second[(wheel + 2)];
99 setDigiAt(sector, digipos,
block);
103 std::cout <<
"looping over digis 2 ..." << std::endl;
110 std::cout <<
"size of data vectors: " << m_vecDataperBx.size() << std::endl;
120 std::cout <<
"RBCProcessRPCSimDigis: DataSize: " << m_data.size() <<
" ndigis " << ndigis << std::endl;
134 constexpr
int maxWheels = 5;
135 constexpr
int maxRbcBrds = 6;
137 dataVec.reserve(maxWheels);
138 for (
int i = 0;
i < maxWheels; ++
i) {
139 auto&
block = dataVec.emplace_back();
143 for (
int j = 0;
j < maxRbcBrds; ++
j) {
146 block.m_orsignals[
j].input_sec[0].reset();
147 block.m_orsignals[
j].input_sec[1].reset();
148 block.m_orsignals[
j].needmapping =
false;
149 block.m_orsignals[
j].hasData =
false;
154 std::cout <<
"initialize: completed" << std::endl;
160 for (
auto& dataPerBx : m_vecDataperBx) {
161 int bx = dataPerBx.first;
165 bxsign = (bx /
abs(bx));
169 for (
auto&
item : dataPerBx.second) {
170 for (
int k = 0;
k < 6; ++
k) {
171 code = bxsign * (1000000 *
abs(bx) + 10000 *
item.wheelIdx() + 100 *
item.m_sec1[
k] + 1 *
item.m_sec2[
k]);
174 signal->needmapping =
false;
177 m_data.insert(std::make_pair(code, signal));
182 if (m_debug and not m_vecDataperBx.empty())
183 std::cout <<
"builddata: completed. size of data: " << m_data.size() << std::endl;
191 blayer = ((_station - 1) * 2) + _layer;
193 blayer = _station + 2;
213 for (pos = 0; pos < 6; ++pos) {
214 if (block.
m_sec1[pos] == sector || block.
m_sec2[pos] == sector)
221 setInputBit(block.
m_orsignals[pos].input_sec[isAoB], digipos);
229 std::cout <<
"setDigiAt completed" << std::endl;
235 std::cout <<
"Bitpos: " << bitpos << std::endl;
236 signals.set(bitpos,
true);
240 std::cout <<
"RBCProcessRPCSimDigis> Output starts" << std::endl;
242 std::map<int, RBCInput*>::const_iterator itr;
243 for (itr = m_data.begin(); itr != m_data.end(); ++itr) {
244 std::cout << (*itr).first <<
'\t' << (*(*itr).second) <<
'\n';
247 std::cout <<
"RBCProcessRPCSimDigis> Output ends" << std::endl;
static AlgebraicMatrix initialize()
constexpr std::array< int, 6 > s_sec2id
std::array< int, 6 > m_sec1
uint16_t *__restrict__ id
constexpr std::array< int, 6 > s_sec1id
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
~RBCProcessRPCSimDigis() override
Destructor.
RBCProcessRPCSimDigis()
Standard constructor.
int getBarrelLayer(const int &, const int &)
void setDigiAt(int, int, RPCData &)
Abs< T >::type abs(const T &t)
void initialize(std::vector< RPCData > &)
const std::map< int, int > s_layermap
void setInputBit(std::bitset< 15 > &, int)
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
std::array< RBCInput, 6 > m_orsignals
void reset(double vett[256])
std::array< int, 6 > m_sec2