Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:39

0001 // Include files
0002 
0003 // local
0004 #include "L1Trigger/RPCTechnicalTrigger/interface/TTUWedgeORLogic.h"
0005 
0006 //-----------------------------------------------------------------------------
0007 // Implementation file for class : TTUWedgeORLogic
0008 //
0009 // 2009-08-09 : Andres Felipe Osorio Oliveros
0010 //-----------------------------------------------------------------------------
0011 
0012 //=============================================================================
0013 // Standard constructor, initializes variables
0014 //=============================================================================
0015 TTUWedgeORLogic::TTUWedgeORLogic() {
0016   m_triggersignal = false;
0017 
0018   //m_maxsectors = 3; //this is the size of the wedge
0019 
0020   //the key is the starting sector: sec 2 -> quadrant 7,8,9 and so on
0021 
0022   m_wedgeSector[2] = 1;   //this is the size of the wedge: sec 2
0023   m_wedgeSector[3] = 1;   //this is the size of the wedge: sec 3
0024   m_wedgeSector[4] = 1;   //this is the size of the wedge: sec 4
0025   m_wedgeSector[5] = 1;   //this is the size of the wedge: sec 5
0026   m_wedgeSector[6] = 1;   //this is the size of the wedge: sec 6
0027   m_wedgeSector[7] = 3;   //this is the size of the wedge: bottom quadrant 1
0028   m_wedgeSector[8] = 3;   //this is the size of the wedge: bottom quadrant 2
0029   m_wedgeSector[9] = 3;   //this is the size of the wedge: bottom quadrant 3
0030   m_wedgeSector[10] = 3;  //this is the size of the wedge: bottom quadrant 4
0031   m_wedgeSector[11] = 3;  //this is the size of the wedge: bottom quadrant 5
0032 
0033   //m_wedgeSector.push_back(2); //this is the starting sector for each wedge
0034   //m_wedgeSector.push_back(4);
0035   //m_wedgeSector.push_back(8);
0036   //m_wedgeSector.push_back(10);
0037 
0038   m_maxwedges = m_wedgeSector.size();
0039 
0040   m_option = 0;
0041 
0042   m_debug = false;
0043 }
0044 //=============================================================================
0045 // Destructor
0046 //=============================================================================
0047 TTUWedgeORLogic::~TTUWedgeORLogic() {}
0048 
0049 //=============================================================================
0050 void TTUWedgeORLogic::setBoardSpecs(const TTUBoardSpecs::TTUBoardConfig& boardspecs) {
0051   m_wheelMajority[boardspecs.m_Wheel1Id] = 3;
0052 
0053   if ((boardspecs.m_MaxNumWheels > 1) && (boardspecs.m_Wheel2Id != 0))
0054     m_wheelMajority[boardspecs.m_Wheel2Id] = 3;
0055 
0056   if (m_debug)
0057     std::cout << "TTUWedgeORLogic::setBoardSpecs> intialization: " << m_wheelMajority.size() << '\t'
0058               << boardspecs.m_MaxNumWheels << '\t' << boardspecs.m_Wheel1Id << '\t' << boardspecs.m_Wheel2Id << '\t'
0059               << m_wheelMajority[boardspecs.m_Wheel1Id] << '\t' << m_wheelMajority[boardspecs.m_Wheel2Id] << '\n';
0060 }
0061 
0062 bool TTUWedgeORLogic::process(const TTUInput& inmap) {
0063   if (m_debug)
0064     std::cout << "TTUWedgeORLogic::process starts" << std::endl;
0065 
0066   m_triggersignal = false;
0067 
0068   // October 15 2009: A.Osorio
0069   // In this context m_option is the Selected Wedge/Quadrant (1,2,3,4...)
0070   // initially we had 4 quadrants
0071   // 1=*2-3-4 ; 2=*4-5-6; 3=*8-9-10; 4=*10-11-12
0072   // Now: we have 5 top sectors: 2,3,4,5,6 and 5 bottom quadrants +/-1 of the opposite sector
0073 
0074   int nhits(0);
0075   int sector_indx(0);
0076   int firstsector = m_option;
0077 
0078   m_maxsectors = m_wedgeSector[firstsector];
0079 
0080   for (int j = 0; j < m_maxsectors; ++j) {
0081     sector_indx = (firstsector - 1) + j;
0082     if (sector_indx >= 12)
0083       sector_indx = 0;
0084     nhits += inmap.input_sec[sector_indx].count();
0085   }
0086 
0087   //...introduce force logic
0088   bool use_forcing = false;
0089 
0090   if (use_forcing) {
0091     for (int j = 0; j < m_maxsectors; ++j) {
0092       sector_indx = (firstsector - 1) + j;
0093 
0094       if (firstsector <= 6) {  //...only top sectors
0095 
0096         bool hasLayer1 = inmap.input_sec[sector_indx][0];  //layer 1: RB1in
0097 
0098         if (!hasLayer1) {
0099           m_triggersignal = false;
0100           return true;
0101         }
0102       }
0103     }
0104   }
0105 
0106   int majority = m_wheelMajority[inmap.m_wheelId];
0107 
0108   if (m_debug)
0109     std::cout << "TTUWedgeORLogic::setBoardSpecs> configuration W: " << inmap.m_wheelId << '\t' << "M: " << majority
0110               << '\n';
0111 
0112   if (nhits >= majority)
0113     m_triggersignal = true;
0114 
0115   if (m_debug)
0116     std::cout << "TTUWedgeORLogic wedge decision: "
0117               << "wheel: " << inmap.m_wheelId << '\t' << "quadrant: " << m_option << '\t' << "fsector: " << firstsector
0118               << '\t' << "nhits: " << nhits << '\t' << "maj: " << majority << '\t' << "Dec: " << m_triggersignal
0119               << std::endl;
0120 
0121   if (m_debug)
0122     std::cout << "TTUWedgeORLogic>process ends" << std::endl;
0123 
0124   return true;
0125 }