CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
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
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 
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_
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

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 23 of file CSCTriggerMapping.h.

Member Typedef Documentation

◆ Connection

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::CSCTriggerMapping ( )

Default constructor.

Definition at line 5 of file CSCTriggerMapping.cc.

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

◆ ~CSCTriggerMapping()

CSCTriggerMapping::~CSCTriggerMapping ( )
virtual

Destructor.

Definition at line 7 of file CSCTriggerMapping.cc.

7 {}

Member Function Documentation

◆ addRecord()

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 31 of file CSCTriggerMapping.cc.

40  {
41  Connection newRecord(rendcap, rstation, rsector, rsubsector, rcscid, cendcap, cstation, csector, csubsector, ccscid);
42  mapping_.push_back(newRecord);
43  int hid = hwId(rendcap, rstation, rsector, rsubsector, rcscid);
44  int sid = swId(cendcap, cstation, csector, csubsector, ccscid);
45  if (debugV())
46  std::cout << myName_ << ": map hw " << hid << " to sw " << sid << std::endl;
47  if (hw2sw_.insert(std::make_pair(hid, sid)).second) {
48  if (debugV())
49  std::cout << myName_ << ": insert pair succeeded." << std::endl;
50  } else {
51  std::cout << myName_ << ": ERROR, already have key = " << hid << std::endl;
52  }
53 }

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

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

◆ chamber()

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.

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())
18  std::cout << myName_ << ": for requested hw id = " << hid << ", found sw id = " << cid << std::endl;
19  } else {
20  std::cout << myName_ << ": ERROR, cannot find requested hw id = " << hid << " in mapping." << std::endl;
21  }
22  return cid;
23 }

References gather_cfg::cout, debugV(), makeMuonMisalignmentScenario::endcap, hw2sw_, hwId(), myName_, and relativeConstraints::station.

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

◆ debugV()

bool CSCTriggerMapping::debugV ( void  ) const
inline

◆ detId()

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 25 of file CSCTriggerMapping.cc.

25  {
26  int cid = chamber(endcap, station, sector, subsector, cscid);
27  int lid = cid + layer;
28  return CSCDetId(lid);
29 }

References chamber(), makeMuonMisalignmentScenario::endcap, phase1PixelTopology::layer, and relativeConstraints::station.

Referenced by CSCTFUnpacker::produce().

◆ fill()

virtual void CSCTriggerMapping::fill ( void  )
pure virtual

Fill mapping store

Implemented in CSCTriggerElectronicsMappingFromFile, and CSCTriggerMappingFromFile.

◆ hwId()

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

◆ myName()

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

Return class name

Definition at line 126 of file CSCTriggerMapping.h.

126 { return myName_; }

References myName_.

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

◆ serialize()

template<class Archive >
void CSCTriggerMapping::serialize ( Archive &  ar,
const unsigned int  version 
)
private

◆ setDebugV()

void CSCTriggerMapping::setDebugV ( bool  dbg)
inline

Set debug printout flag

Definition at line 116 of file CSCTriggerMapping.h.

116 { debugV_ = dbg; }

References debugV_.

◆ swId()

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 55 of file CSCTriggerMapping.cc.

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

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

Referenced by addRecord().

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 147 of file CSCTriggerMapping.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 147 of file CSCTriggerMapping.h.

Member Data Documentation

◆ debugV_

bool CSCTriggerMapping::debugV_
private

Definition at line 143 of file CSCTriggerMapping.h.

Referenced by debugV(), and setDebugV().

◆ hw2sw_

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

Definition at line 145 of file CSCTriggerMapping.h.

Referenced by addRecord(), and chamber().

◆ mapping_

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

Definition at line 144 of file CSCTriggerMapping.h.

Referenced by addRecord().

◆ myName_

std::string CSCTriggerMapping::myName_
private

Definition at line 142 of file CSCTriggerMapping.h.

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

CSCTriggerMapping::Connection
struct CSCTriggerMapping::CSCTriggerConnection Connection
CSCTriggerMapping::hwId
virtual int hwId(int endcap, int station, int sector, int subsector, int cscid) const =0
CSCTriggerMapping::myName_
std::string myName_
Definition: CSCTriggerMapping.h:142
relativeConstraints.station
station
Definition: relativeConstraints.py:67
gather_cfg.cout
cout
Definition: gather_cfg.py:144
CSCDetId::rawIdMaker
static int rawIdMaker(int iendcap, int istation, int iring, int ichamber, int ilayer)
Definition: CSCDetId.h:146
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
CSCTriggerMapping::swId
int swId(int endcap, int station, int sector, int subsector, int cscid) const
Definition: CSCTriggerMapping.cc:55
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
CSCTriggerMapping::hw2sw_
std::map< int, int > hw2sw_
Definition: CSCTriggerMapping.h:145
CSCDetId
Definition: CSCDetId.h:26
CSCTriggerNumbering::ringFromTriggerLabels
static int ringFromTriggerLabels(int station, int triggerCSCID)
Definition: CSCTriggerNumbering.cc:5
CSCTriggerNumbering::chamberFromTriggerLabels
static int chamberFromTriggerLabels(int TriggerSector, int TriggerSubSector, int station, int TriggerCSCID)
Definition: CSCTriggerNumbering.cc:30
CSCTriggerMapping::chamber
int chamber(int endcap, int station, int sector, int subsector, int cscid) const
Definition: CSCTriggerMapping.cc:9
CSCTriggerMapping::debugV
bool debugV(void) const
Definition: CSCTriggerMapping.h:121
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
CSCTriggerMapping::debugV_
bool debugV_
Definition: CSCTriggerMapping.h:143
CSCTriggerMapping::mapping_
std::vector< Connection > mapping_
Definition: CSCTriggerMapping.h:144