CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 #include <TFile.h>
00002 #include <TMath.h>
00003 #include "RecoTauTag/RecoTau/interface/AntiElectronIDMVA2.h"
00004 #include "RecoTauTag/RecoTau/interface/TMVAZipReader.h"
00005 #include "FWCore/Utilities/interface/Exception.h"
00006 
00007 AntiElectronIDMVA2::AntiElectronIDMVA2()
00008   : isInitialized_(kFALSE),
00009     methodName_("BDT")
00010 {
00011   for ( unsigned i = 0; i < 10; ++i ) {
00012     fTMVAReader_[i] = 0;
00013   }
00014 
00015   verbosity_ = 1;
00016 }
00017 
00018 AntiElectronIDMVA2::~AntiElectronIDMVA2()
00019 {
00020   for ( unsigned i = 0; i < 10; ++i ) {
00021     if ( fTMVAReader_[i] ) delete fTMVAReader_[i];
00022   }
00023 }
00024 
00025 enum {  k_NoEleMatch_BL,
00026         k_woG_BL,
00027         k_wGwoGSF_BL,
00028         k_wGwGSFwoPFMVA_BL,
00029         k_wGwGSFwPFMVA_BL,
00030         k_NoEleMatch_EC,
00031         k_woG_EC,
00032         k_wGwoGSF_EC,
00033         k_wGwGSFwoPFMVA_EC,
00034         k_wGwGSFwPFMVA_EC };
00035 
00036 
00037 void AntiElectronIDMVA2::Initialize_from_file(const std::string& methodName,
00038                                               const std::string& oneProngNoEleMatch_BL,
00039                                               const std::string& oneProng0Pi0_BL,
00040                                               const std::string& oneProng1pi0woGSF_BL,
00041                                               const std::string& oneProng1pi0wGSFwoPfEleMva_BL,
00042                                               const std::string& oneProng1pi0wGSFwPfEleMva_BL,
00043                                               const std::string& oneProngNoEleMatch_EC,
00044                                               const std::string& oneProng0Pi0_EC,
00045                                               const std::string& oneProng1pi0woGSF_EC,
00046                                               const std::string& oneProng1pi0wGSFwoPfEleMva_EC,
00047                                               const std::string& oneProng1pi0wGSFwPfEleMva_EC)
00048 {
00049   for ( unsigned i = 0; i < 10; ++i ) {
00050     if ( fTMVAReader_[i] ) delete fTMVAReader_[i];
00051   }
00052 
00053   isInitialized_ = kTRUE;
00054   methodName_ = methodName;
00055 
00056   bookMVAs();
00057 
00058   reco::details::loadTMVAWeights(fTMVAReader_[k_NoEleMatch_BL], methodName_, oneProngNoEleMatch_BL);
00059   reco::details::loadTMVAWeights(fTMVAReader_[k_woG_BL], methodName_, oneProng0Pi0_BL);
00060   reco::details::loadTMVAWeights(fTMVAReader_[k_wGwoGSF_BL], methodName_, oneProng1pi0woGSF_BL);
00061   reco::details::loadTMVAWeights(fTMVAReader_[k_wGwGSFwoPFMVA_BL], methodName_, oneProng1pi0wGSFwoPfEleMva_BL);
00062   reco::details::loadTMVAWeights(fTMVAReader_[k_wGwGSFwPFMVA_BL], methodName_, oneProng1pi0wGSFwPfEleMva_BL);
00063   reco::details::loadTMVAWeights(fTMVAReader_[k_NoEleMatch_EC], methodName_, oneProngNoEleMatch_EC);
00064   reco::details::loadTMVAWeights(fTMVAReader_[k_woG_EC], methodName_, oneProng0Pi0_EC);
00065   reco::details::loadTMVAWeights(fTMVAReader_[k_wGwoGSF_EC], methodName_, oneProng1pi0woGSF_EC);
00066   reco::details::loadTMVAWeights(fTMVAReader_[k_wGwGSFwoPFMVA_EC], methodName_, oneProng1pi0wGSFwoPfEleMva_EC);
00067   reco::details::loadTMVAWeights(fTMVAReader_[k_wGwGSFwPFMVA_EC], methodName_, oneProng1pi0wGSFwPfEleMva_EC);
00068 }
00069 
00070 void AntiElectronIDMVA2::Initialize_from_string(const std::string& methodName,
00071                                                 const std::string& oneProngNoEleMatch_BL,
00072                                                 const std::string& oneProng0Pi0_BL,
00073                                                 const std::string& oneProng1pi0woGSF_BL,
00074                                                 const std::string& oneProng1pi0wGSFwoPfEleMva_BL,
00075                                                 const std::string& oneProng1pi0wGSFwPfEleMva_BL,
00076                                                 const std::string& oneProngNoEleMatch_EC,
00077                                                 const std::string& oneProng0Pi0_EC,
00078                                                 const std::string& oneProng1pi0woGSF_EC,
00079                                                 const std::string& oneProng1pi0wGSFwoPfEleMva_EC,
00080                                                 const std::string& oneProng1pi0wGSFwPfEleMva_EC)
00081 {
00082   for ( unsigned i = 0; i < 10; ++i ) {
00083     if ( fTMVAReader_[i] ) delete fTMVAReader_[i];
00084   }
00085 
00086   isInitialized_ = kTRUE;
00087   methodName_ = methodName;
00088 
00089   bookMVAs();
00090 
00091   int methodName_int = -1;
00092   if ( methodName_ == "BDT" ) methodName_int = TMVA::Types::kBDT;
00093   else throw cms::Exception("InvalidParameter") 
00094     << "Invalid TMVA method name = " << methodName_ << " !!\n";
00095 
00096   fTMVAReader_[k_NoEleMatch_BL]->BookMVA(methodName_int, oneProngNoEleMatch_BL.data());
00097   fTMVAReader_[k_woG_BL]->BookMVA(methodName_int, oneProng0Pi0_BL.data());
00098   fTMVAReader_[k_wGwoGSF_BL]->BookMVA(methodName_int, oneProng1pi0woGSF_BL.data());
00099   fTMVAReader_[k_wGwGSFwoPFMVA_BL]->BookMVA(methodName_int, oneProng1pi0wGSFwoPfEleMva_BL.data());
00100   fTMVAReader_[k_wGwGSFwPFMVA_BL]->BookMVA(methodName_int, oneProng1pi0wGSFwPfEleMva_BL.data());
00101   fTMVAReader_[k_NoEleMatch_EC]->BookMVA(methodName_int, oneProngNoEleMatch_EC.data());
00102   fTMVAReader_[k_woG_EC]->BookMVA(methodName_int, oneProng0Pi0_EC.data());
00103   fTMVAReader_[k_wGwoGSF_EC]->BookMVA(methodName_int, oneProng1pi0woGSF_EC.data());
00104   fTMVAReader_[k_wGwGSFwoPFMVA_EC]->BookMVA(methodName_int, oneProng1pi0wGSFwoPfEleMva_EC.data());
00105   fTMVAReader_[k_wGwGSFwPFMVA_EC]->BookMVA(methodName_int, oneProng1pi0wGSFwPfEleMva_EC.data());
00106 }
00107 
00108 void AntiElectronIDMVA2::bookMVAs()
00109 {
00110   //TMVA::Tools::Instance();
00111 
00112   GammadEta_ = 0.;
00113   GammadPhi_ = 0.;
00114   GammadPt_ = 0.;
00115 
00116   Tau_EtaAtEcalEntrance_ = 0.;
00117   Tau_Pt_ = 0.;
00118   Tau_HasGsf_ = 0.; 
00119   Tau_EmFraction_ = 0.; 
00120   Tau_NumChargedCands_ = 0.;
00121   Tau_NumGammaCands_ = 0.; 
00122   Tau_HadrHoP_ = 0.; 
00123   Tau_HadrEoP_ = 0.; 
00124   Tau_VisMass_ = 0.; 
00125   Tau_GammaEtaMom_ = 0.;
00126   Tau_GammaPhiMom_ = 0.;
00127   Tau_GammaEnFrac_ = 0.;
00128   Tau_HadrMva_ = 0.; 
00129 
00130   Elec_Eta_ = 0.;
00131   Elec_Pt_ = 0.;
00132   Elec_PFMvaOutput_ = 0.;
00133   Elec_Ee_ = 0.;
00134   Elec_Egamma_ = 0.;
00135   Elec_Pin_ = 0.;
00136   Elec_Pout_ = 0.;
00137   Elec_EtotOverPin_ = 0.;
00138   Elec_EeOverPout_ = 0.;
00139   Elec_EgammaOverPdif_ = 0.;
00140   Elec_EarlyBrem_ = 0.;
00141   Elec_LateBrem_ = 0.;
00142   Elec_Fbrem_ = 0.;
00143   Elec_Chi2KF_ = 0.;
00144   Elec_Chi2GSF_ = 0.;
00145   Elec_NumHits_ = 0.;
00146   Elec_GSFTrackResol_ = 0.;
00147   Elec_GSFTracklnPt_ = 0.;
00148   Elec_GSFTrackEta_ = 0.;
00149 
00150 
00151   TMVA::Reader* readerNoEleMatch_BL = new TMVA::Reader( "!Color:Silent:Error" );
00152   readerNoEleMatch_BL->AddVariable("Tau_EtaAtEcalEntrance", &Tau_EtaAtEcalEntrance_);
00153   readerNoEleMatch_BL->AddVariable("Tau_Pt", &Tau_Pt_);
00154   readerNoEleMatch_BL->AddVariable("Tau_EmFraction", &Tau_EmFraction_);
00155   readerNoEleMatch_BL->AddVariable("Tau_NumGammaCands", &Tau_NumGammaCands_);
00156   readerNoEleMatch_BL->AddVariable("Tau_HadrHoP", &Tau_HadrHoP_);
00157   readerNoEleMatch_BL->AddVariable("Tau_HadrEoP", &Tau_HadrEoP_);
00158   readerNoEleMatch_BL->AddVariable("Tau_VisMass", &Tau_VisMass_);
00159   readerNoEleMatch_BL->AddVariable("Tau_GammaEtaMom", &Tau_GammaEtaMom_);
00160   readerNoEleMatch_BL->AddVariable("Tau_GammaPhiMom", &Tau_GammaPhiMom_);
00161   readerNoEleMatch_BL->AddVariable("Tau_GammaEnFrac", &Tau_GammaEnFrac_);
00162   readerNoEleMatch_BL->SetVerbose(verbosity_);
00163 
00164   TMVA::Reader* readerwoG_BL = new TMVA::Reader( "!Color:Silent:Error" );
00165   readerwoG_BL->AddVariable("Elec_EtotOverPin", &Elec_EtotOverPin_);
00166   readerwoG_BL->AddVariable("Elec_LateBrem", &Elec_LateBrem_);
00167   readerwoG_BL->AddVariable("Elec_Fbrem", &Elec_Fbrem_);
00168   readerwoG_BL->AddVariable("Elec_Chi2KF", &Elec_Chi2KF_);
00169   readerwoG_BL->AddVariable("Elec_GSFTrackResol", &Elec_GSFTrackResol_);
00170   readerwoG_BL->AddVariable("Elec_GSFTracklnPt", &Elec_GSFTracklnPt_);
00171   readerwoG_BL->AddVariable("Elec_GSFTrackEta", &Elec_GSFTrackEta_);
00172   readerwoG_BL->AddVariable("Tau_EtaAtEcalEntrance", &Tau_EtaAtEcalEntrance_);
00173   readerwoG_BL->AddVariable("Tau_Pt", &Tau_Pt_);
00174   readerwoG_BL->AddVariable("Tau_EmFraction", &Tau_EmFraction_);
00175   readerwoG_BL->AddVariable("Tau_HadrHoP", &Tau_HadrHoP_);
00176   readerwoG_BL->AddVariable("Tau_HadrEoP", &Tau_HadrEoP_);
00177   readerwoG_BL->AddVariable("Tau_VisMass", &Tau_VisMass_);
00178   readerwoG_BL->SetVerbose(verbosity_);
00179 
00180   TMVA::Reader* readerwGwoGSF_BL = new TMVA::Reader( "!Color:Silent:Error" );
00181   readerwGwoGSF_BL->AddVariable("Elec_EtotOverPin", &Elec_EtotOverPin_);
00182   readerwGwoGSF_BL->AddVariable("Elec_EgammaOverPdif", &Elec_EgammaOverPdif_);
00183   readerwGwoGSF_BL->AddVariable("Elec_LateBrem", &Elec_LateBrem_);
00184   readerwGwoGSF_BL->AddVariable("Elec_Fbrem", &Elec_Fbrem_);
00185   readerwGwoGSF_BL->AddVariable("Elec_Chi2GSF", &Elec_Chi2GSF_);
00186   readerwGwoGSF_BL->AddVariable("Elec_NumHits", &Elec_NumHits_);
00187   readerwGwoGSF_BL->AddVariable("Elec_GSFTrackResol", &Elec_GSFTrackResol_);
00188   readerwGwoGSF_BL->AddVariable("Elec_GSFTracklnPt", &Elec_GSFTracklnPt_);
00189   readerwGwoGSF_BL->AddVariable("Elec_GSFTrackEta", &Elec_GSFTrackEta_);
00190   readerwGwoGSF_BL->AddVariable("Tau_EtaAtEcalEntrance", &Tau_EtaAtEcalEntrance_);
00191   readerwGwoGSF_BL->AddVariable("Tau_Pt", &Tau_Pt_);
00192   readerwGwoGSF_BL->AddVariable("Tau_EmFraction", &Tau_EmFraction_);
00193   readerwGwoGSF_BL->AddVariable("Tau_NumGammaCands", &Tau_NumGammaCands_);
00194   readerwGwoGSF_BL->AddVariable("Tau_HadrHoP", &Tau_HadrHoP_);
00195   readerwGwoGSF_BL->AddVariable("Tau_HadrEoP", &Tau_HadrEoP_);
00196   readerwGwoGSF_BL->AddVariable("Tau_VisMass", &Tau_VisMass_);
00197   readerwGwoGSF_BL->AddVariable("Tau_GammaEtaMom", &Tau_GammaEtaMom_);
00198   readerwGwoGSF_BL->AddVariable("Tau_GammaPhiMom", &Tau_GammaPhiMom_);
00199   readerwGwoGSF_BL->AddVariable("Tau_GammaEnFrac", &Tau_GammaEnFrac_);
00200   readerwGwoGSF_BL->SetVerbose(verbosity_);
00201 
00202   TMVA::Reader* readerwGwGSFwoPFMVA_BL = new TMVA::Reader( "!Color:Silent:Error" );
00203   readerwGwGSFwoPFMVA_BL->AddVariable("Elec_Fbrem", &Elec_Fbrem_);
00204   readerwGwGSFwoPFMVA_BL->AddVariable("Elec_Chi2KF", &Elec_Chi2KF_);
00205   readerwGwGSFwoPFMVA_BL->AddVariable("Elec_Chi2GSF", &Elec_Chi2GSF_);
00206   readerwGwGSFwoPFMVA_BL->AddVariable("Elec_NumHits", &Elec_NumHits_);
00207   readerwGwGSFwoPFMVA_BL->AddVariable("Elec_GSFTrackResol", &Elec_GSFTrackResol_);
00208   readerwGwGSFwoPFMVA_BL->AddVariable("Elec_GSFTracklnPt", &Elec_GSFTracklnPt_);
00209   readerwGwGSFwoPFMVA_BL->AddVariable("Elec_GSFTrackEta", &Elec_GSFTrackEta_);
00210   readerwGwGSFwoPFMVA_BL->AddVariable("Tau_EtaAtEcalEntrance", &Tau_EtaAtEcalEntrance_);
00211   readerwGwGSFwoPFMVA_BL->AddVariable("Tau_Pt", &Tau_Pt_);
00212   readerwGwGSFwoPFMVA_BL->AddVariable("Tau_EmFraction", &Tau_EmFraction_);
00213   readerwGwGSFwoPFMVA_BL->AddVariable("Tau_NumGammaCands", &Tau_NumGammaCands_);
00214   readerwGwGSFwoPFMVA_BL->AddVariable("Tau_HadrHoP", &Tau_HadrHoP_);
00215   readerwGwGSFwoPFMVA_BL->AddVariable("Tau_HadrEoP", &Tau_HadrEoP_);
00216   readerwGwGSFwoPFMVA_BL->AddVariable("Tau_VisMass", &Tau_VisMass_);
00217   readerwGwGSFwoPFMVA_BL->AddVariable("Tau_GammaEtaMom", &Tau_GammaEtaMom_);
00218   readerwGwGSFwoPFMVA_BL->AddVariable("Tau_GammaPhiMom", &Tau_GammaPhiMom_);
00219   readerwGwGSFwoPFMVA_BL->AddVariable("Tau_GammaEnFrac", &Tau_GammaEnFrac_);
00220   readerwGwGSFwoPFMVA_BL->SetVerbose(verbosity_);
00221 
00222   TMVA::Reader* readerwGwGSFwPFMVA_BL = new TMVA::Reader( "!Color:Silent:Error" );
00223   readerwGwGSFwPFMVA_BL->AddVariable("Elec_EtotOverPin", &Elec_EtotOverPin_);
00224   readerwGwGSFwPFMVA_BL->AddVariable("Elec_EeOverPout", &Elec_EeOverPout_);
00225   readerwGwGSFwPFMVA_BL->AddVariable("Elec_LateBrem", &Elec_LateBrem_);
00226   readerwGwGSFwPFMVA_BL->AddVariable("Elec_Chi2GSF", &Elec_Chi2GSF_);
00227   readerwGwGSFwPFMVA_BL->AddVariable("Elec_NumHits", &Elec_NumHits_);
00228   readerwGwGSFwPFMVA_BL->AddVariable("Elec_GSFTrackResol", &Elec_GSFTrackResol_);
00229   readerwGwGSFwPFMVA_BL->AddVariable("Elec_GSFTracklnPt", &Elec_GSFTracklnPt_);
00230   readerwGwGSFwPFMVA_BL->AddVariable("Elec_GSFTrackEta", &Elec_GSFTrackEta_);
00231   readerwGwGSFwPFMVA_BL->AddVariable("Tau_EtaAtEcalEntrance", &Tau_EtaAtEcalEntrance_);
00232   readerwGwGSFwPFMVA_BL->AddVariable("Tau_Pt", &Tau_Pt_);
00233   readerwGwGSFwPFMVA_BL->AddVariable("Tau_EmFraction", &Tau_EmFraction_);
00234   readerwGwGSFwPFMVA_BL->AddVariable("Tau_NumGammaCands", &Tau_NumGammaCands_);
00235   readerwGwGSFwPFMVA_BL->AddVariable("Tau_HadrHoP", &Tau_HadrHoP_);
00236   readerwGwGSFwPFMVA_BL->AddVariable("Tau_HadrEoP", &Tau_HadrEoP_);
00237   readerwGwGSFwPFMVA_BL->AddVariable("Tau_VisMass", &Tau_VisMass_);
00238   readerwGwGSFwPFMVA_BL->AddVariable("Tau_GammaEtaMom", &Tau_GammaEtaMom_);
00239   readerwGwGSFwPFMVA_BL->AddVariable("Tau_GammaPhiMom", &Tau_GammaPhiMom_);
00240   readerwGwGSFwPFMVA_BL->AddVariable("Tau_GammaEnFrac", &Tau_GammaEnFrac_);
00241   readerwGwGSFwPFMVA_BL->SetVerbose(verbosity_);
00242 
00243   TMVA::Reader* readerNoEleMatch_EC = new TMVA::Reader( "!Color:Silent:Error" );
00244   readerNoEleMatch_EC->AddVariable("Tau_EtaAtEcalEntrance", &Tau_EtaAtEcalEntrance_);
00245   readerNoEleMatch_EC->AddVariable("Tau_Pt", &Tau_Pt_);
00246   readerNoEleMatch_EC->AddVariable("Tau_EmFraction", &Tau_EmFraction_);
00247   readerNoEleMatch_EC->AddVariable("Tau_NumGammaCands", &Tau_NumGammaCands_);
00248   readerNoEleMatch_EC->AddVariable("Tau_HadrHoP", &Tau_HadrHoP_);
00249   readerNoEleMatch_EC->AddVariable("Tau_HadrEoP", &Tau_HadrEoP_);
00250   readerNoEleMatch_EC->AddVariable("Tau_VisMass", &Tau_VisMass_);
00251   readerNoEleMatch_EC->AddVariable("Tau_GammaEtaMom", &Tau_GammaEtaMom_);
00252   readerNoEleMatch_EC->AddVariable("Tau_GammaPhiMom", &Tau_GammaPhiMom_);
00253   readerNoEleMatch_EC->AddVariable("Tau_GammaEnFrac", &Tau_GammaEnFrac_);
00254   readerNoEleMatch_EC->SetVerbose(verbosity_);
00255 
00256   TMVA::Reader* readerwoG_EC = new TMVA::Reader( "!Color:Silent:Error" );
00257   readerwoG_EC->AddVariable("Elec_EtotOverPin", &Elec_EtotOverPin_);
00258   readerwoG_EC->AddVariable("Elec_LateBrem", &Elec_LateBrem_);
00259   readerwoG_EC->AddVariable("Elec_Fbrem", &Elec_Fbrem_);
00260   readerwoG_EC->AddVariable("Elec_Chi2KF", &Elec_Chi2KF_);
00261   readerwoG_EC->AddVariable("Elec_GSFTrackResol", &Elec_GSFTrackResol_);
00262   readerwoG_EC->AddVariable("Elec_GSFTracklnPt", &Elec_GSFTracklnPt_);
00263   readerwoG_EC->AddVariable("Elec_GSFTrackEta", &Elec_GSFTrackEta_);
00264   readerwoG_EC->AddVariable("Tau_EtaAtEcalEntrance", &Tau_EtaAtEcalEntrance_);
00265   readerwoG_EC->AddVariable("Tau_Pt", &Tau_Pt_);
00266   readerwoG_EC->AddVariable("Tau_EmFraction", &Tau_EmFraction_);
00267   readerwoG_EC->AddVariable("Tau_HadrHoP", &Tau_HadrHoP_);
00268   readerwoG_EC->AddVariable("Tau_HadrEoP", &Tau_HadrEoP_);
00269   readerwoG_EC->AddVariable("Tau_VisMass", &Tau_VisMass_);
00270   readerwoG_EC->SetVerbose(verbosity_);
00271 
00272   TMVA::Reader* readerwGwoGSF_EC = new TMVA::Reader( "!Color:Silent:Error" );
00273   readerwGwoGSF_EC->AddVariable("Elec_EtotOverPin", &Elec_EtotOverPin_);
00274   readerwGwoGSF_EC->AddVariable("Elec_EgammaOverPdif", &Elec_EgammaOverPdif_);
00275   readerwGwoGSF_EC->AddVariable("Elec_LateBrem", &Elec_LateBrem_);
00276   readerwGwoGSF_EC->AddVariable("Elec_Fbrem", &Elec_Fbrem_);
00277   readerwGwoGSF_EC->AddVariable("Elec_Chi2GSF", &Elec_Chi2GSF_);
00278   readerwGwoGSF_EC->AddVariable("Elec_NumHits", &Elec_NumHits_);
00279   readerwGwoGSF_EC->AddVariable("Elec_GSFTrackResol", &Elec_GSFTrackResol_);
00280   readerwGwoGSF_EC->AddVariable("Elec_GSFTracklnPt", &Elec_GSFTracklnPt_);
00281   readerwGwoGSF_EC->AddVariable("Elec_GSFTrackEta", &Elec_GSFTrackEta_);
00282   readerwGwoGSF_EC->AddVariable("Tau_EtaAtEcalEntrance", &Tau_EtaAtEcalEntrance_);
00283   readerwGwoGSF_EC->AddVariable("Tau_Pt", &Tau_Pt_);
00284   readerwGwoGSF_EC->AddVariable("Tau_EmFraction", &Tau_EmFraction_);
00285   readerwGwoGSF_EC->AddVariable("Tau_NumGammaCands", &Tau_NumGammaCands_);
00286   readerwGwoGSF_EC->AddVariable("Tau_HadrHoP", &Tau_HadrHoP_);
00287   readerwGwoGSF_EC->AddVariable("Tau_HadrEoP", &Tau_HadrEoP_);
00288   readerwGwoGSF_EC->AddVariable("Tau_VisMass", &Tau_VisMass_);
00289   readerwGwoGSF_EC->AddVariable("Tau_GammaEtaMom", &Tau_GammaEtaMom_);
00290   readerwGwoGSF_EC->AddVariable("Tau_GammaPhiMom", &Tau_GammaPhiMom_);
00291   readerwGwoGSF_EC->AddVariable("Tau_GammaEnFrac", &Tau_GammaEnFrac_);
00292   readerwGwoGSF_EC->SetVerbose(verbosity_);
00293 
00294   TMVA::Reader* readerwGwGSFwoPFMVA_EC = new TMVA::Reader( "!Color:Silent:Error" );
00295   readerwGwGSFwoPFMVA_EC->AddVariable("Elec_Fbrem", &Elec_Fbrem_);
00296   readerwGwGSFwoPFMVA_EC->AddVariable("Elec_Chi2KF", &Elec_Chi2KF_);
00297   readerwGwGSFwoPFMVA_EC->AddVariable("Elec_Chi2GSF", &Elec_Chi2GSF_);
00298   readerwGwGSFwoPFMVA_EC->AddVariable("Elec_NumHits", &Elec_NumHits_);
00299   readerwGwGSFwoPFMVA_EC->AddVariable("Elec_GSFTrackResol", &Elec_GSFTrackResol_);
00300   readerwGwGSFwoPFMVA_EC->AddVariable("Elec_GSFTracklnPt", &Elec_GSFTracklnPt_);
00301   readerwGwGSFwoPFMVA_EC->AddVariable("Elec_GSFTrackEta", &Elec_GSFTrackEta_);
00302   readerwGwGSFwoPFMVA_EC->AddVariable("Tau_EtaAtEcalEntrance", &Tau_EtaAtEcalEntrance_);
00303   readerwGwGSFwoPFMVA_EC->AddVariable("Tau_Pt", &Tau_Pt_);
00304   readerwGwGSFwoPFMVA_EC->AddVariable("Tau_EmFraction", &Tau_EmFraction_);
00305   readerwGwGSFwoPFMVA_EC->AddVariable("Tau_NumGammaCands", &Tau_NumGammaCands_);
00306   readerwGwGSFwoPFMVA_EC->AddVariable("Tau_HadrHoP", &Tau_HadrHoP_);
00307   readerwGwGSFwoPFMVA_EC->AddVariable("Tau_HadrEoP", &Tau_HadrEoP_);
00308   readerwGwGSFwoPFMVA_EC->AddVariable("Tau_VisMass", &Tau_VisMass_);
00309   readerwGwGSFwoPFMVA_EC->AddVariable("Tau_GammaEtaMom", &Tau_GammaEtaMom_);
00310   readerwGwGSFwoPFMVA_EC->AddVariable("Tau_GammaPhiMom", &Tau_GammaPhiMom_);
00311   readerwGwGSFwoPFMVA_EC->AddVariable("Tau_GammaEnFrac", &Tau_GammaEnFrac_);
00312   readerwGwGSFwoPFMVA_EC->SetVerbose(verbosity_);
00313 
00314   TMVA::Reader* readerwGwGSFwPFMVA_EC = new TMVA::Reader( "!Color:Silent:Error" );
00315   readerwGwGSFwPFMVA_EC->AddVariable("Elec_EtotOverPin", &Elec_EtotOverPin_);
00316   readerwGwGSFwPFMVA_EC->AddVariable("Elec_EeOverPout", &Elec_EeOverPout_);
00317   readerwGwGSFwPFMVA_EC->AddVariable("Elec_LateBrem", &Elec_LateBrem_);
00318   readerwGwGSFwPFMVA_EC->AddVariable("Elec_Chi2GSF", &Elec_Chi2GSF_);
00319   readerwGwGSFwPFMVA_EC->AddVariable("Elec_NumHits", &Elec_NumHits_);
00320   readerwGwGSFwPFMVA_EC->AddVariable("Elec_GSFTrackResol", &Elec_GSFTrackResol_);
00321   readerwGwGSFwPFMVA_EC->AddVariable("Elec_GSFTracklnPt", &Elec_GSFTracklnPt_);
00322   readerwGwGSFwPFMVA_EC->AddVariable("Elec_GSFTrackEta", &Elec_GSFTrackEta_);
00323   readerwGwGSFwPFMVA_EC->AddVariable("Tau_EtaAtEcalEntrance", &Tau_EtaAtEcalEntrance_);
00324   readerwGwGSFwPFMVA_EC->AddVariable("Tau_Pt", &Tau_Pt_);
00325   readerwGwGSFwPFMVA_EC->AddVariable("Tau_EmFraction", &Tau_EmFraction_);
00326   readerwGwGSFwPFMVA_EC->AddVariable("Tau_NumGammaCands", &Tau_NumGammaCands_);
00327   readerwGwGSFwPFMVA_EC->AddVariable("Tau_HadrHoP", &Tau_HadrHoP_);
00328   readerwGwGSFwPFMVA_EC->AddVariable("Tau_HadrEoP", &Tau_HadrEoP_);
00329   readerwGwGSFwPFMVA_EC->AddVariable("Tau_VisMass", &Tau_VisMass_);
00330   readerwGwGSFwPFMVA_EC->AddVariable("Tau_GammaEtaMom", &Tau_GammaEtaMom_);
00331   readerwGwGSFwPFMVA_EC->AddVariable("Tau_GammaPhiMom", &Tau_GammaPhiMom_);
00332   readerwGwGSFwPFMVA_EC->AddVariable("Tau_GammaEnFrac", &Tau_GammaEnFrac_);
00333   readerwGwGSFwPFMVA_EC->SetVerbose(verbosity_);
00334 
00335   fTMVAReader_[k_NoEleMatch_BL] = readerNoEleMatch_BL;
00336   fTMVAReader_[k_woG_BL] = readerwoG_BL;
00337   fTMVAReader_[k_wGwoGSF_BL] = readerwGwoGSF_BL;
00338   fTMVAReader_[k_wGwGSFwoPFMVA_BL] = readerwGwGSFwoPFMVA_BL;
00339   fTMVAReader_[k_wGwGSFwPFMVA_BL] = readerwGwGSFwPFMVA_BL;
00340   fTMVAReader_[k_NoEleMatch_EC] = readerNoEleMatch_EC;
00341   fTMVAReader_[k_woG_EC] = readerwoG_EC;
00342   fTMVAReader_[k_wGwoGSF_EC] = readerwGwoGSF_EC;
00343   fTMVAReader_[k_wGwGSFwoPFMVA_EC] = readerwGwGSFwoPFMVA_EC;
00344   fTMVAReader_[k_wGwGSFwPFMVA_EC] = readerwGwGSFwPFMVA_EC;
00345 }
00346 
00347 double AntiElectronIDMVA2::MVAValue(Float_t TauEtaAtEcalEntrance,
00348                                     Float_t TauPhi,
00349                                     Float_t TauPt,
00350                                     Float_t TauSignalPFChargedCands,
00351                                     Float_t TauSignalPFGammaCands,
00352                                     Float_t TauLeadPFChargedHadrHoP,
00353                                     Float_t TauLeadPFChargedHadrEoP,
00354                                     Float_t TauHasGsf,
00355                                     Float_t TauVisMass,
00356                                     Float_t TauEmFraction,
00357                                     const std::vector<Float_t>& GammasdEta,
00358                                     const std::vector<Float_t>& GammasdPhi,
00359                                     const std::vector<Float_t>& GammasPt,
00360                                     Float_t ElecEta,
00361                                     Float_t ElecPhi,
00362                                     Float_t ElecPt,
00363                                     Float_t ElecPFMvaOutput,
00364                                     Float_t ElecEe,
00365                                     Float_t ElecEgamma,
00366                                     Float_t ElecPin,
00367                                     Float_t ElecPout,
00368                                     Float_t ElecEarlyBrem,
00369                                     Float_t ElecLateBrem,
00370                                     Float_t ElecFbrem,
00371                                     Float_t ElecChi2KF,
00372                                     Float_t ElecChi2GSF,
00373                                     Float_t ElecNumHits,
00374                                     Float_t ElecGSFTrackResol,
00375                                     Float_t ElecGSFTracklnPt,
00376                                     Float_t ElecGSFTrackEta)
00377 {
00378   double sumPt  = 0.;
00379   double dEta   = 0.;
00380   double dEta2  = 0.;
00381   double dPhi   = 0.;
00382   double dPhi2  = 0.;
00383   double sumPt2 = 0.;
00384   for ( unsigned int i = 0 ; i < GammasPt.size() ; ++i ) {
00385     double pt_i  = GammasPt[i];
00386     double phi_i = GammasdPhi[i];
00387     if ( GammasdPhi[i] > TMath::Pi() ) phi_i = GammasdPhi[i] - 2*TMath::Pi();
00388     else if ( GammasdPhi[i] < -TMath::Pi() ) phi_i = GammasdPhi[i] + 2*TMath::Pi();
00389     double eta_i = GammasdEta[i];
00390     sumPt  +=  pt_i;
00391     sumPt2 += (pt_i*pt_i);
00392     dEta   += (pt_i*eta_i);
00393     dEta2  += (pt_i*eta_i*eta_i);
00394     dPhi   += (pt_i*phi_i);
00395     dPhi2  += (pt_i*phi_i*phi_i);
00396   }
00397 
00398   Float_t GammaEnFrac = sumPt/TauPt;
00399 
00400   if ( sumPt > 0. ) {
00401     dEta  /= sumPt;
00402     dPhi  /= sumPt;
00403     dEta2 /= sumPt;
00404     dPhi2 /= sumPt;
00405   }
00406 
00407   Float_t GammaEtaMom = TMath::Sqrt(dEta2)*TMath::Sqrt(GammaEnFrac)*TauPt;
00408   Float_t GammaPhiMom = TMath::Sqrt(dPhi2)*TMath::Sqrt(GammaEnFrac)*TauPt;
00409 
00410   return MVAValue(TauEtaAtEcalEntrance,
00411                   TauPhi,
00412                   TauPt,
00413                   TauSignalPFChargedCands,
00414                   TauSignalPFGammaCands,
00415                   TauLeadPFChargedHadrHoP,
00416                   TauLeadPFChargedHadrEoP,
00417                   TauHasGsf,
00418                   TauVisMass,
00419                   TauEmFraction,
00420                   GammaEtaMom,
00421                   GammaPhiMom,
00422                   GammaEnFrac,
00423                   ElecEta,
00424                   ElecPhi,
00425                   ElecPt,
00426                   ElecPFMvaOutput,
00427                   ElecEe,
00428                   ElecEgamma,
00429                   ElecPin,
00430                   ElecPout,
00431                   ElecEarlyBrem,
00432                   ElecLateBrem,
00433                   ElecFbrem,
00434                   ElecChi2KF,
00435                   ElecChi2GSF,
00436                   ElecNumHits,
00437                   ElecGSFTrackResol,
00438                   ElecGSFTracklnPt,
00439                   ElecGSFTrackEta);
00440 }
00441 
00442 double AntiElectronIDMVA2::MVAValue(Float_t TauEtaAtEcalEntrance,
00443                                     Float_t TauPhi,
00444                                     Float_t TauPt,
00445                                     Float_t TauSignalPFChargedCands,
00446                                     Float_t TauSignalPFGammaCands,
00447                                     Float_t TauLeadPFChargedHadrHoP,
00448                                     Float_t TauLeadPFChargedHadrEoP,
00449                                     Float_t TauHasGsf,
00450                                     Float_t TauVisMass,
00451                                     Float_t TauEmFraction,
00452                                     Float_t GammaEtaMom,
00453                                     Float_t GammaPhiMom,
00454                                     Float_t GammaEnFrac,
00455                                     Float_t ElecEta,
00456                                     Float_t ElecPhi,
00457                                     Float_t ElecPt,
00458                                     Float_t ElecPFMvaOutput,
00459                                     Float_t ElecEe,
00460                                     Float_t ElecEgamma,
00461                                     Float_t ElecPin,
00462                                     Float_t ElecPout,
00463                                     Float_t ElecEarlyBrem,
00464                                     Float_t ElecLateBrem,
00465                                     Float_t ElecFbrem,
00466                                     Float_t ElecChi2KF,
00467                                     Float_t ElecChi2GSF,
00468                                     Float_t ElecNumHits,
00469                                     Float_t ElecGSFTrackResol,
00470                                     Float_t ElecGSFTracklnPt,
00471                                     Float_t ElecGSFTrackEta)
00472 {
00473 
00474   if ( !isInitialized_ ) {
00475     std::cout << "Error: AntiElectronMVA not properly initialized.\n";
00476     return -99.;
00477   }
00478 
00479   Tau_EtaAtEcalEntrance_ = TauEtaAtEcalEntrance;
00480   Tau_Pt_ = TauPt;
00481   Tau_HasGsf_ = TauHasGsf;
00482   Tau_EmFraction_ = TMath::Max(TauEmFraction,float(0.0));
00483   Tau_NumChargedCands_ = TauSignalPFChargedCands;
00484   Tau_NumGammaCands_ = TauSignalPFGammaCands;
00485   Tau_HadrHoP_ = TauLeadPFChargedHadrHoP;
00486   Tau_HadrEoP_ = TauLeadPFChargedHadrEoP;
00487   Tau_VisMass_ = TauVisMass;
00488   Tau_GammaEtaMom_ = GammaEtaMom;
00489   Tau_GammaPhiMom_ = GammaPhiMom;
00490   Tau_GammaEnFrac_ = GammaEnFrac;
00491 
00492   Elec_Eta_ = ElecEta;
00493   Elec_Pt_ = ElecPt;
00494   Elec_EtotOverPin_ = (ElecEe + ElecEgamma)/ElecPin;
00495   Elec_EgammaOverPdif_ = ElecEgamma/(ElecPin - ElecPout);
00496   Elec_EarlyBrem_ = ElecEarlyBrem;
00497   Elec_LateBrem_ = ElecLateBrem;
00498   Elec_Fbrem_ = ElecFbrem;
00499   Elec_Chi2KF_ = ElecChi2KF;
00500   Elec_Chi2GSF_ = ElecChi2GSF;
00501   Elec_NumHits_ = ElecNumHits;
00502   Elec_GSFTrackResol_ = ElecGSFTrackResol;
00503   Elec_GSFTracklnPt_ = ElecGSFTracklnPt;
00504   Elec_GSFTrackEta_ = ElecGSFTrackEta;
00505 
00506   double mva = -99.;
00507   if ( Tau_NumChargedCands_ == 3 ) mva = 1.0;
00508   else if ( deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 ) {
00509     if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_NoEleMatch_BL]->EvaluateMVA(methodName_);
00510     else mva = fTMVAReader_[k_NoEleMatch_EC]->EvaluateMVA(methodName_);
00511   } else if ( TauSignalPFGammaCands == 0 ) {
00512     if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_woG_BL]->EvaluateMVA(methodName_);
00513     else mva = fTMVAReader_[k_woG_EC]->EvaluateMVA(methodName_);
00514   } else if ( TauSignalPFGammaCands > 0 && TauHasGsf < 0.5 ) {
00515     if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_wGwoGSF_BL]->EvaluateMVA(methodName_);
00516     else mva = fTMVAReader_[k_wGwoGSF_EC]->EvaluateMVA(methodName_);
00517   } else if ( TauSignalPFGammaCands > 0 && TauHasGsf > 0.5 && ElecPFMvaOutput < -0.1 ) {
00518     if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_wGwGSFwoPFMVA_BL]->EvaluateMVA(methodName_);
00519     else mva = fTMVAReader_[k_wGwGSFwoPFMVA_EC]->EvaluateMVA(methodName_);
00520   } else if ( TauSignalPFGammaCands > 0 && TauHasGsf > 0.5 && ElecPFMvaOutput > -0.1 ) {
00521     if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_wGwGSFwPFMVA_BL]->EvaluateMVA(methodName_);
00522     else mva = fTMVAReader_[k_wGwGSFwPFMVA_EC]->EvaluateMVA(methodName_);
00523   }
00524 
00525   return mva;
00526 }
00527 
00528 
00529 double AntiElectronIDMVA2::MVAValue(const reco::PFTau& thePFTau,
00530                                     const reco::GsfElectron& theGsfEle)
00531 
00532 {
00533   float sumEtaTimesEnergy = 0;
00534   float sumEnergy = 0;
00535   Float_t TauEtaAtEcalEntrance = 0;
00536   for(unsigned int j = 0 ; j < (thePFTau.signalPFCands()).size() ; j++){
00537        reco::PFCandidateRef pfcandidate = (thePFTau.signalPFCands()).at(j);
00538        sumEtaTimesEnergy += pfcandidate->positionAtECALEntrance().eta()*pfcandidate->energy();
00539        sumEnergy += pfcandidate->energy();
00540   }
00541   if(sumEnergy>0)TauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
00542 
00543   Float_t TauPhi = thePFTau.phi();
00544   Float_t TauPt = thePFTau.pt();
00545   Float_t TauSignalPFChargedCands = thePFTau.signalPFChargedHadrCands().size();
00546   Float_t TauSignalPFGammaCands = thePFTau.signalPFGammaCands().size();
00547   Float_t TauLeadPFChargedHadrHoP = 0.;
00548   Float_t TauLeadPFChargedHadrEoP = 0.;
00549   if ( thePFTau.leadPFChargedHadrCand()->p() > 0. ) {
00550     TauLeadPFChargedHadrHoP = thePFTau.leadPFChargedHadrCand()->hcalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
00551     TauLeadPFChargedHadrEoP = thePFTau.leadPFChargedHadrCand()->ecalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
00552   }
00553   Float_t TauHasGsf = thePFTau.leadPFChargedHadrCand()->gsfTrackRef().isNonnull();
00554   Float_t TauVisMass = thePFTau.mass();
00555   Float_t TauEmFraction = TMath::Max(thePFTau.emFraction(), (Float_t)0.);
00556   std::vector<Float_t> GammasdEta;
00557   std::vector<Float_t> GammasdPhi;
00558   std::vector<Float_t> GammasPt;
00559   for ( unsigned i = 0 ; i < thePFTau.signalPFGammaCands().size(); ++i ) {
00560     reco::PFCandidateRef gamma = thePFTau.signalPFGammaCands().at(i);
00561     if ( thePFTau.leadPFChargedHadrCand().isNonnull() ) {
00562       GammasdEta.push_back(gamma->eta() - thePFTau.leadPFChargedHadrCand()->eta());
00563       GammasdPhi.push_back(gamma->phi() - thePFTau.leadPFChargedHadrCand()->phi());
00564     } else {
00565       GammasdEta.push_back(gamma->eta() - thePFTau.eta());
00566       GammasdPhi.push_back(gamma->phi() - thePFTau.phi());
00567     }
00568     GammasPt.push_back(gamma->pt());
00569   }
00570 
00571   Float_t ElecEta = theGsfEle.eta();
00572   Float_t ElecPhi = theGsfEle.phi();
00573   Float_t ElecPt = theGsfEle.pt();
00574   Float_t ElecPFMvaOutput = theGsfEle.mvaOutput().mva;
00575   //Variables related to the electron Cluster
00576   Float_t ElecEe = 0.;
00577   Float_t ElecEgamma = 0.;
00578   reco::SuperClusterRef pfSuperCluster = theGsfEle.pflowSuperCluster();
00579   if ( pfSuperCluster.isNonnull() && pfSuperCluster.isAvailable() ) {
00580     for ( reco::CaloCluster_iterator pfCluster = pfSuperCluster->clustersBegin();
00581           pfCluster != pfSuperCluster->clustersEnd(); ++pfCluster ) {
00582       double pfClusterEn = (*pfCluster)->energy();
00583       if ( pfCluster == pfSuperCluster->clustersBegin() ) Elec_Ee_ += pfClusterEn;
00584       else Elec_Egamma_ += pfClusterEn;
00585     }
00586   }
00587   Float_t ElecPin = TMath::Sqrt(theGsfEle.trackMomentumAtVtx().Mag2());
00588   Float_t ElecPout = TMath::Sqrt(theGsfEle.trackMomentumOut().Mag2());
00589   Float_t ElecEarlyBrem = theGsfEle.mvaInput().earlyBrem;
00590   Float_t ElecLateBrem = theGsfEle.mvaInput().lateBrem;
00591   Float_t ElecFbrem = theGsfEle.fbrem();
00592   //Variables related to the CtfTrack
00593   Float_t ElecChi2KF = -99.;
00594   Float_t ElecNumHits = -99.;
00595   if ( theGsfEle.closestCtfTrackRef().isNonnull() ) {
00596     ElecChi2KF = theGsfEle.closestCtfTrackRef()->normalizedChi2();
00597     ElecNumHits = theGsfEle.closestCtfTrackRef()->numberOfValidHits();
00598   }
00599   //Variables related to the GsfTrack
00600   Float_t ElecChi2GSF = -99.;
00601   Float_t ElecGSFTrackResol = -99.;
00602   Float_t ElecGSFTracklnPt = -99.;
00603   Float_t ElecGSFTrackEta = -99.;
00604   if ( theGsfEle.gsfTrack().isNonnull() ) {
00605     ElecChi2GSF = (theGsfEle).gsfTrack()->normalizedChi2();
00606     if ( theGsfEle.gsfTrack()->pt() > 0. ) {
00607       ElecGSFTrackResol = theGsfEle.gsfTrack()->ptError()/theGsfEle.gsfTrack()->pt();
00608       ElecGSFTracklnPt = log(theGsfEle.gsfTrack()->pt())*TMath::Ln10();
00609     }
00610     ElecGSFTrackEta = theGsfEle.gsfTrack()->eta();
00611   }
00612 
00613   return MVAValue(TauEtaAtEcalEntrance,
00614                   TauPhi,
00615                   TauPt,
00616                   TauSignalPFChargedCands,
00617                   TauSignalPFGammaCands,
00618                   TauLeadPFChargedHadrHoP,
00619                   TauLeadPFChargedHadrEoP,
00620                   TauHasGsf,
00621                   TauVisMass,
00622                   TauEmFraction,
00623                   GammasdEta,
00624                   GammasdPhi,
00625                   GammasPt,
00626                   ElecEta,
00627                   ElecPhi,
00628                   ElecPt,
00629                   ElecPFMvaOutput,
00630                   ElecEe,
00631                   ElecEgamma,
00632                   ElecPin,
00633                   ElecPout,
00634                   ElecEarlyBrem,
00635                   ElecLateBrem,
00636                   ElecFbrem,
00637                   ElecChi2KF,
00638                   ElecChi2GSF,
00639                   ElecNumHits,
00640                   ElecGSFTrackResol,
00641                   ElecGSFTracklnPt,
00642                   ElecGSFTrackEta);
00643 }
00644 
00645 double AntiElectronIDMVA2::MVAValue(const reco::PFTau& thePFTau)
00646 {
00647   float sumEtaTimesEnergy = 0;
00648   float sumEnergy = 0;
00649   Float_t TauEtaAtEcalEntrance =0;
00650   for(unsigned int j = 0 ; j < (thePFTau.signalPFCands()).size() ; j++){
00651        reco::PFCandidateRef pfcandidate = (thePFTau.signalPFCands()).at(j);
00652        sumEtaTimesEnergy += pfcandidate->positionAtECALEntrance().eta()*pfcandidate->energy();
00653        sumEnergy += pfcandidate->energy();
00654   }
00655   if(sumEnergy>0)TauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
00656 
00657   Float_t TauPhi = thePFTau.phi();
00658   Float_t TauPt = thePFTau.pt();
00659   Float_t TauSignalPFChargedCands = thePFTau.signalPFChargedHadrCands().size();
00660   Float_t TauSignalPFGammaCands = thePFTau.signalPFGammaCands().size();
00661   Float_t TauLeadPFChargedHadrHoP = 0.;
00662   Float_t TauLeadPFChargedHadrEoP = 0.;
00663   if ( thePFTau.leadPFChargedHadrCand()->p() > 0. ) {
00664     TauLeadPFChargedHadrHoP = thePFTau.leadPFChargedHadrCand()->hcalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
00665     TauLeadPFChargedHadrEoP = thePFTau.leadPFChargedHadrCand()->ecalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
00666   }
00667   Float_t TauHasGsf = thePFTau.leadPFChargedHadrCand()->gsfTrackRef().isNonnull();
00668   Float_t TauVisMass = thePFTau.mass();
00669   Float_t TauEmFraction = TMath::Max(thePFTau.emFraction(), (Float_t)0.);
00670   std::vector<Float_t> GammasdEta;
00671   std::vector<Float_t> GammasdPhi;
00672   std::vector<Float_t> GammasPt;
00673   for ( unsigned i = 0 ; i < thePFTau.signalPFGammaCands().size(); ++i ) {
00674     reco::PFCandidateRef gamma = thePFTau.signalPFGammaCands().at(i);
00675     if ( thePFTau.leadPFChargedHadrCand().isNonnull() ) {
00676       GammasdEta.push_back(gamma->eta() - thePFTau.leadPFChargedHadrCand()->eta());
00677       GammasdPhi.push_back(gamma->phi() - thePFTau.leadPFChargedHadrCand()->phi());
00678     } else {
00679       GammasdEta.push_back(gamma->eta() - thePFTau.eta());
00680       GammasdPhi.push_back(gamma->phi() - thePFTau.phi());
00681     }
00682     GammasPt.push_back(gamma->pt());
00683   }
00684 
00685   Float_t dummyElecEta = 9.9;
00686 
00687   return MVAValue(TauEtaAtEcalEntrance,
00688                   TauPhi,
00689                   TauPt,
00690                   TauSignalPFChargedCands,
00691                   TauSignalPFGammaCands,
00692                   TauLeadPFChargedHadrHoP,
00693                   TauLeadPFChargedHadrEoP,
00694                   TauHasGsf,
00695                   TauVisMass,
00696                   TauEmFraction,
00697                   GammasdEta,
00698                   GammasdPhi,
00699                   GammasPt,
00700                   dummyElecEta,
00701                   0.,
00702                   0.,
00703                   0.,
00704                   0.,
00705                   0.,
00706                   0.,
00707                   0.,
00708                   0.,
00709                   0.,
00710                   0.,
00711                   0.,
00712                   0.,
00713                   0.,
00714                   0.,
00715                   0.,
00716                   0.);
00717 }