Changeset 3574 for trunk/MagicSoft


Ignore:
Timestamp:
03/22/04 14:49:21 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3573 r3574  
    124124     - added support for new condition type
    125125     - adapted Print and GetRule
     126
     127   * mimage/MNewImagePar.[h,cc]:
     128     - added some comments
    126129
    127130
  • trunk/MagicSoft/Mars/NEWS

    r3573 r3574  
    33 
    44   - added support in MF for expressiond like
    5      "MHillas.fWidth<2*MHillas.fLength"
     5     "MHillas.fWidth<2*<MHillas.fLength"
    66
    77   - MDataChain is now able to support variables like [0], [1], ...
  • trunk/MagicSoft/Mars/mbase/MParContainer.cc

    r3183 r3574  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
     18!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2002
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
     
    2424
    2525//////////////////////////////////////////////////////////////////////////////
    26 //                                                                          //
    27 // MParContainer                                                            //
    28 //                                                                          //
    29 // The MParContainer class is the base class for all MARS parameter         //
    30 // containers. At the moment it is almost the same than ROOT's TNamed.      //
    31 // A TNamed contains the essential elements (name, title)                   //
    32 // to identify a derived object in lists like our MParList or MTaskList.    //
    33 // The main difference is that the name and title isn't stored and read     //
    34 // to and from root files ("//!")                                           //
    35 //                                                                          //
     26//
     27// MParContainer
     28//
     29// The MParContainer class is the base class for all MARS parameter
     30// containers. At the moment it is almost the same than ROOT's TNamed.
     31// A TNamed contains the essential elements (name, title)
     32// to identify a derived object in lists like our MParList or MTaskList.
     33// The main difference is that the name and title isn't stored and read
     34// to and from root files ("//!")
     35//
     36// MParContainer has several enhancements compared to TNamed:
     37//  - GetDescriptor():        returns name and class type
     38//  - GetUniqueName():        returns a unique name (used in StreamPrimitive)
     39//  - SetLogStream(MLog *lg): Set a logging stream to which loggingis stored
     40//  - Reset():                Reset content of class in an eventloop
     41//  - IsReadyToSave():        The contents are ready to be saved to a file
     42//  - IsSavedAsPrimitive():   A unique name for this instance is already
     43//                            existing
     44//  - SetVariables():         Can be overloaded if the containers stores
     45//                            coefficients (to be used in fits)
     46//  - SetDisplay():           Set a display for redirecting graphical output
     47//  - GetNames():             Get Name/Title from instance and store it in
     48//                            a TObjArray (used to store the names of the
     49//                            conteiners in a file
     50//  - SetNames():             vice versa
     51//  - ReadEnv(), WriteEnv():  Function which is used for automatical setup
     52//    IsEnvDefined()          from a TEnv file
     53//
    3654//////////////////////////////////////////////////////////////////////////////
    3755#include "MParContainer.h"
  • trunk/MagicSoft/Mars/mbase/MParContainer.h

    r3183 r3574  
    2525
    2626class TEnv;
     27class TArrayD;
    2728class TDataMember;
    2829class TMethodCall;
     
    8384    virtual Bool_t        IsSortable() const    { return kTRUE; }
    8485
    85     virtual void        SetName(const char *name); // *MENU*
    86     virtual void        SetObject(const char *name, const char *title);
    87     virtual void        SetTitle(const char *title=""); // *MENU*
    88     virtual void        ls(Option_t *option="") const;
    89     virtual void        Print(Option_t *option="") const;
    90     virtual Int_t       Sizeof() const;
    91     virtual void        SavePrimitive(ofstream &out, Option_t *o="");
     86    virtual void   SetName(const char *name); // *MENU*
     87    virtual void   SetObject(const char *name, const char *title);
     88    virtual void   SetTitle(const char *title=""); // *MENU*
     89    virtual void   ls(Option_t *option="") const;
     90    virtual void   Print(Option_t *option="") const;
     91    virtual Int_t  Sizeof() const;
     92    virtual void   SavePrimitive(ofstream &out, Option_t *o="");
    9293
    9394    virtual MParContainer *New() const;
     
    99100    virtual void   EnableGraphicalOutput(Bool_t flag=kTRUE) { flag ? SetBit(kEnableGraphicalOutput) : ResetBit(kEnableGraphicalOutput);}
    100101    virtual Bool_t IsGraphicalOutputEnabled() const  { return TestBit(kEnableGraphicalOutput); }
     102    virtual void   SetVariables(const TArrayD &)     { AbstractMethod("SetVariables(const TArrayD&)"); }
    101103
    102104    virtual void SetDisplay(MStatusDisplay *d) { fDisplay = d; }
  • trunk/MagicSoft/Mars/mhist/MHFalseSource.cc

    r3568 r3574  
    625625    gPad->cd();
    626626}
    627 /*
    628 Double_t fcn(Double_t *arg, Double_t *p)
    629 {
    630     const Double_t x = arg[0];
    631 
    632     const Double_t dx = (x-p[1])/p[2];
    633 
    634     const Double_t f1 = p[0]*TMath::Exp(-0.5*dx*dx);
    635     const Double_t f2 = p[3] + p[5]*x*x;
    636 
    637     return f1 + f2;
    638 }
    639 
    640 Double_t FcnI1(Double_t x, Double_t *p)
    641 {
    642     return (p[5]*x*x/3+p[3])*x;
    643 }
    644 Double_t FcnI2(Double_t x, Double_t *p)
    645 {
    646     static const Double_t sqrt2   = TMath::Sqrt(2.);
    647     static const Double_t sqrt2pi = TMath::Sqrt(TMath::TwoPi());
    648 
    649     const Double_t dx = (x-p[1])/p[2];
    650 
    651     const Double_t f2 = p[0]*p[2]*sqrt2pi*TMath::Erf(dx/sqrt2)/2;
    652 
    653     return f2;
    654 }
    655 */
    656 /*
    657 class MHSignificance : public MH
    658 {
    659 private:
    660     TH1D fHist;
    661 
    662     MParameterD *fParam;
    663 
    664 public:
    665     MHSignificance() : fParam(0)
    666     {
    667         fHist.SetName("Alpha");
    668         fHist.SetTitle("Distribution of \\alpha");
    669         fHist.SetXTitle("\\alpha [\\circ]");
    670         fHist.SetYTitle("Counts");
    671     }
    672     Int_t SetupFill(MParList *p)
    673     {
    674         fHist.Reset();
    675 
    676         fParam = (MParameterD*)p->FindCreateObj("Significance", "MParameterD");
    677         if (fParam)
    678             return kFALSE;
    679 
    680         return kTRUE;
    681     }
    682     Int_t Process(MParContainer *p, Double_t w=1)
    683     {
    684         MHillasSrc *hil = dynamic_cast<MHillasSrc*>(p);
    685         if (!hil)
    686         {
    687             *fLog << err << dbginf << "Got no MHillasSrc as argument of Fill()..." << endl;
    688             return kFALSE;
    689         }
    690 
    691         fHist->Fill(hil->GetAlpha(), w);
    692 
    693         return kTRUE;
    694     }
    695     Int_t Finalize()
    696     {
    697         if (fHist.GetEntries()==0)
    698         {
    699             *fLog << err << "Histogram empty." << endl;
    700             return kFALSE;
    701         }
    702 
    703         Float_t sigmax=15;
    704         Float_t bgmin =45;
    705         Float_t bgmax =80;
    706 
    707         fHist.SetNameTitle("Significance",
    708                            Form("Fit Region: Signal<%.1f\\circ, %.1f\\circ<Bg<%.1f\\circ",
    709                                 sigmax, bgmin, bgmax));
    710 
    711         // Implementing the function yourself is not faster at all!
    712         TF1 func("gaus(0) + pol2(3)", fcn, 0, 90, 6);
    713         TArrayD maxpar(func.GetNpar());
    714 
    715         func.FixParameter(1, 0);
    716         func.FixParameter(4, 0);
    717         func.SetParLimits(3, -1, 1);
    718 
    719         const Double_t alpha0 = fHist.GetBinContent(1);
    720 
    721         // First fit a polynom in the off region
    722         func.FixParameter(0, 0);
    723         func.FixParameter(2, 1);
    724         func.ReleaseParameter(3);
    725         func.ReleaseParameter(5);
    726 
    727         h->Fit(&func, "N0Q", "", bgmin, bgmax);
    728 
    729         // Now fit a gaus in the on region on top of the polynom
    730         func.SetParameter(0, alpha0-func.GetParameter(4));
    731         func.SetParameter(2, sigmax*0.75);
    732 
    733         func.ReleaseParameter(0);
    734         func.ReleaseParameter(2);
    735         func.FixParameter(3, func.GetParameter(3));
    736         func.FixParameter(5, func.GetParameter(5));
    737 
    738         func.SetParLimits(2, 0, 80);
    739         h->Fit(&func, "N0Q", "", 0, sigmax);
    740 
    741         TArrayD p(func.GetNpar(), func.GetParameters());
    742 
    743         Double_t sig=0;
    744 
    745         const Int_t n = hist->GetBin(ix+1, iy+1);
    746         if (!(func.GetParameter(0)>alpha0*2 ||
    747               func.GetParameter(2)<2.5      ||
    748               func.GetParameter(2)>70))
    749         {
    750             // Implementing the integral as analytical function
    751             // gives the same result in the order of 10e-5
    752             // and it is not faster at all...
    753             const Double_t s = func.Integral(0, 15);
    754 
    755             func.SetParameter(0, 0);
    756             func.SetParameter(2, 1);
    757 
    758             const Double_t b = func.Integral(0, 15);
    759 
    760             sig = Significance(s, b);
    761         }
    762 
    763         fParam->SetValue(sig);
    764         fParam->SetReadyToSave();
    765         return kTRUE;
    766     }
    767     ClassDef(MHSignificance, 0)
    768 };
    769 */
    770 
    771627
    772628// --------------------------------------------------------------------------
     
    843699    histb->SetYTitle(fHist.GetXaxis()->GetTitle());
    844700
     701    const Double_t w = fHist.GetZaxis()->GetBinWidth(1);
     702
    845703    //                      xmin, xmax, npar
    846704    //TF1 func("MyFunc", fcn, 0, 90, 6);
     
    889747
    890748            const Double_t alpha0 = h->GetBinContent(1);
    891             const Double_t alphaw = h->GetXaxis()->GetBinWidth(1);
    892749
    893750            // Check for the regios which is not filled...
     
    959816            */
    960817
    961             const Double_t s = func.Integral(0, sigint);
     818            // The fitted function returned units of
     819            // counts bin binwidth. To get the correct number
     820            // of events we must adapt the functions by dividing
     821            // the result of the integration by the bin-width
     822            const Double_t s = func.Integral(0, sigint)/w;
    962823
    963824            func.SetParameter(0, 0);
    964825            func.SetParameter(2, 1);
    965826
    966             const Double_t b   = func.Integral(0, sigint);
     827            const Double_t b   = func.Integral(0, sigint)/w;
    967828            const Double_t sig = Significance(s, b);
    968829
  • trunk/MagicSoft/Mars/mimage/MNewImagePar.cc

    r3526 r3574  
    4141// ----------
    4242//  - added fNumHGSaturatedPixels
     43//  - added fInnerLeakage1
     44//  - added fInnerLeakage2
     45//  - added fInnerSize
    4346//
    4447/////////////////////////////////////////////////////////////////////////////
  • trunk/MagicSoft/Mars/mimage/MNewImagePar.h

    r3526 r3574  
    1515    Float_t fLeakage1;           // (photons in most outer ring of pixels) over fSize
    1616    Float_t fLeakage2;           // (photons in the 2 outer rings of pixels) over fSize
    17     Float_t fInnerLeakage1;           // (photons in most outer rings of inner pixels) over fInnerSize
    18     Float_t fInnerLeakage2;           // (photons in the 2 outer rings of inner pixels) over fInnerSize
    19     Float_t fInnerSize;
     17    Float_t fInnerLeakage1;      // (photons in most outer rings of inner pixels) over fInnerSize
     18    Float_t fInnerLeakage2;      // (photons in the 2 outer rings of inner pixels) over fInnerSize
     19    Float_t fInnerSize;          //
    2020
    2121    Float_t fConc;               // [ratio] concentration ratio: sum of the two highest pixels / fSize
Note: See TracChangeset for help on using the changeset viewer.