113 int bx = (*m_digiItr).getBx();
116 if (
m_debug )
std::cout <<
"RBCProcessRPCSimDigis> found a bx bigger than max allowed: "
121 uint32_t detid =
m_digiItr->getDetUnitId();
123 const RPCRoll * roll =
dynamic_cast<const RPCRoll*
>( (*m_ptr_rpcGeom)->roll(
id));
126 if(
m_debug )
std::cout <<
"RBCProcessRPCSimDigis: roll is forward" << std::endl;
130 int wheel = roll->
id().
ring();
132 int layer = roll->
id().
layer();
135 int rollid =
id.roll();
137 int digipos = (station * 100) + (layer * 10) + rollid;
139 if ( (wheel == -1 || wheel == 0 || wheel == 1) && station == 2 && layer == 1 )
140 digipos = 30000 + digipos;
141 if ( (wheel == -2 || wheel == 2) && station == 2 && layer == 2 )
142 digipos = 30000 + digipos;
144 if ( (wheel == -1 || wheel == 0 || wheel == 1) && station == 2 && layer == 2 )
145 digipos = 20000 + digipos;
146 if ( (wheel == -2 || wheel == 2) && station == 2 && layer == 1 )
147 digipos = 20000 + digipos;
150 <<
"Wheel: " << wheel <<
'\t'
151 <<
"Sector: " << sector <<
'\t'
152 <<
"Station: " << station <<
'\t'
153 <<
"Layer: " << layer <<
'\t'
154 <<
"B-Layer: " << blayer <<
'\t'
155 <<
"Roll id: " << rollid <<
'\t'
156 <<
"Digi at: " << digipos <<
'\n';
159 std::map<int,std::vector<RPCData*> >::iterator itr;
164 std::vector<RPCData*> wheelData;
167 this->
m_block = wheelData[ (wheel + 2) ];
171 this->
m_block = (*itr).second[ (wheel + 2) ];
193 <<
" ndigis " << ndigis << std::endl;
195 if (
m_data.size() <= 0 )
return 0;
204 std::map<int,std::vector<RPCData*> >::iterator itr1;
206 std::vector<RPCData*>::iterator itr2;
207 for(itr2 = (*itr1).second.begin(); itr2 != (*itr1).second.end();++itr2 )
208 if ( (*itr2) )
delete *itr2;
209 (*itr1).second.clear();
224 for(
int i=0;
i < maxWheels; ++
i) {
230 for(
int j=0;
j < maxRbcBrds; ++
j) {
253 std::vector<RPCData*>::iterator itr;
254 std::map<int, std::vector<RPCData*> >::iterator itr2;
263 if ( bx != 0 ) bxsign = ( bx /
abs(bx) );
266 for(itr = (*itr2).second.begin(); itr != (*itr2).second.end(); ++itr) {
268 for(
int k=0;
k < 6; ++
k) {
270 code = bxsign * ( 1000000*
abs(bx)
271 + 10000*(*itr)->wheelIdx()
272 + 100 *(*itr)->m_sec1[
k]
273 + 1 *(*itr)->m_sec2[
k] );
276 RBCInput * signal = & (*itr)->m_orsignals[
k];
279 if ( signal->hasData )
280 m_data.insert( std::make_pair( code , signal) );
299 if ( _station < 3 ) {
300 blayer = ( (_station-1) * 2 ) + _layer;
303 blayer = _station + 2;
319 std::vector<int>::const_iterator itr;
327 for ( pos = 0; pos < 6; ++pos ) {
328 if (this->
m_block->
m_sec1[pos] == sector || this->m_block->m_sec2[pos] == sector )
349 signals.set( bitpos , 1 );
356 std::cout <<
"RBCProcessRPCSimDigis> Output starts" << std::endl;
358 std::map<int,RBCInput*>::const_iterator itr;
359 for( itr =
m_data.begin(); itr !=
m_data.end(); ++itr) {
360 std::cout << (*itr).first <<
'\t' << (* (*itr).second ) <<
'\n';
363 std::cout <<
"RBCProcessRPCSimDigis> Output ends" << std::endl;
std::vector< int > m_sec2id
virtual ~RBCProcessRPCSimDigis()
Destructor.
std::map< int, int > m_layermap
std::map< int, RBCInput * > m_data
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const edm::Handle< edm::DetSetVector< RPCDigiSimLink > > * m_ptr_digiSimLink
RBCProcessRPCSimDigis()
Standard constructor.
std::vector< int > m_wheelid
int getBarrelLayer(const int &, const int &)
Abs< T >::type abs(const T &t)
void initialize(std::vector< RPCData * > &)
iterator end()
Return the off-the-end iterator.
void setInputBit(std::bitset< 15 > &, int)
const edm::ESHandle< RPCGeometry > * m_ptr_rpcGeom
edm::DetSet< RPCDigiSimLink >::const_iterator m_digiItr
std::map< int, std::vector< RPCData * > > m_vecDataperBx
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
iterator begin()
Return an iterator to the first DetSet.
edm::DetSetVector< RPCDigiSimLink >::const_iterator m_linkItr
std::vector< int > m_sec1id