Changeset 7178 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
07/08/05 18:14:35 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r7177 r7178  
    5252   * mimage/MHillasCalc.cc:
    5353     - skipped printing the removed case 4 from MHillas::Calc
     54
     55   * mbase/MStatusDisplay.cc:
     56     - fixed wrong "save as" in "open" dialog
     57
     58   * mbase/MTaskInteractive.[h,cc]:
     59     - added ReInit
     60
     61   * mhflux/MAlphaFitter.cc:
     62     - fixed the standard polynom order (0 instead of 1) for
     63       difference histogram
     64     - changed default start velue for gauss sigma in case of kThetaSq
     65
     66   * mhflux/MHAlpha.cc, mhflux/MHCollectionArea.cc,
     67     mhflux/MHEffectiveOnTime.cc, mhflux/MHThetaSq.cc,
     68     mjobs/MJCut.cc:
     69     - enhanced zenith angle range
     70
     71   * mhflux/MHFalseSource.h:
     72     - made GetCatalog protected
     73     - made SetOffData virtual
     74
     75   * mhflux/MHThreshold.cc:
     76     - enabled Sumw2
     77
     78   * mjobs/MJCut.cc:
     79     - removed BinningEnergyEst
     80
     81   * mpointing/MPointingPos.h:
     82     - added copy constructor
     83
     84   * mpointing/MSrcPosCorrect.cc:
     85     - added a comment
     86
     87   * mranforest/MRFEnergyEst.[h,cc]:
     88     - now stores the mean energy of the bins in the forest
     89     - implemented several interpolation methods
    5490
    5591
  • trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc

    r7092 r7178  
    28962896    fi.fIniDir    = StrDup(dir);
    28972897
    2898     new TGFileDialog(fClient->GetRoot(), this, kFDSave, &fi);
     2898    new TGFileDialog(fClient->GetRoot(), this, kFDOpen, &fi);
    28992899
    29002900    if (!fi.fFilename)
  • trunk/MagicSoft/Mars/mbase/MTaskInteractive.cc

    r4513 r7178  
    8383    fCall[1] = 0;
    8484    fCall[2] = 0;
     85    fCall[3] = 0;
    8586}
    8687
     
    9495    Free(1);
    9596    Free(2);
     97    Free(3);
    9698}
    9799
     
    141143    {
    142144    case 0:
    143         gLog << "Pre";
     145        gLog << "PreProcess";
     146        break;
     147    case 1:
     148        gLog << "Process";
    144149        break;
    145150    case 2:
    146         gLog << "Post";
     151        gLog << "PostProcess";
     152        break;
     153    case 3:
     154        gLog << "ReInit";
    147155        break;
    148156
    149157    }
    150     gLog << "Process-function." << endl;
     158    gLog << "-function." << endl;
    151159
    152160    return kTRUE;
  • trunk/MagicSoft/Mars/mbase/MTaskInteractive.h

    r4452 r7178  
    1212{
    1313private:
    14     TMethodCall *fCall[3];
     14    TMethodCall *fCall[4];
    1515
    16     Int_t (*fPreProcess)(MParList *list);
    17     Int_t (*fProcess)();
    18     Int_t (*fPostProcess)();
     16    Int_t  (*fPreProcess)(MParList *list);
     17    Int_t  (*fProcess)();
     18    Int_t  (*fPostProcess)();
     19    Bool_t (*fReInit)(MParList *list);
    1920
    20     Int_t PreProcess(MParList *list) { if (fCall[0]) return Return(0, &list); return fPreProcess  ? (*fPreProcess)(list) : kTRUE; }
    21     Int_t Process()                  { if (fCall[1]) return Return(1);        return fProcess     ? (*fProcess)()        : kTRUE; }
    22     Int_t PostProcess()              { if (fCall[2]) return Return(2);        return fPostProcess ? (*fPostProcess)()    : kTRUE; }
     21    Int_t  PreProcess(MParList *list) { if (fCall[0]) return Return(0, &list); return fPreProcess  ? (*fPreProcess)(list) : kTRUE; }
     22    Int_t  Process()                  { if (fCall[1]) return Return(1);        return fProcess     ? (*fProcess)()        : kTRUE; }
     23    Int_t  PostProcess()              { if (fCall[2]) return Return(2);        return fPostProcess ? (*fPostProcess)()    : kTRUE; }
     24    Bool_t ReInit(MParList *list)     { if (fCall[3]) return Return(3, &list); return fPostProcess ? (*fPostProcess)()    : kTRUE; }
    2325
    2426    Int_t Return(Int_t no, void *param=NULL);
     
    3234    // This is to be used in compiled code
    3335    void SetPreProcess(Int_t (*func)(MParList *list)) { fPreProcess = func;  Free(0); }
    34     void SetProcess(Int_t (*func)())                  { fProcess = func;     Free(1);  }
    35     void SetPostProcess(Int_t (*func)())              { fPostProcess = func; Free(2);  }
     36    void SetProcess(Int_t (*func)())                  { fProcess = func;     Free(1); }
     37    void SetPostProcess(Int_t (*func)())              { fPostProcess = func; Free(2); }
     38    void SetReInit(Bool_t (*func)(MParList *list))    { fReInit = func;      Free(3); }
    3639
    3740    // This is for usage in CINT
     
    3942    void SetProcess(void *fcn)     { Set(fcn, 1, "");          fProcess    =0; }
    4043    void SetPostProcess(void *fcn) { Set(fcn, 2, "");          fPostProcess=0; }
     44    void SetReInit(void *fcn)      { Set(fcn, 3, "MParList*"); fReInit     =0; }
    4145
    4246    ClassDef(MTaskInteractive, 0) // Interactive task
  • trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc

    r7169 r7178  
    178178    // Now fit a gaus in the on region on top of the polynom
    179179    fFunc->SetParameter(0, A);
    180     fFunc->SetParameter(2, sigmax*0.75);
     180    fFunc->SetParameter(2, fSignalFunc==kGauss ? sigmax*0.75 : sigmax);
    181181
    182182    // options : N  do not store the function, do not draw
     
    231231
    232232    MAlphaFitter fit(*this);
    233     fit.SetPolynomOrder(1);
     233    fit.SetPolynomOrder(0);
    234234
    235235    if (alpha<=0 || !fit.Fit(h, paint))
  • trunk/MagicSoft/Mars/mhflux/MHAlpha.cc

    r7151 r7178  
    139139    binsa.SetEdges(18, 0, 90);
    140140    binse.SetEdgesLog(15, 10, 100000);
    141     binst.SetEdgesASin(51, -0.005, 0.505);
     141    binst.SetEdgesASin(67, -0.005, 0.665);
    142142    binse.Apply(fHEnergy);
    143143    binst.Apply(fHTheta);
  • trunk/MagicSoft/Mars/mhflux/MHCollectionArea.cc

    r7170 r7178  
    9494    MBinning binsa, binse, binst;
    9595    binse.SetEdgesLog(15, 10, 1000000);
    96     binst.SetEdgesASin(51, -0.005, 0.505);
     96    binst.SetEdgesASin(67, -0.005, 0.665);
    9797
    9898    binse.Apply(fHEnergy);
  • trunk/MagicSoft/Mars/mhflux/MHEffectiveOnTime.cc

    r7142 r7178  
    410410    // setup binning
    411411    MBinning btheta("BinningTheta");
    412     btheta.SetEdgesASin(51, -0.005, 0.505);
     412    btheta.SetEdgesASin(67, -0.005, 0.665);
    413413
    414414    MBinning btime("BinningDeltaT");
  • trunk/MagicSoft/Mars/mhflux/MHFalseSource.h

    r7109 r7178  
    4646    Double_t fDec;
    4747
     48    TObject *GetCatalog();
     49
    4850private:
    4951    Int_t DistancetoPrimitive(Int_t px, Int_t py);
     
    5456    void ProjectOn(const TH3D &src, TH2D *h, TH2D *all);
    5557    void ProjectOnOff(TH2D *h, TH2D *all);
    56 
    57     TObject *GetCatalog();
    5858
    5959    void MakeSymmetric(TH1 *h);
     
    7878    void SetBgMeanMinus5() { SetBgMean(fBgMean-5); } //*MENU*
    7979
    80     void SetOffData(const MHFalseSource &fs) {
     80    virtual void SetOffData(const MHFalseSource &fs) {
    8181        fHistOff  = &fs.fHist;
    8282        fMinDist  =  fs.fMinDist;
  • trunk/MagicSoft/Mars/mhflux/MHThetaSq.cc

    r7147 r7178  
    9292    //binsa.SetEdges(arr);
    9393    binse.SetEdgesLog(15, 10, 100000);
    94     binst.SetEdgesCos(50, 0, 60);
     94    binst.SetEdgesASin(67, -0.005, 0.665);
    9595    binsa.Apply(fHistTime);
    9696
  • trunk/MagicSoft/Mars/mhflux/MHThreshold.cc

    r7170 r7178  
    7474    fHEnergy.SetDirectory(NULL);
    7575    fHEnergy.UseCurrentStyle();
     76    fHEnergy.Sumw2();
    7677
    7778    MBinning binse(80, 10, 1000000, "", "log");
  • trunk/MagicSoft/Mars/mjobs/MJCut.cc

    r7169 r7178  
    445445
    446446    // Initialize default binnings
    447     MBinning bins1(18,  0,     90,    "BinningAlpha",     "lin");
    448     MBinning bins2(15, 10,     1e6 ,  "BinningEnergyEst", "log");
    449     MBinning bins3(51, -0.005, 0.505, "BinningTheta",    "asin");
     447    MBinning bins1(18,  0,     90,    "BinningAlpha", "lin");
     448    MBinning bins2(15, 10,     1e6 ,  "BinningSize", "log");
     449    MBinning bins3(67, -0.005, 0.665, "BinningTheta", "asin");
    450450    MBinning bins4("BinningFalseSource");
    451451    MBinning bins5("BinningWidth");
     
    465465    plist.AddToList(&bins9);
    466466    plist.AddToList(&bins0);
     467    //plist.AddToList(&binsa);
    467468
    468469    // --------------------------------------------------------------------------------
  • trunk/MagicSoft/Mars/mpointing/MPointingPos.h

    r5117 r7178  
    3030        fTitle = title ? title : "Container storing the (corrected) telescope pointing position";
    3131    }
     32    MPointingPos(const MPointingPos &p) : MParContainer(p),
     33        fZd(p.fZd), fAz(p.fAz), fRa(p.fRa), fHa(p.fHa), fDec(p.fDec)
     34    {
     35    }
    3236
    3337    void SetLocalPosition(Double_t zd, Double_t az) { fZd=zd; fAz=az; }
  • trunk/MagicSoft/Mars/mpointing/MSrcPosCorrect.cc

    r7143 r7178  
    135135    if (fRunNumber<56161 && fRunNumber>53832)
    136136    {
     137        // dx=-0.05deg, dy=0.03deg, d=0.06deg
    137138        static const TVector2 dxy(-14.24, -9.495);
    138139        fSrcPosCam->Add(dxy);
  • trunk/MagicSoft/Mars/mranforest/MRFEnergyEst.cc

    r7169 r7178  
    6969//
    7070MRFEnergyEst::MRFEnergyEst(const char *name, const char *title)
    71     : fNumTrees(-1), fNumTry(-1), fNdSize(-1), fDebug(kFALSE),
    72     fData(0), fEnergyEst(0), fTestMatrix(0), fEstimationMode(kMean)
     71    : fDebug(kFALSE), fData(0), fEnergyEst(0),
     72    fNumTrees(-1), fNumTry(-1), fNdSize(-1),
     73    fTestMatrix(0), fEstimationMode(kMean)
    7374{
    7475    fName  = name  ? name  : gsDefName.Data();
    7576    fTitle = title ? title : gsDefTitle.Data();
     77}
     78
     79MRFEnergyEst::~MRFEnergyEst()
     80{
     81    fEForests.Delete();
    7682}
    7783
     
    163169        MHMatrix matrix1(mat1, "MatrixHadrons");
    164170        MHMatrix matrix0(mat0, "MatrixGammas");
    165 
    166         //matrix1.AddColumns(&usedrules);
    167         //matrix0.AddColumns(&usedrules);
    168171
    169172        // training of RF
     
    191194            gLog.SetNullOutput(kFALSE);
    192195
    193         const Double_t E = (log10(grid[ie])+log10(grid[ie+1]))/2;
     196        // Calculate bin center
     197        const Double_t E = (TMath::Log10(grid[ie])+TMath::Log10(grid[ie+1]))/2;
    194198
    195199        // save whole forest
    196200        MRanForest *forest=(MRanForest*)plist.FindObject("MRanForest");
    197         const TString title = Form("%.10f", E);
    198         forest->SetTitle(title);
    199         forest->Write(title);
     201        forest->SetUserVal(E);
     202        forest->Write(Form("%.10f", E));
    200203    }
    201204
     
    203206    usedrules.Write("rules");
    204207
    205     fileRF.Close();
    206 
    207208    return kTRUE;
    208209}
     
    210211Int_t MRFEnergyEst::ReadForests(MParList &plist)
    211212{
    212     TFile fileRF(fFileName,"read");
     213    TFile fileRF(fFileName, "read");
    213214    if (!fileRF.IsOpen())
    214215    {
     
    218219
    219220    fEForests.Delete();
    220 
    221     Int_t i=0;
    222221
    223222    TIter Next(fileRF.GetListOfKeys());
     
    230229            continue;
    231230
    232         forest->SetTitle(o->GetTitle());
    233         forest->SetBit(kCanDelete);
    234 
    235         fBinning.Set(i+1);
    236         fBinning[i++] = atof(o->GetTitle());
     231        forest->SetUserVal(atof(o->GetName()));
    237232
    238233        fEForests.Add(forest);
     
    283278//
    284279//
     280#include <TGraph.h>
     281#include <TF1.h>
    285282Int_t MRFEnergyEst::Process()
    286283{
     284    static TF1 f1("f1", "gaus");
     285
    287286    TVector event;
    288287    if (fTestMatrix)
     
    291290        *fData >> event;
    292291
    293     Double_t eest = 0;
    294     Double_t hsum = 0;
     292    Double_t sume = 0;
     293    Double_t sumh = 0;
    295294    Double_t maxh = 0;
    296295    Double_t maxe = 0;
    297296
    298     Int_t i=0;
     297    Double_t max  = -1e10;
     298    Double_t min  =  1e10;
     299
     300    //TH1C h("", "", fEForests.GetSize(), 0, 1);
    299301
    300302    TIter Next(&fEForests);
    301303    MRanForest *rf = 0;
     304
     305    TGraph g;
    302306    while ((rf=(MRanForest*)Next()))
    303307    {
    304308        const Double_t h = rf->CalcHadroness(event);
    305         const Double_t e = fBinning[i++];
    306 
    307         hsum += h;
    308         eest += e*h;
     309        const Double_t e = rf->GetUserVal();
     310        g.SetPoint(g.GetN(), e, h);
     311        sume += e*h;
     312        sumh += h;
    309313        if (h>maxh)
    310314        {
     
    312316            maxe = e;
    313317        }
     318        if (e>max)
     319            max = e;
     320        if (e<min)
     321            min = e;
    314322    }
    315323
     
    317325    {
    318326    case kMean:
    319         fEnergyEst->SetVal(pow(10, eest/hsum));
     327        fEnergyEst->SetVal(pow(10, sume/sumh));
    320328        break;
    321329    case kMaximum:
    322330        fEnergyEst->SetVal(pow(10, maxe));
    323331        break;
     332    case kFit:
     333        f1.SetParameter(0, maxh);
     334        f1.SetParameter(1, maxe);
     335        f1.SetParameter(2, 0.125);
     336        g.Fit(&f1, "Q0N");
     337        fEnergyEst->SetVal(pow(10, f1.GetParameter(1)));
     338        break;
     339
    324340    }
    325341    fEnergyEst->SetReadyToSave();
     
    353369        if (txt==(TString)"maximum")
    354370            fEstimationMode = kMaximum;
     371        if (txt==(TString)"fit")
     372            fEstimationMode = kFit;
    355373        rc = kTRUE;
    356374    }
  • trunk/MagicSoft/Mars/mranforest/MRFEnergyEst.h

    r7169 r7178  
    2323    {
    2424        kMean,
    25         kMaximum
     25        kMaximum,
     26        kFit
    2627    };
    2728private:
    28     Int_t        fNumTrees;  // Training parameters
    29     Int_t        fNumTry;    // Training parameters
    30     Int_t        fNdSize;    // Training parameters
     29    Bool_t       fDebug;      // Debugging of eventloop while training on/off
    3130
    32     Bool_t       fDebug;     // Debugging of eventloop while training on/off
    33 
    34     TString      fFileName;
    35     TObjArray    fEForests;
     31    TString      fFileName;   // File name to forest
     32    TObjArray    fEForests;   // List of forests
    3633
    3734    MDataArray  *fData;       //! Used to store the MDataChains to get the event values
    3835    MParameterD *fEnergyEst;  //! Used to storeestimated energy
    3936
    40     MHMatrix *fTestMatrix;
     37    Int_t        fNumTrees;   //! Training parameters
     38    Int_t        fNumTry;     //! Training parameters
     39    Int_t        fNdSize;     //! Training parameters
    4140
    42     TArrayD   fBinning;
     41    MHMatrix    *fTestMatrix; //! Test Matrix
    4342
    4443    EstimationMode_t fEstimationMode;
    4544
     45    // MRFEnergyEst
     46    Int_t ReadForests(MParList &plist);
     47
     48    // MTask
    4649    Int_t PreProcess(MParList *plist);
    4750    Int_t Process();
    4851
    49     Int_t ReadForests(MParList &plist);
    50 
     52    // MParContainer
    5153    Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
    5254
    5355public:
    5456    MRFEnergyEst(const char *name=NULL, const char *title=NULL);
     57    ~MRFEnergyEst();
    5558
     59    // Setter for estimation
    5660    void  SetFileName(TString str)     { fFileName = str; }
     61    void  SetEstimationMode(EstimationMode_t op) { fEstimationMode = op; }
    5762
     63    // Setter for training
    5864    void  SetNumTrees(Int_t n=-1)      { fNumTrees = n; }
    5965    void  SetNdSize(Int_t n=-1)        { fNdSize   = n; }
    6066    void  SetNumTry(Int_t n=-1)        { fNumTry   = n; }
     67    void  SetDebug(Bool_t b=kTRUE)     { fDebug = b; }
    6168
     69    // Train Interface
     70    Int_t Train(const MHMatrix &n, const TArrayD &grid);
     71
     72    // Test Interface
    6273    void  SetTestMatrix(MHMatrix *m=0) { fTestMatrix=m; }
    6374    void  InitMapping(MHMatrix *m=0)   { fTestMatrix=m; }
    64 
    65     void  SetDebug(Bool_t b=kTRUE)     { fDebug = b; }
    66 
    67     void  SetEstimationMode(EstimationMode_t op) { fEstimationMode = op; }
    68 
    69     Int_t Train(const MHMatrix &n, const TArrayD &grid);
    7075
    7176    ClassDef(MRFEnergyEst, 0) // Task
Note: See TracChangeset for help on using the changeset viewer.