CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
RBCProcessRPCSimDigis Class Reference

#include <interface/RBCProcessRPCSimDigis.h>

Inheritance diagram for RBCProcessRPCSimDigis:
ProcessInputSignal

Public Member Functions

void builddata ()
 
void configure ()
 
void initialize (std::vector< RPCData * > &)
 
int next ()
 
void print_output ()
 
 RBCProcessRPCSimDigis ()
 Standard constructor. More...
 
 RBCProcessRPCSimDigis (const edm::ESHandle< RPCGeometry > &, const edm::Handle< edm::DetSetVector< RPCDigiSimLink > > &)
 
void reset ()
 
RPCInputSignalretrievedata ()
 
void rewind ()
 
void showfirst ()
 
virtual ~RBCProcessRPCSimDigis ()
 Destructor. More...
 
- Public Member Functions inherited from ProcessInputSignal
virtual ~ProcessInputSignal ()
 

Private Member Functions

int getBarrelLayer (const int &, const int &)
 
void setDigiAt (int, int)
 
void setInputBit (std::bitset< 15 > &, int)
 

Private Attributes

RPCDatam_block
 
std::map< int, RBCInput * > m_data
 
bool m_debug
 
edm::DetSet< RPCDigiSimLink >
::const_iterator 
m_digiItr
 
std::map< int, int > m_layermap
 
RPCInputSignalm_lbin
 
edm::DetSetVector
< RPCDigiSimLink >
::const_iterator 
m_linkItr
 
int m_maxBxWindow
 
const edm::Handle
< edm::DetSetVector
< RPCDigiSimLink > > * 
m_ptr_digiSimLink
 
const edm::ESHandle
< RPCGeometry > * 
m_ptr_rpcGeom
 
std::vector< int > m_sec1id
 
std::vector< int > m_sec2id
 
std::map< int, std::vector
< RPCData * > > 
m_vecDataperBx
 
std::vector< int > m_wheelid
 

Detailed Description

Author
Andres Felipe Osorio Oliveros
Date
2009-09-20

Definition at line 39 of file RBCProcessRPCSimDigis.h.

Constructor & Destructor Documentation

RBCProcessRPCSimDigis::RBCProcessRPCSimDigis ( )

Standard constructor.

RBCProcessRPCSimDigis::RBCProcessRPCSimDigis ( const edm::ESHandle< RPCGeometry > &  rpcGeom,
const edm::Handle< edm::DetSetVector< RPCDigiSimLink > > &  digiSimLink 
)

Definition at line 14 of file RBCProcessRPCSimDigis.cc.

References configure(), m_data, m_debug, m_lbin, m_ptr_digiSimLink, and m_ptr_rpcGeom.

16 {
17 
18  m_ptr_rpcGeom = & rpcGeom;
19  m_ptr_digiSimLink = & digiSimLink;
20 
21  m_lbin = dynamic_cast<RPCInputSignal*>( new RBCLinkBoardGLSignal( &m_data ) );
22 
23  m_debug = false;
24 
25  configure();
26 
27 }
std::map< int, RBCInput * > m_data
const edm::Handle< edm::DetSetVector< RPCDigiSimLink > > * m_ptr_digiSimLink
const edm::ESHandle< RPCGeometry > * m_ptr_rpcGeom
RBCProcessRPCSimDigis::~RBCProcessRPCSimDigis ( )
virtual

Destructor.

Definition at line 81 of file RBCProcessRPCSimDigis.cc.

References m_layermap, m_lbin, m_sec1id, m_sec2id, m_wheelid, and reset().

81  {
82 
83  if ( m_lbin ) delete m_lbin;
84 
85  m_sec1id.clear();
86  m_sec2id.clear();
87  m_wheelid.clear();
88  m_layermap.clear();
89 
90  reset();
91 
92 }
std::vector< int > m_sec2id
std::map< int, int > m_layermap
std::vector< int > m_wheelid
std::vector< int > m_sec1id

Member Function Documentation

void RBCProcessRPCSimDigis::builddata ( )

Definition at line 247 of file RBCProcessRPCSimDigis.cc.

References funct::abs(), gather_cfg::cout, gen::k, m_data, m_debug, m_vecDataperBx, and RBCInput::needmapping.

Referenced by next().

