Changeset 4891 for trunk/MagicSoft/Mars/mhbase
- Timestamp:
- 09/09/04 10:51:39 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mhbase
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhbase/MBinning.cc
r4840 r4891 44 44 using namespace std; 45 45 46 static const TStringgsDefName = "MBinning";47 static const TStringgsDefTitle = "Container describing the binning of an axis";46 const TString MBinning::gsDefName = "MBinning"; 47 const TString MBinning::gsDefTitle = "Container describing the binning of an axis"; 48 48 49 49 // -------------------------------------------------------------------------- -
trunk/MagicSoft/Mars/mhbase/MBinning.h
r4840 r4891 15 15 class MBinning : public MParContainer 16 16 { 17 public: 18 static const TString gsDefName; 19 static const TString gsDefTitle; 20 17 21 private: 22 18 23 TArrayD fEdges; 19 24 … … 80 85 Bool_t IsUserArray() const { return fType==kIsUserArray; } 81 86 87 Bool_t HasTitle() const { return gsDefTitle!=fTitle; } 88 82 89 void Apply(TH1 &) const; 83 90 -
trunk/MagicSoft/Mars/mhbase/MH3.cc
r4829 r4891 48 48 // SetScaleY and SetScaleZ. 49 49 // 50 // 51 // Axis titles 52 // =========== 53 // 54 // 1) If no other title is given the rule for this axis is used. 55 // 2) If the MBinning used for this axis has a non-default Title 56 // (MBinning::HasTitle) this title is used for the corresponding axis 57 // 3) If the MH3 has a non-default title (MH3::SetTitle called) 58 // this title is set as the histogram title. It can be used to overwrite 59 // the axis titles. For more information see TH1::SetTitle, eg. 60 // SetTitle("MyHist;x[mm];y[cm];Counts"); 61 // 50 62 // For example: 51 63 // MH3 myhist("MHillas.fLength"); … … 83 95 using namespace std; 84 96 85 static const TStringgsDefName = "MH3";86 static const TString gsDefTitle = "Container for a %dD Mars Histogram";97 const TString MH3::gsDefName = "MH3"; 98 const TString MH3::gsDefTitle = "Container for a n-D Mars Histogram"; 87 99 88 100 // -------------------------------------------------------------------------- … … 113 125 114 126 fName = gsDefName; 115 fTitle = Form(gsDefTitle.Data(), fDimension);127 fTitle = gsDefTitle; 116 128 117 129 if (fHist) … … 141 153 142 154 fName = gsDefName; 143 fTitle = Form(gsDefTitle.Data(), 1);155 fTitle = gsDefTitle; 144 156 145 157 fHist->UseCurrentStyle(); … … 168 180 169 181 fName = gsDefName; 170 fTitle = Form(gsDefTitle.Data(), 2);182 fTitle = gsDefTitle; 171 183 172 184 fHist->UseCurrentStyle(); … … 195 207 196 208 fName = gsDefName; 197 fTitle = Form(gsDefTitle.Data(), 3);209 fTitle = gsDefTitle; 198 210 199 211 fHist->UseCurrentStyle(); … … 266 278 return kFALSE; 267 279 } 280 if (fData[2] && !fData[2]->PreProcess(plist)) 281 return kFALSE; 282 if (fData[2]) 283 fHist->SetZTitle(fData[2]->GetTitle()); 284 if (binsz->HasTitle()) 285 fHist->SetZTitle(binsz->GetTitle()); 268 286 if (binsz->IsLogarithmic()) 269 287 fHist->SetBit(kIsLogz); 270 if (fData[2]) fHist->SetZTitle(fData[2]->GetTitle());271 if (fData[2] && !fData[2]->PreProcess(plist))272 return kFALSE;273 288 case 2: 274 289 binsy = (MBinning*)plist->FindObject(bname+"Y", "MBinning"); … … 278 293 return kFALSE; 279 294 } 295 if (fData[1] && !fData[1]->PreProcess(plist)) 296 return kFALSE; 297 if (fData[1]) 298 fHist->SetYTitle(fData[1]->GetTitle()); 299 if (binsy->HasTitle()) 300 fHist->SetYTitle(binsy->GetTitle()); 280 301 if (binsy->IsLogarithmic()) 281 302 fHist->SetBit(kIsLogy); 282 if (fData[1]) fHist->SetYTitle(fData[1]->GetTitle());283 if (fData[1] && !fData[1]->PreProcess(plist))284 return kFALSE;285 303 case 1: 286 304 binsx = (MBinning*)plist->FindObject(bname+"X", "MBinning"); … … 297 315 298 316 } 317 if (fData[0] && !fData[0]->PreProcess(plist)) 318 return kFALSE; 319 if (fData[0]!=NULL) 320 fHist->SetXTitle(fData[0]->GetTitle()); 321 if (binsx->HasTitle()) 322 fHist->SetXTitle(binsx->GetTitle()); 299 323 if (binsx->IsLogarithmic()) 300 324 fHist->SetBit(kIsLogx); 301 302 if (fData[0]!=NULL) fHist->SetXTitle(fData[0]->GetTitle());303 if (fData[0] && !fData[0]->PreProcess(plist))304 return kFALSE;305 325 } 306 326 307 327 fHist->SetName(fName); 328 fHist->SetDirectory(0); 329 330 if (fTitle!=gsDefTitle) 331 { 332 fHist->SetTitle(fTitle); 333 return kTRUE; 334 } 308 335 309 336 TString title("Histogram for "); … … 325 352 return kTRUE; 326 353 } 327 cout << "Still alive...?" << endl; 328 return kTRUE; 354 355 *fLog << err << "ERROR - MH3 has " << fDimension << " dimensions!" << endl; 356 return kFALSE; 329 357 } 330 358 … … 335 363 void MH3::SetName(const char *name) 336 364 { 337 fHist->SetName(name); 365 if (fHist) 366 { 367 fHist->SetName(name); 368 fHist->SetDirectory(0); 369 } 338 370 MParContainer::SetName(name); 339 371 } … … 345 377 void MH3::SetTitle(const char *title) 346 378 { 347 fHist->SetTitle(title); 379 if (fHist) 380 fHist->SetTitle(title); 348 381 MParContainer::SetTitle(title); 349 382 } … … 644 677 out << " " << name << ".SetName(\"" << fName << "\");" << endl; 645 678 646 if (fTitle!= Form(gsDefTitle.Data(), fDimension))679 if (fTitle!=gsDefTitle) 647 680 out << " " << name << ".SetTitle(\"" << fTitle << "\");" << endl; 648 681 -
trunk/MagicSoft/Mars/mhbase/MH3.h
r4828 r4891 15 15 class MH3 : public MH 16 16 { 17 private: 18 static const TString gsDefName; 19 static const TString gsDefTitle; 20 17 21 protected: 18 22 // Could be const but root < 3.02/06 doesn't like this...
Note:
See TracChangeset
for help on using the changeset viewer.