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 40 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 15 of file RBCProcessRPCSimDigis.cc.

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

17 {
18 
19  m_ptr_rpcGeom = & rpcGeom;
20  m_ptr_digiSimLink = & digiSimLink;
21 
22  m_lbin = dynamic_cast<RPCInputSignal*>( new RBCLinkBoardGLSignal( &m_data ) );
23 
24  m_debug = false;
25 
26  configure();
27 
28 }
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 82 of file RBCProcessRPCSimDigis.cc.

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

82  {
83 
84  if ( m_lbin ) delete m_lbin;
85 
86  m_sec1id.clear();
87  m_sec2id.clear();
88  m_wheelid.clear();
89  m_layermap.clear();
90 
91  reset();
92 
93 }
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 248 of file RBCProcessRPCSimDigis.cc.

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

Referenced by next().

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

Definition at line 30 of file RBCProcessRPCSimDigis.cc.

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

Referenced by RBCProcessRPCSimDigis().

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

Referenced by next().

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

Definition at line 217 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().

218 {
219 
220  if ( m_debug ) std::cout << "initialize" << std::endl;
221 
222  int maxWheels = 5;
223  int maxRbcBrds = 6;
224 
225  for(int i=0; i < maxWheels; ++i) {
226 
227  m_block = new RPCData();
228 
230 
231  for(int j=0; j < maxRbcBrds; ++j) {
232  m_block->m_sec1[j] = m_sec1id[j];
233  m_block->m_sec2[j] = m_sec2id[j];
234  m_block->m_orsignals[j].input_sec[0].reset();
235  m_block->m_orsignals[j].input_sec[1].reset();
236  m_block->m_orsignals[j].needmapping = false;
237  m_block->m_orsignals[j].hasData = false;
238  }
239 
240  dataVec.push_back( m_block );
241 
242  }
243 
244  if ( m_debug ) std::cout << "initialize: completed" << std::endl;
245 
246 }
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:65
int m_wheel
Definition: RPCData.h:52
bool needmapping
Definition: RBCInput.h:76
bool hasData
Definition: RBCInput.h:75
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 96 of file RBCProcessRPCSimDigis.cc.

References abs, edm::DetSetVector< T >::begin(), builddata(), gather_cfg::cout, cond::rpcobgas::detid, edm::DetSetVector< T >::end(), getBarrelLayer(), RPCRoll::id(), errorMatrix2Lands_multiChannel::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().

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

Definition at line 354 of file RBCProcessRPCSimDigis.cc.

References gather_cfg::cout, and m_data.

Referenced by next().

355 {
356 
357  std::cout << "RBCProcessRPCSimDigis> Output starts" << std::endl;
358 
359  std::map<int,RBCInput*>::const_iterator itr;
360  for( itr = m_data.begin(); itr != m_data.end(); ++itr) {
361  std::cout << (*itr).first << '\t' << (* (*itr).second ) << '\n';
362  }
363 
364  std::cout << "RBCProcessRPCSimDigis> Output ends" << std::endl;
365 
366 }
std::map< int, RBCInput * > m_data
tuple cout
Definition: gather_cfg.py:121
void RBCProcessRPCSimDigis::reset ( void  )

Definition at line 202 of file RBCProcessRPCSimDigis.cc.

References m_vecDataperBx.

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

203 {
204 
205  std::map<int,std::vector<RPCData*> >::iterator itr1;
206  for( itr1 = m_vecDataperBx.begin(); itr1 != m_vecDataperBx.end(); ++itr1) {
207  std::vector<RPCData*>::iterator itr2;
208  for(itr2 = (*itr1).second.begin(); itr2 != (*itr1).second.end();++itr2 )
209  if ( (*itr2) ) delete *itr2;
210  (*itr1).second.clear();
211  }
212  m_vecDataperBx.clear();
213 
214 }
std::map< int, std::vector< RPCData * > > m_vecDataperBx
RPCInputSignal* RBCProcessRPCSimDigis::retrievedata ( )
inlinevirtual

Implements ProcessInputSignal.

Definition at line 60 of file RBCProcessRPCSimDigis.h.

References m_lbin.

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

Definition at line 64 of file RBCProcessRPCSimDigis.h.

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

Definition at line 312 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, pos, and setInputBit().

Referenced by next().

313 {
314 
315  int pos = 0;
316  int isAoB = 0;
317 
318  if ( m_debug ) std::cout << "setDigiAt" << std::endl;
319 
320  std::vector<int>::const_iterator itr;
321  itr = std::find( m_sec1id.begin(), m_sec1id.end(), sector );
322 
323  if ( itr == m_sec1id.end()) {
324  itr = std::find( m_sec2id.begin(), m_sec2id.end(), sector );
325  isAoB = 1;
326  }
327 
328  for ( pos = 0; pos < 6; ++pos ) {
329  if (this->m_block->m_sec1[pos] == sector || this->m_block->m_sec2[pos] == sector )
330  break;
331  }
332 
333  if ( m_debug ) std::cout << this->m_block->m_orsignals[pos];
334 
335  setInputBit( this->m_block->m_orsignals[pos].input_sec[ isAoB ] , digipos );
336 
337  this->m_block->m_orsignals[pos].hasData = true;
338 
339  if ( m_debug ) std::cout << this->m_block->m_orsignals[pos];
340 
341  if ( m_debug ) std::cout << "setDigiAt completed" << std::endl;
342 
343 }
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:65
void setInputBit(std::bitset< 15 > &, int)
bool hasData
Definition: RBCInput.h:75
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 345 of file RBCProcessRPCSimDigis.cc.

References gather_cfg::cout, m_debug, and m_layermap.

Referenced by setDigiAt().

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

Definition at line 65 of file RBCProcessRPCSimDigis.h.

65 {};

Member Data Documentation

RPCData* RBCProcessRPCSimDigis::m_block
private

Definition at line 85 of file RBCProcessRPCSimDigis.h.

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

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

Definition at line 91 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 83 of file RBCProcessRPCSimDigis.h.

Referenced by next().

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

Definition at line 89 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 82 of file RBCProcessRPCSimDigis.h.

Referenced by next().

int RBCProcessRPCSimDigis::m_maxBxWindow
private

Definition at line 96 of file RBCProcessRPCSimDigis.h.

Referenced by configure(), and next().

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

Definition at line 80 of file RBCProcessRPCSimDigis.h.

Referenced by RBCProcessRPCSimDigis().

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

Definition at line 79 of file RBCProcessRPCSimDigis.h.

Referenced by RBCProcessRPCSimDigis().

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

Definition at line 99 of file RBCProcessRPCSimDigis.h.

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

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

Definition at line 100 of file RBCProcessRPCSimDigis.h.

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

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

Definition at line 93 of file RBCProcessRPCSimDigis.h.

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

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

Definition at line 98 of file RBCProcessRPCSimDigis.h.

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