19 double jetPTthreshold,
double jetEMfracLimit,
20 const JetCorrector& correctedjets,
const std::vector<CaloMET>& uncorMET,
double jetMatchDeltaR,
21 double tauMinEt,
double tauEtaMax,
bool useSeedTrack,
double seedTrackPt,
bool useTrackIsolation,
double trackIsolationMinPt,
22 bool useECALIsolation,
double gammaIsolationMinPt,
bool useProngStructure,std::vector<CaloMET>* corrMET) {
28 double DeltaSumET = 0.0;
31 bool matchFlag =
false;
33 if((fabs(thePFTau->eta()) <= tauEtaMax) && (thePFTau->et() >= tauMinEt)) {
36 if(!(thePFTau->leadPFChargedHadrCand())) {goodTau =
false;}
38 if(thePFTau->leadPFChargedHadrCand()->et() < seedTrackPt) {goodTau =
false;}
41 if(useTrackIsolation) {
44 iChargedHadrCand!=PFTauProdIsolCHCands.
end();++iChargedHadrCand) {
45 if((**iChargedHadrCand).pt() > trackIsolationMinPt) {goodTau =
false;}
48 if(useECALIsolation) {
51 iGammaCand!=PFTauProdIsolGammaCands.
end();++iGammaCand) {
52 if((**iGammaCand).et() > gammaIsolationMinPt) {goodTau =
false;}
55 if(useProngStructure) {
56 if((thePFTau->signalPFChargedHadrCands().size() != 1) && (thePFTau->signalPFChargedHadrCands().size() != 3)) {goodTau =
false;}
60 for(CaloJetCollection::const_iterator calojetIter = calojetHandle->begin();calojetIter != calojetHandle->end();++calojetIter) {
61 if(
deltaR(calojetIter->p4(),thePFTau->p4())<jetMatchDeltaR) {
62 if( calojetIter->pt() > jetPTthreshold && calojetIter->emEnergyFraction() < jetEMfracLimit ) {
63 double correct = correctedjets.
correction (*calojetIter);
64 DeltaPx += ((correct * calojetIter->px()) - thePFTau->px());
65 DeltaPy += ((correct * calojetIter->py()) - thePFTau->py());
66 DeltaSumET += ((correct * calojetIter->et()) - thePFTau->et());
68 DeltaPx += (calojetIter->px() - thePFTau->px());
69 DeltaPy += (calojetIter->py() - thePFTau->py());
70 DeltaSumET += (calojetIter->et() - thePFTau->et());
72 if(matchFlag) {
std::cerr <<
"### TauMETAlgo - ERROR: Multiple jet matches!!!! " << std::endl;}
81 delta.
sumet = - DeltaSumET;
82 const CaloMET* u = &(uncorMET.front());
83 double corrMetPx = u->
px() + delta.
mex;
84 double corrMetPy = u->
py() + delta.
mey;
85 MET::LorentzVector correctedMET4vector( corrMetPx, corrMetPy, 0.,
sqrt(corrMetPx*corrMetPx + corrMetPy*corrMetPy));
86 std::vector<CorrMETData> corrections = u->
mEtCorr();
87 corrections.push_back(delta);
90 corrMET->push_back(result);
95 double jetPTthreshold,
double jetEMfracLimit,
96 const JetCorrector& correctedjets,
const std::vector<MET>& uncorMET,
double jetMatchDeltaR,
97 double tauMinEt,
double tauEtaMax,
bool useSeedTrack,
double seedTrackPt,
bool useTrackIsolation,
double trackIsolationMinPt,
98 bool useECALIsolation,
double gammaIsolationMinPt,
bool useProngStructure,std::vector<MET>* corrMET) {
100 std::cerr <<
"TauMETAlgo::run -> Test.. " << std::endl;
102 double DeltaPx = 0.0;
103 double DeltaPy = 0.0;
104 double DeltaSumET = 0.0;
106 PFTauRef thePFTau(tauHandle,iPFTau);
107 bool matchFlag =
false;
108 bool goodTau =
false;
109 if((fabs(thePFTau->eta()) <= tauEtaMax) && (thePFTau->et() >= tauMinEt)) {
112 if(!(thePFTau->leadPFChargedHadrCand())) {goodTau =
false;}
114 if(thePFTau->leadPFChargedHadrCand()->et() < seedTrackPt) {goodTau =
false;}
117 if(useTrackIsolation) {
120 iChargedHadrCand!=PFTauProdIsolCHCands.
end();++iChargedHadrCand) {
121 if((**iChargedHadrCand).pt() > trackIsolationMinPt) {goodTau =
false;}
124 if(useECALIsolation) {
127 iGammaCand!=PFTauProdIsolGammaCands.
end();++iGammaCand) {
128 if((**iGammaCand).et() > gammaIsolationMinPt) {goodTau =
false;}
131 if(useProngStructure) {
132 if((thePFTau->signalPFChargedHadrCands().size() != 1) && (thePFTau->signalPFChargedHadrCands().size() != 3)) {goodTau =
false;}
136 for(CaloJetCollection::const_iterator calojetIter = calojetHandle->begin();calojetIter != calojetHandle->end();++calojetIter) {
137 if(
deltaR(calojetIter->p4(),thePFTau->p4())<jetMatchDeltaR) {
138 if( calojetIter->pt() > jetPTthreshold && calojetIter->emEnergyFraction() < jetEMfracLimit ) {
139 double correct = correctedjets.
correction (*calojetIter);
140 DeltaPx += ((correct * calojetIter->px()) - thePFTau->px());
141 DeltaPy += ((correct * calojetIter->py()) - thePFTau->py());
142 DeltaSumET += ((correct * calojetIter->et()) - thePFTau->et());
144 DeltaPx += (calojetIter->px() - thePFTau->px());
145 DeltaPy += (calojetIter->py() - thePFTau->py());
146 DeltaSumET += (calojetIter->et() - thePFTau->et());
148 if(matchFlag) {
std::cerr <<
"### TauMETAlgo - ERROR: Multiple jet matches!!!! " << std::endl;}
157 delta.
sumet = - DeltaSumET;
158 const MET* u = &(uncorMET.front());
159 double corrMetPx = u->
px() + delta.
mex;
160 double corrMetPy = u->
py() + delta.
mey;
161 MET::LorentzVector correctedMET4vector( corrMetPx, corrMetPy, 0.,
sqrt(corrMetPx*corrMetPx + corrMetPy*corrMetPy));
162 std::vector<CorrMETData> corrections = u->
mEtCorr();
163 corrections.push_back(delta);
166 corrMET->push_back(result);
virtual const Point & vertex() const
vertex position
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
const_iterator end() const
Termination of iteration.
const_iterator begin() const
Initialize an iterator over the RefVector.
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
SpecificCaloMETData getSpecific() const
std::vector< CorrMETData > mEtCorr() const
double deltaR(double eta1, double eta2, double phi1, double phi2)
virtual double px() const
x coordinate of momentum vector
XYZPointD XYZPoint
point in space with cartesian internal representation
virtual double py() const
y coordinate of momentum vector
math::PtEtaPhiELorentzVectorF LorentzVector