Changeset 1474 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 08/02/02 09:32:34 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MBinning.cc
r1465 r1474 28 28 // // 29 29 ////////////////////////////////////////////////////////////////////////////// 30 #include "MBinning.h" 30 31 31 #include "MBinning.h"32 #include <fstream.h> 32 33 33 34 #include "MH.h" … … 52 53 53 54 55 // -------------------------------------------------------------------------- 56 // 57 // Apply this binning to the given histogram. 58 // (By definition this works only for 1D-histograms. For 2D- and 3D- 59 // histograms use MH::SetBinning directly) 60 // 54 61 void MBinning::Apply(TH1 &h) 55 62 { 56 63 MH::SetBinning(&h, this); 57 64 } 65 66 // -------------------------------------------------------------------------- 67 // 68 // Implementation of SavePrimitive. Used to write the call to a constructor 69 // to a macro. In the original root implementation it is used to write 70 // gui elements to a macro-file. 71 // 72 void MBinning::SavePrimitive(ofstream &out, Option_t *o="") 73 { 74 out << " TArrayD dummy;" << endl; 75 for (int i=0; i<fEdges.GetSize(); i++) 76 out << " dummy[" << i << "]=" << fEdges[i] << ";" << endl; 77 out << " MBinning " << ToLower(fName) << "(\""; 78 out << fName << "\", \"" << fTitle << "\");" << endl; 79 out << " " << ToLower(fName) << ".SetEdges(dummy);" << endl; 80 } -
trunk/MagicSoft/Mars/mhist/MBinning.h
r1465 r1474 54 54 void Apply(TH1 &); 55 55 56 void SavePrimitive(ofstream &out, Option_t *o=""); 57 56 58 ClassDef(MBinning, 1) //Container to store the binning of a histogram 57 59 }; -
trunk/MagicSoft/Mars/mhist/MFillH.cc
r1472 r1474 344 344 } 345 345 346 // -------------------------------------------------------------------------- 347 // 348 // Implementation of SavePrimitive. Used to write the call to a constructor 349 // to a macro. In the original root implementation it is used to write 350 // gui elements to a macro-file. 351 // 346 352 void MFillH::SavePrimitive(ofstream &out, Option_t *o="") 347 353 { 348 354 out << " MFillH " << ToLower(fName) << "(\""; 349 out << fHName << "\", \"" << fParContainerName << "\") " << endl;350 } 355 out << fHName << "\", \"" << fParContainerName << "\");" << endl; 356 } -
trunk/MagicSoft/Mars/mhist/MH3.cc
r1336 r1474 58 58 // 59 59 ///////////////////////////////////////////////////////////////////////////// 60 61 60 #include "MH3.h" 61 62 #include <fstream.h> 62 63 63 64 #include <TH2.h> … … 77 78 ClassImp(MH3); 78 79 80 MH3::MH3() : fDimension(0), fHist(NULL) 81 { 82 fName = "MH3"; 83 fTitle = "Container for a 1D Mars Histogram"; 84 85 fData[0] = fData[1] = fData[2] = NULL; 86 fScale[0] = fScale[1] = fScale[2] = 1; 87 } 88 79 89 // -------------------------------------------------------------------------- 80 90 // … … 367 377 gPad->Update(); 368 378 } 379 380 // -------------------------------------------------------------------------- 381 // 382 // Implementation of SavePrimitive. Used to write the call to a constructor 383 // to a macro. In the original root implementation it is used to write 384 // gui elements to a macro-file. 385 // 386 void MH3::SavePrimitive(ofstream &out, Option_t *o="") 387 { 388 TString name = ToLower(fName); 389 390 out << " MH3 " << name << "(\""; 391 out << fData[0]->GetRule() << "\""; 392 if (fDimension>1) 393 out << ", \"" << fData[1]->GetRule() << "\""; 394 if (fDimension>2) 395 out << ", \"" << fData[2]->GetRule() << "\""; 396 397 out << ");" << endl; 398 399 out << " " << name << ".SetName(\"" << fName << "\");" << endl; 400 out << " " << name << ".SetTitle(\"" << fTitle << "\");" << endl; 401 402 switch (fDimension) 403 { 404 case 3: 405 if (fScale[2]!=1) 406 out << " " << name << ".SetScaleZ(" << fScale[2] << ");" << endl; 407 case 2: 408 if (fScale[1]!=1) 409 out << " " << name << ".SetScaleY(" << fScale[1] << ");" << endl; 410 case 1: 411 if (fScale[0]!=1) 412 out << " " << name << ".SetScaleX(" << fScale[0] << ");" << endl; 413 } 414 } -
trunk/MagicSoft/Mars/mhist/MH3.h
r1326 r1474 25 25 26 26 public: 27 MH3(); 27 28 MH3(const char *memberx); 28 29 MH3(const char *memberx, const char *membery); … … 48 49 TObject *DrawClone(Option_t *opt=NULL) const; 49 50 51 void SavePrimitive(ofstream &out, Option_t *o=""); 52 50 53 ClassDef(MH3, 1) // Generalized 1/2/3D-histogram for Mars variables 51 54 };
Note:
See TracChangeset
for help on using the changeset viewer.