CMS 3D CMS Logo

CSCTriggerMapping.cc
Go to the documentation of this file.
3 #include <iostream>
4 
5 CSCTriggerMapping::CSCTriggerMapping() : myName_("CSCTriggerMapping"), debugV_(false) {}
6 
8 
9 int CSCTriggerMapping::chamber(int endcap, int station, int sector, int subsector, int cscid) const {
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 }
24 
25 CSCDetId CSCTriggerMapping::detId(int endcap, int station, int sector, int subsector, int cscid, int layer) const {
26  int cid = chamber(endcap, station, sector, subsector, cscid);
27  int lid = cid + layer;
28  return CSCDetId(lid);
29 }
30 
32  int rstation,
33  int rsector,
34  int rsubsector,
35  int rcscid,
36  int cendcap,
37  int cstation,
38  int csector,
39  int csubsector,
40  int ccscid) {
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 }
54 
55 int CSCTriggerMapping::swId(int endcap, int station, int sector, int subsector, int cscid) const {
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 }
CSCTriggerMapping::detId
CSCDetId detId(int endcap, int station, int sector, int subsector, int cscid, int layer=0) const
Definition: CSCTriggerMapping.cc:25
CSCTriggerMapping::hwId
virtual int hwId(int endcap, int station, int sector, int subsector, int cscid) const =0
funct::false
false
Definition: Factorize.h:29
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
CSCTriggerMapping::CSCTriggerMapping
CSCTriggerMapping()
Default constructor.
Definition: CSCTriggerMapping.cc:5
CSCDetId::rawIdMaker
static int rawIdMaker(int iendcap, int istation, int iring, int ichamber, int ilayer)
Definition: CSCDetId.h:131
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
CSCTriggerMapping.h
CSCTriggerMapping::swId
int swId(int endcap, int station, int sector, int subsector, int cscid) const
Definition: CSCTriggerMapping.cc:55
CSCTriggerNumbering.h
CSCTriggerMapping::addRecord
void addRecord(int rendcap, int rstation, int rsector, int rsubsector, int rcscid, int cendcap, int cstation, int csector, int csubsector, int ccscid)
Definition: CSCTriggerMapping.cc:31
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
CSCTriggerMapping::~CSCTriggerMapping
virtual ~CSCTriggerMapping()
Destructor.
Definition: CSCTriggerMapping.cc:7
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::CSCTriggerConnection
Definition: CSCTriggerMapping.h:42
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::mapping_
std::vector< Connection > mapping_
Definition: CSCTriggerMapping.h:144