CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/RecoEgamma/PhotonIdentification/src/CutBasedPhotonIDAlgo.cc

Go to the documentation of this file.
00001 #include "RecoEgamma/PhotonIdentification/interface/CutBasedPhotonIDAlgo.h"
00002 #include "DataFormats/EgammaCandidates/interface/Photon.h"
00003 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
00004 
00005 
00006 
00007 void CutBasedPhotonIDAlgo::setup(const edm::ParameterSet& conf) {
00008   
00009 
00010   //Decision cuts
00011   dophotonEcalRecHitIsolationCut_ = conf.getParameter<bool>("DoEcalRecHitIsolationCut");
00012   dophotonHcalTowerIsolationCut_ = conf.getParameter<bool>("DoHcalTowerIsolationCut");
00013   dophotonHCTrkIsolationCut_ = conf.getParameter<bool>("DoHollowConeTrackIsolationCut");
00014   dophotonSCTrkIsolationCut_ = conf.getParameter<bool>("DoSolidConeTrackIsolationCut");
00015   dophotonHCNTrkCut_ = conf.getParameter<bool>("DoHollowConeNTrkCut");
00016   dophotonSCNTrkCut_ = conf.getParameter<bool>("DoSolidConeNTrkCut");
00017   dophotonHadOverEMCut_ = conf.getParameter<bool>("DoHadOverEMCut");
00018   dophotonsigmaeeCut_ = conf.getParameter<bool>("DoEtaWidthCut");
00019   dophotonR9Cut_ = conf.getParameter<bool>("DoR9Cut");
00020   dorequireFiducial_ = conf.getParameter<bool>("RequireFiducial");
00021 
00022   looseEMEcalIsoRelativeCutSlopeEB_ = conf.getParameter<double>("LooseEMEcalIsoRelativeCutSlopeEB");
00023   looseEMEcalIsoRelativeCutOffsetEB_ = conf.getParameter<double>("LooseEMEcalIsoRelativeCutOffsetEB");
00024   looseEMHcalTowerIsolationCutSlopeEB_ = conf.getParameter<double>("LooseEMHcalTowerIsoSlopeEB");
00025   looseEMHcalTowerIsolationCutOffsetEB_ = conf.getParameter<double>("LooseEMHcalTowerIsoOffsetEB");
00026   looseEMHollowConeTrkIsolationSlopeEB_ = conf.getParameter<double>("LooseEMHollowTrkSlopeEB");
00027   looseEMHollowConeTrkIsolationOffsetEB_ = conf.getParameter<double>("LooseEMHollowTrkOffsetEB");
00028   looseEMSolidConeTrkIsolationSlopeEB_ = conf.getParameter<double>("LooseEMSolidTrkSlopeEB");
00029   looseEMSolidConeTrkIsolationOffsetEB_ = conf.getParameter<double>("LooseEMSolidTrkOffsetEB");
00030   looseEMSolidConeTrkIsolationCutEB_ = conf.getParameter<double>("LooseEMSolidTrkEB");
00031   looseEMSolidConeNTrkCutEB_ = conf.getParameter<int>("LooseEMSolidNTrkEB");
00032   looseEMHollowConeNTrkCutEB_ = conf.getParameter<int>("LooseEMHollowNTrkEB");
00033   looseEMEtaWidthCutEB_ = conf.getParameter<double>("LooseEMEtaWidthEB");
00034   looseEMHadOverEMCutEB_ = conf.getParameter<double>("LooseEMHadOverEMEB");
00035   looseEMR9CutEB_ = conf.getParameter<double>("LooseEMR9CutEB");
00036 
00037   loosephotonEcalIsoRelativeCutSlopeEB_ = conf.getParameter<double>("LoosePhotonEcalIsoRelativeCutSlopeEB");
00038   loosephotonEcalIsoRelativeCutOffsetEB_ = conf.getParameter<double>("LoosePhotonEcalIsoRelativeCutOffsetEB");
00039   loosephotonHcalTowerIsolationCutSlopeEB_ = conf.getParameter<double>("LoosePhotonHcalTowerIsoSlopeEB");
00040   loosephotonHcalTowerIsolationCutOffsetEB_ = conf.getParameter<double>("LoosePhotonHcalTowerIsoOffsetEB");
00041   loosephotonHollowConeTrkIsolationSlopeEB_ = conf.getParameter<double>("LoosePhotonHollowTrkSlopeEB");
00042   loosephotonHollowConeTrkIsolationOffsetEB_ = conf.getParameter<double>("LoosePhotonHollowTrkOffsetEB");
00043   loosephotonSolidConeTrkIsolationSlopeEB_ = conf.getParameter<double>("LoosePhotonSolidTrkSlopeEB");
00044   loosephotonSolidConeTrkIsolationOffsetEB_ = conf.getParameter<double>("LoosePhotonSolidTrkOffsetEB");
00045   loosephotonSolidConeTrkIsolationCutEB_ = conf.getParameter<double>("LoosePhotonSolidTrkEB");
00046   loosephotonSolidConeNTrkCutEB_ = conf.getParameter<int>("LoosePhotonSolidNTrkEB");
00047   loosephotonHollowConeNTrkCutEB_ = conf.getParameter<int>("LoosePhotonHollowNTrkEB");
00048   loosephotonEtaWidthCutEB_ = conf.getParameter<double>("LoosePhotonEtaWidthEB");
00049   loosephotonHadOverEMCutEB_ = conf.getParameter<double>("LoosePhotonHadOverEMEB");
00050   loosephotonR9CutEB_ = conf.getParameter<double>("LoosePhotonR9CutEB");
00051 
00052 
00053   tightphotonEcalIsoRelativeCutSlopeEB_ = conf.getParameter<double>("TightPhotonEcalIsoRelativeCutSlopeEB");
00054   tightphotonEcalIsoRelativeCutOffsetEB_ = conf.getParameter<double>("TightPhotonEcalIsoRelativeCutOffsetEB");
00055   tightphotonHcalTowerIsolationCutSlopeEB_ = conf.getParameter<double>("TightPhotonHcalTowerIsoSlopeEB");
00056   tightphotonHcalTowerIsolationCutOffsetEB_ = conf.getParameter<double>("TightPhotonHcalTowerIsoOffsetEB");
00057   tightphotonHollowConeTrkIsolationSlopeEB_ = conf.getParameter<double>("TightPhotonHollowTrkSlopeEB");
00058   tightphotonHollowConeTrkIsolationOffsetEB_ = conf.getParameter<double>("TightPhotonHollowTrkOffsetEB");
00059   tightphotonSolidConeTrkIsolationSlopeEB_ = conf.getParameter<double>("TightPhotonSolidTrkSlopeEB");
00060   tightphotonSolidConeTrkIsolationOffsetEB_ = conf.getParameter<double>("TightPhotonSolidTrkOffsetEB");
00061   tightphotonSolidConeNTrkCutEB_ = conf.getParameter<int>("TightPhotonSolidNTrkEB");
00062   tightphotonHollowConeNTrkCutEB_ = conf.getParameter<int>("TightPhotonHollowNTrkEB");
00063   tightphotonEtaWidthCutEB_ = conf.getParameter<double>("TightPhotonEtaWidthEB");
00064   tightphotonHadOverEMCutEB_ = conf.getParameter<double>("TightPhotonHadOverEMEB");
00065   tightphotonR9CutEB_ = conf.getParameter<double>("TightPhotonR9CutEB");
00066 
00067   //get cuts here EE
00068 
00069   looseEMEcalIsoRelativeCutSlopeEE_ = conf.getParameter<double>("LooseEMEcalIsoRelativeCutSlopeEE");
00070   looseEMEcalIsoRelativeCutOffsetEE_ = conf.getParameter<double>("LooseEMEcalIsoRelativeCutOffsetEE");
00071   looseEMHcalTowerIsolationCutSlopeEE_ = conf.getParameter<double>("LooseEMHcalTowerIsoSlopeEE");
00072   looseEMHcalTowerIsolationCutOffsetEE_ = conf.getParameter<double>("LooseEMHcalTowerIsoOffsetEE");
00073   looseEMHollowConeTrkIsolationSlopeEE_ = conf.getParameter<double>("LooseEMHollowTrkSlopeEE");
00074   looseEMHollowConeTrkIsolationOffsetEE_ = conf.getParameter<double>("LooseEMHollowTrkOffsetEE");
00075   looseEMSolidConeTrkIsolationSlopeEE_ = conf.getParameter<double>("LooseEMSolidTrkSlopeEE");
00076   looseEMSolidConeTrkIsolationOffsetEE_ = conf.getParameter<double>("LooseEMSolidTrkOffsetEE");
00077   looseEMSolidConeTrkIsolationCutEE_ = conf.getParameter<double>("LooseEMSolidTrkEE");
00078   looseEMSolidConeNTrkCutEE_ = conf.getParameter<int>("LooseEMSolidNTrkEE");
00079   looseEMHollowConeNTrkCutEE_ = conf.getParameter<int>("LooseEMHollowNTrkEE");
00080   looseEMEtaWidthCutEE_ = conf.getParameter<double>("LooseEMEtaWidthEE");
00081   looseEMHadOverEMCutEE_ = conf.getParameter<double>("LooseEMHadOverEMEE");
00082   looseEMR9CutEE_ = conf.getParameter<double>("LooseEMR9CutEE");
00083 
00084   loosephotonEcalIsoRelativeCutSlopeEE_ = conf.getParameter<double>("LoosePhotonEcalIsoRelativeCutSlopeEE");
00085   loosephotonEcalIsoRelativeCutOffsetEE_ = conf.getParameter<double>("LoosePhotonEcalIsoRelativeCutOffsetEE");
00086   loosephotonHcalTowerIsolationCutSlopeEE_ = conf.getParameter<double>("LoosePhotonHcalTowerIsoSlopeEE");
00087   loosephotonHcalTowerIsolationCutOffsetEE_ = conf.getParameter<double>("LoosePhotonHcalTowerIsoOffsetEE");
00088   loosephotonHollowConeTrkIsolationSlopeEE_ = conf.getParameter<double>("LoosePhotonHollowTrkSlopeEE");
00089   loosephotonHollowConeTrkIsolationOffsetEE_ = conf.getParameter<double>("LoosePhotonHollowTrkOffsetEE");
00090   loosephotonSolidConeTrkIsolationSlopeEE_ = conf.getParameter<double>("LoosePhotonSolidTrkSlopeEE");
00091   loosephotonSolidConeTrkIsolationOffsetEE_ = conf.getParameter<double>("LoosePhotonSolidTrkOffsetEE");
00092   loosephotonSolidConeTrkIsolationCutEE_ = conf.getParameter<double>("LoosePhotonSolidTrkEE");
00093   loosephotonSolidConeNTrkCutEE_ = conf.getParameter<int>("LoosePhotonSolidNTrkEE");
00094   loosephotonHollowConeNTrkCutEE_ = conf.getParameter<int>("LoosePhotonHollowNTrkEE");
00095   loosephotonEtaWidthCutEE_ = conf.getParameter<double>("LoosePhotonEtaWidthEE");
00096   loosephotonHadOverEMCutEE_ = conf.getParameter<double>("LoosePhotonHadOverEMEE");
00097   loosephotonR9CutEE_ = conf.getParameter<double>("LoosePhotonR9CutEE");
00098 
00099   tightphotonEcalIsoRelativeCutSlopeEE_ = conf.getParameter<double>("TightPhotonEcalIsoRelativeCutSlopeEE");
00100   tightphotonEcalIsoRelativeCutOffsetEE_ = conf.getParameter<double>("TightPhotonEcalIsoRelativeCutOffsetEE");
00101   tightphotonHcalTowerIsolationCutSlopeEE_ = conf.getParameter<double>("TightPhotonHcalTowerIsoSlopeEE");
00102   tightphotonHcalTowerIsolationCutOffsetEE_ = conf.getParameter<double>("TightPhotonHcalTowerIsoOffsetEE");
00103   tightphotonHollowConeTrkIsolationSlopeEE_ = conf.getParameter<double>("TightPhotonHollowTrkSlopeEE");
00104   tightphotonHollowConeTrkIsolationOffsetEE_ = conf.getParameter<double>("TightPhotonHollowTrkOffsetEE");
00105   tightphotonSolidConeTrkIsolationSlopeEE_ = conf.getParameter<double>("TightPhotonSolidTrkSlopeEE");
00106   tightphotonSolidConeTrkIsolationOffsetEE_ = conf.getParameter<double>("TightPhotonSolidTrkOffsetEE");
00107   tightphotonSolidConeNTrkCutEE_ = conf.getParameter<int>("TightPhotonSolidNTrkEE");
00108   tightphotonHollowConeNTrkCutEE_ = conf.getParameter<int>("TightPhotonHollowNTrkEE");
00109   tightphotonEtaWidthCutEE_ = conf.getParameter<double>("TightPhotonEtaWidthEE");
00110   tightphotonHadOverEMCutEE_ = conf.getParameter<double>("TightPhotonHadOverEMEE");
00111   tightphotonR9CutEE_ = conf.getParameter<double>("TightPhotonR9CutEE");
00112 
00113 }
00114 
00115 void CutBasedPhotonIDAlgo::decideEB(const reco::Photon* pho, bool &LooseEM, bool &LoosePhoton, bool &TightPhoton){
00116 
00117 
00119   //If one has selected to apply fiducial cuts, they will be
00120   //applied for all loosePhoton, tightPhoton.
00121   //Consider yourself warned!
00123   
00124   //Require supercluster is within fiducial volume.
00125   if(dorequireFiducial_){
00126     if (pho->isEBEEGap()) {
00127       LooseEM     = false;
00128       LoosePhoton = false;
00129       TightPhoton = false;
00130       return;
00131     }
00132     if ( pho->isEBEtaGap() || pho->isEBPhiGap() ){
00133       LooseEM     = false;
00134       LoosePhoton = false;
00135       TightPhoton = false;
00136       return;
00137     }
00138     if ( pho->isEERingGap() || pho->isEEDeeGap()  ){
00139       LooseEM     = false;
00140       LoosePhoton = false;
00141       TightPhoton = false;
00142       return;
00143     }
00144   }
00146   //Done with fiducial cuts.
00148 
00149   //first do looseEM selection,  if Photon is not LooseEM,
00150   //by definition it is also not LoosePhoton or TightPhoton
00151 
00152   //Cut on the sum of ecal rec hits in a cone
00153   if(dophotonEcalRecHitIsolationCut_){
00154     double cutvalue = looseEMEcalIsoRelativeCutSlopeEB_*pho->pt() + looseEMEcalIsoRelativeCutOffsetEB_;
00155     if(pho->ecalRecHitSumEtConeDR04() > cutvalue){
00156       LooseEM     = false;
00157       LoosePhoton = false;
00158       TightPhoton = false;
00159       return;
00160     }
00161   }
00162   
00163   //Cut on the sum of hcal rec hits in a cone (HBHE)
00164   if(dophotonHcalTowerIsolationCut_){
00165     double cutvalue = looseEMHcalTowerIsolationCutSlopeEB_*pho->pt() + looseEMHcalTowerIsolationCutOffsetEB_;
00166     if(pho->hcalTowerSumEtConeDR04() > cutvalue){
00167       LooseEM     = false;
00168       LoosePhoton = false;
00169       TightPhoton = false;
00170       return;
00171     }
00172   }
00173 
00174   //Cut on number of tracks within the solid cone.
00175   if (dophotonSCNTrkCut_){
00176     if (pho->nTrkSolidConeDR04() > looseEMSolidConeNTrkCutEB_){
00177       LooseEM     = false;
00178       LoosePhoton = false;
00179       TightPhoton = false;
00180       return;
00181     }
00182   }
00183 
00184   //Cut on number of tracks within the hollow cone.
00185   if (dophotonHCNTrkCut_){
00186     if (pho->nTrkHollowConeDR04() > looseEMHollowConeNTrkCutEB_){
00187       LooseEM     = false;
00188       LoosePhoton = false;
00189       TightPhoton = false;    
00190       return;
00191     }
00192   }
00193  
00194   //Cut on the sum of tracks within a solid cone
00195   if (dophotonSCTrkIsolationCut_){
00196     double cutvalue = looseEMSolidConeTrkIsolationSlopeEB_*pho->pt() + looseEMSolidConeTrkIsolationOffsetEB_;
00197     if (pho->trkSumPtSolidConeDR04() > cutvalue){
00198       LooseEM     = false;
00199       LoosePhoton = false;
00200       TightPhoton = false;
00201       return;
00202     }
00203   }
00204 
00205   //Cut on the sum of tracks within a hollow cone
00206   if (dophotonHCTrkIsolationCut_){
00207     double cutvalue = looseEMHollowConeTrkIsolationSlopeEB_*pho->pt() + looseEMHollowConeTrkIsolationOffsetEB_;
00208     if (pho->trkSumPtHollowConeDR04() > cutvalue){
00209       LooseEM     = false;
00210       LoosePhoton = false;
00211       TightPhoton = false;
00212       return;
00213     }  
00214   }
00215 
00216   //HadoverEM cut
00217   if (dophotonHadOverEMCut_){
00218     float hadoverE = pho->hadronicOverEm();
00219     if (hadoverE > looseEMHadOverEMCutEB_){
00220       LooseEM     = false;
00221       LoosePhoton = false;
00222       TightPhoton = false;
00223       return;
00224     }
00225   }
00226 
00227   //eta width
00228 
00229   if (dophotonsigmaeeCut_){
00230  
00231     double sigmaee = pho->sigmaIetaIeta();
00232     if (sigmaee > looseEMEtaWidthCutEB_){
00233       LooseEM     = false;
00234       LoosePhoton = false;
00235       TightPhoton = false;
00236       return;
00237     }
00238   }
00239   //R9 cut
00240   if (dophotonR9Cut_){
00241     if (pho->r9() < looseEMR9CutEB_){
00242       LooseEM     = false;
00243       LoosePhoton = false;
00244       TightPhoton = false;      
00245       return;
00246     }
00247   }
00248   LooseEM = true;
00249 
00251   //Next do loosephoton selection.
00252   //If an object is not LoosePhoton, it is also not
00253   //TightPhoton!
00255   //Cut on the sum of ecal rec hits in a cone
00256   if(dophotonEcalRecHitIsolationCut_){
00257     double cutvalue = loosephotonEcalIsoRelativeCutSlopeEB_*pho->pt() + loosephotonEcalIsoRelativeCutOffsetEB_;
00258     if(pho->ecalRecHitSumEtConeDR04() > cutvalue){
00259       LoosePhoton = false;
00260       TightPhoton = false;
00261       return;
00262     }
00263   }
00264   
00265   //Cut on the sum of hcal rec hits in a cone (HBHE)
00266   if(dophotonHcalTowerIsolationCut_){
00267     double cutvalue = loosephotonHcalTowerIsolationCutSlopeEB_*pho->pt() + loosephotonHcalTowerIsolationCutOffsetEB_;
00268     if(pho->hcalTowerSumEtConeDR04() > cutvalue){
00269       LoosePhoton = false;
00270       TightPhoton = false;
00271       return;
00272     }
00273   }
00274 
00275   //Cut on number of tracks within the solid cone.
00276   if (dophotonSCNTrkCut_){
00277     if (pho->nTrkSolidConeDR04() > loosephotonSolidConeNTrkCutEB_){
00278       LoosePhoton = false;
00279       TightPhoton = false;
00280       return;
00281     }
00282   }
00283 
00284   //Cut on number of tracks within the hollow cone.
00285   if (dophotonHCNTrkCut_){
00286     if (pho->nTrkHollowConeDR04() > loosephotonHollowConeNTrkCutEB_){
00287       LoosePhoton = false;
00288       TightPhoton = false;    
00289       return;
00290     }
00291   }
00292  
00293   //Cut on the sum of tracks within a solid cone
00294   if (dophotonSCTrkIsolationCut_){
00295     double cutvalue = loosephotonSolidConeTrkIsolationSlopeEB_*pho->pt() + loosephotonSolidConeTrkIsolationOffsetEB_;
00296     if (pho->trkSumPtSolidConeDR04() > cutvalue){
00297       LoosePhoton = false;
00298       TightPhoton = false;
00299       return;
00300     }
00301   }
00302 
00303   //Cut on the sum of tracks within a hollow cone
00304   if (dophotonHCTrkIsolationCut_){
00305     double cutvalue = loosephotonHollowConeTrkIsolationSlopeEB_*pho->pt() + loosephotonHollowConeTrkIsolationOffsetEB_;
00306     if (pho->trkSumPtHollowConeDR04() > cutvalue){
00307       LoosePhoton = false;
00308       TightPhoton = false;
00309       return;
00310     }  
00311   }
00312 
00313   //HadoverEM cut
00314   if (dophotonHadOverEMCut_){
00315     float hadoverE = pho->hadronicOverEm();
00316     if (hadoverE > loosephotonHadOverEMCutEB_){
00317       LoosePhoton = false;
00318       TightPhoton = false;
00319       return;
00320     }
00321   }
00322 
00323   //eta width
00324 
00325   if (dophotonsigmaeeCut_){
00326  
00327     double sigmaee = pho->sigmaIetaIeta();
00328     if (sigmaee > loosephotonEtaWidthCutEB_){
00329       LoosePhoton = false;
00330       TightPhoton = false;
00331       return;
00332     }
00333   }
00334   //R9 cut
00335   if (dophotonR9Cut_){
00336     if (pho->r9() < loosephotonR9CutEB_){
00337       LoosePhoton = false;
00338       TightPhoton = false;      
00339       return;
00340     }
00341   }
00342   //If one reaches this point, the decision has been made that this object,
00343   //is indeed loosePhoton.
00344   LoosePhoton = true;
00345 
00347   //Next do tightphoton selection.
00348   //This is the tightest critieria,
00349   //and once more one assumes that these criteria are
00350   //tighter than loose.
00352     //Cut on the sum of ecal rec hits in a cone
00353   if(dophotonEcalRecHitIsolationCut_){
00354     double cutvalue = tightphotonEcalIsoRelativeCutSlopeEB_*pho->pt() + tightphotonEcalIsoRelativeCutOffsetEB_;
00355     if(pho->ecalRecHitSumEtConeDR04() > cutvalue){
00356       LoosePhoton = true;
00357       TightPhoton = false;
00358       return;
00359     }
00360   }
00361 
00362   //Cut on the sum of hcal rec hits in a cone (HBHE)
00363   if(dophotonHcalTowerIsolationCut_){
00364     double cutvalue = tightphotonHcalTowerIsolationCutSlopeEB_*pho->pt() + tightphotonHcalTowerIsolationCutOffsetEB_;
00365     if(pho->hcalTowerSumEtConeDR04() > cutvalue){
00366       LoosePhoton = true;
00367       TightPhoton = false;
00368       return;
00369     }
00370   }
00371 
00372   //Cut on number of tracks within the solid cone.
00373   if (dophotonSCNTrkCut_){
00374     if (pho->nTrkSolidConeDR04() > tightphotonSolidConeNTrkCutEB_){
00375       LoosePhoton = true;
00376       TightPhoton = false;
00377       return;
00378     }
00379   }
00380 
00381   //Cut on number of tracks within the hollow cone.
00382   if (dophotonHCNTrkCut_){
00383     if (pho->nTrkHollowConeDR04() > tightphotonHollowConeNTrkCutEB_){
00384       LoosePhoton = true;
00385       TightPhoton = false;
00386       return;
00387     }
00388   }
00389   
00390   //Cut on the sum of tracks within a solid cone
00391   if (dophotonSCTrkIsolationCut_){
00392     double cutvalue = tightphotonSolidConeTrkIsolationSlopeEB_*pho->pt() + tightphotonSolidConeTrkIsolationOffsetEB_;
00393     if (pho->trkSumPtSolidConeDR04() > cutvalue){
00394       LoosePhoton = true;
00395       TightPhoton = false;
00396       return;
00397     }
00398   }
00399 
00400   //Cut on the sum of tracks within a hollow cone
00401   if (dophotonHCTrkIsolationCut_){
00402     double cutvalue = tightphotonHollowConeTrkIsolationSlopeEB_*pho->pt() + tightphotonHollowConeTrkIsolationOffsetEB_;
00403     if (pho->trkSumPtHollowConeDR04() > cutvalue){
00404       LoosePhoton = true;
00405       TightPhoton = false;
00406       return;
00407     }  
00408   }
00409 
00410   //HadoverEM cut
00411   if (dophotonHadOverEMCut_){
00412     float hadoverE = pho->hadronicOverEm();
00413     if (hadoverE > tightphotonHadOverEMCutEB_){
00414       LoosePhoton = true;
00415       TightPhoton = false;
00416       return;
00417     }
00418   }
00419 
00420   //eta width
00421 
00422   if (dophotonsigmaeeCut_){
00423     double sigmaee = pho->sigmaIetaIeta();
00424     if (sigmaee > tightphotonEtaWidthCutEB_){
00425       LoosePhoton = true;
00426       TightPhoton = false;
00427       return;
00428     }
00429   }
00430   //R9 cut
00431   if (dophotonR9Cut_){
00432     if (pho->r9() < tightphotonR9CutEB_){
00433       LoosePhoton = true;
00434       TightPhoton = false;
00435       return;
00436     }
00437   }
00438 
00439   //if you got here, you must have passed all cuts!
00440   TightPhoton = true;
00441   
00442 }
00443 
00444 
00445 
00446 void CutBasedPhotonIDAlgo::decideEE(const reco::Photon* pho, bool &LooseEM, bool &LoosePhoton, bool &TightPhoton){
00447   
00449   //If one has selected to apply fiducial cuts, they will be
00450   //applied for all , loosePhoton, tightPhoton.
00451   //Consider yourself warned!
00453 
00454   //Require supercluster is within fiducial volume.
00455   if(dorequireFiducial_){
00456     if (pho->isEBEEGap()) {
00457       LooseEM     = false;
00458       LoosePhoton = false;
00459       TightPhoton = false;
00460       
00461       return;
00462     }
00463     if ( pho->isEBEtaGap() ||  pho->isEBPhiGap() ){
00464       LooseEM     = false;
00465       LoosePhoton = false;
00466       TightPhoton = false;
00467       return;
00468     }
00469     if (pho->isEERingGap() || pho->isEEDeeGap() ){
00470       LooseEM     = false;
00471       LoosePhoton = false;
00472       TightPhoton = false;
00473       return;
00474     }
00475   }
00477   //Done with fiducial cuts.
00479   //Do LooseEM selection.  By definition, if a photon does not pass LooseEM, it does not pass LoosePhoton or TightPhoton!
00480   if(dophotonEcalRecHitIsolationCut_){
00481     double cutvalue = looseEMEcalIsoRelativeCutSlopeEE_*pho->pt() + looseEMEcalIsoRelativeCutOffsetEE_;
00482     if(pho->ecalRecHitSumEtConeDR04() > cutvalue){
00483       LooseEM     = false;
00484       LoosePhoton = false;
00485       TightPhoton = false;
00486       return;
00487     }
00488   }
00489   
00490   //Cut on the sum of hcal towers in a cone (HBHE)
00491   if(dophotonHcalTowerIsolationCut_){
00492     double cutvalue = looseEMHcalTowerIsolationCutSlopeEE_*pho->pt() + looseEMHcalTowerIsolationCutOffsetEE_;
00493     if(pho->hcalTowerSumEtConeDR04() > cutvalue){
00494       LooseEM     = false;
00495       LoosePhoton = false;
00496       TightPhoton = false;
00497       return;
00498     }
00499   }
00500 
00501   //Cut on number of tracks within the solid cone.
00502   if (dophotonSCNTrkCut_){
00503     if (pho->nTrkSolidConeDR04() > looseEMSolidConeNTrkCutEE_){
00504       LooseEM     = false;
00505       LoosePhoton = false;
00506       TightPhoton = false;  
00507       return;
00508     }
00509   }
00510 
00511   //Cut on number of tracks within the hollow cone.
00512   if (dophotonHCNTrkCut_){
00513     if (pho->nTrkHollowConeDR04() > looseEMHollowConeNTrkCutEE_){
00514       LooseEM     = false;
00515       LoosePhoton = false;
00516       TightPhoton = false;  
00517       return;
00518     }
00519   }
00520   
00521 
00522   //Cut on the sum of tracks within a solid cone
00523   if (dophotonSCTrkIsolationCut_){
00524     double cutvalue = looseEMSolidConeTrkIsolationSlopeEE_*pho->pt() + looseEMSolidConeTrkIsolationOffsetEE_;
00525     if (pho->trkSumPtSolidConeDR04() > cutvalue){
00526       LooseEM     = false;
00527       LoosePhoton = false;
00528       TightPhoton = false;
00529       return;
00530     }
00531   }
00532 
00533   //Cut on the sum of tracks within a hollow cone
00534   if (dophotonHCTrkIsolationCut_){
00535     double cutvalue = looseEMHollowConeTrkIsolationSlopeEE_*pho->pt() + looseEMHollowConeTrkIsolationOffsetEE_;
00536     if (pho->trkSumPtHollowConeDR04() > cutvalue){
00537       LooseEM     = false;
00538       LoosePhoton = false;
00539       TightPhoton = false;
00540       return;
00541     }  
00542   }
00543 
00544   //HadoverEM cut
00545   if (dophotonHadOverEMCut_){
00546     float hadoverE = pho->hadronicOverEm();
00547     if (hadoverE > looseEMHadOverEMCutEE_){
00548       LooseEM     = false;
00549       LoosePhoton = false;
00550       TightPhoton = false;  
00551       return;
00552     }
00553   }
00554 
00555   //eta width
00556 
00557   if (dophotonsigmaeeCut_){
00558     
00559     double sigmaee = pho->sigmaIetaIeta();
00560   
00561     if (sigmaee > looseEMEtaWidthCutEE_){
00562       LooseEM     = false;
00563       LoosePhoton = false;
00564       TightPhoton = false;  
00565       return;
00566     }
00567   }
00568   //R9 cut
00569   if (dophotonR9Cut_){
00570     if (pho->r9() < looseEMR9CutEE_){
00571       LooseEM     = false;
00572       LoosePhoton = false;
00573       TightPhoton = false;  
00574       return;
00575     }
00576   }
00577   LooseEM = true;
00579   //Next do loosephoton selection.
00580   //If an object is not LoosePhoton, it is also not
00581   //TightPhoton!
00583 
00584   if(dophotonEcalRecHitIsolationCut_){
00585     double cutvalue = loosephotonEcalIsoRelativeCutSlopeEE_*pho->pt() + loosephotonEcalIsoRelativeCutOffsetEE_;
00586     if(pho->ecalRecHitSumEtConeDR04() > cutvalue){
00587       LoosePhoton = false;
00588       TightPhoton = false;
00589       return;
00590     }
00591   }
00592   
00593   //Cut on the sum of hcal rec hits in a cone (HBHE)
00594   if(dophotonHcalTowerIsolationCut_){
00595     double cutvalue = loosephotonHcalTowerIsolationCutSlopeEE_*pho->pt() + loosephotonHcalTowerIsolationCutOffsetEE_;
00596     if(pho->hcalTowerSumEtConeDR04() > cutvalue){
00597       LoosePhoton = false;
00598       TightPhoton = false;
00599       return;
00600     }
00601   }
00602 
00603   //Cut on number of tracks within the solid cone.
00604   if (dophotonSCNTrkCut_){
00605     if (pho->nTrkSolidConeDR04() > loosephotonSolidConeNTrkCutEE_){
00606       LoosePhoton = false;
00607       TightPhoton = false;  
00608       return;
00609     }
00610   }
00611 
00612   //Cut on number of tracks within the hollow cone.
00613   if (dophotonHCNTrkCut_){
00614     if (pho->nTrkHollowConeDR04() > loosephotonHollowConeNTrkCutEE_){
00615       LoosePhoton = false;
00616       TightPhoton = false;  
00617       return;
00618     }
00619   }
00620   
00621 
00622   //Cut on the sum of tracks within a solid cone
00623   if (dophotonSCTrkIsolationCut_){
00624     double cutvalue = loosephotonSolidConeTrkIsolationSlopeEE_*pho->pt() + loosephotonSolidConeTrkIsolationOffsetEE_;
00625     if (pho->trkSumPtSolidConeDR04() > cutvalue){
00626       LoosePhoton = false;
00627       TightPhoton = false;
00628       return;
00629     }
00630   }
00631 
00632   //Cut on the sum of tracks within a hollow cone
00633   if (dophotonHCTrkIsolationCut_){
00634     double cutvalue = loosephotonHollowConeTrkIsolationSlopeEE_*pho->pt() + loosephotonHollowConeTrkIsolationOffsetEE_;
00635     if (pho->trkSumPtHollowConeDR04() > cutvalue){
00636       LoosePhoton = false;
00637       TightPhoton = false;
00638       return;
00639     }  
00640   }
00641 
00642   //HadoverEM cut
00643   if (dophotonHadOverEMCut_){
00644     float hadoverE = pho->hadronicOverEm();
00645     if (hadoverE > loosephotonHadOverEMCutEE_){
00646       LoosePhoton = false;
00647       TightPhoton = false;  
00648       return;
00649     }
00650   }
00651 
00652   //eta width
00653 
00654   if (dophotonsigmaeeCut_){
00655     
00656     double sigmaee = pho->sigmaIetaIeta();
00657   
00658     if (sigmaee > loosephotonEtaWidthCutEE_){
00659       LoosePhoton = false;
00660       TightPhoton = false;  
00661       return;
00662     }
00663   }
00664   //R9 cut
00665   if (dophotonR9Cut_){
00666     if (pho->r9() < loosephotonR9CutEE_){
00667       LoosePhoton = false;
00668       TightPhoton = false;  
00669       return;
00670     }
00671   }
00672   //If one reaches this point, the decision has been made that this object,
00673   //is indeed loosePhoton.
00674   LoosePhoton = true;
00676   //Next do tightphoton selection.
00677   //This is the tightest critieria,
00678   //and once more one assumes that these criteria are
00679   //tighter than loose.
00681   if(dophotonEcalRecHitIsolationCut_){
00682     double cutvalue = tightphotonEcalIsoRelativeCutSlopeEE_*pho->pt() + tightphotonEcalIsoRelativeCutOffsetEE_;
00683     if(pho->ecalRecHitSumEtConeDR04() > cutvalue){
00684       LoosePhoton = true;
00685       TightPhoton = false;
00686       return;
00687     }
00688   }
00689 
00690   //Cut on the sum of hcal rec hits in a cone (HBHE)
00691   if(dophotonHcalTowerIsolationCut_){
00692     double cutvalue = tightphotonHcalTowerIsolationCutSlopeEE_*pho->pt() + tightphotonHcalTowerIsolationCutOffsetEE_;
00693     if(pho->hcalTowerSumEtConeDR04() > cutvalue){
00694       LoosePhoton = true;
00695       TightPhoton = false;
00696       return;
00697     }
00698   }
00699 
00700   //Cut on number of tracks within the solid cone.
00701   if (dophotonSCNTrkCut_){
00702     if (pho->nTrkSolidConeDR04() > tightphotonSolidConeNTrkCutEE_){
00703       LoosePhoton = true;
00704       TightPhoton = false;  
00705       return;
00706     }
00707   }
00708 
00709   //Cut on number of tracks within the hollow cone.
00710   if (dophotonHCNTrkCut_){
00711     if (pho->nTrkHollowConeDR04() > tightphotonHollowConeNTrkCutEE_){
00712       LoosePhoton = true;
00713       TightPhoton = false;  
00714       return;
00715     }
00716   }
00717   
00718 
00719   //Cut on the sum of tracks within a solid cone
00720   if (dophotonSCTrkIsolationCut_){
00721     double cutvalue = tightphotonSolidConeTrkIsolationSlopeEE_*pho->pt() + tightphotonSolidConeTrkIsolationOffsetEE_;
00722     if (pho->trkSumPtSolidConeDR04() > cutvalue){
00723       LoosePhoton = true;
00724       TightPhoton = false;
00725       return;
00726     }
00727   }
00728 
00729   //Cut on the sum of tracks within a hollow cone
00730   if (dophotonHCTrkIsolationCut_){
00731     double cutvalue = tightphotonHollowConeTrkIsolationSlopeEE_*pho->pt() + tightphotonHollowConeTrkIsolationOffsetEE_;
00732     if (pho->trkSumPtHollowConeDR04() > cutvalue){
00733       LoosePhoton = true;
00734       TightPhoton = false;
00735       return;
00736     }  
00737   }
00738 
00739 
00740   //HadoverEM cut
00741   if (dophotonHadOverEMCut_){
00742     float hadoverE = pho->hadronicOverEm();
00743     if (hadoverE > tightphotonHadOverEMCutEE_){
00744       LoosePhoton = true;
00745       TightPhoton = false;  
00746       return;
00747     }
00748   }
00749 
00750   //eta width
00751 
00752   if (dophotonsigmaeeCut_){
00753    
00754     double sigmaee = pho->sigmaIetaIeta();
00755         
00756     if (sigmaee > tightphotonEtaWidthCutEE_){
00757       LoosePhoton = true;
00758       TightPhoton = false;  
00759       return;
00760     }
00761   }
00762   //R9 cut
00763   if (dophotonR9Cut_){
00764     if (pho->r9() < tightphotonR9CutEE_){
00765       LoosePhoton = true;
00766       TightPhoton = false;  
00767       return;
00768     }
00769   }
00770 
00771   //if you got here, you must have passed all cuts!
00772   TightPhoton = true;   
00773   
00774 }