CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes

CSCTriggerMapping Class Reference

#include <CSCTriggerMapping.h>

Inheritance diagram for CSCTriggerMapping:
CSCTriggerElectronicsMapping CSCTriggerSimpleMapping CSCTriggerElectronicsMappingFromFile CSCTriggerMappingFromFile

List of all members.

Classes

struct  CSCTriggerConnection

Public Types

typedef struct
CSCTriggerMapping::CSCTriggerConnection 
Connection

Public Member Functions

void addRecord (int rendcap, int rstation, int rsector, int rsubsector, int rcscid, int cendcap, int cstation, int csector, int csubsector, int ccscid)
int chamber (int endcap, int station, int sector, int subsector, int cscid) const
 CSCTriggerMapping ()
 Default constructor.
bool debugV (void) const
CSCDetId detId (int endcap, int station, int sector, int subsector, int cscid, int layer=0) const
virtual void fill (void)=0
const std::string & myName (void) const
void setDebugV (bool dbg)
virtual ~CSCTriggerMapping ()
 Destructor.

Private Member Functions

virtual int hwId (int endcap, int station, int sector, int subsector, int cscid) const =0
int swId (int endcap, int station, int sector, int subsector, int cscid) const

Private Attributes

bool debugV_
std::map< int, int > hw2sw_
std::vector< Connectionmapping_
std::string myName_

Detailed Description

