Changeset 1966 for trunk/MagicSoft
- Timestamp:
- 04/20/03 12:51:47 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1965 r1966 1 1 -*-*- END OF LINE -*-*- 2 3 2003/04/21: Thomas Bretz 4 5 * macros/plot.C: 6 - Added MStatusDisplay support 7 8 * macros/status.C: 9 - added MHNewImagePar 10 11 * manalysis/MBlindPixelCalc.cc: 12 - updated class reference 13 14 * meventdisp/MGCamDisplay.[h,cc]: 15 - fixed 16 17 * meventdisp/MGEvtDisplay.cc: 18 - changed function adding the tab 19 20 * mgui/MCamDisplay.cc, mhist/MHCerPhotEvt.cc: 21 - as a preliminary solution removed inner pad 22 23 * mhist/MFillH.cc: 24 - make sure canvas is updated correctly in PostProcess 25 26 * mhist/MH.cc: 27 - changed DrawCopy(TH1, TH1) and Draw(TH1, TH1) to fit the new needs 28 display the range correctly and exchanged the two stat boxes 29 30 * mhist/MH3.cc: 31 - fixed a bug in the default constructor 32 - removed DrawClone 33 - updated Draw function 34 35 * mhist/MHMcIntRate.[h,cc], mhist/MHRanForest.[h,cc], 36 mhist/MHRanForestGini.[h,cc], mhist/MHSigmaPixel.[h,cc], 37 mhist/MHSigmaTheta.[h,cc], mhist/MHSigmabarTheta.[h,cc], 38 mhist/MHThetabarTheta.[h,cc], mhist/MHThetabarTime.[h,cc], 39 mhist/MHTimeDiffTheta.[h,cc], mhist/MHTimeDiffTime.[h,cc], 40 mimage/MHNewImagePar.[h,cc]: 41 - removed old DrawClone 42 - updated Draw function 43 - replaced some titles by latex titles in some classes 44 45 * mimage/MHNewImagePar.[h,cc], mimage/MNewImagePar.[h,cc]: 46 - removed scaling stuff 47 48 * mmain/MStatusDisplay.cc: 49 - fixed some minor bugs 50 51 52 53 2003/04/20: Thomas Bretz 2 54 3 55 * Makefile: -
trunk/MagicSoft/Mars/macros/plot.C
r1543 r1966 23 23 ! 24 24 \* ======================================================================== */ 25 25 #include <MH.h> 26 26 // ------------------------------------------------------------------------- 27 27 // … … 32 32 void plot() 33 33 { 34 MStatusDisplay *d = new MStatusDisplay; 35 d->SetLogStream(&gLog); 36 34 37 // 35 38 // Create a empty Parameter List and an empty Task List … … 48 51 // First Task: Read file with image parameters 49 52 // (created with the star.C macro) 50 MReadMarsFile read("Events", "star.root"); 53 MReadMarsFile read("Events", "MC_OFF1.root"); 54 read.AddFile("MC_ON1.root"); 51 55 read.DisableAutoScheme(); 52 56 tlist.AddToList(&read); … … 64 68 // set the name of the variable to plot and the binning 65 69 // 66 TString var(" MHillas.fSize");70 TString var("Hillas.fSize"); 67 71 68 72 MBinning bins("BinningMH3X"); … … 99 103 // Execute your analysis 100 104 // 101 MProgressBar bar; 102 evtloop.SetProgressBar(&bar); 105 evtloop.SetDisplay(d); 103 106 if (!evtloop.Eventloop()) 104 107 return; … … 106 109 tlist.PrintStatistics(); 107 110 108 // Create a default canvas called Plot and set the 111 // Create a pad, check if MStatusDisplay was not closed meanwhile 112 if (evtloop.GetDisplay()) 113 d->AddTab("Size"); 114 else 115 MH::MakeDefCanvas("Plot"); 116 109 117 // x-axis to logarithmic scale 110 MH::MakeDefCanvas("Plot");111 118 gPad->SetLogx(); 112 119 … … 114 121 // and draw a copy of both 115 122 h3h.GetHist().SetLineColor(kRed); 116 h3h.GetHist().SetFillStyle(4000); 117 h3g.GetHist().DrawCopy(); 118 h3h.GetHist().DrawCopy("same"); 123 MH::DrawCopy(h3h.GetHist(), h3g.GetHist(), "Size"); 119 124 120 125 // Now create a new histogram, fill it with the division of the … … 124 129 h.Divide(&h3g.GetHist(), &h3h.GetHist()); 125 130 h.SetLineColor(kGreen); 126 h.SetFillStyle(4000);127 131 h.DrawCopy("same"); 128 132 } -
trunk/MagicSoft/Mars/macros/status.C
r1965 r1966 80 80 81 81 // ------------- user change ----------------- 82 //read.AddFile("data/Pro*.root");83 82 read.AddFile("data/Gam*.root"); 83 //read.AddFile("200*.root"); 84 84 85 85 MMcPedestalCopy pcopy; … … 93 93 MHillasCalc hcalc; 94 94 MHillasSrcCalc scalc; // !!Preliminary!! Will be removed later! 95 MNewImageParCalc icalc; 95 96 96 97 // ------------------------------------------- … … 99 100 MFillH hfill3("MHHillasExtSrc [MHHillasExt]"); 100 101 MFillH hfill4("MHHillasSrc","MHillasSrc"); 102 MFillH hfill4("MHNewImagePar","MNewImagePar"); 101 103 MFillH hfill5("MHStarMap", "MHillas"); 102 104 MFillH hfill6("MHCerPhotEvt", "MCerPhotEvt"); … … 107 109 108 110 tlist.AddToList(&ncalc); 109 110 111 tlist.AddToList(&blind); 111 112 tlist.AddToList(&clean); 112 113 tlist.AddToList(&hcalc); 113 114 tlist.AddToList(&scalc); 115 tlist.AddToList(&icalc); 114 116 tlist.AddToList(&hfill1); 115 117 tlist.AddToList(&hfill2); -
trunk/MagicSoft/Mars/manalysis/MBlindPixelCalc.cc
r1965 r1966 19 19 ! Author(s): Thomas Bretz 08/2002 <mailto:tbretz@astro.uni.wuerzburg.de> 20 20 ! 21 ! Copyright: MAGIC Software Development, 2000-200 221 ! Copyright: MAGIC Software Development, 2000-2003 22 22 ! 23 23 ! … … 25 25 26 26 ///////////////////////////////////////////////////////////////////////////// 27 // // 28 // MBlindPixelCalc // 29 // // 30 // This is the specific image cleaning for a list of pixels. This task // 31 // sets the pixels listed in fPixelsID to unused so they should not be // 32 // used for analysis (eg calculation of hillas parameters). // 33 // // 34 // If you specify an array of pixel IDs this pixels are disabled. // 35 // In all other cases the task tries to determin the starfield from the // 36 // MMcRunHeader and disables pixels correspoding to the starfield. // 37 // // 38 // Implemented star fields: // 39 // - Crab: 400, 401, 402, 437, 438, 439 // 40 // // 41 // You can use MBlindPixelCalc::SetUseInterpolation to replaced the // 42 // blind pixels by the average of its neighbors instead of unmapping // 43 // them. If you want to include the central pixel use // 44 // MBlindPixelCalc::SetUseCentralPixel // 45 // // 46 // Input Containers: // 47 // MCerPhotEvt // 48 // // 49 // Output Containers: // 50 // MBlindPixels // 51 // // 27 // 28 // MBlindPixelCalc 29 // 30 // This is the specific image cleaning for a list of pixels. This task 31 // sets the pixels listed in fPixelsID to unused so they should not be 32 // used for analysis (eg calculation of hillas parameters). 33 // 34 // You can use MBlindPixelCalc::SetUseInterpolation to replaced the 35 // blind pixels by the average of its neighbors instead of unmapping 36 // them. If you want to include the central pixel use 37 // MBlindPixelCalc::SetUseCentralPixel. 38 // 39 // You have three options: 40 // 1) Call SetUseBlindPixels(): 41 // This will take an existing MBlindPixels container filled from 42 // elsewhere (eg. MCT1ReadPreProc) and use this pixels as blind 43 // pixels. 44 // 2) Call SetPixels(): 45 // This will setup an array with pixel numbers. These pixels are used 46 // as blind pixels. 47 // 3) Neither 1) nor 2) 48 // This options tries to identify the starfield from the 49 // MMcRunHeader container and tries to identifies it. If it is known 50 // (eg. Crab) the fixed build in pixel numbers are used as blind 51 // pixels. 52 // 53 // If neither an array of pixels is given (or its size is 0) and 54 // MMcRunHeader couldn't be found the task removes itself from the 55 // tasklist. 56 // 57 // Implemented star fields: 58 // - Crab: 400, 401, 402, 437, 438, 439 59 // 60 // Input Containers: 61 // MCerPhotEvt[, MBlindPixels] 62 // 63 // Output Containers: 64 // MCerPhotEvt, MBlindPixels 65 // 52 66 ///////////////////////////////////////////////////////////////////////////// 53 67 #include "MBlindPixelCalc.h" … … 140 154 // 141 155 // Replaces each pixel by the average of its surrounding pixels. 142 // If TESTBIT(fFlags, kUseCentralPixel) is set the central pixel is also included. 156 // If TESTBIT(fFlags, kUseCentralPixel) is set the central pixel is also 157 // included. 143 158 // 144 159 void MBlindPixelCalc::Interpolate() const -
trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc
r1965 r1966 150 150 const TGWindow *p, /*const TGWindow *main,*/ 151 151 UInt_t w, UInt_t h) 152 : MGEvtDisplay(filename, "Events", p, /*main,*/ w, h) , fDisplay(NULL)152 : MGEvtDisplay(filename, "Events", p, /*main,*/ w, h) 153 153 { 154 154 // … … 162 162 AddSetupElements(); 163 163 164 fCanvas2 = AddTab("Errors"); 165 fCanvas3 = AddTab("Phot/Err"); 166 fCanvas4 = AddTab("Levels"); 167 fCanvas5 = AddTab("Pedestals"); 164 fCanvas2[0] = fCanvas; 165 fCanvas2[1] = AddTab("Errors"); 166 fCanvas2[2] = AddTab("Phot/Err"); 167 fCanvas2[3] = AddTab("Levels"); 168 fCanvas2[4] = AddTab("Pedestals"); 168 169 169 170 // 170 171 // Show camera display for the actual geometry 171 172 // 172 fDisplay = new MCamDisplay(geom); 173 fDisplay2 = new MCamDisplay(geom); 174 fDisplay3 = new MCamDisplay(geom); 175 fDisplay4 = new MCamDisplay(geom); 176 fDisplay5 = new MCamDisplay(geom); 177 178 fList->Add(fDisplay); 179 fList->Add(fDisplay2); 180 fList->Add(fDisplay3); 181 fList->Add(fDisplay4); 182 fList->Add(fDisplay5); 183 184 fCanvas->cd(); 185 fDisplay->Draw(); 186 fCanvas2->cd(); 187 fDisplay2->Draw(); 188 fCanvas3->cd(); 189 fDisplay3->Draw(); 190 fCanvas4->cd(); 191 fDisplay4->Draw(); 192 fCanvas5->cd(); 193 fDisplay5->Draw(); 194 173 for (int i=0; i<5; i++) 174 { 175 fCanvas2[i]->cd(); 176 fDisplay[i] = new MCamDisplay(geom); 177 fDisplay[i]->Draw(); 178 fCanvas2[i]->Update(); 179 fList->Add(fDisplay[i]); 180 } 195 181 196 182 ReadFirstEvent(); … … 203 189 Layout(); 204 190 205 SetWindowName(" HillasEvent Display");206 SetIconName(" Hillas");191 SetWindowName("Image Event Display"); 192 SetIconName("Image"); 207 193 208 194 MapWindow(); … … 242 228 if (fDisplayRaw) 243 229 { 244 //245 230 // Get a clone of MCerPhotEvt which is made before the image cleaning 246 //247 231 const MClone *clone = (MClone*)GetTaskList()->FindObject("MClone"); 248 232 evt = (MCerPhotEvt*)clone->GetClone(); … … 250 234 else 251 235 { 252 //253 236 // Get MCerPhotEvt which containes the cleaned data 254 //255 237 evt = (MCerPhotEvt*)plist->FindObject("MCerPhotEvt"); 256 238 } … … 259 241 const MPedestalCam *ped = (MPedestalCam*)plist->FindObject("MPedestalCam"); 260 242 261 fDisplay->FillPhotNum(*evt); 262 fCanvas->Modified(); 263 fCanvas->Update(); 264 fDisplay2->FillErrorPhot(*evt); 265 fCanvas2->Modified(); 266 fCanvas2->Update(); 267 fDisplay3->FillRatio(*evt); 268 fCanvas3->Modified(); 269 fCanvas3->Update(); 270 fDisplay4->FillLevels(*evt, *clean); 271 fCanvas4->Modified(); 272 fCanvas4->Update(); 273 fDisplay5->FillPedestals(*ped); 274 fCanvas5->Modified(); 275 fCanvas5->Update(); 243 fDisplay[0]->FillPhotNum(*evt); 244 fDisplay[1]->FillErrorPhot(*evt); 245 fDisplay[2]->FillRatio(*evt); 246 fDisplay[3]->FillLevels(*evt, *clean); 247 fDisplay[4]->FillPedestals(*ped); 248 249 for (int i=0; i<5; i++) 250 { 251 fCanvas2[i]->Modified(); 252 fCanvas2[i]->Update(); 253 } 276 254 } 277 255 -
trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.h
r1965 r1966 19 19 TGListBox *fPixelList; 20 20 21 MCamDisplay *fDisplay; 22 MCamDisplay *fDisplay2; 23 MCamDisplay *fDisplay3; 24 MCamDisplay *fDisplay4; 25 MCamDisplay *fDisplay5; 26 27 TCanvas *fCanvas2; 28 TCanvas *fCanvas3; 29 TCanvas *fCanvas4; 30 TCanvas *fCanvas5; 21 MCamDisplay *fDisplay[5]; 22 TCanvas *fCanvas2[5]; 31 23 32 24 void AddSetupElements(); -
trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc
r1836 r1966 216 216 fList->Add(laycanvas); 217 217 218 TGCompositeFrame *frame = fEvtDisplay->AddTab(name); 219 TRootEmbeddedCanvas *canvas = new TRootEmbeddedCanvas(name+"Display", frame, 400, 400); 220 frame->AddFrame(canvas, laycanvas); 221 fList->Add(canvas); 222 return canvas->GetCanvas(); 218 // Add new tab 219 TGCompositeFrame *f = fEvtDisplay->AddTab(name); 220 221 // create root embedded canvas and add it to the tab 222 TRootEmbeddedCanvas *ec = new TRootEmbeddedCanvas(name+"Display", f, f->GetWidth(), f->GetHeight()); 223 f->AddFrame(ec, laycanvas); 224 fList->Add(ec); 225 226 // set background and border mode of the canvas 227 TCanvas &c = *ec->GetCanvas(); 228 c.SetBorderMode(0); 229 230 // layout and map new tab 231 #if ROOT_VERSION_CODE < ROOT_VERSION(3,03,00) 232 MapSubwindows(); 233 Layout(); 234 #else 235 Layout(); 236 MapSubwindows(); 237 #endif 238 239 // display new tab in the main frame 240 gClient->ProcessEventsFor(fEvtDisplay); 241 242 // return pointer to new canvas 243 return &c; 223 244 } 224 245 -
trunk/MagicSoft/Mars/mgui/MCamDisplay.cc
r1965 r1966 278 278 pad->SetFillColor(16); 279 279 280 //281 // All this is necessary to get the background in the correct color282 //283 pad->Divide(1,1);284 pad->cd(1);285 286 gPad->SetBorderMode(0);287 gPad->SetFillColor(16);288 289 //290 // set the color palette for the TBox elements291 //292 280 AppendPad(""); 293 294 //295 // Necessary to visualize the background color (FIXME?)296 //297 gPad->Modified();298 gPad->Update();299 281 } 300 282 … … 309 291 const float w = gPad->GetWw(); 310 292 const float h = gPad->GetWh()*ratio; 293 294 gPad->Range(-fRange, -fRange, (2*ratio-1)*fRange, fRange); 311 295 312 296 if (h<w) … … 314 298 else 315 299 gPad->SetPad(0, (1.-w/h)/2, 1, (w/h+1)/2); 316 317 gPad->Range(-fRange, -fRange, (2*ratio-1)*fRange, fRange);318 300 } 319 301 … … 741 723 742 724 TText &txt = *GetText(i); 743 txt.SetText(txt.GetX(), txt.GetY(), Form( "%5.1f", val));725 txt.SetText(txt.GetX(), txt.GetY(), Form(val<1e6?"%5.1f":"%5.1e", val)); 744 726 } 745 727 } -
trunk/MagicSoft/Mars/mhist/MFillH.cc
r1965 r1966 469 469 fCanvas->cd(); 470 470 fH->DrawClone("nonew"); 471 fCanvas->Modified(); 472 fCanvas->Update(); 471 473 } 472 474 -
trunk/MagicSoft/Mars/mhist/MH.cc
r1965 r1966 584 584 // Draw first histogram 585 585 // 586 TH1 *h1 = ( TH1*)((TH1&)hist1).DrawCopy();586 TH1 *h1 = ((TH1&)hist1).DrawCopy(); 587 587 gPad->SetBorderMode(0); 588 588 gPad->Update(); 589 590 h1->SetMaximum(TMath::Max(hist1.GetMaximum(), hist2.GetMaximum())); 591 h1->SetMinimum(TMath::Min(hist1.GetMinimum(), hist2.GetMinimum())); 589 592 590 593 TPaveText *t = (TPaveText*)gPad->FindObject("title"); … … 609 612 // 610 613 TPaveStats &s1 = *(TPaveStats*)gPad->FindObject("stats"); 611 s1.SetX1NDC(s1.GetX1NDC()-0.01); 612 s1.SetName("MHStat"); 614 const Double_t x1 = s1.GetX1NDC()-0.01; 615 s1.SetName((TString)"Stat"+hist1.GetTitle()); 616 s1.SetX1NDC(x1-(s1.GetX2NDC()-s1.GetX1NDC())); 617 s1.SetX2NDC(x1); 613 618 614 619 // 615 620 // Draw second histogram 616 621 // 617 TH1 *h2 = (TH1*)((TH1&)hist2).DrawCopy("sames");622 ((TH1&)hist2).DrawCopy("sames"); 618 623 gPad->Update(); 619 624 620 625 // 621 // Set new position of second statistics box626 // Draw Legend 622 627 // 623 628 TPaveStats &s2 = *(TPaveStats*)gPad->FindObject("stats"); 624 s2.SetX1NDC(s1.GetX1NDC()-(s2.GetX2NDC()-s2.GetX1NDC())-0.01); 625 s2.SetX2NDC(s1.GetX1NDC()-0.01); 626 627 // 628 // Draw Legend 629 // 630 const Int_t n = s1.GetListOfLines()->GetSize(); 631 const Double_t h = s1.GetY2NDC()-s1.GetY1NDC(); 632 TLegend &l = *new TLegend(s1.GetX1NDC(), s1.GetY1NDC()-0.015-h*2/n, 633 s1.GetX2NDC(), s1.GetY1NDC()-0.01 634 ); 635 l.AddEntry(h1, h1->GetTitle()); 636 l.AddEntry(h2, h2->GetTitle()); 629 TLegend &l = *new TLegend(s2.GetX1NDC(), 630 s2.GetY1NDC()-0.015-(s2.GetY2NDC()-s2.GetY1NDC())/2, 631 s2.GetX2NDC(), 632 s2.GetY1NDC()-0.01 633 ); 634 l.AddEntry((TH1*)&hist1, hist1.GetTitle()); 635 l.AddEntry((TH1*)&hist2, hist2.GetTitle()); 637 636 l.SetTextSize(s2.GetTextSize()); 638 637 l.SetTextFont(s2.GetTextFont()); 639 638 l.SetBorderSize(s2.GetBorderSize()); 640 639 l.SetBit(kCanDelete); 641 642 640 l.Draw(); 643 641 } … … 656 654 gPad->SetBorderMode(0); 657 655 gPad->Update(); 656 657 hist1.SetMaximum(TMath::Max(hist1.GetMaximum(), hist2.GetMaximum())); 658 hist1.SetMinimum(TMath::Min(hist1.GetMinimum(), hist2.GetMinimum())); 658 659 659 660 TPaveText *t = (TPaveText*)gPad->FindObject("title"); … … 678 679 // 679 680 TPaveStats &s1 = *(TPaveStats*)gPad->FindObject("stats"); 680 s1.SetX1NDC(s1.GetX1NDC()-0.01);681 const Double_t x1 = s1.GetX1NDC()-0.01; 681 682 s1.SetName((TString)"Stat"+hist1.GetTitle()); 683 s1.SetX1NDC(x1-(s1.GetX2NDC()-s1.GetX1NDC())); 684 s1.SetX2NDC(x1); 682 685 683 686 // … … 685 688 // 686 689 hist2.Draw("sames"); 687 688 690 gPad->Update(); 689 691 690 692 // 691 // Set new position of second statistics box693 // Draw Legend 692 694 // 693 695 TPaveStats &s2 = *(TPaveStats*)gPad->FindObject("stats"); 694 s2.SetX1NDC(s1.GetX1NDC()-(s2.GetX2NDC()-s2.GetX1NDC())-0.01); 695 s2.SetX2NDC(s1.GetX1NDC()-0.01); 696 697 // 698 // Draw Legend 699 // 700 TLegend &l = *new TLegend(s1.GetX1NDC(), 701 s1.GetY1NDC()-0.015-(s1.GetY2NDC()-s1.GetY1NDC())/2, 702 s1.GetX2NDC(), 703 s1.GetY1NDC()-0.01 696 TLegend &l = *new TLegend(s2.GetX1NDC(), 697 s2.GetY1NDC()-0.015-(s2.GetY2NDC()-s2.GetY1NDC())/2, 698 s2.GetX2NDC(), 699 s2.GetY1NDC()-0.01 704 700 ); 705 701 l.AddEntry(&hist1, hist1.GetTitle()); -
trunk/MagicSoft/Mars/mhist/MH3.cc
r1965 r1966 112 112 fTitle = Form(gsDefTitle.Data(), 1); 113 113 114 fHist->SetDirectory(NULL); 114 if (fHist) 115 fHist->SetDirectory(NULL); 115 116 116 117 fScale[0] = 1; … … 451 452 // pointer to it from this function 452 453 // 454 /* 453 455 TObject *MH3::DrawClone(Option_t *opt) const 454 456 { … … 499 501 return c; 500 502 } 503 */ 501 504 502 505 // -------------------------------------------------------------------------- … … 517 520 void MH3::Draw(Option_t *opt) 518 521 { 519 if (!gPad) 520 MH::MakeDefCanvas(fHist); 522 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fHist); 523 pad->SetBorderMode(0); 524 525 AppendPad(""); 521 526 522 527 TString str(opt); 523 528 529 // FIXME: Do it in Paint() 524 530 if (str.Contains("COL", TString::kIgnoreCase)) 525 531 SetColors(); 532 533 fHist->SetFillStyle(4000); 526 534 527 535 Bool_t only = str.Contains("ONLY", TString::kIgnoreCase) && fDimension==2; … … 546 554 } 547 555 548 if (fHist->TestBit(kIsLogx)) gPad->SetLogx();549 if (fHist->TestBit(kIsLogy)) gPad->SetLogy();550 if (fHist->TestBit(kIsLogz)) gPad->SetLogz();551 552 gPad->Modified();553 gPad->Update();556 if (fHist->TestBit(kIsLogx)) pad->SetLogx(); 557 if (fHist->TestBit(kIsLogy)) pad->SetLogy(); 558 if (fHist->TestBit(kIsLogz)) pad->SetLogz(); 559 560 pad->Modified(); 561 pad->Update(); 554 562 } 555 563 -
trunk/MagicSoft/Mars/mhist/MHCerPhotEvt.cc
r1965 r1966 165 165 pad->SetBorderMode(0); 166 166 167 //168 // All this is necessary to get the background in the correct color169 //170 pad->Divide(1,1);171 pad->cd(1);172 173 gPad->SetBorderMode(0);174 gPad->SetFillColor(gPad->GetFillColor());175 176 //177 // set the color palette for the TBox elements178 //179 167 AppendPad(""); 180 181 //182 // Necessary to visualize the background color (FIXME?)183 //184 gPad->Modified();185 gPad->Update();186 168 } 187 169 -
trunk/MagicSoft/Mars/mhist/MHMcIntRate.cc
r1606 r1966 81 81 } 82 82 83 //-------------------------------------------------------------------------84 //85 // Defualt Destructor86 //87 MHMcIntRate::~MHMcIntRate()88 {89 }90 91 83 // ------------------------------------------------------------------------ 92 84 // … … 95 87 void MHMcIntRate::Draw(Option_t *option) 96 88 { 97 if (!gPad)98 MH::MakeDefCanvas(&fHist);89 TVirtualPad *pad = gPad ? gPad : MH::MakeDefCanvas(this); 90 pad->SetBorderMode(0); 99 91 100 gPad->SetLogx(); 92 AppendPad(""); 93 94 pad->SetLogx(); 101 95 102 96 fHist.Draw(option); 103 97 104 gPad->Modified(); 105 gPad->Update(); 106 } 107 108 TObject *MHMcIntRate::DrawClone(Option_t *option) const 109 { 110 TCanvas *c = MH::MakeDefCanvas(&fHist); 111 112 c->SetLogx(); 113 114 // 115 // This is necessary to get the expected bahviour of DrawClone 116 // 117 gROOT->SetSelectedPad(NULL); 118 119 ((TH1D&)fHist).DrawCopy(option); 120 121 c->Modified(); 122 c->Update(); 123 124 return c; 98 pad->Modified(); 99 pad->Update(); 125 100 } 126 101 -
trunk/MagicSoft/Mars/mhist/MHMcIntRate.h
r1663 r1966 21 21 public: 22 22 MHMcIntRate(const char *name=NULL, const char *title=NULL); 23 ~MHMcIntRate();24 23 25 24 void SetName(const char *name); … … 32 31 33 32 void Draw(Option_t* option = ""); 34 TObject *DrawClone(Option_t* option = "") const;35 33 36 34 void Calc(const MHMcDifRate &rate); -
trunk/MagicSoft/Mars/mhist/MHRanForest.cc
r1929 r1966 67 67 fGraphSigma->SetTitle("Evolution of Standard deviation of estimated hadronness in tree combination"); 68 68 fGraphSigma->SetMaximum(1); 69 fGraphSigma->SetMarkerStyle(kFullDotSmall); 69 70 } 70 71 … … 157 158 // -------------------------------------------------------------------------- 158 159 // 159 // Draw clone of histogram160 //161 TObject *MHRanForest::DrawClone(Option_t *opt) const162 {163 if (fGraphSigma->GetN()==0)164 return NULL;165 166 TCanvas &c = *MakeDefCanvas("RanForest", fTitle);167 gROOT->SetSelectedPad(NULL);168 169 //gStyle->SetOptStat(10);170 TGraph &g = (TGraph&)*fGraphSigma->DrawClone("AL");171 g.SetBit(kCanDelete);172 gPad->Modified();173 gPad->Update();174 if (g.GetHistogram())175 {176 g.GetXaxis()->SetRangeUser(0, fNumEvent);177 g.GetXaxis()->SetTitle("Number of Trees");178 g.GetYaxis()->SetTitle("Standard deviation of estimated hadronness");179 g.SetMarkerStyle(kFullDotMedium);180 gPad->Modified();181 gPad->Update();182 //g.Draw("P");183 }184 gPad->SetGrid();185 186 return &c;187 }188 189 // --------------------------------------------------------------------------190 //191 160 // Draw histogram. (For the Meaning see class description) 192 161 // … … 196 165 return; 197 166 198 if (!gPad)199 MakeDefCanvas("RanForest", fTitle);167 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this); 168 pad->SetBorderMode(0); 200 169 201 //gStyle->SetOptStat(10); 170 AppendPad(""); 171 202 172 fGraphSigma->Draw("ALP"); 203 gPad->Modified(); 204 gPad->Update(); 205 if (fGraphSigma->GetHistogram()) 206 { 207 fGraphSigma->GetXaxis()->SetRangeUser(0, 1); 208 fGraphSigma->GetXaxis()->SetTitle("Number of Trees"); 209 fGraphSigma->GetYaxis()->SetTitle("Standard deviation of estimated hadronness"); 173 pad->Modified(); 174 pad->Update(); 210 175 211 fGraphSigma->SetMarkerStyle(kFullDotSmall); 212 //fGraphSigma->Draw("P"); 213 gPad->Modified(); 214 gPad->Update(); 215 } 176 TH1 *h=fGraphSigma->GetHistogram(); 177 if (!h) 178 return; 179 180 h->GetXaxis()->SetRangeUser(0, 1); 181 h->SetXTitle("No.of Trees"); 182 h->SetYTitle("\\sigma of est.hadronness"); 183 184 pad->Modified(); 185 pad->Update(); 216 186 } -
trunk/MagicSoft/Mars/mhist/MHRanForest.h
r1880 r1966 37 37 38 38 void Draw(Option_t *opt=""); 39 TObject *DrawClone(Option_t *opt="") const;40 39 41 40 ClassDef(MHRanForest, 1) // Histogram showing variance of estimated Hadronness -
trunk/MagicSoft/Mars/mhist/MHRanForestGini.cc
r1929 r1966 65 65 fGraphGini->SetTitle("Importance of RF-input parameters measured by mean Gini decrease"); 66 66 fGraphGini->SetMaximum(1); 67 fGraphGini->SetMarkerStyle(kFullDotSmall); 67 68 } 68 69 … … 140 141 // -------------------------------------------------------------------------- 141 142 // 142 // Draw clone of histogram (For the Meaning see class description)143 //144 TObject *MHRanForestGini::DrawClone(Option_t *opt) const145 {146 if (fGraphGini->GetN()==0)147 return NULL;148 149 TCanvas &c = *MakeDefCanvas("RanForestGini", fTitle);150 gROOT->SetSelectedPad(NULL);151 152 //gStyle->SetOptStat(10);153 TGraph &g = (TGraph&)*fGraphGini->DrawClone("AL");154 g.SetBit(kCanDelete);155 gPad->Modified();156 gPad->Update();157 if (g.GetHistogram())158 {159 g.GetXaxis()->SetRangeUser(0, fRanForest->GetNumTrees());160 g.GetXaxis()->SetTitle("No. of RF-input parameter");161 g.GetYaxis()->SetTitle("Mean decrease in Gini-index [a.u.]");162 g.SetMarkerStyle(kFullDotMedium);163 //g.Draw("P");164 gPad->Modified();165 gPad->Update();166 }167 gPad->SetGrid();168 169 return &c;170 }171 172 // --------------------------------------------------------------------------173 //174 143 // Draw histogram. (For the Meaning see class description) 175 144 // 176 145 void MHRanForestGini::Draw(Option_t *) 177 146 { 178 if (fGraphGini->GetN()==0)147 if (fGraphGini->GetN()==0) 179 148 return; 180 149 181 if (!gPad)182 MakeDefCanvas("RanForest", fTitle);150 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this); 151 pad->SetBorderMode(0); 183 152 184 //gStyle->SetOptStat(10); 153 AppendPad(""); 154 185 155 fGraphGini->Draw("ALP"); 186 gPad->Modified(); 187 gPad->Update(); 188 if (fGraphGini->GetHistogram()) 189 { 190 fGraphGini->GetXaxis()->SetRangeUser(0, 1); 191 fGraphGini->GetXaxis()->SetTitle("No. of RF-input parameter"); 192 fGraphGini->GetYaxis()->SetTitle("Mean decrease in Gini-index [a.u.]"); 156 pad->Modified(); 157 pad->Update(); 193 158 194 fGraphGini->SetMarkerStyle(kFullDotSmall); 195 //fGraphGini->Draw("P"); 196 gPad->Modified(); 197 gPad->Update(); 198 } 159 TH1 *h = fGraphGini->GetHistogram(); 160 if (!h) 161 return; 162 163 h->GetXaxis()->SetRangeUser(0, 1); 164 h->SetXTitle("No.of RF-input parameter"); 165 h->SetYTitle("Mean decrease in Gini-index [a.u.]"); 166 167 pad->Modified(); 168 pad->Update(); 199 169 } -
trunk/MagicSoft/Mars/mhist/MHRanForestGini.h
r1880 r1966 35 35 36 36 void Draw(Option_t *opt=""); 37 TObject *DrawClone(Option_t *opt="") const;38 37 39 38 ClassDef(MHRanForestGini, 1) -
trunk/MagicSoft/Mars/mhist/MHSigmaPixel.cc
r1951 r1966 124 124 void MHSigmaPixel::Draw(Option_t *opt) 125 125 { 126 //gStyle->SetOptStat(1000); 127 if (!gPad) 128 MakeDefCanvas("SigmaPixel", fTitle); 129 130 fHist.Draw(opt); 131 132 gPad->Modified(); 133 gPad->Update(); 126 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this); 127 pad->SetBorderMode(0); 128 129 AppendPad(""); 130 131 fHist.Draw(opt); 132 133 gPad->Modified(); 134 gPad->Update(); 134 135 } 135 136 136 // --------------------------------------------------------------------------137 //138 // Draw copies of the histogram139 //140 TObject *MHSigmaPixel::DrawClone(Option_t *opt) const141 {142 //gStyle->SetOptStat(1000);143 TCanvas &c = *MakeDefCanvas("SigmaPixel", fTitle);144 145 ((TH2&)fHist).DrawCopy(opt);146 147 c.Modified();148 c.Update();149 150 return &c;151 }152 -
trunk/MagicSoft/Mars/mhist/MHSigmaPixel.h
r1951 r1966 35 35 36 36 void Draw(Option_t *option=""); 37 TObject *DrawClone(Option_t *option="") const;38 37 39 38 ClassDef(MHSigmaPixel, 1) //2D-histogram in Sigma and Pixel number -
trunk/MagicSoft/Mars/mhist/MHSigmaTheta.cc
r1961 r1966 249 249 TObject *MHSigmaTheta::DrawClone(Option_t *opt) 250 250 { 251 TCanvas &c = *MakeDefCanvas("SigmaThetaPlot", "Sigmabar vs. Theta", 252 900, 900); 253 c.Divide(3, 3); 254 255 gROOT->SetSelectedPad(NULL); 256 257 //-------------------------------------------------------------------- 251 return MH::DrawClone(opt, 900, 900); 252 } 253 254 // -------------------------------------------------------------------------- 255 // 256 // Draw the histogram 257 // 258 void MHSigmaTheta::Draw(Option_t *opt) 259 { 260 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this, 900, 900); 261 pad->SetBorderMode(0); 262 263 AppendPad(""); 264 265 pad->Divide(3, 3); 266 258 267 // draw the 2D histogram Sigmabar versus Theta 259 TH1D *h; 260 261 c.cd(1); 262 h = ((TH2*)&fSigmaTheta)->ProjectionX("ProjX-Theta", -1, 9999, "E"); 268 TH1 *h; 269 270 pad->cd(1); 271 gPad->SetLogy(); 272 h = fSigmaTheta.ProjectionX("ProjX-Theta", -1, 9999, "E"); 263 273 h->SetDirectory(NULL); 264 274 h->SetTitle("Distribution of \\Theta"); 265 275 h->SetXTitle("\\Theta [\\circ]"); 266 276 h->SetYTitle("No.of events"); 267 268 h->DrawCopy(opt); 269 h->SetBit(kCanDelete);; 270 gPad->SetLogy(); 271 272 c.cd(4); 273 h = ((TH2*)&fSigmaTheta)->ProjectionY("ProjY-sigma", -1, 9999, "E"); 274 h->SetDirectory(NULL); 275 h->SetTitle("Distribution of Sigmabar"); 276 h->SetXTitle("Sigmabar"); 277 h->Draw("box"); 278 h->SetBit(kCanDelete); 279 280 pad->cd(2); 281 h = fDiffPixTheta.Project3D("zx"); 282 h->SetDirectory(NULL); 283 h->SetTitle("\\sigma_{ped}^{2}-\\bar{\\sigma}_{ped}^{2} vs. \\Theta (all pixels)"); 284 h->SetXTitle("\\Theta [\\circ]"); 285 h->SetYTitle("\\sigma_{ped}^2-\\bar{\\sigma}_{ped}^{2}"); 286 h->SetBit(kCanDelete); 287 288 pad->cd(3); 289 h = fSigmaPixTheta.Project3D("zx"); 290 h->SetDirectory(NULL); 291 h->SetTitle("\\sigma_{ped} vs. \\Theta (all pixels)"); 292 h->SetXTitle("\\Theta [\\circ]"); 293 h->SetYTitle("\\sigma_{ped}"); 294 h->Draw("box"); 295 h->SetBit(kCanDelete); 296 297 pad->cd(4); 298 h = fSigmaTheta.ProjectionY("ProjY-sigma", -1, 9999, "E"); 299 h->SetDirectory(NULL); 300 h->SetTitle("Distribution of \\bar{\\sigma}_{ped}"); 301 h->SetXTitle("\\bar{\\sigma}_{ped}"); 277 302 h->SetYTitle("No.of events"); 278 279 h->DrawCopy(opt);280 h->SetBit(kCanDelete);;281 282 c.cd(7);283 ((TH2*)&fSigmaTheta)->DrawCopy(opt);284 285 //--------------------------------------------------------------------286 // draw the 3D histogram : Theta, pixel, Sigma^2-Sigmabar^2287 288 TH2D *l;289 290 c.cd(2);291 l = (TH2D*) ((TH3*)&fDiffPixTheta)->Project3D("zx");292 l->SetDirectory(NULL);293 l->SetTitle("Sigma^2-Sigmabar^2 vs. \\Theta (all pixels)");294 l->SetXTitle("\\Theta [\\circ]");295 l->SetYTitle("Sigma^2-Sigmabar^2");296 297 l->DrawCopy("box");298 l->SetBit(kCanDelete);;299 300 c.cd(5);301 l = (TH2D*) ((TH3*)&fDiffPixTheta)->Project3D("zy");302 l->SetDirectory(NULL);303 l->SetTitle("Sigma^2-Sigmabar^2 vs. pixel number (all \\Theta)");304 l->SetXTitle("pixel");305 l->SetYTitle("Sigma^2-Sigmabar^2");306 307 l->DrawCopy("box");308 l->SetBit(kCanDelete);;309 310 //c.cd(8);311 //((TH2*)&fDiffPixTheta)->DrawCopy(opt);312 313 c.cd(8);314 ((TH1*)&fBlindId)->DrawCopy(opt);315 316 317 //--------------------------------------------------------------------318 // draw the 3D histogram : Theta, pixel, Sigma319 320 TH2D *k;321 322 c.cd(3);323 k = (TH2D*) ((TH3*)&fSigmaPixTheta)->Project3D("zx");324 k->SetDirectory(NULL);325 k->SetTitle("Sigma vs. \\Theta (all pixels)");326 k->SetXTitle("\\Theta [\\circ]");327 k->SetYTitle("Sigma");328 329 k->DrawCopy("box");330 k->SetBit(kCanDelete);;331 332 c.cd(6);333 k = (TH2D*) ((TH3*)&fSigmaPixTheta)->Project3D("zy");334 k->SetDirectory(NULL);335 k->SetTitle("Sigma vs. pixel number (all \\Theta)");336 k->SetXTitle("pixel");337 k->SetYTitle("Sigma");338 339 k->DrawCopy("box");340 k->SetBit(kCanDelete);;341 342 //c.cd(9);343 //((TH2*)&fSigmaPixTheta)->DrawCopy(opt);344 345 c.cd(9);346 ((TH1*)&fNpix)->DrawCopy(opt);347 348 //--------------------------------------------------------------------349 c.Modified();350 c.Update();351 352 return &c;353 }354 355 // --------------------------------------------------------------------------356 //357 // Draw the histogram358 //359 void MHSigmaTheta::Draw(Option_t *opt)360 {361 if (!gPad)362 MakeDefCanvas("SigmaTheta", "Sigmabar vs. Theta", 600, 600);363 364 TH1D *h;365 366 gPad->Divide(2,2);367 368 gPad->cd(1);369 h = ((TH2*)&fSigmaTheta)->ProjectionX("ProjX-Theta", -1, 9999, "E");370 h->SetTitle("Distribution of \\Theta");371 h->SetXTitle("\\Theta [\\circ]");372 h->SetYTitle("No.of events");373 374 303 h->Draw(opt); 375 h->SetBit(kCanDelete);; 376 gPad->SetLogy(); 377 378 gPad->cd(2); 379 h = ((TH2*)&fSigmaTheta)->ProjectionY("ProjY-sigma", -1, 9999, "E"); 380 h->SetTitle("Distribution of Sigmabar"); 381 h->SetXTitle("Sigmabar"); 382 h->SetYTitle("No.of events"); 383 384 h->Draw(opt); 385 h->SetBit(kCanDelete);; 386 387 gPad->cd(3); 388 fSigmaTheta.DrawCopy(opt); 389 390 gPad->Modified(); 391 gPad->Update(); 392 } 393 // -------------------------------------------------------------------------- 394 395 396 397 304 h->SetBit(kCanDelete); 305 306 pad->cd(5); 307 h = fDiffPixTheta.Project3D("zy"); 308 h->SetDirectory(NULL); 309 h->SetTitle("\\sigma_{ped}^{2}-\\bar{\\sigma}_{ped}^{2} vs. pixel Id (all \\Theta)"); 310 h->SetXTitle("Id"); 311 h->SetYTitle("\\sigma_{ped}^{2}-\\bar{\\sigma}_{ped}^{2}"); 312 h->Draw("box"); 313 h->SetBit(kCanDelete); 314 315 pad->cd(6); 316 h = fSigmaPixTheta.Project3D("zy"); 317 h->SetDirectory(NULL); 318 h->SetTitle("\\sigma_{ped} vs. pixel Id (all \\Theta)"); 319 h->SetXTitle("Id"); 320 h->SetYTitle("\\sigma_{ped}"); 321 h->Draw("box"); 322 h->SetBit(kCanDelete); 323 324 pad->cd(7); 325 fSigmaTheta.Draw(opt); 326 327 pad->cd(8); 328 fDiffPixTheta.Draw(opt); 329 330 pad->cd(9); 331 fSigmaPixTheta.Draw(opt); 332 } -
trunk/MagicSoft/Mars/mhist/MHSigmabarTheta.cc
r1951 r1966 63 63 fHist.SetTitle("3D-plot of sigmabar and theta"); 64 64 fHist.SetXTitle("\\theta [\\circ]"); 65 fHist.SetYTitle("\\ overline{\\sigma}");65 fHist.SetYTitle("\\bar{\\sigma}"); 66 66 fHist.SetZTitle("N"); 67 67 } … … 123 123 void MHSigmabarTheta::Draw(Option_t *opt) 124 124 { 125 if (!gPad) 126 MakeDefCanvas("SigmabarTheta", fTitle); 127 125 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this); 126 pad->SetBorderMode(0); 127 128 AppendPad(""); 129 128 130 fHist.Draw(opt); 129 131 130 gPad->Modified();131 gPad->Update();132 pad->Modified(); 133 pad->Update(); 132 134 } 133 135 134 // --------------------------------------------------------------------------135 //136 // Draw copies of the histogram137 //138 TObject *MHSigmabarTheta::DrawClone(Option_t *opt) const139 {140 TCanvas &c = *MakeDefCanvas("SigmabarTheta", fTitle);141 142 ((TH2&)fHist).DrawCopy(opt);143 144 c.Modified();145 c.Update();146 147 return &c;148 }149 -
trunk/MagicSoft/Mars/mhist/MHSigmabarTheta.h
r1951 r1966 36 36 37 37 void Draw(Option_t *option=""); 38 TObject *DrawClone(Option_t *option="") const;39 38 40 39 ClassDef(MHSigmabarTheta, 1) //3D-histogram in alpha, Energy and theta -
trunk/MagicSoft/Mars/mhist/MHThetabarTheta.cc
r1668 r1966 61 61 62 62 fHist.SetXTitle("\\Theta [\\circ]"); 63 fHist.SetYTitle(" Theta-bar[ \\circ]");63 fHist.SetYTitle("\\bar{\\Theta} [ \\circ]"); 64 64 } 65 65 … … 91 91 // -------------------------------------------------------------------------- 92 92 // 93 // Draw a copy of the histogram94 //95 TObject *MHThetabarTheta::DrawClone(Option_t *opt) const96 {97 TCanvas &c = *MakeDefCanvas("ThetabarTheta", "Thetabar vs. Theta");98 99 gROOT->SetSelectedPad(NULL);100 101 ((TProfile)fHist).DrawCopy(opt);102 103 c.Modified();104 c.Update();105 106 return &c;107 }108 109 // --------------------------------------------------------------------------110 //111 93 // Draw the histogram 112 94 // 113 95 void MHThetabarTheta::Draw(Option_t *opt) 114 96 { 115 if (!gPad)116 MakeDefCanvas("ThetabarTheta", "Thetabar vs. Theta");97 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this); 98 pad->SetBorderMode(0); 117 99 118 fHist.DrawCopy(opt);100 AppendPad(""); 119 101 120 gPad->Modified(); 121 gPad->Update(); 102 fHist.Draw(opt); 103 104 pad->Modified(); 105 pad->Update(); 122 106 } 123 107 -
trunk/MagicSoft/Mars/mhist/MHThetabarTheta.h
r1668 r1966 34 34 35 35 void Draw(Option_t *option=""); 36 TObject *DrawClone(Option_t *option="") const;37 36 38 37 ClassDef(MHThetabarTheta, 0) //Profile histogram Thetabar vs. time -
trunk/MagicSoft/Mars/mhist/MHThetabarTime.cc
r1412 r1966 63 63 64 64 fHist.SetXTitle("time [s]"); 65 fHist.SetYTitle(" Theta-bar[ \\circ]");65 fHist.SetYTitle("\\bar{\\Theta} [ \\circ]"); 66 66 } 67 67 … … 100 100 // -------------------------------------------------------------------------- 101 101 // 102 // Draw a copy of the histogram103 //104 TObject *MHThetabarTime::DrawClone(Option_t *opt) const105 {106 TCanvas &c = *MakeDefCanvas("ThetabarTime", "Thetabar vs. time");107 108 gROOT->SetSelectedPad(NULL);109 110 ((TProfile*)&fHist)->DrawCopy(opt);111 112 c.Modified();113 c.Update();114 115 return &c;116 }117 118 // --------------------------------------------------------------------------119 //120 102 // Draw the histogram 121 103 // 122 104 void MHThetabarTime::Draw(Option_t *opt) 123 105 { 124 if (!gPad)125 MakeDefCanvas("ThetabarTime", "Thetabar vs. time");106 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this); 107 pad->SetBorderMode(0); 126 108 127 fHist.DrawCopy(opt);109 AppendPad(""); 128 110 129 gPad->Modified(); 130 gPad->Update(); 111 fHist.Draw(opt); 112 113 pad->Modified(); 114 pad->Update(); 131 115 } 132 116 -
trunk/MagicSoft/Mars/mhist/MHThetabarTime.h
r1668 r1966 37 37 38 38 void Draw(Option_t *option=""); 39 TObject *DrawClone(Option_t *option="") const;40 39 41 40 ClassDef(MHThetabarTime, 0) //Profile histogram Thetabar vs. time -
trunk/MagicSoft/Mars/mhist/MHTimeDiffTheta.cc
r1668 r1966 102 102 // -------------------------------------------------------------------------- 103 103 // 104 // Draw a copy of the histogram105 //106 TObject *MHTimeDiffTheta::DrawClone(Option_t *opt) const107 {108 TCanvas &c = *MakeDefCanvas("DiffTimeTheta", "Distrib of \\Delta t, Theta");109 110 c.Divide(2, 2);111 112 gROOT->SetSelectedPad(NULL);113 114 //115 // FIXME: ProjectionX,Y is not const within root116 //117 118 TH1D *h;119 120 c.cd(1);121 h = ((TH2*)&fHist)->ProjectionX("ProjX-Theta", -1, 9999, "E");122 123 h->SetTitle("Distribution of \\Delta t [s]");124 h->SetXTitle("\\Delta t [s]");125 h->SetYTitle("Counts");126 127 h->Draw(opt);128 h->SetBit(kCanDelete);;129 gPad->SetLogy();130 131 c.cd(2);132 h = ((TH2*)&fHist)->ProjectionY("ProjY-timediff", -1, 9999, "E");133 134 h->SetTitle("Distribution of \\Theta [\\circ]");135 h->SetXTitle("\\Theta [\\circ]");136 h->SetYTitle("Counts");137 138 h->Draw(opt);139 h->SetBit(kCanDelete);;140 141 c.cd(3);142 ((TH2*)&fHist)->DrawCopy(opt);143 144 c.Modified();145 c.Update();146 147 return &c;148 }149 150 // --------------------------------------------------------------------------151 //152 104 // Draw the histogram 153 105 // 154 106 void MHTimeDiffTheta::Draw(Option_t *opt) 155 107 { 156 if (!gPad)157 MakeDefCanvas("DiffTimeTheta", "Distrib of Delta t, Theta");108 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this); 109 pad->SetBorderMode(0); 158 110 159 TH1D *h;111 AppendPad(""); 160 112 161 gPad->Divide(2,2);113 TH1 *h; 162 114 163 gPad->cd(1); 115 pad->Divide(2,2); 116 117 pad->cd(1); 118 gPad->SetLogy(); 164 119 h = fHist.ProjectionX("ProjX_Theta", -1, 9999, "E"); 165 166 120 h->SetTitle("Distribution of \\Delta t [s]"); 167 121 h->SetXTitle("\\Delta t [s]"); 168 122 h->SetYTitle("Counts"); 169 170 123 h->Draw(opt); 171 124 h->SetBit(kCanDelete);; 172 gPad->SetLogy();173 125 174 gPad->cd(2);126 pad->cd(2); 175 127 h = fHist.ProjectionY("ProjY_timediff", -1, 9999, "E"); 176 177 128 h->SetTitle("Distribution of \\Theta [\\circ]"); 178 129 h->SetXTitle("\\Theta [\\circ]"); 179 130 h->SetYTitle("Counts"); 180 181 131 h->Draw(opt); 182 132 h->SetBit(kCanDelete);; 183 133 184 gPad->cd(3);185 fHist.Draw Copy(opt);134 pad->cd(3); 135 fHist.Draw(opt); 186 136 187 gPad->Modified();188 gPad->Update();137 pad->Modified(); 138 pad->Update(); 189 139 } 190 140 -
trunk/MagicSoft/Mars/mhist/MHTimeDiffTheta.h
r1668 r1966 35 35 36 36 void Draw(Option_t *option=""); 37 TObject *DrawClone(Option_t *option="") const;38 37 39 38 ClassDef(MHTimeDiffTheta, 0) //2D-histogram time-diff vs. Theta -
trunk/MagicSoft/Mars/mhist/MHTimeDiffTime.cc
r1668 r1966 95 95 // -------------------------------------------------------------------------- 96 96 // 97 // Draw a copy of the histogram98 //99 TObject *MHTimeDiffTime::DrawClone(Option_t *opt) const100 {101 102 TCanvas &c = *MakeDefCanvas("DiffTimeTime", "Distrib of dt and t");103 104 c.Divide(2, 2);105 106 gROOT->SetSelectedPad(NULL);107 108 TH1D *h;109 110 c.cd(1);111 h = ((TH2*)&fHist)->ProjectionX("ProjX-sumtime", -1, 9999, "E");112 113 h->SetTitle("Distribution of \\Delta t [s]");114 h->SetXTitle("\\Delta t [s]");115 h->SetYTitle("Counts");116 117 h->Draw(opt);118 h->SetBit(kCanDelete);119 gPad->SetLogy();120 121 c.cd(2);122 h = ((TH2*)&fHist)->ProjectionY("ProjY-sumtimediff", -1, 9999, "E");123 124 h->SetTitle("Distribution of time [s]");125 h->SetXTitle("time [s]");126 h->SetYTitle("Counts");127 128 h->Draw(opt);129 h->SetBit(kCanDelete);130 131 c.cd(3);132 ((TH2*)&fHist)->DrawCopy(opt);133 134 c.Modified();135 c.Update();136 137 return &c;138 }139 140 // --------------------------------------------------------------------------141 //142 97 // Draw the histogram 143 98 // 144 99 void MHTimeDiffTime::Draw(Option_t *opt) 145 100 { 146 if (!gPad)147 MakeDefCanvas("DiffTimeTime", "Distrib of \\Delta t, time");101 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this); 102 pad->SetBorderMode(0); 148 103 149 gPad->Divide(2,2); 104 AppendPad(""); 105 106 pad->Divide(2,2); 150 107 151 108 TH1D *h; 152 109 153 gPad->cd(1); 110 pad->cd(1); 111 gPad->SetLogy(); 154 112 h = fHist.ProjectionX("ProjX_sumtime", -1, 9999, "E"); 155 156 113 h->SetTitle("Distribution of \\Delta t [s]"); 157 114 h->SetXTitle("\\Delta t [s]"); 158 115 h->SetYTitle("Counts"); 159 160 116 h->Draw(opt); 161 117 h->SetBit(kCanDelete); 162 gPad->SetLogy();163 118 164 gPad->cd(2);119 pad->cd(2); 165 120 h = fHist.ProjectionY("ProjY_sumtimediff", -1, 9999, "E"); 166 167 121 h->SetTitle("Distribution of time [s]"); 168 122 h->SetXTitle("time [s]"); 169 123 h->SetYTitle("Counts"); 170 171 124 h->Draw(opt); 172 125 h->SetBit(kCanDelete); 173 126 174 gPad->cd(3);127 pad->cd(3); 175 128 fHist.DrawCopy(opt); 176 129 177 gPad->Modified(); 178 gPad->Update(); 179 130 pad->Modified(); 131 pad->Update(); 180 132 } 181 133 -
trunk/MagicSoft/Mars/mhist/MHTimeDiffTime.h
r1668 r1966 33 33 34 34 void Draw(Option_t *option=""); 35 TObject *DrawClone(Option_t *option="") const;36 35 37 36 ClassDef(MHTimeDiffTime, 0) //2D-histogram time-diff vs. time -
trunk/MagicSoft/Mars/mimage/MHNewImagePar.cc
r1965 r1966 55 55 // 56 56 MHNewImagePar::MHNewImagePar(const char *name, const char *title) 57 : fUseMmScale(kTRUE)58 57 { 59 58 fName = name ? name : "MHNewImagePar"; 60 fTitle = title ? title : " Container for histograms of new image parameters";59 fTitle = title ? title : "Histograms of new image parameters"; 61 60 62 fLeakage1 = new TH1F("Leakage1", "Leakage 1", 100, 0.0, 1.0);61 fLeakage1 = new TH1F("Leakage1", "Leakage_{1}", 100, 0.0, 1.0); 63 62 fLeakage1->SetDirectory(NULL); 64 fLeakage1->SetXTitle("Leakage 1");63 fLeakage1->SetXTitle("Leakage"); 65 64 fLeakage1->SetYTitle("Counts"); 66 65 67 fLeakage2 = new TH1F("Leakage2", "Leakage 2", 100, 0.0, 1.0);66 fLeakage2 = new TH1F("Leakage2", "Leakage_{2}", 100, 0.0, 1.0); 68 67 fLeakage2->SetDirectory(NULL); 69 fLeakage2->SetXTitle("Leakage 2");68 fLeakage2->SetXTitle("Leakage"); 70 69 fLeakage2->SetYTitle("Counts"); 70 fLeakage2->SetLineColor(kBlue); 71 71 } 72 72 … … 79 79 delete fLeakage1; 80 80 delete fLeakage2; 81 }82 83 // --------------------------------------------------------------------------84 //85 // Setup the Binning for the histograms automatically if the correct86 // instances of MBinning (with the names 'BinningAlpha' and 'BinningDist')87 // are found in the parameter list88 // Use this function if you want to set the conversion factor which89 // is used to convert the mm-scale in the camera plain into the deg-scale90 // used for histogram presentations. The conversion factor is part of91 // the camera geometry. Please create a corresponding MGeomCam container.92 //93 Bool_t MHNewImagePar::SetupFill(const MParList *plist)94 {95 const MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");96 if (!geom)97 *fLog << warn << dbginf << "No Camera Geometry available. Using mm-scale for histograms." << endl;98 else99 {100 fMm2Deg = geom->GetConvMm2Deg();101 SetMmScale(kFALSE);102 }103 104 //ApplyBinning(*plist, "Alpha", fAlpha);105 //ApplyBinning(*plist, "Dist", fDist);106 //ApplyBinning(*plist, "HeadTail", fHeadTail);107 108 return kTRUE;109 81 } 110 82 … … 125 97 // -------------------------------------------------------------------------- 126 98 // 127 // Use this function to setup your own conversion factor between degrees128 // and millimeters. The conversion factor should be the one calculated in129 // MGeomCam. Use this function with Caution: You could create wrong values130 // by setting up your own scale factor.131 //132 void MHNewImagePar::SetMm2Deg(Float_t mmdeg)133 {134 if (mmdeg<=0)135 {136 *fLog << warn << dbginf << "Warning - Conversion factor <= 0 - nonsense. Ignored." << endl;137 return;138 }139 140 if (fMm2Deg>0)141 *fLog << warn << dbginf << "Warning - Conversion factor already set. Overwriting" << endl;142 143 fMm2Deg = mmdeg;144 }145 146 // --------------------------------------------------------------------------147 //148 // With this function you can convert the histogram ('on the fly') between149 // degrees and millimeters.150 //151 void MHNewImagePar::SetMmScale(Bool_t mmscale)152 {153 if (fUseMmScale == mmscale)154 return;155 156 if (fMm2Deg<0)157 {158 *fLog << warn << GetDescriptor() << ": Warning - Sorry, no conversion factor for conversion available." << endl;159 return;160 }161 162 //const Double_t scale = mmscale ? 1./fMm2Deg : fMm2Deg;163 //MH::ScaleAxis(fDist, scale);164 //MH::ScaleAxis(fHeadTail, scale);165 166 if (mmscale)167 {168 // fDist->SetXTitle("Dist [mm]");169 // fHeadTail->SetXTitle("Head-Tail [mm]");170 }171 else172 {173 // fDist->SetXTitle("Dist [\\circ]");174 // fHeadTail->SetXTitle("Head-Tail [\\circ]");175 }176 177 fUseMmScale = mmscale;178 }179 180 // --------------------------------------------------------------------------181 //182 // Draw clones of all two histograms. So that the object can be deleted183 // and the histograms are still visible in the canvas.184 // The cloned object are deleted together with the canvas if the canvas is185 // destroyed. If you want to handle dostroying the canvas you can get a186 // pointer to it from this function187 //188 TObject *MHNewImagePar::DrawClone(Option_t *opt) const189 {190 return MH::DrawClone(opt, 300, 600);191 }192 193 // --------------------------------------------------------------------------194 //195 99 // Creates a new canvas and draws the two histograms into it. 196 100 // Be careful: The histograms belongs to this object and won't get deleted … … 199 103 void MHNewImagePar::Draw(Option_t *) 200 104 { 201 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this , 300, 600);105 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this); 202 106 pad->SetBorderMode(0); 203 107 204 108 AppendPad(""); 205 109 206 pad->Divide(1, 2); 207 208 pad->cd(1); 209 pad->SetBorderMode(0); 210 fLeakage1->Draw(); 211 212 pad->cd(2); 213 pad->SetBorderMode(0); 214 fLeakage2->Draw(); 110 MH::Draw(*fLeakage1, *fLeakage2, "Leakage1 and Leakage2"); 215 111 216 112 pad->Modified(); … … 228 124 return NULL; 229 125 } 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 -
trunk/MagicSoft/Mars/mimage/MHNewImagePar.h
r1940 r1966 15 15 TH1F *fLeakage2; //-> 16 16 17 Float_t fMm2Deg;18 Bool_t fUseMmScale;19 20 17 public: 21 18 MHNewImagePar(const char *name=NULL, const char *title=NULL); 22 19 ~MHNewImagePar(); 23 20 24 void SetMmScale(Bool_t mmscale=kTRUE);25 void SetMm2Deg(Float_t mmdeg);26 27 Bool_t SetupFill(const MParList *pList);28 21 Bool_t Fill(const MParContainer *par); 29 22 … … 34 27 35 28 void Draw(Option_t *opt=NULL); 36 TObject *DrawClone(Option_t *opt=NULL) const;37 29 38 ClassDef(MHNewImagePar, 1) // Container which holds histograms for thenew image parameters30 ClassDef(MHNewImagePar, 1) // Histograms of new image parameters 39 31 }; 40 32 -
trunk/MagicSoft/Mars/mimage/MNewImagePar.cc
r1940 r1966 72 72 const MHillas *hillas) 73 73 { 74 //fHillas = (MHillas*)hillas;75 76 74 const UInt_t npixevt = evt.GetNumPixels(); 77 75 78 Double_t edgepix1 = 0 .0;79 Double_t edgepix2 = 0 .0;76 Double_t edgepix1 = 0; 77 Double_t edgepix2 = 0; 80 78 81 79 for (UInt_t i=0; i<npixevt; i++) … … 87 85 const MGeomPix &gpix = geom[pix.GetPixId()]; 88 86 89 Double_t nphot = pix.GetNumPhotons();87 const Double_t nphot = pix.GetNumPhotons(); 90 88 91 89 // count photons in outer rings of camera -
trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc
r1965 r1966 372 372 txt += cont.GetTitle(); 373 373 374 cout << txt << endl;375 376 374 SetStatusLine2(txt); 377 375 } … … 552 550 553 551 // layout and map new tab 552 #if ROOT_VERSION_CODE < ROOT_VERSION(3,03,00) 553 MapSubwindows(); 554 Layout(); 555 #else 554 556 Layout(); 555 557 MapSubwindows(); 558 #endif 556 559 557 560 // display new tab in the main frame … … 804 807 return kTRUE; 805 808 806 if (timer==&fTimer) 807 { 808 TGCompositeFrame *f=fTab->GetCurrentContainer(); 809 if (f!=fLogBox) 810 return kTRUE; 811 812 UpdateTab(f); 813 return kTRUE; 814 } 809 // Update a canvas tab (if visible) 810 if (timer==&fTimer && c!=fLogIdx) 811 { 812 UpdateTab(fTab->GetCurrentContainer()); 813 return kTRUE; 814 } 815 816 // update the logbook tab (if visible) 815 817 if (timer==&fLogTimer && c==fLogIdx) 816 818 {
Note:
See TracChangeset
for help on using the changeset viewer.