CMS 3D CMS Logo

Public Member Functions | Private Attributes

TTUWedgeORLogic Class Reference

#include <interface/TTUWedgeORLogic.h>

Inheritance diagram for TTUWedgeORLogic:
TTULogic

List of all members.

Public Member Functions

bool process (const TTUInput &)
void setBoardSpecs (const TTUBoardSpecs::TTUBoardConfig &)
 TTUWedgeORLogic ()
 Standard constructor.
virtual ~TTUWedgeORLogic ()
 Destructor.

Private Attributes

bool m_debug
int m_maxsectors
int m_maxwedges
std::map< int, int > m_wedgeSector
std::map< int, int > m_wheelMajority

Detailed Description

Author:
Andres Felipe Osorio Oliveros
Date:
2009-08-09

Definition at line 19 of file TTUWedgeORLogic.h.


Constructor & Destructor Documentation

TTUWedgeORLogic::TTUWedgeORLogic ( )

Standard constructor.

Definition at line 18 of file TTUWedgeORLogic.cc.

References m_debug, m_maxwedges, TTULogic::m_option, TTULogic::m_triggersignal, and m_wedgeSector.

                                   {

  m_triggersignal = false;
  
  //m_maxsectors = 3; //this is the size of the wedge

  //the key is the starting sector: sec 2 -> quadrant 7,8,9 and so on
 
  m_wedgeSector[2]   = 1; //this is the size of the wedge: sec 2
  m_wedgeSector[3]   = 1; //this is the size of the wedge: sec 3
  m_wedgeSector[4]   = 1; //this is the size of the wedge: sec 4
  m_wedgeSector[5]   = 1; //this is the size of the wedge: sec 5
  m_wedgeSector[6]   = 1; //this is the size of the wedge: sec 6
  m_wedgeSector[7]   = 3; //this is the size of the wedge: bottom quadrant 1
  m_wedgeSector[8]   = 3; //this is the size of the wedge: bottom quadrant 2
  m_wedgeSector[9]   = 3; //this is the size of the wedge: bottom quadrant 3
  m_wedgeSector[10]  = 3; //this is the size of the wedge: bottom quadrant 4
  m_wedgeSector[11]  = 3; //this is the size of the wedge: bottom quadrant 5

  //m_wedgeSector.push_back(2); //this is the starting sector for each wedge
  //m_wedgeSector.push_back(4);
  //m_wedgeSector.push_back(8);
  //m_wedgeSector.push_back(10);

  m_maxwedges = m_wedgeSector.size();
  
  m_option = 0;
  
  m_debug = false;
  
}
TTUWedgeORLogic::~TTUWedgeORLogic ( ) [virtual]

Destructor.

Definition at line 52 of file TTUWedgeORLogic.cc.

{} 

Member Function Documentation

bool TTUWedgeORLogic::process ( const TTUInput inmap) [virtual]

Implements TTULogic.

Definition at line 73 of file TTUWedgeORLogic.cc.

References gather_cfg::cout, TTUInput::input_sec, j, m_debug, m_maxsectors, TTULogic::m_option, TTULogic::m_triggersignal, m_wedgeSector, TTUInput::m_wheelId, and m_wheelMajority.

