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.5 by mingyang, Mon Dec 5 01:39:48 2011 UTC vs.
Revision 1.8 by bendavid, Tue Dec 13 21:13:23 2011 UTC

# Line 137 | Line 137 | void MVATools::InitializeMVA(int Variabl
137          readers[i]->AddVariable( "RelPreshowerEnergy", &RelPreshowerEnergy );
138        }
139      }
140 +
141 +    if(VariableType==6){
142 +      readers[i]->AddVariable( "HoE", &HoE );
143 +      readers[i]->AddVariable( "covIEtaIEta", &covIEtaIEta );
144 +      readers[i]->AddVariable( "tIso1abs", &tIso1abs );
145 +      readers[i]->AddVariable( "tIso3abs", &tIso3abs );
146 +      readers[i]->AddVariable( "tIso2abs", &tIso2abs );
147 +      readers[i]->AddVariable( "R9", &R9 );
148 +      readers[i]->AddVariable( "absIsoEcal", &absIsoEcal );
149 +      readers[i]->AddVariable( "absIsoHcal", &absIsoHcal );
150 +      readers[i]->AddVariable( "RelE5x5", &RelE5x5 );
151 +      readers[i]->AddVariable( "EtaWidth", &EtaWidth );
152 +      readers[i]->AddVariable( "PhiWidth", &PhiWidth );
153 +      readers[i]->AddVariable( "CoviEtaiPhi", &CoviEtaiPhi );
154 +      readers[i]->AddVariable( "CoviPhiiPhi", &CoviPhiiPhi );
155 +      readers[i]->AddVariable( "NVertexes", &NVertexes );
156 +      if(i==0){
157 +      readers[i]->AddVariable( "RelPreshowerEnergy", &RelPreshowerEnergy );
158 +      }
159 +    }
160 +
161    }
162    
163    fReaderEndcap->BookMVA("BDT method",EndcapWeights);
# Line 147 | Line 168 | void MVATools::InitializeMVA(int Variabl
168    
169   }
170  
171 < Bool_t MVATools::PassMVASelection(const Photon* p,const Vertex* vtx,const TrackCol* trackCol,const VertexCol* vtxCol,Double_t _tRho,Float_t bdtCutBarrel, Float_t bdtCutEndcap) {
171 > Bool_t MVATools::PassMVASelection(const Photon* p,const Vertex* vtx,const TrackCol* trackCol,const VertexCol* vtxCol,Double_t _tRho,Float_t bdtCutBarrel, Float_t bdtCutEndcap, const ElectronCol* els, Bool_t applyElectronVeto) {
172    
173    //initilize the bool value
174    PassMVA=kFALSE;
175    
176 <  Float_t photon_bdt =  MVATools::GetMVAbdtValue(p,vtx,trackCol,vtxCol, _tRho);
176 >  Float_t photon_bdt =  MVATools::GetMVAbdtValue(p,vtx,trackCol,vtxCol, _tRho, els, applyElectronVeto);
177    
178    if (isbarrel) {
179      if(bdt>bdtCutBarrel){
# Line 190 | Line 211 | Int_t MVATools::PassElectronVetoInt(cons
211    
212    isbarrel = (fabs(ScEta_MVA)<1.4442);
213  
214 <  R9 = p->R9();
214 >  //R9 = p->R9();
215 >  R9 = p->E33()/p->SCluster()->RawEnergy();
216    
217    // check which category it is ...
218    _tCat = 1;
# Line 208 | Line 230 | Int_t MVATools::PassElectronVetoInt(cons
230  
231   //--------------------------------------------------------------------------------------------------
232  
233 < Float_t MVATools::GetMVAbdtValue(const Photon* p,const Vertex* vtx,const TrackCol* trackCol,const VertexCol* vtxCol,Double_t _tRho) {
233 > Float_t MVATools::GetMVAbdtValue(const Photon* p,const Vertex* vtx,const TrackCol* trackCol,const VertexCol* vtxCol,Double_t _tRho, const ElectronCol* els, Bool_t applyElectronVeto) {
234    
235    //get the variables used to compute MVA variables
236    ecalIso3 = p->EcalRecHitIsoDr03();
# Line 217 | Line 239 | Float_t MVATools::GetMVAbdtValue(const P
239    
240    wVtxInd = 0;
241    
242 <  trackIso1 = IsolationTools::CiCTrackIsolation(p,vtx, 0.3, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol);//Question Ming:whyfPV->At(0) instead of selected vertex using ranking method?
243 <  
222 <  // track iso only
223 <  trackIso3 = IsolationTools::CiCTrackIsolation(p,vtx, 0.3, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol);
224 <  
242 >  trackIso1 = IsolationTools::CiCTrackIsolation(p,vtx, 0.3, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol, NULL, NULL, (!applyElectronVeto ? els : NULL) );//Question Ming:whyfPV->At(0) instead of selected vertex using ranking method?
243 >    
244    // track iso worst vtx
245 <  trackIso2 = IsolationTools::CiCTrackIsolation(p,vtx, 0.4, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol, &wVtxInd,vtxCol);
245 >  trackIso2 = IsolationTools::CiCTrackIsolation(p,vtx, 0.4, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol, &wVtxInd,vtxCol, (!applyElectronVeto ? els : NULL) );
246    
247    combIso1 = ecalIso3+hcalIso4+trackIso1 - 0.17*_tRho;
248    combIso2 = ecalIso4+hcalIso4+trackIso2 - 0.52*_tRho;
# Line 232 | Line 251 | Float_t MVATools::GetMVAbdtValue(const P
251    
252    //mva varialbes v1 and v2
253    tIso1 = (combIso1) *50./p->Et();
254 <  tIso3 = (trackIso3)*50./p->Et();
254 >  tIso3 = (trackIso1)*50./p->Et();
255    tIso2 = (combIso2) *50./(p->MomVtx(vtxCol->At(wVtxInd)->Position()).Pt());
256    RelIsoEcal=(ecalIso3-0.17*_tRho)/p->Et();
257    RelIsoHcal=(hcalIso4-0.17*_tRho)/p->Et();
# Line 241 | Line 260 | Float_t MVATools::GetMVAbdtValue(const P
260    HoE = p->HadOverEm();
261    covIEtaIEta = p->CoviEtaiEta();
262    tIso1abs = combIso1;
263 <  tIso3abs = trackIso3;
263 >  tIso3abs = trackIso1;
264    tIso2abs = combIso2;
265    R9 = p->R9();
266  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines