1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
#ifndef DeDxHitInfo_H
#define DeDxHitInfo_H
#include <vector>
#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/SiStripDetId/interface/SiStripDetId.h"
#include "DataFormats/SiStripCluster/interface/SiStripCluster.h"
#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
#include "DataFormats/GeometryVector/interface/LocalPoint.h"
#include "DataFormats/Common/interface/Association.h"
#include "DataFormats/Common/interface/RefVector.h"
namespace reco {
class DeDxHitInfo {
public:
class DeDxHitInfoContainer {
public:
DeDxHitInfoContainer() : charge_(0.0f), pathlength_(0.0f) {}
DeDxHitInfoContainer(
const float charge, const float pathlength, const DetId& detId, const LocalPoint& pos, const uint8_t& type)
: charge_(charge), pathlength_(pathlength), detId_(detId), pos_(pos), type_(type) {}
float charge() const { return charge_; }
float pathlength() const { return pathlength_; }
const DetId& detId() const { return detId_; }
const LocalPoint& pos() const { return pos_; }
const uint8_t& type() const { return type_; }
private:
//! total cluster charge
float charge_;
//! path length inside a module
float pathlength_;
DetId detId_;
//! hit position
LocalPoint pos_;
uint8_t type_;
};
static constexpr int Complete = 0, Compatible = 1, Calibration = 2;
typedef std::vector<DeDxHitInfo::DeDxHitInfoContainer> DeDxHitInfoContainerCollection;
public:
DeDxHitInfo() {}
size_t size() const { return infos_.size(); }
float charge(size_t i) const { return infos_[i].charge(); }
float pathlength(size_t i) const { return infos_[i].pathlength(); }
DetId detId(size_t i) const { return infos_[i].detId(); }
const LocalPoint pos(size_t i) const { return infos_[i].pos(); }
const uint8_t type(size_t i) const { return infos_[i].type(); }
const SiPixelCluster* pixelCluster(size_t i) const {
size_t P = 0;
bool isPixel = false;
bool isFirst = true;
for (size_t j = 0; j <= i && j < infos_.size(); j++) {
if (detId(j).subdetId() < SiStripDetId::TIB) {
if (isFirst)
isFirst = false;
else
P++;
isPixel = true;
} else {
isPixel = false;
}
}
if (isPixel && pixelClusters_.size() > P) {
return &(pixelClusters_[P]);
}
return nullptr;
}
const SiStripCluster* stripCluster(size_t i) const {
size_t S = 0;
bool isStrip = false;
bool isFirst = true;
for (size_t j = 0; j <= i && j < infos_.size(); j++) {
if (detId(j).subdetId() >= SiStripDetId::TIB) {
if (isFirst) {
isFirst = false;
} else
S++;
isStrip = true;
} else {
isStrip = false;
}
}
if (isStrip && stripClusters_.size() > S) {
return &(stripClusters_[S]);
}
return nullptr;
}
const std::vector<SiStripCluster>& stripClusters() const { return stripClusters_; }
const std::vector<SiPixelCluster>& pixelClusters() const { return pixelClusters_; }
void addHit(const float charge,
const float pathlength,
const DetId& detId,
const LocalPoint& pos,
const uint8_t& type,
const SiStripCluster& stripCluster) {
infos_.push_back(DeDxHitInfoContainer(charge, pathlength, detId, pos, type));
stripClusters_.push_back(stripCluster);
}
void addHit(const float charge,
const float pathlength,
const DetId& detId,
const LocalPoint& pos,
const uint8_t& type,
const SiPixelCluster& pixelCluster) {
infos_.push_back(DeDxHitInfoContainer(charge, pathlength, detId, pos, type));
pixelClusters_.push_back(pixelCluster);
}
private:
std::vector<DeDxHitInfoContainer> infos_;
std::vector<SiStripCluster> stripClusters_;
std::vector<SiPixelCluster> pixelClusters_;
};
typedef std::vector<DeDxHitInfo> DeDxHitInfoCollection;
typedef edm::Ref<DeDxHitInfoCollection> DeDxHitInfoRef;
typedef edm::RefProd<DeDxHitInfoCollection> DeDxHitInfoRefProd;
typedef edm::RefVector<DeDxHitInfoCollection> DeDxHitInfoRefVector;
typedef edm::Association<DeDxHitInfoCollection> DeDxHitInfoAss;
} // namespace reco
#endif
|