CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes
MuonIDMVA Class Reference

#include <MuonIDMVA.h>

Public Types

enum  EMuonEffectiveAreaType {
  kMuChargedIso03, kMuNeutralIso03, kMuChargedIso04, kMuNeutralIso04,
  kMuHadEnergy, kMuHoEnergy, kMuEmEnergy, kMuHadS9Energy,
  kMuHoS9Energy, kMuEmS9Energy, kMuTrkIso03, kMuEMIso03,
  kMuHadIso03, kMuTrkIso05, kMuEMIso05, kMuHadIso05
}
 

Public Member Functions

void Initialize (TString methodName, unsigned int version, TString Subdet0Pt10To14p5Weights, TString Subdet1Pt10To14p5Weights, TString Subdet0Pt14p5To20Weights, TString Subdet1Pt14p5To20Weights, TString Subdet0Pt20ToInfWeights, TString Subdet1Pt20ToInfWeights)
 
Bool_t IsInitialized () const
 
 MuonIDMVA ()
 
Double_t MVAValue (HWW &, const unsigned int mu, const unsigned int vertex)
 
Double_t MVAValue (Double_t MuPt, Double_t MuEta, Double_t MuTkNchi2, Double_t MuGlobalNchi2, Double_t MuNValidHits, Double_t MuNTrackerHits, Double_t MuNPixelHits, Double_t MuNMatches, Double_t MuD0, Double_t MuIP3d, Double_t MuIP3dSig, Double_t MuTrkKink, Double_t MuSegmentCompatibility, Double_t MuCaloCompatibility, Double_t MuHadEnergyOverPt, Double_t MuHoEnergyOverPt, Double_t MuEmEnergyOverPt, Double_t MuHadS9EnergyOverPt, Double_t MuHoS9EnergyOverPt, Double_t MuEmS9EnergyOverPt, Double_t MuTrkIso03OverPt, Double_t MuEMIso03OverPt, Double_t MuHadIso03OverPt, Double_t MuTrkIso05OverPt, Double_t MuEMIso05OverPt, Double_t MuHadIso05OverPt, Bool_t printDebug=kFALSE)
 
 ~MuonIDMVA ()
 

Static Public Member Functions

static const Double_t MuonEffectiveArea (EMuonEffectiveAreaType type, Double_t Eta)
 

Protected Attributes

Bool_t fIsInitialized
 
TString fMethodname
 
Float_t fMVAVar_MuCaloCompatibility
 
Float_t fMVAVar_MuChargedIso03OverPt
 
Float_t fMVAVar_MuChargedIso04OverPt
 
Float_t fMVAVar_MuD0
 
Float_t fMVAVar_MuEmEnergyOverPt
 
Float_t fMVAVar_MuEMIso03OverPt
 
Float_t fMVAVar_MuEMIso05OverPt
 
Float_t fMVAVar_MuEmS9EnergyOverPt
 
Float_t fMVAVar_MuGlobalNchi2
 
Float_t fMVAVar_MuHadEnergyOverPt
 
Float_t fMVAVar_MuHadIso03OverPt
 
Float_t fMVAVar_MuHadIso05OverPt
 
Float_t fMVAVar_MuHadS9EnergyOverPt
 
Float_t fMVAVar_MuHoEnergyOverPt
 
Float_t fMVAVar_MuHoS9EnergyOverPt
 
Float_t fMVAVar_MuIP3d
 
Float_t fMVAVar_MuIP3dSig
 
Float_t fMVAVar_MuNeutralIso03OverPt
 
Float_t fMVAVar_MuNeutralIso04OverPt
 
Float_t fMVAVar_MuNMatches
 
Float_t fMVAVar_MuNPixelHits
 
Float_t fMVAVar_MuNTrackerHits
 
Float_t fMVAVar_MuNValidHits
 
Float_t fMVAVar_MuSegmentCompatibility
 
Float_t fMVAVar_MuTkNchi2
 
Float_t fMVAVar_MuTrkIso03OverPt
 
Float_t fMVAVar_MuTrkIso05OverPt
 
Float_t fMVAVar_MuTrkKink
 
TMVA::Reader * fTMVAReader [6]
 

Detailed Description

Definition at line 24 of file MuonIDMVA.h.

Member Enumeration Documentation

Enumerator
kMuChargedIso03 
kMuNeutralIso03 
kMuChargedIso04 
kMuNeutralIso04 
kMuHadEnergy 
kMuHoEnergy 
kMuEmEnergy 
kMuHadS9Energy 
kMuHoS9Energy 
kMuEmS9Energy 
kMuTrkIso03 
kMuEMIso03 
kMuHadIso03 
kMuTrkIso05 
kMuEMIso05 
kMuHadIso05 

Definition at line 68 of file MuonIDMVA.h.

Constructor & Destructor Documentation

MuonIDMVA::MuonIDMVA ( )

Definition at line 15 of file MuonIDMVA.cc.

References fTMVAReader, and i.

15  :
16  fMethodname("BDTG method"),
17  fIsInitialized(kFALSE)
18 {
19  // Constructor.
20  for(UInt_t i=0; i<6; ++i) {
21  fTMVAReader[i] = 0;
22  }
23 }
int i
Definition: DBlmapReader.cc:9
TString fMethodname
Definition: MuonIDMVA.h:182
Bool_t fIsInitialized
Definition: MuonIDMVA.h:183
TMVA::Reader * fTMVAReader[6]
Definition: MuonIDMVA.h:181
MuonIDMVA::~MuonIDMVA ( )

Definition at line 27 of file MuonIDMVA.cc.

References fTMVAReader, and i.

28 {
29  for(UInt_t i=0; i<6; ++i) {
30  if (fTMVAReader[i]) delete fTMVAReader[i];
31  }
32 }
int i
Definition: DBlmapReader.cc:9
TMVA::Reader * fTMVAReader[6]
Definition: MuonIDMVA.h:181

