11 bool trackIdHitPairLess(
const std::pair<unsigned int, const PSimHit *> &
a,
12 const std::pair<unsigned int, const PSimHit *> &
b) {
13 return a.first < b.first;
16 bool trackIdHitPairLessSort(
const std::pair<unsigned int, const PSimHit *> &
a,
17 const std::pair<unsigned int, const PSimHit *> &
b) {
18 if (a.first == b.first) {
20 ? a.second->timeOfFlight()
21 : std::numeric_limits<decltype(a.second->timeOfFlight())>::
max();
23 ? b.second->timeOfFlight()
24 : std::numeric_limits<decltype(b.second->timeOfFlight())>::
max();
27 return a.first < b.first;
39 for (
const auto &
simHit : *hsimhits) {
46 std::tuple<std::unique_ptr<edm::ValueMap<unsigned int>>,
47 std::unique_ptr<edm::ValueMap<unsigned int>>,
48 std::unique_ptr<edm::ValueMap<unsigned int>>>
57 std::vector<unsigned int> valuesLayers(tps.size(), 0);
58 std::vector<unsigned int> valuesPixelLayers(tps.size(), 0);
59 std::vector<unsigned int> valuesStripMonoAndStereoLayers(tps.size(), 0);
60 for (
size_t iTP = 0; iTP < tps.size(); ++iTP) {
66 constexpr unsigned int maxLayer = 0xF + 1;
67 bool hasHit[maxSubdet][maxLayer];
68 bool hasPixel[maxSubdet][maxLayer];
69 bool hasMono[maxSubdet][maxLayer];
70 bool hasStereo[maxSubdet][maxLayer];
71 memset(hasHit, 0,
sizeof(hasHit));
72 memset(hasPixel, 0,
sizeof(hasPixel));
73 memset(hasMono, 0,
sizeof(hasMono));
74 memset(hasStereo, 0,
sizeof(hasStereo));
80 std::pair<unsigned int, const PSimHit *>(
simTrack.trackId(),
nullptr),
85 auto iHitPtr =
range.first;
86 for (; iHitPtr !=
range.second; ++iHitPtr) {
88 if (iHitPtr->second->particleType() ==
pdgId)
91 if (iHitPtr ==
range.second)
93 int processType = iHitPtr->second->processType();
96 for (; iHitPtr !=
range.second; ++iHitPtr) {
107 bool isStripStereo =
false;
108 bool isStripMono =
false;
116 isStripMono = tTopo.
tibIsRPhi(newDetector);
120 isStripMono = tTopo.
tidIsRPhi(newDetector);
124 isStripMono = tTopo.
tobIsRPhi(newDetector);
128 isStripMono = tTopo.
tecIsRPhi(newDetector);
133 const auto subdet = newDetector.
subdetId();
134 const auto layer = tTopo.
layer(newDetector);
136 hasHit[subdet][layer] =
true;
138 hasPixel[subdet][layer] =
isPixel;
139 else if (isStripMono)
140 hasMono[subdet][layer] = isStripMono;
141 else if (isStripStereo)
142 hasStereo[subdet][layer] = isStripStereo;
150 for (
unsigned int i = 0;
i < maxSubdet; ++
i) {
151 for (
unsigned int j = 0;
j < maxLayer; ++
j) {
152 nLayers += hasHit[
i][
j];
153 nPixelLayers += hasPixel[
i][
j];
154 nStripMonoAndStereoLayers += (hasMono[
i][
j] && hasStereo[
i][
j]);
163 auto ret0 = std::make_unique<edm::ValueMap<unsigned int>>();
166 filler.
insert(htps, valuesLayers.begin(), valuesLayers.end());
169 auto ret1 = std::make_unique<edm::ValueMap<unsigned int>>();
172 filler.
insert(htps, valuesPixelLayers.begin(), valuesPixelLayers.end());
175 auto ret2 = std::make_unique<edm::ValueMap<unsigned int>>();
178 filler.
insert(htps, valuesStripMonoAndStereoLayers.begin(), valuesStripMonoAndStereoLayers.end());
static constexpr auto TEC
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
static constexpr auto TOB
bool tecIsRPhi(const DetId &id) const
std::vector< std::pair< unsigned int, const PSimHit * > > trackIdToHitPtr_
bool tidIsRPhi(const DetId &id) const
static constexpr auto TIB
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.
static constexpr auto TID
unsigned int detUnitId() const