ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Utils/src/MVATools.cc
(Generate patch)

Comparing UserCode/MitPhysics/Utils/src/MVATools.cc (file contents):
Revision 1.18 by fabstoec, Thu Aug 2 13:57:32 2012 UTC vs.
Revision 1.22 by mingyang, Sat Nov 9 15:06:27 2013 UTC

# Line 198 | Line 198 | void MVATools::InitializeMVA(MVATools::I
198      mvaVarMapEE.insert( std::pair<std::string,unsigned int> ( varNames[mvaVars.size() - 1], mvaVars.size() - 1) );
199  
200      break;
201 +
202 +  case k2013FinalIdMVA_8TeV:
203 +    
204 +    EndcapWeights =      (gSystem->Getenv("CMSSW_BASE")+
205 +                          TString("/src/MitPhysics/data/2013FinalPaper_PhotonID_Weight/8TeV/")+
206 +                          TString("2013FinalPaper_PhotonID_Endcap_BDT_TrainRangePT15_8TeV.")+
207 +                          TString("weights.xml"));
208 +    BarrelWeights =      (gSystem->Getenv("CMSSW_BASE")+
209 +                          TString("/src/MitPhysics/data/2013FinalPaper_PhotonID_Weight/8TeV/")+
210 +                          TString("2013FinalPaper_PhotonID_Barrel_BDT_TrainRangePT15_8TeV.")+
211 +                          TString("weights.xml"));
212 +
213 +    mvaVars.resize(13);
214 +    varNames.push_back("ph.scrawe"                    );
215 +    varNames.push_back("ph.r9"                        );
216 +    varNames.push_back("ph.sigietaieta"               );
217 +    varNames.push_back("ph.scetawidth"                );
218 +    varNames.push_back("ph.scphiwidth"                );
219 +    varNames.push_back("ph.idmva_CoviEtaiPhi"         );
220 +    varNames.push_back("ph.idmva_s4ratio"             );
221 +    varNames.push_back("ph.idmva_GammaIso"            );
222 +    varNames.push_back("ph.idmva_ChargedIso_selvtx"   );
223 +    varNames.push_back("ph.idmva_ChargedIso_worstvtx" );
224 +    varNames.push_back("ph.sceta"                     );
225 +    varNames.push_back("rho"                          );
226 +    varNames.push_back("ph.idmva_PsEffWidthSigmaRR"   );
227 +
228 +    for( unsigned int iV = 0; iV < mvaVars.size() - 1; ++iV) {
229 +      mvaVarMapEB.insert(  std::pair<std::string,unsigned int>(varNames[iV], iV) );
230 +      mvaVarMapEE.insert(  std::pair<std::string,unsigned int>(varNames[iV], iV) );
231 +    }
232 +    
233 +    // pre-shower only used for Endcaps
234 +    mvaVarMapEE.insert( std::pair<std::string,unsigned int> ( varNames[mvaVars.size() - 1], mvaVars.size() - 1) );
235 +
236 +    break;
237 +
238 +  case k2013FinalIdMVA_7TeV:
239 +    
240 +    EndcapWeights =      (gSystem->Getenv("CMSSW_BASE")+
241 +                          TString("/src/MitPhysics/data/2013FinalPaper_PhotonID_Weight/7TeV/")+
242 +                          TString("2013FinalPaper_PhotonID_Endcap_BDT_TrainRangePT15_7TeV.")+
243 +                          TString("weights.xml"));
244 +    BarrelWeights =      (gSystem->Getenv("CMSSW_BASE")+
245 +                          TString("/src/MitPhysics/data/2013FinalPaper_PhotonID_Weight/7TeV/")+
246 +                          TString("2013FinalPaper_PhotonID_Barrel_BDT_TrainRangePT15_7TeV.")+
247 +                          TString("weights.xml"));
248 +
249 +    mvaVars.resize(13);
250 +    varNames.push_back("ph.scrawe"                    );
251 +    varNames.push_back("ph.r9"                        );
252 +    varNames.push_back("ph.sigietaieta"               );
253 +    varNames.push_back("ph.scetawidth"                );
254 +    varNames.push_back("ph.scphiwidth"                );
255 +    varNames.push_back("ph.idmva_CoviEtaiPhi"         );
256 +    varNames.push_back("ph.idmva_s4ratio"             );
257 +    varNames.push_back("ph.idmva_GammaIso"            );
258 +    varNames.push_back("ph.idmva_ChargedIso_selvtx"   );
259 +    varNames.push_back("ph.idmva_ChargedIso_worstvtx" );
260 +    varNames.push_back("ph.sceta"                     );
261 +    varNames.push_back("rho"                          );
262 +    varNames.push_back("ph.idmva_PsEffWidthSigmaRR"   );
263 +
264 +    for( unsigned int iV = 0; iV < mvaVars.size() - 1; ++iV) {
265 +      mvaVarMapEB.insert(  std::pair<std::string,unsigned int>(varNames[iV], iV) );
266 +      mvaVarMapEE.insert(  std::pair<std::string,unsigned int>(varNames[iV], iV) );
267 +    }
268 +    
269 +    // pre-shower only used for Endcaps
270 +    mvaVarMapEE.insert( std::pair<std::string,unsigned int> ( varNames[mvaVars.size() - 1], mvaVars.size() - 1) );
271 +
272 +    break;
273      
274    default:
275      // no variables... better never called..
# Line 460 | Line 532 | void MVATools::InitializeMVA(MVATools::I
532   Double_t MVATools::GetMVAbdtValue(const Photon* p, const Vertex* vtx, const TrackCol* trackCol, const VertexCol* vtxCol, Double_t _tRho, const PFCandidateCol *fPFCands, const ElectronCol* els, Bool_t applyElectronVeto) {
533  
534    // if there's no reader, or the type is kNone, return the default values of -99.
535 +  //if( ( !fReaderBarrel || !fReaderEndcap ) ) return -199.;
536    if( ( !fReaderBarrel || !fReaderEndcap ) || fMVAType == kNone ) return -99.;
537  
538    // we compute the variable names... make sure no confilcts when adding new variables...
# Line 467 | Line 540 | Double_t MVATools::GetMVAbdtValue(const
540    // check if it's a Barrel or EE photon
541    bool isBarrel = ( p->SCluster()->AbsEta() < 1.5 );
542  
543 <  std::map<std::string,unsigned int>* theVars = ( isBarrel ? &mvaVarMapEB : &mvaVarMapEB );  
543 >  std::map<std::string,unsigned int>* theVars = ( isBarrel ? &mvaVarMapEB : &mvaVarMapEE );  
544    
545    // loop over all the variables in the map... and keep count (to make sure we have filled all variables)
546    unsigned int varCounter = 0;
# Line 561 | Line 634 | Double_t MVATools::GetMVAbdtValue(const
634                 !theVarName.CompareTo("ph.idmva_s4ratio") || !theVarName.CompareTo("s4r")
635                 ) {
636        (*theVarValue) = p->S4Ratio();
637 +      //(*theVarValue) = p->SCluster()->Seed()->E2x2()/p->E55();
638        varCounter++;
639      } else if (
640                 !theVarName.CompareTo("ph.idmva_GammaIso") || !theVarName.CompareTo("pfgiso")
# Line 584 | Line 658 | Double_t MVATools::GetMVAbdtValue(const
658        (*theVarValue) = p->EffSigmaRR();
659        varCounter++;
660      } else if (
661 <               !theVarName.CompareTo("rawe")
661 >               !theVarName.CompareTo("rawe")|| !theVarName.CompareTo("ph.scrawe")
662                 ) {
663        (*theVarValue) = p->SCluster()->RawEnergy();
664        varCounter++;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines