CMS 3D CMS Logo

FastTimeDetId.cc
Go to the documentation of this file.
3 #include <ostream>
4 #include <iostream>
5 
7 
9 
10 FastTimeDetId::FastTimeDetId(uint32_t rawid) : DetId(rawid) {}
11 
12 FastTimeDetId::FastTimeDetId(int module_type, int module_iz, int module_iphi, int module_zside)
13  : DetId(Forward, FastTime) {
14  int zsid = (module_zside > 0) ? (kFastTimeZsideMask) : (0);
15  id_ |= (((module_type & kFastTimeTypeMask) << kFastTimeTypeOffset) |
16  ((module_iz & kFastTimeCellZMask) << kFastTimeCellZOffset) |
17  ((module_iphi & kFastTimeCellPhiMask) << kFastTimeCellPhiOffset) | (zsid << kFastTimeZsideOffset));
18 }
19 
21  if (!gen.null()) {
23  if (gen.det() != Forward || (subdet != FastTime)) {
24  throw cms::Exception("Invalid DetId")
25  << "Cannot initialize FastTimeDetId from " << std::hex << gen.rawId() << std::dec;
26  }
27  }
28  id_ = gen.rawId();
29 }
30 
32  if (!gen.null()) {
34  if (gen.det() != Forward || (subdet != FastTime)) {
35  throw cms::Exception("Invalid DetId")
36  << "Cannot assign FastTimeDetId from " << std::hex << gen.rawId() << std::dec;
37  }
38  }
39  id_ = gen.rawId();
40  return (*this);
41 }
42 
43 std::ostream& operator<<(std::ostream& s, const FastTimeDetId& id) {
44  return s << "(FastTime " << id.type() << ", iz " << ((id.zside() > 0) ? ("+ ") : ("- ")) << " iz/ieta " << id.iz()
45  << ", iphi " << id.iphi() << ")";
46 }
static const int kFastTimeTypeMask
Definition: FastTimeDetId.h:17
static const int kFastTimeTypeOffset
Definition: FastTimeDetId.h:16
FastTimeDetId & operator=(const DetId &id)
std::ostream & operator<<(std::ostream &s, const FastTimeDetId &id)
static const int kFastTimeZsideMask
Definition: FastTimeDetId.h:15
static const int kFastTimeCellPhiMask
Definition: FastTimeDetId.h:13
static const int kFastTimeCellZOffset
Definition: FastTimeDetId.h:10
ForwardSubdetector subdet() const
get the subdetector
Definition: FastTimeDetId.h:35
ForwardSubdetector
static const FastTimeDetId Undefined
Definition: FastTimeDetId.h:54
static const int kFastTimeCellZMask
Definition: FastTimeDetId.h:11
static const int kFastTimeZsideOffset
Definition: FastTimeDetId.h:14
Definition: DetId.h:17
uint32_t id_
Definition: DetId.h:69
static const int kFastTimeCellPhiOffset
Definition: FastTimeDetId.h:12