00001 // $Id: TTUWedgeORLogic.cc,v 1.7 2012/02/09 13:00:01 eulisse Exp $ 00002 // Include files 00003 00004 00005 00006 // local 00007 #include "L1Trigger/RPCTechnicalTrigger/interface/TTUWedgeORLogic.h" 00008 00009 //----------------------------------------------------------------------------- 00010 // Implementation file for class : TTUWedgeORLogic 00011 // 00012 // 2009-08-09 : Andres Felipe Osorio Oliveros 00013 //----------------------------------------------------------------------------- 00014 00015 //============================================================================= 00016 // Standard constructor, initializes variables 00017 //============================================================================= 00018 TTUWedgeORLogic::TTUWedgeORLogic( ) { 00019 00020 m_triggersignal = false; 00021 00022 //m_maxsectors = 3; //this is the size of the wedge 00023 00024 //the key is the starting sector: sec 2 -> quadrant 7,8,9 and so on 00025 00026 m_wedgeSector[2] = 1; //this is the size of the wedge: sec 2 00027 m_wedgeSector[3] = 1; //this is the size of the wedge: sec 3 00028 m_wedgeSector[4] = 1; //this is the size of the wedge: sec 4 00029 m_wedgeSector[5] = 1; //this is the size of the wedge: sec 5 00030 m_wedgeSector[6] = 1; //this is the size of the wedge: sec 6 00031 m_wedgeSector[7] = 3; //this is the size of the wedge: bottom quadrant 1 00032 m_wedgeSector[8] = 3; //this is the size of the wedge: bottom quadrant 2 00033 m_wedgeSector[9] = 3; //this is the size of the wedge: bottom quadrant 3 00034 m_wedgeSector[10] = 3; //this is the size of the wedge: bottom quadrant 4 00035 m_wedgeSector[11] = 3; //this is the size of the wedge: bottom quadrant 5 00036 00037 //m_wedgeSector.push_back(2); //this is the starting sector for each wedge 00038 //m_wedgeSector.push_back(4); 00039 //m_wedgeSector.push_back(8); 00040 //m_wedgeSector.push_back(10); 00041 00042 m_maxwedges = m_wedgeSector.size(); 00043 00044 m_option = 0; 00045 00046 m_debug = false; 00047 00048 } 00049 //============================================================================= 00050 // Destructor 00051 //============================================================================= 00052 TTUWedgeORLogic::~TTUWedgeORLogic() {} 00053 00054 //============================================================================= 00055 void TTUWedgeORLogic::setBoardSpecs( const TTUBoardSpecs::TTUBoardConfig & boardspecs ) 00056 { 00057 00058 m_wheelMajority[ boardspecs.m_Wheel1Id ] = 3; 00059 00060 if ( (boardspecs.m_MaxNumWheels > 1) && (boardspecs.m_Wheel2Id != 0) ) 00061 m_wheelMajority[ boardspecs.m_Wheel2Id ] = 3; 00062 00063 if ( m_debug ) std::cout << "TTUWedgeORLogic::setBoardSpecs> intialization: " 00064 << m_wheelMajority.size() << '\t' 00065 << boardspecs.m_MaxNumWheels << '\t' 00066 << boardspecs.m_Wheel1Id << '\t' 00067 << boardspecs.m_Wheel2Id << '\t' 00068 << m_wheelMajority[ boardspecs.m_Wheel1Id ] << '\t' 00069 << m_wheelMajority[ boardspecs.m_Wheel2Id ] << '\n'; 00070 00071 } 00072 00073 bool TTUWedgeORLogic::process( const TTUInput & inmap ) 00074 { 00075 00076 if( m_debug) std::cout << "TTUWedgeORLogic::process starts" << std::endl; 00077 00078 m_triggersignal = false; 00079 00080 // October 15 2009: A.Osorio 00081 // In this context m_option is the Selected Wedge/Quadrant (1,2,3,4...) 00082 // initially we had 4 quadrants 00083 // 1=*2-3-4 ; 2=*4-5-6; 3=*8-9-10; 4=*10-11-12 00084 // Now: we have 5 top sectors: 2,3,4,5,6 and 5 bottom quadrants +/-1 of the opposite sector 00085 00086 int nhits(0); 00087 int sector_indx(0); 00088 int firstsector = m_option; 00089 00090 m_maxsectors = m_wedgeSector[ firstsector ]; 00091 00092 for(int j = 0; j < m_maxsectors; ++j) { 00093 sector_indx = (firstsector-1) + j; 00094 if( sector_indx >= 12 ) sector_indx = 0; 00095 nhits += inmap.input_sec[ sector_indx ].count(); 00096 } 00097 00098 //...introduce force logic 00099 bool use_forcing = false; 00100 00101 if ( use_forcing ) { 00102 00103 for(int j = 0; j < m_maxsectors; ++j) { 00104 00105 sector_indx = (firstsector-1) + j; 00106 00107 if( firstsector <= 6 ) { //...only top sectors 00108 00109 bool hasLayer1 = inmap.input_sec[sector_indx][0]; //layer 1: RB1in 00110 00111 if ( ! hasLayer1 ) { 00112 m_triggersignal = false; 00113 return true; 00114 } 00115 00116 } 00117 00118 } 00119 00120 } 00121 00122 00123 int majority = m_wheelMajority[ inmap.m_wheelId ]; 00124 00125 if ( m_debug ) std::cout << "TTUWedgeORLogic::setBoardSpecs> configuration W: " 00126 << inmap.m_wheelId << '\t' << "M: " << majority << '\n'; 00127 00128 if ( nhits >= majority) m_triggersignal = true; 00129 00130 if( m_debug ) 00131 std::cout << "TTUWedgeORLogic wedge decision: " 00132 << "wheel: " << inmap.m_wheelId << '\t' 00133 << "quadrant: " << m_option << '\t' 00134 << "fsector: " << firstsector << '\t' 00135 << "nhits: " << nhits << '\t' 00136 << "maj: " << majority << '\t' 00137 << "Dec: " << m_triggersignal << std::endl; 00138 00139 if( m_debug ) std::cout << "TTUWedgeORLogic>process ends" << std::endl; 00140 00141 return true; 00142 00143 }