CMS 3D CMS Logo

Classes | Public Member Functions | Public Attributes | Private Attributes

TTUEmulator Class Reference

#include <TTUEmulator.h>

List of all members.

Classes

class  TriggerResponse

Public Member Functions

void clearTriggerResponse ()
void emulate ()
bool initialise ()
int line ()
int mode ()
void printinfo ()
void processTtu (RPCInputSignal *, int)
void processTtu (RPCInputSignal *)
void SetLineId (int)
void setmode (int mode)
void setSpecifications (const TTUBoardSpecs *, const RBCBoardSpecs *)
void setSpecs ()
 TTUEmulator (int, int)
 TTUEmulator (int, const char *, const char *, const char *, int)
 TTUEmulator (int, const char *, const char *, int)
 TTUEmulator ()
 Standard constructor.
virtual ~TTUEmulator ()
 Destructor.

Public Attributes

int m_maxWheels
std::bitset< 2 > m_trigger
std::map< int, std::bitset< 2 > > m_triggerBx
std::vector< TriggerResponse * > m_triggerBxVec
RPCWheelm_Wheels

Private Attributes

int m_bx
bool m_debug
int m_id
int m_line
std::string m_logtype
int m_mode
TTUConfigurationm_ttuconf
TTUInputm_ttuin
int * m_wheelIds

Detailed Description

This class performs the following tasks [ref 2]:

The default algorithm is implemented is TrackingAlg [ref 2].

ref 2: "A configurable Tracking Algorithm to detect cosmic muon tracks for the CMS-RPC based Technical Trigger", R.T.Rajan et al

Author:
Andres Osorio

email: aosorio@uniandes.edu.co

Date:
2008-10-15

Definition at line 38 of file TTUEmulator.h.


Constructor & Destructor Documentation

TTUEmulator::TTUEmulator ( ) [inline]

Standard constructor.

Definition at line 41 of file TTUEmulator.h.

{ }; 
TTUEmulator::TTUEmulator ( int  id,
int  mxw 
)

Definition at line 22 of file TTUEmulator.cc.

References gen::k, m_debug, m_id, m_line, m_maxWheels, m_mode, m_trigger, m_ttuin, m_wheelIds, m_Wheels, and tmp.

{
  
  m_id        = id;
  m_maxWheels = mxw;
  
  int tmp[6]  = {1,  2, 0, 0, -1, -2};
  m_wheelIds = new int[6];
  for( int k=0; k < 6; ++k) m_wheelIds[k]=tmp[k];
  
  m_Wheels = new RPCWheel[2];
  for( int k=0; k < m_maxWheels; ++k ) 
    m_Wheels[k].setProperties( m_wheelIds[(id*2)+(k-2)] );
  
  m_ttuin = new TTUInput[2];
  
  m_trigger.reset();
  
  m_mode = 1;
  
  m_debug = false;
  
  m_line = 1;
  
}
TTUEmulator::TTUEmulator ( int  id,
const char *  rbclogic_type,
const char *  ttulogic_type,
int  mxw 
)

Definition at line 49 of file TTUEmulator.cc.

References gen::k, m_debug, m_id, m_line, m_maxWheels, m_mode, m_trigger, m_ttuconf, m_ttuin, m_wheelIds, m_Wheels, and tmp.

{
  
  m_id        = id;
  m_maxWheels = mxw;

  int tmp[6]  = {1,  2, 0, 0, -1, -2};
  m_wheelIds = new int[6];
  for( int k=0; k < 6; ++k) m_wheelIds[k]=tmp[k];
  
  m_Wheels = new RPCWheel[2];
  for( int k=0; k < m_maxWheels; ++k ) 
    m_Wheels[k].setProperties( m_wheelIds[(id*2)+(k-2)], rbclogic_type );
  
  m_ttuin = new TTUInput[2];
  
  m_ttuconf   = dynamic_cast<TTUConfiguration*> (new TTUBasicConfig (ttulogic_type));
  
  m_trigger.reset();
  
  m_mode = 1;

  m_debug = false;

  m_line = 1;
  
}
TTUEmulator::TTUEmulator ( int  id,
const char *  f_name,
const char *  rbclogic_type,
const char *  ttulogic_type,
int  mxw 
)

Definition at line 77 of file TTUEmulator.cc.

References gen::k, m_debug, m_id, m_line, m_maxWheels, m_mode, m_trigger, m_ttuconf, m_ttuin, m_wheelIds, m_Wheels, and tmp.