Member Function Documentation

void MuonIDMVA::Initialize ( TString  methodName,
unsigned int  version,
TString  Subdet0Pt10To14p5Weights,
TString  Subdet1Pt10To14p5Weights,
TString  Subdet0Pt14p5To20Weights,
TString  Subdet1Pt14p5To20Weights,
TString  Subdet0Pt20ToInfWeights,
TString  Subdet1Pt20ToInfWeights 
)

Definition at line 35 of file MuonIDMVA.cc.

References fIsInitialized, fMethodname, fMVAVar_MuCaloCompatibility, fMVAVar_MuD0, fMVAVar_MuEmEnergyOverPt, fMVAVar_MuEMIso03OverPt, fMVAVar_MuEMIso05OverPt, fMVAVar_MuEmS9EnergyOverPt, fMVAVar_MuGlobalNchi2, fMVAVar_MuHadEnergyOverPt, fMVAVar_MuHadIso03OverPt, fMVAVar_MuHadIso05OverPt, fMVAVar_MuHadS9EnergyOverPt, fMVAVar_MuIP3d, fMVAVar_MuIP3dSig, fMVAVar_MuNMatches, fMVAVar_MuNPixelHits, fMVAVar_MuNTrackerHits, fMVAVar_MuNValidHits, fMVAVar_MuSegmentCompatibility, fMVAVar_MuTkNchi2, fMVAVar_MuTrkIso03OverPt, fMVAVar_MuTrkIso05OverPt, fMVAVar_MuTrkKink, fTMVAReader, and i.

41  {
42 
43  if (version != 1) {
44  edm::LogError("InvalidInput") << "[MuonIDMVA::Initialize] Version must be 1. Aborting.";
45  return;
46  }
47 
48  fIsInitialized = kTRUE;
49  fMethodname = methodName;
50 
51  for(UInt_t i=0; i<6; ++i) {
52  if (fTMVAReader[i]) delete fTMVAReader[i];
53 
54  fTMVAReader[i] = new TMVA::Reader( "!Color:!Silent:Error" );
55  fTMVAReader[i]->SetVerbose(kTRUE);
56 
57  // order matters!
58  if (version == 1) {
59  fTMVAReader[i]->AddVariable( "TkNchi2", &fMVAVar_MuTkNchi2 );
60  fTMVAReader[i]->AddVariable( "GlobalNchi2", &fMVAVar_MuGlobalNchi2 );
61  fTMVAReader[i]->AddVariable( "NValidHits", &fMVAVar_MuNValidHits );
62  fTMVAReader[i]->AddVariable( "NTrackerHits", &fMVAVar_MuNTrackerHits );
63  fTMVAReader[i]->AddVariable( "NPixelHits", &fMVAVar_MuNPixelHits );
64  fTMVAReader[i]->AddVariable( "NMatches", &fMVAVar_MuNMatches );
65  fTMVAReader[i]->AddVariable( "D0", &fMVAVar_MuD0 );
66  fTMVAReader[i]->AddVariable( "IP3d", &fMVAVar_MuIP3d );
67  fTMVAReader[i]->AddVariable( "IP3dSig", &fMVAVar_MuIP3dSig );
68  fTMVAReader[i]->AddVariable( "TrkKink", &fMVAVar_MuTrkKink );
69  fTMVAReader[i]->AddVariable( "SegmentCompatibility", &fMVAVar_MuSegmentCompatibility );
70  fTMVAReader[i]->AddVariable( "CaloCompatibility", &fMVAVar_MuCaloCompatibility );
71  fTMVAReader[i]->AddVariable( "HadEnergyOverPt", &fMVAVar_MuHadEnergyOverPt );
72  fTMVAReader[i]->AddVariable( "EmEnergyOverPt", &fMVAVar_MuEmEnergyOverPt );
73  fTMVAReader[i]->AddVariable( "HadS9EnergyOverPt", &fMVAVar_MuHadS9EnergyOverPt );
74  fTMVAReader[i]->AddVariable( "EmS9EnergyOverPt", &fMVAVar_MuEmS9EnergyOverPt );
75  fTMVAReader[i]->AddVariable( "TrkIso03OverPt", &fMVAVar_MuTrkIso03OverPt );
76  fTMVAReader[i]->AddVariable( "EMIso03OverPt", &fMVAVar_MuEMIso03OverPt );
77  fTMVAReader[i]->AddVariable( "HadIso03OverPt", &fMVAVar_MuHadIso03OverPt );
78  fTMVAReader[i]->AddVariable( "TrkIso05OverPt", &fMVAVar_MuTrkIso05OverPt );
79  fTMVAReader[i]->AddVariable( "EMIso05OverPt", &fMVAVar_MuEMIso05OverPt );
80  fTMVAReader[i]->AddVariable( "HadIso05OverPt", &fMVAVar_MuHadIso05OverPt );
81  }
82 
83  if (i==0) fTMVAReader[i]->BookMVA(fMethodname , Subdet0Pt10To14p5Weights );
84  if (i==1) fTMVAReader[i]->BookMVA(fMethodname , Subdet1Pt10To14p5Weights );
85  if (i==2) fTMVAReader[i]->BookMVA(fMethodname , Subdet0Pt14p5To20Weights );
86  if (i==3) fTMVAReader[i]->BookMVA(fMethodname , Subdet1Pt14p5To20Weights );
87  if (i==4) fTMVAReader[i]->BookMVA(fMethodname , Subdet0Pt20ToInfWeights );
88  if (i==5) fTMVAReader[i]->BookMVA(fMethodname , Subdet1Pt20ToInfWeights );
89 
90  }
91 }
Float_t fMVAVar_MuEMIso05OverPt
Definition: MuonIDMVA.h:211
Float_t fMVAVar_MuIP3dSig
Definition: MuonIDMVA.h:193
int i
Definition: DBlmapReader.cc:9
Float_t fMVAVar_MuGlobalNchi2
Definition: MuonIDMVA.h:186
Float_t fMVAVar_MuEMIso03OverPt
Definition: MuonIDMVA.h:208
TString fMethodname
Definition: MuonIDMVA.h:182
Bool_t fIsInitialized
Definition: MuonIDMVA.h:183
Float_t fMVAVar_MuCaloCompatibility
Definition: MuonIDMVA.h:196
Float_t fMVAVar_MuHadEnergyOverPt
Definition: MuonIDMVA.h:197
Float_t fMVAVar_MuTrkIso03OverPt
Definition: MuonIDMVA.h:207
Float_t fMVAVar_MuNPixelHits
Definition: MuonIDMVA.h:189
Float_t fMVAVar_MuNMatches
Definition: MuonIDMVA.h:190
Float_t fMVAVar_MuEmS9EnergyOverPt
Definition: MuonIDMVA.h:202
Float_t fMVAVar_MuHadIso05OverPt
Definition: MuonIDMVA.h:212
Float_t fMVAVar_MuTrkKink
Definition: MuonIDMVA.h:194
Float_t fMVAVar_MuD0
Definition: MuonIDMVA.h:191
Float_t fMVAVar_MuTrkIso05OverPt
Definition: MuonIDMVA.h:210
Float_t fMVAVar_MuHadIso03OverPt
Definition: MuonIDMVA.h:209
Float_t fMVAVar_MuSegmentCompatibility
Definition: MuonIDMVA.h:195
Float_t fMVAVar_MuEmEnergyOverPt
Definition: MuonIDMVA.h:199
Float_t fMVAVar_MuHadS9EnergyOverPt
Definition: MuonIDMVA.h:200
TMVA::Reader * fTMVAReader[6]
Definition: MuonIDMVA.h:181
Float_t fMVAVar_MuIP3d
Definition: MuonIDMVA.h:192
Float_t fMVAVar_MuNTrackerHits
Definition: MuonIDMVA.h:188
Float_t fMVAVar_MuNValidHits
Definition: MuonIDMVA.h:187
Float_t fMVAVar_MuTkNchi2
Definition: MuonIDMVA.h:185
Bool_t MuonIDMVA::IsInitialized ( ) const
inline

