Ignore:
Timestamp:
08/08/02 14:01:38 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhist
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhist/MHHillas.h

    r1489 r1490  
    2828    void SetColors() const;
    2929
    30 protected:
    3130    Float_t fMm2Deg;
    32 
    33     Bool_t fUseMmScale;
     31    Bool_t  fUseMmScale;
    3432
    3533public:
  • trunk/MagicSoft/Mars/mhist/MHHillasExt.cc

    r1489 r1490  
    5757//
    5858MHHillasExt::MHHillasExt(const char *name, const char *title)
     59    : fMm2Deg(1), fUseMmScale(kTRUE)
    5960{
    6061    //
     
    107108    bins.Apply(fHM3Trans);
    108109
    109     bins.SetEdges(89, -297, 593);
     110    bins.SetEdges(101, -593, 593);
    110111    bins.Apply(fHAsym);
    111112}
     
    131132Bool_t MHHillasExt::SetupFill(const MParList *plist)
    132133{
     134    TObject *obj = plist->FindObject("MHillas");
     135    if (!obj)
     136    {
     137        *fLog << err << dbginf << "Sorry 'MHillas' not found in parameter list... aborting." << endl;
     138        return kFALSE;
     139    }
     140    if (!obj->InheritsFrom(MHillasExt::Class()))
     141    {
     142        *fLog << err << dbginf << "Sorry 'MHillas' doesn't inherit from MHillasExt... aborting." << endl;
     143        return kFALSE;
     144    }
     145    fHillasExt = (MHillasExt*)obj;
     146
    133147    const MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
    134148    if (!geom)
     
    146160    ApplyBinning(*plist, "M3Trans", &fHM3Trans);
    147161
    148     fHillasSrc = (MHillasSrc*)plist->FindObject("HillasSource");
    149     if (!fHillasSrc)
    150         *fLog << warn << dbginf << "Sorry 'HillasSource' [MHillasSrc] not found. Histograms will be source independant." << endl;
    151 
    152     return MHHillas::SetupFill(plist);
     162    return kTRUE;
    153163}
    154164
     
    160170Bool_t MHHillasExt::Fill(const MParContainer *par)
    161171{
    162     const MHillasExt &ext = *(MHillasExt*)par;
    163 
    164     const Double_t scale = fHillasSrc ? TMath::Sign(fUseMmScale?1:fMm2Deg, fHillasSrc->GetCosDeltaAlpha()) : 1;
    165 
    166     fHConc.Fill(ext.GetConc());
    167     fHConc1.Fill(ext.GetConc1());
    168 
    169     fHAsym.Fill(scale*ext.GetAsym());
    170     fHM3Long.Fill(scale*ext.GetM3Long());
    171     fHM3Trans.Fill(scale*ext.GetM3Trans());
     172    const MHillasSrc *src = (MHillasSrc*)par;
     173
     174    const Double_t scale = src ? TMath::Sign(fUseMmScale?1:fMm2Deg, src->GetCosDeltaAlpha()) : 1;
     175
     176    fHConc.Fill(fHillasExt->GetConc());
     177    fHConc1.Fill(fHillasExt->GetConc1());
     178
     179    fHAsym.Fill(scale*fHillasExt->GetAsym());
     180    fHM3Long.Fill(scale*fHillasExt->GetM3Long());
     181    fHM3Trans.Fill(scale*fHillasExt->GetM3Trans());
    172182    //fHAsymna.Fill(scale*ext.GetAsymna());
    173183    //fHAsym0.Fill(scale*ext.GetAsym0());
    174184
    175     return MHHillas::Fill(par);
     185    return kTRUE;
    176186}
    177187
     
    200210    {
    201211        fHAsym.SetXTitle("Asym [mm]");
    202         fHM3Long.SetXTitle("3^{rd} M_{l}[mm]");
     212        fHM3Long.SetXTitle("3^{rd} M_{l} [mm]");
    203213        fHM3Trans.SetXTitle("3^{rd} M_{t} [mm]");
    204214    }
     
    210220    }
    211221
    212     MHHillas::SetMmScale(mmscale);
     222    fUseMmScale = mmscale;
     223}
     224
     225// --------------------------------------------------------------------------
     226//
     227// Use this function to setup your own conversion factor between degrees
     228// and millimeters. The conversion factor should be the one calculated in
     229// MGeomCam. Use this function with Caution: You could create wrong values
     230// by setting up your own scale factor.
     231//
     232void MHHillasExt::SetMm2Deg(Float_t mmdeg)
     233{
     234    if (mmdeg<0)
     235    {
     236        *fLog << warn << dbginf << "Warning - Conversion factor < 0 - nonsense. Ignored." << endl;
     237        return;
     238    }
     239
     240    if (fMm2Deg>=0)
     241        *fLog << warn << dbginf << "Warning - Conversion factor already set. Overwriting" << endl;
     242
     243    fMm2Deg = mmdeg;
    213244}
    214245
     
    245276    c.Update();
    246277
    247     MHHillas::DrawClone();
    248 
    249278    return &c;
    250279}
     
    279308    gPad->Modified();
    280309    gPad->Update();
    281 
    282     MHHillas::DrawClone();
    283 }
     310}
  • trunk/MagicSoft/Mars/mhist/MHHillasExt.h

    r1465 r1490  
    55#include <TH1.h>
    66#endif
    7 #ifndef MARS_MHHillas
    8 #include "MHHillas.h"
     7#ifndef MARS_MH
     8#include "MH.h"
    99#endif
    1010
    11 class MHillasSrc;
     11class MHillasExt;
    1212
    13 class MHHillasExt : public MHHillas
     13class MHHillasExt : public MH
    1414{
    1515private:
    16     MHillasSrc *fHillasSrc; //! Pointer to an MHillasSrc to be able to add sign to Asym, M3Long and M3Trans
     16    MHillasExt *fHillasExt; //! Pointer to the MHillasExt container
    1717
    1818    TH1F fHConc;    // [ratio] concentration ratio: sum of the two highest pixels / fSize
     
    2222    TH1F fHM3Trans; // [mm]    3rd moment (e-weighted) along minor axis
    2323
     24    Float_t fMm2Deg;
     25    Bool_t  fUseMmScale;
     26
    2427public:
    2528    MHHillasExt(const char *name=NULL, const char *title=NULL);
     
    2730
    2831    void SetMmScale(Bool_t mmscale=kTRUE);
     32    virtual void SetMm2Deg(Float_t mmdeg);
    2933
    3034    Bool_t SetupFill(const MParList *pList);
     
    3438    TObject *DrawClone(Option_t *opt=NULL) const;
    3539
    36     ClassDef(MHHillasExt, 1) // Container which holds histograms for length and width
     40    ClassDef(MHHillasExt, 1) // Container which holds histograms for the extended hillas parameters
    3741};
    3842
Note: See TracChangeset for help on using the changeset viewer.