248 {
249 
250  int bx(0);
251  int code(0);
252  int bxsign(1);
253  std::vector<RPCData*>::iterator itr;
254  std::map<int, std::vector<RPCData*> >::iterator itr2;
255 
256  itr2 = m_vecDataperBx.begin();
257  if( itr2 == ( m_vecDataperBx.end() ) ) return;
258 
259  while ( itr2 != m_vecDataperBx.end() ) {
260 
261  bx = (*itr2).first;
262 
263  if ( bx != 0 ) bxsign = ( bx / abs(bx) );
264  else bxsign = 1;
265 
266  for(itr = (*itr2).second.begin(); itr != (*itr2).second.end(); ++itr) {
267 
268  for(int k=0; k < 6; ++k) {
269 
270  code = bxsign * ( 1000000*abs(bx)
271  + 10000*(*itr)->wheelIdx()
272  + 100 *(*itr)->m_sec1[k]
273  + 1 *(*itr)->m_sec2[k] );
274 
275 
276  RBCInput * signal = & (*itr)->m_orsignals[k];
277  signal->needmapping = false;
278 
279  if ( signal->hasData )
280  m_data.insert( std::make_pair( code , signal) );
281 
282  }
283  }
284 
285  ++itr2;
286 
287  }
288 
289  if ( m_debug ) std::cout << "builddata: completed. size of data: " << m_data.size() << std::endl;
290 
291 }
std::map< int, RBCInput * > m_data
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int k[5][pyjets_maxn]
bool needmapping
Definition: RBCInput.h:75
std::map< int, std::vector< RPCData * > > m_vecDataperBx
tuple cout
Definition: gather_cfg.py:121
void RBCProcessRPCSimDigis::configure ( )

Definition at line 29 of file RBCProcessRPCSimDigis.cc.

References m_layermap, m_maxBxWindow, m_sec1id, m_sec2id, and m_wheelid.

Referenced by RBCProcessRPCSimDigis().

30 {
31 
32  m_wheelid.push_back(-2); //-2
33  m_wheelid.push_back(-1); //-1
34  m_wheelid.push_back(0); // 0
35  m_wheelid.push_back( 1); //+1
36  m_wheelid.push_back( 2); //+2
37 
38  m_sec1id.push_back(12);
39  m_sec2id.push_back(1);
40  m_sec1id.push_back(2);
41  m_sec2id.push_back(3);
42  m_sec1id.push_back(4);
43  m_sec2id.push_back(5);
44  m_sec1id.push_back(6);
45  m_sec2id.push_back(7);
46  m_sec1id.push_back(8);
47  m_sec2id.push_back(9);
48  m_sec1id.push_back(10);
49  m_sec2id.push_back(11);
50 
51  m_layermap[113] = 0; //RB1InFw
52  m_layermap[123] = 1; //RB1OutFw
53 
54  m_layermap[20213] = 2; //RB22Fw
55  m_layermap[20223] = 2; //RB22Fw
56  m_layermap[30223] = 3; //RB23Fw
57  m_layermap[30213] = 3; //RB23Fw
58  m_layermap[30212] = 4; //RB23M
59  m_layermap[30222] = 4; //RB23M
60 
61  m_layermap[313] = 5; //RB3Fw
62  m_layermap[413] = 6; //RB4Fw
63  m_layermap[111] = 7; //RB1InBk
64  m_layermap[121] = 8; //RB1OutBk
65 
66  m_layermap[20211] = 9; //RB22Bw
67  m_layermap[20221] = 9; //RB22Bw
68  m_layermap[30211] = 10; //RB23Bw
69  m_layermap[30221] = 10; //RB23Bw
70 
71  m_layermap[311] = 11; //RB3Bk
72  m_layermap[411] = 12; //RB4Bk
73 
74  m_maxBxWindow = 3;
75 
76 }
std::vector< int > m_sec2id
std::map< int, int > m_layermap
std::vector< int > m_wheelid
std::vector< int > m_sec1id
int RBCProcessRPCSimDigis::getBarrelLayer ( const int &  _layer,
const int &  _station 
)
private

Definition at line 293 of file RBCProcessRPCSimDigis.cc.

Referenced by next().

294 {
295 
296  //... Calculates the generic Barrel Layer (1 to 6)
297  int blayer(0);
298 
299  if ( _station < 3 ) {
300  blayer = ( (_station-1) * 2 ) + _layer;
301  }
302  else {
303  blayer = _station + 2;
304  }
305 
306  return blayer;
307 
308 }
void RBCProcessRPCSimDigis::initialize ( std::vector< RPCData * > &  dataVec)

Definition at line 216 of file RBCProcessRPCSimDigis.cc.

References gather_cfg::cout, RBCInput::hasData, i, RBCInput::input_sec, j, m_block, m_debug, RPCData::m_orsignals, RPCData::m_sec1, m_sec1id, RPCData::m_sec2, m_sec2id, RPCData::m_wheel, m_wheelid, and RBCInput::needmapping.

Referenced by next().

217 {
218 
219  if ( m_debug ) std::cout << "initialize" << std::endl;
220 
221  int maxWheels = 5;
222  int maxRbcBrds = 6;
223 
224  for(int i=0; i < maxWheels; ++i) {
225 
226  m_block = new RPCData();
227 
229 
230  for(int j=0; j < maxRbcBrds; ++j) {
231  m_block->m_sec1[j] = m_sec1id[j];
232  m_block->m_sec2[j] = m_sec2id[j];
233  m_block->m_orsignals[j].input_sec[0].reset();
234  m_block->m_orsignals[j].input_sec[1].reset();
235  m_block->m_orsignals[j].needmapping = false;
236  m_block->m_orsignals[j].hasData = false;
237  }
238 
239  dataVec.push_back( m_block );
240 
241  }
242 
243  if ( m_debug ) std::cout << "initialize: completed" << std::endl;
244 
245 }
int i
Definition: DBlmapReader.cc:9
RBCInput * m_orsignals
Definition: RPCData.h:55
std::vector< int > m_sec2id
int * m_sec2
Definition: RPCData.h:54
std::vector< int > m_wheelid
int j
Definition: DBlmapReader.cc:9
std::bitset< 15 > * input_sec
Definition: RBCInput.h:64
int m_wheel
Definition: RPCData.h:52
bool needmapping
Definition: RBCInput.h:75
bool hasData
Definition: RBCInput.h:74
tuple cout
Definition: gather_cfg.py:121
std::vector< int > m_sec1id
int * m_sec1
Definition: RPCData.h:53
int RBCProcessRPCSimDigis::next ( void  )
virtual

Implements ProcessInputSignal.

Definition at line 95 of file RBCProcessRPCSimDigis.cc.

References funct::abs(), edm::DetSetVector< T >::begin(), builddata(), gather_cfg::cout, cond::rpcobgas::detid, edm::DetSetVector< T >::end(), getBarrelLayer(), RPCRoll::id(), initialize(), RPCRoll::isForward(), RPCDetId::layer(), m_block, m_data, m_debug, m_digiItr, m_linkItr, m_maxBxWindow, m_vecDataperBx, print_output(), reset(), RPCDetId::ring(), RPCDetId::sector(), setDigiAt(), relativeConstraints::station, and RPCDetId::station().

Referenced by BeautifulSoup.PageElement::_invert().

95  {
96 
97  //...clean up previous data contents
98 
99  reset();
100 
101  int ndigis(0);
102 
103  for( m_linkItr = (*m_ptr_digiSimLink)->begin();
104  m_linkItr != (*m_ptr_digiSimLink)->end();
105  ++m_linkItr ) {
106 
107  for ( m_digiItr = m_linkItr->data.begin();
108  m_digiItr != m_linkItr->data.end();
109  ++m_digiItr ) {
110 
111  if ( m_debug ) std::cout << "looping over digis 1 ..." << std::endl;
112 
113  int bx = (*m_digiItr).getBx();
114 
115  if ( abs(bx) >= m_maxBxWindow ) {
116  if ( m_debug ) std::cout << "RBCProcessRPCSimDigis> found a bx bigger than max allowed: "
117  << bx << std::endl;
118  continue;
119  }
120 
121  uint32_t detid = m_digiItr->getDetUnitId();
122  const RPCDetId id( detid );
123  const RPCRoll * roll = dynamic_cast<const RPCRoll* >( (*m_ptr_rpcGeom)->roll(id));
124 
125  if((roll->isForward())) {
126  if( m_debug ) std::cout << "RBCProcessRPCSimDigis: roll is forward" << std::endl;
127  continue;
128  }
129 
130  int wheel = roll->id().ring(); // -2,-1,0,+1,+2
131  int sector = roll->id().sector(); // 1 to 12
132  int layer = roll->id().layer(); // 1,2
133  int station = roll->id().station(); // 1-4
134  int blayer = getBarrelLayer( layer, station ); // 1 to 6
135  int rollid = id.roll();
136 
137  int digipos = (station * 100) + (layer * 10) + rollid;
138 
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;
143 
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;
148 
149  if ( m_debug ) std::cout << "Bx: " << bx << '\t'
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';
157 
158  //... Construct the RBCinput objects
159  std::map<int,std::vector<RPCData*> >::iterator itr;
160  itr = m_vecDataperBx.find( bx );
161 
162  if ( itr == m_vecDataperBx.end() ) {
163  if ( m_debug ) std::cout << "Found a new Bx: " << bx << std::endl;
164  std::vector<RPCData*> wheelData;
165  initialize(wheelData);
166  m_vecDataperBx[bx] = wheelData;
167  this->m_block = wheelData[ (wheel + 2) ];
168  setDigiAt( sector, digipos );
169  }
170  else{
171  this->m_block = (*itr).second[ (wheel + 2) ];
172  setDigiAt( sector, digipos );
173  }
174 
175  if ( m_debug ) std::cout << "looping over digis 2 ..." << std::endl;
176 
177  ++ndigis;
178 
179  }
180 
181  }
182 
183  if ( m_debug ) std::cout << "size of data vectors: " << m_vecDataperBx.size() << std::endl;
184 
185  builddata();
186 
187  if ( m_debug ) {
188  std::cout << "after reset" << std::endl;
189  print_output();
190  }
191 
192  if ( m_debug ) std::cout << "RBCProcessRPCSimDigis: DataSize: " << m_data.size()
193  << " ndigis " << ndigis << std::endl;
194 
195  if ( m_data.size() <= 0 ) return 0;
196 
197  return 1;
198 
199 }
std::map< int, RBCInput * > m_data
RPCDetId id() const
Definition: RPCRoll.cc:24
int ring() const
Definition: RPCDetId.h:72
int getBarrelLayer(const int &, const int &)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void initialize(std::vector< RPCData * > &)
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:363
int layer() const
Definition: RPCDetId.h:108
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)
Definition: RPCDetId.h:102
tuple cout
Definition: gather_cfg.py:121
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:348
edm::DetSetVector< RPCDigiSimLink >::const_iterator m_linkItr
bool isForward() const
Definition: RPCRoll.cc:98
int station() const
Definition: RPCDetId.h:96
void RBCProcessRPCSimDigis::print_output ( )

