CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/RecoTauTag/TauTagTools/interface/PFTauElementsOperators.h

Go to the documentation of this file.
00001 #ifndef RecoTauTag_RecoTau_PFTauElementsOperators_H_
00002 #define RecoTauTag_RecoTau_PFTauElementsOperators_H_
00003 
00004 #include "FWCore/Framework/interface/Frameworkfwd.h"
00005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00006 
00007 #include "DataFormats/ParticleFlowReco/interface/PFBlock.h"
00008 #include "DataFormats/ParticleFlowReco/interface/PFBlockElement.h"
00009 #include "DataFormats/ParticleFlowReco/interface/PFRecTrack.h"
00010 #include "DataFormats/ParticleFlowReco/interface/PFRecTrackFwd.h"
00011 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
00012 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
00013 #include "DataFormats/TauReco/interface/PFTau.h"
00014 #include "DataFormats/JetReco/interface/PFJet.h"
00015 #include "DataFormats/VertexReco/interface/Vertex.h"
00016 
00017 #include "RecoTauTag/TauTagTools/interface/TauTagTools.h"
00018 #include "RecoTauTag/TauTagTools/interface/TauElementsOperators.h"
00019 #include "RecoTauTag/TauTagTools/interface/ElementsInCone.h"
00020 #include "RecoTauTag/TauTagTools/interface/ElementsInAnnulus.h"
00021 #include "RecoTauTag/TauTagTools/interface/ElementsInEllipse.h"
00022 #include "PhysicsTools/IsolationUtils/interface/FixedAreaIsolationCone.h"
00023 #include "DataFormats/Math/interface/deltaR.h"
00024 #include "CommonTools/Utils/interface/Angle.h"
00025 
00026 #include "Math/GenVector/VectorUtil.h"
00027 #include "Math/GenVector/PxPyPzE4D.h"
00028 
00029 #include <algorithm>
00030 
00031 class PFTauElementsOperators : public TauElementsOperators {
00032  public:
00033   PFTauElementsOperators(reco::PFTau& thePFTau);
00034   ~PFTauElementsOperators(){}   
00035   void setAreaMetricrecoElementsmaxabsEta( double x);
00036   //return the leading PFCandidate in a given cone around the jet axis or a given direction
00037   reco::PFCandidateRef leadPFCand(const std::string matchingcone_metric,const double matchingcone_size,const double minPt)const;
00038   reco::PFCandidateRef leadPFCand(const math::XYZVector myVector,const std::string matchingcone_metric,const double matchingcone_size,const double minPt)const;  
00039   reco::PFCandidateRef leadPFChargedHadrCand(const std::string matchingcone_metric,const double matchingcone_size,const double minPt)const;
00040   reco::PFCandidateRef leadPFChargedHadrCand(const math::XYZVector myVector,const std::string matchingcone_metric,const double matchingcone_size,const double minPt)const;  
00041   reco::PFCandidateRef leadPFNeutrHadrCand(const std::string matchingcone_metric,const double matchingcone_size,const double minPt)const;
00042   reco::PFCandidateRef leadPFNeutrHadrCand(const math::XYZVector myVector,const std::string matchingcone_metric,const double matchingcone_size,const double minPt)const;  
00043   reco::PFCandidateRef leadPFGammaCand(const std::string matchingcone_metric,const double matchingcone_size,const double minPt)const;
00044   reco::PFCandidateRef leadPFGammaCand(const math::XYZVector myVector,const std::string matchingcone_metric,const double matchingcone_size,const double minPt)const;  
00045   
00046   // return all PFCandidates in a cone of metric* "cone_metric" and size "conesize" around a direction "myVector" 
00047   reco::PFCandidateRefVector PFCandsInCone(const reco::PFCandidateRefVector PFCands,const math::XYZVector myVector,const std::string conemetric,const double conesize,const double minPt)const;
00048   reco::PFCandidateRefVector PFCandsInCone(const math::XYZVector myVector,const std::string conemetric,const double conesize,const double minPt)const;
00049   reco::PFCandidateRefVector PFChargedHadrCandsInCone(const math::XYZVector myVector,const std::string conemetric,const double conesize,const double minPt)const;
00050   reco::PFCandidateRefVector 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;
00051   reco::PFCandidateRefVector PFNeutrHadrCandsInCone(const math::XYZVector myVector,const std::string conemetric,const double conesize,const double minPt)const;
00052   reco::PFCandidateRefVector PFGammaCandsInCone(const math::XYZVector myVector,const std::string conemetric,const double conesize,const double minPt)const;
00053   
00054   // 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" 
00055   reco::PFCandidateRefVector PFCandsInAnnulus(const reco::PFCandidateRefVector 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;
00056   reco::PFCandidateRefVector 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;
00057   reco::PFCandidateRefVector 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;
00058   reco::PFCandidateRefVector 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;
00059   reco::PFCandidateRefVector 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;
00060   reco::PFCandidateRefVector 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;
00061   //Put function to get elements inside ellipse here ... EELL
00062   std::pair<reco::PFCandidateRefVector,reco::PFCandidateRefVector> PFGammaCandsInOutEllipse(const reco::PFCandidateRefVector, const reco::PFCandidate, double rPhi, double rEta, double maxPt) const;
00063   //EELL
00064 
00066   void                 copyCandRefsFilteredByPt(const reco::PFCandidateRefVector& theInputCands, reco::PFCandidateRefVector& theOutputCands, const double minPt);
00067 
00069   void                 computeInsideOutContents(const reco::PFCandidateRefVector& theChargedCands, const reco::PFCandidateRefVector& theGammaCands, const math::XYZVector leadTrackVector, 
00070                                const TFormula& coneSizeFormula, double (*ptrToMetricFunction)(const math::XYZVector&, const math::XYZVector&),  // determines grow function, and the metric to compare the opening angle to
00071                                const double minChargedSize, const double maxChargedSize, const double minNeutralSize, const double maxNeutralSize,
00072                                const double minChargedPt, const double minNeutralPt,
00073                                const std::string& outlierCollectorConeMetric, const double outlierCollectorConeSize,
00074                                reco::PFCandidateRefVector& signalChargedObjects, reco::PFCandidateRefVector& outlierChargedObjects,
00075                                reco::PFCandidateRefVector& signalGammaObjects, reco::PFCandidateRefVector& outlierGammaObjects, bool useScanningAxis); //these last two quantities are the return values
00076 
00077   // return 1 if no/low PFCandidates activity in an isolation annulus around a leading PFCandidate, 0 otherwise; 
00078   // different possible metrics* for the matching, signal and isolation cones; 
00079   double discriminatorByIsolPFCandsN(int IsolPFCands_maxN=0);
00080   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);
00081   double discriminatorByIsolPFCandsN(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);
00082   double discriminatorByIsolPFChargedHadrCandsN(int IsolPFCands_maxN=0);
00083   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);
00084   double discriminatorByIsolPFChargedHadrCandsN(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);
00085   double discriminatorByIsolPFNeutrHadrCandsN(int IsolPFCands_maxN=0);
00086   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);
00087   double discriminatorByIsolPFNeutrHadrCandsN(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);
00088   double discriminatorByIsolPFGammaCandsN(int IsolPFCands_maxN=0);
00089   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);
00090   double discriminatorByIsolPFGammaCandsN(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);
00091   double discriminatorByIsolPFCandsEtSum(double IsolPFCands_maxEtSum=0);
00092   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);
00093   double discriminatorByIsolPFCandsEtSum(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);
00094   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);
00095   double discriminatorByIsolPFChargedHadrCandsEtSum(double IsolPFCands_maxEtSum=0);
00096   double discriminatorByIsolPFChargedHadrCandsEtSum(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);
00097   double discriminatorByIsolPFNeutrHadrCandsEtSum(double IsolPFCands_maxEtSum=0);
00098   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);
00099   double discriminatorByIsolPFNeutrHadrCandsEtSum(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);
00100   double discriminatorByIsolPFGammaCandsEtSum(double IsolPFCands_maxEtSum=0);
00101   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);
00102   double discriminatorByIsolPFGammaCandsEtSum(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);  
00103  private:
00104   reco::PFJetRef PFJetRef_;
00105   double AreaMetric_recoElements_maxabsEta_;
00106   reco::PFCandidateRefVector PFCands_;
00107   reco::PFCandidateRefVector IsolPFCands_;
00108   reco::PFCandidateRefVector PFChargedHadrCands_;
00109   reco::PFCandidateRefVector IsolPFChargedHadrCands_;
00110   reco::PFCandidateRefVector PFNeutrHadrCands_;
00111   reco::PFCandidateRefVector IsolPFNeutrHadrCands_;
00112   reco::PFCandidateRefVector PFGammaCands_;
00113   reco::PFCandidateRefVector IsolPFGammaCands_;
00114   // template objects for DR and Angle metrics
00115   DeltaR<math::XYZVector> metricDR_;  
00116   Angle<math::XYZVector> metricAngle_;
00117   double computeDeltaR(const math::XYZVector& vec1, const math::XYZVector& vec2);
00118   double computeAngle(const math::XYZVector& vec1, const math::XYZVector& vec2);
00119   ElementsInCone<math::XYZVector,DeltaR<math::XYZVector>,reco::PFCandidateCollection> PFCandsinCone_DRmetric_;
00120   ElementsInCone<math::XYZVector,Angle<math::XYZVector>,reco::PFCandidateCollection> PFCandsinCone_Anglemetric_; 
00121   ElementsInAnnulus<math::XYZVector,DeltaR<math::XYZVector>,DeltaR<math::XYZVector>,reco::PFCandidateCollection> PFCandsinAnnulus_innerDRouterDRmetrics_;
00122   ElementsInAnnulus<math::XYZVector,DeltaR<math::XYZVector>,Angle<math::XYZVector>,reco::PFCandidateCollection> PFCandsinAnnulus_innerDRouterAnglemetrics_; 
00123   ElementsInAnnulus<math::XYZVector,Angle<math::XYZVector>,Angle<math::XYZVector>,reco::PFCandidateCollection> PFCandsinAnnulus_innerAngleouterAnglemetrics_;
00124   ElementsInAnnulus<math::XYZVector,Angle<math::XYZVector>,DeltaR<math::XYZVector>,reco::PFCandidateCollection> PFCandsinAnnulus_innerAngleouterDRmetrics_; 
00125   ElementsInEllipse<reco::PFCandidate, reco::PFCandidateCollection> PFCandidatesInEllipse_;
00126 };
00127 #endif
00128 
00129 // * different possible metrics for a cone : "DR", "angle", "area"; 
00130 
00131 
00132 
00133