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.

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

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

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 }
struct CSCTriggerMapping::CSCTriggerConnection Connection
int swId(int endcap, int station, int sector, int subsector, int cscid) const
std::map< int, int > hw2sw_
bool debugV(void) const
std::vector< Connection > mapping_
virtual int hwId(int endcap, int station, int sector, int subsector, int cscid) const =0

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

References gather_cfg::cout, debugV(), makeMuonMisalignmentScenario::endcap, hw2sw_, hwId(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, myName_, nano_mu_digi_cff::sector, relativeConstraints::station, and nano_mu_digi_cff::subsector.

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())
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 }
std::map< int, int > hw2sw_
bool debugV(void) const
virtual int hwId(int endcap, int station, int sector, int subsector, int cscid) const =0

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

References chamber(), makeMuonMisalignmentScenario::endcap, nano_mu_digi_cff::layer, nano_mu_digi_cff::sector, relativeConstraints::station, and nano_mu_digi_cff::subsector.

Referenced by CSCTFUnpacker::produce().

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

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

References myName_.

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

126 { return myName_; }

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

References debugV_.

116 { debugV_ = dbg; }

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

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

Referenced by addRecord().

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

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