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.9 by bendavid, Sat Dec 17 20:00:40 2011 UTC

# Line 55 | Line 55 | MVATools::MVATools():
55    RelIsoHcal(0),
56    tIso1(0),
57    tIso3(0),
58 <  tIso2(0)
58 >  tIso2(0),
59 >  ScEta(0.)
60   {
61    // Constructor.
62   }
# Line 137 | Line 138 | void MVATools::InitializeMVA(int Variabl
138          readers[i]->AddVariable( "RelPreshowerEnergy", &RelPreshowerEnergy );
139        }
140      }
141 +
142 +    if(VariableType==6){
143 +      readers[i]->AddVariable( "HoE", &HoE );
144 +      readers[i]->AddVariable( "covIEtaIEta", &covIEtaIEta );
145 +      readers[i]->AddVariable( "tIso1abs", &tIso1abs );
146 +      readers[i]->AddVariable( "tIso3abs", &tIso3abs );
147 +      readers[i]->AddVariable( "tIso2abs", &tIso2abs );
148 +      readers[i]->AddVariable( "R9", &R9 );
149 +      readers[i]->AddVariable( "absIsoEcal", &absIsoEcal );
150 +      readers[i]->AddVariable( "absIsoHcal", &absIsoHcal );
151 +      readers[i]->AddVariable( "RelE5x5", &RelE5x5 );
152 +      readers[i]->AddVariable( "EtaWidth", &EtaWidth );
153 +      readers[i]->AddVariable( "PhiWidth", &PhiWidth );
154 +      readers[i]->AddVariable( "CoviEtaiPhi", &CoviEtaiPhi );
155 +      readers[i]->AddVariable( "CoviPhiiPhi", &CoviPhiiPhi );
156 +      readers[i]->AddVariable( "NVertexes", &NVertexes );
157 +      if(i==0){
158 +      readers[i]->AddVariable( "RelPreshowerEnergy", &RelPreshowerEnergy );
159 +      }
160 +    }
161 +    
162 +    if(VariableType==7){
163 +      readers[i]->AddVariable( "HoE", &HoE );
164 +      readers[i]->AddVariable( "covIEtaIEta", &covIEtaIEta );
165 +      readers[i]->AddVariable( "tIso1abs", &tIso1abs );
166 +      readers[i]->AddVariable( "tIso3abs", &tIso3abs );
167 +      readers[i]->AddVariable( "tIso2abs", &tIso2abs );
168 +      readers[i]->AddVariable( "R9", &R9 );
169 +      readers[i]->AddVariable( "absIsoEcal", &absIsoEcal );
170 +      readers[i]->AddVariable( "absIsoHcal", &absIsoHcal );
171 +      readers[i]->AddVariable( "NVertexes", &NVertexes );
172 +      readers[i]->AddVariable( "ScEta", &ScEta );
173 +    }    
174 +
175    }
176    
177    fReaderEndcap->BookMVA("BDT method",EndcapWeights);
# Line 147 | Line 182 | void MVATools::InitializeMVA(int Variabl
182    
183   }
184  
185 < 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) {
185 > 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) {
186    
187    //initilize the bool value
188    PassMVA=kFALSE;
189    
190 <  Float_t photon_bdt =  MVATools::GetMVAbdtValue(p,vtx,trackCol,vtxCol, _tRho);
190 >  Float_t photon_bdt =  MVATools::GetMVAbdtValue(p,vtx,trackCol,vtxCol, _tRho, els, applyElectronVeto);
191    
192    if (isbarrel) {
193      if(bdt>bdtCutBarrel){
# Line 191 | Line 226 | Int_t MVATools::PassElectronVetoInt(cons
226    isbarrel = (fabs(ScEta_MVA)<1.4442);
227  
228    R9 = p->R9();
229 +  //R9 = p->E33()/p->SCluster()->RawEnergy();
230    
231    // check which category it is ...
232    _tCat = 1;
# Line 208 | Line 244 | Int_t MVATools::PassElectronVetoInt(cons
244  
245   //--------------------------------------------------------------------------------------------------
246  
247 < Float_t MVATools::GetMVAbdtValue(const Photon* p,const Vertex* vtx,const TrackCol* trackCol,const VertexCol* vtxCol,Double_t _tRho) {
247 > 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) {
248    
249    //get the variables used to compute MVA variables
250    ecalIso3 = p->EcalRecHitIsoDr03();
# Line 217 | Line 253 | Float_t MVATools::GetMVAbdtValue(const P
253    
254    wVtxInd = 0;
255    
256 <  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?
257 <  
222 <  // track iso only
223 <  trackIso3 = IsolationTools::CiCTrackIsolation(p,vtx, 0.3, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol);
224 <  
256 >  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?
257 >    
258    // track iso worst vtx
259 <  trackIso2 = IsolationTools::CiCTrackIsolation(p,vtx, 0.4, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol, &wVtxInd,vtxCol);
259 >  trackIso2 = IsolationTools::CiCTrackIsolation(p,vtx, 0.4, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol, &wVtxInd,vtxCol, (!applyElectronVeto ? els : NULL) );
260    
261    combIso1 = ecalIso3+hcalIso4+trackIso1 - 0.17*_tRho;
262    combIso2 = ecalIso4+hcalIso4+trackIso2 - 0.52*_tRho;
263    
264    RawEnergy = p->SCluster()->RawEnergy();
265    
266 +  ScEta = p->SCluster()->Eta();
267 +  
268    //mva varialbes v1 and v2
269    tIso1 = (combIso1) *50./p->Et();
270 <  tIso3 = (trackIso3)*50./p->Et();
270 >  tIso3 = (trackIso1)*50./p->Et();
271    tIso2 = (combIso2) *50./(p->MomVtx(vtxCol->At(wVtxInd)->Position()).Pt());
272    RelIsoEcal=(ecalIso3-0.17*_tRho)/p->Et();
273    RelIsoHcal=(hcalIso4-0.17*_tRho)/p->Et();
# Line 241 | Line 276 | Float_t MVATools::GetMVAbdtValue(const P
276    HoE = p->HadOverEm();
277    covIEtaIEta = p->CoviEtaiEta();
278    tIso1abs = combIso1;
279 <  tIso3abs = trackIso3;
279 >  tIso3abs = trackIso1;
280    tIso2abs = combIso2;
281    R9 = p->R9();
282  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines