Ignore:
Timestamp:
04/20/03 12:51:47 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mimage
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mimage/MHNewImagePar.cc

    r1965 r1966  
    5555//
    5656MHNewImagePar::MHNewImagePar(const char *name, const char *title)
    57     : fUseMmScale(kTRUE)
    5857{
    5958    fName  = name  ? name  : "MHNewImagePar";
    60     fTitle = title ? title : "Container for histograms of new image parameters";
     59    fTitle = title ? title : "Histograms of new image parameters";
    6160
    62     fLeakage1 = new TH1F("Leakage1", "Leakage1", 100, 0.0, 1.0);
     61    fLeakage1 = new TH1F("Leakage1", "Leakage_{1}", 100, 0.0, 1.0);
    6362    fLeakage1->SetDirectory(NULL);
    64     fLeakage1->SetXTitle("Leakage1");
     63    fLeakage1->SetXTitle("Leakage");
    6564    fLeakage1->SetYTitle("Counts");
    6665
    67     fLeakage2 = new TH1F("Leakage2", "Leakage2", 100, 0.0, 1.0);
     66    fLeakage2 = new TH1F("Leakage2", "Leakage_{2}", 100, 0.0, 1.0);
    6867    fLeakage2->SetDirectory(NULL);
    69     fLeakage2->SetXTitle("Leakage2");
     68    fLeakage2->SetXTitle("Leakage");
    7069    fLeakage2->SetYTitle("Counts");
     70    fLeakage2->SetLineColor(kBlue);
    7171}
    7272
     
    7979    delete fLeakage1;
    8080    delete fLeakage2;
    81 }
    82 
    83 // --------------------------------------------------------------------------
    84 //
    85 // Setup the Binning for the histograms automatically if the correct
    86 // instances of MBinning (with the names 'BinningAlpha' and 'BinningDist')
    87 // are found in the parameter list
    88 // Use this function if you want to set the conversion factor which
    89 // is used to convert the mm-scale in the camera plain into the deg-scale
    90 // used for histogram presentations. The conversion factor is part of
    91 // the camera geometry. Please create a corresponding MGeomCam container.
    92 //
    93 Bool_t MHNewImagePar::SetupFill(const MParList *plist)
    94 {
    95     const MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
    96     if (!geom)
    97         *fLog << warn << dbginf << "No Camera Geometry available. Using mm-scale for histograms." << endl;
    98     else
    99     {
    100         fMm2Deg = geom->GetConvMm2Deg();
    101         SetMmScale(kFALSE);
    102     }
    103 
    104     //ApplyBinning(*plist, "Alpha",    fAlpha);
    105     //ApplyBinning(*plist, "Dist",     fDist);
    106     //ApplyBinning(*plist, "HeadTail", fHeadTail);
    107 
    108     return kTRUE;
    10981}
    11082
     
    12597// --------------------------------------------------------------------------
    12698//
    127 // Use this function to setup your own conversion factor between degrees
    128 // and millimeters. The conversion factor should be the one calculated in
    129 // MGeomCam. Use this function with Caution: You could create wrong values
    130 // by setting up your own scale factor.
    131 //
    132 void MHNewImagePar::SetMm2Deg(Float_t mmdeg)
    133 {
    134     if (mmdeg<=0)
    135     {
    136         *fLog << warn << dbginf << "Warning - Conversion factor <= 0 - nonsense. Ignored." << endl;
    137         return;
    138     }
    139 
    140     if (fMm2Deg>0)
    141         *fLog << warn << dbginf << "Warning - Conversion factor already set. Overwriting" << endl;
    142 
    143     fMm2Deg = mmdeg;
    144 }
    145 
    146 // --------------------------------------------------------------------------
    147 //
    148 // With this function you can convert the histogram ('on the fly') between
    149 // degrees and millimeters.
    150 //
    151 void MHNewImagePar::SetMmScale(Bool_t mmscale)
    152 {
    153     if (fUseMmScale == mmscale)
    154         return;
    155 
    156     if (fMm2Deg<0)
    157     {
    158         *fLog << warn << GetDescriptor() << ": Warning - Sorry, no conversion factor for conversion available." << endl;
    159         return;
    160     }
    161 
    162     //const Double_t scale = mmscale ? 1./fMm2Deg : fMm2Deg;
    163     //MH::ScaleAxis(fDist,     scale);
    164     //MH::ScaleAxis(fHeadTail, scale);
    165 
    166     if (mmscale)
    167     {
    168       //    fDist->SetXTitle("Dist [mm]");
    169       //    fHeadTail->SetXTitle("Head-Tail [mm]");
    170     }
    171     else
    172     {
    173       //    fDist->SetXTitle("Dist [\\circ]");
    174       //    fHeadTail->SetXTitle("Head-Tail [\\circ]");
    175     }
    176 
    177     fUseMmScale = mmscale;
    178 }
    179 
    180 // --------------------------------------------------------------------------
    181 //
    182 // Draw clones of all two histograms. So that the object can be deleted
    183 // and the histograms are still visible in the canvas.
    184 // The cloned object are deleted together with the canvas if the canvas is
    185 // destroyed. If you want to handle dostroying the canvas you can get a
    186 // pointer to it from this function
    187 //
    188 TObject *MHNewImagePar::DrawClone(Option_t *opt) const
    189 {
    190     return MH::DrawClone(opt, 300, 600);
    191 }
    192 
    193 // --------------------------------------------------------------------------
    194 //
    19599// Creates a new canvas and draws the two histograms into it.
    196100// Be careful: The histograms belongs to this object and won't get deleted
     
    199103void MHNewImagePar::Draw(Option_t *)
    200104{
    201     TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this, 300, 600);
     105    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
    202106    pad->SetBorderMode(0);
    203107
    204108    AppendPad("");
    205109
    206     pad->Divide(1, 2);
    207 
    208     pad->cd(1);
    209     pad->SetBorderMode(0);
    210     fLeakage1->Draw();
    211 
    212     pad->cd(2);
    213     pad->SetBorderMode(0);
    214     fLeakage2->Draw();
     110    MH::Draw(*fLeakage1, *fLeakage2, "Leakage1 and Leakage2");
    215111
    216112    pad->Modified();
     
    228124    return NULL;
    229125}
    230 
    231 
    232 
    233 
    234 
    235 
    236 
    237 
    238 
    239 
    240 
    241 
    242 
    243 
    244 
    245 
    246 
  • trunk/MagicSoft/Mars/mimage/MHNewImagePar.h

    r1940 r1966  
    1515    TH1F *fLeakage2;     //->
    1616
    17     Float_t fMm2Deg;
    18     Bool_t  fUseMmScale;
    19 
    2017public:
    2118    MHNewImagePar(const char *name=NULL, const char *title=NULL);
    2219    ~MHNewImagePar();
    2320
    24     void SetMmScale(Bool_t mmscale=kTRUE);
    25     void SetMm2Deg(Float_t mmdeg);
    26 
    27     Bool_t SetupFill(const MParList *pList);
    2821    Bool_t Fill(const MParContainer *par);
    2922
     
    3427
    3528    void Draw(Option_t *opt=NULL);
    36     TObject *DrawClone(Option_t *opt=NULL) const;
    3729
    38     ClassDef(MHNewImagePar, 1) // Container which holds histograms for the new image parameters
     30    ClassDef(MHNewImagePar, 1) // Histograms of new image parameters
    3931};
    4032
  • trunk/MagicSoft/Mars/mimage/MNewImagePar.cc

    r1940 r1966  
    7272                          const MHillas *hillas)
    7373{
    74     //fHillas = (MHillas*)hillas;
    75 
    7674    const UInt_t npixevt = evt.GetNumPixels();
    7775
    78     Double_t edgepix1 = 0.0;
    79     Double_t edgepix2 = 0.0;
     76    Double_t edgepix1 = 0;
     77    Double_t edgepix2 = 0;
    8078
    8179    for (UInt_t i=0; i<npixevt; i++)
     
    8785        const MGeomPix &gpix = geom[pix.GetPixId()];
    8886
    89         Double_t nphot = pix.GetNumPhotons();                       
     87        const Double_t nphot = pix.GetNumPhotons();
    9088
    9189        // count photons in outer rings of camera
Note: See TracChangeset for help on using the changeset viewer.