Changeset 8698 for trunk/MagicSoft/Mars/mhbase
- Timestamp:
- 08/23/07 11:26:38 (17 years ago)
- Location:
- trunk/MagicSoft/Mars/mhbase
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhbase/MH3.cc
r8695 r8698 88 88 // Class Version 3: 89 89 // ---------------- 90 // - Byte_t fStyleBits 90 // - Byte_t fStyleBits 91 // + MBinning fBins[3] 91 92 // 92 93 ///////////////////////////////////////////////////////////////////////////// … … 145 146 fData[2] = NULL; 146 147 148 fBins[0] = NULL; 149 fBins[1] = NULL; 150 fBins[2] = NULL; 151 147 152 fName = gsDefName; 148 153 fTitle = gsDefTitle; … … 172 177 fData[1] = NULL; 173 178 fData[2] = NULL; 179 180 fBins[0] = NULL; 181 fBins[1] = NULL; 182 fBins[2] = NULL; 174 183 175 184 fName = gsDefName; … … 197 206 fData[2] = NULL; 198 207 208 fBins[0] = NULL; 209 fBins[1] = NULL; 210 fBins[2] = NULL; 211 199 212 switch (fDimension) 200 213 { … … 233 246 fData[2] = NULL; 234 247 248 fBins[0] = NULL; 249 fBins[1] = NULL; 250 fBins[2] = NULL; 251 235 252 fName = gsDefName; 236 253 fTitle = gsDefTitle; … … 260 277 fData[2] = new MDataPhrase(memberz); 261 278 279 fBins[0] = NULL; 280 fBins[1] = NULL; 281 fBins[2] = NULL; 282 262 283 fName = gsDefName; 263 284 fTitle = gsDefTitle; … … 339 360 { 340 361 case 3: 341 binsz = (MBinning*)plist->FindObject(bz, "MBinning");362 binsz = fBins[2] ? fBins[2] : (MBinning*)plist->FindObject(bz, "MBinning"); 342 363 if (!binsz) 343 364 { … … 354 375 fHist->SetBit(kIsLogz); 355 376 case 2: 356 binsy = (MBinning*)plist->FindObject(by, "MBinning");377 binsy = fBins[1] ? fBins[1] : (MBinning*)plist->FindObject(by, "MBinning"); 357 378 if (!binsy) 358 379 { … … 369 390 fHist->SetBit(kIsLogy); 370 391 case 1: 371 binsx = (MBinning*)plist->FindObject(bx, "MBinning");392 binsx = fBins[0] ? fBins[0] : (MBinning*)plist->FindObject(bx, "MBinning"); 372 393 if (!binsx) 373 394 { … … 507 528 { 508 529 GetRangeX(*fHist, lo, hi); 509 cout << "====> " << GetName() << " " << fHist->GetName() << ": " << lo << " " << hi <<" " << fHist->GetNbinsX() << endl;510 530 fHist->GetXaxis()->SetRange(lo-2, hi+1); 511 531 } … … 525 545 } 526 546 527 // --------------------------------------------------------------------------528 //529 // Setup a inversed deep blue sea palette for the fCenter histogram.530 //531 void MH3::SetColors() const532 {533 // FIXME: This must be redone each time the canvas is repainted....534 gStyle->SetPalette(51, NULL);535 Int_t c[50];536 for (int i=0; i<50; i++)537 c[49-i] = gStyle->GetColorPalette(i);538 gStyle->SetPalette(50, c);539 }540 541 547 void MH3::Paint(Option_t *o) 542 548 { 543 549 TProfile *p=0; 550 551 if (fDimension==2) 552 MH::SetPalette("pretty"); 544 553 545 554 const TString pfx(Form("%sProfX", fHist->GetName())); -
trunk/MagicSoft/Mars/mhbase/MH3.h
r8695 r8698 11 11 class TH1; 12 12 class MData; 13 class MBinning; 13 14 14 15 class MH3 : public MH … … 23 24 TH1 *fHist; // Histogram to fill 24 25 MData *fData[3]; // Object from which the data is filled 26 MBinning *fBins[3]; // Binning set omitting the parlist access 25 27 Double_t fScale[3]; // Scale for the three axis (eg unit) 26 28 Byte_t fStyleBits; // Set the range of a histogram automatically in Finalize … … 58 60 void SetAutoRange(Bool_t x=kTRUE, Bool_t y=kTRUE, Bool_t z=kTRUE) { SetAutoRangeX(x); SetAutoRangeY(y); SetAutoRangeZ(z); } 59 61 62 void SetBinningX(MBinning *x) { fBins[0] = x; } 63 void SetBinningY(MBinning *y) { fBins[1] = y; } 64 void SetBinningZ(MBinning *z) { fBins[2] = z; } 65 void SetBinnings(MBinning *x=0, MBinning *y=0, MBinning *z=0) { SetBinningX(x); SetBinningY(y); SetBinningZ(z); } 66 60 67 void Sumw2() const { if (fHist) fHist->Sumw2(); } 61 68 … … 90 97 void SetTitle(const char *title); 91 98 92 void SetColors() const;93 99 void Draw(Option_t *opt=NULL); 94 100 void Paint(Option_t *opt=""); -
trunk/MagicSoft/Mars/mhbase/MHn.cc
r8697 r8698 27 27 // MHn 28 28 // 29 // +-----------------+ 30 // |1 | 31 // | | 32 // | | 33 // | | 34 // | | 35 // +-----------------+ 36 // 37 // +-----------------+ +--------+--------+ 38 // |1 | |1 |2 | 39 // | | | | | 40 // +-----------------+ | | | 41 // |2 | | | | 42 // | | | | | 43 // +-----------------+ +--------+--------+ 44 // 45 // +--------+--------+ +-----+-----+-----+ 46 // |1 |2 | |1 |3 | 47 // | | | | | | 48 // +--------+--------+ +-----+ + 49 // |3 | | |2 | | 50 // | | | | | | 51 // +--------+--------+ +-----+-----+-----+ 52 // 53 // +--------+--------+ +------+----------+ 54 // |1 |2 | |1 |4 | 55 // | | | +------+ | 56 // +--------+--------+ |2 | | 57 // |3 |4 | +------+ | 58 // | | | |3 | | 59 // +--------+--------+ +------+----------+ 60 // 61 // +-----+-----+-----+ +--------+--------+ 62 // |1 |2 |3 | |1 |2 | 63 // | | | | +--------+--------| 64 // +-----+-----+-----+ |3 |4 | 65 // |4 |5 | | +--------+ | 66 // | | | | |5 | | 67 // +-----+-----+-----+ +--------+--------+ 68 // 69 // +-----+-----+-----+ +--------+--------+ 70 // |1 |2 |3 | |1 |2 | 71 // | | | | +--------+--------+ 72 // +-----+-----+-----+ |3 |4 | 73 // |4 |5 |6 | +--------+--------+ 74 // | | | | |5 |6 | 75 // +-----+-----+-----+ +--------+--------+ 29 // 30 // Initialization 31 // -------------- 32 // 33 // MHn is a histogram class which derives from MH as all Mars histogram 34 // classes do, i.e. to fill the histogram use MFillH. (Example below) 35 // 36 // After instantisation of MHn add the histograms of your interest using 37 // AddHist. Before the next AddHist is called you can now set the options 38 // of your histogram using InitName, InitTitle, SetLog, SetAutoRange, 39 // SetScale and SetDrawOption. 40 // 41 // 42 // Layout 43 // ------ 44 // 45 // The layout of the histograms on the screen depends on the number of 46 // initialized histograms and the option SetLayout. For details see below. 47 // 48 // SetLayout(MHn::kSimple) 49 // < default > SetLayout(MHn::kComplex) 50 // ========================= ========================== 51 // +-----------------+ 52 // |1 | 53 // | | 54 // | | 55 // | | 56 // | | 57 // +-----------------+ 58 // 59 // +-----------------+ +--------+--------+ 60 // |1 | |1 |2 | 61 // | | | | | 62 // +-----------------+ | | | 63 // |2 | | | | 64 // | | | | | 65 // +-----------------+ +--------+--------+ 66 // 67 // +--------+--------+ +-----+-----+-----+ 68 // |1 |2 | |1 |3 | 69 // | | | | | | 70 // +--------+--------+ +-----+ + 71 // |3 | | |2 | | 72 // | | | | | | 73 // +--------+--------+ +-----+-----+-----+ 74 // 75 // +--------+--------+ +------+----------+ 76 // |1 |2 | |1 |4 | 77 // | | | +------+ | 78 // +--------+--------+ |2 | | 79 // |3 |4 | +------+ | 80 // | | | |3 | | 81 // +--------+--------+ +------+----------+ 82 // 83 // +-----+-----+-----+ +--------+--------+ 84 // |1 |2 |3 | |1 |2 | 85 // | | | | +--------+--------| 86 // +-----+-----+-----+ |3 |4 | 87 // |4 |5 | | +--------+ | 88 // | | | | |5 | | 89 // +-----+-----+-----+ +--------+--------+ 90 // 91 // +-----+-----+-----+ +--------+--------+ 92 // |1 |2 |3 | |1 |2 | 93 // | | | | +--------+--------+ 94 // +-----+-----+-----+ |3 |4 | 95 // |4 |5 |6 | +--------+--------+ 96 // | | | | |5 |6 | 97 // +-----+-----+-----+ +--------+--------+ 76 98 // 77 99 // 78 100 // For example: 79 // MHn myhist 80 // ... 101 // ------------ 102 // // Instatiate the MHn class with default name and title 103 // MHn hres("Energy2", "Energy Residual (lg E_{est} - lg E_{mc})"); 104 // 105 // // Initialize your first histogram (here a 2D histogram with x- and y-axis) 106 // hres.AddHist("MMcEvt.fEnergy", "log10(MEnergyEst.fVal)-log10(MMcEvt.fEnergy)"); 107 // // Initialize the name of the histogram (ResEmc) and the title of the 108 // // binnings ((here BinningEnergy for x-axis and BinningEnergyResidual for y-axis) 109 // hres.InitName("ResEmc;Energy;EnergyResidual"); 110 // // Initialize the title of the histogram and the axis titles 111 // hres.InitTitle(";E_{mc} [GeV];\\Delta lg E;"); 112 // // Initialize the draw option for the histogram 113 // hres.SetDrawOption("colz profx"); 114 // // for more details on the options and more options see below 115 // // or the class reference of MH3 116 // 117 // // Initialize a second histogram 118 // hres.AddHist("MPointingPos.fZd", "log10(MEnergyEst.fVal)-log10(MMcEvt.fEnergy)"); 119 // hres.InitName("ResTheta;Theta;EnergyResidual"); 120 // hres.InitTitle(";Zd [\\circ];\\Delta lg E;"); 121 // hres.SetDrawOption("colz profx"); 122 // 123 // // Note that only AddHist is mandatory. All other options can be omitted 124 // 125 // // Initialize the filling task which can now be added to the tasklist 126 // MFillH fill(&hres); 127 // ... 81 128 // 82 129 ///////////////////////////////////////////////////////////////////////////// … … 268 315 269 316 return kTRUE; 317 } 318 319 void MHn::SetScale(Double_t x, Double_t y, Double_t z) const 320 { 321 if (fHist[fNum-1]) 322 fHist[fNum-1]->SetScale(x, y, z); 323 } 324 325 void MHn::SetLog(Bool_t x, Bool_t y, Bool_t z) const 326 { 327 if (fHist[fNum-1]) 328 fHist[fNum-1]->SetLog(x, y, z); 329 } 330 void MHn::SetAutoRange(Bool_t x, Bool_t y, Bool_t z) const 331 { 332 if (fHist[fNum-1]) 333 fHist[fNum-1]->SetAutoRange(x, y, z); 334 } 335 336 void MHn::Sumw2() const 337 { 338 if (fHist[fNum-1]) 339 fHist[fNum-1]->Sumw2(); 340 } 341 342 void MHn::SetBinnings(MBinning *x, MBinning *y, MBinning *z) const 343 { 344 if (fHist[fNum-1]) 345 fHist[fNum-1]->SetBinnings(x, y, z); 270 346 } 271 347 … … 337 413 break; 338 414 case 3: // 3 339 case 4: // 4340 415 pad->Divide(2,2); 416 delete pad->GetPad(4); 417 break; 418 case 4: // 4 419 pad->Divide(2,2); 341 420 break; 342 421 case 5: // 5 422 pad->Divide(3,2); 423 delete pad->GetPad(6); 424 break; 343 425 case 6: // 6 344 426 pad->Divide(3,2);
Note:
See TracChangeset
for help on using the changeset viewer.