CMS 3D CMS Logo

PFTauElementsOperators.h
Go to the documentation of this file.
1 #ifndef RecoTauTag_RecoTau_PFTauElementsOperators_H_
2 #define RecoTauTag_RecoTau_PFTauElementsOperators_H_
3 
6 
16 
25 
26 #include "Math/GenVector/VectorUtil.h"
27 #include "Math/GenVector/PxPyPzE4D.h"
28 
29 #include <algorithm>
30 
32  public:
36  //return the leading PFCandidate in a given cone around the jet axis or a given direction
37  reco::PFCandidatePtr leadPFCand(const std::string matchingcone_metric,const double matchingcone_size,const double minPt)const;
38  reco::PFCandidatePtr leadPFCand(const math::XYZVector& myVector,const std::string matchingcone_metric,const double matchingcone_size,const double minPt)const;
39  reco::PFCandidatePtr leadPFChargedHadrCand(const std::string matchingcone_metric,const double matchingcone_size,const double minPt)const;
40  reco::PFCandidatePtr leadPFChargedHadrCand(const math::XYZVector& myVector,const std::string matchingcone_metric,const double matchingcone_size,const double minPt)const;
41  reco::PFCandidatePtr leadPFNeutrHadrCand(const std::string matchingcone_metric,const double matchingcone_size,const double minPt)const;
42  reco::PFCandidatePtr leadPFNeutrHadrCand(const math::XYZVector& myVector,const std::string matchingcone_metric,const double matchingcone_size,const double minPt)const;
43  reco::PFCandidatePtr leadPFGammaCand(const std::string matchingcone_metric,const double matchingcone_size,const double minPt)const;
44  reco::PFCandidatePtr leadPFGammaCand(const math::XYZVector& myVector,const std::string matchingcone_metric,const double matchingcone_size,const double minPt)const;
45 
46  // return all PFCandidates in a cone of metric* "cone_metric" and size "conesize" around a direction "myVector"
47  std::vector<reco::PFCandidatePtr> PFCandsInCone(const std::vector<reco::PFCandidatePtr>& PFCands,const math::XYZVector& myVector,const std::string conemetric,const double conesize,const double minPt)const;
48  std::vector<reco::PFCandidatePtr> PFCandsInCone(const math::XYZVector& myVector,const std::string conemetric,const double conesize,const double minPt)const;
49  std::vector<reco::PFCandidatePtr> PFChargedHadrCandsInCone(const math::XYZVector& myVector,const std::string conemetric,const double conesize,const double minPt)const;
50  std::vector<reco::PFCandidatePtr> PFChargedHadrCandsInCone(const math::XYZVector& myVector,const std::string conemetric,const double conesize,const double minPt,const double PFChargedHadrCand_tracktorefpoint_maxDZ,const double refpoint_Z, const reco::Vertex &mPV)const;
51  std::vector<reco::PFCandidatePtr> PFNeutrHadrCandsInCone(const math::XYZVector& myVector,const std::string conemetric,const double conesize,const double minPt)const;
52  std::vector<reco::PFCandidatePtr> PFGammaCandsInCone(const math::XYZVector& myVector,const std::string conemetric,const double conesize,const double minPt)const;
53 
54  // return all PFCandidates in a annulus defined by inner(metric* "innercone_metric" and size "innercone_size") and outer(metric* "outercone_metric" and size "outercone_size") cones around a direction "myVector"
55  std::vector<reco::PFCandidatePtr> PFCandsInAnnulus(const std::vector<reco::PFCandidatePtr>& PFCands,const math::XYZVector& myVector,const std::string innercone_metric,const double innercone_size,const std::string outercone_metric,const double outercone_size,const double minPt)const;
56  std::vector<reco::PFCandidatePtr> PFCandsInAnnulus(const math::XYZVector& myVector,const std::string innercone_metric,const double innercone_size,const std::string outercone_metric,const double outercone_size,const double minPt)const;
57  std::vector<reco::PFCandidatePtr> PFChargedHadrCandsInAnnulus(const math::XYZVector& myVector,const std::string innercone_metric,const double innercone_size,const std::string outercone_metric,const double outercone_size,const double minPt)const;
58  std::vector<reco::PFCandidatePtr> PFChargedHadrCandsInAnnulus(const math::XYZVector& myVector,const std::string innercone_metric,const double innercone_size,const std::string outercone_metric,const double outercone_size,const double minPt,const double PFChargedHadrCand_tracktorefpoint_maxDZ,const double refpoint_Z, const reco::Vertex &myPV)const;
59  std::vector<reco::PFCandidatePtr> PFNeutrHadrCandsInAnnulus(const math::XYZVector& myVector,const std::string innercone_metric,const double innercone_size,const std::string outercone_metric,const double outercone_size,const double minPt)const;
60  std::vector<reco::PFCandidatePtr> PFGammaCandsInAnnulus(const math::XYZVector& myVector,const std::string innercone_metric,const double innercone_size,const std::string outercone_metric,const double outercone_size,const double minPt)const;
61  //Put function to get elements inside ellipse here ... EELL
62  std::pair<std::vector<reco::PFCandidatePtr>,std::vector<reco::PFCandidatePtr>> PFGammaCandsInOutEllipse(const std::vector<reco::PFCandidatePtr>&, const reco::PFCandidate&, double rPhi, double rEta, double maxPt) const;
63  //EELL
64 
66  void copyCandRefsFilteredByPt(const std::vector<reco::PFCandidatePtr>& theInputCands, std::vector<reco::PFCandidatePtr>& theOutputCands, const double minPt);
67 
69  void computeInsideOutContents(const std::vector<reco::PFCandidatePtr>& theChargedCands, const std::vector<reco::PFCandidatePtr>& theGammaCands, const math::XYZVector& leadTrackVector,
70  const TFormula& coneSizeFormula, double (*ptrToMetricFunction)(const math::XYZVector&, const math::XYZVector&), // determines grow function, and the metric to compare the opening angle to
71  const double minChargedSize, const double maxChargedSize, const double minNeutralSize, const double maxNeutralSize,
72  const double minChargedPt, const double minNeutralPt,
73  const std::string& outlierCollectorConeMetric, const double outlierCollectorConeSize,
74  std::vector<reco::PFCandidatePtr>& signalChargedObjects, std::vector<reco::PFCandidatePtr>& outlierChargedObjects,
75  std::vector<reco::PFCandidatePtr>& signalGammaObjects, std::vector<reco::PFCandidatePtr>& outlierGammaObjects, bool useScanningAxis); //these last two quantities are the return values
76 
77  // return 1 if no/low PFCandidates activity in an isolation annulus around a leading PFCandidate, 0 otherwise;
78  // different possible metrics* for the matching, signal and isolation cones;
79  double discriminatorByIsolPFCandsN(int IsolPFCands_maxN=0);
80  double discriminatorByIsolPFCandsN(std::string matchingcone_metric,double matchingcone_size,std::string signalcone_metric,double signalcone_size,std::string isolcone_metric,double isolcone_size,bool useOnlyChargedHadrforleadPFCand,double minPt_leadPFCand,double minPt_PFCand,int IsolPFCands_maxN=0);
81  double discriminatorByIsolPFCandsN(const math::XYZVector& myVector,std::string matchingcone_metric,double matchingcone_size,std::string signalcone_metric,double signalcone_size,std::string isolcone_metric,double isolcone_size,bool useOnlyChargedHadrforleadPFCand,double minPt_leadPFCand,double minPt_PFCand,int IsolPFCands_maxN=0);
82  double discriminatorByIsolPFChargedHadrCandsN(int IsolPFCands_maxN=0);
83  double discriminatorByIsolPFChargedHadrCandsN(std::string matchingcone_metric,double matchingcone_size,std::string signalcone_metric,double signalcone_size,std::string isolcone_metric,double isolcone_size,bool useOnlyChargedHadrforleadPFCand,double minPt_leadPFCand,double minPt_PFCand,int IsolPFCands_maxN=0);
84  double discriminatorByIsolPFChargedHadrCandsN(const math::XYZVector& myVector,std::string matchingcone_metric,double matchingcone_size,std::string signalcone_metric,double signalcone_size,std::string isolcone_metric,double isolcone_size,bool useOnlyChargedHadrforleadPFCand,double minPt_leadPFCand,double minPt_PFCand,int IsolPFCands_maxN=0);
85  double discriminatorByIsolPFNeutrHadrCandsN(int IsolPFCands_maxN=0);
86  double discriminatorByIsolPFNeutrHadrCandsN(std::string matchingcone_metric,double matchingcone_size,std::string signalcone_metric,double signalcone_size,std::string isolcone_metric,double isolcone_size,bool useOnlyChargedHadrforleadPFCand,double minPt_leadPFCand,double minPt_PFCand,int IsolPFCands_maxN=0);
87  double discriminatorByIsolPFNeutrHadrCandsN(const math::XYZVector& myVector,std::string matchingcone_metric,double matchingcone_size,std::string signalcone_metric,double signalcone_size,std::string isolcone_metric,double isolcone_size,bool useOnlyChargedHadrforleadPFCand,double minPt_leadPFCand,double minPt_PFCand,int IsolPFCands_maxN=0);
88  double discriminatorByIsolPFGammaCandsN(int IsolPFCands_maxN=0);
89  double discriminatorByIsolPFGammaCandsN(std::string matchingcone_metric,double matchingcone_size,std::string signalcone_metric,double signalcone_size,std::string isolcone_metric,double isolcone_size,bool useOnlyChargedHadrforleadPFCand,double minPt_leadPFCand,double minPt_PFCand,int IsolPFCands_maxN=0);
90  double discriminatorByIsolPFGammaCandsN(const math::XYZVector& myVector,std::string matchingcone_metric,double matchingcone_size,std::string signalcone_metric,double signalcone_size,std::string isolcone_metric,double isolcone_size,bool useOnlyChargedHadrforleadPFCand,double minPt_leadPFCand,double minPt_PFCand,int IsolPFCands_maxN=0);
91  double discriminatorByIsolPFCandsEtSum(double IsolPFCands_maxEtSum=0);
92  double discriminatorByIsolPFCandsEtSum(std::string matchingcone_metric,double matchingcone_size,std::string signalcone_metric,double signalcone_size,std::string isolcone_metric,double isolcone_size,bool useOnlyChargedHadrforleadPFCand,double minPt_leadPFCand,double minPt_PFCand,double IsolPFCands_maxEtSum=0);
93  double discriminatorByIsolPFCandsEtSum(const math::XYZVector& myVector,std::string matchingcone_metric,double matchingcone_size,std::string signalcone_metric,double signalcone_size,std::string isolcone_metric,double isolcone_size,bool useOnlyChargedHadrforleadPFCand,double minPt_leadPFCand,double minPt_PFCand,double IsolPFCands_maxEtSum=0);
94  double discriminatorByIsolPFChargedHadrCandsEtSum(std::string matchingcone_metric,double matchingcone_size,std::string signalcone_metric,double signalcone_size,std::string isolcone_metric,double isolcone_size,bool useOnlyChargedHadrforleadPFCand,double minPt_leadPFCand,double minPt_PFCand,double IsolPFCands_maxEtSum=0);
95  double discriminatorByIsolPFChargedHadrCandsEtSum(double IsolPFCands_maxEtSum=0);
96  double discriminatorByIsolPFChargedHadrCandsEtSum(const math::XYZVector& myVector,std::string matchingcone_metric,double matchingcone_size,std::string signalcone_metric,double signalcone_size,std::string isolcone_metric,double isolcone_size,bool useOnlyChargedHadrforleadPFCand,double minPt_leadPFCand,double minPt_PFCand,double IsolPFCands_maxEtSum=0);
97  double discriminatorByIsolPFNeutrHadrCandsEtSum(double IsolPFCands_maxEtSum=0);
98  double discriminatorByIsolPFNeutrHadrCandsEtSum(std::string matchingcone_metric,double matchingcone_size,std::string signalcone_metric,double signalcone_size,std::string isolcone_metric,double isolcone_size,bool useOnlyChargedHadrforleadPFCand,double minPt_leadPFCand,double minPt_PFCand,double IsolPFCands_maxEtSum=0);
99  double discriminatorByIsolPFNeutrHadrCandsEtSum(const math::XYZVector& myVector,std::string matchingcone_metric,double matchingcone_size,std::string signalcone_metric,double signalcone_size,std::string isolcone_metric,double isolcone_size,bool useOnlyChargedHadrforleadPFCand,double minPt_leadPFCand,double minPt_PFCand,double IsolPFCands_maxEtSum=0);
100  double discriminatorByIsolPFGammaCandsEtSum(double IsolPFCands_maxEtSum=0);
101  double discriminatorByIsolPFGammaCandsEtSum(std::string matchingcone_metric,double matchingcone_size,std::string signalcone_metric,double signalcone_size,std::string isolcone_metric,double isolcone_size,bool useOnlyChargedHadrforleadPFCand,double minPt_leadPFCand,double minPt_PFCand,double IsolPFCands_maxEtSum=0);
102  double discriminatorByIsolPFGammaCandsEtSum(const math::XYZVector& myVector,std::string matchingcone_metric,double matchingcone_size,std::string signalcone_metric,double signalcone_size,std::string isolcone_metric,double isolcone_size,bool useOnlyChargedHadrforleadPFCand,double minPt_leadPFCand,double minPt_PFCand,double IsolPFCands_maxEtSum=0);
103  private:
106  std::vector<reco::PFCandidatePtr> PFCands_;
107  std::vector<reco::PFCandidatePtr> IsolPFCands_;
108  std::vector<reco::PFCandidatePtr> PFChargedHadrCands_;
109  std::vector<reco::PFCandidatePtr> IsolPFChargedHadrCands_;
110  std::vector<reco::PFCandidatePtr> PFNeutrHadrCands_;
111  std::vector<reco::PFCandidatePtr> IsolPFNeutrHadrCands_;
112  std::vector<reco::PFCandidatePtr> PFGammaCands_;
113  std::vector<reco::PFCandidatePtr> IsolPFGammaCands_;
114  // template objects for DR and Angle metrics
117  double computeDeltaR(const math::XYZVector& vec1, const math::XYZVector& vec2);
118  double computeAngle(const math::XYZVector& vec1, const math::XYZVector& vec2);
126 };
127 #endif
128 
129 // * different possible metrics for a cone : "DR", "angle", "area";
130 
131 
132 
133 
std::vector< reco::PFCandidatePtr > PFCandsInCone(const std::vector< reco::PFCandidatePtr > &PFCands, const math::XYZVector &myVector, const std::string conemetric, const double conesize, const double minPt) const
double computeDeltaR(const math::XYZVector &vec1, const math::XYZVector &vec2)
std::vector< reco::PFCandidatePtr > IsolPFChargedHadrCands_
std::vector< reco::PFCandidatePtr > IsolPFGammaCands_
std::pair< std::vector< reco::PFCandidatePtr >, std::vector< reco::PFCandidatePtr > > PFGammaCandsInOutEllipse(const std::vector< reco::PFCandidatePtr > &, const reco::PFCandidate &, double rPhi, double rEta, double maxPt) const
double discriminatorByIsolPFGammaCandsN(int IsolPFCands_maxN=0)
std::vector< reco::PFCandidatePtr > PFGammaCands_
std::vector< reco::PFCandidatePtr > PFGammaCandsInCone(const math::XYZVector &myVector, const std::string conemetric, const double conesize, const double minPt) const
ElementsInAnnulus< math::XYZVector, Angle< math::XYZVector >, Angle< math::XYZVector >, reco::PFCandidate > PFCandsinAnnulus_innerAngleouterAnglemetrics_
Angle< math::XYZVector > metricAngle_
std::vector< reco::PFCandidatePtr > IsolPFNeutrHadrCands_
double discriminatorByIsolPFChargedHadrCandsN(int IsolPFCands_maxN=0)
ElementsInAnnulus< math::XYZVector, Angle< math::XYZVector >, DeltaR< math::XYZVector >, reco::PFCandidate > PFCandsinAnnulus_innerAngleouterDRmetrics_
std::vector< reco::PFCandidatePtr > PFNeutrHadrCands_
void computeInsideOutContents(const std::vector< reco::PFCandidatePtr > &theChargedCands, const std::vector< reco::PFCandidatePtr > &theGammaCands, const math::XYZVector &leadTrackVector, const TFormula &coneSizeFormula, double(*ptrToMetricFunction)(const math::XYZVector &, const math::XYZVector &), const double minChargedSize, const double maxChargedSize, const double minNeutralSize, const double maxNeutralSize, const double minChargedPt, const double minNeutralPt, const std::string &outlierCollectorConeMetric, const double outlierCollectorConeSize, std::vector< reco::PFCandidatePtr > &signalChargedObjects, std::vector< reco::PFCandidatePtr > &outlierChargedObjects, std::vector< reco::PFCandidatePtr > &signalGammaObjects, std::vector< reco::PFCandidatePtr > &outlierGammaObjects, bool useScanningAxis)
compute size of cone using the Inside-Out cone (Author Evan Friis, UC Davis)
ElementsInAnnulus< math::XYZVector, DeltaR< math::XYZVector >, Angle< math::XYZVector >, reco::PFCandidate > PFCandsinAnnulus_innerDRouterAnglemetrics_
std::vector< reco::PFCandidatePtr > PFCands_
void copyCandRefsFilteredByPt(const std::vector< reco::PFCandidatePtr > &theInputCands, std::vector< reco::PFCandidatePtr > &theOutputCands, const double minPt)
append elements of theInputCands that pass Pt requirement to the end of theOutputCands ...
reco::PFCandidatePtr leadPFCand(const std::string matchingcone_metric, const double matchingcone_size, const double minPt) const
double discriminatorByIsolPFCandsEtSum(double IsolPFCands_maxEtSum=0)
ElementsInEllipse< reco::PFCandidate, reco::PFCandidate > PFCandidatesInEllipse_
std::vector< double > vec1
Definition: HCALResponse.h:15
double discriminatorByIsolPFGammaCandsEtSum(double IsolPFCands_maxEtSum=0)
double discriminatorByIsolPFCandsN(int IsolPFCands_maxN=0)
reco::PFCandidatePtr leadPFNeutrHadrCand(const std::string matchingcone_metric, const double matchingcone_size, const double minPt) const
std::vector< reco::PFCandidatePtr > PFNeutrHadrCandsInCone(const math::XYZVector &myVector, const std::string conemetric, const double conesize, const double minPt) const
double computeAngle(const math::XYZVector &vec1, const math::XYZVector &vec2)
PFTauElementsOperators(reco::PFTau &thePFTau)
std::vector< reco::PFCandidatePtr > IsolPFCands_
double discriminatorByIsolPFNeutrHadrCandsN(int IsolPFCands_maxN=0)
ElementsInAnnulus< math::XYZVector, DeltaR< math::XYZVector >, DeltaR< math::XYZVector >, reco::PFCandidate > PFCandsinAnnulus_innerDRouterDRmetrics_
ElementsInCone< math::XYZVector, Angle< math::XYZVector >, reco::PFCandidate > PFCandsinCone_Anglemetric_
reco::PFCandidatePtr leadPFGammaCand(const std::string matchingcone_metric, const double matchingcone_size, const double minPt) const
reco::PFCandidatePtr leadPFChargedHadrCand(const std::string matchingcone_metric, const double matchingcone_size, const double minPt) const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
ElementsInCone< math::XYZVector, DeltaR< math::XYZVector >, reco::PFCandidate > PFCandsinCone_DRmetric_
std::vector< reco::PFCandidatePtr > PFGammaCandsInAnnulus(const math::XYZVector &myVector, const std::string innercone_metric, const double innercone_size, const std::string outercone_metric, const double outercone_size, const double minPt) const
DeltaR< math::XYZVector > metricDR_
std::vector< reco::PFCandidatePtr > PFChargedHadrCandsInAnnulus(const math::XYZVector &myVector, const std::string innercone_metric, const double innercone_size, const std::string outercone_metric, const double outercone_size, const double minPt) const
void setAreaMetricrecoElementsmaxabsEta(double x)
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
std::vector< reco::PFCandidatePtr > PFCandsInAnnulus(const std::vector< reco::PFCandidatePtr > &PFCands, const math::XYZVector &myVector, const std::string innercone_metric, const double innercone_size, const std::string outercone_metric, const double outercone_size, const double minPt) const
double discriminatorByIsolPFChargedHadrCandsEtSum(std::string matchingcone_metric, double matchingcone_size, std::string signalcone_metric, double signalcone_size, std::string isolcone_metric, double isolcone_size, bool useOnlyChargedHadrforleadPFCand, double minPt_leadPFCand, double minPt_PFCand, double IsolPFCands_maxEtSum=0)
double discriminatorByIsolPFNeutrHadrCandsEtSum(double IsolPFCands_maxEtSum=0)
std::vector< reco::PFCandidatePtr > PFChargedHadrCandsInCone(const math::XYZVector &myVector, const std::string conemetric, const double conesize, const double minPt) const
std::vector< reco::PFCandidatePtr > PFNeutrHadrCandsInAnnulus(const math::XYZVector &myVector, const std::string innercone_metric, const double innercone_size, const std::string outercone_metric, const double outercone_size, const double minPt) const
std::vector< vec1 > vec2
Definition: HCALResponse.h:16
std::vector< reco::PFCandidatePtr > PFChargedHadrCands_