#include <CondFormats/CSCObjects/interface/CSCTriggerMapping.h>
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) |
Add one record of info to mapping. | |
int | 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). | |
CSCTriggerMapping () | |
Default constructor. | |
bool | debugV (void) const |
Status of debug printout flag. | |
CSCDetId | 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. | |
virtual void | fill (void)=0 |
Fill mapping store. | |
const std::string & | myName (void) const |
Return class name. | |
void | setDebugV (bool dbg) |
Set debug printout flag. | |
virtual | ~CSCTriggerMapping () |
Destructor. | |
Private Member Functions | |
virtual int | hwId (int endcap, int station, int sector, int subsector, int cscid) const =0 |
Build a unique integer out of the readout electronics labels. | |
int | swId (int endcap, int station, int sector, int subsector, int cscid) const |
Build a unique integer out of chamber labels. | |
Private Attributes | |
bool | debugV_ |
std::map< int, int > | hw2sw_ |
std::vector< Connection > | mapping_ |
std::string | myName_ |
Classes | |
struct | CSCTriggerConnection |
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. More... |
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.
CSCTriggerMapping::CSCTriggerMapping | ( | ) |
CSCTriggerMapping::~CSCTriggerMapping | ( | ) | [virtual] |
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 GenMuonPlsPt100GeV_cfg::cout, debugV(), lat::endl(), hw2sw_, hwId(), mapping_, myName_, and swId().
Referenced by CSCTFUnpacker::CSCTFUnpacker(), CSCTriggerMappingFromFile::fill(), and CSCTriggerElectronicsMappingFromFile::fill().
00034 { 00035 00036 Connection newRecord( rendcap, rstation, rsector, rsubsector, rcscid, cendcap, cstation, csector, csubsector, ccscid ); 00037 mapping_.push_back( newRecord ); 00038 int hid = hwId( rendcap, rstation, rsector, rsubsector, rcscid ); 00039 int sid = swId( cendcap, cstation, csector, csubsector, ccscid ); 00040 if ( debugV() ) std::cout << myName_ << ": map hw " << hid << " to sw " << sid << std::endl; 00041 if ( hw2sw_.insert( std::make_pair( hid, sid) ).second ) { 00042 if ( debugV() ) std::cout << myName_ << ": insert pair succeeded." << std::endl; 00043 } 00044 else { 00045 std::cout << myName_ << ": ERROR, already have key = " << hid << std::endl; 00046 } 00047 }
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 GenMuonPlsPt100GeV_cfg::cout, debugV(), lat::endl(), hw2sw_, hwId(), it, and myName_.
Referenced by detId(), CSCTriggerSimpleMapping::hwId(), and swId().
00009 { 00010 // Build hw id from input, find sw id to match 00011 int cid = 0; 00012 int hid = hwId( endcap, station, sector, subsector, cscid ); 00013 // Search for that hw id in mapping 00014 std::map<int,int>::const_iterator it = hw2sw_.find( hid ); 00015 if ( it != hw2sw_.end() ) { 00016 cid = it->second; 00017 if ( debugV() ) std::cout << myName_ << ": for requested hw id = " << hid << 00018 ", found sw id = " << cid << std::endl; 00019 } 00020 else { 00021 std::cout << myName_ << ": ERROR, cannot find requested hw id = " << hid << 00022 " in mapping." << std::endl; 00023 } 00024 return cid; 00025 }
Status of debug printout flag.
Definition at line 95 of file CSCTriggerMapping.h.
References debugV_.
Referenced by addRecord(), chamber(), CSCTriggerMappingFromFile::fill(), CSCTriggerElectronicsMappingFromFile::fill(), CSCTriggerElectronicsMapping::hwId(), and CSCTriggerSimpleMapping::hwId().
00095 { return debugV_; }
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().
Referenced by CSCTFValidator::analyze(), and CSCTFUnpacker::produce().
00027 { 00028 int cid = chamber( endcap, station, sector, subsector, cscid ); 00029 int lid = cid + layer; 00030 return CSCDetId( lid ); 00031 }
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().
00100 { return myName_; }
Set debug printout flag.
Definition at line 90 of file CSCTriggerMapping.h.
References debugV_.
00090 { 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(), and CSCTriggerNumbering::ringFromTriggerLabels().
Referenced by addRecord().
00049 { 00050 // Software id is just CSCDetId for the chamber 00051 int ring = CSCTriggerNumbering::ringFromTriggerLabels(station, cscid); 00052 int chamber = CSCTriggerNumbering::chamberFromTriggerLabels(sector,subsector,station,cscid); 00053 return CSCDetId::rawIdMaker( endcap, station, ring, chamber, 0 ); // usual detid for chamber, i.e. layer=0 00054 }
bool CSCTriggerMapping::debugV_ [private] |
std::map< int, int > CSCTriggerMapping::hw2sw_ [private] |
std::vector< Connection > CSCTriggerMapping::mapping_ [private] |
std::string CSCTriggerMapping::myName_ [private] |
Definition at line 117 of file CSCTriggerMapping.h.
Referenced by addRecord(), chamber(), and myName().