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) {
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),
84 if (range.first == range.second)
87 auto iHitPtr = range.first;
88 for (; iHitPtr != range.second; ++iHitPtr) {
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);
T getParameter(std::string const &) const
std::vector< TrackingParticle > TrackingParticleCollection
bool getByToken(EDGetToken token, Handle< PROD > &result) const
constexpr bool isFinite(T x)
#define DEFINE_FWK_MODULE(type)
EncodedEventId eventId() const
edm::EDGetTokenT< TrackingParticleCollection > vec_TrackingParticle_Token_
T const * product() const
std::vector< HistogramManager > histo
void analyze(const edm::Event &, const edm::EventSetup &) override
SiPixelPhase1TrackingParticleV(const edm::ParameterSet &conf)
std::vector< edm::EDGetTokenT< std::vector< PSimHit > > > simHitTokens_
unsigned int detUnitId() const