{
  
  if( m_debug) std::cout << "TTUWedgeORLogic::process starts" << std::endl;
  
  m_triggersignal = false;
  
  // October 15 2009: A.Osorio
  // In this context m_option is the Selected Wedge/Quadrant (1,2,3,4...)
  // initially we had 4 quadrants
  // 1=*2-3-4 ; 2=*4-5-6; 3=*8-9-10; 4=*10-11-12
  // Now: we have 5 top sectors: 2,3,4,5,6 and 5 bottom quadrants +/-1 of the opposite sector
  
  int nhits(0);
  int sector_indx(0);
  int firstsector = m_option;
  
  m_maxsectors = m_wedgeSector[ firstsector ];
  
  for(int j = 0; j < m_maxsectors; ++j)  {
    sector_indx = (firstsector-1) + j;
    if( sector_indx >= 12 ) sector_indx = 0;
    nhits += inmap.input_sec[ sector_indx ].count();
  }
  
  //...introduce force logic
  bool use_forcing = false;
  
  if ( use_forcing ) {

    for(int j = 0; j < m_maxsectors; ++j)  {
      
      sector_indx = (firstsector-1) + j;
      
      if( firstsector <= 6 ) { //...only top sectors
        
        bool hasLayer1 = inmap.input_sec[sector_indx][0]; //layer 1: RB1in
        
        if ( ! hasLayer1 ) {
          m_triggersignal = false;
          return true;
        }
        
      }
      
    }
    
  }
  

  int majority = m_wheelMajority[ inmap.m_wheelId ];

  if ( m_debug ) std::cout << "TTUWedgeORLogic::setBoardSpecs> configuration W: " 
                           << inmap.m_wheelId << '\t' << "M: " << majority << '\n';
  
  if ( nhits >= majority) m_triggersignal = true;
  
  if( m_debug ) 
    std::cout << "TTUWedgeORLogic wedge decision: "
              << "wheel: "    << inmap.m_wheelId << '\t'
              << "quadrant: " << m_option << '\t' 
              << "fsector: "  << firstsector << '\t' 
              << "nhits: "    << nhits << '\t'
              << "maj: "      << majority << '\t'
              << "Dec: "      << m_triggersignal << std::endl;
  
  if( m_debug ) std::cout << "TTUWedgeORLogic>process ends" << std::endl;
  
  return true;
  
}
void TTUWedgeORLogic::setBoardSpecs ( const TTUBoardSpecs::TTUBoardConfig boardspecs) [virtual]

Implements TTULogic.

Definition at line 55 of file TTUWedgeORLogic.cc.

References gather_cfg::cout, m_debug, TTUBoardSpecs::TTUBoardConfig::m_MaxNumWheels, TTUBoardSpecs::TTUBoardConfig::m_Wheel1Id, TTUBoardSpecs::TTUBoardConfig::m_Wheel2Id, and m_wheelMajority.

Referenced by TTUPointingLogic::setBoardSpecs().

{
 
  m_wheelMajority[ boardspecs.m_Wheel1Id ] = 3;
  
  if ( (boardspecs.m_MaxNumWheels > 1) && (boardspecs.m_Wheel2Id != 0) )
    m_wheelMajority[ boardspecs.m_Wheel2Id ] = 3;

  if ( m_debug ) std::cout << "TTUWedgeORLogic::setBoardSpecs> intialization: " 
                           << m_wheelMajority.size() << '\t'
                           << boardspecs.m_MaxNumWheels << '\t'
                           << boardspecs.m_Wheel1Id << '\t'
                           << boardspecs.m_Wheel2Id << '\t'
                           << m_wheelMajority[ boardspecs.m_Wheel1Id ] << '\t'
                           << m_wheelMajority[ boardspecs.m_Wheel2Id ] << '\n';
    
}

Member Data Documentation

bool TTUWedgeORLogic::m_debug [private]

Definition at line 34 of file TTUWedgeORLogic.h.

Referenced by process(), setBoardSpecs(), and TTUWedgeORLogic().

Definition at line 36 of file TTUWedgeORLogic.h.

Referenced by process().

Definition at line 38 of file TTUWedgeORLogic.h.

Referenced by TTUWedgeORLogic().

std::map<int,int> TTUWedgeORLogic::m_wedgeSector [private]

Definition at line 44 of file TTUWedgeORLogic.h.

Referenced by process(), and TTUWedgeORLogic().

std::map< int, int> TTUWedgeORLogic::m_wheelMajority [private]

Definition at line 40 of file TTUWedgeORLogic.h.

Referenced by process(), and setBoardSpecs().