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:
19  DeDxHitInfoContainer(const float charge, const float pathlength, const DetId& detId, const LocalPoint& pos)
21 
22  float charge() const { return charge_; }
23  float pathlength() const { return pathlength_; }
24  const DetId& detId() const { return detId_; }
25  const LocalPoint& pos() const { return pos_; }
26 
27  private:
29  float charge_;
31  float pathlength_;
35  };
36 
37  typedef std::vector<DeDxHitInfo::DeDxHitInfoContainer> DeDxHitInfoContainerCollection;
38 
39  public:
41  size_t size() const { return infos_.size(); }
42  float charge(size_t i) const { return infos_[i].charge(); }
43  float pathlength(size_t i) const { return infos_[i].pathlength(); }
44  DetId detId(size_t i) const { return infos_[i].detId(); }
45  const LocalPoint pos(size_t i) const { return infos_[i].pos(); }
46  const SiPixelCluster* pixelCluster(size_t i) const {
47  size_t P = 0;
48  bool isPixel = false;
49  bool isFirst = true;
50  for (size_t j = 0; j <= i && j < infos_.size(); j++) {
51  if (detId(j).subdetId() < SiStripDetId::TIB) {
52  if (isFirst)
53  isFirst = false;
54  else
55  P++;
56  isPixel = true;
57  } else {
58  isPixel = false;
59  }
60  }
61  if (isPixel && pixelClusters_.size() > P) {
62  return &(pixelClusters_[P]);
63  }
64  return nullptr;
65  }
66  const SiStripCluster* stripCluster(size_t i) const {
67  size_t S = 0;
68  bool isStrip = false;
69  bool isFirst = true;
70  for (size_t j = 0; j <= i && j < infos_.size(); j++) {
71  if (detId(j).subdetId() >= SiStripDetId::TIB) {
72  if (isFirst) {
73  isFirst = false;
74  } else
75  S++;
76  isStrip = true;
77  } else {
78  isStrip = false;
79  }
80  }
81  if (isStrip && stripClusters_.size() > S) {
82  return &(stripClusters_[S]);
83  }
84  return nullptr;
85  }
86  const std::vector<SiStripCluster>& stripClusters() const { return stripClusters_; }
87  const std::vector<SiPixelCluster>& pixelClusters() const { return pixelClusters_; }
88 
89  void addHit(const float charge,
90  const float pathlength,
91  const DetId& detId,
92  const LocalPoint& pos,
95  stripClusters_.push_back(stripCluster);
96  }
97  void addHit(const float charge,
98  const float pathlength,
99  const DetId& detId,
100  const LocalPoint& pos,
101  const SiPixelCluster& pixelCluster) {
103  pixelClusters_.push_back(pixelCluster);
104  }
105 
106  private:
107  std::vector<DeDxHitInfoContainer> infos_;
108  std::vector<SiStripCluster> stripClusters_;
109  std::vector<SiPixelCluster> pixelClusters_;
110  };
111 
112  typedef std::vector<DeDxHitInfo> DeDxHitInfoCollection;
117 } // namespace reco
118 
119 #endif
float pathlength(size_t i) const
Definition: DeDxHitInfo.h:43
DeDxHitInfoContainer(const float charge, const float pathlength, const DetId &detId, const LocalPoint &pos)
Definition: DeDxHitInfo.h:19
float pathlength_
path length inside a module
Definition: DeDxHitInfo.h:31
const LocalPoint pos(size_t i) const
Definition: DeDxHitInfo.h:45
const LocalPoint & pos() const
Definition: DeDxHitInfo.h:25
edm::RefProd< DeDxHitInfoCollection > DeDxHitInfoRefProd
Definition: DeDxHitInfo.h:114
std::vector< SiStripCluster > stripClusters_
Definition: DeDxHitInfo.h:108
const std::vector< SiStripCluster > & stripClusters() const
Definition: DeDxHitInfo.h:86
edm::Ref< DeDxHitInfoCollection > DeDxHitInfoRef
Definition: DeDxHitInfo.h:113
std::vector< SiPixelCluster > pixelClusters_
Definition: DeDxHitInfo.h:109
edm::Association< DeDxHitInfoCollection > DeDxHitInfoAss
Definition: DeDxHitInfo.h:116
float charge_
total cluster charge
Definition: DeDxHitInfo.h:29
const SiStripCluster * stripCluster(size_t i) const
Definition: DeDxHitInfo.h:66
double f[11][100]
void addHit(const float charge, const float pathlength, const DetId &detId, const LocalPoint &pos, const SiStripCluster &stripCluster)
Definition: DeDxHitInfo.h:89
std::vector< DeDxHitInfo::DeDxHitInfoContainer > DeDxHitInfoContainerCollection
Definition: DeDxHitInfo.h:37
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
DetId detId(size_t i) const
Definition: DeDxHitInfo.h:44
isFirst
Definition: cuy.py:418
Definition: DetId.h:17
std::vector< DeDxHitInfo > DeDxHitInfoCollection
Definition: DeDxHitInfo.h:112
size_t size() const
Definition: DeDxHitInfo.h:41
std::pair< OmniClusterRef, TrackingParticleRef > P
static constexpr auto TIB
Definition: SiStripDetId.h:37
edm::RefVector< DeDxHitInfoCollection > DeDxHitInfoRefVector
Definition: DeDxHitInfo.h:115
Pixel cluster – collection of neighboring pixels above threshold.
fixed size matrix
const SiPixelCluster * pixelCluster(size_t i) const
Definition: DeDxHitInfo.h:46
bool isPixel(HitType hitType)
float charge(size_t i) const
Definition: DeDxHitInfo.h:42
const std::vector< SiPixelCluster > & pixelClusters() const
Definition: DeDxHitInfo.h:87
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:107
void addHit(const float charge, const float pathlength, const DetId &detId, const LocalPoint &pos, const SiPixelCluster &pixelCluster)
Definition: DeDxHitInfo.h:97