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) {
49  if (SubDet != sdTrackingStrip && SubDet != sdTrackingPixel && SubDet != sdTimingDiamond &&
50  SubDet != sdTimingFastSilicon) {
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 }
std::ostream & operator<<(std::ostream &os, const CTPPSDetId &id)
Definition: CTPPSDetId.cc:70
static const uint32_t maxStation
Definition: CTPPSDetId.h:46
static const uint32_t startRPBit
Definition: CTPPSDetId.h:47
static const uint32_t maskStation
Definition: CTPPSDetId.h:46
static const uint32_t maskRP
Definition: CTPPSDetId.h:47
static const std::string armNames[]
Definition: CTPPSDetId.h:149
static const uint32_t lowMaskStation
Definition: CTPPSDetId.h:46
static const uint32_t maskArm
Definition: CTPPSDetId.h:45
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 uint32_t maxArm
Definition: CTPPSDetId.h:45
static const std::string subDetectorPaths[]
Definition: CTPPSDetId.h:148
static const uint32_t maxRP
Definition: CTPPSDetId.h:47
static const std::string rpNames[]
Definition: CTPPSDetId.h:151
static const std::string subDetectorNames[]
Definition: CTPPSDetId.h:147
Definition: DetId.h:17
uint32_t id_
Definition: DetId.h:69
static const uint32_t startStationBit
Definition: CTPPSDetId.h:46
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
CTPPSDetId(uint32_t id)
Construct from a raw id.
Definition: CTPPSDetId.cc:35
static const uint32_t startArmBit
Definition: CTPPSDetId.h:45
static const std::string stationNames[]
Definition: CTPPSDetId.h:150
static const uint32_t lowMaskArm
Definition: CTPPSDetId.h:45
static const uint32_t lowMaskRP
Definition: CTPPSDetId.h:47
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46