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.4 by mingyang, Mon Dec 5 00:47:46 2011 UTC vs.
Revision 1.7 by bendavid, Sun Dec 11 00:03:05 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,const ElectronCol* els,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,els);
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,const ElectronCol* els) {
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?
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 only
245 <  trackIso3 = IsolationTools::CiCTrackIsolation(p,vtx, 0.3, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol);
245 >  trackIso3 = IsolationTools::CiCTrackIsolation(p,vtx, 0.3, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol, NULL, NULL, (!applyElectronVeto ? els : NULL) );
246    
247    // track iso worst vtx
248 <  trackIso2 = IsolationTools::CiCTrackIsolation(p,vtx, 0.4, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol, &wVtxInd,vtxCol);
248 >  trackIso2 = IsolationTools::CiCTrackIsolation(p,vtx, 0.4, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol, &wVtxInd,vtxCol, (!applyElectronVeto ? els : NULL) );
249    
250    combIso1 = ecalIso3+hcalIso4+trackIso1 - 0.17*_tRho;
251    combIso2 = ecalIso4+hcalIso4+trackIso2 - 0.52*_tRho;
252    
253    RawEnergy = p->SCluster()->RawEnergy();
254    
233  dRTrack = PhotonTools::ElectronVetoCiC(p, els);
234
255    //mva varialbes v1 and v2
256    tIso1 = (combIso1) *50./p->Et();
257    tIso3 = (trackIso3)*50./p->Et();
# Line 286 | Line 306 | Float_t MVATools::GetMVAbdtValue(const P
306  
307    bdt = reader->EvaluateMVA("BDT method");
308  
309 <  printf("HoE: %f\n",HoE);
309 >  /* printf("HoE: %f\n",HoE);
310    printf("covIEtaIEta: %f\n",covIEtaIEta);
311    printf("tIso1abs: %f\n",tIso1abs);
312    printf("tIso3abs: %f\n",tIso3abs);
# Line 313 | Line 333 | Float_t MVATools::GetMVAbdtValue(const P
333    
334    if (!isbarrel) {
335      printf("RelPreshowerEnergy: %f\n",RelPreshowerEnergy);
336 <  }
336 >    }*/
337    
338    return bdt;
339   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines