7 isInitialized_(kFALSE),
52 TMVA::Reader *readerX0BL =
new TMVA::Reader(
"!Color:Silent:Error" );
59 TMVA::Reader *reader11BL =
new TMVA::Reader(
"!Color:Silent:Error" );
62 reader11BL->AddVariable(
"etaMom2*TMath::Sqrt(gammaFrac)*pt", &
GammadEta_);
63 reader11BL->AddVariable(
"phiMom2*TMath::Sqrt(gammaFrac)*pt", &
GammadPhi_);
64 reader11BL->AddVariable(
"gammaFrac", &
GammadPt_);
68 TMVA::Reader *reader01BL =
new TMVA::Reader(
"!Color:Silent:Error" );
70 reader01BL->AddVariable(
"etaMom2*TMath::Sqrt(gammaFrac)*pt", &
GammadEta_);
71 reader01BL->AddVariable(
"phiMom2*TMath::Sqrt(gammaFrac)*pt", &
GammadPhi_);
72 reader01BL->AddVariable(
"gammaFrac", &
GammadPt_);
78 TMVA::Reader *readerX0EC =
new TMVA::Reader(
"!Color:Silent:Error" );
85 TMVA::Reader *reader11EC =
new TMVA::Reader(
"!Color:Silent:Error" );
88 reader11EC->AddVariable(
"etaMom2*TMath::Sqrt(gammaFrac)*pt", &
GammadEta_);
89 reader11EC->AddVariable(
"phiMom2*TMath::Sqrt(gammaFrac)*pt", &
GammadPhi_);
90 reader11EC->AddVariable(
"gammaFrac", &
GammadPt_);
94 TMVA::Reader *reader01EC =
new TMVA::Reader(
"!Color:Silent:Error" );
96 reader01EC->AddVariable(
"etaMom2*TMath::Sqrt(gammaFrac)*pt", &
GammadEta_);
97 reader01EC->AddVariable(
"phiMom2*TMath::Sqrt(gammaFrac)*pt", &
GammadPhi_);
98 reader01EC->AddVariable(
"gammaFrac", &
GammadPt_);
112 Float_t TauSignalPFChargedCands, Float_t TauSignalPFGammaCands,
113 Float_t TauLeadPFChargedHadrMva,
114 Float_t TauLeadPFChargedHadrHoP, Float_t TauLeadPFChargedHadrEoP,
115 Float_t TauHasGsf, Float_t TauVisMass, Float_t TauEmFraction,
116 std::vector<Float_t>* GammasdEta, std::vector<Float_t>* GammasdPhi, std::vector<Float_t>* GammasPt
120 std::cout <<
"Error: AntiElectronMVA with method 1 not properly initialized.\n";
139 for(
unsigned int k = 0 ;
k < GammasPt->size() ;
k++){
140 float pt_k = (*GammasPt)[
k];
141 float phi_k = (*GammasdPhi)[
k];
144 float eta_k = (*GammasdEta)[
k];
146 sumPt2 += (pt_k*pt_k);
147 dEta += (pt_k*eta_k);
148 dEta2 += (pt_k*eta_k*eta_k);
149 dPhi += (pt_k*phi_k);
150 dPhi2 += (pt_k*phi_k*phi_k);
170 if( TauSignalPFChargedCands==3 )
172 else if( TauSignalPFChargedCands==1 && TauSignalPFGammaCands==0){
173 if(TMath::Abs(TauEta)<1.5)
178 else if( TauSignalPFChargedCands==1 && TauSignalPFGammaCands>0 && TauHasGsf>0.5){
179 if(TMath::Abs(TauEta)<1.5)
184 else if( TauSignalPFChargedCands==1 && TauSignalPFGammaCands>0 && TauHasGsf<0.5){
185 if(TMath::Abs(TauEta)<1.5)
199 Float_t TauSignalPFChargedCands, Float_t TauSignalPFGammaCands,
200 Float_t TauLeadPFChargedHadrMva,
201 Float_t TauLeadPFChargedHadrHoP, Float_t TauLeadPFChargedHadrEoP,
202 Float_t TauHasGsf, Float_t TauVisMass, Float_t TauEmFraction,
203 Float_t GammaEtaMom, Float_t GammaPhiMom, Float_t GammaEnFrac
207 std::cout <<
"Error: AntiElectronMVA with method 2 not properly initialized.\n";
223 if( TauSignalPFChargedCands==3 )
225 else if( TauSignalPFChargedCands==1 && TauSignalPFGammaCands==0){
226 if(TMath::Abs(TauEta)<1.5)
231 else if( TauSignalPFChargedCands==1 && TauSignalPFGammaCands>0 && TauHasGsf>0.5){
232 if(TMath::Abs(TauEta)<1.5)
237 else if( TauSignalPFChargedCands==1 && TauSignalPFGammaCands>0 && TauHasGsf<0.5){
238 if(TMath::Abs(TauEta)<1.5)
256 std::cout <<
"Error: AntiElectronMVA with method 3 not properly initialized.\n";
264 TauLeadPFChargedHadrHoP_ = ((*thePFTauRef).leadPFChargedHadrCand())->hcalEnergy()/(*thePFTauRef).leadPFChargedHadrCand()->p();
265 TauLeadPFChargedHadrEoP_ = ((*thePFTauRef).leadPFChargedHadrCand())->ecalEnergy()/(*thePFTauRef).leadPFChargedHadrCand()->p();
268 std::vector<float> GammasdEta;
269 std::vector<float> GammasdPhi;
270 std::vector<float> GammasPt;
272 for(
unsigned int k = 0 ;
k < ((*thePFTauRef).signalPFGammaCands()).
size() ;
k++){
274 if( ((*thePFTauRef).leadPFChargedHadrCand()).isNonnull() ){
275 GammasdEta.push_back( gamma->eta() - (*thePFTauRef).leadPFChargedHadrCand()->eta() );
276 GammasdPhi.push_back( gamma->phi() - (*thePFTauRef).leadPFChargedHadrCand()->phi() );
279 GammasdEta.push_back( gamma->eta() - (*thePFTauRef).eta() );
280 GammasdPhi.push_back( gamma->phi() - (*thePFTauRef).phi() );
282 GammasPt.push_back( gamma->pt() );
292 for(
unsigned int k = 0 ;
k < GammasPt.size() ;
k++){
293 float pt_k = GammasPt[
k];
294 float phi_k = GammasdPhi[
k];
297 float eta_k = GammasdEta[
k];
299 sumPt2 += (pt_k*pt_k);
300 dEta += (pt_k*eta_k);
301 dEta2 += (pt_k*eta_k*eta_k);
302 dPhi += (pt_k*phi_k);
303 dPhi2 += (pt_k*phi_k*phi_k);
321 if( ((*thePFTauRef).signalPFChargedHadrCands()).
size() == 3)
323 else if( ((*thePFTauRef).signalPFChargedHadrCands()).
size()==1 && ((*thePFTauRef).signalPFGammaCands()).
size()==0){
324 if(TMath::Abs((*thePFTauRef).eta())<1.5)
329 else if( ((*thePFTauRef).signalPFChargedHadrCands()).
size()==1 && ((*thePFTauRef).signalPFGammaCands()).
size()>0 && (((*thePFTauRef).leadPFChargedHadrCand())->gsfTrackRef()).isNonnull()){
330 if(TMath::Abs((*thePFTauRef).eta())<1.5)
335 else if( ((*thePFTauRef).signalPFChargedHadrCands()).
size()==1 && ((*thePFTauRef).signalPFGammaCands()).
size()>0 && !(((*thePFTauRef).leadPFChargedHadrCand())->gsfTrackRef()).isNonnull()){
336 if(TMath::Abs((*thePFTauRef).eta())<1.5)
Float_t TauLeadPFChargedHadrMva_
Float_t TauLeadPFChargedHadrHoP_
double MVAValue(Float_t TauEta, Float_t TauPt, Float_t TauSignalPFChargedCands, Float_t TauSignalPFGammaCands, Float_t TauLeadPFChargedHadrMva, Float_t TauLeadPFChargedHadrHoP, Float_t TauLeadPFChargedHadrEoP, Float_t TauHasGsf, Float_t TauVisMass, Float_t TauEmFraction, std::vector< Float_t > *GammasdEta, std::vector< Float_t > *GammasdPhi, std::vector< Float_t > *GammasPt)
TMVA::Reader * fTMVAReader_[6]
Float_t TauLeadPFChargedHadrEoP_
Float_t TauSignalPFGammaCands_
double dPhi(double phi1, double phi2)
void Initialize(std::string methodName, std::string oneProng0Pi0_BL, std::string oneProng1pi0wGSF_BL, std::string oneProng1pi0woGSF_BL, std::string oneProng0Pi0_EC, std::string oneProng1pi0wGSF_EC, std::string oneProng1pi0woGSF_EC)
tuple size
Write out results.
void loadTMVAWeights(TMVA::Reader *reader, const std::string &method, const std::string &weightFile, bool verbose=false)