Definition at line 353 of file RBCProcessRPCSimDigis.cc.

References gather_cfg::cout, and m_data.

Referenced by next().

354 {
355 
356  std::cout << "RBCProcessRPCSimDigis> Output starts" << std::endl;
357 
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';
361  }
362 
363  std::cout << "RBCProcessRPCSimDigis> Output ends" << std::endl;
364 
365 }
std::map< int, RBCInput * > m_data
tuple cout
Definition: gather_cfg.py:121
void RBCProcessRPCSimDigis::reset ( void  )

Definition at line 201 of file RBCProcessRPCSimDigis.cc.

References m_vecDataperBx.

Referenced by next(), and ~RBCProcessRPCSimDigis().

202 {
203 
204  std::map<int,std::vector<RPCData*> >::iterator itr1;
205  for( itr1 = m_vecDataperBx.begin(); itr1 != m_vecDataperBx.end(); ++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();
210  }
211  m_vecDataperBx.clear();
212 
213 }
std::map< int, std::vector< RPCData * > > m_vecDataperBx
RPCInputSignal* RBCProcessRPCSimDigis::retrievedata ( )
inlinevirtual

Implements ProcessInputSignal.

Definition at line 59 of file RBCProcessRPCSimDigis.h.

References m_lbin.

59  {
60  return m_lbin;
61  };
void RBCProcessRPCSimDigis::rewind ( )
inline

Definition at line 63 of file RBCProcessRPCSimDigis.h.

63 {};
void RBCProcessRPCSimDigis::setDigiAt ( int  sector,
int  digipos 
)
private

Definition at line 311 of file RBCProcessRPCSimDigis.cc.

References gather_cfg::cout, spr::find(), RBCInput::hasData, RBCInput::input_sec, m_block, m_debug, RPCData::m_orsignals, RPCData::m_sec1, m_sec1id, m_sec2id, and setInputBit().

Referenced by next().

