CMS 3D CMS Logo

DeDxHitInfo.h
Go to the documentation of this file.
1 #ifndef DeDxHitInfo_H
2 #define DeDxHitInfo_H
3 #include <vector>
4 
12 
13 namespace reco {
14  class DeDxHitInfo {
15  public:
17  public:
20  const float charge, const float pathlength, const DetId& detId, const LocalPoint& pos, const uint8_t& type)
22 
23  float charge() const { return charge_; }
24  float pathlength() const { return pathlength_; }
25  const DetId& detId() const { return detId_; }
26  const LocalPoint& pos() const { return pos_; }
27  const uint8_t& type() const { return type_; }
28 
29  private:
31  float charge_;
33  float pathlength_;
37  uint8_t type_;
38  };
39 
40  static constexpr int Complete = 0, Compatible = 1, Calibration = 2;
41  typedef std::vector<DeDxHitInfo::DeDxHitInfoContainer> DeDxHitInfoContainerCollection;
42 
43  public:
45  size_t size() const { return infos_.size(); }
46  float charge(size_t i) const { return infos_[i].charge(); }
47  float pathlength(size_t i) const { return infos_[i].pathlength(); }
48  DetId detId(size_t i) const { return infos_[i].detId(); }
49  const LocalPoint pos(size_t i) const { return infos_[i].pos(); }
50  const uint8_t type(size_t i) const { return infos_[i].type(); }
51  const SiPixelCluster* pixelCluster(size_t i) const {
52  size_t P = 0;
53  bool isPixel = false;
54  bool isFirst = true;
55  for (size_t j = 0; j <= i && j < infos_.size(); j++) {
56  if (detId(j).subdetId() < SiStripDetId::TIB) {
57  if (isFirst)
58  isFirst = false;
59  else
60  P++;
61  isPixel = true;
62  } else {
63  isPixel = false;
64  }
65  }
66  if (isPixel && pixelClusters_.size() > P) {
67  return &(pixelClusters_[P]);
68  }
69  return nullptr;
70  }
71  const SiStripCluster* stripCluster(size_t i) const {
72  size_t S = 0;
73  bool isStrip = false;
74  bool isFirst = true;
75  for (size_t j = 0; j <= i && j < infos_.size(); j++) {
76  if (detId(j).subdetId() >= SiStripDetId::TIB) {
77  if (isFirst) {
78  isFirst = false;
79  } else
80  S++;
81  isStrip = true;
82  } else {
83  isStrip = false;
84  }
85  }
86  if (isStrip && stripClusters_.size() > S) {
87  return &(stripClusters_[S]);
88  }
89  return nullptr;
90  }
91  const std::vector<SiStripCluster>& stripClusters() const { return stripClusters_; }
92  const std::vector<SiPixelCluster>& pixelClusters() const { return pixelClusters_; }
93 
94  void addHit(const float charge,
95  const float pathlength,
96  const DetId& detId,
97  const LocalPoint& pos,
98  const uint8_t& type,
101  stripClusters_.push_back(stripCluster);
102  }
103  void addHit(const float charge,
104  const float pathlength,
105  const DetId& detId,
106  const LocalPoint& pos,
107  const uint8_t& type,
108  const SiPixelCluster& pixelCluster) {
110  pixelClusters_.push_back(pixelCluster);
111  }
112 
113  private:
114  std::vector<DeDxHitInfoContainer> infos_;
115  std::vector<SiStripCluster> stripClusters_;
116  std::vector<SiPixelCluster> pixelClusters_;
117  };
118 
119  typedef std::vector<DeDxHitInfo> DeDxHitInfoCollection;
124 } // namespace reco
125 
126 #endif
float pathlength(size_t i) const
Definition: DeDxHitInfo.h:47
float pathlength_
path length inside a module
Definition: DeDxHitInfo.h:33
const LocalPoint pos(size_t i) const
Definition: DeDxHitInfo.h:49
const LocalPoint & pos() const
Definition: DeDxHitInfo.h:26
void addHit(const float charge, const float pathlength, const DetId &detId, const LocalPoint &pos, const uint8_t &type, const SiPixelCluster &pixelCluster)
Definition: DeDxHitInfo.h:103
const uint8_t type(size_t i) const
Definition: DeDxHitInfo.h:50
static constexpr int Compatible
Definition: DeDxHitInfo.h:40
edm::RefProd< DeDxHitInfoCollection > DeDxHitInfoRefProd
Definition: DeDxHitInfo.h:121
std::vector< SiStripCluster > stripClusters_
Definition: DeDxHitInfo.h:115
const std::vector< SiStripCluster > & stripClusters() const
Definition: DeDxHitInfo.h:91
edm::Ref< DeDxHitInfoCollection > DeDxHitInfoRef
Definition: DeDxHitInfo.h:120
std::vector< SiPixelCluster > pixelClusters_
Definition: DeDxHitInfo.h:116
edm::Association< DeDxHitInfoCollection > DeDxHitInfoAss
Definition: DeDxHitInfo.h:123
void addHit(const float charge, const float pathlength, const DetId &detId, const LocalPoint &pos, const uint8_t &type, const SiStripCluster &stripCluster)
Definition: DeDxHitInfo.h:94
float charge_
total cluster charge
Definition: DeDxHitInfo.h:31
const SiStripCluster * stripCluster(size_t i) const
Definition: DeDxHitInfo.h:71
double f[11][100]
std::vector< DeDxHitInfo::DeDxHitInfoContainer > DeDxHitInfoContainerCollection
Definition: DeDxHitInfo.h:41
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 constexpr int Calibration
Definition: DeDxHitInfo.h:40
DetId detId(size_t i) const
Definition: DeDxHitInfo.h:48
isFirst
Definition: cuy.py:418
DeDxHitInfoContainer(const float charge, const float pathlength, const DetId &detId, const LocalPoint &pos, const uint8_t &type)
Definition: DeDxHitInfo.h:19
Definition: DetId.h:17
std::vector< DeDxHitInfo > DeDxHitInfoCollection
Definition: DeDxHitInfo.h:119
size_t size() const
Definition: DeDxHitInfo.h:45
std::pair< OmniClusterRef, TrackingParticleRef > P
static constexpr auto TIB
Definition: SiStripDetId.h:37
edm::RefVector< DeDxHitInfoCollection > DeDxHitInfoRefVector
Definition: DeDxHitInfo.h:122
static constexpr int Complete
Definition: DeDxHitInfo.h:40
Pixel cluster – collection of neighboring pixels above threshold.
fixed size matrix
const SiPixelCluster * pixelCluster(size_t i) const
Definition: DeDxHitInfo.h:51
bool isPixel(HitType hitType)
float charge(size_t i) const
Definition: DeDxHitInfo.h:46
const std::vector< SiPixelCluster > & pixelClusters() const
Definition: DeDxHitInfo.h:92
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::LocalCoordinateSystemTag > LocalPoint
point in local coordinate system
Definition: Point3D.h:15
std::vector< DeDxHitInfoContainer > infos_
Definition: DeDxHitInfo.h:114