CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/RecoTauTag/RecoTau/src/AntiElectronIDMVA3.cc

Go to the documentation of this file.
00001 #include <TFile.h>
00002 #include <TMath.h>
00003 #include "RecoTauTag/RecoTau/interface/AntiElectronIDMVA3.h"
00004 #include "RecoTauTag/RecoTau/interface/TMVAZipReader.h"
00005 
00006 AntiElectronIDMVA3::AntiElectronIDMVA3()
00007   : isInitialized_(kFALSE),
00008     methodName_("BDTG")
00009 {
00010   for ( unsigned i = 0; i < 16; ++i ) {
00011     fTMVAReader_[i] = 0;
00012   }
00013 
00014   verbosity_ = 1;
00015 }
00016 
00017 AntiElectronIDMVA3::~AntiElectronIDMVA3()
00018 {
00019   for ( unsigned i = 0; i < 16; ++i ) {
00020     if ( fTMVAReader_[i] ) delete fTMVAReader_[i];
00021   }
00022 }
00023 
00024 enum {  k_NoEleMatchwoGwoGSF_BL,
00025         k_NoEleMatchwoGwGSF_BL,
00026         k_NoEleMatchwGwoGSF_BL,
00027         k_NoEleMatchwGwGSF_BL,
00028         k_woGwoGSF_BL,
00029         k_woGwGSF_BL,
00030         k_wGwoGSF_BL,
00031         k_wGwGSF_BL,
00032         k_NoEleMatchwoGwoGSF_EC,
00033         k_NoEleMatchwoGwGSF_EC,
00034         k_NoEleMatchwGwoGSF_EC,
00035         k_NoEleMatchwGwGSF_EC,
00036         k_woGwoGSF_EC,
00037         k_woGwGSF_EC,
00038         k_wGwoGSF_EC,
00039         k_wGwGSF_EC};
00040 
00041 
00042 void AntiElectronIDMVA3::Initialize_from_file(const std::string& methodName,
00043                                               const std::string& oneProngNoEleMatch0Pi0woGSF_BL,
00044                                               const std::string& oneProngNoEleMatch0Pi0wGSF_BL,
00045                                               const std::string& oneProngNoEleMatch1Pi0woGSF_BL,
00046                                               const std::string& oneProngNoEleMatch1Pi0wGSF_BL,
00047                                               const std::string& oneProng0Pi0woGSF_BL,
00048                                               const std::string& oneProng0Pi0wGSF_BL,
00049                                               const std::string& oneProng1Pi0woGSF_BL,
00050                                               const std::string& oneProng1Pi0wGSF_BL,
00051                                               const std::string& oneProngNoEleMatch0Pi0woGSF_EC,
00052                                               const std::string& oneProngNoEleMatch0Pi0wGSF_EC,
00053                                               const std::string& oneProngNoEleMatch1Pi0woGSF_EC,
00054                                               const std::string& oneProngNoEleMatch1Pi0wGSF_EC,
00055                                               const std::string& oneProng0Pi0woGSF_EC,
00056                                               const std::string& oneProng0Pi0wGSF_EC,
00057                                               const std::string& oneProng1Pi0woGSF_EC,
00058                                               const std::string& oneProng1Pi0wGSF_EC)
00059 {
00060   for ( unsigned i = 0; i < 16; ++i ) {
00061     if ( fTMVAReader_[i] ) delete fTMVAReader_[i];
00062   }
00063 
00064   isInitialized_ = kTRUE;
00065   methodName_    = methodName;
00066 
00067   bookMVAs();
00068 
00069   reco::details::loadTMVAWeights(fTMVAReader_[k_NoEleMatchwoGwoGSF_BL], "BDTG", oneProngNoEleMatch0Pi0woGSF_BL);
00070   reco::details::loadTMVAWeights(fTMVAReader_[k_NoEleMatchwoGwGSF_BL], "BDTG", oneProngNoEleMatch0Pi0wGSF_BL);
00071   reco::details::loadTMVAWeights(fTMVAReader_[k_NoEleMatchwGwoGSF_BL], "BDTG", oneProngNoEleMatch1Pi0woGSF_BL);
00072   reco::details::loadTMVAWeights(fTMVAReader_[k_NoEleMatchwGwGSF_BL], "BDTG", oneProngNoEleMatch1Pi0wGSF_BL);
00073   reco::details::loadTMVAWeights(fTMVAReader_[k_woGwoGSF_BL], "BDTG", oneProng0Pi0woGSF_BL);
00074   reco::details::loadTMVAWeights(fTMVAReader_[k_woGwGSF_BL], "BDTG", oneProng0Pi0wGSF_BL);
00075   reco::details::loadTMVAWeights(fTMVAReader_[k_wGwoGSF_BL], "BDTG", oneProng1Pi0woGSF_BL);
00076   reco::details::loadTMVAWeights(fTMVAReader_[k_wGwGSF_BL], "BDTG", oneProng1Pi0wGSF_BL);
00077   reco::details::loadTMVAWeights(fTMVAReader_[k_NoEleMatchwoGwoGSF_EC], "BDTG", oneProngNoEleMatch0Pi0woGSF_EC);
00078   reco::details::loadTMVAWeights(fTMVAReader_[k_NoEleMatchwoGwGSF_EC], "BDTG", oneProngNoEleMatch0Pi0wGSF_EC);
00079   reco::details::loadTMVAWeights(fTMVAReader_[k_NoEleMatchwGwoGSF_EC], "BDTG", oneProngNoEleMatch1Pi0woGSF_EC);
00080   reco::details::loadTMVAWeights(fTMVAReader_[k_NoEleMatchwGwGSF_EC], "BDTG", oneProngNoEleMatch1Pi0wGSF_EC);
00081   reco::details::loadTMVAWeights(fTMVAReader_[k_woGwoGSF_EC], "BDTG", oneProng0Pi0woGSF_EC);
00082   reco::details::loadTMVAWeights(fTMVAReader_[k_woGwGSF_EC], "BDTG", oneProng0Pi0wGSF_EC);
00083   reco::details::loadTMVAWeights(fTMVAReader_[k_wGwoGSF_EC], "BDTG", oneProng1Pi0woGSF_EC);
00084   reco::details::loadTMVAWeights(fTMVAReader_[k_wGwGSF_EC], "BDTG", oneProng1Pi0wGSF_EC);
00085 
00086 }
00087 
00088 void AntiElectronIDMVA3::Initialize_from_string(const std::string& methodName,
00089                                                 const std::string& oneProngNoEleMatch0Pi0woGSF_BL,
00090                                                 const std::string& oneProngNoEleMatch0Pi0wGSF_BL,
00091                                                 const std::string& oneProngNoEleMatch1Pi0woGSF_BL,
00092                                                 const std::string& oneProngNoEleMatch1Pi0wGSF_BL,
00093                                                 const std::string& oneProng0Pi0woGSF_BL,
00094                                                 const std::string& oneProng0Pi0wGSF_BL,
00095                                                 const std::string& oneProng1Pi0woGSF_BL,
00096                                                 const std::string& oneProng1Pi0wGSF_BL,
00097                                                 const std::string& oneProngNoEleMatch0Pi0woGSF_EC,
00098                                                 const std::string& oneProngNoEleMatch0Pi0wGSF_EC,
00099                                                 const std::string& oneProngNoEleMatch1Pi0woGSF_EC,
00100                                                 const std::string& oneProngNoEleMatch1Pi0wGSF_EC,
00101                                                 const std::string& oneProng0Pi0woGSF_EC,
00102                                                 const std::string& oneProng0Pi0wGSF_EC,
00103                                                 const std::string& oneProng1Pi0woGSF_EC,
00104                                                 const std::string& oneProng1Pi0wGSF_EC)
00105 {
00106   for ( unsigned i = 0; i < 16; ++i ) {
00107     if ( fTMVAReader_[i] ) delete fTMVAReader_[i];
00108   }
00109 
00110   isInitialized_ = kTRUE;
00111   methodName_    = methodName;
00112 
00113   bookMVAs();
00114 
00115   fTMVAReader_[k_NoEleMatchwoGwoGSF_BL]->BookMVA(TMVA::Types::kBDT, oneProngNoEleMatch0Pi0woGSF_BL.data());
00116   fTMVAReader_[k_NoEleMatchwoGwGSF_BL]->BookMVA(TMVA::Types::kBDT, oneProngNoEleMatch0Pi0wGSF_BL.data());
00117   fTMVAReader_[k_NoEleMatchwGwoGSF_BL]->BookMVA(TMVA::Types::kBDT, oneProngNoEleMatch1Pi0woGSF_BL.data());
00118   fTMVAReader_[k_NoEleMatchwGwGSF_BL]->BookMVA(TMVA::Types::kBDT, oneProngNoEleMatch1Pi0wGSF_BL.data());
00119   fTMVAReader_[k_woGwoGSF_BL]->BookMVA(TMVA::Types::kBDT, oneProng0Pi0woGSF_BL.data());
00120   fTMVAReader_[k_woGwGSF_BL]->BookMVA(TMVA::Types::kBDT, oneProng0Pi0wGSF_BL.data());
00121   fTMVAReader_[k_wGwoGSF_BL]->BookMVA(TMVA::Types::kBDT, oneProng1Pi0woGSF_BL.data());
00122   fTMVAReader_[k_wGwGSF_BL]->BookMVA(TMVA::Types::kBDT, oneProng1Pi0wGSF_BL.data());
00123   fTMVAReader_[k_NoEleMatchwoGwoGSF_EC]->BookMVA(TMVA::Types::kBDT, oneProngNoEleMatch0Pi0woGSF_EC.data());
00124   fTMVAReader_[k_NoEleMatchwoGwGSF_EC]->BookMVA(TMVA::Types::kBDT, oneProngNoEleMatch0Pi0wGSF_EC.data());
00125   fTMVAReader_[k_NoEleMatchwGwoGSF_EC]->BookMVA(TMVA::Types::kBDT, oneProngNoEleMatch1Pi0woGSF_EC.data());
00126   fTMVAReader_[k_NoEleMatchwGwGSF_EC]->BookMVA(TMVA::Types::kBDT, oneProngNoEleMatch1Pi0wGSF_EC.data());
00127   fTMVAReader_[k_woGwoGSF_EC]->BookMVA(TMVA::Types::kBDT, oneProng0Pi0woGSF_EC.data());
00128   fTMVAReader_[k_woGwGSF_EC]->BookMVA(TMVA::Types::kBDT, oneProng0Pi0wGSF_EC.data());
00129   fTMVAReader_[k_wGwoGSF_EC]->BookMVA(TMVA::Types::kBDT, oneProng1Pi0woGSF_EC.data());
00130   fTMVAReader_[k_wGwGSF_EC]->BookMVA(TMVA::Types::kBDT, oneProng1Pi0wGSF_EC.data());
00131 
00132 }
00133 
00134 void AntiElectronIDMVA3::bookMVAs()
00135 {
00136 
00137   GammadEta_ = 0.;
00138   GammadPhi_ = 0.;
00139   GammadPt_ = 0.;
00140 
00141   Tau_EtaAtEcalEntrance_ = 0.;
00142   Tau_Pt_ = 0.;
00143   Tau_dCrackEta_ = 0.;
00144   Tau_dCrackPhi_ = 0.;
00145   Tau_EmFraction_ = 0.; 
00146   Tau_NumGammaCands_ = 0.; 
00147   Tau_HadrHoP_ = 0.; 
00148   Tau_HadrEoP_ = 0.; 
00149   Tau_VisMass_ = 0.; 
00150   Tau_HadrMva_ = 0.; 
00151   Tau_GammaEtaMom_ = 0.;
00152   Tau_GammaPhiMom_ = 0.;
00153   Tau_GammaEnFrac_ = 0.;
00154   Tau_GSFChi2_ = 0.; 
00155   Tau_NumHitsVariable_ = 0.; 
00156   Tau_GSFTrackResol_ = 0.;
00157   Tau_GSFTracklnPt_ = 0.;
00158   Tau_GSFTrackEta_ = 0.;
00159 
00160   Elec_EtotOverPin_ = 0.;
00161   Elec_EgammaOverPdif_ = 0.;
00162   Elec_Fbrem_ = 0.;
00163   Elec_Chi2GSF_ = 0.;
00164   Elec_GSFNumHits_ = 0.;
00165   Elec_GSFTrackResol_ = 0.;
00166   Elec_GSFTracklnPt_ = 0.;
00167   Elec_GSFTrackEta_ = 0.;
00168 
00169   //TMVA::Tools::Instance();
00170 
00171   TMVA::Reader *readerNoEleMatchwoGwoGSF_BL = new TMVA::Reader( "!Color:Silent:Error" );
00172   readerNoEleMatchwoGwoGSF_BL->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
00173   readerNoEleMatchwoGwoGSF_BL->AddVariable("Tau_Pt",&Tau_Pt_);
00174   readerNoEleMatchwoGwoGSF_BL->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
00175   readerNoEleMatchwoGwoGSF_BL->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
00176   readerNoEleMatchwoGwoGSF_BL->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
00177   readerNoEleMatchwoGwoGSF_BL->AddVariable("Tau_VisMass",&Tau_VisMass_);
00178   readerNoEleMatchwoGwoGSF_BL->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
00179   readerNoEleMatchwoGwoGSF_BL->AddVariable("Tau_dCrackPhi",&Tau_dCrackPhi_);
00180   readerNoEleMatchwoGwoGSF_BL->SetVerbose(verbosity_);
00181 
00182   TMVA::Reader *readerNoEleMatchwoGwGSF_BL = new TMVA::Reader( "!Color:Silent:Error" );
00183   readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
00184   readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_Pt",&Tau_Pt_);
00185   readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
00186   readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
00187   readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
00188   readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_VisMass",&Tau_VisMass_);
00189   readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_HadrMva",&Tau_HadrMva_);
00190   readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_GSFChi2",&Tau_GSFChi2_);
00191   readerNoEleMatchwoGwGSF_BL->AddVariable("(Tau_GSFNumHits - Tau_KFNumHits)/(Tau_GSFNumHits + Tau_KFNumHits)",&Tau_NumHitsVariable_);
00192   readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_GSFTrackResol",&Tau_GSFTrackResol_);
00193   readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_GSFTracklnPt",&Tau_GSFTracklnPt_);
00194   readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_GSFTrackEta",&Tau_GSFTrackEta_);
00195   readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
00196   readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_dCrackPhi",&Tau_dCrackPhi_);
00197   readerNoEleMatchwoGwGSF_BL->SetVerbose(verbosity_);
00198 
00199   TMVA::Reader *readerNoEleMatchwGwoGSF_BL = new TMVA::Reader( "!Color:Silent:Error" );
00200   readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
00201   readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_Pt",&Tau_Pt_);
00202   readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
00203   readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_NumGammaCands",&Tau_NumGammaCands_);
00204   readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
00205   readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
00206   readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_VisMass",&Tau_VisMass_);
00207   readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_GammaEtaMom",&Tau_GammaEtaMom_);
00208   readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_GammaPhiMom",&Tau_GammaPhiMom_);
00209   readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_GammaEnFrac",&Tau_GammaEnFrac_);
00210   readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
00211   readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_dCrackPhi",&Tau_dCrackPhi_);
00212   readerNoEleMatchwGwoGSF_BL->SetVerbose(verbosity_);
00213 
00214   TMVA::Reader *readerNoEleMatchwGwGSF_BL = new TMVA::Reader( "!Color:Silent:Error" );
00215   readerNoEleMatchwGwGSF_BL->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
00216   readerNoEleMatchwGwGSF_BL->AddVariable("Tau_Pt",&Tau_Pt_);
00217   readerNoEleMatchwGwGSF_BL->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
00218   readerNoEleMatchwGwGSF_BL->AddVariable("Tau_NumGammaCands",&Tau_NumGammaCands_);
00219   readerNoEleMatchwGwGSF_BL->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
00220   readerNoEleMatchwGwGSF_BL->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
00221   readerNoEleMatchwGwGSF_BL->AddVariable("Tau_VisMass",&Tau_VisMass_);
00222   readerNoEleMatchwGwGSF_BL->AddVariable("Tau_HadrMva",&Tau_HadrMva_);
00223   readerNoEleMatchwGwGSF_BL->AddVariable("Tau_GammaEtaMom",&Tau_GammaEtaMom_);
00224   readerNoEleMatchwGwGSF_BL->AddVariable("Tau_GammaPhiMom",&Tau_GammaPhiMom_);
00225   readerNoEleMatchwGwGSF_BL->AddVariable("Tau_GammaEnFrac",&Tau_GammaEnFrac_);
00226   readerNoEleMatchwGwGSF_BL->AddVariable("Tau_GSFChi2",&Tau_GSFChi2_);
00227   readerNoEleMatchwGwGSF_BL->AddVariable("(Tau_GSFNumHits - Tau_KFNumHits)/(Tau_GSFNumHits + Tau_KFNumHits)",&Tau_NumHitsVariable_);
00228   readerNoEleMatchwGwGSF_BL->AddVariable("Tau_GSFTrackResol",&Tau_GSFTrackResol_);
00229   readerNoEleMatchwGwGSF_BL->AddVariable("Tau_GSFTracklnPt",&Tau_GSFTracklnPt_);
00230   readerNoEleMatchwGwGSF_BL->AddVariable("Tau_GSFTrackEta",&Tau_GSFTrackEta_);
00231   readerNoEleMatchwGwGSF_BL->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
00232   readerNoEleMatchwGwGSF_BL->AddVariable("Tau_dCrackPhi",&Tau_dCrackPhi_);
00233   readerNoEleMatchwGwGSF_BL->SetVerbose(verbosity_);
00234 
00235   TMVA::Reader *readerwoGwoGSF_BL = new TMVA::Reader( "!Color:Silent:Error" );
00236   readerwoGwoGSF_BL->AddVariable("Elec_EtotOverPin",&Elec_EtotOverPin_);
00237   readerwoGwoGSF_BL->AddVariable("Elec_EgammaOverPdif",&Elec_EgammaOverPdif_);
00238   readerwoGwoGSF_BL->AddVariable("Elec_Fbrem",&Elec_Fbrem_);
00239   readerwoGwoGSF_BL->AddVariable("Elec_Chi2GSF",&Elec_Chi2GSF_);
00240   readerwoGwoGSF_BL->AddVariable("Elec_GSFNumHits",&Elec_GSFNumHits_);
00241   readerwoGwoGSF_BL->AddVariable("Elec_GSFTrackResol",&Elec_GSFTrackResol_);
00242   readerwoGwoGSF_BL->AddVariable("Elec_GSFTracklnPt",&Elec_GSFTracklnPt_);
00243   readerwoGwoGSF_BL->AddVariable("Elec_GSFTrackEta",&Elec_GSFTrackEta_);
00244   readerwoGwoGSF_BL->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
00245   readerwoGwoGSF_BL->AddVariable("Tau_Pt",&Tau_Pt_);
00246   readerwoGwoGSF_BL->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
00247   readerwoGwoGSF_BL->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
00248   readerwoGwoGSF_BL->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
00249   readerwoGwoGSF_BL->AddVariable("Tau_VisMass",&Tau_VisMass_);
00250   readerwoGwoGSF_BL->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
00251   readerwoGwoGSF_BL->AddVariable("Tau_dCrackPhi",&Tau_dCrackPhi_);
00252   readerwoGwoGSF_BL->SetVerbose(verbosity_);
00253 
00254   TMVA::Reader *readerwoGwGSF_BL = new TMVA::Reader( "!Color:Silent:Error" );
00255   readerwoGwGSF_BL->AddVariable("Elec_EtotOverPin",&Elec_EtotOverPin_);
00256   readerwoGwGSF_BL->AddVariable("Elec_EgammaOverPdif",&Elec_EgammaOverPdif_);
00257   readerwoGwGSF_BL->AddVariable("Elec_Fbrem",&Elec_Fbrem_);
00258   readerwoGwGSF_BL->AddVariable("Elec_Chi2GSF",&Elec_Chi2GSF_);
00259   readerwoGwGSF_BL->AddVariable("Elec_GSFNumHits",&Elec_GSFNumHits_);
00260   readerwoGwGSF_BL->AddVariable("Elec_GSFTrackResol",&Elec_GSFTrackResol_);
00261   readerwoGwGSF_BL->AddVariable("Elec_GSFTracklnPt",&Elec_GSFTracklnPt_);
00262   readerwoGwGSF_BL->AddVariable("Elec_GSFTrackEta",&Elec_GSFTrackEta_);
00263   readerwoGwGSF_BL->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
00264   readerwoGwGSF_BL->AddVariable("Tau_Pt",&Tau_Pt_);
00265   readerwoGwGSF_BL->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
00266   readerwoGwGSF_BL->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
00267   readerwoGwGSF_BL->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
00268   readerwoGwGSF_BL->AddVariable("Tau_VisMass",&Tau_VisMass_);
00269   readerwoGwGSF_BL->AddVariable("Tau_HadrMva",&Tau_HadrMva_);
00270   readerwoGwGSF_BL->AddVariable("Tau_GSFChi2",&Tau_GSFChi2_);
00271   readerwoGwGSF_BL->AddVariable("(Tau_GSFNumHits - Tau_KFNumHits)/(Tau_GSFNumHits + Tau_KFNumHits)",&Tau_NumHitsVariable_);
00272   readerwoGwGSF_BL->AddVariable("Tau_GSFTrackResol",&Tau_GSFTrackResol_);
00273   readerwoGwGSF_BL->AddVariable("Tau_GSFTracklnPt",&Tau_GSFTracklnPt_);
00274   readerwoGwGSF_BL->AddVariable("Tau_GSFTrackEta",&Tau_GSFTrackEta_);
00275   readerwoGwGSF_BL->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
00276   readerwoGwGSF_BL->AddVariable("Tau_dCrackPhi",&Tau_dCrackPhi_);
00277   readerwoGwGSF_BL->SetVerbose(verbosity_);
00278 
00279   TMVA::Reader *readerwGwoGSF_BL = new TMVA::Reader( "!Color:Silent:Error" );
00280   readerwGwoGSF_BL->AddVariable("Elec_EtotOverPin",&Elec_EtotOverPin_);
00281   readerwGwoGSF_BL->AddVariable("Elec_EgammaOverPdif",&Elec_EgammaOverPdif_);
00282   readerwGwoGSF_BL->AddVariable("Elec_Fbrem",&Elec_Fbrem_);
00283   readerwGwoGSF_BL->AddVariable("Elec_Chi2GSF",&Elec_Chi2GSF_);
00284   readerwGwoGSF_BL->AddVariable("Elec_GSFNumHits",&Elec_GSFNumHits_);
00285   readerwGwoGSF_BL->AddVariable("Elec_GSFTrackResol",&Elec_GSFTrackResol_);
00286   readerwGwoGSF_BL->AddVariable("Elec_GSFTracklnPt",&Elec_GSFTracklnPt_);
00287   readerwGwoGSF_BL->AddVariable("Elec_GSFTrackEta",&Elec_GSFTrackEta_);
00288   readerwGwoGSF_BL->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
00289   readerwGwoGSF_BL->AddVariable("Tau_Pt",&Tau_Pt_);
00290   readerwGwoGSF_BL->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
00291   readerwGwoGSF_BL->AddVariable("Tau_NumGammaCands",&Tau_NumGammaCands_);
00292   readerwGwoGSF_BL->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
00293   readerwGwoGSF_BL->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
00294   readerwGwoGSF_BL->AddVariable("Tau_VisMass",&Tau_VisMass_);
00295   readerwGwoGSF_BL->AddVariable("Tau_GammaEtaMom",&Tau_GammaEtaMom_);
00296   readerwGwoGSF_BL->AddVariable("Tau_GammaPhiMom",&Tau_GammaPhiMom_);
00297   readerwGwoGSF_BL->AddVariable("Tau_GammaEnFrac",&Tau_GammaEnFrac_);
00298   readerwGwoGSF_BL->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
00299   readerwGwoGSF_BL->AddVariable("Tau_dCrackPhi",&Tau_dCrackPhi_);
00300   readerwGwoGSF_BL->SetVerbose(verbosity_);
00301 
00302   TMVA::Reader *readerwGwGSF_BL = new TMVA::Reader( "!Color:Silent:Error" );
00303   readerwGwGSF_BL->AddVariable("Elec_EtotOverPin",&Elec_EtotOverPin_);
00304   readerwGwGSF_BL->AddVariable("Elec_EgammaOverPdif",&Elec_EgammaOverPdif_);
00305   readerwGwGSF_BL->AddVariable("Elec_Fbrem",&Elec_Fbrem_);
00306   readerwGwGSF_BL->AddVariable("Elec_Chi2GSF",&Elec_Chi2GSF_);
00307   readerwGwGSF_BL->AddVariable("Elec_GSFNumHits",&Elec_GSFNumHits_);
00308   readerwGwGSF_BL->AddVariable("Elec_GSFTrackResol",&Elec_GSFTrackResol_);
00309   readerwGwGSF_BL->AddVariable("Elec_GSFTracklnPt",&Elec_GSFTracklnPt_);
00310   readerwGwGSF_BL->AddVariable("Elec_GSFTrackEta",&Elec_GSFTrackEta_);
00311   readerwGwGSF_BL->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
00312   readerwGwGSF_BL->AddVariable("Tau_Pt",&Tau_Pt_);
00313   readerwGwGSF_BL->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
00314   readerwGwGSF_BL->AddVariable("Tau_NumGammaCands",&Tau_NumGammaCands_);
00315   readerwGwGSF_BL->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
00316   readerwGwGSF_BL->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
00317   readerwGwGSF_BL->AddVariable("Tau_VisMass",&Tau_VisMass_);
00318   readerwGwGSF_BL->AddVariable("Tau_HadrMva",&Tau_HadrMva_);
00319   readerwGwGSF_BL->AddVariable("Tau_GammaEtaMom",&Tau_GammaEtaMom_);
00320   readerwGwGSF_BL->AddVariable("Tau_GammaPhiMom",&Tau_GammaPhiMom_);
00321   readerwGwGSF_BL->AddVariable("Tau_GammaEnFrac",&Tau_GammaEnFrac_);
00322   readerwGwGSF_BL->AddVariable("Tau_GSFChi2",&Tau_GSFChi2_);
00323   readerwGwGSF_BL->AddVariable("(Tau_GSFNumHits - Tau_KFNumHits)/(Tau_GSFNumHits + Tau_KFNumHits)",&Tau_NumHitsVariable_);
00324   readerwGwGSF_BL->AddVariable("Tau_GSFTrackResol",&Tau_GSFTrackResol_);
00325   readerwGwGSF_BL->AddVariable("Tau_GSFTracklnPt",&Tau_GSFTracklnPt_);
00326   readerwGwGSF_BL->AddVariable("Tau_GSFTrackEta",&Tau_GSFTrackEta_);
00327   readerwGwGSF_BL->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
00328   readerwGwGSF_BL->AddVariable("Tau_dCrackPhi",&Tau_dCrackPhi_);
00329   readerwGwGSF_BL->SetVerbose(verbosity_);
00330 
00332 
00333   TMVA::Reader *readerNoEleMatchwoGwoGSF_EC = new TMVA::Reader( "!Color:Silent:Error" );
00334   readerNoEleMatchwoGwoGSF_EC->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
00335   readerNoEleMatchwoGwoGSF_EC->AddVariable("Tau_Pt",&Tau_Pt_);
00336   readerNoEleMatchwoGwoGSF_EC->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
00337   readerNoEleMatchwoGwoGSF_EC->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
00338   readerNoEleMatchwoGwoGSF_EC->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
00339   readerNoEleMatchwoGwoGSF_EC->AddVariable("Tau_VisMass",&Tau_VisMass_);
00340   readerNoEleMatchwoGwoGSF_EC->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
00341   readerNoEleMatchwoGwoGSF_EC->SetVerbose(verbosity_);
00342 
00343   TMVA::Reader *readerNoEleMatchwoGwGSF_EC = new TMVA::Reader( "!Color:Silent:Error" );
00344   readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
00345   readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_Pt",&Tau_Pt_);
00346   readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
00347   readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
00348   readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
00349   readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_VisMass",&Tau_VisMass_);
00350   readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_HadrMva",&Tau_HadrMva_);
00351   readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_GSFChi2",&Tau_GSFChi2_);
00352   readerNoEleMatchwoGwGSF_EC->AddVariable("(Tau_GSFNumHits - Tau_KFNumHits)/(Tau_GSFNumHits + Tau_KFNumHits)",&Tau_NumHitsVariable_);
00353   readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_GSFTrackResol",&Tau_GSFTrackResol_);
00354   readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_GSFTracklnPt",&Tau_GSFTracklnPt_);
00355   readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_GSFTrackEta",&Tau_GSFTrackEta_);
00356   readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
00357   readerNoEleMatchwoGwGSF_EC->SetVerbose(verbosity_);
00358 
00359   TMVA::Reader *readerNoEleMatchwGwoGSF_EC = new TMVA::Reader( "!Color:Silent:Error" );
00360   readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
00361   readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_Pt",&Tau_Pt_);
00362   readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
00363   readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_NumGammaCands",&Tau_NumGammaCands_);
00364   readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
00365   readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
00366   readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_VisMass",&Tau_VisMass_);
00367   readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_GammaEtaMom",&Tau_GammaEtaMom_);
00368   readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_GammaPhiMom",&Tau_GammaPhiMom_);
00369   readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_GammaEnFrac",&Tau_GammaEnFrac_);
00370   readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
00371   readerNoEleMatchwGwoGSF_EC->SetVerbose(verbosity_);
00372 
00373   TMVA::Reader *readerNoEleMatchwGwGSF_EC = new TMVA::Reader( "!Color:Silent:Error" );
00374   readerNoEleMatchwGwGSF_EC->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
00375   readerNoEleMatchwGwGSF_EC->AddVariable("Tau_Pt",&Tau_Pt_);
00376   readerNoEleMatchwGwGSF_EC->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
00377   readerNoEleMatchwGwGSF_EC->AddVariable("Tau_NumGammaCands",&Tau_NumGammaCands_);
00378   readerNoEleMatchwGwGSF_EC->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
00379   readerNoEleMatchwGwGSF_EC->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
00380   readerNoEleMatchwGwGSF_EC->AddVariable("Tau_VisMass",&Tau_VisMass_);
00381   readerNoEleMatchwGwGSF_EC->AddVariable("Tau_HadrMva",&Tau_HadrMva_);
00382   readerNoEleMatchwGwGSF_EC->AddVariable("Tau_GammaEtaMom",&Tau_GammaEtaMom_);
00383   readerNoEleMatchwGwGSF_EC->AddVariable("Tau_GammaPhiMom",&Tau_GammaPhiMom_);
00384   readerNoEleMatchwGwGSF_EC->AddVariable("Tau_GammaEnFrac",&Tau_GammaEnFrac_);
00385   readerNoEleMatchwGwGSF_EC->AddVariable("Tau_GSFChi2",&Tau_GSFChi2_);
00386   readerNoEleMatchwGwGSF_EC->AddVariable("(Tau_GSFNumHits - Tau_KFNumHits)/(Tau_GSFNumHits + Tau_KFNumHits)",&Tau_NumHitsVariable_);
00387   readerNoEleMatchwGwGSF_EC->AddVariable("Tau_GSFTrackResol",&Tau_GSFTrackResol_);
00388   readerNoEleMatchwGwGSF_EC->AddVariable("Tau_GSFTracklnPt",&Tau_GSFTracklnPt_);
00389   readerNoEleMatchwGwGSF_EC->AddVariable("Tau_GSFTrackEta",&Tau_GSFTrackEta_);
00390   readerNoEleMatchwGwGSF_EC->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
00391   readerNoEleMatchwGwGSF_EC->SetVerbose(verbosity_);
00392 
00393   TMVA::Reader *readerwoGwoGSF_EC = new TMVA::Reader( "!Color:Silent:Error" );
00394   readerwoGwoGSF_EC->AddVariable("Elec_EtotOverPin",&Elec_EtotOverPin_);
00395   readerwoGwoGSF_EC->AddVariable("Elec_EgammaOverPdif",&Elec_EgammaOverPdif_);
00396   readerwoGwoGSF_EC->AddVariable("Elec_Fbrem",&Elec_Fbrem_);
00397   readerwoGwoGSF_EC->AddVariable("Elec_Chi2GSF",&Elec_Chi2GSF_);
00398   readerwoGwoGSF_EC->AddVariable("Elec_GSFNumHits",&Elec_GSFNumHits_);
00399   readerwoGwoGSF_EC->AddVariable("Elec_GSFTrackResol",&Elec_GSFTrackResol_);
00400   readerwoGwoGSF_EC->AddVariable("Elec_GSFTracklnPt",&Elec_GSFTracklnPt_);
00401   readerwoGwoGSF_EC->AddVariable("Elec_GSFTrackEta",&Elec_GSFTrackEta_);
00402   readerwoGwoGSF_EC->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
00403   readerwoGwoGSF_EC->AddVariable("Tau_Pt",&Tau_Pt_);
00404   readerwoGwoGSF_EC->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
00405   readerwoGwoGSF_EC->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
00406   readerwoGwoGSF_EC->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
00407   readerwoGwoGSF_EC->AddVariable("Tau_VisMass",&Tau_VisMass_);
00408   readerwoGwoGSF_EC->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
00409   readerwoGwoGSF_EC->SetVerbose(verbosity_);
00410 
00411   TMVA::Reader *readerwoGwGSF_EC = new TMVA::Reader( "!Color:Silent:Error" );
00412   readerwoGwGSF_EC->AddVariable("Elec_EtotOverPin",&Elec_EtotOverPin_);
00413   readerwoGwGSF_EC->AddVariable("Elec_EgammaOverPdif",&Elec_EgammaOverPdif_);
00414   readerwoGwGSF_EC->AddVariable("Elec_Fbrem",&Elec_Fbrem_);
00415   readerwoGwGSF_EC->AddVariable("Elec_Chi2GSF",&Elec_Chi2GSF_);
00416   readerwoGwGSF_EC->AddVariable("Elec_GSFNumHits",&Elec_GSFNumHits_);
00417   readerwoGwGSF_EC->AddVariable("Elec_GSFTrackResol",&Elec_GSFTrackResol_);
00418   readerwoGwGSF_EC->AddVariable("Elec_GSFTracklnPt",&Elec_GSFTracklnPt_);
00419   readerwoGwGSF_EC->AddVariable("Elec_GSFTrackEta",&Elec_GSFTrackEta_);
00420   readerwoGwGSF_EC->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
00421   readerwoGwGSF_EC->AddVariable("Tau_Pt",&Tau_Pt_);
00422   readerwoGwGSF_EC->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
00423   readerwoGwGSF_EC->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
00424   readerwoGwGSF_EC->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
00425   readerwoGwGSF_EC->AddVariable("Tau_VisMass",&Tau_VisMass_);
00426   readerwoGwGSF_EC->AddVariable("Tau_HadrMva",&Tau_HadrMva_);
00427   readerwoGwGSF_EC->AddVariable("Tau_GSFChi2",&Tau_GSFChi2_);
00428   readerwoGwGSF_EC->AddVariable("(Tau_GSFNumHits - Tau_KFNumHits)/(Tau_GSFNumHits + Tau_KFNumHits)",&Tau_NumHitsVariable_);
00429   readerwoGwGSF_EC->AddVariable("Tau_GSFTrackResol",&Tau_GSFTrackResol_);
00430   readerwoGwGSF_EC->AddVariable("Tau_GSFTracklnPt",&Tau_GSFTracklnPt_);
00431   readerwoGwGSF_EC->AddVariable("Tau_GSFTrackEta",&Tau_GSFTrackEta_);
00432   readerwoGwGSF_EC->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
00433   readerwoGwGSF_EC->SetVerbose(verbosity_);
00434 
00435   TMVA::Reader *readerwGwoGSF_EC = new TMVA::Reader( "!Color:Silent:Error" );
00436   readerwGwoGSF_EC->AddVariable("Elec_EtotOverPin",&Elec_EtotOverPin_);
00437   readerwGwoGSF_EC->AddVariable("Elec_EgammaOverPdif",&Elec_EgammaOverPdif_);
00438   readerwGwoGSF_EC->AddVariable("Elec_Fbrem",&Elec_Fbrem_);
00439   readerwGwoGSF_EC->AddVariable("Elec_Chi2GSF",&Elec_Chi2GSF_);
00440   readerwGwoGSF_EC->AddVariable("Elec_GSFNumHits",&Elec_GSFNumHits_);
00441   readerwGwoGSF_EC->AddVariable("Elec_GSFTrackResol",&Elec_GSFTrackResol_);
00442   readerwGwoGSF_EC->AddVariable("Elec_GSFTracklnPt",&Elec_GSFTracklnPt_);
00443   readerwGwoGSF_EC->AddVariable("Elec_GSFTrackEta",&Elec_GSFTrackEta_);
00444   readerwGwoGSF_EC->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
00445   readerwGwoGSF_EC->AddVariable("Tau_Pt",&Tau_Pt_);
00446   readerwGwoGSF_EC->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
00447   readerwGwoGSF_EC->AddVariable("Tau_NumGammaCands",&Tau_NumGammaCands_);
00448   readerwGwoGSF_EC->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
00449   readerwGwoGSF_EC->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
00450   readerwGwoGSF_EC->AddVariable("Tau_VisMass",&Tau_VisMass_);
00451   readerwGwoGSF_EC->AddVariable("Tau_GammaEtaMom",&Tau_GammaEtaMom_);
00452   readerwGwoGSF_EC->AddVariable("Tau_GammaPhiMom",&Tau_GammaPhiMom_);
00453   readerwGwoGSF_EC->AddVariable("Tau_GammaEnFrac",&Tau_GammaEnFrac_);
00454   readerwGwoGSF_EC->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
00455   readerwGwoGSF_EC->SetVerbose(verbosity_);
00456 
00457   TMVA::Reader *readerwGwGSF_EC = new TMVA::Reader( "!Color:Silent:Error" );
00458   readerwGwGSF_EC->AddVariable("Elec_EtotOverPin",&Elec_EtotOverPin_);
00459   readerwGwGSF_EC->AddVariable("Elec_EgammaOverPdif",&Elec_EgammaOverPdif_);
00460   readerwGwGSF_EC->AddVariable("Elec_Fbrem",&Elec_Fbrem_);
00461   readerwGwGSF_EC->AddVariable("Elec_Chi2GSF",&Elec_Chi2GSF_);
00462   readerwGwGSF_EC->AddVariable("Elec_GSFNumHits",&Elec_GSFNumHits_);
00463   readerwGwGSF_EC->AddVariable("Elec_GSFTrackResol",&Elec_GSFTrackResol_);
00464   readerwGwGSF_EC->AddVariable("Elec_GSFTracklnPt",&Elec_GSFTracklnPt_);
00465   readerwGwGSF_EC->AddVariable("Elec_GSFTrackEta",&Elec_GSFTrackEta_);
00466   readerwGwGSF_EC->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
00467   readerwGwGSF_EC->AddVariable("Tau_Pt",&Tau_Pt_);
00468   readerwGwGSF_EC->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
00469   readerwGwGSF_EC->AddVariable("Tau_NumGammaCands",&Tau_NumGammaCands_);
00470   readerwGwGSF_EC->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
00471   readerwGwGSF_EC->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
00472   readerwGwGSF_EC->AddVariable("Tau_VisMass",&Tau_VisMass_);
00473   readerwGwGSF_EC->AddVariable("Tau_HadrMva",&Tau_HadrMva_);
00474   readerwGwGSF_EC->AddVariable("Tau_GammaEtaMom",&Tau_GammaEtaMom_);
00475   readerwGwGSF_EC->AddVariable("Tau_GammaPhiMom",&Tau_GammaPhiMom_);
00476   readerwGwGSF_EC->AddVariable("Tau_GammaEnFrac",&Tau_GammaEnFrac_);
00477   readerwGwGSF_EC->AddVariable("Tau_GSFChi2",&Tau_GSFChi2_);
00478   readerwGwGSF_EC->AddVariable("(Tau_GSFNumHits - Tau_KFNumHits)/(Tau_GSFNumHits + Tau_KFNumHits)",&Tau_NumHitsVariable_);
00479   readerwGwGSF_EC->AddVariable("Tau_GSFTrackResol",&Tau_GSFTrackResol_);
00480   readerwGwGSF_EC->AddVariable("Tau_GSFTracklnPt",&Tau_GSFTracklnPt_);
00481   readerwGwGSF_EC->AddVariable("Tau_GSFTrackEta",&Tau_GSFTrackEta_);
00482   readerwGwGSF_EC->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
00483   readerwGwGSF_EC->SetVerbose(verbosity_);
00484 
00485   fTMVAReader_[k_NoEleMatchwoGwoGSF_BL] = readerNoEleMatchwoGwoGSF_BL;
00486   fTMVAReader_[k_NoEleMatchwoGwGSF_BL] = readerNoEleMatchwoGwGSF_BL;
00487   fTMVAReader_[k_NoEleMatchwGwoGSF_BL] = readerNoEleMatchwGwoGSF_BL;
00488   fTMVAReader_[k_NoEleMatchwGwGSF_BL] = readerNoEleMatchwGwGSF_BL;
00489   fTMVAReader_[k_woGwoGSF_BL] = readerwoGwoGSF_BL;
00490   fTMVAReader_[k_woGwGSF_BL] = readerwoGwGSF_BL;
00491   fTMVAReader_[k_wGwoGSF_BL] = readerwGwoGSF_BL;
00492   fTMVAReader_[k_wGwGSF_BL] = readerwGwGSF_BL;
00493   fTMVAReader_[k_NoEleMatchwoGwoGSF_EC] = readerNoEleMatchwoGwoGSF_EC;
00494   fTMVAReader_[k_NoEleMatchwoGwGSF_EC] = readerNoEleMatchwoGwGSF_EC;
00495   fTMVAReader_[k_NoEleMatchwGwoGSF_EC] = readerNoEleMatchwGwoGSF_EC;
00496   fTMVAReader_[k_NoEleMatchwGwGSF_EC] = readerNoEleMatchwGwGSF_EC;
00497   fTMVAReader_[k_woGwoGSF_EC] = readerwoGwoGSF_EC;
00498   fTMVAReader_[k_woGwGSF_EC] = readerwoGwGSF_EC;
00499   fTMVAReader_[k_wGwoGSF_EC] = readerwGwoGSF_EC;
00500   fTMVAReader_[k_wGwGSF_EC] = readerwGwGSF_EC;
00501 
00502 }
00503 
00504 double AntiElectronIDMVA3::MVAValue(Float_t TauEtaAtEcalEntrance,
00505                                     Float_t TauPt,
00506                                     Float_t TaudCrackEta,
00507                                     Float_t TaudCrackPhi,
00508                                     Float_t TauEmFraction,
00509                                     Float_t TauSignalPFGammaCands,
00510                                     Float_t TauLeadPFChargedHadrHoP,
00511                                     Float_t TauLeadPFChargedHadrEoP,
00512                                     Float_t TauVisMass,
00513                                     Float_t TauHadrMva,
00514                                     const std::vector<Float_t>& GammasdEta,
00515                                     const std::vector<Float_t>& GammasdPhi,
00516                                     const std::vector<Float_t>& GammasPt,
00517                                     Float_t TauKFNumHits,
00518                                     Float_t TauGSFNumHits,
00519                                     Float_t TauGSFChi2,
00520                                     Float_t TauGSFTrackResol,
00521                                     Float_t TauGSFTracklnPt,
00522                                     Float_t TauGSFTrackEta,
00523                                     Float_t TauPhi,
00524                                     Float_t TauSignalPFChargedCands,
00525                                     Float_t TauHasGsf,
00526                                     Float_t ElecEta,
00527                                     Float_t ElecPhi,
00528                                     Float_t ElecPt,
00529                                     Float_t ElecEe,
00530                                     Float_t ElecEgamma,
00531                                     Float_t ElecPin,
00532                                     Float_t ElecPout,
00533                                     Float_t ElecFbrem,
00534                                     Float_t ElecChi2GSF,
00535                                     Float_t ElecGSFNumHits,
00536                                     Float_t ElecGSFTrackResol,
00537                                     Float_t ElecGSFTracklnPt,
00538                                     Float_t ElecGSFTrackEta)
00539 {
00540   double sumPt  = 0.;
00541   double dEta   = 0.;
00542   double dEta2  = 0.;
00543   double dPhi   = 0.;
00544   double dPhi2  = 0.;
00545   double sumPt2 = 0.;
00546   for ( unsigned int i = 0 ; i < GammasPt.size() ; ++i ) {
00547     double pt_i  = GammasPt[i];
00548     double phi_i = GammasdPhi[i];
00549     if ( GammasdPhi[i] > TMath::Pi() ) phi_i = GammasdPhi[i] - 2*TMath::Pi();
00550     else if ( GammasdPhi[i] < -TMath::Pi() ) phi_i = GammasdPhi[i] + 2*TMath::Pi();
00551     double eta_i = GammasdEta[i];
00552     sumPt  +=  pt_i;
00553     sumPt2 += (pt_i*pt_i);
00554     dEta   += (pt_i*eta_i);
00555     dEta2  += (pt_i*eta_i*eta_i);
00556     dPhi   += (pt_i*phi_i);
00557     dPhi2  += (pt_i*phi_i*phi_i);
00558   }
00559 
00560   Float_t TauGammaEnFrac = sumPt/TauPt;
00561 
00562   if ( sumPt > 0. ) {
00563     dEta  /= sumPt;
00564     dPhi  /= sumPt;
00565     dEta2 /= sumPt;
00566     dPhi2 /= sumPt;
00567   }
00568 
00569   Float_t TauGammaEtaMom = TMath::Sqrt(dEta2)*TMath::Sqrt(TauGammaEnFrac)*TauPt;
00570   Float_t TauGammaPhiMom = TMath::Sqrt(dPhi2)*TMath::Sqrt(TauGammaEnFrac)*TauPt;
00571 
00572   return MVAValue(TauEtaAtEcalEntrance,
00573                   TauPt,
00574                   TaudCrackEta,
00575                   TaudCrackPhi,
00576                   TauEmFraction,
00577                   TauSignalPFGammaCands,
00578                   TauLeadPFChargedHadrHoP,
00579                   TauLeadPFChargedHadrEoP,
00580                   TauVisMass,
00581                   TauHadrMva,
00582                   TauGammaEtaMom,
00583                   TauGammaPhiMom,
00584                   TauGammaEnFrac,
00585                   TauKFNumHits,
00586                   TauGSFNumHits,
00587                   TauGSFChi2,
00588                   TauGSFTrackResol,
00589                   TauGSFTracklnPt,
00590                   TauGSFTrackEta,
00591                   TauPhi,
00592                   TauSignalPFChargedCands,
00593                   TauHasGsf,
00594                   ElecEta,
00595                   ElecPhi,
00596                   ElecPt,
00597                   ElecEe,
00598                   ElecEgamma,
00599                   ElecPin,
00600                   ElecPout,
00601                   ElecFbrem,
00602                   ElecChi2GSF,
00603                   ElecGSFNumHits,
00604                   ElecGSFTrackResol,
00605                   ElecGSFTracklnPt,
00606                   ElecGSFTrackEta);
00607 }
00608 
00609 double AntiElectronIDMVA3::MVAValue(Float_t TauEtaAtEcalEntrance,
00610                                     Float_t TauPt,
00611                                     Float_t TaudCrackEta,
00612                                     Float_t TaudCrackPhi,
00613                                     Float_t TauEmFraction,
00614                                     Float_t TauSignalPFGammaCands,
00615                                     Float_t TauLeadPFChargedHadrHoP,
00616                                     Float_t TauLeadPFChargedHadrEoP,
00617                                     Float_t TauVisMass,
00618                                     Float_t TauHadrMva,
00619                                     Float_t TauGammaEtaMom,
00620                                     Float_t TauGammaPhiMom,
00621                                     Float_t TauGammaEnFrac,
00622                                     Float_t TauKFNumHits,
00623                                     Float_t TauGSFNumHits,
00624                                     Float_t TauGSFChi2,
00625                                     Float_t TauGSFTrackResol,
00626                                     Float_t TauGSFTracklnPt,
00627                                     Float_t TauGSFTrackEta,
00628                                     Float_t TauPhi,
00629                                     Float_t TauSignalPFChargedCands,
00630                                     Float_t TauHasGsf,
00631                                     Float_t ElecEta,
00632                                     Float_t ElecPhi,
00633                                     Float_t ElecPt,
00634                                     Float_t ElecEe,
00635                                     Float_t ElecEgamma,
00636                                     Float_t ElecPin,
00637                                     Float_t ElecPout,
00638                                     Float_t ElecFbrem,
00639                                     Float_t ElecChi2GSF,
00640                                     Float_t ElecGSFNumHits,
00641                                     Float_t ElecGSFTrackResol,
00642                                     Float_t ElecGSFTracklnPt,
00643                                     Float_t ElecGSFTrackEta)
00644 {
00645 
00646   if ( !isInitialized_ ) {
00647     //std::cout << "Error: AntiElectronMVA not properly initialized.\n";
00648     return -99.;
00649   }
00650 
00651   Tau_EtaAtEcalEntrance_ = TauEtaAtEcalEntrance;
00652   Tau_Pt_ = TauPt;
00653   Tau_dCrackEta_ = TaudCrackEta;
00654   Tau_dCrackPhi_ = TaudCrackPhi;
00655   Tau_EmFraction_ = TMath::Max(TauEmFraction,float(0.0));
00656   Tau_NumGammaCands_ = TauSignalPFGammaCands;
00657   Tau_HadrHoP_ = TauLeadPFChargedHadrHoP;
00658   Tau_HadrEoP_ = TauLeadPFChargedHadrEoP;
00659   Tau_VisMass_ = TauVisMass;
00660   Tau_HadrMva_ = TauHadrMva;
00661   Tau_GammaEtaMom_ = TauGammaEtaMom;
00662   Tau_GammaPhiMom_ = TauGammaPhiMom;
00663   Tau_GammaEnFrac_ = TauGammaEnFrac;
00664   Tau_GSFChi2_ = TauGSFChi2;
00665   Tau_NumHitsVariable_ = (TauGSFNumHits-TauKFNumHits)/(TauGSFNumHits+TauKFNumHits);
00666   Tau_GSFTrackResol_ = TauGSFTrackResol;
00667   Tau_GSFTracklnPt_ = TauGSFTracklnPt;
00668   Tau_GSFTrackEta_ = TauGSFTrackEta;
00669 
00670   Elec_EtotOverPin_ = (ElecEe + ElecEgamma)/ElecPin;
00671   Elec_EgammaOverPdif_ = ElecEgamma/(ElecPin - ElecPout);
00672   Elec_Fbrem_ = ElecFbrem;
00673   Elec_Chi2GSF_ = ElecChi2GSF;
00674   Elec_GSFNumHits_ = ElecGSFNumHits;
00675   Elec_GSFTrackResol_ = ElecGSFTrackResol;
00676   Elec_GSFTracklnPt_ = ElecGSFTracklnPt;
00677   Elec_GSFTrackEta_ = ElecGSFTrackEta;
00678 
00679   double mva = -99.;
00680   if ( TauSignalPFChargedCands == 3 ) mva = 1.0;
00681   else if ( deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 &&  TauSignalPFGammaCands == 0 && TauHasGsf < 0.5) {
00682     if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_NoEleMatchwoGwoGSF_BL]->EvaluateMVA(methodName_);
00683     else mva = fTMVAReader_[k_NoEleMatchwoGwoGSF_EC]->EvaluateMVA(methodName_);
00684   }
00685   else if ( deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 &&  TauSignalPFGammaCands == 0 && TauHasGsf > 0.5) {
00686     if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_NoEleMatchwoGwGSF_BL]->EvaluateMVA(methodName_);
00687     else mva = fTMVAReader_[k_NoEleMatchwoGwGSF_EC]->EvaluateMVA(methodName_);
00688   }
00689   else if ( deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 &&  TauSignalPFGammaCands > 0 && TauHasGsf < 0.5) {
00690     if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_NoEleMatchwGwoGSF_BL]->EvaluateMVA(methodName_);
00691     else mva = fTMVAReader_[k_NoEleMatchwGwoGSF_EC]->EvaluateMVA(methodName_);
00692   }
00693   else if ( deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 &&  TauSignalPFGammaCands > 0 && TauHasGsf > 0.5) {
00694     if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_NoEleMatchwGwGSF_BL]->EvaluateMVA(methodName_);
00695     else mva = fTMVAReader_[k_NoEleMatchwGwGSF_EC]->EvaluateMVA(methodName_);
00696   }
00697   else if ( TauSignalPFGammaCands == 0 && TauHasGsf < 0.5) {
00698     if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_woGwoGSF_BL]->EvaluateMVA(methodName_);
00699     else mva = fTMVAReader_[k_woGwoGSF_EC]->EvaluateMVA(methodName_);
00700   }
00701   else if ( TauSignalPFGammaCands == 0 && TauHasGsf > 0.5) {
00702     if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_woGwGSF_BL]->EvaluateMVA(methodName_);
00703     else mva = fTMVAReader_[k_woGwGSF_EC]->EvaluateMVA(methodName_);
00704   }
00705   else if ( TauSignalPFGammaCands > 0 && TauHasGsf < 0.5) {
00706     if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_wGwoGSF_BL]->EvaluateMVA(methodName_);
00707     else mva = fTMVAReader_[k_wGwoGSF_EC]->EvaluateMVA(methodName_);
00708   }
00709   else if ( TauSignalPFGammaCands > 0 && TauHasGsf > 0.5) {
00710     if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_wGwGSF_BL]->EvaluateMVA(methodName_);
00711     else mva = fTMVAReader_[k_wGwGSF_EC]->EvaluateMVA(methodName_);
00712   }
00713   return mva;
00714 }
00715 
00716 
00717 double AntiElectronIDMVA3::MVAValue(const reco::PFTau& thePFTau,
00718                                     const reco::GsfElectron& theGsfEle)
00719 
00720 {
00721   Float_t TauEtaAtEcalEntrance = -99.;
00722   float sumEtaTimesEnergy = 0;
00723   float sumEnergy = 0;
00724   for(unsigned int j = 0 ; j < (thePFTau.signalPFCands()).size() ; j++){
00725     reco::PFCandidateRef pfcandidate = (thePFTau.signalPFCands()).at(j);
00726     sumEtaTimesEnergy += pfcandidate->positionAtECALEntrance().eta()*pfcandidate->energy();
00727     sumEnergy += pfcandidate->energy();
00728   }
00729   if(sumEnergy>0)TauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
00730 
00731   Float_t TauPt = thePFTau.pt();
00732   Float_t TauEmFraction = TMath::Max(thePFTau.emFraction(), (Float_t)0.);
00733   Float_t TauSignalPFGammaCands = thePFTau.signalPFGammaCands().size();
00734   Float_t TauLeadPFChargedHadrHoP = 0.;
00735   Float_t TauLeadPFChargedHadrEoP = 0.;
00736   if ( thePFTau.leadPFChargedHadrCand()->p() > 0. ) {
00737     TauLeadPFChargedHadrHoP = thePFTau.leadPFChargedHadrCand()->hcalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
00738     TauLeadPFChargedHadrEoP = thePFTau.leadPFChargedHadrCand()->ecalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
00739   }
00740   Float_t TauVisMass = thePFTau.mass();
00741   Float_t TauHadrMva = TMath::Max(thePFTau.electronPreIDOutput(),float(-1.0));
00742   std::vector<Float_t> GammasdEta;
00743   std::vector<Float_t> GammasdPhi;
00744   std::vector<Float_t> GammasPt;
00745   for ( unsigned i = 0 ; i < thePFTau.signalPFGammaCands().size(); ++i ) {
00746     reco::PFCandidateRef gamma = thePFTau.signalPFGammaCands().at(i);
00747     if ( thePFTau.leadPFChargedHadrCand().isNonnull() ) {
00748       GammasdEta.push_back(gamma->eta() - thePFTau.leadPFChargedHadrCand()->eta());
00749       GammasdPhi.push_back(gamma->phi() - thePFTau.leadPFChargedHadrCand()->phi());
00750     } else {
00751       GammasdEta.push_back(gamma->eta() - thePFTau.eta());
00752       GammasdPhi.push_back(gamma->phi() - thePFTau.phi());
00753     }
00754     GammasPt.push_back(gamma->pt());
00755   }
00756   Float_t TauKFNumHits = -99.;
00757   if((thePFTau.leadPFChargedHadrCand()->trackRef()).isNonnull()){
00758     TauKFNumHits = thePFTau.leadPFChargedHadrCand()->trackRef()->numberOfValidHits();
00759   }
00760   Float_t TauGSFNumHits = -99.;
00761   Float_t TauGSFChi2 = -99.;
00762   Float_t TauGSFTrackResol = -99.;
00763   Float_t TauGSFTracklnPt = -99.;
00764   Float_t TauGSFTrackEta = -99.;
00765   if((thePFTau.leadPFChargedHadrCand()->gsfTrackRef()).isNonnull()){
00766       TauGSFChi2 = thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->normalizedChi2();
00767       TauGSFNumHits = thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->numberOfValidHits();
00768       if ( thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->pt() > 0. ) {
00769         TauGSFTrackResol = thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->ptError()/thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->pt();
00770         TauGSFTracklnPt = log(thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->pt())*TMath::Ln10();
00771       }
00772       TauGSFTrackEta = thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->eta();
00773   }
00774   Float_t TauPhi = thePFTau.phi();
00775   float sumPhiTimesEnergy = 0;
00776   float sumEnergyPhi = 0;
00777   for(unsigned int j = 0 ; j < (thePFTau.signalPFCands()).size() ; j++){
00778     reco::PFCandidateRef pfcandidate = (thePFTau.signalPFCands()).at(j);
00779     sumPhiTimesEnergy += pfcandidate->positionAtECALEntrance().phi()*pfcandidate->energy();
00780     sumEnergyPhi += pfcandidate->energy();
00781   }
00782   if(sumEnergy>0)TauPhi = sumPhiTimesEnergy/sumEnergyPhi;
00783   Float_t TaudCrackPhi = dCrackPhi(TauPhi,TauEtaAtEcalEntrance) ;
00784   Float_t TaudCrackEta = dCrackEta(TauEtaAtEcalEntrance) ;
00785   Float_t TauSignalPFChargedCands = thePFTau.signalPFChargedHadrCands().size();
00786   Float_t TauHasGsf = thePFTau.leadPFChargedHadrCand()->gsfTrackRef().isNonnull();
00787 
00788   Float_t ElecEta = theGsfEle.eta();
00789   Float_t ElecPhi = theGsfEle.phi();
00790   Float_t ElecPt = theGsfEle.pt();
00791   //Variables related to the electron Cluster
00792   Float_t ElecEe = 0.;
00793   Float_t ElecEgamma = 0.;
00794   reco::SuperClusterRef pfSuperCluster = theGsfEle.pflowSuperCluster();
00795   if ( pfSuperCluster.isNonnull() && pfSuperCluster.isAvailable() ) {
00796     for ( reco::CaloCluster_iterator pfCluster = pfSuperCluster->clustersBegin();
00797           pfCluster != pfSuperCluster->clustersEnd(); ++pfCluster ) {
00798       double pfClusterEn = (*pfCluster)->energy();
00799       if ( pfCluster == pfSuperCluster->clustersBegin() ) ElecEe += pfClusterEn;
00800       else ElecEgamma += pfClusterEn;
00801     }
00802   }
00803   Float_t ElecPin = TMath::Sqrt(theGsfEle.trackMomentumAtVtx().Mag2());
00804   Float_t ElecPout = TMath::Sqrt(theGsfEle.trackMomentumOut().Mag2());
00805   Float_t ElecFbrem = theGsfEle.fbrem();
00806   //Variables related to the GsfTrack
00807   Float_t ElecChi2GSF = -99.;
00808   Float_t ElecGSFNumHits = -99.;
00809   Float_t ElecGSFTrackResol = -99.;
00810   Float_t ElecGSFTracklnPt = -99.;
00811   Float_t ElecGSFTrackEta = -99.;
00812   if ( theGsfEle.gsfTrack().isNonnull() ) {
00813     ElecChi2GSF = (theGsfEle).gsfTrack()->normalizedChi2();
00814     ElecGSFNumHits = (theGsfEle).gsfTrack()->numberOfValidHits();
00815     if ( theGsfEle.gsfTrack()->pt() > 0. ) {
00816       ElecGSFTrackResol = theGsfEle.gsfTrack()->ptError()/theGsfEle.gsfTrack()->pt();
00817       ElecGSFTracklnPt = log(theGsfEle.gsfTrack()->pt())*TMath::Ln10();
00818     }
00819     ElecGSFTrackEta = theGsfEle.gsfTrack()->eta();
00820   }
00821 
00822   return MVAValue(TauEtaAtEcalEntrance,
00823                   TauPt,
00824                   TaudCrackEta,
00825                   TaudCrackPhi,
00826                   TauEmFraction,
00827                   TauSignalPFGammaCands,
00828                   TauLeadPFChargedHadrHoP,
00829                   TauLeadPFChargedHadrEoP,
00830                   TauVisMass,
00831                   TauHadrMva,
00832                   GammasdEta,
00833                   GammasdPhi,
00834                   GammasPt,
00835                   TauKFNumHits,
00836                   TauGSFNumHits,
00837                   TauGSFChi2,
00838                   TauGSFTrackResol,
00839                   TauGSFTracklnPt,
00840                   TauGSFTrackEta,
00841                   TauPhi,
00842                   TauSignalPFChargedCands,
00843                   TauHasGsf,
00844                   ElecEta,
00845                   ElecPhi,
00846                   ElecPt,
00847                   ElecEe,
00848                   ElecEgamma,
00849                   ElecPin,
00850                   ElecPout,
00851                   ElecFbrem,
00852                   ElecChi2GSF,
00853                   ElecGSFNumHits,
00854                   ElecGSFTrackResol,
00855                   ElecGSFTracklnPt,
00856                   ElecGSFTrackEta);
00857 }
00858 
00859 double AntiElectronIDMVA3::MVAValue(const reco::PFTau& thePFTau)
00860 {
00861   Float_t TauEtaAtEcalEntrance = -99.;
00862   float sumEtaTimesEnergy = 0;
00863   float sumEnergy = 0;
00864   for(unsigned int j = 0 ; j < (thePFTau.signalPFCands()).size() ; j++){
00865     reco::PFCandidateRef pfcandidate = (thePFTau.signalPFCands()).at(j);
00866     sumEtaTimesEnergy += pfcandidate->positionAtECALEntrance().eta()*pfcandidate->energy();
00867     sumEnergy += pfcandidate->energy();
00868   }
00869   if(sumEnergy>0)TauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
00870 
00871   Float_t TauPt = thePFTau.pt();
00872   Float_t TauEmFraction = TMath::Max(thePFTau.emFraction(), (Float_t)0.);
00873   Float_t TauSignalPFGammaCands = thePFTau.signalPFGammaCands().size();
00874   Float_t TauLeadPFChargedHadrHoP = 0.;
00875   Float_t TauLeadPFChargedHadrEoP = 0.;
00876   if ( thePFTau.leadPFChargedHadrCand()->p() > 0. ) {
00877     TauLeadPFChargedHadrHoP = thePFTau.leadPFChargedHadrCand()->hcalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
00878     TauLeadPFChargedHadrEoP = thePFTau.leadPFChargedHadrCand()->ecalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
00879   }
00880   Float_t TauVisMass = thePFTau.mass();
00881   Float_t TauHadrMva = TMath::Max(thePFTau.electronPreIDOutput(),float(-1.0));
00882   std::vector<Float_t> GammasdEta;
00883   std::vector<Float_t> GammasdPhi;
00884   std::vector<Float_t> GammasPt;
00885   for ( unsigned i = 0 ; i < thePFTau.signalPFGammaCands().size(); ++i ) {
00886     reco::PFCandidateRef gamma = thePFTau.signalPFGammaCands().at(i);
00887     if ( thePFTau.leadPFChargedHadrCand().isNonnull() ) {
00888       GammasdEta.push_back(gamma->eta() - thePFTau.leadPFChargedHadrCand()->eta());
00889       GammasdPhi.push_back(gamma->phi() - thePFTau.leadPFChargedHadrCand()->phi());
00890     } else {
00891       GammasdEta.push_back(gamma->eta() - thePFTau.eta());
00892       GammasdPhi.push_back(gamma->phi() - thePFTau.phi());
00893     }
00894     GammasPt.push_back(gamma->pt());
00895   }
00896   Float_t TauKFNumHits = -99.;
00897   if((thePFTau.leadPFChargedHadrCand()->trackRef()).isNonnull()){
00898     TauKFNumHits = thePFTau.leadPFChargedHadrCand()->trackRef()->numberOfValidHits();
00899   }
00900   Float_t TauGSFNumHits = -99.;
00901   Float_t TauGSFChi2 = -99.;
00902   Float_t TauGSFTrackResol = -99.;
00903   Float_t TauGSFTracklnPt = -99.;
00904   Float_t TauGSFTrackEta = -99.;
00905   if((thePFTau.leadPFChargedHadrCand()->gsfTrackRef()).isNonnull()){
00906       TauGSFChi2 = thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->normalizedChi2();
00907       TauGSFNumHits = thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->numberOfValidHits();
00908       if ( thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->pt() > 0. ) {
00909         TauGSFTrackResol = thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->ptError()/thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->pt();
00910         TauGSFTracklnPt = log(thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->pt())*TMath::Ln10();
00911       }
00912       TauGSFTrackEta = thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->eta();
00913   }
00914   Float_t TauPhi = thePFTau.phi();
00915   float sumPhiTimesEnergy = 0;
00916   float sumEnergyPhi = 0;
00917   for(unsigned int j = 0 ; j < (thePFTau.signalPFCands()).size() ; j++){
00918     reco::PFCandidateRef pfcandidate = (thePFTau.signalPFCands()).at(j);
00919     sumPhiTimesEnergy += pfcandidate->positionAtECALEntrance().phi()*pfcandidate->energy();
00920     sumEnergyPhi += pfcandidate->energy();
00921   }
00922   if(sumEnergy>0)TauPhi = sumPhiTimesEnergy/sumEnergyPhi;
00923   Float_t TaudCrackPhi = dCrackPhi(TauPhi,TauEtaAtEcalEntrance) ;
00924   Float_t TaudCrackEta = dCrackEta(TauEtaAtEcalEntrance) ;
00925   Float_t TauSignalPFChargedCands = thePFTau.signalPFChargedHadrCands().size();
00926   Float_t TauHasGsf = thePFTau.leadPFChargedHadrCand()->gsfTrackRef().isNonnull();
00927 
00928   Float_t dummyElecEta = 9.9;
00929 
00930   return MVAValue(TauEtaAtEcalEntrance,
00931                   TauPt,
00932                   TaudCrackEta,
00933                   TaudCrackPhi,
00934                   TauEmFraction,
00935                   TauSignalPFGammaCands,
00936                   TauLeadPFChargedHadrHoP,
00937                   TauLeadPFChargedHadrEoP,
00938                   TauVisMass,
00939                   TauHadrMva,
00940                   GammasdEta,
00941                   GammasdPhi,
00942                   GammasPt,
00943                   TauKFNumHits,
00944                   TauGSFNumHits,
00945                   TauGSFChi2,
00946                   TauGSFTrackResol,
00947                   TauGSFTracklnPt,
00948                   TauGSFTrackEta,
00949                   TauPhi,
00950                   TauSignalPFChargedCands,
00951                   TauHasGsf,
00952                   dummyElecEta,
00953                   0.,
00954                   0.,
00955                   0.,
00956                   0.,
00957                   0.,
00958                   0.,
00959                   0.,
00960                   0.,
00961                   0.,
00962                   0.,
00963                   0.,
00964                   0.);
00965 }
00966 
00967 
00968 double
00969 AntiElectronIDMVA3::minimum(double a,double b){
00970   if(TMath::Abs(b)<TMath::Abs(a)) return b;
00971   else return a;
00972 }
00973 
00974 //compute the unsigned distance to the closest phi-crack in the barrel
00975 double
00976 AntiElectronIDMVA3:: dCrackPhi(double phi, double eta){
00977 
00978   double pi= TMath::Pi();// 3.14159265358979323846;
00979 
00980   //Location of the 18 phi-cracks
00981   static std::vector<double> cPhi;
00982   if(cPhi.size()==0)
00983     {
00984       cPhi.resize(18,0);
00985       cPhi[0]=2.97025;
00986       for(unsigned i=1;i<=17;++i) cPhi[i]=cPhi[0]-2*i*pi/18;
00987     }
00988 
00989   //Shift of this location if eta<0
00990   double delta_cPhi=0.00638;
00991 
00992   double m; //the result
00993 
00994   if (eta>=- 1.47464 && eta<= 1.47464){
00995 
00996     //the location is shifted
00997     if(eta<0) phi +=delta_cPhi;
00998 
00999     if (phi>=-pi && phi<=pi){
01000 
01001       //the problem of the extrema
01002       if (phi<cPhi[17] || phi>=cPhi[0]){
01003         if (phi<0) phi+= 2*pi;
01004         m = minimum(phi -cPhi[0],phi-cPhi[17]-2*pi);
01005       }
01006 
01007       //between these extrema...
01008       else{
01009         bool OK = false;
01010         unsigned i=16;
01011         while(!OK){
01012           if (phi<cPhi[i]){
01013             m=minimum(phi-cPhi[i+1],phi-cPhi[i]);
01014             OK=true;
01015           }
01016           else i-=1;
01017         }
01018       }
01019     }
01020     else{
01021       m=0.;        //if there is a problem, we assum that we are in a crack
01022       //std::cout<<"Problem in dminphi"<<std::endl;
01023     }
01024   }
01025   else{
01026     return -99.;
01027     //std::cout<<"Encap region"<<std::endl;
01028   }
01029 
01030   return TMath::Abs(m);
01031 }
01032 
01033 //compute the unsigned distance to the closest phi-crack in the barrel
01034 double
01035 AntiElectronIDMVA3:: dCrackEta(double eta){
01036 
01037   //Location of the eta-cracks
01038   double cracks[5] = {0, 4.44747e-01, 7.92824e-01, 1.14090e+00, 1.47464e+00};
01039 
01040   double m=99.; //the result
01041 
01042   for(int i=0;i<5;i++){
01043     double d = minimum(eta-cracks[i], eta+cracks[i]);
01044     if (TMath::Abs(d)<TMath::Abs(m)){
01045       m=d;
01046     }
01047   }
01048 
01049   return TMath::Abs(m);
01050 }