22 class TrackAssociatorByHits;
25 bool trackIdHitPairLess(
const std::pair<unsigned int, const PSimHit *> &
a,
26 const std::pair<unsigned int, const PSimHit *> &
b) {
27 return a.first < b.first;
30 bool trackIdHitPairLessSort(
const std::pair<unsigned int, const PSimHit *> &
a,
31 const std::pair<unsigned int, const PSimHit *> &
b) {
32 if (a.first == b.first) {
34 ? a.second->timeOfFlight()
35 : std::numeric_limits<decltype(a.second->timeOfFlight())>::
max();
37 ? b.second->timeOfFlight()
38 : std::numeric_limits<decltype(b.second->timeOfFlight())>::
max();
41 return a.first < b.first;
48 for (
const auto &
tag : iConfig.
getParameter<std::vector<edm::InputTag>>(
"simHitToken")) {
57 std::vector<std::pair<unsigned int, const PSimHit *>> trackIdToHitPtr;
64 trackIdToHitPtr.reserve(trackIdToHitPtr.size() + hsimhits->size());
65 for (
const auto &simHit : *hsimhits) {
66 trackIdToHitPtr.emplace_back(simHit.trackId(), &simHit);
69 std::stable_sort(trackIdToHitPtr.begin(), trackIdToHitPtr.end(), trackIdHitPairLessSort);
72 for (TrackingParticleCollection::const_iterator
t = tPC->begin();
t != tPC->end(); ++
t) {
75 bool isBpixtrack =
false, isFpixtrack =
false;
80 auto range = std::equal_range(trackIdToHitPtr.begin(),
81 trackIdToHitPtr.end(),
82 std::pair<unsigned int, const PSimHit *>(
simTrack.trackId(),
nullptr),
87 auto iHitPtr =
range.first;
88 for (; iHitPtr !=
range.second; ++iHitPtr) {
89 const PSimHit &simHit = *(iHitPtr->second);
90 if (simHit.
eventId() !=
t->eventId())
95 uint32_t subdetid = (
id.subdetId());
105 if (isBpixtrack || isFpixtrack) {
111 histo[
PT].fill(
sqrt(
t->momentum().perp2()),
id, &iEvent);
uint16_t *__restrict__ id
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
constexpr bool isFinite(T x)
const uint16_t range(const Frame &aFrame)
EncodedEventId eventId() const
edm::EDGetTokenT< TrackingParticleCollection > vec_TrackingParticle_Token_
T const * product() const
T getParameter(std::string const &) const
std::vector< HistogramManager > histo
void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< TrackingParticle > TrackingParticleCollection
SiPixelPhase1TrackingParticleV(const edm::ParameterSet &conf)
std::vector< edm::EDGetTokenT< std::vector< PSimHit > > > simHitTokens_
unsigned int detUnitId() const