21 m_ptr_rpcGeom = & rpcGeom;
22 m_ptr_digiSimLink = & digiSimLink;
24 m_lbin = std::make_unique<RBCLinkBoardGLSignal>( &m_data ) ;
47 for( m_linkItr = (*m_ptr_digiSimLink)->begin();
48 m_linkItr != (*m_ptr_digiSimLink)->end();
51 for ( m_digiItr = m_linkItr->data.begin();
52 m_digiItr != m_linkItr->data.end();
55 if ( m_debug )
std::cout <<
"looping over digis 1 ..." << std::endl;
57 int bx = (*m_digiItr).getBx();
59 if (
abs(bx) >= m_maxBxWindow ) {
60 if ( m_debug )
std::cout <<
"RBCProcessRPCSimDigis> found a bx bigger than max allowed: " 65 uint32_t detid = m_digiItr->getDetUnitId();
67 const RPCRoll * roll =
dynamic_cast<const RPCRoll*
>( (*m_ptr_rpcGeom)->roll(
id));
70 if( m_debug )
std::cout <<
"RBCProcessRPCSimDigis: roll is forward" << std::endl;
78 int blayer = getBarrelLayer( layer, station );
79 int rollid =
id.roll();
81 int digipos = (station * 100) + (layer * 10) + rollid;
83 if ( (wheel == -1 || wheel == 0 || wheel == 1) && station == 2 && layer == 1 )
84 digipos = 30000 + digipos;
85 if ( (wheel == -2 || wheel == 2) && station == 2 && layer == 2 )
86 digipos = 30000 + digipos;
88 if ( (wheel == -1 || wheel == 0 || wheel == 1) && station == 2 && layer == 2 )
89 digipos = 20000 + digipos;
90 if ( (wheel == -2 || wheel == 2) && station == 2 && layer == 1 )
91 digipos = 20000 + digipos;
93 if ( m_debug )
std::cout <<
"Bx: " << bx <<
'\t' 94 <<
"Wheel: " << wheel <<
'\t' 95 <<
"Sector: " << sector <<
'\t' 96 <<
"Station: " << station <<
'\t' 97 <<
"Layer: " << layer <<
'\t' 98 <<
"B-Layer: " << blayer <<
'\t' 99 <<
"Roll id: " << rollid <<
'\t' 100 <<
"Digi at: " << digipos <<
'\n';
103 auto itr = m_vecDataperBx.find( bx );
105 if ( itr == m_vecDataperBx.end() ) {
106 if ( m_debug )
std::cout <<
"Found a new Bx: " << bx << std::endl;
107 auto& wheelData = m_vecDataperBx[bx];
109 auto&
block = wheelData[ (wheel + 2) ];
110 setDigiAt( sector, digipos,
block );
113 auto&
block = (*itr).second[ (wheel + 2) ];
114 setDigiAt( sector, digipos,
block );
117 if ( m_debug )
std::cout <<
"looping over digis 2 ..." << std::endl;
125 if ( m_debug )
std::cout <<
"size of data vectors: " << m_vecDataperBx.size() << std::endl;
134 if ( m_debug )
std::cout <<
"RBCProcessRPCSimDigis: DataSize: " << m_data.size()
135 <<
" ndigis " << ndigis << std::endl;
137 if ( m_data.empty() )
return 0;
146 m_vecDataperBx.clear();
154 if ( m_debug )
std::cout <<
"initialize" << std::endl;
159 dataVec.reserve(maxWheels);
160 for(
int i=0;
i < maxWheels; ++
i) {
162 auto&
block = dataVec.emplace_back();
166 for(
int j=0; j < maxRbcBrds; ++j) {
169 block.m_orsignals[j].input_sec[0].reset();
170 block.m_orsignals[j].input_sec[1].reset();
171 block.m_orsignals[j].needmapping =
false;
172 block.m_orsignals[j].hasData =
false;
176 if ( m_debug )
std::cout <<
"initialize: completed" << std::endl;
185 for(
auto& dataPerBx: m_vecDataperBx) {
187 int bx = dataPerBx.first;
190 if ( bx != 0 ) bxsign = ( bx /
abs(bx) );
193 for(
auto& item : dataPerBx.second) {
195 for(
int k=0;
k < 6; ++
k) {
197 code = bxsign * ( 1000000*
abs(bx)
198 + 10000*item.wheelIdx()
199 + 100 *item.m_sec1[
k]
200 + 1 *item.m_sec2[
k] );
203 RBCInput * signal = & item.m_orsignals[
k];
206 if ( signal->hasData )
207 m_data.insert( std::make_pair( code , signal) );
213 if ( m_debug and not m_vecDataperBx.empty())
std::cout <<
"builddata: completed. size of data: " << m_data.size() << std::endl;
223 if ( _station < 3 ) {
224 blayer = ( (_station-1) * 2 ) + _layer;
227 blayer = _station + 2;
241 if ( m_debug )
std::cout <<
"setDigiAt" << std::endl;
250 for ( pos = 0; pos < 6; ++pos ) {
251 if (block.
m_sec1[pos] == sector || block.
m_sec2[pos] == sector )
257 setInputBit( block.
m_orsignals[pos].input_sec[ isAoB ] , digipos );
263 if ( m_debug )
std::cout <<
"setDigiAt completed" << std::endl;
271 if( m_debug )
std::cout <<
"Bitpos: " << bitpos << std::endl;
272 signals.set( bitpos ,
true );
279 std::cout <<
"RBCProcessRPCSimDigis> Output starts" << std::endl;
281 std::map<int,RBCInput*>::const_iterator itr;
282 for( itr = m_data.begin(); itr != m_data.end(); ++itr) {
283 std::cout << (*itr).first <<
'\t' << (* (*itr).second ) <<
'\n';
286 std::cout <<
"RBCProcessRPCSimDigis> Output ends" << std::endl;
static AlgebraicMatrix initialize()
std::array< RBCInput, 6 > m_orsignals
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
~RBCProcessRPCSimDigis() override
Destructor.
constexpr std::array< int, 6 > s_sec2id
RBCProcessRPCSimDigis()
Standard constructor.
int getBarrelLayer(const int &, const int &)
void setDigiAt(int, int, RPCData &)
constexpr std::array< int, 6 > s_sec1id
Abs< T >::type abs(const T &t)
void initialize(std::vector< RPCData > &)
const std::map< int, int > s_layermap
constexpr std::array< int, 5 > s_wheelid
void setInputBit(std::bitset< 15 > &, int)
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
std::array< int,6 > m_sec2
void reset(double vett[256])
std::array< int, 6 > m_sec1