Changeset 8679 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
08/19/07 22:40:04 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r8677 r8679  
    2525       the ListOfCleanups instead of removing the newly created canvas
    2626       from the global list of canvases
     27
     28   * mimage/MHHillas.cc, mimage/MHHillasExt.cc, mimage/MHHillasSrc.cc,
     29     mimage/MHImagePar.cc, mimage/MHNewImagePar.cc:
     30     - enables a lot of grids
     31
     32   * mhbase/MBinning.[h,cc]:
     33     - addec constructor with a TArrayD
     34
     35   * mhbase/MH.[h,cc]:
     36     - added two new member functions GetRange and GetRangeUser
     37
     38   * mjoptim/MJOptimizeDisp.[h,cc]:
     39     - added new option UseThetaSq
     40
     41   * mjoptim/MJOptimizeEnergy.[h,cc]:
     42     - added possibility to use also logarithmic fits
     43
     44   * mmc/MMcCorsikaRunHeader.cc:
     45     - improved Print function
     46
     47   * msignal/MExtractTimeAndChargeSpline.cc:
     48     - initialize rise and fall time as suggested by valgrind
     49
     50   * mtools/MChisqEval.[h,cc]:
     51     - implemented the possibility to use weights
     52
    2753
    2854
  • trunk/MagicSoft/Mars/NEWS

    r8676 r8679  
    132132      + PostCleanType: 3
    133133
     134   - star/ganymed: The old spark-cuts have been replaced by new ones.
     135     These new spark cuts have been cross checked with the sequences
     136     84720 (before splitter), 101041 (after splitter) and 223539 (new
     137     FADCs). In all cases they seperate pretty well, but of course not
     138     perfect. Monte Carlos have suggested to tighten the cuts a little
     139     bit further at low sizes. This has been done.
     140
     141   - ganymed: IMPORTANT - The spark cuts have been changed to match
     142     all available data more or less well. This might mean that for
     143     YOUR data there are still sparks visible.
     144     Whenever you do an analysis you have to make sure that NO sparks
     145     survive your cuts!
     146
    134147   - ganymed: The old hadronness and size cuts have gotten new indices
    135148     (10, 11). The old indices 8 and 9 now mean an additional condition
     
    188201     paremtrization set parameter 8 to 0.
    189202
    190    - star/ganymed: The old spark-cuts have been replaced by new ones.
    191      These new spark cuts have been cross checked with the sequences
    192      84720 (before splitter), 101041 (after splitter) and 223539 (new
    193      FADCs). In all cases they seperate pretty well, but of course not
    194      perfect. Monte Carlos have suggested to tighten the cuts a little
    195      bit further at low sizes. This has been done.
    196 
    197    - ganymed: IMPORTANT - The spark cuts have been changed to match
    198      all available data more or less well. This might mean that for
    199      YOUR data there are still sparks visible.
    200      Whenever you do an analysis you have to make sure that NO sparks
    201      survive your cuts!
    202 
    203203   - ganymed: The distribution of observation time versus zenith
    204204     angle is now shown for off- AND on-data.
     
    209209     all off-regions from this file. Please do not forget to
    210210     set the scaling in optimwobble.C properly:
    211         fit.SetScaleMode(MAlphaFitter::kNone);
    212211        fit.SetScaleUser(1./3);
    213212     it is not yet read in automatically (will follow soon).
     
    244243     the information is lost.
    245244
    246    - sponde: added a new tab "EventDist" showing the unweighted event
    247      distribution of your sample after cuts. This tells you how many
    248      events with this energy you had in your MC files. The same information
    249      you get from the error bars of the weighted histograms, but this is
    250      less intuitive.
     245   - sponde: added a new tab "EventDist" showing the unweighted real
     246     absolute number of events of your sample after cuts. This tells
     247     you how many events with this energy you had in your MC files.
     248     The same information you get from the error bars of the weighted
     249     histograms, but this is less intuitive.
    251250
    252251
  • trunk/MagicSoft/Mars/mhbase/MBinning.cc

    r8106 r8679  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MBinning.cc,v 1.17 2006-10-17 17:16:00 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MBinning.cc,v 1.18 2007-08-19 21:35:00 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    134134// --------------------------------------------------------------------------
    135135//
     136// Initialize Binning from TArrayD.
     137//
     138MBinning::MBinning(const TArrayD &axis, const char *name, const char *title)
     139{
     140    fName  = name  ? name : gsDefName.Data();
     141    fTitle = title ? title : gsDefTitle.Data();
     142
     143    SetEdges(axis);
     144}
     145
     146// --------------------------------------------------------------------------
     147//
    136148// Search in the parameter list for the binning with name "name". If found,
    137149// set the edges and title accordingly. Default is name of object.
  • trunk/MagicSoft/Mars/mhbase/MBinning.h

    r8398 r8679  
    4343    MBinning(const TH1 &h, const Char_t axis='x', const char *name=0, const char *title=0);
    4444    MBinning(const TAxis &a, const char *name=0, const char *title=0);
     45    MBinning(const TArrayD &a, const char *name=0, const char *title=0);
    4546
    4647    void Copy(TObject &named) const
  • trunk/MagicSoft/Mars/mhbase/MH.cc

    r8657 r8679  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MH.cc,v 1.33 2007-08-06 14:44:13 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MH.cc,v 1.34 2007-08-19 21:36:00 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    2020!   Author(s): Thomas Bretz  07/2001 <mailto:tbretz@astro.uni-wuerzburg.de>
    2121!
    22 !   Copyright: MAGIC Software Development, 2000-2002
     22!   Copyright: MAGIC Software Development, 2000-2007
    2323!
    2424!
     
    14091409// --------------------------------------------------------------------------
    14101410//
     1411// Return the first and last bin of the histogram which is not 0
     1412//
     1413void MH::GetRange(const TH1 &h, Int_t &lo, Int_t &hi)
     1414{
     1415    lo = 0;
     1416    hi = 1;
     1417
     1418    for (int i=2; i<=h.GetNbinsX(); i++)
     1419    {
     1420        if (lo==0 && h.GetBinContent(i)>0)
     1421            lo = i;
     1422
     1423        if (h.GetBinContent(i)>0)
     1424            hi = i;
     1425    }
     1426}
     1427
     1428// --------------------------------------------------------------------------
     1429//
     1430// Return the lower edge of the first and the upper edge of the last bin
     1431// of the histogram which is not 0
     1432//
     1433void MH::GetRangeUser(const TH1 &h, Axis_t &lo, Axis_t &hi)
     1434{
     1435    Int_t f, l;
     1436    GetRange(h, f, l);
     1437
     1438    lo = h.GetBinLowEdge(f);
     1439    hi = h.GetBinLowEdge(l+1);
     1440}
     1441
     1442// --------------------------------------------------------------------------
     1443//
    14111444// See MTask::PrintSkipped
    14121445//
  • trunk/MagicSoft/Mars/mhbase/MH.h

    r8657 r8679  
    119119    static void ProjectionY(TH1D &dest, const TH2 &src, Int_t firstxbin=-1, Int_t lastxbin=9999);
    120120
     121    static void GetRangeUser(const TH1 &hist, Axis_t &lo, Axis_t &hi);
     122    static void GetRange(const TH1 &hist, Int_t &lo, Int_t &hi);
     123
    121124    static TObject *FindObjectInPad(const char *name, TVirtualPad *pad=NULL);
    122125
  • trunk/MagicSoft/Mars/mjoptim/MJOptimizeDisp.cc

    r8671 r8679  
    178178
    179179    MChisqEval eval;
    180     eval.SetY1("sqrt(ThetaSquared.fVal)");
     180    eval.SetY1(fUseThetaSq?"ThetaSquared.fVal":"sqrt(ThetaSquared.fVal)");
     181    if (weights)
     182        eval.SetNameWeight();
    181183
    182184    MMatrixLoop loop(&m);
  • trunk/MagicSoft/Mars/mjoptim/MJOptimizeDisp.h

    r7152 r8679  
    1010class MJOptimizeDisp : public MJOptimize
    1111{
     12private:
     13    Bool_t fUseThetaSq;
     14
    1215public:
    13     MJOptimizeDisp() : MJOptimize() { }
     16    MJOptimizeDisp() : MJOptimize(), fUseThetaSq(kFALSE) { }
     17
     18    void EnableThetaSq(Bool_t b=kTRUE) { fUseThetaSq=b; }
    1419
    1520    // Special optimizing routines
  • trunk/MagicSoft/Mars/mjoptim/MJOptimizeEnergy.cc

    r8671 r8679  
    6666// histograms
    6767#include "../mhflux/MHEnergyEst.h"
     68#include "../mtools/MChisqEval.h"
    6869
    6970// tasks
     
    108109    MHMatrix m("M");
    109110    AddRulesToMatrix(m);
     111    const Int_t map = m.AddColumn("MMcEvt.fEnergy");
    110112    parlist.AddToList(&m);
    111113
     
    136138        fill.SetWeight();
    137139
     140    MChisqEval eval;
     141    eval.SetY1(fOptimLog?Form("log10(MEnergyEst.fVal/M[%d])", map):Form("MEnergyEst.fVal-M[%d]", map));
     142    if (weights)
     143        eval.SetNameWeight();
     144
    138145    MMatrixLoop loop(&m);
    139146
     
    143150        tasklist.AddToList(weights);
    144151    tasklist.AddToList(&fill);
     152    tasklist.AddToList(&eval);
    145153
    146154    // Optimize with the tasklist in this parameterlist
  • trunk/MagicSoft/Mars/mjoptim/MJOptimizeEnergy.h

    r7152 r8679  
    1010class MJOptimizeEnergy : public MJOptimize
    1111{
     12private:
     13    Bool_t fOptimLog;
     14
    1215public:
    13     MJOptimizeEnergy() : MJOptimize() { }
     16    MJOptimizeEnergy() : MJOptimize(), fOptimLog(kFALSE) { }
     17
     18    void EnableOptimLog(Bool_t b=kTRUE) { fOptimLog=b; }
    1419
    1520    // Special optimizing routines
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSpline.cc

    r8478 r8679  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndChargeSpline.cc,v 1.68 2007-05-09 12:15:53 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndChargeSpline.cc,v 1.69 2007-08-19 21:40:03 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    179179//
    180180MExtractTimeAndChargeSpline::MExtractTimeAndChargeSpline(const char *name, const char *title)
    181     : fHeightTm(0.5), fExtractionType(MExtralgoSpline::kIntegralRel)
     181    : fRiseTimeHiGain(0), fFallTimeHiGain(0), fHeightTm(0.5), fExtractionType(MExtralgoSpline::kIntegralRel)
    182182{
    183183
  • trunk/MagicSoft/Mars/mtools/MChisqEval.cc

    r8074 r8679  
    4949const TString MChisqEval::gsDefTitle = "Evaluate a chisq";
    5050
    51 MChisqEval::MChisqEval(const char *name, const char *title) : fData0(NULL), fData1(NULL), fNameResult("MinimizationValue")
     51MChisqEval::MChisqEval(const char *name, const char *title)
     52    : fData0(NULL), fData1(NULL), fWeight(NULL), fNameResult("MinimizationValue")
    5253{
    5354    fName  = name  ? name  : gsDefName.Data();
     
    5556}
    5657
    57 MChisqEval::MChisqEval(MData *y1, const char *name, const char *title) : fData0(NULL), fData1(NULL), fNameResult("MinimizationValue")
     58MChisqEval::MChisqEval(MData *y1, const char *name, const char *title)
     59: fData0(NULL), fData1(NULL), fWeight(NULL), fNameResult("MinimizationValue")
    5860{
    5961    fName  = name  ? name  : gsDefName.Data();
     
    6264}
    6365
    64 MChisqEval::MChisqEval(MData *y1, MData *y2, const char *name, const char *title) : fData0(NULL), fData1(NULL), fNameResult("MinimizationValue")
     66MChisqEval::MChisqEval(MData *y1, MData *y2, const char *name, const char *title)
     67: fData0(NULL), fData1(NULL), fWeight(NULL), fNameResult("MinimizationValue")
    6568{
    6669    fName  = name  ? name  : gsDefName.Data();
     
    112115{
    113116    fChisq = 0;
     117    fSumW  = 0;
    114118
    115119    if (!fData0)
     
    122126        if (!fData1->PreProcess(plist))
    123127            return kFALSE;
     128
     129    if (!fNameWeight.IsNull())
     130    {
     131        fWeight = (MParameterD*)plist->FindObject(fNameWeight, "MParameterD");
     132        if (!fWeight)
     133            return kFALSE;
     134    }
    124135
    125136    fResult = (MParameterD*)plist->FindCreateObj("MParameterD", fNameResult);
     
    138149    const Double_t err = fData1 ? y1*y2 : 1;
    139150
    140     fChisq += dy*dy/err;
     151    const Double_t w   = fWeight ? fWeight->GetVal() : 1;
     152
     153    fChisq += w*dy*dy/err;
     154    fSumW  += w;
     155
    141156    return kTRUE;
    142157}
     
    145160{
    146161    if (GetNumExecutions()>0)
    147         fChisq /= GetNumExecutions();
     162        fChisq /= fSumW;
    148163
    149164    fResult->SetVal(fChisq);
  • trunk/MagicSoft/Mars/mtools/MChisqEval.h

    r7804 r8679  
    1515    static const TString gsDefTitle;
    1616
    17     Double_t     fChisq;  //! Evaluated chi square
    18     MParameterD *fResult; //! Storage for result
    19 
    2017    MData   *fData0; // Data Member one (monte carlo data or chisq function)
    2118    MData   *fData1; // Data Member two (measured data)
    2219
     20    MParameterD *fWeight;  //! Storage for weight
     21    MParameterD *fResult;  //! Storage for result
     22
    2323    TString fNameResult;
     24    TString fNameWeight;
     25
     26    Double_t     fChisq;   //! Evaluated chi square
     27    Double_t     fSumW;    //! Sum of weights
    2428
    2529    void StreamPrimitive(ostream &out) const;
     
    4347
    4448    void SetOwner(Bool_t o=kTRUE) { o ? SetBit(kIsOwner) : ResetBit(kIsOwner); }
     49    void SetNameWeight(TString w="MWeight") { fNameWeight=w; }
    4550
    4651    Double_t GetChisq() const { return fChisq; }
Note: See TracChangeset for help on using the changeset viewer.