CMS 3D CMS Logo

PTrajectoryStateOnDet.h
Go to the documentation of this file.
1 #ifndef PTrajectoryStateOnDet_H
2 #define PTrajectoryStateOnDet_H
3 
5 #include <cassert>
11 public:
12  // little endian...
13  struct Packing {
14  unsigned int rest : 30;
15  unsigned char ss : 2;
16  };
17  struct DetPack {
18  unsigned int loc : 25;
19  unsigned char sub : 3;
20  unsigned char det : 4;
21  };
22 
23 private:
24  // we assume that id cannot be calo! (i.e. det<4)
25  static const unsigned int idMask = 0x3fffffff;
26  union Pack {
27  Pack() {}
28  Pack(unsigned int pack) : packed(pack) {}
29  Pack(unsigned int id, int surfaceSide) : packed(id) {
31  assert(surfaceSide < 3);
32  assert((id >> 28) < 4);
33  }
34  int side() const { return bytes.ss; }
35  unsigned int id() const { return packed & idMask; }
36  unsigned int packed;
39  };
40 
41 public:
43 
44  PTrajectoryStateOnDet(const LocalTrajectoryParameters& param, float ipt, unsigned int id, int surfaceSide)
45  : theLocalParameters(param), thePt(ipt) {
46  Pack p(id, surfaceSide);
47  thePack = p.packed;
48  theLocalErrors[0] = -99999.e10;
49  }
50 
52  const LocalTrajectoryParameters& param, float ipt, float errmatrix[15], unsigned int id, int surfaceSide)
53  : theLocalParameters(param), thePt(ipt) {
54  Pack p(id, surfaceSide);
55  thePack = p.packed;
56  for (int i = 0; i < 15; i++)
57  theLocalErrors[i] = errmatrix[i];
58  }
59 
61  float pt() const { return thePt; }
62  bool hasError() const { return theLocalErrors[0] > -1.e10; }
63  float& error(int i) { return theLocalErrors[i]; }
64  float error(int i) const { return theLocalErrors[i]; }
65  unsigned int detId() const { return thePack & idMask; }
66  int surfaceSide() const {
67  Pack p(thePack);
68  return p.side();
69  }
70 
71 private:
73  float theLocalErrors[15] = {};
74  float thePt = 0;
75  unsigned int thePack = 0;
76 };
77 
78 #endif
mps_fire.i
i
Definition: mps_fire.py:428
PTrajectoryStateOnDet::error
float & error(int i)
Definition: PTrajectoryStateOnDet.h:63
PTrajectoryStateOnDet::Pack::packed
unsigned int packed
Definition: PTrajectoryStateOnDet.h:36
cms::cuda::assert
assert(be >=bs)
PTrajectoryStateOnDet::Pack::det
DetPack det
Definition: PTrajectoryStateOnDet.h:38
PTrajectoryStateOnDet::Packing
Definition: PTrajectoryStateOnDet.h:13
LocalTrajectoryParameters
Definition: LocalTrajectoryParameters.h:25
PTrajectoryStateOnDet::Pack::bytes
Packing bytes
Definition: PTrajectoryStateOnDet.h:37
LocalTrajectoryParameters.h
PTrajectoryStateOnDet::theLocalErrors
float theLocalErrors[15]
Definition: PTrajectoryStateOnDet.h:73
PTrajectoryStateOnDet::detId
unsigned int detId() const
Definition: PTrajectoryStateOnDet.h:65
PTrajectoryStateOnDet::Pack::Pack
Pack(unsigned int id, int surfaceSide)
Definition: PTrajectoryStateOnDet.h:29
PTrajectoryStateOnDet::PTrajectoryStateOnDet
PTrajectoryStateOnDet(const LocalTrajectoryParameters &param, float ipt, float errmatrix[15], unsigned int id, int surfaceSide)
Definition: PTrajectoryStateOnDet.h:51
PTrajectoryStateOnDet::error
float error(int i) const
Definition: PTrajectoryStateOnDet.h:64
PTrajectoryStateOnDet::surfaceSide
int surfaceSide() const
Definition: PTrajectoryStateOnDet.h:66
PTrajectoryStateOnDet::PTrajectoryStateOnDet
PTrajectoryStateOnDet(const LocalTrajectoryParameters &param, float ipt, unsigned int id, int surfaceSide)
Definition: PTrajectoryStateOnDet.h:44
PTrajectoryStateOnDet::Packing::rest
unsigned int rest
Definition: PTrajectoryStateOnDet.h:14
PTrajectoryStateOnDet::theLocalParameters
LocalTrajectoryParameters theLocalParameters
Definition: PTrajectoryStateOnDet.h:72
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
PTrajectoryStateOnDet::thePack
unsigned int thePack
Definition: PTrajectoryStateOnDet.h:75
PTrajectoryStateOnDet::Pack::side
int side() const
Definition: PTrajectoryStateOnDet.h:34
timeUnitHelper.pack
def pack(high, low)
Definition: timeUnitHelper.py:3
PTrajectoryStateOnDet::DetPack::loc
unsigned int loc
Definition: PTrajectoryStateOnDet.h:18
PTrajectoryStateOnDet::DetPack::sub
unsigned char sub
Definition: PTrajectoryStateOnDet.h:19
PTrajectoryStateOnDet::hasError
bool hasError() const
Definition: PTrajectoryStateOnDet.h:62
PTrajectoryStateOnDet::pt
float pt() const
Definition: PTrajectoryStateOnDet.h:61
PTrajectoryStateOnDet::parameters
const LocalTrajectoryParameters & parameters() const
Definition: PTrajectoryStateOnDet.h:60
PTrajectoryStateOnDet::Pack::Pack
Pack(unsigned int pack)
Definition: PTrajectoryStateOnDet.h:28
PTrajectoryStateOnDet::PTrajectoryStateOnDet
PTrajectoryStateOnDet()
Definition: PTrajectoryStateOnDet.h:42
PTrajectoryStateOnDet::Packing::ss
unsigned char ss
Definition: PTrajectoryStateOnDet.h:15
PTrajectoryStateOnDet::idMask
static const unsigned int idMask
Definition: PTrajectoryStateOnDet.h:25
PTrajectoryStateOnDet::Pack::Pack
Pack()
Definition: PTrajectoryStateOnDet.h:27
PTrajectoryStateOnDet::thePt
float thePt
Definition: PTrajectoryStateOnDet.h:74
PTrajectoryStateOnDet
Definition: PTrajectoryStateOnDet.h:10
PTrajectoryStateOnDet::Pack::id
unsigned int id() const
Definition: PTrajectoryStateOnDet.h:35
PTrajectoryStateOnDet::Pack
Definition: PTrajectoryStateOnDet.h:26
PTrajectoryStateOnDet::DetPack::det
unsigned char det
Definition: PTrajectoryStateOnDet.h:20
PTrajectoryStateOnDet::DetPack
Definition: PTrajectoryStateOnDet.h:17