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", "totem_t2"};
27 const string CTPPSDetId::subDetectorPaths[] = {"",
28  "",
29  "",
30  "CTPPS/TrackingStrip",
31  "CTPPS/TrackingPixel",
32  "CTPPS/TimingDiamond",
33  "CTPPS/TimingFastSilicon",
34  "TotemT2"};
35 const string CTPPSDetId::armNames[] = {"45", "56"};
36 const string CTPPSDetId::stationNames[] = {"210", "220cyl", "220"};
37 const string CTPPSDetId::rpNames[] = {"nr_tp", "nr_bt", "nr_hr", "fr_hr", "fr_tp", "fr_bt", "cyl_hr"};
38 
39 //----------------------------------------------------------------------------------------------------
40 
41 CTPPSDetId::CTPPSDetId(uint32_t id) : DetId(id) {
42  bool inputOK = (det() == DetId::VeryForward);
43 
44  if (!inputOK) {
45  throw cms::Exception("InvalidDetId") << "CTPPSDetId ctor:"
46  << " det: " << det() << " subdet: " << subdetId()
47  << " is not a valid CTPPS id.";
48  }
49 }
50 
51 //----------------------------------------------------------------------------------------------------
52 
53 CTPPSDetId::CTPPSDetId(uint32_t SubDet, uint32_t Arm, uint32_t Station, uint32_t RomanPot)
54  : DetId(DetId::VeryForward, SubDet) {
57  throw cms::Exception("InvalidDetId") << "CTPPSDetId ctor: invalid sub-detector " << SubDet << ".";
58  }
59 
60  if (Arm > maxArm || Station > maxStation || RomanPot > maxRP) {
61  throw cms::Exception("InvalidDetId") << "CTPPSDetId ctor:"
62  << " Invalid parameters:"
63  << " arm=" << Arm << " station=" << Station << " rp=" << RomanPot << std::endl;
64  }
65 
66  uint32_t ok = 0xfe000000;
67  id_ &= ok;
68 
69  id_ |= ((Arm & maskArm) << startArmBit);
70  id_ |= ((Station & maskStation) << startStationBit);
71  id_ |= ((RomanPot & maskRP) << startRPBit);
72 }
73 
74 //----------------------------------------------------------------------------------------------------
75 
76 std::ostream& operator<<(std::ostream& os, const CTPPSDetId& id) {
77  os << "subDet=" << id.subdetId() << " arm=" << id.arm() << " station=" << id.station() << " rp=" << id.rp();
78 
79  return os;
80 }
std::ostream & operator<<(std::ostream &os, const CTPPSDetId &id)
Definition: CTPPSDetId.cc:76
static const uint32_t maxStation
Definition: CTPPSDetId.h:52
static const uint32_t startRPBit
Definition: CTPPSDetId.h:53
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
static const uint32_t maskStation
Definition: CTPPSDetId.h:52
static const uint32_t maskRP
Definition: CTPPSDetId.h:53
static const std::string armNames[]
Definition: CTPPSDetId.h:155
static const uint32_t lowMaskStation
Definition: CTPPSDetId.h:52
static const uint32_t maskArm
Definition: CTPPSDetId.h:51
static const uint32_t maxArm
Definition: CTPPSDetId.h:51
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static const std::string subDetectorPaths[]
Definition: CTPPSDetId.h:154
static const uint32_t maxRP
Definition: CTPPSDetId.h:53
static const std::string rpNames[]
Definition: CTPPSDetId.h:157
static const std::string subDetectorNames[]
Definition: CTPPSDetId.h:153
Definition: DetId.h:17
uint32_t id_
Definition: DetId.h:69
static const uint32_t startStationBit
Definition: CTPPSDetId.h:52
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
CTPPSDetId(uint32_t id)
Construct from a raw id.
Definition: CTPPSDetId.cc:41
static const uint32_t startArmBit
Definition: CTPPSDetId.h:51
static const std::string stationNames[]
Definition: CTPPSDetId.h:156
static const uint32_t lowMaskArm
Definition: CTPPSDetId.h:51
static const uint32_t lowMaskRP
Definition: CTPPSDetId.h:53