Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #include "RecoTauTag/RecoTau/interface/TauDiscriminationProducerBase.h"
00008 #include "DataFormats/TrackReco/interface/Track.h"
00009
00010 using namespace reco;
00011
00012 class PFRecoTauDiscriminationAgainstElectron : public PFTauDiscriminationProducerBase {
00013 public:
00014 explicit PFRecoTauDiscriminationAgainstElectron(const edm::ParameterSet& iConfig):PFTauDiscriminationProducerBase(iConfig) {
00015
00016 emFraction_maxValue_ = iConfig.getParameter<double>("EmFraction_maxValue");
00017 applyCut_emFraction_ = iConfig.getParameter<bool>("ApplyCut_EmFraction");
00018 hcalTotOverPLead_minValue_ = iConfig.getParameter<double>("HcalTotOverPLead_minValue");
00019 applyCut_hcalTotOverPLead_ = iConfig.getParameter<bool>("ApplyCut_HcalTotOverPLead");
00020 hcalMaxOverPLead_minValue_ = iConfig.getParameter<double>("HcalMaxOverPLead_minValue");
00021 applyCut_hcalMaxOverPLead_ = iConfig.getParameter<bool>("ApplyCut_HcalMaxOverPLead");
00022 hcal3x3OverPLead_minValue_ = iConfig.getParameter<double>("Hcal3x3OverPLead_minValue");
00023
00024 applyCut_hcal3x3OverPLead_ = iConfig.getParameter<bool>("ApplyCut_Hcal3x3OverPLead");
00025 EOverPLead_minValue_ = iConfig.getParameter<double>("EOverPLead_minValue");
00026 EOverPLead_maxValue_ = iConfig.getParameter<double>("EOverPLead_maxValue");
00027 applyCut_EOverPLead_ = iConfig.getParameter<bool>("ApplyCut_EOverPLead");
00028 bremsRecoveryEOverPLead_minValue_ = iConfig.getParameter<double>("BremsRecoveryEOverPLead_minValue");
00029 bremsRecoveryEOverPLead_maxValue_ = iConfig.getParameter<double>("BremsRecoveryEOverPLead_maxValue");
00030
00031 applyCut_bremsRecoveryEOverPLead_ = iConfig.getParameter<bool>("ApplyCut_BremsRecoveryEOverPLead");
00032
00033 applyCut_electronPreID_ = iConfig.getParameter<bool>("ApplyCut_ElectronPreID");
00034
00035 applyCut_electronPreID_2D_ = iConfig.getParameter<bool>("ApplyCut_ElectronPreID_2D");
00036
00037 elecPreID0_EOverPLead_maxValue_ = iConfig.getParameter<double>("ElecPreID0_EOverPLead_maxValue");
00038 elecPreID0_HOverPLead_minValue_ = iConfig.getParameter<double>("ElecPreID0_HOverPLead_minValue");
00039 elecPreID1_EOverPLead_maxValue_ = iConfig.getParameter<double>("ElecPreID1_EOverPLead_maxValue");
00040 elecPreID1_HOverPLead_minValue_ = iConfig.getParameter<double>("ElecPreID1_HOverPLead_minValue");
00041
00042
00043 applyCut_PFElectronMVA_ = iConfig.getParameter<bool>("ApplyCut_PFElectronMVA");
00044 pfelectronMVA_maxValue_ = iConfig.getParameter<double>("PFElectronMVA_maxValue");
00045
00046
00047
00048 applyCut_ecalCrack_ = iConfig.getParameter<bool>("ApplyCut_EcalCrackCut");
00049
00050 applyCut_bremCombined_ = iConfig.getParameter<bool>("ApplyCut_BremCombined");
00051 bremCombined_fraction_ = iConfig.getParameter<double>("BremCombined_Fraction");
00052 bremCombined_maxHOP_ = iConfig.getParameter<double>("BremCombined_HOP");
00053 bremCombined_minMass_ = iConfig.getParameter<double>("BremCombined_Mass");
00054 bremCombined_stripSize_ = iConfig.getParameter<double>("BremCombined_StripSize");
00055
00056 }
00057
00058 double discriminate(const PFTauRef& pfTau);
00059
00060 ~PFRecoTauDiscriminationAgainstElectron(){}
00061
00062 private:
00063 bool isInEcalCrack(double) const;
00064 edm::InputTag PFTauProducer_;
00065 bool applyCut_emFraction_;
00066 double emFraction_maxValue_;
00067 bool applyCut_hcalTotOverPLead_;
00068 double hcalTotOverPLead_minValue_;
00069 bool applyCut_hcalMaxOverPLead_;
00070 double hcalMaxOverPLead_minValue_;
00071 bool applyCut_hcal3x3OverPLead_;
00072 double hcal3x3OverPLead_minValue_;
00073
00074 bool applyCut_EOverPLead_;
00075 double EOverPLead_minValue_;
00076 double EOverPLead_maxValue_;
00077 bool applyCut_bremsRecoveryEOverPLead_;
00078 double bremsRecoveryEOverPLead_minValue_;
00079 double bremsRecoveryEOverPLead_maxValue_;
00080
00081 bool applyCut_electronPreID_;
00082
00083 bool applyCut_electronPreID_2D_;
00084 double elecPreID0_EOverPLead_maxValue_;
00085 double elecPreID0_HOverPLead_minValue_;
00086 double elecPreID1_EOverPLead_maxValue_;
00087 double elecPreID1_HOverPLead_minValue_;
00088
00089 bool applyCut_PFElectronMVA_;
00090 double pfelectronMVA_maxValue_;
00091 bool applyCut_ecalCrack_;
00092
00093 bool applyCut_bremCombined_;
00094 double bremCombined_fraction_;
00095 double bremCombined_maxHOP_;
00096 double bremCombined_minMass_;
00097 double bremCombined_stripSize_;
00098
00099
00100
00101 };
00102
00103 double PFRecoTauDiscriminationAgainstElectron::discriminate(const PFTauRef& thePFTauRef)
00104 {
00105
00106
00107
00108
00109
00110 if( (*thePFTauRef).leadPFChargedHadrCand().isNull() )
00111 {
00112 return 0.;
00113 } else
00114 {
00115
00116 TrackRef myleadTk;
00117 myleadTk=(*thePFTauRef).leadPFChargedHadrCand()->trackRef();
00118 math::XYZPointF myleadTkEcalPos = (*thePFTauRef).leadPFChargedHadrCand()->positionAtECALEntrance();
00119 if(myleadTk.isNonnull())
00120 {
00121 if (applyCut_ecalCrack_ && isInEcalCrack(myleadTkEcalPos.eta()))
00122 {
00123 return 0.;
00124 }
00125 }
00126 }
00127
00128 bool decision = false;
00129 bool emfPass = true, htotPass = true, hmaxPass = true;
00130 bool h3x3Pass = true, estripPass = true, erecovPass = true;
00131 bool epreidPass = true, epreid2DPass = true;
00132 bool mvaPass = true, bremCombinedPass = true;
00133
00134 if (applyCut_emFraction_) {
00135 if ((*thePFTauRef).emFraction() > emFraction_maxValue_) {
00136 emfPass = false;
00137 }
00138 }
00139 if (applyCut_hcalTotOverPLead_) {
00140 if ((*thePFTauRef).hcalTotOverPLead() < hcalTotOverPLead_minValue_) {
00141 htotPass = false;
00142 }
00143 }
00144 if (applyCut_hcalMaxOverPLead_) {
00145 if ((*thePFTauRef).hcalMaxOverPLead() < hcalMaxOverPLead_minValue_) {
00146 hmaxPass = false;
00147 }
00148 }
00149 if (applyCut_hcal3x3OverPLead_) {
00150 if ((*thePFTauRef).hcal3x3OverPLead() < hcal3x3OverPLead_minValue_) {
00151 h3x3Pass = false;
00152 }
00153 }
00154 if (applyCut_EOverPLead_) {
00155 if ((*thePFTauRef).ecalStripSumEOverPLead() > EOverPLead_minValue_ &&
00156 (*thePFTauRef).ecalStripSumEOverPLead() < EOverPLead_maxValue_) {
00157 estripPass = false;
00158 } else {
00159 estripPass = true;
00160 }
00161 }
00162 if (applyCut_bremsRecoveryEOverPLead_) {
00163 if ((*thePFTauRef).bremsRecoveryEOverPLead() > bremsRecoveryEOverPLead_minValue_ &&
00164 (*thePFTauRef).bremsRecoveryEOverPLead() < bremsRecoveryEOverPLead_maxValue_) {
00165 erecovPass = false;
00166 } else {
00167 erecovPass = true;
00168 }
00169 }
00170 if (applyCut_electronPreID_) {
00171 if ((*thePFTauRef).electronPreIDDecision()) {
00172 epreidPass = false;
00173 } else {
00174 epreidPass = true;
00175 }
00176 }
00177
00178 if (applyCut_electronPreID_2D_) {
00179 if (
00180 ((*thePFTauRef).electronPreIDDecision() &&
00181 ((*thePFTauRef).ecalStripSumEOverPLead() < elecPreID1_EOverPLead_maxValue_ ||
00182 (*thePFTauRef).hcal3x3OverPLead() > elecPreID1_HOverPLead_minValue_))
00183 ||
00184 (!(*thePFTauRef).electronPreIDDecision() &&
00185 ((*thePFTauRef).ecalStripSumEOverPLead() < elecPreID0_EOverPLead_maxValue_ ||
00186 (*thePFTauRef).hcal3x3OverPLead() > elecPreID0_HOverPLead_minValue_))
00187 ){
00188 epreid2DPass = true;
00189 } else {
00190 epreid2DPass = false;
00191 }
00192 }
00193
00194 if (applyCut_PFElectronMVA_) {
00195 if ((*thePFTauRef).electronPreIDOutput()>pfelectronMVA_maxValue_) {
00196 mvaPass = false;
00197 }
00198 }
00199 if (applyCut_bremCombined_) {
00200 if (thePFTauRef->leadPFChargedHadrCand()->trackRef().isNull()) {
00201
00202 return 0;
00203 }
00204 if(thePFTauRef->signalPFChargedHadrCands().size()==1 && thePFTauRef->signalPFGammaCands().size()==0) {
00205 if(thePFTauRef->leadPFChargedHadrCand()->hcalEnergy()/thePFTauRef->leadPFChargedHadrCand()->trackRef()->p()<bremCombined_maxHOP_)
00206 bremCombinedPass = false;
00207 }
00208 else if(thePFTauRef->signalPFChargedHadrCands().size()==1 && thePFTauRef->signalPFGammaCands().size()>0) {
00209
00210 float bremEnergy=0.;
00211 float emEnergy=0.;
00212 for(unsigned int Nc = 0 ;Nc < thePFTauRef->signalPFGammaCands().size();++Nc)
00213 {
00214 PFCandidateRef cand = thePFTauRef->signalPFGammaCands().at(Nc);
00215 if(fabs(thePFTauRef->leadPFChargedHadrCand()->trackRef()->eta()-cand->eta())<bremCombined_stripSize_)
00216 bremEnergy+=cand->energy();
00217 emEnergy+=cand->energy();
00218 }
00219 if(bremEnergy/emEnergy>bremCombined_fraction_&&thePFTauRef->mass()<bremCombined_minMass_)
00220 bremCombinedPass = false;
00221
00222 }
00223 }
00224
00225 decision = emfPass && htotPass && hmaxPass &&
00226 h3x3Pass && estripPass && erecovPass && epreidPass && epreid2DPass && mvaPass &&bremCombinedPass;
00227
00228 return (decision ? 1. : 0.);
00229 }
00230
00231 bool
00232 PFRecoTauDiscriminationAgainstElectron::isInEcalCrack(double eta) const
00233 {
00234 eta = fabs(eta);
00235 return (eta < 0.018 ||
00236 (eta>0.423 && eta<0.461) ||
00237 (eta>0.770 && eta<0.806) ||
00238 (eta>1.127 && eta<1.163) ||
00239 (eta>1.460 && eta<1.558));
00240 }
00241
00242 DEFINE_FWK_MODULE(PFRecoTauDiscriminationAgainstElectron);