00001 #include "RecoTauTag/RecoTau/interface/PFRecoTauDiscriminationAgainstElectron.h"
00002
00003 void PFRecoTauDiscriminationAgainstElectron::produce(Event& iEvent,const EventSetup& iEventSetup){
00004 Handle<PFTauCollection> thePFTauCollection;
00005 iEvent.getByLabel(PFTauProducer_,thePFTauCollection);
00006
00007
00008 auto_ptr<PFTauDiscriminator> thePFTauDiscriminatorAgainstElectron(new PFTauDiscriminator(PFTauRefProd(thePFTauCollection)));
00009
00010 for(size_t iPFTau=0;iPFTau<thePFTauCollection->size();++iPFTau) {
00011 PFTauRef thePFTauRef(thePFTauCollection,iPFTau);
00012
00013
00014 TrackRef myleadTk;
00015 if((*thePFTauRef).leadPFChargedHadrCand().isNonnull()){
00016 myleadTk=(*thePFTauRef).leadPFChargedHadrCand()->trackRef();
00017 math::XYZPointF myleadTkEcalPos = (*thePFTauRef).leadPFChargedHadrCand()->positionAtECALEntrance();
00018
00019 if(myleadTk.isNonnull()){
00020 if (applyCut_ecalCrack_ && isInEcalCrack(abs((double)myleadTkEcalPos.eta()))) {
00021 thePFTauDiscriminatorAgainstElectron->setValue(iPFTau,0);
00022 continue;
00023 }
00024 }
00025 }
00026
00027 bool decision = false;
00028 bool emfPass = true, htotPass = true, hmaxPass = true;
00029 bool h3x3Pass = true, estripPass = true, erecovPass = true;
00030 bool epreidPass = true, epreid2DPass = true;
00031
00032 if (applyCut_emFraction_) {
00033 if ((*thePFTauRef).emFraction() > emFraction_maxValue_) {
00034 emfPass = false;
00035 }
00036 }
00037 if (applyCut_hcalTotOverPLead_) {
00038 if ((*thePFTauRef).hcalTotOverPLead() < hcalTotOverPLead_minValue_) {
00039 htotPass = false;
00040 }
00041 }
00042 if (applyCut_hcalMaxOverPLead_) {
00043 if ((*thePFTauRef).hcalMaxOverPLead() < hcalMaxOverPLead_minValue_) {
00044 hmaxPass = false;
00045 }
00046 }
00047 if (applyCut_hcal3x3OverPLead_) {
00048 if ((*thePFTauRef).hcal3x3OverPLead() < hcal3x3OverPLead_minValue_) {
00049 h3x3Pass = false;
00050 }
00051 }
00052 if (applyCut_EOverPLead_) {
00053 if ((*thePFTauRef).ecalStripSumEOverPLead() > EOverPLead_minValue_ &&
00054 (*thePFTauRef).ecalStripSumEOverPLead() < EOverPLead_maxValue_) {
00055 estripPass = false;
00056 } else {
00057 estripPass = true;
00058 }
00059 }
00060 if (applyCut_bremsRecoveryEOverPLead_) {
00061 if ((*thePFTauRef).bremsRecoveryEOverPLead() > bremsRecoveryEOverPLead_minValue_ &&
00062 (*thePFTauRef).bremsRecoveryEOverPLead() < bremsRecoveryEOverPLead_maxValue_) {
00063 erecovPass = false;
00064 } else {
00065 erecovPass = true;
00066 }
00067 }
00068 if (applyCut_electronPreID_) {
00069 if ((*thePFTauRef).electronPreIDDecision()) {
00070 epreidPass = false;
00071 } else {
00072 epreidPass = true;
00073 }
00074 }
00075
00076 if (applyCut_electronPreID_2D_) {
00077 if (
00078 ((*thePFTauRef).electronPreIDDecision() &&
00079 ((*thePFTauRef).ecalStripSumEOverPLead() < elecPreID1_EOverPLead_maxValue ||
00080 (*thePFTauRef).hcal3x3OverPLead() > elecPreID1_HOverPLead_minValue))
00081 ||
00082 (!(*thePFTauRef).electronPreIDDecision() &&
00083 ((*thePFTauRef).ecalStripSumEOverPLead() < elecPreID0_EOverPLead_maxValue ||
00084 (*thePFTauRef).hcal3x3OverPLead() > elecPreID0_HOverPLead_minValue))
00085 ){
00086 epreid2DPass = true;
00087 } else {
00088 epreid2DPass = false;
00089 }
00090 }
00091
00092 decision = emfPass && htotPass && hmaxPass &&
00093 h3x3Pass && estripPass && erecovPass && epreidPass && epreid2DPass;
00094 if (decision) {
00095 thePFTauDiscriminatorAgainstElectron->setValue(iPFTau,1);
00096 } else {
00097 thePFTauDiscriminatorAgainstElectron->setValue(iPFTau,0);
00098 }
00099 }
00100
00101
00102 iEvent.put(thePFTauDiscriminatorAgainstElectron);
00103 }
00104
00105 bool
00106 PFRecoTauDiscriminationAgainstElectron::isInEcalCrack(double eta) const{
00107 return (eta < 0.018 ||
00108 (eta>0.423 && eta<0.461) ||
00109 (eta>0.770 && eta<0.806) ||
00110 (eta>1.127 && eta<1.163) ||
00111 (eta>1.460 && eta<1.558));
00112 }