CMS 3D CMS Logo

TTUWedgeORLogic.cc
Go to the documentation of this file.
1 // Include files
2 
3 
4 
5 // local
7 
8 //-----------------------------------------------------------------------------
9 // Implementation file for class : TTUWedgeORLogic
10 //
11 // 2009-08-09 : Andres Felipe Osorio Oliveros
12 //-----------------------------------------------------------------------------
13 
14 //=============================================================================
15 // Standard constructor, initializes variables
16 //=============================================================================
18 
19  m_triggersignal = false;
20 
21  //m_maxsectors = 3; //this is the size of the wedge
22 
23  //the key is the starting sector: sec 2 -> quadrant 7,8,9 and so on
24 
25  m_wedgeSector[2] = 1; //this is the size of the wedge: sec 2
26  m_wedgeSector[3] = 1; //this is the size of the wedge: sec 3
27  m_wedgeSector[4] = 1; //this is the size of the wedge: sec 4
28  m_wedgeSector[5] = 1; //this is the size of the wedge: sec 5
29  m_wedgeSector[6] = 1; //this is the size of the wedge: sec 6
30  m_wedgeSector[7] = 3; //this is the size of the wedge: bottom quadrant 1
31  m_wedgeSector[8] = 3; //this is the size of the wedge: bottom quadrant 2
32  m_wedgeSector[9] = 3; //this is the size of the wedge: bottom quadrant 3
33  m_wedgeSector[10] = 3; //this is the size of the wedge: bottom quadrant 4
34  m_wedgeSector[11] = 3; //this is the size of the wedge: bottom quadrant 5
35 
36  //m_wedgeSector.push_back(2); //this is the starting sector for each wedge
37  //m_wedgeSector.push_back(4);
38  //m_wedgeSector.push_back(8);
39  //m_wedgeSector.push_back(10);
40 
41  m_maxwedges = m_wedgeSector.size();
42 
43  m_option = 0;
44 
45  m_debug = false;
46 
47 }
48 //=============================================================================
49 // Destructor
50 //=============================================================================
52 
53 //=============================================================================
55 {
56 
57  m_wheelMajority[ boardspecs.m_Wheel1Id ] = 3;
58 
59  if ( (boardspecs.m_MaxNumWheels > 1) && (boardspecs.m_Wheel2Id != 0) )
60  m_wheelMajority[ boardspecs.m_Wheel2Id ] = 3;
61 
62  if ( m_debug ) std::cout << "TTUWedgeORLogic::setBoardSpecs> intialization: "
63  << m_wheelMajority.size() << '\t'
64  << boardspecs.m_MaxNumWheels << '\t'
65  << boardspecs.m_Wheel1Id << '\t'
66  << boardspecs.m_Wheel2Id << '\t'
67  << m_wheelMajority[ boardspecs.m_Wheel1Id ] << '\t'
68  << m_wheelMajority[ boardspecs.m_Wheel2Id ] << '\n';
69 
70 }
71 
72 bool TTUWedgeORLogic::process( const TTUInput & inmap )
73 {
74 
75  if( m_debug) std::cout << "TTUWedgeORLogic::process starts" << std::endl;
76 
77  m_triggersignal = false;
78 
79  // October 15 2009: A.Osorio
80  // In this context m_option is the Selected Wedge/Quadrant (1,2,3,4...)
81  // initially we had 4 quadrants
82  // 1=*2-3-4 ; 2=*4-5-6; 3=*8-9-10; 4=*10-11-12
83  // Now: we have 5 top sectors: 2,3,4,5,6 and 5 bottom quadrants +/-1 of the opposite sector
84 
85  int nhits(0);
86  int sector_indx(0);
87  int firstsector = m_option;
88 
89  m_maxsectors = m_wedgeSector[ firstsector ];
90 
91  for(int j = 0; j < m_maxsectors; ++j) {
92  sector_indx = (firstsector-1) + j;
93  if( sector_indx >= 12 ) sector_indx = 0;
94  nhits += inmap.input_sec[ sector_indx ].count();
95  }
96 
97  //...introduce force logic
98  bool use_forcing = false;
99 
100  if ( use_forcing ) {
101 
102  for(int j = 0; j < m_maxsectors; ++j) {
103 
104  sector_indx = (firstsector-1) + j;
105 
106  if( firstsector <= 6 ) { //...only top sectors
107 
108  bool hasLayer1 = inmap.input_sec[sector_indx][0]; //layer 1: RB1in
109 
110  if ( ! hasLayer1 ) {
111  m_triggersignal = false;
112  return true;
113  }
114 
115  }
116 
117  }
118 
119  }
120 
121 
122  int majority = m_wheelMajority[ inmap.m_wheelId ];
123 
124  if ( m_debug ) std::cout << "TTUWedgeORLogic::setBoardSpecs> configuration W: "
125  << inmap.m_wheelId << '\t' << "M: " << majority << '\n';
126 
127  if ( nhits >= majority) m_triggersignal = true;
128 
129  if( m_debug )
130  std::cout << "TTUWedgeORLogic wedge decision: "
131  << "wheel: " << inmap.m_wheelId << '\t'
132  << "quadrant: " << m_option << '\t'
133  << "fsector: " << firstsector << '\t'
134  << "nhits: " << nhits << '\t'
135  << "maj: " << majority << '\t'
136  << "Dec: " << m_triggersignal << std::endl;
137 
138  if( m_debug ) std::cout << "TTUWedgeORLogic>process ends" << std::endl;
139 
140  return true;
141 
142 }
bool process(const TTUInput &) override
int m_wheelId
Definition: TTUInput.h:33
TTUWedgeORLogic()
Standard constructor.
void setBoardSpecs(const TTUBoardSpecs::TTUBoardConfig &) override
std::map< int, int > m_wheelMajority
std::array< std::bitset< 6 >, 12 > input_sec
Definition: TTUInput.h:37
bool m_triggersignal
Definition: TTULogic.h:34
int m_option
Definition: TTULogic.h:30
~TTUWedgeORLogic() override
Destructor.
std::map< int, int > m_wedgeSector