{
  
  m_id        = id;
  m_maxWheels = mxw;

  int tmp[6]  = {1,  2, 0, 0, -1, -2};
  m_wheelIds = new int[6];
  for( int k=0; k < 6; ++k) m_wheelIds[k]=tmp[k];
  
  m_Wheels = new RPCWheel[2];
  for( int k=0; k < m_maxWheels; ++k ) 
    m_Wheels[k].setProperties( m_wheelIds[(id*2)+(k-2)], f_name, rbclogic_type );
  
  m_ttuin = new TTUInput[2];
  
  m_ttuconf   = dynamic_cast<TTUConfiguration*> (new TTUBasicConfig (ttulogic_type));
  
  m_trigger.reset();
  
  m_mode = 1;
  
  m_debug = false;

  m_line = 1;
  
}
TTUEmulator::~TTUEmulator ( ) [virtual]

Destructor.

Definition at line 109 of file TTUEmulator.cc.

References m_ttuconf, m_ttuin, m_wheelIds, and m_Wheels.

                          {

  if ( m_wheelIds ) delete[] m_wheelIds;
  if ( m_Wheels   ) delete[] m_Wheels;
  if ( m_ttuin    ) delete[] m_ttuin;
  if ( m_ttuconf  ) delete m_ttuconf;
  
} 

Member Function Documentation

void TTUEmulator::clearTriggerResponse ( )

Definition at line 325 of file TTUEmulator.cc.

References m_triggerBxVec.

Referenced by RPCTechnicalTrigger::produce().

{
  
  std::vector<TriggerResponse*>::iterator itr;
  for ( itr = m_triggerBxVec.begin(); itr != m_triggerBxVec.end(); ++itr)
    if ( (*itr) ) delete (*itr);
  m_triggerBxVec.clear();
  
}
void TTUEmulator::emulate ( )

Definition at line 155 of file TTUEmulator.cc.

References gen::k, m_maxWheels, and m_Wheels.

{
  //... only for testing
  for( int k=0; k < m_maxWheels; ++k ) 
    m_Wheels[k].emulate();
  
}
bool TTUEmulator::initialise ( )

Definition at line 134 of file TTUEmulator.cc.

References gather_cfg::cout, TTUConfiguration::initialise(), gen::k, m_debug, m_id, m_line, m_maxWheels, m_ttuconf, m_Wheels, and ntuplemaker::status.

Referenced by RPCTechnicalTrigger::beginRun().

{
  bool status(false);
  for( int k=0; k < m_maxWheels; ++k)
    status = m_Wheels[k].initialise( );
  
  status = m_ttuconf->initialise( m_line , m_id );
  
  if ( !status ) { 
    if( m_debug ) std::cout << "TTUEmulator> Problem initialising the Configuration \n"; 
    return 0; };
  
  return status;
  
}
int TTUEmulator::line ( ) [inline]

Definition at line 73 of file TTUEmulator.h.

References m_line.

Referenced by SetLineId().

             {
    return m_line;
  };
int TTUEmulator::mode ( void  ) [inline]

Definition at line 65 of file TTUEmulator.h.

References m_mode.

Referenced by setmode().

             {
    return m_mode;
  };
void TTUEmulator::printinfo ( )

Definition at line 337 of file TTUEmulator.cc.

References gather_cfg::cout, gen::k, m_id, m_maxWheels, and m_Wheels.

Referenced by RPCTechnicalTrigger::printinfo().

{
  
  std::cout << "TTUEmulator: " << m_id << '\n';
  for( int k=0; k < m_maxWheels; ++k ) 
    m_Wheels[k].printinfo();
  
}
void TTUEmulator::processTtu ( RPCInputSignal signal,
int  wedgeId 
)

Definition at line 245 of file TTUEmulator.cc.

References gather_cfg::cout, RPCWheel::createWheelMap(), RPCWheel::getid(), TTULogicUnit::isTriggered(), gen::k, m_debug, m_id, m_maxWheels, m_trigger, m_triggerBx, m_triggerBxVec, m_ttuconf, m_ttuin, TTUConfiguration::m_ttulogic, m_Wheels, LaserDQM_cfg::process, RPCWheel::retrieveWheelMap(), TTULogicUnit::run(), TTUEmulator::TriggerResponse::setTriggerBits(), and generateDummyData::trg().

{
  
  //. 
  int bx(0);
  bool trg(false); 
  
  if( m_debug ) std::cout << "TTUEmulator::processTtu( Pointing ) starts " << '\n';
  
  m_trigger.reset();
  m_triggerBx.clear();
  
  std::vector<int> bxVec;
  std::vector<int>::iterator bxItr;
  std::map<int,RBCInput*> * linkboardin;
  std::map<int,RBCInput*>::iterator inItr;
  
  linkboardin = dynamic_cast<RBCLinkBoardGLSignal*>( signal )->m_linkboardin;
  
  for( inItr = (*linkboardin).begin(); inItr != (*linkboardin).end(); ++inItr) 
  {
    
    if ( (*inItr).first < 0 ) bx = (int) ceil( (*inItr).first / 1000000.0 );
    else bx = (int) floor( (*inItr).first / 1000000.0 );
    bxVec.push_back(bx);
    
  }
  
  bxItr = unique (bxVec.begin(), bxVec.end());
  bxVec.resize(bxItr - bxVec.begin());
  
  for ( bxItr = bxVec.begin(); bxItr != bxVec.end(); ++bxItr) {
    
    TriggerResponse * triggerResponse = new TriggerResponse();
    
    for( int k=0; k < m_maxWheels; ++k )
    {
      
      if ( m_Wheels[k].process( (*bxItr) , (*linkboardin) ) ) { // <- this process uses the default RBC emulation but need a different logic
        
        m_Wheels[k].createWheelMap();
        
        m_Wheels[k].retrieveWheelMap( (m_ttuin[k]) );
        
        //.. execute selected logic at Ttu level
        m_ttuconf->m_ttulogic->run( (m_ttuin[k]) , wedgeId );
        
        //... and produce a Wheel-Wedge level trigger
        trg = m_ttuconf->m_ttulogic->isTriggered();
        
        m_trigger.set(k,trg);
        
        if( m_debug ) std::cout << "TTUEmulator::processTtu( Pointing ) ttuid: " << m_id 
                                << " bx: "          << (*bxItr)
                                << " wheel: "       << m_Wheels[k].getid()
                                << " response: "    << trg << std::endl;
        
      }
      
      
    }
    
    triggerResponse->setTriggerBits( (*bxItr) , wedgeId, m_trigger );
    m_triggerBxVec.push_back( triggerResponse );
    m_triggerBx[ (*bxItr) ] = m_trigger;
    
  }
  
  if( m_debug ) std::cout << "TTUEmulator::processTtu (Pointing) > size of trigger map " 
                          << m_triggerBx.size() << std::endl;
  
  if( m_debug ) std::cout << "TTUEmulator::processTtu (Pointing) > done with this TTU: " << m_id << std::endl;
  
  bxVec.clear();

  if( m_debug ) std::cout << "TTUEmulator::processTtu( Pointing ) end" << '\n';
  
}
void TTUEmulator::processTtu ( RPCInputSignal signal)

Definition at line 163 of file TTUEmulator.cc.

References gather_cfg::cout, RPCWheel::createWheelMap(), RPCWheel::getid(), TTULogicUnit::isTriggered(), gen::k, m_debug, m_id, m_maxWheels, m_trigger, m_triggerBx, m_triggerBxVec, m_ttuconf, m_ttuin, TTUConfiguration::m_ttulogic, m_Wheels, LaserDQM_cfg::process, RPCWheel::retrieveWheelMap(), TTULogicUnit::run(), TTUEmulator::TriggerResponse::setTriggerBits(), and generateDummyData::trg().

Referenced by RPCTechnicalTrigger::produce().

{
  
  //. 
  int bx(0);
  bool trg(false); 

  if( m_debug ) std::cout << "TTUEmulator::processTtu starts" << '\n';
  
  m_trigger.reset();
  m_triggerBx.clear();
  
  std::vector<int> bxVec;
  std::vector<int>::iterator bxItr;
  std::map<int,RBCInput*> * linkboardin;
  std::map<int,RBCInput*>::iterator inItr;
  
  linkboardin = dynamic_cast<RBCLinkBoardGLSignal*>( signal )->m_linkboardin;
  
  for( inItr = (*linkboardin).begin(); inItr != (*linkboardin).end(); ++inItr) 
  {
    
    if ( (*inItr).first < 0 ) bx = (int) ceil( (*inItr).first / 1000000.0 );
    else bx = (int) floor( (*inItr).first / 1000000.0 );
    bxVec.push_back(bx);
    
  }
  
  bxItr = unique (bxVec.begin(), bxVec.end());
  bxVec.resize(bxItr - bxVec.begin());
  
  for ( bxItr = bxVec.begin(); bxItr != bxVec.end(); ++bxItr) {
    
    TriggerResponse * triggerResponse = new TriggerResponse();
    
    for( int k=0; k < m_maxWheels; ++k )
    {
      
      if ( m_Wheels[k].process( (*bxItr) , (*linkboardin) ) ) {
        
        m_Wheels[k].createWheelMap();
        
        m_Wheels[k].retrieveWheelMap( (m_ttuin[k]) );
        
        //.. execute selected logic at Ttu level
        m_ttuconf->m_ttulogic->run( (m_ttuin[k]) );
        
        //... and produce a Wheel level trigger
        trg = m_ttuconf->m_ttulogic->isTriggered();
        
        m_trigger.set(k,trg);
        
        if( m_debug ) std::cout << "TTUEmulator::processTtu ttuid: " << m_id 
                                << " bx: "          << (*bxItr)
                                << " wheel: "       << m_Wheels[k].getid()
                                << " response: "    << trg << std::endl;
        
      }

      
    }

    
    triggerResponse->setTriggerBits( (*bxItr) , m_trigger );
    m_triggerBxVec.push_back( triggerResponse );
    m_triggerBx[ (*bxItr) ] = m_trigger;
    
  }
  
  
  if( m_debug ) std::cout << "TTUEmulator::processTtu> size of trigger map " 
                          << m_triggerBx.size() << std::endl;
  
  
  if( m_debug ) std::cout << "TTUEmulator::processTtu> done with this TTU: " << m_id << std::endl;

  bxVec.clear();

  if( m_debug ) std::cout << "TTUEmulator::processTtu ends" << '\n';
    
}
void TTUEmulator::SetLineId ( int  line)

Definition at line 150 of file TTUEmulator.cc.

References line(), and m_line.

Referenced by RPCTechnicalTrigger::beginRun().

{
  m_line = line;
}
void TTUEmulator::setmode ( int  mode) [inline]

Definition at line 69 of file TTUEmulator.h.

References m_mode, and mode().

                         {
    m_mode = mode;
  };
void TTUEmulator::setSpecifications ( const TTUBoardSpecs ttuspecs,
const RBCBoardSpecs rbcspecs 
)

Definition at line 119 of file TTUEmulator.cc.

References gen::k, TTUBoardSpecs::m_boardspecs, m_maxWheels, m_mode, TTUConfiguration::m_ttuboardspecs, m_ttuconf, and m_Wheels.

Referenced by RPCTechnicalTrigger::beginRun().

{
  
  m_ttuconf   = dynamic_cast<TTUConfiguration*> (new TTUBasicConfig (ttuspecs));
  
  for( int k=0; k < m_maxWheels; ++k)
    m_Wheels[k].setSpecifications( rbcspecs );

  std::vector<TTUBoardSpecs::TTUBoardConfig>::const_iterator itr;
  itr = m_ttuconf->m_ttuboardspecs->m_boardspecs.begin();
  
  m_mode = (*itr).m_triggerMode;
  
}
void TTUEmulator::setSpecs ( )

Member Data Documentation

int TTUEmulator::m_bx [private]

Definition at line 120 of file TTUEmulator.h.

bool TTUEmulator::m_debug [private]

Definition at line 132 of file TTUEmulator.h.

Referenced by initialise(), processTtu(), and TTUEmulator().

int TTUEmulator::m_id [private]

Definition at line 119 of file TTUEmulator.h.

Referenced by initialise(), printinfo(), processTtu(), and TTUEmulator().

int TTUEmulator::m_line [private]

Definition at line 122 of file TTUEmulator.h.

Referenced by initialise(), line(), SetLineId(), and TTUEmulator().

std::string TTUEmulator::m_logtype [private]

Definition at line 126 of file TTUEmulator.h.

Definition at line 81 of file TTUEmulator.h.

Referenced by emulate(), initialise(), printinfo(), processTtu(), setSpecifications(), and TTUEmulator().

int TTUEmulator::m_mode [private]

Definition at line 121 of file TTUEmulator.h.

Referenced by mode(), setmode(), setSpecifications(), and TTUEmulator().

std::bitset<2> TTUEmulator::m_trigger

Definition at line 84 of file TTUEmulator.h.

Referenced by processTtu(), and TTUEmulator().

std::map<int, std::bitset<2> > TTUEmulator::m_triggerBx

Definition at line 85 of file TTUEmulator.h.

Referenced by processTtu().

Definition at line 113 of file TTUEmulator.h.

Referenced by clearTriggerResponse(), processTtu(), and RPCTechnicalTrigger::produce().

Definition at line 130 of file TTUEmulator.h.

Referenced by initialise(), processTtu(), setSpecifications(), TTUEmulator(), and ~TTUEmulator().

Definition at line 128 of file TTUEmulator.h.

Referenced by processTtu(), TTUEmulator(), and ~TTUEmulator().

int* TTUEmulator::m_wheelIds [private]

Definition at line 124 of file TTUEmulator.h.

Referenced by TTUEmulator(), and ~TTUEmulator().