Changeset 5620
- Timestamp:
- 12/17/04 13:27:08 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r5619 r5620 28 28 * mcalib/MCalibColorSet.cc: 29 29 - replaced arbitrary number for run type by correct enum 30 31 * mbase/MStatusDisplay.[h,cc]: 32 - changed DrawClonePad such that 33 + before cloning we change into the pad (necessary for 34 GetDrawOption) 35 + removed SetSelectedPad (seems not necessary at all) 36 + SetBit(kCanDelete) for all cloned object 37 + copy bits kMustCleanup, kCannotPick and kNoContextMenu 38 + oldc is not const anymore (cd()!) 39 40 * mhbase/MH3.[h,cc]: 41 - removed fNameProfX, fNameProfY - didn't work with a more accurate 42 scheme to get the handle to the profile histograms 43 - moved most code from Draw to Paint so that a more accurate handling 44 of read pads containing these histograms is possible 45 46 * mhvstime/MHVsTime.[h,cc]: 47 - moved most code from Draw to Paint so that a more accurate handling 48 of read pads containing these histograms is possible 49 50 * mhflux/MHEffectiveOnTime.[h,cc]: 51 - removed fNameProj* - didn't work with a more accurate 52 scheme to get the handle to the profile histograms 53 - set no option for default AppendPad (istead of "fit" which 54 didn't work for saved files - for unknown reasons) 30 55 31 56 -
trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc
r5557 r5620 1588 1588 // Draws a clone of a canvas into a new canvas. Taken from TCanvas. 1589 1589 // 1590 void MStatusDisplay::DrawClonePad(TCanvas &newc, constTCanvas &oldc) const1590 void MStatusDisplay::DrawClonePad(TCanvas &newc, TCanvas &oldc) const 1591 1591 { 1592 1592 //copy pad attributes … … 1605 1605 ((TAttPad&)oldc).Copy((TAttPad&)newc); 1606 1606 1607 // This must be there: Otherwise GetDrawOption() won't work 1608 TVirtualPad *padsav = gPad; 1609 oldc.cd(); 1610 1607 1611 //copy primitives 1608 1612 TObject *obj; 1609 1613 TIter next(oldc.GetListOfPrimitives()); 1610 while ((obj=next())) { 1611 gROOT->SetSelectedPad(&newc); 1612 newc.GetListOfPrimitives()->Add(obj->Clone(),obj->GetDrawOption()); 1614 while ((obj=next())) 1615 { 1616 // Old line - I think it is not necessary anymore because of the cd() 1617 //gROOT->SetSelectedPad(&newc); 1618 1619 // Now make a clone of the object 1620 TObject *clone = obj->Clone(); 1621 1622 // Clone also important bits (FIXME: Is this correct) 1623 clone->SetBit(obj->TestBits(kMustCleanup|kCannotPick|kNoContextMenu)); 1624 1625 // Now make sure that the clones are deleted at a later time 1626 clone->SetBit(kCanDelete); 1627 1628 // Add the clone and its draw-option to the current pad 1629 newc.GetListOfPrimitives()->Add(clone, obj->GetDrawOption()); 1613 1630 } 1614 1631 newc.Modified(); 1615 1632 newc.Update(); 1633 1634 padsav->cd(); 1616 1635 } 1617 1636 -
trunk/MagicSoft/Mars/mbase/MStatusDisplay.h
r5498 r5620 117 117 void UpdateTab(TGCompositeFrame *f); 118 118 119 void DrawClonePad(TCanvas &newc, constTCanvas &oldc) const;119 void DrawClonePad(TCanvas &newc, TCanvas &oldc) const; 120 120 void CanvasSetFillColor(TPad &c, Int_t col) const; 121 121 Bool_t Display(const TObjArray &list); -
trunk/MagicSoft/Mars/mhbase/MH3.cc
r5603 r5620 103 103 // 104 104 MH3::MH3(const unsigned int dim) 105 : fDimension(dim>3?3:dim), fHist(NULL) ,105 : fDimension(dim>3?3:dim), fHist(NULL)/*, 106 106 fNameProfX(Form("ProfX_%p", this)), 107 fNameProfY(Form("ProfY_%p", this)) 107 fNameProfY(Form("ProfY_%p", this))*/ 108 108 { 109 109 switch (fDimension) … … 205 205 // 206 206 MH3::MH3(const char *memberx, const char *membery) 207 : fDimension(2) , fNameProfX(Form("ProjX_%p", this)), fNameProfY(Form("ProjY_%p", this))207 : fDimension(2)/*, fNameProfX(Form("ProjX_%p", this)), fNameProfY(Form("ProjY_%p", this))*/ 208 208 { 209 209 fHist = new TH2F; … … 507 507 void MH3::Paint(Option_t *o) 508 508 { 509 /* 510 *fLog << all << fHist << " " << gPad->GetName() << " ----> Paint " << o << endl; 511 TListIter Next(gPad->GetListOfPrimitives()); TObject *obj; 512 while ((obj=Next())) *fLog << obj << " " << obj->GetName() << " " << obj->ClassName() << " " << Next.GetOption() << " " << (int)obj->TestBit(kCanDelete) << endl; 513 */ 514 /* 509 515 TString str(o); 510 511 // FIXME: Do it in Paint()512 /*513 if (str.Contains("COL", TString::kIgnoreCase))514 {515 SetColors();516 return;517 }518 */519 516 520 517 if (str.Contains("log", TString::kIgnoreCase)) … … 536 533 if ((h0 = (TProfile*)gPad->FindObject(fNameProfY))) 537 534 ((TH2*)fHist)->ProfileY(fNameProfY, -1, 9999, "s"); 538 } 535 } 536 */ 537 538 fHist->SetFillStyle(4000); 539 540 TString str(o); 541 str = str.Strip(TString::kBoth); 542 543 Bool_t only = str.Contains("ONLY", TString::kIgnoreCase) && fDimension==2; 544 Bool_t same = str.Contains("SAME", TString::kIgnoreCase) && fDimension==2; 545 Bool_t blue = str.Contains("BLUE", TString::kIgnoreCase) && fDimension==2; 546 547 // FIXME: We may have to remove all our own options from str! 548 if (!only && !gPad->GetListOfPrimitives()->FindObject(fHist)) 549 fHist->Draw(str); 550 551 if (str.Contains("PROFX", TString::kIgnoreCase) && fDimension==2) 552 { 553 TProfile *p = ((TH2*)fHist)->ProfileX("ProfX", -1, 9999, "s"); 554 if (!gPad->GetListOfPrimitives()->FindObject(p)) 555 { 556 p->UseCurrentStyle(); 557 p->SetLineColor(blue ? kBlue : fHist->GetLineColor()); 558 p->SetBit(kCanDelete); 559 p->SetDirectory(NULL); 560 p->SetXTitle(fHist->GetXaxis()->GetTitle()); 561 p->SetYTitle(fHist->GetYaxis()->GetTitle()); 562 p->Draw(only&&!same?"":"same"); 563 } 564 } 565 if (str.Contains("PROFY", TString::kIgnoreCase) && fDimension==2) 566 { 567 TProfile *p = ((TH2*)fHist)->ProfileY("ProfY", -1, 9999, "s"); 568 if (!gPad->GetListOfPrimitives()->FindObject(p)) 569 { 570 p->UseCurrentStyle(); 571 p->SetLineColor(blue ? kBlue : fHist->GetLineColor()); 572 p->SetBit(kCanDelete); 573 p->SetDirectory(NULL); 574 p->SetYTitle(fHist->GetXaxis()->GetTitle()); 575 p->SetXTitle(fHist->GetYaxis()->GetTitle()); 576 p->Draw(only&&!same?"":"same"); 577 } 578 } 579 580 if (fHist->TestBit(kIsLogx) && fHist->GetEntries()>0) gPad->SetLogx(); 581 if (fHist->TestBit(kIsLogy) && fHist->GetEntries()>0) gPad->SetLogy(); 582 if (fHist->TestBit(kIsLogz) && fHist->GetEntries()>0) gPad->SetLogz(); 539 583 } 540 584 … … 559 603 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fHist); 560 604 pad->SetBorderMode(0); 561 605 AppendPad(opt); 606 607 return; 608 /* 562 609 fHist->SetFillStyle(4000); 563 610 … … 597 644 } 598 645 599 AppendPad("log"); 646 AppendPad("log");*/ 600 647 } 601 648 -
trunk/MagicSoft/Mars/mhbase/MH3.h
r5429 r5620 26 26 Double_t fScale[3]; // Scale for the three axis (eg unit) 27 27 28 TString fNameProfX; //! This should make sure, that gROOT doen't confuse the profile with something else29 TString fNameProfY; //! This should make sure, that gROOT doen't confuse the profile with something else28 // TString fNameProfX; //! This should make sure, that gROOT doen't confuse the profile with something else 29 // TString fNameProfY; //! This should make sure, that gROOT doen't confuse the profile with something else 30 30 31 31 void StreamPrimitive(ofstream &out) const; … … 36 36 kIsLogz = BIT(19) 37 37 }; 38 39 // Int_t DistancetoPrimitive(Int_t px, Int_t py); 40 // void ExecuteEvent(Int_t event, Int_t px, Int_t py); 38 41 39 42 public: -
trunk/MagicSoft/Mars/mhflux/MHEffectiveOnTime.cc
r5143 r5620 107 107 MHEffectiveOnTime::MHEffectiveOnTime(const char *name, const char *title) 108 108 : fPointPos(0), fTime(0), fParam(0), fIsFinalized(kFALSE), 109 fNumEvents(200*60) , fNameProjDeltaT(Form("DeltaT_%p", this)),110 fNameProjTheta(Form("Theta_%p", this)) 109 fNumEvents(200*60)/*, fNameProjDeltaT(Form("DeltaT_%p", this)), 110 fNameProjTheta(Form("Theta_%p", this))*/ 111 111 { 112 112 // … … 646 646 void MHEffectiveOnTime::Paint(Option_t *opt) 647 647 { 648 *fLog << all << "Paint: '" << opt << "'" << endl; 649 648 650 TH1D *h=0; 649 651 TPaveStats *st=0; … … 675 677 676 678 pad->GetPad(1)->cd(1); 677 if ((h = (TH1D*)gPad->FindObject( fNameProjDeltaT)))679 if ((h = (TH1D*)gPad->FindObject("ProjDeltaT"/*fNameProjDeltaT*/))) 678 680 { 679 h = fH2DeltaT.ProjectionX( fNameProjDeltaT, -1, 9999, "E");681 h = fH2DeltaT.ProjectionX("ProjDeltaT"/*fNameProjDeltaT*/, -1, 9999, "E"); 680 682 if (h->GetEntries()>0) 681 683 gPad->SetLogy(); … … 683 685 684 686 pad->GetPad(2)->cd(1); 685 if ((h = (TH1D*)gPad->FindObject( fNameProjTheta)))686 fH2DeltaT.ProjectionY( fNameProjTheta, -1, 9999, "E");687 if ((h = (TH1D*)gPad->FindObject("ProjTheta"/*fNameProjTheta*/))) 688 fH2DeltaT.ProjectionY("ProjTheta"/*fNameProjTheta*/, -1, 9999, "E"); 687 689 688 690 if (!fIsFinalized) … … 692 694 if (o==(TString)"paint") 693 695 { 694 if ((h = (TH1D*)gPad->FindObject( fNameProjDeltaT)))696 if ((h = (TH1D*)gPad->FindObject("ProjDeltaT"/*fNameProjDeltaT*/))) 695 697 { 696 698 Double_t res[7]; … … 771 773 pad->GetPad(1)->cd(1); 772 774 gPad->SetBorderMode(0); 773 h = fH2DeltaT.ProjectionX( fNameProjDeltaT, -1, 9999, "E");775 h = fH2DeltaT.ProjectionX("ProjDeltaT"/*fNameProjDeltaT*/, -1, 9999, "E"); 774 776 h->SetTitle("Distribution of \\Delta t [s]"); 775 777 h->SetXTitle("\\Delta t [s]"); … … 801 803 pad->GetPad(2)->cd(1); 802 804 gPad->SetBorderMode(0); 803 h = fH2DeltaT.ProjectionY( fNameProjTheta, -1, 9999, "E");805 h = fH2DeltaT.ProjectionY("ProjTheta"/*fNameProjTheta*/, -1, 9999, "E"); 804 806 h->SetTitle("Distribution of \\Theta [\\circ]"); 805 807 h->SetXTitle("\\Theta [\\circ]"); -
trunk/MagicSoft/Mars/mhflux/MHEffectiveOnTime.h
r4999 r5620 50 50 Int_t fNumEvents; // Number of events to be used for a bin in time 51 51 52 const TString fNameProjDeltaT; //! This should make sure, that gROOT doen't confuse the projection with something else53 const TString fNameProjTheta; //! This should make sure, that gROOT doen't confuse the projection with something else52 //const TString fNameProjDeltaT; //! This should make sure, that gROOT doen't confuse the projection with something else 53 //const TString fNameProjTheta; //! This should make sure, that gROOT doen't confuse the projection with something else 54 54 55 55 Bool_t FitH(TH1D *h, Double_t *res, Bool_t paint=kFALSE) const; -
trunk/MagicSoft/Mars/mhvstime/MHVsTime.cc
r4891 r5620 83 83 // 84 84 MHVsTime::MHVsTime(const char *rule, const char *error) 85 : fGraph(NULL), fData(NULL), fError( 0), fScale(1), fMaxPts(-1),85 : fGraph(NULL), fData(NULL), fError(NULL), fScale(1), fMaxPts(-1), 86 86 fNumEvents(1), fUseEventNumber(0) 87 87 { … … 114 114 if (fData) 115 115 delete fData; 116 117 if (fError) 118 delete fError; 116 119 } 117 120 … … 169 172 { 170 173 fGraph->SetName(name); 171 M ParContainer::SetName(name);174 MH::SetName(name); 172 175 } 173 176 … … 179 182 { 180 183 fGraph->SetTitle(title); 181 M ParContainer::SetTitle(title);184 MH::SetTitle(title); 182 185 } 183 186 … … 247 250 void MHVsTime::Paint(Option_t *opt) 248 251 { 252 /* 253 *fLog << all << fGraph << " " << gPad->GetName() << " ----> Paint " << opt << endl; 254 TListIter Next(gPad->GetListOfPrimitives()); TObject *obj; 255 while ((obj=Next())) *fLog << obj << " " << obj->GetName() << " " << obj->ClassName() << " " << Next.GetOption() << endl; 256 */ 257 258 if (!fGraph) 259 return; 260 261 // *fLog << all << fGraph->GetN() << " " << opt << endl; 262 263 if (fGraph->GetN()==0) 264 return; 265 266 TString str(opt); 267 if (!str.Contains("A")) 268 str += "A"; 269 if (!str.Contains("P")) 270 str += "P"; 271 if (str.Contains("same", TString::kIgnoreCase)) 272 { 273 str.ReplaceAll("same", ""); 274 str.ReplaceAll("A", ""); 275 } 276 249 277 // SetPoint deletes the histogram! 250 278 if (fUseEventNumber) … … 264 292 // Otherwise MStatusDisplay::Update hangs. 265 293 gPad->GetListOfPrimitives()->Remove(fGraph); 266 gPad->GetListOfPrimitives()->Add(fGraph, fGraph->GetN()<2 ? "A" : opt); 294 fGraph->Draw(fGraph->GetN()<2 ? "A" : str); 295 //gPad->GetListOfPrimitives()->Add(fGraph, fGraph->GetN()<2 ? "A" : opt); 296 // AppendPad(str); 297 // fGraph->Draw(str); 298 267 299 } 268 300 … … 275 307 void MHVsTime::Draw(Option_t *opt) 276 308 { 277 if (!fGraph)278 return;279 280 if (fGraph->GetN()==0)281 return;282 283 309 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fGraph); 284 310 pad->SetBorderMode(0); 285 286 TString str(opt); 287 288 if (!str.Contains("A")) 289 str += "A"; 290 if (!str.Contains("P")) 291 str += "P"; 292 293 if (str.Contains("same", TString::kIgnoreCase)) 294 { 295 str.ReplaceAll("same", ""); 296 str.ReplaceAll("A", ""); 297 } 298 299 AppendPad(str); 300 fGraph->Draw(str); 311 AppendPad(opt); 301 312 } 302 313
Note:
See TracChangeset
for help on using the changeset viewer.