Changeset 9312


Ignore:
Timestamp:
02/10/09 20:00:10 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft
Files:
31 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r9311 r9312  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20 2009/02/10 Thomas Bretz
     21
     22   * manalysis/MMcTriggerLvl2Calc.cc:
     23     - removed obsolete include of MmcRunHeader
     24
     25   * mbase/MSpline3.[h,cc]:
     26     - improved the available constructors
     27     - added some comments for future use
     28     - added default constructor
     29     - added GetHistogram()
     30
     31   * mcorsika/MCorsikaRunHeader.[h,cc]:
     32     - added fImpactMax
     33     - added some Getters
     34
     35   * melectronics/MPulseShape.[h,cc]:
     36     - set class version to 1 to make it storable
     37     - set a title for the splines
     38     - implemented Paint function
     39
     40   * mhbase/MH.[h,cc]:
     41     - added SetPadRange
     42
     43   * mhist/MHCamEvent.[h,cc]:
     44     - Init the geometry in ReInit thus it can work with a geometry stored in a file
     45     - Make sure that histogranms already drawn properly to a pad are found in Paint
     46     - added RecursiveRemove for sanity
     47
     48   * mmc/MMcCorsikaRunHeader.h:
     49     - added SetSpectrum
     50
     51   * mmc/MMcEvt.hxx:
     52     - added SetEvtNumber
     53     - added SetPhotElfromShower
     54
     55   * mmc/MMcEvtBasic.[h,cc]:
     56     - added operator=
     57
     58   * mmc/MMcRunHeader.[hxx, cxx]:
     59     - set default for the versions to UShort_t(-1)
     60     - added some comments
     61     - added SetNumSimulatedShowers
     62     - added SetImpactMax
     63
     64   * mraw/MRawRunHeader.cc:
     65     - suppress some information in header if not valid
     66
     67   * msignal/MSignalCalc.cc:
     68     - if (!fPedestal) we should return kTRUE not kFALSE
     69
     70   * msimreflector/MMirror.[h,cc], msimreflector/MMirrorDisk.[h,cc],
     71     msimreflector/MMirrorHex.[h,cc], msimreflector/MMirrorSquare.[h,cc],
     72     msimreflector/MReflector.[h,cc],
     73     - added Print
     74     - some cosmetics in header
     75     - set class version to 1 to make it storable
     76
     77   * mtools/MagicJam.cc:
     78     - updated
     79
     80
    2081
    2182 2009/02/10 Daniela Dorner
  • trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2Calc.cc

    r7188 r9312  
    4545#include "MMcTrig.hxx"
    4646#include "MRawRunHeader.h"
    47 #include "MMcRunHeader.hxx"
    4847
    4948#include "MGeomCam.h"
  • trunk/MagicSoft/Mars/mbase/MSpline3.cc

    r9229 r9312  
    3838#include <TF1.h>
    3939
     40#include "MArrayD.h"
     41
    4042ClassImp(MSpline3);
    4143
     
    4850MSpline3::MSpline3(const TF1 &f, const char *opt, Double_t valbeg, Double_t valend)
    4951    : TSpline3("MSpline3", f.GetXmin(), f.GetXmax(), &f, f.GetNpx(), opt, valbeg, valend)
     52{
     53}
     54
     55MSpline3::MSpline3(const TF1 &f, Double_t freq, const char *opt,Double_t valbeg, Double_t valend)
     56    : TSpline3("MSpline3", f.GetXmin()*freq, f.GetXmax()*freq, ConvertFunc(f, freq).GetArray(), f.GetNpx(), opt, valbeg, valend)
    5057{
    5158}
     
    105112// a discrete binning is done similar to the constructor of TSpline
    106113//
    107 TGraph *MSpline3::ConvertFunc(const TF1 &f, Float_t freq) const
     114MArrayD &MSpline3::ConvertFunc(const TF1 &f, Float_t freq) const
    108115{
    109116    const UInt_t npx = f.GetNpx();
     
    111118    // WARNING: This is a stupid workaround because the TSpline3-
    112119    // constructor takes a pointer as input! It is not thread-safe!
    113     static TGraph g;
     120    static MArrayD g;
    114121    g.Set(npx);
    115122
     
    119126    {
    120127        const Double_t x = f.GetXmin() + i*step;
    121         g.SetPoint(i, x*freq, f.Eval(x));
     128        g[i] = f.Eval(x);
    122129    }
    123130
    124     return &g;
     131    return g;
    125132}
     133
     134// FIXME: As soon as TSpline3 allows access to fPoly we can implement
     135//        a much faster evaluation of the spline, especially in
     136//        special conditions like in MAnalogSignal::AddPulse
     137//        This will be the case for root > 5.22/00
     138
     139/*
     140Double_t MSpline3::EvalFast(Double_t x) const
     141{
     142    // Eval this spline at x
     143    const Int_t klow=FindFast(x);
     144    return fPoly[klow].Eval(x);
     145}
     146
     147Int_t MSpline3::FindFast(Double_t x) const
     148{
     149    //
     150    // If out of boundaries, extrapolate
     151    // It may be badly wrong
     152
     153    // if (x<=fXmin)
     154    //     return 0;
     155    //
     156    // if (x>=fXmax)
     157    //     return fNp-1;
     158
     159    //
     160    // Equidistant knots, use histogramming
     161    if (fKstep)
     162        return TMath::Min(Int_t((x-fXmin)/fDelta),fNp-1);
     163
     164    //
     165    // Non equidistant knots, binary search
     166    Int_t klow = 0;
     167    Int_t khig = fNp-1;
     168
     169    Int_t khalf;
     170    while (khig-klow>1)
     171        if(x>fPoly[khalf=(klow+khig)/2].X())
     172            klow=khalf;
     173        else
     174            khig=khalf;
     175
     176    // This could be removed, sanity check
     177    //if(!(fPoly[klow].X()<=x && x<=fPoly[klow+1].X()))
     178    //    Error("Eval",
     179    //          "Binary search failed x(%d) = %f < %f < x(%d) = %f\n",
     180    //          klow,fPoly[klow].X(),x,fPoly[klow+1].X());
     181
     182    return klow;
     183}
     184*/
  • trunk/MagicSoft/Mars/mbase/MSpline3.h

    r9229 r9312  
    66#endif
    77
     8class MArrayD;
     9
    810class MSpline3 : public TSpline3
    911{
    1012private:
    11     TGraph *ConvertSpline(const TSpline &s, Float_t freq) const;
    12     TGraph *ConvertGraph(const TGraph &s, Float_t freq) const;
    13     TGraph *ConvertFunc(const TF1 &f, Float_t freq) const;
     13    TGraph  *ConvertSpline(const TSpline &s, Float_t freq) const;
     14    TGraph  *ConvertGraph(const TGraph &s, Float_t freq) const;
     15    MArrayD &ConvertFunc(const TF1 &f, Float_t freq) const;
    1416
    1517public:
    16    MSpline3(const TGraph &g,
    17             const char *opt=0, Double_t valbeg=0, Double_t valend=0)
    18         : TSpline3("MSpline3", &g, opt, valbeg, valend)
    19    {
    20    }
     18    MSpline3() { }
    2119
    22    MSpline3(const TGraph &g, Double_t freq,
    23             const char *opt=0, Double_t valbeg=0, Double_t valend=0)
    24         : TSpline3("MSpline3", ConvertGraph(g, freq), opt, valbeg, valend)
    25    {
    26    }
     20    // None equidistant binning (evaluation a bit slower in case of many bins)
     21    MSpline3(const TGraph &g,
     22             const char *opt=0, Double_t valbeg=0, Double_t valend=0)
     23       : TSpline3("MSpline3", &g, opt, valbeg, valend)
     24    {
     25    }
    2726
    28    MSpline3(const TSpline &s, Double_t freq,
    29             const char *opt=0, Double_t valbeg=0, Double_t valend=0)
    30         : TSpline3("MSpline3", ConvertSpline(s, freq), opt, valbeg, valend)
    31    {
    32    }
    33         /*
    34    MSpline3(Double_t xmin, Double_t xmax,
    35             const TF1 *func, Int_t n, const char *opt=0,
    36             Double_t valbeg=0, Double_t valend=0)
    37         : TSpline3("MSpline3", xmin, xmax, func, n, opt, valbeg, valend)
    38    {
    39    }*/
    40    MSpline3(const TF1 &f, const char *opt=0,Double_t valbeg=0, Double_t valend=0);
     27    MSpline3(const TGraph &g, Double_t freq,
     28             const char *opt=0, Double_t valbeg=0, Double_t valend=0)
     29       : TSpline3("MSpline3", ConvertGraph(g, freq), opt, valbeg, valend)
     30    {
     31    }
    4132
    42    MSpline3(const TF1 &f, Double_t freq,
    43             const char *opt=0,Double_t valbeg=0, Double_t valend=0)
    44         : TSpline3("MSpline3", ConvertFunc(f, freq), opt, valbeg, valend)
    45    {
    46    }
     33    MSpline3(const TSpline &s, Double_t freq,
     34             const char *opt=0, Double_t valbeg=0, Double_t valend=0)
     35       : TSpline3("MSpline3", ConvertSpline(s, freq), opt, valbeg, valend)
     36    {
     37    }
    4738
    48    MSpline3(const Double_t x[], const Double_t y[], Int_t n, const char *opt=0,
    49             Double_t valbeg=0, Double_t valend=0)
    50         : TSpline3("MSpline3", const_cast<Double_t*>(x), const_cast<Double_t*>(y), n, opt, valbeg, valend)
    51    {
    52    }
     39    MSpline3(const Double_t x[], const Double_t y[], Int_t n, const char *opt=0,
     40             Double_t valbeg=0, Double_t valend=0)
     41       : TSpline3("MSpline3", const_cast<Double_t*>(x), const_cast<Double_t*>(y), n, opt, valbeg, valend)
     42    {
     43    }
     44
     45    // Equidistant binning (evaluation a bit faster in case of many bins)
     46
     47    // FIXME: In principle TF1 can be evaluated histogram like which should be faster
     48    MSpline3(const TF1 &f, const char *opt=0,Double_t valbeg=0, Double_t valend=0);
     49    MSpline3(const TF1 &f, Double_t freq, const char *opt=0,Double_t valbeg=0, Double_t valend=0);
    5350
    5451   Double_t GetXmin() const { return fXmin; }     // Minimum value of abscissa
     
    5754   Int_t GetNp() const { return fNp; }
    5855
     56   TH1 *GetHistogram() const { return fHistogram; }
     57
    5958   ClassDef(MSpline3, 1) // An extension of the TSpline3
    6059};
  • trunk/MagicSoft/Mars/mcorsika/MCorsikaRunHeader.cc

    r9308 r9312  
    3333// ----------------
    3434//  + UInt_t fParticleID
     35//  + Float_t fImpactMax
    3536//
    3637////////////////////////////////////////////////////////////////////////////
     
    148149    fParticleID = TMath::Nint(g[1]);
    149150
    150     //fImpactMax = g[86];
     151    fImpactMax = g[86];
    151152
    152153    fZdMin = g[79];                // lower edge of theta in °
  • trunk/MagicSoft/Mars/mcorsika/MCorsikaRunHeader.h

    r9308 r9312  
    1616
    1717private:
    18     UInt_t    fRunNumber;         // Run number
    19     UInt_t    fParticleID;        // Particle ID (see MMcEvtBasic or CORSIKA manual)
    20     UInt_t    fNumEvents;         // Number of events
    21     MTime     fRunStart;          // Date of begin (yymmdd)
    22     Float_t   fProgramVersion;    // Version of program
     18    UInt_t   fRunNumber;              // Run number
     19    UInt_t   fParticleID;             // Particle ID (see MMcEvtBasic or CORSIKA manual)
     20    UInt_t   fNumEvents;              // Number of events
     21    MTime    fRunStart;               // Date of begin (yymmdd)
     22    Float_t  fProgramVersion;         // Version of program
    2323
    24     Byte_t    fNumObsLevel;       // Number of observation levels
    25     Float_t   fObsLevel[10];      // Observation levels [cm]
     24    Byte_t   fNumObsLevel;            // Number of observation levels
     25    Float_t  fObsLevel[10];           // Observation levels [cm]
    2626
    27     Float_t   fSlopeSpectrum;     // Slope of energy spectrum
    28     Float_t   fEnergyMin;         // Lower limit of energy range
    29     Float_t   fEnergyMax;         // Upper limit of energy range
     27    Float_t  fImpactMax;              // [cm] Maximum simulated impact
    3028
    31     Float_t  fZdMin;                     // [rad] Zenith distance
    32     Float_t  fZdMax;                     // [rad] Zenith distance
    33     Float_t  fAzMin;                     // [rad] Azimuth (north=0; west=90)
    34     Float_t  fAzMax;                     // [rad] Azimuth (north=0; west=90)
     29    Float_t  fSlopeSpectrum;          // Slope of energy spectrum
     30    Float_t  fEnergyMin;              // Lower limit of energy range
     31    Float_t  fEnergyMax;              // Upper limit of energy range
    3532
    36     Float_t fWavelengthMin;      // [nm] Wavelength bandwidth lo edge
    37     Float_t fWavelengthMax;      // [nm] Wavelength bandwidth up edge
     33    Float_t  fZdMin;                  // [rad] Zenith distance
     34    Float_t  fZdMax;                  // [rad] Zenith distance
     35    Float_t  fAzMin;                  // [rad] Azimuth (north=0; west=90)
     36    Float_t  fAzMax;                  // [rad] Azimuth (north=0; west=90)
    3837
    39     //Float_t  fImpactMax;              // [cm] Maximum simulated impact
     38    Float_t fWavelengthMin;           // [nm] Wavelength bandwidth lo edge
     39    Float_t fWavelengthMax;           // [nm] Wavelength bandwidth up edge
    4040
    4141    Float_t fViewConeInnerAngle;      // [deg]
     
    4848    Bool_t HasViewCone() const { return fViewConeOuterAngle>0; }
    4949
     50    UInt_t GetParticleID() const { return fParticleID; }
     51
    5052    Float_t GetZdMin() const { return fZdMin; }
    5153    Float_t GetZdMax() const { return fZdMax; }
     
    5759    Float_t GetWavelengthMax() const { return fWavelengthMax; }
    5860
    59     UInt_t GetParticleID() const { return fParticleID; }
     61    Float_t GetSlopeSpectrum() const { return fSlopeSpectrum; }
     62    Float_t GetEnergyMin() const { return fEnergyMin; }
     63    Float_t GetEnergyMax() const { return fEnergyMax; }
    6064
    61     //Float_t GetImpactMax() const { return fImpactMax; }
     65    Float_t GetImpactMax() const { return fImpactMax; }
    6266
    6367    Float_t GetViewConeOuterAngle() const { return fViewConeOuterAngle; }
  • trunk/MagicSoft/Mars/melectronics/MPulseShape.cc

    r9280 r9312  
    127127    Clear();
    128128    fSpline = new MSpline3(g);//, fRunHeader->GetFreqSampling()/1000.);
     129    fSpline->SetTitle("MPulseShape");
    129130
    130131    // FIXME: Make a boundary condition e1b1,0,0 (First der, at Xmin and Xmax==0)
     
    146147    Clear();
    147148    fSpline = new MSpline3(f);//, fRunHeader->GetFreqSampling()/1000.);
     149    fSpline->SetTitle("MPulseShape");
    148150
    149151    // FIXME: Make a boundary condition e1b1,0,0 (First der, at Xmin and Xmax==0)
     
    200202    return rc;
    201203}
     204
     205void MPulseShape::Paint(Option_t *)
     206{
     207    fSpline->SetMarkerStyle(kFullDotMedium);
     208
     209    if (!fSpline->GetHistogram())
     210        fSpline->Paint();
     211
     212    TH1 *h = fSpline->GetHistogram();
     213    if (!h)
     214        return;
     215
     216    h->SetXTitle("t [ns]");
     217    h->SetYTitle("a.u.");
     218
     219    fSpline->Paint("PC");
     220}
  • trunk/MagicSoft/Mars/melectronics/MPulseShape.h

    r9274 r9312  
    3636
    3737    void Clear(Option_t *o="");
     38    void Paint(Option_t *o="");
    3839
    3940    MSpline3 *GetSpline() const { return fSpline; }
     
    4344    Float_t GetXmax() const;
    4445
    45     ClassDef(MPulseShape, 0) // Parameter container to hold the setup for a pulse shape
     46    ClassDef(MPulseShape, 1) // Parameter container to hold the setup for a pulse shape
    4647};
    4748
  • trunk/MagicSoft/Mars/mhbase/MH.cc

    r9302 r9312  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MH.cc,v 1.43 2009-02-07 20:40:12 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MH.cc,v 1.44 2009-02-10 20:00:09 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    18131813    return "MH::GetObjectInfo: unknown class.";
    18141814}
     1815
     1816// --------------------------------------------------------------------------
     1817//
     1818// Set the pad-range such that at the smallest width it is still
     1819// two times max and that the displayed "pixels" (i.e. its coordinate
     1820// system) have the width to height ratio of aspect.
     1821//
     1822void MH::SetPadRange(Float_t max, Float_t aspect)
     1823{
     1824    if (!gPad)
     1825        return;
     1826
     1827    const Float_t w = gPad->GetWw();
     1828    const Float_t h = gPad->GetWh();
     1829
     1830    if (w>aspect*h)
     1831    {
     1832        const Double_t dx = ((w/h-aspect)/2+1)*max;
     1833        gPad->Range(-dx, -max, dx, max);
     1834    }
     1835    else
     1836    {
     1837        const Double_t dy = ((h/w-1./aspect)/2+1)*max;
     1838        gPad->Range(-max, -dy, max, dy);
     1839    }
     1840}
     1841
     1842// --------------------------------------------------------------------------
     1843//
     1844// Set the range of a pad in a way that the coordinates fit into the pad
     1845// without abberation.
     1846//
     1847void MH::SetPadRange(Float_t x0, Float_t y0, Float_t x1, Float_t y1)
     1848{
     1849    if (!gPad)
     1850        return;
     1851
     1852    const Float_t w = x1-x0;                              // Width  in user coordinates
     1853    const Float_t h = y1-y0;                              // Hieght in user coordinates
     1854
     1855    const Float_t ww = gPad->GetWw()*gPad->GetAbsWNDC();  // Width  of pad in pixels
     1856    const Float_t hh = gPad->GetWh()*gPad->GetAbsHNDC();  // Height of pad in pixels
     1857
     1858    if (ww/hh > w/h)
     1859    {
     1860        const Double_t dx = (ww/hh-w/h)/2*h;
     1861
     1862        gPad->Range(x0-dx, y0, x1+dx, y1);
     1863    }
     1864    else
     1865    {
     1866        const Double_t dy = (hh/ww-h/w)/2*w;
     1867
     1868        gPad->Range(x0, y0-dy, x1, y1+dy);
     1869    }
     1870}
  • trunk/MagicSoft/Mars/mhbase/MH.h

    r9205 r9312  
    130130
    131131    static void SetPalette(TString paletteName="pretty", Int_t ncol=50);
     132    static void SetPadRange(Float_t max, Float_t aspect=1);
     133    static void SetPadRange(Float_t x0, Float_t y0, Float_t x1, Float_t y1);
    132134
    133135    static char *GetObjectInfoH(Int_t px, Int_t py, const TH1 &h);
  • trunk/MagicSoft/Mars/mhist/MHCamEvent.cc

    r9308 r9312  
    9191//
    9292MHCamEvent::MHCamEvent(const char *name, const char *title)
    93 : fSum(NULL), fEvt(NULL), fType(0), fErrorSpread(kTRUE), fErrorRelative(kFALSE),
     93: fSum(NULL), fErr(NULL), fEvt(NULL), fType(0), fErrorSpread(kTRUE), fErrorRelative(kFALSE),
    9494fThreshold(0), fUseThreshold(0)
    9595{
     
    104104//
    105105MHCamEvent::MHCamEvent(Int_t type, const char *name, const char *title)
    106 : fSum(NULL), fEvt(NULL), fType(type), fErrorSpread(kTRUE), fErrorRelative(kFALSE),
     106: fSum(NULL), fErr(NULL), fEvt(NULL), fType(type), fErrorSpread(kTRUE), fErrorRelative(kFALSE),
    107107fThreshold(0), fUseThreshold(0)
    108108{
     
    120120    if (fSum)
    121121        delete fSum;
     122}
     123
     124Bool_t MHCamEvent::InitGeom(const MParList &plist)
     125{
     126    MGeomCam *cam = (MGeomCam*)plist.FindObject(fNameGeom, "MGeomCam");
     127    if (!cam)
     128    {
     129        *fLog << err << fNameGeom << " [MGeomCam] not found... abort." << endl;
     130        return kFALSE;
     131    }
     132
     133    // combine name
     134    const TString name = fNameEvt.IsNull() ? fName : fNameEvt;
     135
     136    fSum->SetGeometry(*cam, name+";avg");
     137    if (fTitle!=gsDefTitle)
     138        fSum->SetTitle(fTitle);
     139    if (!fTitle.Contains(";"))
     140        fSum->SetYTitle("a.u.");
     141
     142    if (fErr)
     143        fErr->SetGeometry(*fSum->GetGeometry(), fErr->GetName(), fErr->GetTitle());
     144
     145    return kTRUE;
    122146}
    123147
     
    142166    }
    143167
    144     MGeomCam *cam = (MGeomCam*)plist->FindObject(fNameGeom, "MGeomCam");
    145     if (!cam)
    146     {
    147         *fLog << err << fNameGeom << " [MGeomCam] not found... abort." << endl;
     168    fSum->Reset();
     169
     170    fNumReInit = 0;
     171
     172    if (!InitGeom(*plist))
    148173        return kFALSE;
    149     }
    150 
    151     // combine name
    152     const TString name = fNameEvt.IsNull() ? fName : fNameEvt;
    153 
    154     fSum->Reset();
    155     fSum->SetGeometry(*cam, name+";avg");
    156 
    157     if (fTitle!=gsDefTitle)
    158         fSum->SetTitle(fTitle);
    159     if (!fTitle.Contains(";"))
    160         fSum->SetYTitle("a.u.");
     174
    161175    if (fUseThreshold!=kCollectMin && fUseThreshold!=kCollectMax)
    162176        fSum->SetBit(MHCamera::kProfile);
     
    169183// --------------------------------------------------------------------------
    170184//
     185// The geometry read from the RunHeaders might have changed. This does not
     186// effect anything in PreProcess. So we set a new geometry. We don't move
     187// this away from PreProcess to support also loops without calling ReInit.
     188//
     189Bool_t MHCamEvent::ReInit(MParList *plist)
     190{
     191    return fNumReInit++==0 ? InitGeom(*plist) : kTRUE;
     192}
     193
     194
     195// --------------------------------------------------------------------------
     196//
    171197// Fill the histograms with data from a MCamEvent-Container.
    172198//
     
    250276}
    251277
     278TString MHCamEvent::Format(const char *ext) const
     279{
     280    TString n = fSum->GetName();
     281
     282    const Ssiz_t pos = n.Last(';');
     283    if (pos<0)
     284        return "";
     285
     286    n  = n(0, pos);
     287    n += ";";
     288    n += ext;
     289    return n;
     290}
     291
    252292void MHCamEvent::Paint(Option_t *)
    253293{
     
    255295
    256296    pad->cd(2);
    257     if (gPad->FindObject(MString::Format("%s;proj", fName.Data())))
    258     {
    259         TH1 *h=fSum->Projection(MString::Format("%s;proj", fName.Data()));
     297    if (gPad->FindObject(Format("proj")))
     298    {
     299        TH1 *h=fSum->Projection(Format("proj"));
    260300        if (h->GetMaximum()>0)
    261301            gPad->SetLogy();
     
    263303
    264304    pad->cd(5);
    265     if (gPad->FindObject(MString::Format("%s;rad", fName.Data())))
    266         fSum->RadialProfile(MString::Format("%s;rad", fName.Data()));
     305    if (gPad->FindObject(Format("rad")))
     306        fSum->RadialProfile(Format("rad"));
    267307
    268308    pad->cd(6);
    269     if (gPad->FindObject(MString::Format("%s;az", fName.Data())))
    270         fSum->AzimuthProfile(MString::Format("%s;az", fName.Data()));
     309    if (gPad->FindObject(Format("az")))
     310        fSum->AzimuthProfile(Format("az"));
    271311
    272312    pad->cd(4);
    273313    gPad->cd(1);
    274     MHCamera *cam = (MHCamera*)gPad->FindObject(MString::Format("%s;err", fName.Data()));
     314    MHCamera *cam = (MHCamera*)gPad->FindObject(Format("err"));
    275315    if (cam)
    276316        cam->SetCamContent(*fSum, fErrorRelative ? 1 : 2);
     
    300340    p->Draw();
    301341    p->cd();
    302     TH1 *h = fSum->Projection(MString::Format("%s;proj", fName.Data()), 50);
     342    TH1 *h = fSum->Projection(Format("proj"), 50);
    303343    h->SetTitle("Projection");
    304344    h->SetBit(kCanDelete);
     
    328368        e += "/v_{i}";
    329369
    330     MHCamera *cam = new MHCamera(*fSum->GetGeometry());
    331     cam->SetName(MString::Format("%s;err", fName.Data()));
    332     cam->SetTitle(e);
    333     cam->SetYTitle(fSum->GetYaxis()->GetTitle());
    334     cam->SetCamContent(*fSum, fErrorRelative ? 1 : 2);
    335     cam->SetBit(kCanDelete);
    336     cam->Draw();
     370    fErr = new MHCamera(*fSum->GetGeometry());
     371    fErr->SetName(Format("err"));
     372    fErr->SetTitle(e);
     373    fErr->SetYTitle(fSum->GetYaxis()->GetTitle());
     374    fErr->SetCamContent(*fSum, fErrorRelative ? 1 : 2);
     375    fErr->SetBit(kMustCleanup);
     376    fErr->SetBit(kCanDelete);
     377    fErr->Draw();
    337378
    338379    pad->cd();
     
    343384    p->Draw();
    344385    p->cd();
    345     h = (TH1*)fSum->RadialProfile(MString::Format("%s;rad", fName.Data()), 20);
     386    h = (TH1*)fSum->RadialProfile(Format("rad"), 20);
    346387    h->SetTitle("Radial Profile");
    347388    h->SetBit(kCanDelete|TH1::kNoStats);
     
    355396    p->Draw();
    356397    p->cd();
    357     h = (TH1*)fSum->AzimuthProfile(MString::Format("%s;az", fName.Data()), 30);
     398    h = (TH1*)fSum->AzimuthProfile(Format("az"), 30);
    358399    h->SetTitle("Azimuth Profile");
    359400    h->SetBit(kCanDelete|TH1::kNoStats);
     
    361402}
    362403
     404
     405void MHCamEvent::RecursiveRemove(TObject *obj)
     406{
     407    if (obj==fErr)
     408        fErr = 0;
     409}
  • trunk/MagicSoft/Mars/mhist/MHCamEvent.h

    r9308 r9312  
    1717protected:
    1818    MHCamera  *fSum;       // storing the sum
     19    MHCamera  *fErr;       //! storing the err
    1920    MCamEvent *fEvt;       //! the current event
    2021
     
    2930    Char_t fUseThreshold;  // Use a threshold? Which direction has it?
    3031
    31     void Init(const char *name, const char *title);
     32    Int_t fNumReInit;      //!
     33
     34    TString Format(const char *ext) const;
     35
     36    void   Init(const char *name, const char *title);
     37    Bool_t InitGeom(const MParList &plist);
    3238
    3339    Bool_t SetupFill(const MParList *pList);
     40    Bool_t ReInit(MParList *plist);
    3441    Int_t  Fill(const MParContainer *par, const Stat_t w=1);
    3542
     
    6269    void SetErrorRelative(Bool_t b=kTRUE) { fErrorRelative = b; }
    6370
     71    void RecursiveRemove(TObject *obj);
     72
    6473    ClassDef(MHCamEvent, 2) // Histogram to sum camera events
    6574};
  • trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc

    r9309 r9312  
    964964    if (fFormatVersion>6)
    965965        *fLog << "Sampling:     " << fSamplingFrequency << "MHz with " << (int)fFadcResolution << " significant bits" << endl;
    966     *fLog << "Samples:      " << fNumSamplesHiGain << "/" << fNumSamplesLoGain << " (hi/lo) * " << fNumBytesPerSample << "B/sample = " << (fNumSamplesLoGain+fNumSamplesHiGain) * fNumCrates * fNumPixInCrate * fNumBytesPerSample/1000 << "kB/Evt" << endl;
     966    *fLog << "Samples:      " << fNumSamplesHiGain << "/" << fNumSamplesLoGain << " (hi/lo) * " << fNumBytesPerSample << "B/sample = ";
     967    if (fNumCrates>0)
     968        *fLog << (fNumSamplesLoGain+fNumSamplesHiGain) * fNumCrates * fNumPixInCrate * fNumBytesPerSample/1000 << "kB/Evt" << endl;
     969    else
     970        *fLog << (fNumSamplesLoGain+fNumSamplesHiGain) * fNumBytesPerSample << "B/pix" << endl;
    967971    *fLog << "Evt Counter:  " << fNumEvents;
    968972    if (fFormatVersion>8)
  • trunk/MagicSoft/Mars/msignal/MSignalCalc.cc

    r9261 r9312  
    128128{
    129129    if (!fPedestals)
    130         return kFALSE;
     130        return kTRUE;
    131131
    132132    const Int_t npix = fRawEvt->GetNumPixels();
  • trunk/MagicSoft/Mars/msimreflector/MMirror.cc

    r9243 r9312  
    7878#include <TRandom.h>
    7979
     80#include "MLog.h"
     81
    8082#include "MQuaternion.h"
    8183
     
    133135    return dn;  // Return the vector to be added to the normal vector
    134136}
     137
     138void MMirror::Print(Option_t *o) const
     139{
     140    gLog << fPos.X()  << " " << fPos.Y()  << " " << fPos.Z() << " ";
     141    gLog << fNorm.X() << " " << fNorm.Y() << " " << fNorm.Z() << " ";
     142    gLog << fFocalLength << " ";
     143
     144    const TString n = ClassName();
     145
     146    gLog << n(7, n.Length());
     147}
  • trunk/MagicSoft/Mars/msimreflector/MMirror.h

    r9236 r9312  
    7070    // ----- Mirror specialized functions -----
    7171
    72     // This should fit with Paint()
    7372    virtual Bool_t HasHit(const MQuaternion &p) const=0;
    74     // This should fit with HasHit()
    75     //void Paint(Option_t *)=0;
    7673    virtual Bool_t CanHit(const MQuaternion &p) const=0;
    7774
    7875    virtual Int_t ReadM(const TObjArray &tok)=0;
     76
     77    // TObject
     78    void Print(Option_t *o) const;
    7979
    8080    /*
     
    8686    }
    8787    */
    88     ClassDef(MMirror, 0) // Base class to describe a mirror
     88    ClassDef(MMirror, 1) // Base class to describe a mirror
    8989};
    9090
  • trunk/MagicSoft/Mars/msimreflector/MMirrorDisk.cc

    r9252 r9312  
    3838#include <TEllipse.h>
    3939#include <TVirtualPad.h>
     40
     41#include "MLog.h"
    4042
    4143#include "MQuaternion.h"
     
    99101// ------------------------------------------------------------------------
    100102//
     103// Print the contents of the mirror
     104//
     105void MMirrorDisk::Print(Option_t *o) const
     106{
     107    MMirror::Print(o);
     108    gLog << " " << fR << endl;
     109}
     110
     111// ------------------------------------------------------------------------
     112//
    101113// Paint the mirror in x/y.
    102114//
  • trunk/MagicSoft/Mars/msimreflector/MMirrorDisk.h

    r9236 r9312  
    99{
    1010private:
    11     Double_t fR;
     11    Double_t fR; // Radius of the disk
    1212
    1313public:
    1414    MMirrorDisk() : fR(24.75) { }
    1515
     16    // MMirror
    1617    Double_t GetMaxR() const { return fR; }
    1718
    18     // This should fit with Paint()
     19    Bool_t CanHit(const MQuaternion &p) const;
    1920    Bool_t HasHit(const MQuaternion &p) const;
    20     // This should fit with HasHit()
    21     void Paint(Option_t *);
    22     Bool_t CanHit(const MQuaternion &p) const;
     21
    2322    Int_t ReadM(const TObjArray &tok);
    2423
    25     ClassDef(MMirrorDisk, 0)  // A spherical disk type mirror
     24    //TObject
     25    void Paint(Option_t *);
     26    void Print(Option_t *) const;
     27
     28    ClassDef(MMirrorDisk, 1)  // A spherical disk type mirror
    2629};
    2730
  • trunk/MagicSoft/Mars/msimreflector/MMirrorHex.cc

    r9252 r9312  
    3939#include <TEllipse.h>
    4040#include <TVirtualPad.h>
     41
     42#include "MLog.h"
    4143
    4244#include "MHexagon.h"
     
    142144// ------------------------------------------------------------------------
    143145//
     146// Print the contents of the mirror
     147//
     148void MMirrorHex::Print(Option_t *o) const
     149{
     150    MMirror::Print(o);
     151    gLog << " " << fD*2 << endl;
     152}
     153
     154// ------------------------------------------------------------------------
     155//
    144156// Read the mirror's setup from a file. The first eight tokens should be
    145157// ignored. (This could be fixed!)
  • trunk/MagicSoft/Mars/msimreflector/MMirrorHex.h

    r9236 r9312  
    2121    MMirrorHex() { SetD(24.75); }
    2222
     23    // MMirror
    2324    Double_t GetMaxR() const { return fMaxR; }
    2425
    25     // This should fit with Paint()
     26    Bool_t CanHit(const MQuaternion &p) const;
    2627    Bool_t HasHit(const MQuaternion &p) const;
    27     // This should fit with HasHit()
    28     void Paint(Option_t *);
    29     Bool_t CanHit(const MQuaternion &p) const;
     28
    3029    Int_t ReadM(const TObjArray &tok);
    3130
    32     ClassDef(MMirrorHex, 0) // A spherical hexagon type mirror
     31    // TObject
     32    void Paint(Option_t *);
     33    void Print(Option_t *) const;
     34
     35    ClassDef(MMirrorHex, 1) // A spherical hexagon type mirror
    3336};
    3437
  • trunk/MagicSoft/Mars/msimreflector/MMirrorSquare.cc

    r9252 r9312  
    4040#include <TEllipse.h>
    4141#include <TVirtualPad.h>
     42
     43#include "MLog.h"
    4244
    4345#include "MQuaternion.h"
     
    139141// ------------------------------------------------------------------------
    140142//
     143// Print the contents of the mirror
     144//
     145void MMirrorSquare::Print(Option_t *o) const
     146{
     147    MMirror::Print(o);
     148    gLog << " " << fSideLength << endl;
     149}
     150
     151// ------------------------------------------------------------------------
     152//
    141153// Read the mirror's setup from a file. The first eight tokens should be
    142154// ignored. (This could be fixed!)
  • trunk/MagicSoft/Mars/msimreflector/MMirrorSquare.h

    r9252 r9312  
    1010private:
    1111    Double_t fSideLength; // HALF of the side length!
     12
    1213public:
    1314    MMirrorSquare() : fSideLength(24.75) { }
    1415
     16    // MMirror
    1517    Double_t GetMaxR() const;
    1618
    17     // This should fit with Paint()
    1819    Bool_t HasHit(const MQuaternion &p) const;
    19     // This should fit with HasHit()
    20     void Paint(Option_t *);
    2120    Bool_t CanHit(const MQuaternion &p) const;
     21
    2222    Int_t ReadM(const TObjArray &tok);
    2323
    24     ClassDef(MMirrorSquare, 0) // A spherical square type mirror
     24    // TObject
     25    void Paint(Option_t *);
     26    void Print(Option_t *) const;
     27
     28    ClassDef(MMirrorSquare, 1) // A spherical square type mirror
    2529};
    2630
  • trunk/MagicSoft/Mars/msimreflector/MReflector.h

    r9262 r9312  
    2828    void InitMaxR();
    2929
     30    // MParContainer
    3031    Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
    3132
     
    4647    Int_t ExecuteReflector(MQuaternion &p, MQuaternion &u) const;
    4748
     49    // TObject
    4850    void Paint(Option_t *o);
     51    void Print(Option_t *o) const;
    4952
    50     ClassDef(MReflector, 0) // Parameter container storing a collection of several mirrors (reflector)
     53    ClassDef(MReflector, 1) // Parameter container storing a collection of several mirrors (reflector)
    5154};
    5255   
  • trunk/MagicSoft/Mars/msimreflector/MSimReflector.cc

    r9307 r9312  
    559559    fEvt->Sort(kTRUE);
    560560
     561    // FIXME FIXME FIXME: Set maxindex, first and last time.
     562    // SetMaxIndex(fReflector->GetNumMirrors()-1)
     563    // if (fEvt->GetNumPhotons())
     564    // {
     565    //    SetTime(fEvt->GetFirst()->GetTime(), fEvt->GetLast()->GetTime());
     566    // }
     567
    561568    return kTRUE;
    562569}
  • trunk/MagicSoft/Mars/mtools/MagicJam.cc

    r9235 r9312  
    7777#include <TGFileDialog.h>
    7878
     79#include "MH.h"
    7980#include "MHexagon.h"
    8081#include "MGeomCam.h"
     
    365366    if (fImage)
    366367    {
    367         SetRange();
     368        const Float_t r = fGeomCam->GetMaxRadius();
     369
     370        MH::SetPadRange(-r*1.02, -r*1.02, TestBit(kNoLegend) ? r : 1.15*r, r*1.2);
    368371
    369372        Double_t x1, y1, x2, y2;
     
    732735        cam[i].SetNeighbors(nn[0], nn[1], nn[2], nn[3], nn[4], nn[5]);
    733736    }
     737
     738    cam.InitGeometry();
    734739
    735740    SetGeometry(cam);
     
    856861        o->Draw();
    857862        gPad->SetBit(kCannotPick);
    858         gPad->GetPad(1)->SetBit(kCannotPick);
    859863    }
    860864
  • trunk/MagicSoft/include-Classes/MMcFormat/MMcCorsikaRunHeader.h

    r8758 r9312  
    109109                Int_t CTnum);
    110110
     111    void SetSpectrum(Float_t slope, Float_t emin, Float_t emax)
     112    {
     113        fSlopeSpec=slope; fELowLim=emin; fEUppLim=emax;
     114    }
     115
    111116    MGeomCorsikaCT &operator[](Int_t i) const;
    112117
  • trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.hxx

    r8438 r9312  
    109109    void SetCoreY(Float_t CoreY) { fCoreY=CoreY; }                //Set Core y pos
    110110
     111    void SetEvtNumber(UInt_t n) { fEvtNumber=n; }
     112    void SetPhotElfromShower(UInt_t n) { fPhotElfromShower=n; }
     113
    111114    void Fill( UInt_t, ParticleId_t, Float_t, Float_t, Float_t,
    112115               Float_t, Float_t, Float_t, Float_t, Float_t, Float_t,
  • trunk/MagicSoft/include-Classes/MMcFormat/MMcEvtBasic.cc

    r7094 r9312  
    8989// --------------------------------------------------------------------------
    9090//
     91// Copy operator. Copy all data members
     92//
     93void MMcEvtBasic::operator=(const MMcEvtBasic &evt)
     94{
     95    fPartId         = evt.fPartId;
     96    fEnergy         = evt.fEnergy;
     97    fImpact         = evt.fImpact;
     98    fTelescopePhi   = evt.fTelescopePhi;
     99    fTelescopeTheta = evt.fTelescopeTheta;
     100}
     101
     102// --------------------------------------------------------------------------
     103//
    91104//  Reset all values: Fill(kUNDEFINED, -1, -1, 0, 0)
    92105//
  • trunk/MagicSoft/include-Classes/MMcFormat/MMcEvtBasic.h

    r9272 r9312  
    55#include "MParContainer.h"
    66#endif
    7 
    87
    98class MMcEvtBasic : public MParContainer
     
    4140  MMcEvtBasic();
    4241  MMcEvtBasic(ParticleId_t, Float_t, Float_t, Float_t, Float_t);
     42  void operator=(const MMcEvtBasic &evt);
    4343
    4444  // Getter
  • trunk/MagicSoft/include-Classes/MMcFormat/MMcRunHeader.cxx

    r8066 r9312  
    138138    fSlopeSpec = 0.0;
    139139
    140     fCorsikaVersion = 0;
    141     fReflVersion = 0;
    142     fCamVersion = 0;
     140    fCorsikaVersion = UShort_t(-1);
     141    fReflVersion    = UShort_t(-1);
     142    fCamVersion     = UShort_t(-1);
     143
    143144    fOpticLinksNoise= 0;
    144145
  • trunk/MagicSoft/include-Classes/MMcFormat/MMcRunHeader.hxx

    r7880 r9312  
    66#endif
    77
     8// -------------------------------------------------------------
     9//
     10//  The following data member are in use:
     11//
     12//    fCorsikaVersion        MHCollectionArea
     13//    fReflVersion           MSrcPosCalc
     14//    fCamVersion            MMcCalibrationUpdate, MReadMarsFile,
     15//                           MMcPedestalCopy, MMcPedestalNSBAdd
     16//    fStarField*            MMcBadPixelSet
     17//    fImpactMax             MHCollectionArea
     18//    fNumSimulatedShowers   MHCollectionArea
     19//    [fAllEvtsTriggered]    MHCollectionArea
     20//    fNumPheFromDNSB        MMcPedestalNSBAdd
     21//
     22// -------------------------------------------------------------
    823
    924class MMcRunHeader : public MParContainer
     
    146161  Float_t GetImpactMax() const            {return fImpactMax;}
    147162
     163  void SetNumSimulatedShowers(UInt_t n) { fNumSimulatedShowers=n; }
     164  void SetImpactMax(Float_t im) { fImpactMax=im; }
     165
    148166  ClassDef(MMcRunHeader, 7)     // storage container for general run info
    149167};
Note: See TracChangeset for help on using the changeset viewer.