312 {
313 
314  int pos = 0;
315  int isAoB = 0;
316 
317  if ( m_debug ) std::cout << "setDigiAt" << std::endl;
318 
319  std::vector<int>::const_iterator itr;
320  itr = std::find( m_sec1id.begin(), m_sec1id.end(), sector );
321 
322  if ( itr == m_sec1id.end()) {
323  itr = std::find( m_sec2id.begin(), m_sec2id.end(), sector );
324  isAoB = 1;
325  }
326 
327  for ( pos = 0; pos < 6; ++pos ) {
328  if (this->m_block->m_sec1[pos] == sector || this->m_block->m_sec2[pos] == sector )
329  break;
330  }
331 
332  if ( m_debug ) std::cout << this->m_block->m_orsignals[pos];
333 
334  setInputBit( this->m_block->m_orsignals[pos].input_sec[ isAoB ] , digipos );
335 
336  this->m_block->m_orsignals[pos].hasData = true;
337 
338  if ( m_debug ) std::cout << this->m_block->m_orsignals[pos];
339 
340  if ( m_debug ) std::cout << "setDigiAt completed" << std::endl;
341 
342 }
RBCInput * m_orsignals
Definition: RPCData.h:55
std::vector< int > m_sec2id
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::bitset< 15 > * input_sec
Definition: RBCInput.h:64
void setInputBit(std::bitset< 15 > &, int)
bool hasData
Definition: RBCInput.h:74
tuple cout
Definition: gather_cfg.py:121
std::vector< int > m_sec1id
int * m_sec1
Definition: RPCData.h:53
void RBCProcessRPCSimDigis::setInputBit ( std::bitset< 15 > &  signals,
int  digipos 
)
private

Definition at line 344 of file RBCProcessRPCSimDigis.cc.

References gather_cfg::cout, m_debug, and m_layermap.

Referenced by setDigiAt().

345 {
346 
347  int bitpos = m_layermap[digipos];
348  if( m_debug ) std::cout << "Bitpos: " << bitpos << std::endl;
349  signals.set( bitpos , 1 );
350 
351 }
std::map< int, int > m_layermap
tuple cout
Definition: gather_cfg.py:121
void RBCProcessRPCSimDigis::showfirst ( )
inline

Definition at line 64 of file RBCProcessRPCSimDigis.h.

64 {};

Member Data Documentation

RPCData* RBCProcessRPCSimDigis::m_block
private

Definition at line 84 of file RBCProcessRPCSimDigis.h.

Referenced by initialize(), next(), and setDigiAt().

std::map<int, RBCInput*> RBCProcessRPCSimDigis::m_data
private

Definition at line 90 of file RBCProcessRPCSimDigis.h.

Referenced by builddata(), next(), print_output(), and RBCProcessRPCSimDigis().

bool RBCProcessRPCSimDigis::m_debug
private
edm::DetSet<RPCDigiSimLink>::const_iterator RBCProcessRPCSimDigis::m_digiItr
private

Definition at line 82 of file RBCProcessRPCSimDigis.h.

Referenced by next().

std::map<int, int> RBCProcessRPCSimDigis::m_layermap
private

Definition at line 88 of file RBCProcessRPCSimDigis.h.

Referenced by configure(), setInputBit(), and ~RBCProcessRPCSimDigis().

RPCInputSignal* RBCProcessRPCSimDigis::m_lbin
private
edm::DetSetVector<RPCDigiSimLink>::const_iterator RBCProcessRPCSimDigis::m_linkItr
private

Definition at line 81 of file RBCProcessRPCSimDigis.h.

Referenced by next().

int RBCProcessRPCSimDigis::m_maxBxWindow
private

Definition at line 95 of file RBCProcessRPCSimDigis.h.

Referenced by configure(), and next().

const edm::Handle<edm::DetSetVector<RPCDigiSimLink> >* RBCProcessRPCSimDigis::m_ptr_digiSimLink
private

Definition at line 79 of file RBCProcessRPCSimDigis.h.

Referenced by RBCProcessRPCSimDigis().

const edm::ESHandle<RPCGeometry>* RBCProcessRPCSimDigis::m_ptr_rpcGeom
private

Definition at line 78 of file RBCProcessRPCSimDigis.h.

Referenced by RBCProcessRPCSimDigis().

std::vector<int> RBCProcessRPCSimDigis::m_sec1id
private

Definition at line 98 of file RBCProcessRPCSimDigis.h.

Referenced by configure(), initialize(), setDigiAt(), and ~RBCProcessRPCSimDigis().

std::vector<int> RBCProcessRPCSimDigis::m_sec2id
private

Definition at line 99 of file RBCProcessRPCSimDigis.h.

Referenced by configure(), initialize(), setDigiAt(), and ~RBCProcessRPCSimDigis().

std::map<int, std::vector<RPCData*> > RBCProcessRPCSimDigis::m_vecDataperBx
private

Definition at line 92 of file RBCProcessRPCSimDigis.h.

Referenced by builddata(), next(), and reset().

std::vector<int> RBCProcessRPCSimDigis::m_wheelid
private

Definition at line 97 of file RBCProcessRPCSimDigis.h.

Referenced by configure(), initialize(), and ~RBCProcessRPCSimDigis().