CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RPCWheelMap.cc
Go to the documentation of this file.
1 // $Id: RPCWheelMap.cc,v 1.7 2009/06/07 21:18:51 aosorio Exp $
2 // Include files
3 
4 
5 
6 // local
8 #include <string>
9 #include <iostream>
10 //-----------------------------------------------------------------------------
11 // Implementation file for class : RPCWheelMap
12 //
13 // 2008-11-24 : Andres Felipe Osorio Oliveros
14 //-----------------------------------------------------------------------------
15 
16 //=============================================================================
17 // Standard constructor, initializes variables
18 //=============================================================================
19 RPCWheelMap::RPCWheelMap( int wheelid ) {
20 
21  m_maxBx = 7;
22  m_maxBxWindow = 3; //... considering that we have a bxing in the range [-3,+3]
23  m_maxSectors = 12;
24 
25  int maxMaps = m_maxBx * m_maxSectors;
26 
28  m_wheelMap = new std::bitset<6>[m_maxSectors];
29  m_wheelMapBx = new std::bitset<6>[m_maxSectors * m_maxBx];
31 
32  for(int i=0; i < m_maxSectors; ++i)
33  m_wheelMap[i].reset();
34 
35  for(int i=0; i < maxMaps; ++i)
36  m_wheelMapBx[i].reset();
37 
38  m_debug = false;
39 
40 }
41 //=============================================================================
42 // Destructor
43 //=============================================================================
45 
46  if ( m_wheelMap ) delete[] m_wheelMap;
47  if ( m_wheelMapBx ) delete[] m_wheelMapBx;
48  if ( m_ttuinVec ) delete[] m_ttuinVec;
49 
50 }
51 
52 //=============================================================================
53 void RPCWheelMap::addHit( int bx, int sec, int layer)
54 {
55 
56  // |--12--|--12--|--12--|--12--|--12--|--12--|--12--| (12 sectors x 6 layers x 7 bx)
57  // 0.....11
58  int indx1 = bx + m_maxBxWindow;
59  int indx2 = sec + indx1*m_maxSectors;
60  m_wheelMapBx[ indx2 ].set( layer-1, 1);
61 
62 }
63 
65 {
66 
67  bool anyHits(false);
68 
69  for(int bx=0; bx < m_maxBx; ++bx) {
70 
71  anyHits = false;
72 
73  for(int i=0; i < m_maxSectors; ++i) {
74 
75  int indx = i + bx*m_maxSectors;
76 
77  m_ttuinVec[bx].m_bx = ( bx - m_maxBxWindow );
78  m_wheelMap[i] = m_wheelMapBx[ indx ];
80 
81  anyHits |= m_wheelMap[i].any();
82 
83  if( m_debug ) {
84  std::string test;
85  test = m_wheelMap[i].to_string<char,std::char_traits<char>,std::allocator<char> >();
86  std::cout << "prepareData> sec: " << i << " " << test << " anyHits " << anyHits << std::endl;
87  }
88 
89  }
90 
91  m_ttuinVec[bx].m_hasHits = anyHits;
92 
93  }
94 
95  if( m_debug ) std::cout << "prepareData> done." << '\n';
96 
97 }
98 
99 
int i
Definition: DBlmapReader.cc:9
int m_bx
Definition: TTUInput.h:53
bool m_debug
Definition: RPCWheelMap.h:47
virtual ~RPCWheelMap()
Destructor.
Definition: RPCWheelMap.cc:44
RPCWheelMap()
Standard constructor.
Definition: RPCWheelMap.h:18
void prepareData()
Definition: RPCWheelMap.cc:64
int wheelid()
Definition: RPCWheelMap.h:28
std::bitset< 6 > * m_wheelMap
Definition: RPCWheelMap.h:44
TTUInput * m_ttuinVec
Definition: RPCWheelMap.h:30
int m_maxSectors
Definition: RPCWheelMap.h:41
int m_maxBxWindow
Definition: RPCWheelMap.h:42
bool m_hasHits
Definition: TTUInput.h:57
std::bitset< 6 > * m_wheelMapBx
Definition: RPCWheelMap.h:45
tuple cout
Definition: gather_cfg.py:121
void reset(double vett[256])
Definition: TPedValues.cc:11
void addHit(int, int, int)
Definition: RPCWheelMap.cc:53
std::bitset< 6 > * input_sec
Definition: TTUInput.h:59