Changeset 2015 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 04/28/03 09:52:57 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MFillH.cc
r1994 r2015 326 326 } 327 327 328 // -------------------------------------------------------------------------- 329 // 330 // Creates a new tab in a status display with the name of the MH class, 331 // if fDisplay is set and the MH-class overwrites the Draw function 332 // 328 333 Bool_t MFillH::DrawToDisplay() 329 334 { 335 fCanvas = NULL; 336 330 337 if (!fDisplay) 338 return kTRUE; 339 340 if (!fH->OverwritesDraw()) 331 341 return kTRUE; 332 342 … … 485 495 fH->SetReadyToSave(); 486 496 487 if (fDisplay) 497 // 498 // Check whether fDisplay has previously been used (fCanvas) 499 // and fDisplay is still open. 500 // 501 if (fCanvas && fDisplay) 488 502 { 489 503 fCanvas->cd(); -
trunk/MagicSoft/Mars/mhist/MH.cc
r2010 r2015 59 59 #include <TLegend.h> 60 60 #include <TPaveStats.h> 61 #include <TBaseClass.h> 61 62 #if ROOT_VERSION_CODE > ROOT_VERSION(3,04,01) 62 63 #include <THLimitsFinder.h> … … 589 590 590 591 // FIXME: Also align max/min with set Maximum/Minimum 591 const Double_t max = TMath::Max(hist1.GetBinContent(hist1.GetMaximumBin()), hist2.GetBinContent(hist2.GetMaximumBin())); 592 const Double_t min = TMath::Min(hist1.GetBinContent(hist1.GetMinimumBin()), hist2.GetBinContent(hist2.GetMinimumBin())); 593 h1->SetMaximum(max); 594 h1->SetMinimum(min); 592 const Double_t maxbin1 = hist1.GetBinContent(hist1.GetMaximumBin()); 593 const Double_t maxbin2 = hist2.GetBinContent(hist2.GetMaximumBin()); 594 const Double_t minbin1 = hist1.GetBinContent(hist1.GetMinimumBin()); 595 const Double_t minbin2 = hist2.GetBinContent(hist2.GetMinimumBin()); 596 597 const Double_t max = TMath::Max(maxbin1, maxbin2); 598 const Double_t min = TMath::Min(minbin1, minbin2); 599 600 h1->SetMaximum(max>0?max*1.05:max*0.95); 601 h1->SetMinimum(max>0?min*0.95:min*1.05); 595 602 596 603 TPaveText *t = (TPaveText*)gPad->FindObject("title"); … … 658 665 gPad->Update(); 659 666 660 // FIXME: Also align max/min with set Maximum/Minimum661 667 /* 662 const Double_t max = TMath::Max(hist1.GetBinContent(hist1.GetMaximumBin()), hist2.GetBinContent(hist2.GetMaximumBin())); 663 const Double_t min = TMath::Min(hist1.GetBinContent(hist1.GetMinimumBin()), hist2.GetBinContent(hist2.GetMinimumBin())); 664 hist1.SetMaximum(max); 665 hist1.SetMinimum(min); 668 const Double_t maxbin1 = hist1.GetBinContent(hist1.GetMaximumBin()); 669 const Double_t maxbin2 = hist2.GetBinContent(hist2.GetMaximumBin()); 670 const Double_t minbin1 = hist1.GetBinContent(hist1.GetMinimumBin()); 671 const Double_t minbin2 = hist2.GetBinContent(hist2.GetMinimumBin()); 672 673 const Double_t max = TMath::Max(maxbin1, maxbin2); 674 const Double_t min = TMath::Min(minbin1, minbin2); 675 676 hist1.SetMaximum(max>0?max*1.05:max*0.95); 677 hist1.SetMinimum(max>0?min*0.95:min*1.05); 666 678 */ 667 679 … … 751 763 return o; 752 764 } 765 766 // -------------------------------------------------------------------------- 767 // 768 // Check whether a class inheriting from MH overwrites the Draw function 769 // 770 Bool_t MH::OverwritesDraw(TClass *cls) const 771 { 772 if (!cls) 773 cls = IsA(); 774 775 // 776 // Check whether we reached the base class MTask 777 // 778 if (TString(cls->GetName())=="MH") 779 return kFALSE; 780 781 // 782 // Check whether the class cls overwrites Draw 783 // 784 if (cls->GetMethodAny("Draw")) 785 { 786 *fLog << all << "FOUND: " << cls->GetName() << " " << (cls->GetName()=="MH") << endl; 787 return kTRUE; 788 } 789 790 // 791 // If the class itself doesn't overload it check all it's base classes 792 // 793 TBaseClass *base=NULL; 794 TIter NextBase(cls->GetListOfBases()); 795 while ((base=(TBaseClass*)NextBase())) 796 { 797 if (OverwritesDraw(base->GetClassPointer())) 798 return kTRUE; 799 } 800 801 return kFALSE; 802 } -
trunk/MagicSoft/Mars/mhist/MH.h
r2003 r2015 21 21 MH(const char *name=NULL, const char *title=NULL); 22 22 23 Bool_t OverwritesDraw(TClass *cls=NULL) const; 24 23 25 virtual Bool_t SetupFill(const MParList *pList) { return kTRUE; } 24 26 virtual Bool_t Fill(const MParContainer *par, Double_t weight=1); … … 30 32 31 33 static TCanvas *MakeDefCanvas(TString name="", const char *title="", 32 const UInt_t w= 580, const UInt_t h=435);34 const UInt_t w=625, const UInt_t h=440); 33 35 static TCanvas *MakeDefCanvas(const TObject *obj, 34 const UInt_t w= 580, const UInt_t h=435);36 const UInt_t w=625, const UInt_t h=440); 35 37 36 38 static void SetBinning(TH1 *h, const MBinning *binsx); … … 63 65 TObject *DrawClone(Option_t *opt="") const 64 66 { 65 return MH::DrawClone(opt, 580, 435);67 return MH::DrawClone(opt, 625, 440); 66 68 } 67 69 -
trunk/MagicSoft/Mars/mhist/MHAlphaEnergyTheta.cc
r1992 r2015 126 126 void MHAlphaEnergyTheta::Draw(Option_t *opt) 127 127 { 128 if (!gPad)129 MakeDefCanvas("AlphaEnergyTheta", fTitle);128 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this); 129 pad->SetBorderMode(0); 130 130 131 gPad->Divide(2,2); 131 AppendPad(""); 132 133 pad->Divide(2,2); 132 134 133 135 TH1 *h; 134 136 135 gPad->cd(1); 137 pad->cd(1); 138 gPad->SetBorderMode(0); 136 139 h = fHist.Project3D("expro"); 137 138 140 h->SetTitle("Distribution of \\alpha [\\circ]"); 139 141 h->SetXTitle("\\alpha [\\circ]"); 140 142 h->SetYTitle("Counts"); 141 142 143 h->Draw(opt); 143 144 h->SetBit(kCanDelete); 144 145 145 gPad->cd(2); 146 pad->cd(2); 147 gPad->SetBorderMode(0); 148 gPad->SetLogx(); 146 149 h = fHist.Project3D("eypro"); 147 148 150 h->SetTitle("Distribution of E-est [GeV]"); 149 151 h->SetXTitle("E_{est} [GeV]"); 150 152 h->SetYTitle("Counts"); 151 152 153 h->Draw(opt); 153 154 h->SetBit(kCanDelete); 154 gPad->SetLogx();155 155 156 gPad->cd(3); 156 pad->cd(3); 157 gPad->SetBorderMode(0); 157 158 h = fHist.Project3D("ezpro"); 158 159 159 h->SetTitle("Distribution of \\Theta [\\circ]"); 160 160 h->SetXTitle("\\Theta [\\circ]"); 161 161 h->SetYTitle("Counts"); 162 163 162 h->Draw(opt); 164 163 h->SetBit(kCanDelete); 165 164 166 gPad->cd(4); 165 pad->cd(4); 166 gPad->SetBorderMode(0); 167 167 fHist.Draw(opt); 168 168 169 gPad->Modified();170 gPad->Update();169 pad->Modified(); 170 pad->Update(); 171 171 } 172 173 // --------------------------------------------------------------------------174 //175 // Draw copies of the histogram176 //177 TObject *MHAlphaEnergyTheta::DrawClone(Option_t *opt) const178 {179 TCanvas &c = *MakeDefCanvas("AlphaEnergyTheta", fTitle);180 c.Divide(2, 2);181 182 gROOT->SetSelectedPad(NULL);183 184 TH1 *h;185 186 c.cd(1);187 h = ((TH3*)(&fHist))->Project3D(fName+"_expro");188 189 h->SetTitle("Distribution of \\alpha [\\circ]");190 h->SetXTitle("\\alpha [\\circ]");191 h->SetYTitle("Counts");192 193 h->Draw(opt);194 h->SetBit(kCanDelete);195 196 c.cd(2);197 h = ((TH3*)(&fHist))->Project3D(fName+"_eypro");198 199 h->SetTitle("Distribution of E-est [GeV]");200 h->SetXTitle("E_{est} [GeV]");201 h->SetYTitle("Counts");202 203 h->Draw(opt);204 h->SetBit(kCanDelete);205 gPad->SetLogx();206 207 c.cd(3);208 h = ((TH3*)(&fHist))->Project3D(fName+"_ezpro");209 210 h->SetTitle("Distribution of \\Theta [\\circ]");211 h->SetXTitle("\\Theta [\\circ]");212 h->SetYTitle("Counts");213 214 h->Draw(opt);215 h->SetBit(kCanDelete);216 217 c.cd(4);218 ((TH3&)fHist).DrawCopy(opt);219 220 c.Modified();221 c.Update();222 223 return &c;224 }225 -
trunk/MagicSoft/Mars/mhist/MHAlphaEnergyTheta.h
r1992 r2015 42 42 43 43 void Draw(Option_t *option=""); 44 TObject *DrawClone(Option_t *option="") const;45 44 46 45 ClassDef(MHAlphaEnergyTheta, 0) //3D-histogram in alpha, Energy and theta -
trunk/MagicSoft/Mars/mhist/MHAlphaEnergyTime.cc
r1992 r2015 126 126 void MHAlphaEnergyTime::Draw(Option_t *opt) 127 127 { 128 if (!gPad)129 MakeDefCanvas("AlphaEnergyTime", fTitle);130 131 gPad->Divide(2,2);128 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this); 129 pad->SetBorderMode(0); 130 131 pad->Divide(2,2); 132 132 133 133 TH1 *h; 134 134 135 gPad->cd(1); 135 pad->cd(1); 136 gPad->SetBorderMode(0); 136 137 h = fHist.Project3D("ex"); 137 138 138 h->SetTitle("Distribution of \\alpha [\\circ]"); 139 139 h->SetXTitle("\\alpha [\\circ]"); 140 140 h->SetYTitle("Counts"); 141 142 141 h->Draw(opt); 143 142 h->SetBit(kCanDelete); 144 143 145 gPad->cd(2); 144 pad->cd(2); 145 gPad->SetBorderMode(0); 146 gPad->SetLogx(); 146 147 h = fHist.Project3D("ey"); 147 148 148 h->SetTitle("Distribution of E-est [GeV]"); 149 149 h->SetXTitle("E-est [GeV] "); 150 150 h->SetYTitle("Counts"); 151 152 151 h->Draw(opt); 153 152 h->SetBit(kCanDelete); 154 gPad->SetLogx(); 155 156 gPad-> cd(3);153 154 pad->cd(3); 155 gPad->SetBorderMode(0); 157 156 h = fHist.Project3D("ez"); 158 159 157 h->SetTitle("Distribution of time [s]"); 160 158 h->SetXTitle("time [s]"); 161 159 h->SetYTitle("Counts"); 162 163 160 h->Draw(opt); 164 161 h->SetBit(kCanDelete); 165 162 166 gPad->cd(4); 163 pad->cd(4); 164 gPad->SetBorderMode(0); 167 165 fHist.Draw(opt); 168 166 169 gPad->Modified(); 170 gPad->Update(); 171 172 } 173 174 // -------------------------------------------------------------------------- 175 // 176 // Draw copies of the histogram 177 // 178 TObject *MHAlphaEnergyTime::DrawClone(Option_t *opt) const 179 { 180 TCanvas &c = *MakeDefCanvas("AlphaEnergyTime", fTitle); 181 182 c.Divide(2, 2); 183 184 gROOT->SetSelectedPad(NULL); 185 186 TH1 *h; 187 188 c.cd(1); 189 h = ((TH3D*)(&fHist))->Project3D("ex"); 190 191 h->SetTitle("Distribution of \\alpha [\\circ]"); 192 h->SetXTitle("\\alpha [\\circ]"); 193 h->SetYTitle("Counts"); 194 195 h->Draw(opt); 196 h->SetBit(kCanDelete); 197 198 c.cd(2); 199 h = ((TH3D*)(&fHist))->Project3D("ey"); 200 201 h->SetTitle("Distribution of E-est [GeV]"); 202 h->SetXTitle("E-est [GeV] "); 203 h->SetYTitle("Counts"); 204 205 h->Draw(opt); 206 h->SetBit(kCanDelete); 207 gPad->SetLogx(); 208 209 c.cd(3); 210 h = ((TH3D*)(&fHist))->Project3D("ez"); 211 212 h->SetTitle("Distribution of time [s]"); 213 h->SetXTitle("time [s]"); 214 h->SetYTitle("Counts"); 215 216 h->Draw(opt); 217 h->SetBit(kCanDelete); 218 219 c.cd(4); 220 ((TH3D&)fHist).DrawCopy(opt); 221 222 c.Modified(); 223 c.Update(); 224 225 return &c; 226 } 227 167 pad->Modified(); 168 pad->Update(); 169 170 } 228 171 229 172 // -------------------------------------------------------------------------- -
trunk/MagicSoft/Mars/mhist/MHAlphaEnergyTime.h
r1992 r2015 41 41 42 42 void Draw(Option_t *option=""); 43 TObject *DrawClone(Option_t *option="") const;44 43 45 44 TH2D *IntegrateTime (const char *title, Bool_t Draw); -
trunk/MagicSoft/Mars/mhist/MHCerPhotEvt.cc
r2002 r2015 152 152 // -------------------------------------------------------------------------- 153 153 // 154 // Draw clone155 //156 TObject *MHCerPhotEvt::DrawClone(Option_t *opt) const157 {158 return MH::DrawClone(opt, 750, 600);159 }160 161 // --------------------------------------------------------------------------162 //163 154 // Draw the present 'fill status' 164 155 // -
trunk/MagicSoft/Mars/mhist/MHCerPhotEvt.h
r1989 r2015 37 37 const MCerPhotEvt &GetSum() const { return fSum; } 38 38 39 TObject *DrawClone(Option_t *opt) const; 40 void Draw(Option_t *); 39 void Draw(Option_t *opt=""); 41 40 void Paint(Option_t *option=""); 42 41 -
trunk/MagicSoft/Mars/mhist/MHEffOnTime.cc
r1992 r2015 361 361 // ------------------------------------------------------------------------- 362 362 // 363 // Draw a copy of the histogram364 //365 TObject *MHEffOnTime::DrawClone(Option_t *opt) const366 {367 TCanvas &c = *MakeDefCanvas(TString("EffOnTime")+fVarname,368 TString("Results from on time fit vs. ")+fVarname);369 c.Divide(2, 2);370 371 gROOT->SetSelectedPad(NULL);372 373 c.cd(1);374 ((TH2*)&fHEffOn)->DrawCopy(opt);375 376 c.cd(2);377 ((TH2*)&fHProb)->DrawCopy(opt);378 379 c.cd(3);380 ((TH2*)&fHLambda)->DrawCopy(opt);381 382 c.cd(4);383 ((TH2*)&fHRdead)->DrawCopy(opt);384 385 c.Modified();386 c.Update();387 388 return &c;389 }390 391 // -------------------------------------------------------------------------392 //393 363 // Draw the histogram 394 364 // 395 365 void MHEffOnTime::Draw(Option_t *opt) 396 366 { 397 if (!gPad)398 MakeDefCanvas(TString("EffOnTime")+fVarname,399 TString("Results from on time fit vs. ")+fVarname); 400 401 gPad->Divide(2,2); 402 403 gPad-> cd(1);367 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this); 368 pad->SetBorderMode(0); 369 370 pad->Divide(2,2); 371 372 pad->cd(1); 373 gPad->SetBorderMode(0); 404 374 fHEffOn.Draw(opt); 405 375 406 gPad->cd(2); 376 pad->cd(2); 377 gPad->SetBorderMode(0); 407 378 fHProb.Draw(opt); 408 379 409 gPad->cd(3); 380 pad->cd(3); 381 gPad->SetBorderMode(0); 410 382 fHLambda.Draw(opt); 411 383 412 gPad->cd(4); 384 pad->cd(4); 385 gPad->SetBorderMode(0); 413 386 fHRdead.Draw(opt); 414 387 415 gPad->Modified();416 gPad->Update();388 pad->Modified(); 389 pad->Update(); 417 390 } 418 391 -
trunk/MagicSoft/Mars/mhist/MHEffOnTime.h
r1992 r2015 41 41 42 42 void Draw(Option_t *option=""); 43 TObject *DrawClone(Option_t *option="") const;44 43 45 44 ClassDef(MHEffOnTime, 0) //1D-plot of Delta t vs. Var -
trunk/MagicSoft/Mars/mhist/MHEffOnTimeTheta.cc
r1992 r2015 257 257 // ------------------------------------------------------------------------- 258 258 // 259 // Draw a copy of the histogram260 //261 TObject *MHEffOnTimeTheta::DrawClone(Option_t *opt) const262 {263 TCanvas &c = *MakeDefCanvas("EffOnTimeTheta", "Results from on time fit vs. Theta");264 265 c.Divide(2, 2);266 267 gROOT->SetSelectedPad(NULL);268 269 c.cd(1);270 ((TH2*)&fHEffOn)->DrawCopy(opt);271 272 c.cd(2);273 ((TH2*)&fHChi2)->DrawCopy(opt);274 275 c.cd(3);276 ((TH2*)&fHLambda)->DrawCopy(opt);277 278 c.cd(4);279 ((TH2*)&fHN0del)->DrawCopy(opt);280 281 c.Modified();282 c.Update();283 284 return &c;285 }286 287 // -------------------------------------------------------------------------288 //289 259 // Draw the histogram 290 260 // 291 261 void MHEffOnTimeTheta::Draw(Option_t *opt) 292 262 { 293 if (!gPad) 294 MakeDefCanvas("EffOnTimeTheta", "Results from on time fit vs. Theta"); 295 296 gPad->Divide(2,2); 297 298 gPad->cd(1); 263 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this); 264 pad->SetBorderMode(0); 265 266 pad->Divide(2,2); 267 268 pad->cd(1); 269 gPad->SetBorderMode(0); 299 270 fHEffOn.Draw(opt); 300 271 301 gPad->cd(2); 272 pad->cd(2); 273 gPad->SetBorderMode(0); 302 274 fHChi2.Draw(opt); 303 275 304 gPad->cd(3); 276 pad->cd(3); 277 gPad->SetBorderMode(0); 305 278 fHLambda.Draw(opt); 306 279 307 gPad->cd(4); 280 pad->cd(4); 281 gPad->SetBorderMode(0); 308 282 fHN0del.Draw(opt); 309 283 310 gPad->Modified();311 gPad->Update();312 } 284 pad->Modified(); 285 pad->Update(); 286 } -
trunk/MagicSoft/Mars/mhist/MHEffOnTimeTheta.h
r1992 r2015 32 32 33 33 void Draw(Option_t *option=""); 34 TObject *DrawClone(Option_t *option="") const;35 34 36 35 ClassDef(MHEffOnTimeTheta, 0) //1D-plot of Delta t vs. Theta -
trunk/MagicSoft/Mars/mhist/MHEffOnTimeTime.cc
r1992 r2015 264 264 // ------------------------------------------------------------------------- 265 265 // 266 // Draw a copy of the histogram267 //268 TObject *MHEffOnTimeTime::DrawClone(Option_t *opt) const269 {270 TCanvas &c = *MakeDefCanvas("EffOnTimeTime", "Results from on time fit vs. time");271 c.Divide(2, 2);272 273 gROOT->SetSelectedPad(NULL);274 275 c.cd(1);276 ((TH2*)&fHEffOn)->DrawCopy(opt);277 278 c.cd(2);279 ((TH2*)&fHChi2)->DrawCopy(opt);280 281 c.cd(3);282 ((TH2*)&fHLambda)->DrawCopy(opt);283 284 c.cd(4);285 ((TH2*)&fHN0del)->DrawCopy(opt);286 287 c.Modified();288 c.Update();289 290 return &c;291 }292 293 // -------------------------------------------------------------------------294 //295 266 // Draw the histogram 296 267 // 297 268 void MHEffOnTimeTime::Draw(Option_t *opt) 298 269 { 299 if (!gPad) 300 MakeDefCanvas("EffOnTimeTime", "Results from on time fit vs. time"); 301 302 gPad->Divide(2,2); 303 304 gPad->cd(1); 270 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this); 271 pad->SetBorderMode(0); 272 273 pad->Divide(2,2); 274 275 pad->cd(1); 276 gPad->SetBorderMode(0); 305 277 fHEffOn.Draw(opt); 306 278 307 gPad->cd(2); 279 pad->cd(2); 280 gPad->SetBorderMode(0); 308 281 fHChi2.Draw(opt); 309 282 310 gPad->cd(3); 283 pad->cd(3); 284 gPad->SetBorderMode(0); 311 285 fHLambda.Draw(opt); 312 286 313 gPad->cd(4); 287 pad->cd(4); 288 gPad->SetBorderMode(0); 314 289 fHN0del.Draw(opt); 315 290 316 gPad->Modified();317 gPad->Update();318 } 319 320 321 322 323 291 pad->Modified(); 292 pad->Update(); 293 } 294 295 296 297 298 -
trunk/MagicSoft/Mars/mhist/MHEffOnTimeTime.h
r1992 r2015 32 32 33 33 void Draw(Option_t *option=""); 34 TObject *DrawClone(Option_t *option="") const;35 34 36 35 ClassDef(MHEffOnTimeTime, 0) //1D-plot of Delta t vs. time -
trunk/MagicSoft/Mars/mhist/MHEnergyTheta.cc
r1992 r2015 89 89 // -------------------------------------------------------------------------- 90 90 // 91 // Delete the three histograms92 //93 MHEnergyTheta::~MHEnergyTheta()94 {95 }96 97 // --------------------------------------------------------------------------98 //99 91 // Fill data into the histogram which contains all showers 100 92 // … … 114 106 void MHEnergyTheta::Draw(Option_t* option) 115 107 { 116 if (!gPad) 117 MakeDefCanvas(&fHist); 108 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this); 109 pad->SetBorderMode(0); 110 pad->SetLogy(); 118 111 119 fHist.DrawCopy(option); 120 gPad->SetLogy(); 112 fHist.Draw(option); 121 113 122 gPad->Modified(); 123 gPad->Update(); 124 } 125 126 // -------------------------------------------------------------------------- 127 // 128 // Creates a new canvas and draws the histogram into it. 129 // Be careful: The histogram belongs to this object and won't get deleted 130 // together with the canvas. 131 // 132 TObject *MHEnergyTheta::DrawClone(Option_t* option) const 133 { 134 TCanvas *c = MakeDefCanvas(&fHist); 135 136 // 137 // This is necessary to get the expected bahviour of DrawClone 138 // 139 gROOT->SetSelectedPad(NULL); 140 141 ((TH2D&)fHist).DrawCopy(option); 142 gPad->SetLogy(); 143 144 c->Modified(); 145 c->Update(); 146 147 return c; 114 pad->Modified(); 115 pad->Update(); 148 116 } 149 117 -
trunk/MagicSoft/Mars/mhist/MHEnergyTheta.h
r1992 r2015 18 18 19 19 public: 20 21 20 MHEnergyTheta(const char *name=NULL, const char *title=NULL); 22 ~MHEnergyTheta();23 21 24 22 Bool_t Fill(const MParContainer *cont, Double_t w=1); 25 23 26 24 void Draw(Option_t *option=""); 27 TObject *DrawClone(Option_t *option="") const;28 25 29 26 Bool_t SetupFill(const MParList *plist); -
trunk/MagicSoft/Mars/mhist/MHEnergyTime.cc
r1330 r2015 62 62 // we set the radius range from 0 m to 500 m with 10 m bin --> 50 ybins 63 63 64 65 64 fName = name ? name : "MHEnergyTime"; 66 65 fTitle = title ? title : "Data to Calculate Collection Area"; … … 97 96 // -------------------------------------------------------------------------- 98 97 // 99 // Delete the three histograms100 //101 MHEnergyTime::~MHEnergyTime()102 {103 }104 105 // --------------------------------------------------------------------------106 //107 98 // Fill data into the histogram which contains all showers 108 99 // … … 122 113 void MHEnergyTime::Draw(Option_t* option) 123 114 { 124 if (!gPad)125 MakeDefCanvas(&fHist);115 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fHist); 116 pad->SetBorderMode(0); 126 117 118 AppendPad(""); 119 120 pad->SetLogy(); 127 121 fHist.DrawCopy(option); 128 gPad->SetLogy();129 122 130 gPad->Modified(); 131 gPad->Update(); 132 } 133 134 // -------------------------------------------------------------------------- 135 // 136 // Creates a new canvas and draws the histogram into it. 137 // Be careful: The histogram belongs to this object and won't get deleted 138 // together with the canvas. 139 // 140 TObject *MHEnergyTime::DrawClone(Option_t* option) const 141 { 142 TCanvas *c = MakeDefCanvas(&fHist); 143 144 // 145 // This is necessary to get the expected bahviour of DrawClone 146 // 147 gROOT->SetSelectedPad(NULL); 148 149 ((TH2D&)fHist).DrawCopy(option); 150 gPad->SetLogy(); 151 152 c->Modified(); 153 c->Update(); 154 155 return c; 123 pad->Modified(); 124 pad->Update(); 156 125 } 157 126 -
trunk/MagicSoft/Mars/mhist/MHEnergyTime.h
r1663 r2015 19 19 20 20 public: 21 22 21 MHEnergyTime(const char *name=NULL, const char *title=NULL); 23 ~MHEnergyTime();24 22 25 23 Bool_t Fill(const MParContainer *cont); 26 24 27 25 void Draw(Option_t *option=""); 28 TObject *DrawClone(Option_t *option="") const;29 26 30 27 Bool_t SetupFill(const MParList *plist); -
trunk/MagicSoft/Mars/mhist/MHFlux.cc
r1992 r2015 503 503 // ------------------------------------------------------------------------- 504 504 // 505 // Draw copies of the histograms506 //507 TObject *MHFlux::DrawClone(Option_t *opt) const508 {509 TCanvas &c = *MakeDefCanvas("flux", "Orig - Unfold - Flux plots");510 c.Divide(2, 2);511 512 gROOT->SetSelectedPad(NULL);513 514 c.cd(1);515 ((TH2*)&fHOrig)->DrawCopy("");516 gPad->SetLogx();517 518 c.cd(2);519 ((TH2*)&fHUnfold)->DrawCopy("");520 gPad->SetLogx();521 522 c.cd(3);523 ((TH2*)&fHFlux)->DrawCopy("");524 gPad->SetLogx();525 526 c.Modified();527 c.Update();528 529 return &c;530 }531 532 // -------------------------------------------------------------------------533 //534 505 // Draw the histograms 535 506 // 536 507 void MHFlux::Draw(Option_t *opt) 537 508 { 538 if (!gPad) 539 MakeDefCanvas("flux", "orig-unfold-flux plots"); 540 541 gPad->Divide(2,2); 542 543 gPad->cd(1); 509 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fHist); 510 pad->SetBorderMode(0); 511 512 AppendPad(""); 513 514 pad->Divide(2,2); 515 516 pad->cd(1); 517 gPad->SetBorderMode(0); 544 518 fHOrig.Draw(opt); 545 519 546 gPad->cd(2); 520 pad->cd(2); 521 gPad->SetBorderMode(0); 547 522 fHUnfold.Draw(opt); 548 523 549 gPad->cd(3); 524 pad->cd(3); 525 gPad->SetBorderMode(0); 550 526 fHFlux.Draw(opt); 551 527 552 gPad->Modified();553 gPad->Update();528 pad->Modified(); 529 pad->Update(); 554 530 } 555 531 -
trunk/MagicSoft/Mars/mhist/MHFlux.h
r1992 r2015 59 59 60 60 void Draw(Option_t *option=""); 61 TObject *DrawClone(Option_t *option="") const; 61 62 62 void DrawFluxProjectionX(Option_t *opt="") const; 63 63 void DrawOrigProjectionX(Option_t *opt="") const; -
trunk/MagicSoft/Mars/mhist/MHMatrix.cc
r1992 r2015 880 880 DrawDefRefInfo(hth, hthd, thsh, refcolumn); 881 881 882 if (!rest) 883 return kTRUE; 884 885 CopyCrop(*rest, mrest, evtcount2); 882 if (rest) 883 CopyCrop(*rest, mrest, evtcount2); 886 884 887 885 return kTRUE; -
trunk/MagicSoft/Mars/mhist/MHSigmaTheta.cc
r1992 r2015 180 180 { 181 181 Double_t theta = fMcEvt->GetTelescopeTheta()*kRad2Deg; 182 Double_t my Sig = fSigmabar->Calc(*fCam, *fPed, *fEvt);183 184 fSigmaTheta.Fill(theta, my Sig);182 Double_t mysig = fSigmabar->Calc(*fCam, *fPed, *fEvt); 183 184 fSigmaTheta.Fill(theta, mysig); 185 185 186 186 const UInt_t npix = fEvt->GetNumPixels(); … … 188 188 for (UInt_t i=0; i<npix; i++) 189 189 { 190 MCerPhotPix cerpix = (*fEvt)[i]; 191 if (!cerpix.IsPixelUsed()) 192 continue; 193 194 const Int_t id = cerpix.GetPixId(); 195 const MPedestalPix &pix = (*fPed)[id]; 196 197 const Double_t sigma = pix.GetMeanRms(); 198 const Double_t area = fCam->GetPixRatio(id); 199 200 201 fSigmaPixTheta.Fill(theta, (Double_t)id, sigma); 202 203 const Double_t diff = sigma*sigma/area - mySig*mySig; 204 fDiffPixTheta.Fill(theta, (Double_t)id, diff); 190 MCerPhotPix cerpix = (*fEvt)[i]; 191 if (!cerpix.IsPixelUsed()) 192 continue; 193 194 const Int_t id = cerpix.GetPixId(); 195 const MPedestalPix &pix = (*fPed)[id]; 196 197 const Double_t sigma = pix.GetMeanRms(); 198 const Double_t area = fCam->GetPixRatio(id); 199 200 fSigmaPixTheta.Fill(theta, (Double_t)id, sigma); 201 202 const Double_t diff = sigma*sigma/area - mysig*mysig; 203 fDiffPixTheta.Fill(theta, (Double_t)id, diff); 205 204 } 206 205 207 206 return kTRUE; 208 }209 210 // --------------------------------------------------------------------------211 //212 // Draw a copy of the histogram213 //214 TObject *MHSigmaTheta::DrawClone(Option_t *opt)215 {216 return MH::DrawClone(opt, 900, 900);217 207 } 218 208 -
trunk/MagicSoft/Mars/mhist/MHSigmaTheta.h
r1992 r2015 32 32 MMcEvt *fMcEvt; //! 33 33 34 TH1D fNpix; // 1D-distribution no.of pixels in MCerPhotEvt;35 TH1D fBlindId; // 1D-distribution Id of blind pixel;36 34 TH2D fSigmaTheta; // 2D-distribution sigmabar versus Theta; 37 35 // sigmabar is the average pedestasl sigma in an event … … 48 46 const TH2D *GetSigmaTheta() { return &fSigmaTheta; } 49 47 const TH2D *GetSigmaTheta() const { return &fSigmaTheta; } 50 TH2D *GetSigmaThetaByName(const TString name) { return &fSigmaTheta; }51 48 52 49 const TH3D *GetSigmaPixTheta() { return &fSigmaPixTheta; } 53 50 const TH3D *GetSigmaPixTheta() const { return &fSigmaPixTheta; } 54 TH3D *GetSigmaPixThetaByName(const TString name) { return &fSigmaPixTheta; }55 51 56 52 const TH3D *GetDiffPixTheta() { return &fDiffPixTheta; } 57 53 const TH3D *GetDiffPixTheta() const { return &fDiffPixTheta; } 58 TH3D *GetDiffPixThetaByName(const TString name) { return &fDiffPixTheta; }59 54 60 55 void Draw(Option_t *option=""); 61 TObject *DrawClone(Option_t *option="");62 56 63 57 ClassDef(MHSigmaTheta, 0) //2D-histogram sigmabar vs. Theta
Note:
See TracChangeset
for help on using the changeset viewer.