CMS 3D CMS Logo

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