Definition at line 37 of file MuonIDMVA.h.

References fIsInitialized.

37 { return fIsInitialized; }
Bool_t fIsInitialized
Definition: MuonIDMVA.h:183
static const Double_t MuonIDMVA::MuonEffectiveArea ( EMuonEffectiveAreaType  type,
Double_t  Eta 
)
inlinestatic

Definition at line 87 of file MuonIDMVA.h.

References kMuChargedIso03, kMuChargedIso04, kMuEmEnergy, kMuEMIso03, kMuEMIso05, kMuEmS9Energy, kMuHadEnergy, kMuHadIso03, kMuHadIso05, kMuHadS9Energy, kMuHoEnergy, kMuHoS9Energy, kMuNeutralIso03, kMuNeutralIso04, kMuTrkIso03, and kMuTrkIso05.

Referenced by MVAValue().

87  {
88 
89  Double_t EffectiveArea = 0;
90  if (fabs(Eta) < 1.0) {
91  if (type == kMuChargedIso03) EffectiveArea = 0.000;
92  if (type == kMuNeutralIso03) EffectiveArea = 0.080;
93  if (type == kMuChargedIso04) EffectiveArea = 0.000;
94  if (type == kMuNeutralIso04) EffectiveArea = 0.163;
95  if (type == kMuHadEnergy) EffectiveArea = 0.000;
96  if (type == kMuHoEnergy) EffectiveArea = 0.000;
97  if (type == kMuEmEnergy) EffectiveArea = 0.000;
98  if (type == kMuHadS9Energy) EffectiveArea = 0.016;
99  if (type == kMuHoS9Energy) EffectiveArea = 0.000;
100  if (type == kMuEmS9Energy) EffectiveArea = 0.000;
101  if (type == kMuTrkIso03) EffectiveArea = 0.000;
102  if (type == kMuEMIso03) EffectiveArea = 0.080;
103  if (type == kMuHadIso03) EffectiveArea = 0.025;
104  if (type == kMuTrkIso05) EffectiveArea = 0.000;
105  if (type == kMuEMIso05) EffectiveArea = 0.290;
106  if (type == kMuHadIso05) EffectiveArea = 0.091;
107  } else if (fabs(Eta) >= 1.0 && fabs(Eta) < 1.479 ) {
108  if (type == kMuChargedIso03) EffectiveArea = 0.000;
109  if (type == kMuNeutralIso03) EffectiveArea = 0.083;
110  if (type == kMuChargedIso04) EffectiveArea = 0.000;
111  if (type == kMuNeutralIso04) EffectiveArea = 0.168;
112  if (type == kMuHadEnergy) EffectiveArea = 0.005;
113  if (type == kMuHoEnergy) EffectiveArea = 0.000;
114  if (type == kMuEmEnergy) EffectiveArea = 0.000;
115  if (type == kMuHadS9Energy) EffectiveArea = 0.041;
116  if (type == kMuHoS9Energy) EffectiveArea = 0.000;
117  if (type == kMuEmS9Energy) EffectiveArea = 0.000;
118  if (type == kMuTrkIso03) EffectiveArea = 0.000;
119  if (type == kMuEMIso03) EffectiveArea = 0.043;
120  if (type == kMuHadIso03) EffectiveArea = 0.028;
121  if (type == kMuTrkIso05) EffectiveArea = 0.000;
122  if (type == kMuEMIso05) EffectiveArea = 0.184;
123  if (type == kMuHadIso05) EffectiveArea = 0.106;
124  } else if (fabs(Eta) >= 1.479 && fabs(Eta) < 2.0 ) {
125  if (type == kMuChargedIso03) EffectiveArea = 0.000;
126  if (type == kMuNeutralIso03) EffectiveArea = 0.060;
127  if (type == kMuChargedIso04) EffectiveArea = 0.000;
128  if (type == kMuNeutralIso04) EffectiveArea = 0.131;
129  if (type == kMuHadEnergy) EffectiveArea = 0.020;
130  if (type == kMuHoEnergy) EffectiveArea = 0.000;
131  if (type == kMuEmEnergy) EffectiveArea = 0.000;
132  if (type == kMuHadS9Energy) EffectiveArea = 0.072;
133  if (type == kMuHoS9Energy) EffectiveArea = 0.000;
134  if (type == kMuEmS9Energy) EffectiveArea = 0.000;
135  if (type == kMuTrkIso03) EffectiveArea = 0.000;
136  if (type == kMuEMIso03) EffectiveArea = 0.025;
137  if (type == kMuHadIso03) EffectiveArea = 0.036;
138  if (type == kMuTrkIso05) EffectiveArea = 0.000;
139  if (type == kMuEMIso05) EffectiveArea = 0.124;
140  if (type == kMuHadIso05) EffectiveArea = 0.140;
141  } else if (fabs(Eta) >= 2.0 && fabs(Eta) < 2.25 ) {
142  if (type == kMuChargedIso03) EffectiveArea = 0.000;
143  if (type == kMuNeutralIso03) EffectiveArea = 0.066;
144  if (type == kMuChargedIso04) EffectiveArea = 0.000;
145  if (type == kMuNeutralIso04) EffectiveArea = 0.149;
146  if (type == kMuHadEnergy) EffectiveArea = 0.056;
147  if (type == kMuHoEnergy) EffectiveArea = 0.000;
148  if (type == kMuEmEnergy) EffectiveArea = 0.000;
149  if (type == kMuHadS9Energy) EffectiveArea = 0.148;
150  if (type == kMuHoS9Energy) EffectiveArea = 0.000;
151  if (type == kMuEmS9Energy) EffectiveArea = 0.000;
152  if (type == kMuTrkIso03) EffectiveArea = 0.000;
153  if (type == kMuEMIso03) EffectiveArea = 0.025;
154  if (type == kMuHadIso03) EffectiveArea = 0.050;
155  if (type == kMuTrkIso05) EffectiveArea = 0.000;
156  if (type == kMuEMIso05) EffectiveArea = 0.120;
157  if (type == kMuHadIso05) EffectiveArea = 0.186;
158  } else if (fabs(Eta) >= 2.25 && fabs(Eta) < 2.4 ) {
159  if (type == kMuChargedIso03) EffectiveArea = 0.000;
160  if (type == kMuNeutralIso03) EffectiveArea = 0.098;
161  if (type == kMuChargedIso04) EffectiveArea = 0.000;
162  if (type == kMuNeutralIso04) EffectiveArea = 0.200;
163  if (type == kMuHadEnergy) EffectiveArea = 0.093;
164  if (type == kMuHoEnergy) EffectiveArea = 0.000;
165  if (type == kMuEmEnergy) EffectiveArea = 0.000;
166  if (type == kMuHadS9Energy) EffectiveArea = 0.260;
167  if (type == kMuHoS9Energy) EffectiveArea = 0.000;
168  if (type == kMuEmS9Energy) EffectiveArea = 0.000;
169  if (type == kMuTrkIso03) EffectiveArea = 0.000;
170  if (type == kMuEMIso03) EffectiveArea = 0.027;
171  if (type == kMuHadIso03) EffectiveArea = 0.060;
172  if (type == kMuTrkIso05) EffectiveArea = 0.000;
173  if (type == kMuEMIso05) EffectiveArea = 0.139;
174  if (type == kMuHadIso05) EffectiveArea = 0.228;
175  }
176  return EffectiveArea;
177  }
type
Definition: HCALResponse.h:21
Double_t MuonIDMVA::MVAValue ( HWW hww,
const unsigned int  mu,
const unsigned int  vertex 
)

