22 class TrackAssociatorByHits;
25 bool trackIdHitPairLess(
const std::pair<unsigned int, const PSimHit*>&
a,
const std::pair<unsigned int, const PSimHit*>&
b) {
26 return a.first < b.first;
29 bool trackIdHitPairLessSort(
const std::pair<unsigned int, const PSimHit*>&
a,
const std::pair<unsigned int, const PSimHit*>&
b) {
30 if(a.first == b.first) {
31 const auto atof =
edm::isFinite(a.second->timeOfFlight()) ? a.second->timeOfFlight() : std::numeric_limits<decltype(a.second->timeOfFlight())>::
max();
32 const auto btof =
edm::isFinite(b.second->timeOfFlight()) ? b.second->timeOfFlight() : std::numeric_limits<decltype(b.second->timeOfFlight())>::
max();
35 return a.first < b.first;
44 for(
const auto&
tag: iConfig.
getParameter<std::vector<edm::InputTag>>(
"simHitToken")) {
54 std::vector<std::pair<unsigned int, const PSimHit *>> trackIdToHitPtr;
61 trackIdToHitPtr.reserve(trackIdToHitPtr.size()+hsimhits->size());
62 for(
const auto&
simHit: *hsimhits) {
66 std::stable_sort(trackIdToHitPtr.begin(), trackIdToHitPtr.end(), trackIdHitPairLessSort);
70 for (TrackingParticleCollection::const_iterator
t = tPC ->
begin();
t != tPC ->
end(); ++
t) {
74 bool isBpixtrack =
false, isFpixtrack =
false;
79 auto range = std::equal_range(trackIdToHitPtr.begin(), trackIdToHitPtr.end(), std::pair<unsigned int, const PSimHit *>(
simTrack.trackId(),
nullptr), trackIdHitPairLess);
80 if(range.first == range.second)
continue;
82 auto iHitPtr = range.first;
83 for(; iHitPtr != range.second; ++iHitPtr) {
90 uint32_t subdetid = (
id.subdetId());
97 if ( isBpixtrack || isFpixtrack ) {
103 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
#define DEFINE_FWK_MODULE(type)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
simTrack
per collection params
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