CMS 3D CMS Logo

CTPPSDetId.cc
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * This is a part of TOTEM offline software.
4  * Authors:
5  * Hubert Niewiadomski
6  * Jan Kašpar (jan.kaspar@gmail.com)
7  *
8  ****************************************************************************/
9 
11 
13 
14 using namespace std;
15 
16 //----------------------------------------------------------------------------------------------------
17 
18 const uint32_t CTPPSDetId::startArmBit = 24, CTPPSDetId::maskArm = 0x1, CTPPSDetId::maxArm = 1,
19  CTPPSDetId::lowMaskArm = 0xFFFFFF;
21  CTPPSDetId::lowMaskStation = 0x3FFFFF;
22 const uint32_t CTPPSDetId::startRPBit = 19, CTPPSDetId::maskRP = 0x7, CTPPSDetId::maxRP = 6,
23  CTPPSDetId::lowMaskRP = 0x7FFFF;
24 
25 const string CTPPSDetId::subDetectorNames[] = {
26  "", "", "", "ctpps_tr_strip", "ctpps_tr_pixel", "ctpps_ti_diamond", "ctpps_ti_fastsilicon"};
27 const string CTPPSDetId::subDetectorPaths[] = {
28  "", "", "", "CTPPS/TrackingStrip", "CTPPS/TrackingPixel", "CTPPS/TimingDiamond", "CTPPS/TimingFastSilicon"};
29 const string CTPPSDetId::armNames[] = {"45", "56"};
30 const string CTPPSDetId::stationNames[] = {"210", "220cyl", "220"};
31 const string CTPPSDetId::rpNames[] = {"nr_tp", "nr_bt", "nr_hr", "fr_hr", "fr_tp", "fr_bt", "cyl_hr"};
32 
33 //----------------------------------------------------------------------------------------------------
34 
35 CTPPSDetId::CTPPSDetId(uint32_t id) : DetId(id) {
36  bool inputOK = (det() == DetId::VeryForward);
37 
38  if (!inputOK) {
39  throw cms::Exception("InvalidDetId") << "CTPPSDetId ctor:"
40  << " det: " << det() << " subdet: " << subdetId()
41  << " is not a valid CTPPS id.";
42  }
43 }
44 
45 //----------------------------------------------------------------------------------------------------
46 
47 CTPPSDetId::CTPPSDetId(uint32_t SubDet, uint32_t Arm, uint32_t Station, uint32_t RomanPot)
48  : DetId(DetId::VeryForward, SubDet) {
51  throw cms::Exception("InvalidDetId") << "CTPPSDetId ctor: invalid sub-detector " << SubDet << ".";
52  }
53 
54  if (Arm > maxArm || Station > maxStation || RomanPot > maxRP) {
55  throw cms::Exception("InvalidDetId") << "CTPPSDetId ctor:"
56  << " Invalid parameters:"
57  << " arm=" << Arm << " station=" << Station << " rp=" << RomanPot << std::endl;
58  }
59 
60  uint32_t ok = 0xfe000000;
61  id_ &= ok;
62 
63  id_ |= ((Arm & maskArm) << startArmBit);
64  id_ |= ((Station & maskStation) << startStationBit);
65  id_ |= ((RomanPot & maskRP) << startRPBit);
66 }
67 
68 //----------------------------------------------------------------------------------------------------
69 
70 std::ostream& operator<<(std::ostream& os, const CTPPSDetId& id) {
71  os << "subDet=" << id.subdetId() << " arm=" << id.arm() << " station=" << id.station() << " rp=" << id.rp();
72 
73  return os;
74 }
CTPPSDetId::subDetectorPaths
static const std::string subDetectorPaths[]
Definition: CTPPSDetId.h:152
CTPPSDetId::maxRP
static const uint32_t maxRP
Definition: CTPPSDetId.h:51
CTPPSDetId::subDetectorNames
static const std::string subDetectorNames[]
Definition: CTPPSDetId.h:151
CTPPSDetId::CTPPSDetId
CTPPSDetId(uint32_t id)
Construct from a raw id.
Definition: CTPPSDetId.cc:34
CTPPSDetId::rpNames
static const std::string rpNames[]
Definition: CTPPSDetId.h:155
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
CTPPSDetId::maxArm
static const uint32_t maxArm
Definition: CTPPSDetId.h:49
CTPPSDetId::sdTimingFastSilicon
Definition: CTPPSDetId.h:44
CTPPSDetId::lowMaskArm
static const uint32_t lowMaskArm
Definition: CTPPSDetId.h:49
CTPPSDetId::startArmBit
static const uint32_t startArmBit
Definition: CTPPSDetId.h:49
DetId::VeryForward
Definition: DetId.h:31
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
DetId
Definition: DetId.h:17
CTPPSDetId::sdTrackingStrip
Definition: CTPPSDetId.h:44
CTPPSDetId::startStationBit
static const uint32_t startStationBit
Definition: CTPPSDetId.h:50
CTPPSDetId::lowMaskRP
static const uint32_t lowMaskRP
Definition: CTPPSDetId.h:51
ntupleEnum.SubDet
SubDet
Definition: ntupleEnum.py:15
CTPPSDetId::sdTimingDiamond
Definition: CTPPSDetId.h:44
CTPPSDetId::sdTrackingPixel
Definition: CTPPSDetId.h:44
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
CTPPSDetId::stationNames
static const std::string stationNames[]
Definition: CTPPSDetId.h:154
DetId::id_
uint32_t id_
Definition: DetId.h:69
CTPPSDetId
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:31
CTPPSDetId::maskStation
static const uint32_t maskStation
Definition: CTPPSDetId.h:50
CTPPSDetId::maxStation
static const uint32_t maxStation
Definition: CTPPSDetId.h:50
CTPPSDetId::startRPBit
static const uint32_t startRPBit
Definition: CTPPSDetId.h:51
std
Definition: JetResolutionObject.h:76
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
Exception
Definition: hltDiff.cc:246
CTPPSDetId.h
Exception.h
CTPPSDetId::lowMaskStation
static const uint32_t lowMaskStation
Definition: CTPPSDetId.h:50
CTPPSDetId::armNames
static const std::string armNames[]
Definition: CTPPSDetId.h:153
operator<<
std::ostream & operator<<(std::ostream &os, const CTPPSDetId &id)
Definition: CTPPSDetId.cc:69
CTPPSDetId::maskArm
static const uint32_t maskArm
Definition: CTPPSDetId.h:49
CTPPSDetId::maskRP
static const uint32_t maskRP
Definition: CTPPSDetId.h:51