Definition at line 211 of file MuonIDMVA.cc.

References assert(), HWW::evt_event(), HWW::evt_lumiBlock(), HWW::evt_run(), HWW::evt_ww_rho_vor(), plotBeamSpotDB::first, fIsInitialized, fMethodname, fMVAVar_MuCaloCompatibility, fMVAVar_MuD0, fMVAVar_MuEmEnergyOverPt, fMVAVar_MuEMIso03OverPt, fMVAVar_MuEMIso05OverPt, fMVAVar_MuEmS9EnergyOverPt, fMVAVar_MuGlobalNchi2, fMVAVar_MuHadEnergyOverPt, fMVAVar_MuHadIso03OverPt, fMVAVar_MuHadIso05OverPt, fMVAVar_MuHadS9EnergyOverPt, fMVAVar_MuHoEnergyOverPt, fMVAVar_MuHoS9EnergyOverPt, fMVAVar_MuIP3d, fMVAVar_MuIP3dSig, fMVAVar_MuNMatches, fMVAVar_MuNPixelHits, fMVAVar_MuNTrackerHits, fMVAVar_MuNValidHits, fMVAVar_MuSegmentCompatibility, fMVAVar_MuTkNchi2, fMVAVar_MuTrkIso03OverPt, fMVAVar_MuTrkIso05OverPt, fMVAVar_MuTrkKink, fTMVAReader, kMuEmEnergy, kMuEMIso03, kMuEMIso05, kMuEmS9Energy, kMuHadEnergy, kMuHadIso03, kMuHadIso05, kMuHadS9Energy, kMuHoEnergy, kMuHoS9Energy, kMuTrkIso03, kMuTrkIso05, LogDebug, HWWFunctions::mud0PV_smurfV3(), MuonEffectiveArea(), HWW::mus_caloCompatibility(), HWW::mus_chi2(), HWW::mus_e_em(), HWW::mus_e_emS9(), HWW::mus_e_had(), HWW::mus_e_hadS9(), HWW::mus_e_ho(), HWW::mus_e_hoS9(), HWW::mus_gfit_chi2(), HWW::mus_gfit_ndof(), HWW::mus_gfit_validSTAHits(), HWW::mus_ip3d(), HWW::mus_ip3derr(), HWW::mus_iso03_emEt(), HWW::mus_iso03_hadEt(), HWW::mus_iso03_sumPt(), HWW::mus_iso05_emEt(), HWW::mus_iso05_hadEt(), HWW::mus_iso05_sumPt(), HWW::mus_ndof(), HWW::mus_nmatches(), HWW::mus_p4(), HWW::mus_segmCompatibility(), HWW::mus_trk_p4(), HWW::mus_trkidx(), HWW::mus_trkKink(), HWW::mus_validHits(), matplotRender::reader, HWWFunctions::trks_d0_pv(), and HWW::trks_valid_pixelhits().

Referenced by HWWFunctions::goodMuonTMVA().

211  {
212 
213  if (!fIsInitialized) {
214  edm::LogError("NotInialized") << "Error: MuonIDMVA not properly initialized.";
215  return -9999;
216  }
217 
218  Double_t MuPt = hww.mus_trk_p4().at(mu).pt();
219  Double_t MuEta = hww.mus_trk_p4().at(mu).eta();
220  Double_t Rho = hww.evt_ww_rho_vor();
221 
222  Int_t subdet = 0;
223  if (fabs(MuEta) < 1.479) subdet = 0;
224  else subdet = 1;
225  Int_t ptBin = 0;
226  if (MuPt > 14.5) ptBin = 1;
227  if (MuPt > 20.0) ptBin = 2;
228 
229  //set all input variables
230  fMVAVar_MuTkNchi2 = hww.mus_chi2().at(mu) / hww.mus_ndof().at(mu);
231  fMVAVar_MuGlobalNchi2 = hww.mus_gfit_chi2().at(mu) / hww.mus_gfit_ndof().at(mu);
235  fMVAVar_MuNMatches = hww.mus_nmatches().at(mu);
237 
238  const double mud0sign = ( (trks_d0_pv(hww, hww.mus_trkidx().at(mu),0).first) >=0 ) ? 1. : -1.;
239  fMVAVar_MuIP3d = hww.mus_ip3d().at(mu)*mud0sign;
240  if (hww.mus_ip3derr().at(mu) == 0.0) fMVAVar_MuIP3dSig = 0.0;
241  else fMVAVar_MuIP3dSig = hww.mus_ip3d().at(mu)*mud0sign / hww.mus_ip3derr().at(mu);
242  fMVAVar_MuTrkKink = hww.mus_trkKink().at(mu);
257 
258  Double_t mva = -9999;
259  TMVA::Reader *reader = 0;
260 
261  Int_t MVABin = -1;
262  if (subdet == 0 && ptBin == 0) MVABin = 0;
263  if (subdet == 1 && ptBin == 0) MVABin = 1;
264  if (subdet == 0 && ptBin == 1) MVABin = 2;
265  if (subdet == 1 && ptBin == 1) MVABin = 3;
266  if (subdet == 0 && ptBin == 2) MVABin = 4;
267  if (subdet == 1 && ptBin == 2) MVABin = 5;
268  assert(MVABin >= 0 && MVABin <= 5);
269  reader = fTMVAReader[MVABin];
270 
271  mva = reader->EvaluateMVA( fMethodname );
272 
273  if (0) {
274  LogDebug("MuonIDMVA") << "Debug Muon MVA: "
275  << hww.evt_run() << " " << hww.evt_lumiBlock() << " " << hww.evt_event() << " " << Rho << " "
276  << hww.mus_p4().at(mu).pt() << " " << hww.mus_p4().at(mu).eta() << " " << hww.mus_p4().at(mu).phi() << " : "
277  << MuPt << " " << MuEta << " --> MVABin " << MVABin << " : "
278  << fMVAVar_MuTkNchi2 << " "
279  << fMVAVar_MuGlobalNchi2 << " "
280  << fMVAVar_MuNValidHits << " "
281  << fMVAVar_MuNTrackerHits << " "
282  << fMVAVar_MuNPixelHits << " "
283  << fMVAVar_MuNMatches << " "
284  << fMVAVar_MuD0 << " "
285  << fMVAVar_MuIP3d << " "
286  << fMVAVar_MuIP3dSig << " "
287  << fMVAVar_MuTrkKink << " "
289  << fMVAVar_MuCaloCompatibility << " "
290  << fMVAVar_MuHadEnergyOverPt << " "
291  << fMVAVar_MuHoEnergyOverPt << " "
292  << fMVAVar_MuEmEnergyOverPt << " "
293  << fMVAVar_MuHadS9EnergyOverPt << " "
294  << fMVAVar_MuHoS9EnergyOverPt << " "
295  << fMVAVar_MuEmS9EnergyOverPt << " "
296  << fMVAVar_MuTrkIso03OverPt << " "
297  << fMVAVar_MuEMIso03OverPt << " "
298  << fMVAVar_MuHadIso03OverPt << " "
299  << fMVAVar_MuTrkIso05OverPt << " "
300  << fMVAVar_MuEMIso05OverPt << " "
301  << fMVAVar_MuHadIso05OverPt << " "
302  << " === : === "
303  << mva;
304  }
305 
306  return mva;
307 }
#define LogDebug(id)
Float_t fMVAVar_MuEMIso05OverPt
Definition: MuonIDMVA.h:211
Float_t fMVAVar_MuIP3dSig
Definition: MuonIDMVA.h:193
Float_t fMVAVar_MuGlobalNchi2
Definition: MuonIDMVA.h:186
Float_t fMVAVar_MuEMIso03OverPt
Definition: MuonIDMVA.h:208
TString fMethodname
Definition: MuonIDMVA.h:182
double mud0PV_smurfV3(HWW &, unsigned int index)
std::vector< int > & trks_valid_pixelhits()
Definition: HWW.cc:63
Bool_t fIsInitialized
Definition: MuonIDMVA.h:183
std::vector< float > & mus_iso05_hadEt()
Definition: HWW.cc:479
Float_t fMVAVar_MuHoEnergyOverPt
Definition: MuonIDMVA.h:198
std::vector< float > & mus_gfit_chi2()
Definition: HWW.cc:383
Float_t fMVAVar_MuCaloCompatibility
Definition: MuonIDMVA.h:196
assert(m_qm.get())
Float_t fMVAVar_MuHadEnergyOverPt
Definition: MuonIDMVA.h:197
std::vector< int > & mus_trkidx()
Definition: HWW.cc:535
Float_t fMVAVar_MuTrkIso03OverPt
Definition: MuonIDMVA.h:207
std::vector< LorentzVector > & mus_p4()
Definition: HWW.cc:367
std::vector< float > & mus_iso03_hadEt()
Definition: HWW.cc:467
float & evt_ww_rho_vor()
Definition: HWW.cc:623
std::vector< float > & mus_e_hoS9()
Definition: HWW.cc:451
std::vector< int > & mus_nmatches()
Definition: HWW.cc:547
std::vector< float > & mus_iso03_sumPt()
Definition: HWW.cc:459
Float_t fMVAVar_MuNPixelHits
Definition: MuonIDMVA.h:189
std::vector< int > & mus_gfit_validSTAHits()
Definition: HWW.cc:515
std::vector< float > & mus_ndof()
Definition: HWW.cc:415
std::vector< float > & mus_ip3derr()
Definition: HWW.cc:423
Float_t fMVAVar_MuNMatches
Definition: MuonIDMVA.h:190
std::vector< float > & mus_ip3d()
Definition: HWW.cc:419
std::vector< float > & mus_e_emS9()
Definition: HWW.cc:455
Float_t fMVAVar_MuEmS9EnergyOverPt
Definition: MuonIDMVA.h:202
edm::LuminosityBlockNumber_t & evt_lumiBlock()
Definition: HWW.cc:611
Float_t fMVAVar_MuHadIso05OverPt
Definition: MuonIDMVA.h:212
std::pair< double, double > trks_d0_pv(HWW &, int itrk, int ipv)
std::vector< LorentzVector > & mus_trk_p4()
Definition: HWW.cc:371
std::vector< int > & mus_validHits()
Definition: HWW.cc:531
Float_t fMVAVar_MuTrkKink
Definition: MuonIDMVA.h:194
Float_t fMVAVar_MuD0
Definition: MuonIDMVA.h:191
Float_t fMVAVar_MuTrkIso05OverPt
Definition: MuonIDMVA.h:210
Float_t fMVAVar_MuHadIso03OverPt
Definition: MuonIDMVA.h:209
std::vector< float > & mus_gfit_ndof()
Definition: HWW.cc:387
static const Double_t MuonEffectiveArea(EMuonEffectiveAreaType type, Double_t Eta)
Definition: MuonIDMVA.h:87
Float_t fMVAVar_MuSegmentCompatibility
Definition: MuonIDMVA.h:195
const int mu
Definition: Constants.h:22
std::vector< float > & mus_e_hadS9()
Definition: HWW.cc:447
std::vector< float > & mus_e_had()
Definition: HWW.cc:435
std::vector< float > & mus_trkKink()
Definition: HWW.cc:395
Float_t fMVAVar_MuEmEnergyOverPt
Definition: MuonIDMVA.h:199
Float_t fMVAVar_MuHadS9EnergyOverPt
Definition: MuonIDMVA.h:200
std::vector< float > & mus_segmCompatibility()
Definition: HWW.cc:427
TMVA::Reader * fTMVAReader[6]
Definition: MuonIDMVA.h:181
Float_t fMVAVar_MuIP3d
Definition: MuonIDMVA.h:192
std::vector< float > & mus_e_em()
Definition: HWW.cc:443
std::vector< float > & mus_iso05_sumPt()
Definition: HWW.cc:471
Float_t fMVAVar_MuNTrackerHits
Definition: MuonIDMVA.h:188
std::vector< float > & mus_caloCompatibility()
Definition: HWW.cc:431
std::vector< float > & mus_e_ho()
Definition: HWW.cc:439
Float_t fMVAVar_MuHoS9EnergyOverPt
Definition: MuonIDMVA.h:201
Float_t fMVAVar_MuNValidHits
Definition: MuonIDMVA.h:187
std::vector< float > & mus_iso05_emEt()
Definition: HWW.cc:475
std::vector< float > & mus_chi2()
Definition: HWW.cc:411
Float_t fMVAVar_MuTkNchi2
Definition: MuonIDMVA.h:185
std::vector< float > & mus_iso03_emEt()
Definition: HWW.cc:463
edm::RunNumber_t & evt_run()
Definition: HWW.cc:607
edm::EventNumber_t & evt_event()
Definition: HWW.cc:615
Double_t MuonIDMVA::MVAValue ( Double_t  MuPt,
Double_t  MuEta,
Double_t  MuTkNchi2,
Double_t  MuGlobalNchi2,
Double_t  MuNValidHits,
Double_t  MuNTrackerHits,
Double_t  MuNPixelHits,
Double_t  MuNMatches,
Double_t  MuD0,
Double_t  MuIP3d,
Double_t  MuIP3dSig,
Double_t  MuTrkKink,
Double_t  MuSegmentCompatibility,
Double_t  MuCaloCompatibility,
Double_t  MuHadEnergyOverPt,
Double_t  MuHoEnergyOverPt,
Double_t  MuEmEnergyOverPt,
Double_t  MuHadS9EnergyOverPt,
Double_t  MuHoS9EnergyOverPt,
Double_t  MuEmS9EnergyOverPt,
Double_t  MuTrkIso03OverPt,
Double_t  MuEMIso03OverPt,
Double_t  MuHadIso03OverPt,
Double_t  MuTrkIso05OverPt,
Double_t  MuEMIso05OverPt,
Double_t  MuHadIso05OverPt,
Bool_t  printDebug = kFALSE 
)

