CMS 3D CMS Logo

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