Changeset 2416 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 10/20/03 21:32:30 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MFillH.cc
r2414 r2416 324 324 const Ssiz_t length = last-first-1; 325 325 326 //327 // Make a copy before stripping leading and trailing White Spaces.328 //329 326 TString strip = fHName(first+1, length); 330 327 return strip.Strip(TString::kBoth); … … 343 340 return kTRUE; 344 341 342 if (!fH->OverwritesDraw()) 343 return kTRUE; 344 345 345 if (TestBit(kDoNotDisplay)) 346 346 return kTRUE; 347 347 348 const Bool_t dr = fH->OverwritesDraw();349 const Bool_t ts = fH->OverwritesDraw(NULL, "TS");350 if (!dr && !ts)351 return kTRUE;352 353 if (!ts)354 {355 *fLog << warn << "You overwrote " << fH->ClassName() << "::";356 *fLog << "Draw instead of " << fH->ClassName() << "::DrawTS" << endl;357 *fLog << "This is not thread safe and might result in trouble using" << endl;358 *fLog << "multithreaded programs like MONA." << endl;359 *fLog << "" << endl;360 return kTRUE;361 }362 363 348 fCanvas = &fDisplay->AddTab(fH->GetName()); 364 fH->DrawTS(fCanvas); 365 366 return kTRUE; 367 } 368 369 // -------------------------------------------------------------------------- 370 // 371 // 372 Bool_t MFillH::DrawCloneToDisplay() 373 { 374 fH->DrawCloneTS(fCanvas); 375 fCanvas->Modified(); 376 fCanvas->Update(); 349 fH->Draw(); 377 350 378 351 return kTRUE; … … 533 506 // 534 507 if (fDisplay && fDisplay->HasCanvas(fCanvas)) 535 DrawCloneToDisplay(); 508 { 509 fCanvas->cd(); 510 fH->DrawClone("nonew"); 511 fCanvas->Modified(); 512 fCanvas->Update(); 513 } 536 514 537 515 return kTRUE; -
trunk/MagicSoft/Mars/mhist/MFillH.h
r2414 r2416 44 44 45 45 Bool_t DrawToDisplay(); 46 Bool_t DrawCloneToDisplay();47 46 48 47 public: … … 64 63 Int_t PostProcess(); 65 64 66 MH *GetH() { return fH; }67 65 TCanvas *GetCanvas() { return fCanvas; } 68 66 -
trunk/MagicSoft/Mars/mhist/MH.cc
r2413 r2416 700 700 // Also layout the two statistic boxes and a legend. 701 701 // 702 void MH::DrawSame(TH1 &hist1, TH1 &hist2, const TString title , TVirtualPad *pad)702 void MH::DrawSame(TH1 &hist1, TH1 &hist2, const TString title) 703 703 { 704 704 // 705 705 // Draw first histogram 706 706 // 707 if (!pad) 708 pad = gPad; 709 710 MParContainer::DrawTS(&hist1, pad); 711 pad->SetBorderMode(0); 712 pad->Update(); 707 hist1.Draw(); 708 gPad->SetBorderMode(0); 709 gPad->Update(); 713 710 714 711 if (hist1.GetEntries()>0 && hist2.GetEntries()>0) … … 729 726 } 730 727 731 TPaveText *t = (TPaveText*) pad->FindObject("title");728 TPaveText *t = (TPaveText*)gPad->FindObject("title"); 732 729 if (t) 733 730 { … … 741 738 // (see THistPainter::PaintTitle) title 742 739 // 743 pad->Modified(); // indicates a change744 pad->Update(); // recreates the original title740 gPad->Modified(); // indicates a change 741 gPad->Update(); // recreates the original title 745 742 t->Pop(); // bring our title on top 746 743 } … … 750 747 // 751 748 // Where to get the TPaveStats depends on the root version 752 TPaveStats *s1 = (TPaveStats*) pad->FindObject("stats");749 TPaveStats *s1 = (TPaveStats*)gPad->FindObject("stats"); 753 750 if (!s1) 754 751 s1 = (TPaveStats*)hist1.GetListOfFunctions()->FindObject("stats"); … … 766 763 // Draw second histogram 767 764 // 768 MParContainer::DrawTS(&hist2, pad,"sames");769 pad->Update();765 hist2.Draw("sames"); 766 gPad->Update(); 770 767 771 768 // … … 773 770 // 774 771 // Where to get the TPaveStats depends on the root version 775 TPaveStats *s2 = (TPaveStats*) pad->FindObject("stats");772 TPaveStats *s2 = (TPaveStats*)gPad->FindObject("stats"); 776 773 if (!s2) 777 774 s2 = (TPaveStats*)hist2.GetListOfFunctions()->FindObject("stats"); … … 790 787 l.SetBorderSize(s2->GetBorderSize()); 791 788 l.SetBit(kCanDelete); 792 MParContainer::DrawTS(&l, pad);789 l.Draw(); 793 790 } 794 791 } … … 833 830 // to the present pad. The kCanDelete bit is set for the clone. 834 831 // 835 TObject *MH::DrawClone TS(TVirtualPad *pad,Option_t *opt, Int_t w, Int_t h) const832 TObject *MH::DrawClone(Option_t *opt, Int_t w, Int_t h) const 836 833 { 837 834 TString option(opt); 838 835 839 //gLog << dbg << "DrawCloneTS: Arg=" << pad << " " << gPad << endl; 840 841 TVirtualPad *p = GetNewPad(option) || pad ? pad : NULL; 842 //gLog << dbg << "DrawCloneTS: nonew&&gpad=" << p << " " << opt << endl; 843 if (!p) 844 p = MakeDefCanvas(this, w, h); 845 else 846 /*{ 847 gLog << dbg << "--> Clear" << endl;*/ 848 p->Clear(); 849 //} 850 //gLog << dbg << "DrawCloneTS: " << p << endl; 851 852 TObject *o = MParContainer::DrawCloneTS(pad, option); 853 o->SetBit(kCanDelete); 854 return o; 855 } 856 857 /* 858 // -------------------------------------------------------------------------- 859 // 860 // If the opt string contains 'nonew' or gPad is not given a new canvas 861 // with size w/h is created. Otherwise the object is cloned and drawn 862 // to the present pad. The kCanDelete bit is set for the clone. 863 // 864 TObject *MH::DrawClone(Option_t *opt, Int_t w, Int_t h) const 865 { 866 TString option(opt); 867 868 gLog << dbg << "DrawCloneTS: Arg=" << gPad << endl; 869 870 TVirtualPad *p = GetNewPad(option) ? gPad : NULL; 871 gLog << dbg << "DrawCloneTS: nonew&&gpad=" << p << " " << opt << endl; 836 TVirtualPad *p = GetNewPad(option); 872 837 if (!p) 873 838 p = MakeDefCanvas(this, w, h); 874 839 else 875 840 p->Clear(); 876 gLog << dbg << "DrawCloneTS: " << p << endl; 877 878 TObject *o = Clone(option); 841 842 gROOT->SetSelectedPad(NULL); 843 844 TObject *o = MParContainer::DrawClone(option); 879 845 o->SetBit(kCanDelete); 880 846 return o; 881 847 } 882 */883 848 884 849 // -------------------------------------------------------------------------- … … 886 851 // Check whether a class inheriting from MH overwrites the Draw function 887 852 // 888 Bool_t MH::OverwritesDraw(TClass *cls , const char *ext) const853 Bool_t MH::OverwritesDraw(TClass *cls) const 889 854 { 890 855 if (!cls) … … 900 865 // Check whether the class cls overwrites Draw 901 866 // 902 TString name("Draw"); 903 name += ext; 904 if (cls->GetMethodAny(name)) 867 if (cls->GetMethodAny("Draw")) 905 868 return kTRUE; 906 869 … … 912 875 while ((base=(TBaseClass*)NextBase())) 913 876 { 914 if (OverwritesDraw(base->GetClassPointer() , ext))877 if (OverwritesDraw(base->GetClassPointer())) 915 878 return kTRUE; 916 879 } -
trunk/MagicSoft/Mars/mhist/MH.h
r2413 r2416 22 22 MH(const char *name=NULL, const char *title=NULL); 23 23 24 Bool_t OverwritesDraw(TClass *cls=NULL , const char *ext="") const;24 Bool_t OverwritesDraw(TClass *cls=NULL) const; 25 25 26 26 virtual Bool_t SetupFill(const MParList *pList) { return kTRUE; } … … 64 64 65 65 static void DrawSameCopy(const TH1 &hist1, const TH1 &hist2, const TString title); 66 static void DrawSame(TH1 &hist1, TH1 &hist2, const TString title , TVirtualPad *pad=NULL);66 static void DrawSame(TH1 &hist1, TH1 &hist2, const TString title); 67 67 68 68 TObject *Clone(const char *name="") const; 69 69 70 TObject *DrawClone(Option_t *opt, Int_t w, Int_t h) const 71 { 72 return MH::DrawCloneTS(NULL, opt, 625, 440); 73 } 70 TObject *DrawClone(Option_t *opt, Int_t w, Int_t h) const; 74 71 TObject *DrawClone(Option_t *opt="") const 75 72 { 76 return MH::DrawCloneTS(NULL, opt, 625, 440); 77 } 78 TObject *DrawCloneTS(TVirtualPad *pad, Option_t *opt, Int_t w, Int_t h) const; 79 TObject *DrawCloneTS(TVirtualPad *pad=NULL, Option_t *opt="") const 80 { 81 return MH::DrawCloneTS(pad, opt, 625, 440); 73 return MH::DrawClone(opt, 625, 440); 82 74 } 83 75 -
trunk/MagicSoft/Mars/mhist/MHCamEvent.cc
r2415 r2416 137 137 } 138 138 139 // -------------------------------------------------------------------------- 140 // 141 // Print pixel indices which value is higher than mean+sigma*rms 142 // 143 void MHCamEvent::PrintOutliers(Float_t sigma) const 139 void MHCamEvent::PrintOutliers(Float_t s) const 144 140 { 145 141 const Double_t mean = fSum->GetMean(); … … 153 149 continue; 154 150 155 if ((*fSum)[i+1]>mean+s igma*rms)156 *fLog << "Contents of Pixel-Index #" << i << ": " << (*fSum)[i+1] << " > " << s igma<< "*rms" << endl;151 if ((*fSum)[i+1]>mean+s*rms) 152 *fLog << "Contents of Pixel-Index #" << i << ": " << (*fSum)[i+1] << " > " << s << "*rms" << endl; 157 153 // if ((*fSum)[i+1]==0) 158 154 // *fLog << "Contents of Pixel-Index #" << i << ": " << (*fSum)[i+1] << " == 0" << endl; … … 171 167 } 172 168 173 void MHCamEvent::Draw TS(TVirtualPad *p,Option_t *)169 void MHCamEvent::Draw(Option_t *) 174 170 { 175 if (!fSum) 176 { 177 *fLog << warn << "MHCamEvent::Draw - fSum==NULL not initialized." << endl; 178 return; 179 } 180 181 TVirtualPad *pad = p ? p : MakeDefCanvas(this); 171 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this); 182 172 pad->SetBorderMode(0); 183 173 184 174 pad->Divide(1,2); 185 175 186 p = pad->GetPad(1); 187 p->SetBorderMode(0); 176 pad->cd(1); 177 gPad->SetBorderMode(0); 178 gPad->Divide(1,1); 179 gPad->cd(1); 180 gPad->SetBorderMode(0); 181 fSum->Draw(); 188 182 189 // fSum doesn't derive from MParContainer 190 MParContainer::DrawTS(fSum, p); 191 192 p = pad->GetPad(2); 193 p->SetBorderMode(0); 194 195 // fSum doesn't derive from MParContainer 196 MParContainer::DrawTS(fSum, p, "EPhist"); 197 198 // fSum doesn't derive from MParContainer 199 //MParContainer::DrawTS(fSum, pad); 183 pad->cd(2); 184 gPad->SetBorderMode(0); 185 fSum->Draw("EPhist"); 200 186 } -
trunk/MagicSoft/Mars/mhist/MHCamEvent.h
r2415 r2416 32 32 TH1 *GetHistByName(const TString name=""); 33 33 34 void Draw TS(TVirtualPad *pad=NULL,Option_t *o="");34 void Draw(Option_t *o=""); 35 35 36 void PrintOutliers(Float_t s igma) const;36 void PrintOutliers(Float_t s) const; 37 37 38 38 ClassDef(MHCamEvent, 1) // Histogram to sum camera events -
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r2409 r2416 1135 1135 if (fNotify && fNotify->GetSize()>0) 1136 1136 { 1137 TCanvas *c=new TCanvas;1138 fNotify->ForEach(MCamEvent, DrawPixelContent)(idx , c);1137 new TCanvas; 1138 fNotify->ForEach(MCamEvent, DrawPixelContent)(idx); 1139 1139 } 1140 1140 } … … 1148 1148 { 1149 1149 gPad=NULL; 1150 return TH1D::DrawCopy( );1150 return TH1D::DrawCopy(fName+";cpy"); 1151 1151 } -
trunk/MagicSoft/Mars/mhist/MHTriggerLvl0.cc
r2414 r2416 171 171 } 172 172 173 void MHTriggerLvl0::Draw TS(TVirtualPad *p=NULL, Option_t * ="")173 void MHTriggerLvl0::Draw(Option_t *) 174 174 { 175 TVirtualPad *pad = p ? p: MakeDefCanvas(this);175 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this); 176 176 pad->SetBorderMode(0); 177 177 178 //-----------------------------179 178 pad->Divide(1,2); 180 179 181 p = pad->GetPad(1); 182 p->SetBorderMode(0); 183 p->Divide(1,1); 184 p->cd(1); 185 p->SetBorderMode(0); 186 // fSum does not derive from MParContainer 187 MParContainer::DrawTS(fSum, p); 180 pad->cd(1); 181 gPad->SetBorderMode(0); 182 gPad->Divide(1,1); 183 gPad->cd(1); 184 gPad->SetBorderMode(0); 185 fSum->Draw(); 188 186 189 p = pad->GetPad(2); 190 p->SetBorderMode(0); 191 // fSum does not derive from MParContainer 192 MParContainer::DrawTS(fSum, p, "EPhist"); 193 //----------------------------- 194 195 //MParContainer::DrawTS(fSum, p); 187 pad->cd(2); 188 gPad->SetBorderMode(0); 189 fSum->Draw("EPhist"); 196 190 } -
trunk/MagicSoft/Mars/mhist/MHTriggerLvl0.h
r2414 r2416 34 34 TH1 *GetHistByName(const TString name=""); 35 35 36 //void Draw(Option_t * =""); 37 void DrawTS(TVirtualPad *pad=NULL, Option_t * =""); 36 void Draw(Option_t * =""); 38 37 39 38 void PrintOutlayers(Float_t s) const;
Note:
See TracChangeset
for help on using the changeset viewer.