Author:
Lindsey Gray (taken from T. Cox's design) Abstract class to define mapping between CSC Trigger Hardware labels and geometry labels. Basically this amounts to a cabling scheme.

Defines the ids and labels in the mapping and supplies tramslation interface. A derived class must define how hardware labels map to a unique integer. A derived, concrete, class must define from where the mapping information comes.

Definition at line 21 of file CSCTriggerMapping.h.


Member Typedef Documentation

Instead of a set of vectors of int use one vector of a set of ints Defines a connection between a chamber on a disc and a readout label. This is equivalent to the placement of a board in a crate, and a MPC to SR/SP optical connection. Construction of CSCDetIds is done using CSCTriggerNumbering.

variables with a 'r' prefix are readout-derived labels variables with a 'c' prefix are geometry-derived labels (c as in chamber label)

Warning:
ALL LABELS ARE TRIGGER LABELS. PLEASE ACCOUNT FOR THIS!!!

Constructor & Destructor Documentation

CSCTriggerMapping::CSCTriggerMapping ( )

Default constructor.

Definition at line 5 of file CSCTriggerMapping.cc.

: myName_("CSCTriggerMapping"), debugV_( false ) {}
CSCTriggerMapping::~CSCTriggerMapping ( ) [virtual]

Destructor.

Definition at line 7 of file CSCTriggerMapping.cc.

{}

Member Function Documentation

void CSCTriggerMapping::addRecord ( int  rendcap,
int  rstation,
int  rsector,
int  rsubsector,
int  rcscid,
int  cendcap,
int  cstation,
int  csector,
int  csubsector,
int  ccscid 
)

Add one record of info to mapping

Definition at line 33 of file CSCTriggerMapping.cc.

References gather_cfg::cout, debugV(), hw2sw_, hwId(), mapping_, myName_, evf::utils::sid, and swId().

Referenced by CSCTFUnpacker::CSCTFUnpacker(), CSCTriggerMappingFromFile::fill(), and CSCTriggerElectronicsMappingFromFile::fill().

                                                                                                        {

  Connection newRecord( rendcap, rstation, rsector, rsubsector, rcscid, cendcap, cstation, csector, csubsector, ccscid );
  mapping_.push_back( newRecord );
  int hid = hwId( rendcap, rstation, rsector, rsubsector, rcscid );
  int sid = swId( cendcap, cstation, csector, csubsector, ccscid );
  if ( debugV() ) std::cout << myName_ << ": map hw " << hid << " to sw " << sid << std::endl;
  if ( hw2sw_.insert( std::make_pair( hid, sid) ).second ) {
    if ( debugV() ) std::cout << myName_ << ": insert pair succeeded." << std::endl;
  }
  else {
    std::cout << myName_ << ": ERROR, already have key = " << hid << std::endl;
  }
} 
int CSCTriggerMapping::chamber ( int  endcap,
int  station,
int  sector,
int  subsector,
int  cscid 
) const

Return chamber label corresponding to readout ids station, sector, subsector and cscid for given endcap endcap = 1 (+z), 2 (-z), station, sector, subsector, cscid (dmb slot/2)

Definition at line 9 of file CSCTriggerMapping.cc.

References gather_cfg::cout, debugV(), hw2sw_, hwId(), and myName_.

Referenced by detId(), CSCTriggerSimpleMapping::hwId(), and swId().

                                                                                                    {
  // Build hw id from input, find sw id to match
  int cid = 0;
  int hid = hwId( endcap, station, sector, subsector, cscid );
  // Search for that hw id in mapping
  std::map<int,int>::const_iterator it = hw2sw_.find( hid );
  if ( it != hw2sw_.end() ) {
    cid = it->second;
    if ( debugV() ) std::cout << myName_ << ": for requested hw id = " << hid <<
       ", found sw id = " << cid << std::endl;
  }
  else {
    std::cout << myName_ << ": ERROR, cannot find requested hw id = " << hid <<
      " in mapping." << std::endl;
  }
  return cid;
}
bool CSCTriggerMapping::debugV ( void  ) const [inline]
CSCDetId CSCTriggerMapping::detId ( int  endcap,
int  station,
int  sector,
int  subsector,
int  cscid,
int  layer = 0 
) const

Return CSCDetId for chamber/layer corresponding to readout ids station, sector, subsector and cscid for given endcap and layer no. 1-6, or for chamber if no layer no. supplied. Args: endcap = 1 (+z), 2 (-z), station, readout sector, readout subsector, readout cscid, layer#

Definition at line 27 of file CSCTriggerMapping.cc.

References chamber(), and CSCDetId.

Referenced by CSCTFUnpacker::produce().

                                                                                                                  {
  int cid = chamber( endcap, station, sector, subsector, cscid );
  int lid = cid + layer;
  return CSCDetId( lid );
}
virtual void CSCTriggerMapping::fill ( void  ) [pure virtual]

Fill mapping store

Implemented in CSCTriggerElectronicsMappingFromFile, and CSCTriggerMappingFromFile.

virtual int CSCTriggerMapping::hwId ( int  endcap,
int  station,
int  sector,
int  subsector,
int  cscid 
) const [private, pure virtual]

Build a unique integer out of the readout electronics labels.

Implemented in CSCTriggerElectronicsMapping, and CSCTriggerSimpleMapping.

Referenced by addRecord(), and chamber().

const std::string& CSCTriggerMapping::myName ( void  ) const [inline]

Return class name

Definition at line 100 of file CSCTriggerMapping.h.

References myName_.

Referenced by CSCTriggerElectronicsMapping::hwId(), and CSCTriggerSimpleMapping::hwId().

{ return myName_; }
void CSCTriggerMapping::setDebugV ( bool  dbg) [inline]

Set debug printout flag

Definition at line 90 of file CSCTriggerMapping.h.

References debugV_.

{ debugV_ = dbg; }
int CSCTriggerMapping::swId ( int  endcap,
int  station,
int  sector,
int  subsector,
int  cscid 
) const [private]

Build a unique integer out of chamber labels.

Translate to geometry labels then use rawId.

Definition at line 49 of file CSCTriggerMapping.cc.

References chamber(), CSCTriggerNumbering::chamberFromTriggerLabels(), CSCDetId::rawIdMaker(), relativeConstraints::ring, and CSCTriggerNumbering::ringFromTriggerLabels().

Referenced by addRecord().

                                                                                                 {
  // Software id is just CSCDetId for the chamber
  int ring = CSCTriggerNumbering::ringFromTriggerLabels(station, cscid);
  int chamber = CSCTriggerNumbering::chamberFromTriggerLabels(sector,subsector,station,cscid);
  return CSCDetId::rawIdMaker( endcap, station, ring, chamber, 0 ); // usual detid for chamber, i.e. layer=0
}

Member Data Documentation

Definition at line 118 of file CSCTriggerMapping.h.

Referenced by debugV(), and setDebugV().

std::map< int, int > CSCTriggerMapping::hw2sw_ [private]

Definition at line 120 of file CSCTriggerMapping.h.

Referenced by addRecord(), and chamber().

std::vector< Connection > CSCTriggerMapping::mapping_ [private]

Definition at line 119 of file CSCTriggerMapping.h.

Referenced by addRecord().

std::string CSCTriggerMapping::myName_ [private]

Definition at line 117 of file CSCTriggerMapping.h.

Referenced by addRecord(), chamber(), and myName().