Changeset 7710
- Timestamp:
- 05/18/06 14:01:43 (18 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r7709 r7710 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 2006/05/18 Thomas Bretz 22 23 * mhflux/MAlphaFitter.h: 24 - added Getter for ScaleMode 25 26 * mhflux/MHThetaSq.[h,cc]: 27 - removed obsolete data-member fThetaSq 28 29 * mjtrain/MJTrainRanForest.cc, mranforest/MRanForestCalc.cc: 30 - fixed a typo in a comment 31 32 * mranforest/MRanTree.cc: 33 - added a lot of comments in the code 34 35 20 36 21 37 2006/05/18 Daniela Dorner -
trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h
r7618 r7710 169 169 Double_t GetMinimizationValue() const; 170 170 171 ScaleMode_t GetScaleMode() const { return fScaleMode; } 172 171 173 Double_t GetGausSigma() const { return fCoefficients[2]; } 172 174 Double_t GetGausMu() const { return fCoefficients[1]; } -
trunk/MagicSoft/Mars/mhflux/MHThetaSq.cc
r7194 r7710 62 62 // 63 63 MHThetaSq::MHThetaSq(const char *name, const char *title) 64 : MHAlpha(name, title), f ThetaSq(0), fNumBinsSignal(3), fNumBinsTotal(75)64 : MHAlpha(name, title), fNumBinsSignal(3), fNumBinsTotal(75) 65 65 { 66 66 // -
trunk/MagicSoft/Mars/mhflux/MHThetaSq.h
r7151 r7710 11 11 { 12 12 private: 13 MParameterD *fThetaSq; //!14 15 13 UInt_t fNumBinsSignal; 16 14 UInt_t fNumBinsTotal; -
trunk/MagicSoft/Mars/mjtrain/MJTrainRanForest.cc
r7697 r7710 90 90 // Int_t idx = AddParameter("log10(MHillas.fSize)"); 91 91 // 92 // The indices are astarting with 0 always.92 // The indices are starting with 0 always. 93 93 // 94 94 Int_t MJTrainRanForest::AddParameter(const char *rule) -
trunk/MagicSoft/Mars/mranforest/MRanForestCalc.cc
r7687 r7710 1 /* ================================ ======================================== *\1 /* ================================q======================================== *\ 2 2 ! 3 3 ! * … … 32 32 #include "MRanForestCalc.h" 33 33 34 #include <TF1.h> 35 #include <TGraph.h> 34 36 #include <TVector.h> 35 37 … … 279 281 } 280 282 281 // Maybe fEForests[0].fRules yould be used instead? 282 283 // Maybe fEForests[0].fRules could be used instead? 283 284 if (fData->Read("rules")<=0) 284 285 { … … 322 323 } 323 324 324 #include <TGraph.h>325 #include <TF1.h>326 325 Int_t MRanForestCalc::Process() 327 326 { -
trunk/MagicSoft/Mars/mranforest/MRanTree.cc
r7697 r7710 41 41 #include "MArrayF.h" 42 42 43 #include "MMath.h" 44 43 45 #include "MLog.h" 44 46 #include "MLogManip.h" … … 176 178 Double_t pdo=0; 177 179 178 for (Int_t j=0; j<nclass; j++) 180 // tclasspop: sum of weights for events in class 181 for (Int_t j=0; j<nclass; j++) // loop over number of classes to classifiy 179 182 { 180 183 pno+=tclasspop[j]*tclasspop[j]; … … 182 185 } 183 186 184 const Double_t crit0=pno/pdo; 187 const Double_t crit0=pno/pdo; // weighted mean of weights 185 188 186 189 // start main loop through variables to find best split, … … 190 193 191 194 // random split selection, number of trials = fNumTry 192 for (Int_t mt=0; mt<fNumTry; mt++) 195 for (Int_t mt=0; mt<fNumTry; mt++) // we could try ALL variables??? 193 196 { 194 197 const Int_t mvar= gRandom->Integer(mdim); … … 212 215 213 216 // do classification, Gini index as split rule 214 rln+=u*( 2*wl[k]+u); 215 rrn+=u*(-2*wr[k]+u); 216 217 rld+=u; 218 rrd-=u; 219 220 wl[k]+=u; 221 wr[k]-=u; 222 217 rln +=u*(2*wl[k]+u); // += u*(wl[k]{i-1} + wl[k]{i-1}+u{i}) 218 rld +=u; // sum of weights left from cut total 219 wl[k] +=u; // sum of weights left from cut for class k 220 221 rrn -=u*(2*wr[k]-u); // -= u*(wr[k]{i-1} + wr[k]{i-1}-u{i}) 222 // rr0=0; rr0+=u*2*tclasspop[k] 223 // rrn = pno - rr0 + rln 224 rrd -=u; // sum of weights right from cut total 225 wr[k] -=u; // sum of weights right from cut for class k 226 227 // REPLACE BY? 228 // rr0 = 0 229 // rr0 += u*2*tclasspop[k] 230 // rrn = pno - rr0 + rln 231 // rrd = pdo - rld 232 // wr[k] = tclasspop[k] - wl[k] 233 234 // crit = (rln*(pdo - rld + 1) + pno - rr0) / rld*(pdo - rld) 235 236 /* 237 if (k==background) 238 continue; 239 crit = TMath::Max(MMath::SignificanceLiMa(rld, rld-wl[k]), 240 MMath::SignificanceLiMa(rrd, rrd-wr[k])) 241 */ 242 243 // This condition is in fact a == (> cannot happen at all) 244 // This is because we cannot set the cut between two identical values 245 //if (datarang[mn+datasort[mn+nsp]]>=datarang[mn+datasort[mn+nsp+1]]) 223 246 if (datarang[mn+nc]>=datarang[mn+datasort[mn+nsp+1]]) 224 247 continue; 225 248 226 if (TMath::Min(rrd,rld)<=1.0e-5) 249 // If crit starts to become pretty large do WHAT??? 250 if (TMath::Min(rrd,rld)<=1.0e-5) // FIXME: CHECKIT FOR WEIGHTS! 227 251 continue; 228 252 229 253 const Double_t crit=(rln/rld)+(rrn/rrd); 230 254 255 // Search for the highest value of crit 231 256 if (crit<=critvar) continue; 232 257 258 // store the highest crit value and the corresponding event to cut at 233 259 nbestvar=nsp; 234 260 critvar=crit; … … 237 263 if (critvar<=critmax) continue; 238 264 239 msplit=mvar; 240 nbest=nbestvar; 265 msplit=mvar; // Variable in which to split 266 nbest=nbestvar; // event at which the best split was found 241 267 critmax=critvar; 242 268 } 243 269 270 // crit0 = MMath::SignificanceLiMa(pdo, pdo-tclasspop[0]) 271 // mean increase of sensitivity 272 // decsplit = sqrt(critmax/crit0) 244 273 decsplit=critmax-crit0; 245 274 … … 299 328 const Int_t mn = mvar*numdata; 300 329 301 Double_t rrn=0, rrd=0, rln=0, rld=0;302 303 330 Double_t esumr =mean; 304 331 Double_t e2sumr=square; … … 316 343 const Float_t &u=winbag[nc]; 317 344 318 e2sumr-=u*f*f;319 esumr -=u*f;320 wr -=u;321 322 //-------------------------------------------323 // resolution324 //rrn=(wr*e2sumr-esumr*esumr)*wr;325 //rrd=(wr-1.)*esumr*esumr;326 327 // resolution times n328 //rrn=(wr*e2sumr-esumr*esumr)*wr;329 //rrd=esumr*esumr;330 331 // sigma332 //rrn=(e2sumr-esumr*esumr/wr);333 //rrd=(wr-1.);334 335 // sigma times n336 rrn=(e2sumr-esumr*esumr/wr);337 rrd=1.;338 339 // 1./(n*variance)340 //rrn=1.;341 //rrd=(e2sumr-esumr*esumr/wr);342 //-------------------------------------------343 344 345 e2suml+=u*f*f; 345 346 esuml +=u*f; … … 348 349 //------------------------------------------- 349 350 // resolution 350 // rln=(wl*e2suml-esuml*esuml)*wl;351 // rld=(wl-1.)*esuml*esuml;351 //const Double_t rln=(wl*e2suml-esuml*esuml)*wl; 352 //const Double_t rld=(wl-1.)*esuml*esuml; 352 353 353 354 // resolution times n 354 // rln=(wl*e2suml-esuml*esuml)*wl;355 // rld=esuml*esuml;355 //const Double_t rln=(wl*e2suml-esuml*esuml)*wl; 356 //const Double_t rld=esuml*esuml; 356 357 357 358 // sigma 358 // rln=(e2suml-esuml*esuml/wl);359 // rld=(wl-1.);359 //const Double_t rln=(e2suml-esuml*esuml/wl); 360 //const Double_t rld=(wl-1.); 360 361 361 362 // sigma times n 362 rln=(e2suml-esuml*esuml/wl);363 rld=1.;363 Double_t rln=(e2suml-esuml*esuml/wl); 364 Double_t rld=1.; 364 365 365 366 // 1./(n*variance) 366 //rln=1.; 367 //rld=(e2suml-esuml*esuml/wl); 367 //const Double_t rln=1.; 368 //const Double_t rld=(e2suml-esuml*esuml/wl); 369 //------------------------------------------- 370 371 // REPLACE BY??? 372 e2sumr-=u*f*f; // e2sumr = square - e2suml 373 esumr -=u*f; // esumr = mean - esuml 374 wr -=u; // wr = tclasspop[0] - wl 375 376 //------------------------------------------- 377 // resolution 378 //const Double_t rrn=(wr*e2sumr-esumr*esumr)*wr; 379 //const Double_t rrd=(wr-1.)*esumr*esumr; 380 381 // resolution times n 382 //const Double_t rrn=(wr*e2sumr-esumr*esumr)*wr; 383 //const Double_t rrd=esumr*esumr; 384 385 // sigma 386 //const Double_t rrn=(e2sumr-esumr*esumr/wr); 387 //const Double_t rrd=(wr-1.); 388 389 // sigma times n 390 const Double_t rrn=(e2sumr-esumr*esumr/wr); 391 const Double_t rrd=1.; 392 393 // 1./(n*variance) 394 //const Double_t rrn=1.; 395 //const Double_t rrd=(e2sumr-esumr*esumr/wr); 368 396 //------------------------------------------- 369 397 … … 538 566 const int j=idclass[nc]; 539 567 568 // statistics left from cut 540 569 mean[ncur+1]+=hadtrue[nc]*winbag[nc]; 541 570 square[ncur+1]+=hadtrue[nc]*hadtrue[nc]*winbag[nc]; 542 571 572 // sum of weights left from cut 543 573 classpop[j*nrnodes+ncur+1]+=winbag[nc]; 544 574 } … … 549 579 const int j=idclass[nc]; 550 580 581 // statistics right from cut 551 582 mean[ncur+2] +=hadtrue[nc]*winbag[nc]; 552 583 square[ncur+2]+=hadtrue[nc]*hadtrue[nc]*winbag[nc]; 553 584 585 // sum of weights right from cut 554 586 classpop[j*nrnodes+ncur+2]+=winbag[nc]; 555 587 }
Note:
See TracChangeset
for help on using the changeset viewer.