Definition at line 94 of file MuonIDMVA.cc.

References assert(), fIsInitialized, fMethodname, fMVAVar_MuCaloCompatibility, fMVAVar_MuD0, fMVAVar_MuEmEnergyOverPt, fMVAVar_MuEMIso03OverPt, fMVAVar_MuEMIso05OverPt, fMVAVar_MuEmS9EnergyOverPt, fMVAVar_MuGlobalNchi2, fMVAVar_MuHadEnergyOverPt, fMVAVar_MuHadIso03OverPt, fMVAVar_MuHadIso05OverPt, fMVAVar_MuHadS9EnergyOverPt, fMVAVar_MuHoEnergyOverPt, fMVAVar_MuHoS9EnergyOverPt, fMVAVar_MuIP3d, fMVAVar_MuIP3dSig, fMVAVar_MuNMatches, fMVAVar_MuNPixelHits, fMVAVar_MuNTrackerHits, fMVAVar_MuNValidHits, fMVAVar_MuSegmentCompatibility, fMVAVar_MuTkNchi2, fMVAVar_MuTrkIso03OverPt, fMVAVar_MuTrkIso05OverPt, fMVAVar_MuTrkKink, fTMVAReader, LogDebug, and matplotRender::reader.

120  {
121 
122  if (!fIsInitialized) {
123  edm::LogError("NotInitialized") << "Error: MuonIDMVA not properly initialized.";
124  return -9999;
125  }
126 
127  Int_t subdet = 0;
128  if (fabs(MuEta) < 1.479) subdet = 0;
129  else subdet = 1;
130  Int_t ptBin = 0;
131  if (MuPt > 14.5) ptBin = 1;
132  if (MuPt > 20.0) ptBin = 2;
133 
134 
135  //set all input variables
136  fMVAVar_MuTkNchi2 = MuTkNchi2;
137  fMVAVar_MuGlobalNchi2 = MuGlobalNchi2;
138  fMVAVar_MuNValidHits = MuNValidHits;
139  fMVAVar_MuNTrackerHits = MuNTrackerHits;
140  fMVAVar_MuNPixelHits = MuNPixelHits;
141  fMVAVar_MuNMatches = MuNMatches;
142  fMVAVar_MuD0 = MuD0;
143  fMVAVar_MuIP3d = MuIP3d;
144  fMVAVar_MuIP3dSig = MuIP3dSig;
145  fMVAVar_MuTrkKink = MuTrkKink;
146  fMVAVar_MuSegmentCompatibility = MuSegmentCompatibility;
147  fMVAVar_MuCaloCompatibility = MuCaloCompatibility;
148  fMVAVar_MuHadEnergyOverPt = MuHadEnergyOverPt;
149  fMVAVar_MuHoEnergyOverPt = MuHoEnergyOverPt;
150  fMVAVar_MuEmEnergyOverPt = MuEmEnergyOverPt;
151  fMVAVar_MuHadS9EnergyOverPt = MuHadS9EnergyOverPt;
152  fMVAVar_MuHoS9EnergyOverPt = MuHoS9EnergyOverPt;
153  fMVAVar_MuEmS9EnergyOverPt = MuEmS9EnergyOverPt;
154  fMVAVar_MuTrkIso03OverPt = MuTrkIso03OverPt;
155  fMVAVar_MuEMIso03OverPt = MuEMIso03OverPt;
156  fMVAVar_MuHadIso03OverPt = MuHadIso03OverPt;
157  fMVAVar_MuTrkIso05OverPt = MuTrkIso05OverPt;
158  fMVAVar_MuEMIso05OverPt = MuEMIso05OverPt;
159  fMVAVar_MuHadIso05OverPt = MuHadIso05OverPt;
160 
161  Double_t mva = -9999;
162  TMVA::Reader *reader = 0;
163 
164  Int_t MVABin = -1;
165  if (subdet == 0 && ptBin == 0) MVABin = 0;
166  if (subdet == 1 && ptBin == 0) MVABin = 1;
167  if (subdet == 0 && ptBin == 1) MVABin = 2;
168  if (subdet == 1 && ptBin == 1) MVABin = 3;
169  if (subdet == 0 && ptBin == 2) MVABin = 4;
170  if (subdet == 1 && ptBin == 2) MVABin = 5;
171  assert(MVABin >= 0 && MVABin <= 5);
172  reader = fTMVAReader[MVABin];
173 
174  mva = reader->EvaluateMVA( fMethodname );
175 
176  if (printDebug) {
177  LogDebug("MuonIDMVA") << "Debug Muon MVA: "
178  << MuPt << " " << MuEta << " --> MVABin " << MVABin << " : "
179  << fMVAVar_MuTkNchi2 << " "
180  << fMVAVar_MuGlobalNchi2 << " "
181  << fMVAVar_MuNValidHits << " "
182  << fMVAVar_MuNTrackerHits << " "
183  << fMVAVar_MuNPixelHits << " "
184  << fMVAVar_MuNMatches << " "
185  << fMVAVar_MuD0 << " "
186  << fMVAVar_MuIP3d << " "
187  << fMVAVar_MuIP3dSig << " "
188  << fMVAVar_MuTrkKink << " "
190  << fMVAVar_MuCaloCompatibility << " "
191  << fMVAVar_MuHadEnergyOverPt << " "
192  << fMVAVar_MuHoEnergyOverPt << " "
193  << fMVAVar_MuEmEnergyOverPt << " "
194  << fMVAVar_MuHadS9EnergyOverPt << " "
195  << fMVAVar_MuHoS9EnergyOverPt << " "
196  << fMVAVar_MuEmS9EnergyOverPt << " "
197  << fMVAVar_MuTrkIso03OverPt << " "
198  << fMVAVar_MuEMIso03OverPt << " "
199  << fMVAVar_MuHadIso03OverPt << " "
200  << fMVAVar_MuTrkIso05OverPt << " "
201  << fMVAVar_MuEMIso05OverPt << " "
202  << fMVAVar_MuHadIso05OverPt << " "
203  << " === : === "
204  << mva;
205  }
206 
207  return mva;
208 }
#define LogDebug(id)
Float_t fMVAVar_MuEMIso05OverPt
Definition: MuonIDMVA.h:211
Float_t fMVAVar_MuIP3dSig
Definition: MuonIDMVA.h:193
Float_t fMVAVar_MuGlobalNchi2
Definition: MuonIDMVA.h:186
Float_t fMVAVar_MuEMIso03OverPt
Definition: MuonIDMVA.h:208
TString fMethodname
Definition: MuonIDMVA.h:182
Bool_t fIsInitialized
Definition: MuonIDMVA.h:183
Float_t fMVAVar_MuHoEnergyOverPt
Definition: MuonIDMVA.h:198
Float_t fMVAVar_MuCaloCompatibility
Definition: MuonIDMVA.h:196
assert(m_qm.get())
Float_t fMVAVar_MuHadEnergyOverPt
Definition: MuonIDMVA.h:197
Float_t fMVAVar_MuTrkIso03OverPt
Definition: MuonIDMVA.h:207
Float_t fMVAVar_MuNPixelHits
Definition: MuonIDMVA.h:189
Float_t fMVAVar_MuNMatches
Definition: MuonIDMVA.h:190
Float_t fMVAVar_MuEmS9EnergyOverPt
Definition: MuonIDMVA.h:202
Float_t fMVAVar_MuHadIso05OverPt
Definition: MuonIDMVA.h:212
Float_t fMVAVar_MuTrkKink
Definition: MuonIDMVA.h:194
Float_t fMVAVar_MuD0
Definition: MuonIDMVA.h:191
Float_t fMVAVar_MuTrkIso05OverPt
Definition: MuonIDMVA.h:210
Float_t fMVAVar_MuHadIso03OverPt
Definition: MuonIDMVA.h:209
Float_t fMVAVar_MuSegmentCompatibility
Definition: MuonIDMVA.h:195
Float_t fMVAVar_MuEmEnergyOverPt
Definition: MuonIDMVA.h:199
Float_t fMVAVar_MuHadS9EnergyOverPt
Definition: MuonIDMVA.h:200
TMVA::Reader * fTMVAReader[6]
Definition: MuonIDMVA.h:181
Float_t fMVAVar_MuIP3d
Definition: MuonIDMVA.h:192
Float_t fMVAVar_MuNTrackerHits
Definition: MuonIDMVA.h:188
Float_t fMVAVar_MuHoS9EnergyOverPt
Definition: MuonIDMVA.h:201
Float_t fMVAVar_MuNValidHits
Definition: MuonIDMVA.h:187
Float_t fMVAVar_MuTkNchi2
Definition: MuonIDMVA.h:185

Member Data Documentation

Bool_t MuonIDMVA::fIsInitialized
protected

Definition at line 183 of file MuonIDMVA.h.

Referenced by Initialize(), IsInitialized(), and MVAValue().

TString MuonIDMVA::fMethodname
protected

Definition at line 182 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuCaloCompatibility
protected

Definition at line 196 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuChargedIso03OverPt
protected

Definition at line 203 of file MuonIDMVA.h.

Float_t MuonIDMVA::fMVAVar_MuChargedIso04OverPt
protected

Definition at line 205 of file MuonIDMVA.h.

Float_t MuonIDMVA::fMVAVar_MuD0
protected

Definition at line 191 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuEmEnergyOverPt
protected

Definition at line 199 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuEMIso03OverPt
protected

Definition at line 208 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuEMIso05OverPt
protected

Definition at line 211 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuEmS9EnergyOverPt
protected

Definition at line 202 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuGlobalNchi2
protected

Definition at line 186 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuHadEnergyOverPt
protected

Definition at line 197 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuHadIso03OverPt
protected

Definition at line 209 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuHadIso05OverPt
protected

Definition at line 212 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuHadS9EnergyOverPt
protected

Definition at line 200 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuHoEnergyOverPt
protected

Definition at line 198 of file MuonIDMVA.h.

Referenced by MVAValue().

Float_t MuonIDMVA::fMVAVar_MuHoS9EnergyOverPt
protected

Definition at line 201 of file MuonIDMVA.h.

Referenced by MVAValue().

Float_t MuonIDMVA::fMVAVar_MuIP3d
protected

Definition at line 192 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuIP3dSig
protected

Definition at line 193 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuNeutralIso03OverPt
protected

Definition at line 204 of file MuonIDMVA.h.

Float_t MuonIDMVA::fMVAVar_MuNeutralIso04OverPt
protected

Definition at line 206 of file MuonIDMVA.h.

Float_t MuonIDMVA::fMVAVar_MuNMatches
protected

Definition at line 190 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuNPixelHits
protected

Definition at line 189 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuNTrackerHits
protected

Definition at line 188 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuNValidHits
protected

Definition at line 187 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuSegmentCompatibility
protected

Definition at line 195 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuTkNchi2
protected

Definition at line 185 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuTrkIso03OverPt
protected

Definition at line 207 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuTrkIso05OverPt
protected

Definition at line 210 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

Float_t MuonIDMVA::fMVAVar_MuTrkKink
protected

Definition at line 194 of file MuonIDMVA.h.

Referenced by Initialize(), and MVAValue().

TMVA::Reader* MuonIDMVA::fTMVAReader[6]
protected

Definition at line 181 of file MuonIDMVA.h.

Referenced by Initialize(), MuonIDMVA(), MVAValue(), and ~MuonIDMVA().