Changeset 1216 for trunk


Ignore:
Timestamp:
02/13/02 16:40:37 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1215 r1216  
    11                                                                  -*-*- END -*-*-
     2
     3 2002/02/13: Thomas Bretz
     4
     5   * macros/MagicHillas.C, mhist/MHHillas.[h,cc], mhist/MHHillasSrc.[h,cc]:
     6     - implemented variable binning (MBinning)
     7     - implemented conversion to degrees (thanks to rudy)
     8     
     9   * mgui/MGeomCam.[h,cc], mgui/MGeomCamCT1.cc, mgui/MGeomCamMagic.cc:
     10     - implemented fMm2Deg and fCamDist
     11
     12
    213
    314 2002/01/23: Thomas Bretz
  • trunk/MagicSoft/Mars/NEWS

    r1203 r1216  
    1414     in different histograms (eg. the Energy bins should be the same in
    1515     all histograms)
    16  
     16
     17   - Changed Hillas histograms from mm to deg
     18
     19   - Added the flexible binning to the hillas histograms
     20
     21   - Added a filter for the alpha parameter (MFilter)
     22
    1723 
    1824 
  • trunk/MagicSoft/Mars/macros/MagicHillas.C

    r1209 r1216  
    2424
    2525
    26 void MagicHillas(const char *filename="~/data/Gamma*.root")
     26void MagicHillas(const char *filename="~/data/gamma*.root")
    2727{
    2828    //
     
    4545    MGeomCamMagic geomcam;
    4646    plist.AddToList(&geomcam);
     47
     48    //
     49    // Setup binning for your histograms.
     50    //
     51    MBinning binswidth("BinningWidth");
     52    binswidth.SetEdges(100, 0, 1);   // 100 bins from 0 to 1 deg
     53
     54    MBinning binslength("BinningLength");
     55    binslength.SetEdges(100, 0, 1);  // 100 bins from 0 to 1 deg
     56
     57    MBinning binsalpha("BinningAlpha");
     58    binsalpha.SetEdges(90, 0, 90);   // 90 bins from 0 to 90 deg
     59
     60    MBinning binsdist("BinningDist");
     61    binsdist.SetEdges(100, 0, 2);    // 100 bins from 0 to 2 deg
     62
     63    plist.AddToList(&binswidth);
     64    plist.AddToList(&binslength);
     65    plist.AddToList(&binsalpha);
     66    plist.AddToList(&binsdist);
    4767
    4868    //
  • trunk/MagicSoft/Mars/mgui/MGeomCam.cc

    r1082 r1216  
    4949// are deleted when the corresponding array is deleted.
    5050//
    51 MGeomCam::MGeomCam(UInt_t npix, const char *name, const char *title)
    52     : fNumPixels(npix)
     51MGeomCam::MGeomCam(UInt_t npix, Float_t dist, const char *name, const char *title)
     52    : fNumPixels(npix), fCamDist(dist), fMm2Deg(kRad2Deg/(dist*1000))
    5353{
    5454    fName  = name  ? name  : "MGeomCam";
  • trunk/MagicSoft/Mars/mgui/MGeomCam.h

    r1052 r1216  
    1717    Float_t  fMaxRadius;  // maximum radius of the camera (eg. for GUI layout)
    1818
     19    Float_t  fCamDist;    // [m] Average distance of the camera from the mirror
     20    Float_t  fMm2Deg;     // conversion factor to convert mm in the camera plain into degrees
     21
    1922    TObjArray *fPixels;   // Array of singel pixels storing the geometry
    2023
     
    2427public:
    2528
    26     MGeomCam(UInt_t npix, const char *name=NULL, const char *title=NULL);
     29    MGeomCam(UInt_t npix, Float_t dist, const char *name=NULL, const char *title=NULL);
    2730
    2831    virtual ~MGeomCam();
     32
     33    Float_t GetCameraDist() const { return fCamDist; }
     34    Float_t GetConvMm2Deg() const { return fMm2Deg; }
    2935
    3036    UInt_t  GetNumPixels() const { return fNumPixels; }
  • trunk/MagicSoft/Mars/mgui/MGeomCamCT1.cc

    r1082 r1216  
    5353//  CreateCam and CreateNN
    5454//
    55 MGeomCamCT1::MGeomCamCT1(const char *name) : MGeomCam(127, name, "Geometry information of CT1 camera")
     55MGeomCamCT1::MGeomCamCT1(const char *name)
     56    : MGeomCam(127, 4.88, name, "Geometry information of CT1 camera")
    5657{
    5758    CreateCam();
  • trunk/MagicSoft/Mars/mgui/MGeomCamMagic.cc

    r1082 r1216  
    4242#include "MGeomPix.h"
    4343
    44 ClassImp(MGeomCamMagic)
     44ClassImp(MGeomCamMagic);
    4545
    4646// --------------------------------------------------------------------------
     
    4949//  CreateCam and CreateNN
    5050//
    51 MGeomCamMagic::MGeomCamMagic(const char *name) : MGeomCam(577, name, "Geometry information of Magic Camera")
     51MGeomCamMagic::MGeomCamMagic(const char *name)
     52    : MGeomCam(577, 17, name, "Geometry information of Magic Camera")
    5253{
    5354    CreateCam();
  • trunk/MagicSoft/Mars/mhist/MHHillas.cc

    r1210 r1216  
    3939#include <TCanvas.h>
    4040
     41#include "MLog.h"
     42#include "MLogManip.h"
     43
     44#include "MGeomCam.h"
    4145#include "MHillas.h"
    4246#include "MParList.h"
     
    4953//
    5054MHHillas::MHHillas(const char *name, const char *title)
     55    : fMm2Deg(1), fUseMmScale(kFALSE)
    5156{
    5257    //
     
    6166    // connect all the histogram with the container fHist
    6267    //
    63     fWidth  = new TH1F("Width [mm]",  "Width of Hillas",  100, 0, 300);
    64     fLength = new TH1F("Length [mm]", "Length of Hillas", 100, 0, 300);
     68    fWidth  = new TH1F("Width",  "Width of Ellipse",  100, 0, 300);
     69    fLength = new TH1F("Length", "Length of Ellipse", 100, 0, 300);
    6570
    6671    fLength->SetDirectory(NULL);
     
    8994// instances of MBinning (with the names 'BinningWidth' and 'BinningLength')
    9095// are found in the parameter list
     96// Use this function if you want to set the conversion factor which
     97// is used to convert the mm-scale in the camera plain into the deg-scale
     98// used for histogram presentations. The conversion factor is part of
     99// the camera geometry. Please create a corresponding MGeomCam container.
    91100//
    92101Bool_t MHHillas::SetupFill(const MParList *plist)
     
    94103    const MBinning* binsw = (MBinning*)plist->FindObject("BinningWidth");
    95104    const MBinning* binsl = (MBinning*)plist->FindObject("BinningLength");
    96 
    97     if (binsw)
    98         SetBinning(fWidth, binsw);
    99 
    100     if (binsl)
    101         SetBinning(fLength, binsl);
     105    if (!binsw || !binsl)
     106    {
     107        *fLog << err << dbginf << "At least one MBinning not found... aborting." << endl;
     108        return kFALSE;
     109    }
     110
     111    SetBinning(fWidth,  binsw);
     112    SetBinning(fLength, binsl);
     113
     114    const MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
     115    if (!geom)
     116    {
     117        *fLog << warn << dbginf << "No Camera Geometry available. Using mm-scale for histograms." << endl;
     118        return kTRUE;
     119    }
     120
     121    fLength->GetXaxis()->SetTitle("Length [\\circ]");
     122    fWidth->GetXaxis()->SetTitle("Width [\\circ]");
     123
     124    fMm2Deg = geom->GetConvMm2Deg();
    102125
    103126    return kTRUE;
     
    113136    const MHillas &h = *(MHillas*)par;
    114137
    115     fWidth ->Fill(h.GetWidth());
    116     fLength->Fill(h.GetLength());
     138    if (fUseMmScale)
     139    {
     140        fWidth ->Fill(h.GetWidth());
     141        fLength->Fill(h.GetLength());
     142    }
     143    else
     144    {
     145        fWidth ->Fill(fMm2Deg*h.GetWidth());
     146        fLength->Fill(fMm2Deg*h.GetLength());
     147    }
    117148
    118149    return kTRUE;
  • trunk/MagicSoft/Mars/mhist/MHHillas.h

    r1210 r1216  
    1515    TH1F *fLength;
    1616
     17    Float_t fMm2Deg;
     18
     19    Bool_t fUseMmScale;
     20
    1721public:
    1822    MHHillas(const char *name=NULL, const char *title=NULL);
    1923    ~MHHillas();
     24
     25    void SetMmScale(Bool_t mmscale=kTRUE) { fUseMmScale = mmscale; }
    2026
    2127    Bool_t SetupFill(const MParList *pList);
  • trunk/MagicSoft/Mars/mhist/MHHillasSrc.cc

    r1210 r1216  
    3838#include <TCanvas.h>
    3939
     40#include "MLog.h"
     41#include "MLogManip.h"
     42
     43#include "MGeomCam.h"
     44
    4045#include "MParList.h"
    4146
     
    6267    // connect all the histogram with the container fHist
    6368    //
    64     fAlpha = new TH1F("Alpha [deg]", "Alpha of Hillas",   90, 0,  90);
    65     fDist  = new TH1F("Dist [mm]",   "Dist of Hillas",   100, 0, 600);
     69    fAlpha = new TH1F("Alpha", "Alpha of Ellipse",   90, 0,  90);
     70    fDist  = new TH1F("Dist",  "Dist of Ellipse",   100, 0, 600);
    6671
    6772    fAlpha->SetDirectory(NULL);
     
    9095// instances of MBinning (with the names 'BinningAlpha' and 'BinningDist')
    9196// are found in the parameter list
     97// Use this function if you want to set the conversion factor which
     98// is used to convert the mm-scale in the camera plain into the deg-scale
     99// used for histogram presentations. The conversion factor is part of
     100// the camera geometry. Please create a corresponding MGeomCam container.
    92101//
    93102Bool_t MHHillasSrc::SetupFill(const MParList *plist)
     
    95104    const MBinning* binsa = (MBinning*)plist->FindObject("BinningAlpha");
    96105    const MBinning* binsd = (MBinning*)plist->FindObject("BinningDist");
    97 
    98     if (binsa)
    99         SetBinning(fAlpha, binsa);
    100 
    101     if (binsd)
    102         SetBinning(fDist, binsd);
     106    if (!binsa || !binsd)
     107    {
     108        *fLog << err << dbginf << "At least one MBinning not found... aborting." << endl;
     109        return kFALSE;
     110    }
     111
     112    SetBinning(fAlpha, binsa);
     113    SetBinning(fDist,  binsd);
     114
     115    const MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
     116    if (!geom)
     117    {
     118        *fLog << warn << dbginf << "No Camera Geometry available. Using mm-scale for histograms." << endl;
     119        return kTRUE;
     120    }
     121
     122    fDist->GetXaxis()->SetTitle("Dist [\\circ]");
     123
     124    fMm2Deg = geom->GetConvMm2Deg();
    103125
    104126    return kTRUE;
     
    115137
    116138    fAlpha->Fill(fabs(h.GetAlpha()));
    117     fDist ->Fill(h.GetDist());
     139    fDist ->Fill(fUseMmScale ? h.GetDist() : fMm2Deg*h.GetDist());
    118140
    119141    return kTRUE;
  • trunk/MagicSoft/Mars/mhist/MHHillasSrc.h

    r1210 r1216  
    1515    TH1F *fDist;
    1616
     17    Float_t fMm2Deg;
     18    Bool_t  fUseMmScale;
     19
    1720public:
    1821    MHHillasSrc(const char *name=NULL, const char *title=NULL);
    1922    ~MHHillasSrc();
     23
     24    void SetUseMmScale(Bool_t mmscale=kTRUE) { fUseMmScale = mmscale; }
    2025
    2126    Bool_t SetupFill(const MParList *pList);
  • trunk/MagicSoft/Mars/mhist/Makefile

    r1211 r1216  
    2222#  connect the include files defined in the config.mk file
    2323#
    24 INCLUDES = -I. -I../mbase -I../mraw -I../manalysis -I../mmc
     24INCLUDES = -I. -I../mbase -I../mraw -I../manalysis -I../mmc -I../mgui
    2525
    2626#------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.