7 auto sq = [](
double val) {
return val *
val; };
16 auto qualNames = para.
getParameter<std::vector<std::string> >(
"allowedQualities");
17 auto algoNames = para.
getParameter<std::vector<std::string> >(
"algosToReject");
19 for (
auto& qualName : qualNames) {
22 for (
auto& algoName : algoNames) {
30 desc.
add<
double>(
"minPt", 1.0);
31 desc.
add<
double>(
"maxDR", 0.3);
32 desc.
add<
double>(
"minDR", 0.000);
33 desc.
add<
double>(
"minDEta", 0.005);
34 desc.
add<
double>(
"maxDZ", 0.1);
35 desc.
add<
double>(
"maxDPtPt", -1);
36 desc.
add<
int>(
"minHits", 8);
37 desc.
add<
int>(
"minPixelHits", 1);
38 desc.
add<std::vector<std::string> >(
"allowedQualities");
39 desc.
add<std::vector<std::string> >(
"algosToReject");
52 std::vector<float>
pt;
53 std::vector<float>
eta;
54 std::vector<float>
phi;
55 std::vector<float> vz;
56 pt.reserve(tracks.size());
57 eta.reserve(tracks.size());
58 phi.reserve(tracks.size());
59 vz.reserve(tracks.size());
61 for (
auto const& trk : tracks) {
62 auto trkPt = trk.pt();
64 pt.emplace_back(trkPt);
65 eta.emplace_back(trk.eta());
66 phi.emplace_back(trk.phi());
67 vz.emplace_back(trk.vz());
77 std::vector<float>
pt;
78 std::vector<float>
eta;
79 std::vector<float>
phi;
80 std::vector<float> vz;
81 pt.reserve(cands.size());
82 eta.reserve(cands.size());
83 phi.reserve(cands.size());
84 vz.reserve(cands.size());
86 for (
auto const& cand : cands) {
87 if (cand.hasTrackDetails() && cand.charge() != 0 &&
passPIDVeto(cand.pdgId(), pidVeto)) {
89 float trkPt = trk.
pt();
91 pt.emplace_back(trkPt);
92 eta.emplace_back(trk.
eta());
93 phi.emplace_back(trk.
phi());
94 vz.emplace_back(trk.
vz());
108 const float eleEta = eleTrk.
eta();
109 const float elePhi = eleTrk.
phi();
110 const float eleVz = eleTrk.
vz();
112 const bool isBarrelElectron =
std::abs(eleEta) < 1.5;
117 for (
auto const& trk : preselectedTracks) {
119 const float dEta = trk.get<
Eta>() - eleEta;
120 const float dZ = eleVz - trk.get<
Vz>();
123 ptSum += trk.get<
Pt>();
127 return {nrTrks, ptSum};
146 throw cms::Exception(
"CodeError") <<
"invalid PIDVeto " <<
static_cast<int>(
veto) <<
", "
147 <<
"this is likely due to some static casting of invalid ints somewhere";
151 if (vetoStr ==
"NONE")
153 else if (vetoStr ==
"ELES")
155 else if (vetoStr ==
"NONELES")
158 throw cms::Exception(
"CodeError") <<
"unrecognised string " << vetoStr
159 <<
", either a typo or this function needs to be updated";
173 for (
auto qual : quals) {
182 const std::vector<reco::TrackBase::TrackAlgorithm>& algosToRej) {
183 return algosToRej.empty() ||
186 !(std::binary_search(algosToRej.begin(), algosToRej.end(), trk.
algo()) &&
187 std::binary_search(algosToRej.begin(), algosToRej.end(), trk.
originalAlgo()));
200 return preselectedTracks;
TrkCuts(const edm::ParameterSet ¶)
reco::TrackCollection const * tracks_
bool tracksCachedForEndcapCuts_
static bool passTrackPreselection(const reco::TrackBase &trk, float trkPt, const TrkCuts &cuts)
static edm::ParameterSetDescription pSetDescript()
std::vector< pat::PackedCandidate > PackedCandidateCollection
std::vector< Track > TrackCollection
collection of Tracks
double phi() const
azimuthal angle of momentum vector
auto const & tracks
cannot be loose
static TrackTable preselectTracks(reco::TrackCollection const &tracks, TrkCuts const &cuts)
static bool passAlgo(const reco::TrackBase &trk, const std::vector< reco::TrackBase::TrackAlgorithm > &algosToRej)
std::vector< reco::TrackBase::TrackQuality > allowedQualities
TrackAlgorithm algo() const
TkSoA const *__restrict__ CAHitNtupletGeneratorKernelsGPU::QualityCuts cuts
double eta() const
pseudorapidity of momentum vector
Output operator()(const reco::TrackBase &electronTrack)
std::vector< reco::TrackBase::TrackAlgorithm > algosToReject
double pt() const
track transverse momentum
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
Abs< T >::type abs(const T &t)
static edm::ParameterSetDescription pSetDescript()
unsigned short numberOfValidHits() const
number of valid hits found
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static bool passQual(const reco::TrackBase &trk, const std::vector< reco::TrackBase::TrackQuality > &quals)
double vz() const
z coordinate of the reference point on track
TrackAlgorithm originalAlgo() const
TrackTable preselectedTracksWithBarrelCuts_
bool tracksCachedForBarrelCuts_
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
static TrackQuality qualityByName(const std::string &name)
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
static PIDVeto pidVetoFromStr(const std::string &vetoStr)
static TrackTable preselectTracksFromCands(pat::PackedCandidateCollection const &cands, TrkCuts const &cuts, PIDVeto=PIDVeto::NONE)
T getParameter(std::string const &) const
bool quality(const TrackQuality) const
Track quality.
Configuration const & cfg_
static TrackAlgorithm algoByName(const std::string &name)
int numberOfValidPixelHits() const
pat::PackedCandidateCollection const * cands_
TrackTable const & getPreselectedTracks(bool isBarrel)
TrackTable preselectedTracksWithEndcapCuts_
static bool passPIDVeto(const int pdgId, const EleTkIsolFromCands::PIDVeto pidVeto)