CMS 3D CMS Logo

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