Changeset 8775 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
12/03/07 17:44:59 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r8770 r8775  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20
     21 2007/12/03 Thomas Bretz
     22
     23   * mdata/MData.h:
     24     - added Print to context menu
     25
     26   * mhflux/MAlphaFitter.[h,cc]:
     27     - added new member functions to apply scaling to off-data
     28
     29   * mhflux/MHAlpha.[h,cc]:
     30     - added new member functions to apply scaling to off-data
     31     - added a public member function which allows to reinitiate fitting
     32
     33   * mhist/MHCamera.cc:
     34     - replaced a loop to reset the used pixels by a call to fUsed.Reset()
     35
     36   * mmuon/MHSingleMuon.[h,cc]:
     37     - keep mean and rms of relative arrival time of the fit
     38     - increased class Version accordingly
     39
     40   * mmuon/MMuonCalibPar.[h,cc]:
     41     - keep mean and rms of relative arrival time of the fit
     42     - increased class Version accordingly
     43
     44   * mmuon/MMuonCalibParCalc.cc:
     45     - copy result of arrival time fit from histogram to storage container
     46
     47
    2048
    2149 2007/11/28 Daniela Dorner
  • trunk/MagicSoft/Mars/mdata/MData.h

    r1574 r8775  
    2525    Double_t operator()() { return GetValue(); }
    2626
    27     void Print(Option_t *opt = "") const;
     27    void Print(Option_t *opt = "") const; //*MENU*
    2828    Bool_t AsciiWrite(ostream &out) const;
    2929
  • trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc

    r8767 r8775  
    630630}
    631631*/
     632
    632633Bool_t MAlphaFitter::FitAlpha(const TH3D &hon, const TH3D &hof, Bool_t paint)
    633634{
     
    646647
    647648    return rc;
     649}
     650
     651Bool_t MAlphaFitter::ApplyScaling(const TH3D &hon, TH3D &hof, UInt_t bin) const
     652{
     653    const TString name1(Form("TempAlpha%06d_on",  gRandom->Integer(1000000)));
     654    const TString name0(Form("TempAlpha%06d_off", gRandom->Integer(1000000)));
     655
     656    TH1D *h1 = hon.ProjectionZ(name1, -1, -1, bin, bin, "E");
     657    TH1D *h0 = hof.ProjectionZ(name0, -1, -1, bin, bin, "E");
     658    h1->SetDirectory(0);
     659    h0->SetDirectory(0);
     660
     661    const Double_t scale = Scale(*h0, *h1);
     662
     663    delete h0;
     664    delete h1;
     665
     666    for (int x=0; x<=hof.GetNbinsX()+1; x++)
     667        for (int z=0; z<=hof.GetNbinsZ()+1; z++)
     668        {
     669            hof.SetBinContent(x, bin, z, hof.GetBinContent(x, bin, z)*scale);
     670            hof.SetBinError(  x, bin, z, hof.GetBinError(  x, bin, z)*scale);
     671        }
     672
     673    return scale>0;
     674}
     675
     676Bool_t MAlphaFitter::ApplyScaling(const TH3D &hon, TH3D &hof) const
     677{
     678    for (int y=0; y<=hof.GetNbinsY()+1; y++)
     679        ApplyScaling(hon, hof, y);
     680
     681    return kTRUE;
    648682}
    649683
  • trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h

    r8767 r8775  
    237237    Double_t Scale(TH1D &off, const TH1D &on) const;
    238238
     239    Bool_t ApplyScaling(const TH3D &hon, TH3D &hof, UInt_t bin) const;
     240    Bool_t ApplyScaling(const TH3D &hon, TH3D &hof) const;
     241
    239242    // Interface to result
    240243    void PaintResult(Float_t x=0.04, Float_t y=0.94, Float_t size=0.035, Bool_t draw=kFALSE) const;
  • trunk/MagicSoft/Mars/mhflux/MHAlpha.cc

    r8695 r8775  
    10101010Bool_t MHAlpha::Finalize()
    10111011{
    1012     //TH1D *h = fHist.ProjectionZ("AlphaExc_px", -1, 9999, -1, 9999, "E");
    1013     //h->SetDirectory(0);
    1014     //Bool_t rc = fFit.Fit(*h);
    1015     //delete h;
    1016 
    1017     if (!fFit.FitAlpha(fHist, fOffData))
     1012    if (!FitAlpha())
    10181013    {
    10191014        *fLog << warn << "MAlphaFitter - Fit failed..." << endl;
     
    10991094}
    11001095
     1096void MHAlpha::ApplyScaling()
     1097{
     1098    if (!fOffData)
     1099        return;
     1100
     1101    fFit.ApplyScaling(fHist, *const_cast<TH3D*>(fOffData));
     1102}
     1103
    11011104Int_t MHAlpha::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
    11021105{
  • trunk/MagicSoft/Mars/mhflux/MHAlpha.h

    r8636 r8775  
    104104    const TH1D &GetHEnergy() const { return fHEnergy; }
    105105
     106    const TH3D *GetOffData() const { return fOffData; }
     107
    106108    // Setter
    107109    void SetNameParameter(const char *name) { fNameParameter=name; }
     
    132134    void ForceUsingSize(Bool_t b=kTRUE) { fForceUsingSize=b; }
    133135
     136    Bool_t FitAlpha()
     137    {
     138        return fFit.FitAlpha(fHist, fOffData);
     139    }
     140
    134141    void DrawNicePlot(const char *title="MAGIC Telescope observation", const char *watermark="preliminary") { DrawNicePlot(kTRUE, title, watermark); } //*MENU*
    135142    void DrawNicePlot(Bool_t newc, const char *title=0, const char *watermark=0);
     
    139146    virtual void InitMapping(MHMatrix *mat, Int_t type=0);
    140147    void StopMapping();
     148
     149    void ApplyScaling();
    141150
    142151    // TObject
  • trunk/MagicSoft/Mars/mhist/MHCamera.cc

    r8756 r8775  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MHCamera.cc,v 1.106 2007-10-13 18:56:27 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MHCamera.cc,v 1.107 2007-12-03 17:44:46 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    165165    rc->SetDirectory(NULL);
    166166
     167    // fGeomCam need special treatment due to its TObjArray
    167168    if (rc->fGeomCam && fGeomCam)
    168169    {
     
    191192
    192193    fUsed.Set(geom.GetNumPixels());
    193     for (Int_t i=0; i<fNcells-2; i++)
    194         ResetUsed(i);
     194    fUsed.Reset();
    195195
    196196    fBinEntries.Set(geom.GetNumPixels()+2);
  • trunk/MagicSoft/Mars/mmuon/MHSingleMuon.cc

    r8660 r8775  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MHSingleMuon.cc,v 1.16 2007-08-06 16:50:45 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MHSingleMuon.cc,v 1.17 2007-12-03 17:44:59 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    7070// your results!!
    7171//
    72 // Inputcontainer:
     72// InputContainer:
    7373//   - MGeomCam
    7474//   - MMuonSearchPar
    7575//
     76//
     77// Class Version 2:
     78// ----------------
     79//   + Double_t fRelTimeMean;   // Result of the gaus fit to the arrival time
     80//   + Double_t fRelTimeSigma;  // Result of the gaus fit to the arrival time
    7681//
    7782////////////////////////////////////////////////////////////////////////////
     
    194199Bool_t MHSingleMuon::Fill(const MParContainer *par, const Stat_t w)
    195200{
     201    fRelTimeMean  =  0;
     202    fRelTimeSigma = -1;
     203
    196204    fHistPhi.Reset();
    197205    fHistWidth.Reset();
     
    247255    fHistTime.Fit(&g1, "QNB");
    248256
    249     //    Double_t err;
    250     Double_t sig, mean, dummy;
    251     gMinuit->GetParameter(1, mean, dummy);  // get the mean  value
    252     gMinuit->GetParameter(2, sig,  dummy);  // get the sigma value
     257    Double_t dummy;
     258    gMinuit->GetParameter(1, fRelTimeMean,   dummy);  // get the mean  value
     259    gMinuit->GetParameter(2, fRelTimeSigma,  dummy);  // get the sigma value
    253260
    254261    // The mean arrival time which was subtracted before will
    255262    // be added again, now
    256     const Double_t tm0 = fMuonSearchPar->GetTime()+mean;
     263    const Double_t tm0 = fMuonSearchPar->GetTime()+fRelTimeMean;
    257264
    258265    for (Int_t i=0; i<entries; i++)
     
    268275        // if the signal is not near the estimated circle, it is ignored.
    269276        if (TMath::Abs(dist-fMuonSearchPar->GetRadius())<fMargin &&
    270             TMath::Abs(pix.GetArrivalTime()-tm0) < 2*sig)
     277            TMath::Abs(pix.GetArrivalTime()-tm0) < 2*fRelTimeSigma)
    271278        {
    272279            fHistPhi.Fill(TMath::ATan2(dx, dy)*TMath::RadToDeg(), pix.GetNumPhotons());
Note: See TracChangeset for help on using the changeset viewer.