Ignore:
Timestamp:
08/02/02 09:32:34 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhist
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhist/MBinning.cc

    r1465 r1474  
    2828//                                                                          //
    2929//////////////////////////////////////////////////////////////////////////////
     30#include "MBinning.h"
    3031
    31 #include "MBinning.h"
     32#include <fstream.h>
    3233
    3334#include "MH.h"
     
    5253
    5354
     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//
    5461void MBinning::Apply(TH1 &h)
    5562{
    5663    MH::SetBinning(&h, this);
    5764}
     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//
     72void 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  
    5454    void Apply(TH1 &);
    5555
     56    void SavePrimitive(ofstream &out, Option_t *o="");
     57
    5658    ClassDef(MBinning, 1) //Container to store the binning of a histogram
    5759};
  • trunk/MagicSoft/Mars/mhist/MFillH.cc

    r1472 r1474  
    344344}
    345345
     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//
    346352void MFillH::SavePrimitive(ofstream &out, Option_t *o="")
    347353{
    348354    out << "   MFillH " << ToLower(fName) << "(\"";
    349     out << fHName << "\", \"" << fParContainerName << "\")" << endl;
    350 }
     355    out << fHName << "\", \"" << fParContainerName << "\");" << endl;
     356}
  • trunk/MagicSoft/Mars/mhist/MH3.cc

    r1336 r1474  
    5858//
    5959/////////////////////////////////////////////////////////////////////////////
    60 
    6160#include "MH3.h"
     61
     62#include <fstream.h>
    6263
    6364#include <TH2.h>
     
    7778ClassImp(MH3);
    7879
     80MH3::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
    7989// --------------------------------------------------------------------------
    8090//
     
    367377    gPad->Update();
    368378}
     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//
     386void 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  
    2525
    2626public:
     27    MH3();
    2728    MH3(const char *memberx);
    2829    MH3(const char *memberx, const char *membery);
     
    4849    TObject *DrawClone(Option_t *opt=NULL) const;
    4950
     51    void SavePrimitive(ofstream &out, Option_t *o="");
     52
    5053    ClassDef(MH3, 1) // Generalized 1/2/3D-histogram for Mars variables
    5154};
Note: See TracChangeset for help on using the changeset viewer.