10 bool trackIdHitPairLess(
const std::pair<unsigned int, const PSimHit *> &
a,
11 const std::pair<unsigned int, const PSimHit *> &
b) {
12 return a.first < b.first;
15 bool trackIdHitPairLessSort(
const std::pair<unsigned int, const PSimHit *> &
a,
16 const std::pair<unsigned int, const PSimHit *> &
b) {
17 if (a.first == b.first) {
19 ? a.second->timeOfFlight()
20 : std::numeric_limits<decltype(a.second->timeOfFlight())>::
max();
22 ? b.second->timeOfFlight()
23 : std::numeric_limits<decltype(b.second->timeOfFlight())>::
max();
26 return a.first < b.first;
38 for (
const auto &
simHit : *hsimhits) {
45 std::tuple<std::unique_ptr<edm::ValueMap<unsigned int>>,
46 std::unique_ptr<edm::ValueMap<unsigned int>>,
47 std::unique_ptr<edm::ValueMap<unsigned int>>>
56 std::vector<unsigned int> valuesLayers(tps.size(), 0);
57 std::vector<unsigned int> valuesPixelLayers(tps.size(), 0);
58 std::vector<unsigned int> valuesStripMonoAndStereoLayers(tps.size(), 0);
59 for (
size_t iTP = 0; iTP < tps.size(); ++iTP) {
65 constexpr unsigned int maxLayer = 0xF + 1;
66 bool hasHit[maxSubdet][maxLayer];
67 bool hasPixel[maxSubdet][maxLayer];
68 bool hasMono[maxSubdet][maxLayer];
69 bool hasStereo[maxSubdet][maxLayer];
70 memset(hasHit, 0,
sizeof(hasHit));
71 memset(hasPixel, 0,
sizeof(hasPixel));
72 memset(hasMono, 0,
sizeof(hasMono));
73 memset(hasStereo, 0,
sizeof(hasStereo));
79 std::pair<unsigned int, const PSimHit *>(
simTrack.trackId(),
nullptr),
81 if (range.first == range.second)
84 auto iHitPtr = range.first;
85 for (; iHitPtr != range.second; ++iHitPtr) {
87 if (iHitPtr->second->particleType() ==
pdgId)
90 if (iHitPtr == range.second)
92 int processType = iHitPtr->second->processType();
95 for (; iHitPtr != range.second; ++iHitPtr) {
106 bool isStripStereo =
false;
107 bool isStripMono =
false;
115 isStripMono = tTopo.
tibIsRPhi(newDetector);
119 isStripMono = tTopo.
tidIsRPhi(newDetector);
123 isStripMono = tTopo.
tobIsRPhi(newDetector);
127 isStripMono = tTopo.
tecIsRPhi(newDetector);
132 const auto subdet = newDetector.
subdetId();
133 const auto layer = tTopo.
layer(newDetector);
135 hasHit[subdet][layer] =
true;
137 hasPixel[subdet][layer] =
isPixel;
138 else if (isStripMono)
139 hasMono[subdet][layer] = isStripMono;
140 else if (isStripStereo)
141 hasStereo[subdet][layer] = isStripStereo;
149 for (
unsigned int i = 0;
i < maxSubdet; ++
i) {
150 for (
unsigned int j = 0; j < maxLayer; ++j) {
151 nLayers += hasHit[
i][j];
152 nPixelLayers += hasPixel[
i][j];
153 nStripMonoAndStereoLayers += (hasMono[
i][j] && hasStereo[
i][j]);
162 auto ret0 = std::make_unique<edm::ValueMap<unsigned int>>();
165 filler.
insert(htps, valuesLayers.begin(), valuesLayers.end());
168 auto ret1 = std::make_unique<edm::ValueMap<unsigned int>>();
171 filler.
insert(htps, valuesPixelLayers.begin(), valuesPixelLayers.end());
174 auto ret2 = std::make_unique<edm::ValueMap<unsigned int>>();
177 filler.
insert(htps, valuesStripMonoAndStereoLayers.begin(), valuesStripMonoAndStereoLayers.end());
const std::vector< SimTrack > & g4Tracks() const
TrackingParticleNumberOfLayers(const edm::Event &iEvent, const std::vector< edm::EDGetTokenT< std::vector< PSimHit >>> &simHitTokens)
std::vector< TrackingParticle > TrackingParticleCollection
bool tobIsStereo(const DetId &id) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
int pdgId() const
PDG ID.
void insert(const H &h, I begin, I end)
bool tobIsRPhi(const DetId &id) const
constexpr bool isFinite(T x)
bool tidIsStereo(const DetId &id) const
bool tecIsStereo(const DetId &id) const
bool tibIsRPhi(const DetId &id) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
EncodedEventId eventId() const
bool tecIsRPhi(const DetId &id) const
std::vector< std::pair< unsigned int, const PSimHit * > > trackIdToHitPtr_
bool tidIsRPhi(const DetId &id) const
bool tibIsStereo(const DetId &id) const
unsigned short processType() const
unsigned int layer(const DetId &id) const
EncodedEventId eventId() const
Signal source, crossing number.
std::tuple< std::unique_ptr< edm::ValueMap< unsigned int > >, std::unique_ptr< edm::ValueMap< unsigned int > >, std::unique_ptr< edm::ValueMap< unsigned int > > > calculate(const edm::Handle< TrackingParticleCollection > &tps, const edm::EventSetup &iSetup) const
bool isPixel(HitType hitType)
Monte Carlo truth information used for tracking validation.
unsigned int detUnitId() const