Changeset 2557 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 11/22/03 21:14:14 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MFillH.cc
r2556 r2557 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 18 ! Author(s): Thomas Bretz, 07/2001 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 220 ! Copyright: MAGIC Software Development, 2000-2003 21 21 ! 22 22 ! … … 155 155 156 156 AddToBranchList(Form("%s.*", (const char*)ExtractName(hist))); 157 AddToBranchList(Form("%s.*", (const char*)ExtractName(par))); 157 if (par) 158 AddToBranchList(Form("%s.*", (const char*)ExtractName(par))); 158 159 159 160 if (title) … … 224 225 225 226 AddToBranchList(fH->GetDataMember()); 226 AddToBranchList(Form("%s.*", (const char*)ExtractName(par))); 227 if (par) 228 AddToBranchList(Form("%s.*", (const char*)ExtractName(par))); 227 229 228 230 if (title) -
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r2550 r2557 568 568 Update(gPad->GetLogy(), isbox, iscol); 569 569 PaintAxisTitle(); 570 571 if (opt.Contains("pixelindex")) 572 PaintIndices(kFALSE); 573 if (opt.Contains("sectorindex")) 574 PaintIndices(kTRUE); 570 575 } 571 576 … … 627 632 } 628 633 629 void MHCamera:: DrawPixelIndices()634 void MHCamera::PaintIndices(Bool_t sector) 630 635 { 631 636 if (fNcells<=1) 632 637 return; 633 634 // FIXME: Is this correct?635 for (int i=0; i<kItemsLegend; i++)636 fColors[i] = 16;637 638 if (!gPad)639 Draw();640 638 641 639 TText txt; … … 645 643 for (Int_t i=0; i<fNcells-2; i++) 646 644 { 645 const MGeomPix &h = (*fGeomCam)[i]; 646 647 647 TString num; 648 num += i; 649 650 const MGeomPix &h = (*fGeomCam)[i]; 651 TText *nt = txt.DrawText(h.GetX(), h.GetY(), num); 652 nt->SetTextSize(0.3*h.GetD()/fGeomCam->GetMaxRadius()/1.05); 653 } 654 } 655 656 void MHCamera::DrawSectorIndices() 657 { 658 if (fNcells<=1) 659 return; 660 661 for (int i=0; i<kItemsLegend; i++) 662 fColors[i] = 16; 663 664 if (!gPad) 665 Draw(); 666 667 TText txt; 668 txt.SetTextFont(122); 669 txt.SetTextAlign(22); // centered/centered 670 671 for (Int_t i=0; i<fNcells-2; i++) 672 { 673 TString num; 674 num += (*fGeomCam)[i].GetSector(); 675 676 const MGeomPix &h = (*fGeomCam)[i]; 677 TText *nt = txt.DrawText(h.GetX(), h.GetY(), num); 678 nt->SetTextSize(0.3*h.GetD()/fGeomCam->GetMaxRadius()/1.05); 648 num += sector ? h.GetSector() : i; 649 650 txt.SetTextSize(0.3*h.GetD()/fGeomCam->GetMaxRadius()/1.05); 651 txt.PaintText(h.GetX(), h.GetY(), num); 679 652 } 680 653 } -
trunk/MagicSoft/Mars/mhist/MHCamera.h
r2484 r2557 59 59 Int_t GetColor(Float_t val, Float_t min, Float_t max, Bool_t islog); 60 60 61 void PaintIndices(Bool_t sector); 61 62 void Update(Bool_t islog, Bool_t isbox, Bool_t iscol); 62 63 void UpdateLegend(Float_t min, Float_t max, Bool_t islog); … … 144 145 void FillRandom(TH1 *h, Int_t ntimes=5000) { TH1::FillRandom(h, ntimes); } 145 146 void FillRandom(); 146 147 void DrawPixelIndices();148 void DrawSectorIndices();149 147 150 148 void PrintInfo() const { Print(""); } // *MENU* -
trunk/MagicSoft/Mars/mhist/MHVsTime.cc
r2556 r2557 60 60 // 61 61 MHVsTime::MHVsTime(const char *rule) 62 : f Hist(NULL), fData(NULL), fScale(1)62 : fGraph(NULL), fData(NULL), fScale(1) 63 63 { 64 64 fName = gsDefName; … … 68 68 return; 69 69 70 f Hist= new TGraph;70 fGraph = new TGraph; 71 71 fData = new MDataChain(rule); 72 72 } … … 78 78 MHVsTime::~MHVsTime() 79 79 { 80 if (f Hist)81 delete f Hist;80 if (fGraph) 81 delete fGraph; 82 82 83 83 if (fData) … … 92 92 TString MHVsTime::GetDataMember() const 93 93 { 94 *fLog << dbg << fData->GetDataMember() << endl;95 94 return fData ? fData->GetDataMember() : (TString)""; 96 95 } … … 105 104 { 106 105 // reset histogram (necessary if the same eventloop is run more than once) 107 //f Hist->Reset();106 //fGraph->Reset(); 108 107 109 108 if (fData && !fData->PreProcess(plist)) 110 109 return kFALSE; 111 110 112 if (f Hist)111 if (fGraph) 113 112 { 114 delete f Hist;115 f Hist= new TGraph;113 delete fGraph; 114 fGraph = new TGraph; 116 115 } 117 116 … … 119 118 title += " vs Time"; 120 119 121 f Hist->SetNameTitle(fName, title);120 fGraph->SetNameTitle(fName, title); 122 121 123 122 return kTRUE; … … 130 129 void MHVsTime::SetName(const char *name) 131 130 { 132 f Hist->SetName(name);131 fGraph->SetName(name); 133 132 MParContainer::SetName(name); 134 133 } … … 140 139 void MHVsTime::SetTitle(const char *title) 141 140 { 142 f Hist->SetTitle(title);141 fGraph->SetTitle(title); 143 142 MParContainer::SetTitle(title); 144 143 } … … 160 159 const Double_t T = (*t);///3600; 161 160 162 f Hist->SetPoint(fHist->GetN(), T>12*3600?T-24*3600:T, v);161 fGraph->SetPoint(fGraph->GetN(), T>12*3600?T-24*3600:T, v); 163 162 164 163 return kTRUE; … … 182 181 void MHVsTime::Draw(Option_t *opt) 183 182 { 184 if (f Hist->GetN()==0)183 if (fGraph->GetN()==0) 185 184 return; 186 185 187 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(f Hist);186 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fGraph); 188 187 pad->SetBorderMode(0); 189 188 … … 192 191 TString str(opt); 193 192 194 f Hist->GetHistogram()->SetXTitle("Time");195 f Hist->GetHistogram()->SetYTitle(GetRule());196 f Hist->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M:%S");197 f Hist->GetHistogram()->GetXaxis()->SetTimeDisplay(1);198 f Hist->GetHistogram()->GetXaxis()->SetLabelSize(0.033);199 f Hist->Draw("AP");200 if (f Hist->TestBit(kIsLogy))193 fGraph->GetHistogram()->SetXTitle("Time"); 194 fGraph->GetHistogram()->SetYTitle(GetRule()); 195 fGraph->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M:%S"); 196 fGraph->GetHistogram()->GetXaxis()->SetTimeDisplay(1); 197 fGraph->GetHistogram()->GetXaxis()->SetLabelSize(0.033); 198 fGraph->Draw("AP"); 199 if (fGraph->TestBit(kIsLogy)) 201 200 pad->SetLogy(); 202 201 … … 229 228 Int_t MHVsTime::GetNbins() const 230 229 { 231 return f Hist->GetN();232 } 233 230 return fGraph->GetN(); 231 } 232 /* 234 233 TH1 *MHVsTime::GetHist() 235 234 { 236 return f Hist ? fHist->GetHistogram() : 0;235 return fGraph ? fGraph->GetHistogram() : 0; 237 236 } 238 237 239 238 const TH1 *MHVsTime::GetHist() const 240 239 { 241 return f Hist ? fHist->GetHistogram() : 0;240 return fGraph ? fGraph->GetHistogram() : 0; 242 241 } 243 242 … … 246 245 return GetHist(); 247 246 } 247 */ -
trunk/MagicSoft/Mars/mhist/MHVsTime.h
r2556 r2557 13 13 protected: 14 14 // Could be const but root < 3.02/06 doesn't like this... 15 TGraph *f Hist; // Histogram to fill15 TGraph *fGraph; // Histogram to fill 16 16 MDataChain *fData; // Object from which the data is filled 17 17 Double_t fScale; // Scale for axis (eg unit) … … 38 38 TString GetRule() const; 39 39 40 const TH1 *GetHist() const; 41 TH1 *GetHist(); 42 TH1 *GetHistByName(const TString name=""); 40 /* 41 // const TH1 *GetHist() const; 42 // TH1 *GetHist(); 43 // TH1 *GetHistByName(const TString name=""); 44 */ 45 const TGraph *GetGraph() const { return fGraph; } 46 TGraph *GetGraph() { return fGraph; } 47 43 48 44 49 void Draw(Option_t *opt=NULL);
Note:
See TracChangeset
for help on using the changeset viewer.