CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
CSCTriggerMapping Class Referenceabstract

#include <CSCTriggerMapping.h>

Inheritance diagram for CSCTriggerMapping:
CSCTriggerElectronicsMapping CSCTriggerSimpleMapping CSCTriggerElectronicsMappingFromFile CSCTriggerMappingFromFile

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. More...
 
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. More...
 

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.

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

Destructor.

Definition at line 7 of file CSCTriggerMapping.cc.

7 {}

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(), CSCTriggerElectronicsMappingFromFile::fill(), and CSCTriggerMappingFromFile::fill().

34  {
35 
36  Connection newRecord( rendcap, rstation, rsector, rsubsector, rcscid, cendcap, cstation, csector, csubsector, ccscid );
37  mapping_.push_back( newRecord );
38  int hid = hwId( rendcap, rstation, rsector, rsubsector, rcscid );
39  int sid = swId( cendcap, cstation, csector, csubsector, ccscid );
40  if ( debugV() ) std::cout << myName_ << ": map hw " << hid << " to sw " << sid << std::endl;
41  if ( hw2sw_.insert( std::make_pair( hid, sid) ).second ) {
42  if ( debugV() ) std::cout << myName_ << ": insert pair succeeded." << std::endl;
43  }
44  else {
45  std::cout << myName_ << ": ERROR, already have key = " << hid << std::endl;
46  }
47 }
std::map< int, int > hw2sw_
struct CSCTriggerMapping::CSCTriggerConnection Connection
bool debugV(void) const
std::vector< Connection > mapping_
int swId(int endcap, int station, int sector, int subsector, int cscid) const
tuple cout
Definition: gather_cfg.py:121
virtual int hwId(int endcap, int station, int sector, int subsector, int cscid) const =0
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(), geometryXMLparser.CSCAlignable::index(), and swId().

9  {
10  // Build hw id from input, find sw id to match
11  int cid = 0;
12  int hid = hwId( endcap, station, sector, subsector, cscid );
13  // Search for that hw id in mapping
14  std::map<int,int>::const_iterator it = hw2sw_.find( hid );
15  if ( it != hw2sw_.end() ) {
16  cid = it->second;
17  if ( debugV() ) std::cout << myName_ << ": for requested hw id = " << hid <<
18  ", found sw id = " << cid << std::endl;
19  }
20  else {
21  std::cout << myName_ << ": ERROR, cannot find requested hw id = " << hid <<
22  " in mapping." << std::endl;
23  }
24  return cid;
25 }
std::map< int, int > hw2sw_
bool debugV(void) const
tuple cout
Definition: gather_cfg.py:121
virtual int hwId(int endcap, int station, int sector, int subsector, int cscid) const =0
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().

27  {
28  int cid = chamber( endcap, station, sector, subsector, cscid );
29  int lid = cid + layer;
30  return CSCDetId( lid );
31 }
int chamber(int endcap, int station, int sector, int subsector, int cscid) const
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
privatepure 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().

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

Set debug printout flag

Definition at line 90 of file CSCTriggerMapping.h.

References debugV_.

90 { 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().

49  {
50  // Software id is just CSCDetId for the chamber
53  return CSCDetId::rawIdMaker( endcap, station, ring, chamber, 0 ); // usual detid for chamber, i.e. layer=0
54 }
int chamber(int endcap, int station, int sector, int subsector, int cscid) const
static int rawIdMaker(int iendcap, int istation, int iring, int ichamber, int ilayer)
Definition: CSCDetId.h:146
static int ringFromTriggerLabels(int station, int triggerCSCID)
static int chamberFromTriggerLabels(int TriggerSector, int TriggerSubSector, int station, int TriggerCSCID)

Member Data Documentation

bool CSCTriggerMapping::debugV_
private

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().