CMS 3D CMS Logo

TotemRPDetId.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 
22 
23 const string TotemRPDetId::planeNames[] = {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10"};
24 const string TotemRPDetId::chipNames[] = {"1", "2", "3", "4"};
25 
26 //----------------------------------------------------------------------------------------------------
27 
29  bool inputOK = (det() == DetId::VeryForward && subdetId() == sdTrackingStrip);
30 
31  if (!inputOK) {
32  throw cms::Exception("InvalidDetId") << "TotemRPDetId ctor:"
33  << " det: " << det() << " subdet: " << subdetId()
34  << " is not a valid TotemRP id.";
35  }
36 }
37 
38 //----------------------------------------------------------------------------------------------------
39 
40 TotemRPDetId::TotemRPDetId(uint32_t Arm, uint32_t Station, uint32_t RomanPot, uint32_t Plane, uint32_t Chip)
41  : CTPPSDetId(sdTrackingStrip, Arm, Station, RomanPot) {
42  if (Arm > maxArm || Station > maxStation || RomanPot > maxRP || Plane > maxPlane || Chip > maxChip) {
43  throw cms::Exception("InvalidDetId") << "TotemRPDetId ctor:"
44  << " Invalid parameters:"
45  << " arm=" << Arm << " station=" << Station << " rp=" << RomanPot
46  << " plane=" << Plane << " chip=" << Chip << std::endl;
47  }
48 
49  uint32_t ok = 0xfe000000;
50  id_ &= ok;
51 
52  id_ |= ((Arm & maskArm) << startArmBit);
53  id_ |= ((Station & maskStation) << startStationBit);
54  id_ |= ((RomanPot & maskRP) << startRPBit);
55  id_ |= ((Plane & maskPlane) << startPlaneBit);
56  id_ |= ((Chip & maskChip) << startChipBit);
57 }
58 
59 //----------------------------------------------------------------------------------------------------
60 
61 std::ostream& operator<<(std::ostream& os, const TotemRPDetId& id) {
62  os << "arm=" << id.arm() << " station=" << id.station() << " rp=" << id.rp() << " plane=" << id.plane()
63  << " chip=" << id.chip();
64 
65  return os;
66 }
TotemRPDetId::lowMaskPlane
static const uint32_t lowMaskPlane
Definition: TotemRPDetId.h:46
CTPPSDetId::maxRP
static const uint32_t maxRP
Definition: CTPPSDetId.h:51
TotemRPDetId::maskChip
static const uint32_t maskChip
Definition: TotemRPDetId.h:47
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
operator<<
std::ostream & operator<<(std::ostream &os, const TotemRPDetId &id)
Definition: TotemRPDetId.cc:60
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
TotemRPDetId::startPlaneBit
static const uint32_t startPlaneBit
Definition: TotemRPDetId.h:46
CTPPSDetId::sdTrackingStrip
Definition: CTPPSDetId.h:44
CTPPSDetId::startStationBit
static const uint32_t startStationBit
Definition: CTPPSDetId.h:50
TotemRPDetId::maxPlane
static const uint32_t maxPlane
Definition: TotemRPDetId.h:46
TotemRPDetId::startChipBit
static const uint32_t startChipBit
Definition: TotemRPDetId.h:47
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
TotemRPDetId::chipNames
static const std::string chipNames[]
Definition: TotemRPDetId.h:122
DetId::id_
uint32_t id_
Definition: DetId.h:69
TotemRPDetId::lowMaskChip
static const uint32_t lowMaskChip
Definition: TotemRPDetId.h:47
TotemRPDetId::planeNames
static const std::string planeNames[]
Definition: TotemRPDetId.h:121
CTPPSDetId
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:31
TotemRPDetId::maxChip
static const uint32_t maxChip
Definition: TotemRPDetId.h:47
CTPPSDetId::maskStation
static const uint32_t maskStation
Definition: CTPPSDetId.h:50
CTPPSDetId::maxStation
static const uint32_t maxStation
Definition: CTPPSDetId.h:50
TotemRPDetId::TotemRPDetId
TotemRPDetId(uint32_t id)
Definition: TotemRPDetId.cc:27
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
Plane
Definition: Plane.h:16
TotemRPDetId.h
Exception.h
TotemRPDetId
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:29
TotemRPDetId::maskPlane
static const uint32_t maskPlane
Definition: TotemRPDetId.h:46
CTPPSDetId::maskArm
static const uint32_t maskArm
Definition: CTPPSDetId.h:49
CTPPSDetId::maskRP
static const uint32_t maskRP
Definition: CTPPSDetId.h:51