Changeset 5143


Ignore:
Timestamp:
09/28/04 12:25:50 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r5141 r5143  
    2020                                                 -*-*- END OF LINE -*-*-
    2121
     22 2004/09/28: Thomas Bretz
     23
     24   * mbase/MGMap.h:
     25     - added Clear() function
     26
     27   * mfileio/MReadReports.[h,cc]:
     28     - added GetReader member function
     29
     30   * mhbase/MBinning.h:
     31     - set a default for a constructor argument
     32
     33   * mhbase/MH.cc:
     34     - do not treat errors when enhancing histograms
     35       if errors are not set
     36
     37   * mhflux/MHEffectiveOnTime.cc:
     38     - changed conditions for fit:
     39       + 5% - 95%  --->  60% - 99%
     40       + start value 200Hz
     41       + ok if chi2<3*NDF
     42     - resturn chi2 as result of fit
     43     - changed some text output in pads
     44
     45   * mhflux/MHFalseSource.cc:
     46     - made work without MPointingPos
     47     - fixed crash if star-display is used
     48     - fixed dissapearing alpha plot
     49
     50   * mhist/MHCamEvent.[h,cc]:
     51     - removed rms histogram
     52     - enhanced display
     53     - fixed handling of title
     54
     55   * mhist/MHCamera.[h,cc]:
     56     - simplified projection functions a bit
     57     - simplified profile functions a bit
     58     - added default for binning
     59     - added binning to Profiles
     60
     61   * mimage/MConcentration.c:
     62     - fixed author list
     63
     64   * mimage/MHHillas.cc:
     65     - display size as logy
     66
     67   * mimage/MHHillasExt.cc, mimage/MHHillasSrc.cc:
     68     - fixed binnings
     69     - removed obsolete pad->Update in Draw
     70
     71   * mimage/MHImagePar.cc:
     72     - fixed setting of log-scale
     73
     74   * mjobs/MJCalibrateSignal.cc:
     75     - fixed histogram titles and axis titles
     76
     77   * mjobs/MJStar.cc:
     78     - added EventRate cut which cuts out events with extremely
     79       changing rates
     80
     81   * mmain/MEventDisplay.cc:
     82     - unlock event display
     83
     84   * msignal/MArrivalTime.cc:
     85     - fixed GetPixelContent
     86
     87
     88
    2289 2004/09/28: Raquel de los Reyes
    2390
     
    2794       00035488 (2004_08_30)
    2895
     96
     97
    2998 2004/09/27: Abelardo Moralejo
    3099
     
    32101     - Added. Macro to compare the piled-up signals for many pixels and
    33102       events together, intended to check the noise fluctuations.
     103
     104
    34105
    35106 2004/09/23: Markus Gaug
     
    76147
    77148
     149
    78150 2004/09/23: Abelardo Moralejo
    79151   * mtemp/mpadova/macros/area.C, RanForestPD.C, gammarate.C
    80152     - Added
     153
    81154   * macros/starmc.C
    82155     - Added some missing RunHeaders in the output
    83156
     157
     158
    84159 2004/09/19: Thomas Bretz
    85160
    86    * mbadpixels/MBadPIxlesCam.[h,cc]:
     161   * mbadpixels/MBadPixlesCam.[h,cc]:
    87162     - added Reset-function. This makes sure, that the event-wise
    88163       bad pixels determined by MBadPIxelsCalc are deleted after
     
    92167   * mpointing/MPointingPos.cc, mreport/MReportDrive.cc:
    93168     - initialize the variables in the constructor
     169
    94170
    95171
  • trunk/MagicSoft/Mars/mbase/MGMap.h

    r4081 r5143  
    1111class TString;
    1212class TGToolTip;
     13
     14#include <iostream>
    1315
    1416class MGMap : public TExMap
     
    3133    void     Add(TObject *k, TString *v=0);
    3234    void     Delete(Option_t *opt = "");
     35    void     Clear(Option_t *o="") { TExMap::Delete(); }
    3336
    3437    //    void   SetNoToolTips(Bool_t b=kTRUE) { b ? SetBit(kNoToolTips) : ResetBit(kNoToolTips); } // *TOGGLE* *GETTER=HasNoToolTips
  • trunk/MagicSoft/Mars/mfileio/MReadReports.cc

    r4895 r5143  
    198198}
    199199
     200MReadTree *MReadReports::GetReader(const char *tree) const
     201{
     202    return (MReadTree*)fTrees->FindObject(tree);
     203}
     204
    200205// --------------------------------------------------------------------------
    201206//
  • trunk/MagicSoft/Mars/mfileio/MReadReports.h

    r4895 r5143  
    1313class MTime;
    1414class MTaskList;
     15class MReadTree;
    1516
    1617class MReadReports : public MRead
     
    5556    void  EnableAutoScheme(Bool_t e=kTRUE) { fEnableAutoScheme = e; } // Must be called BEFORE AddTree!
    5657
     58    MReadTree *GetReader(const char *tree) const;
     59
    5760    ClassDef(MReadReports, 0) // Reads events and reports from a root file ordered in time
    5861};
  • trunk/MagicSoft/Mars/mhbase/MBinning.h

    r4966 r5143  
    3737public:
    3838    MBinning(const char *name=NULL, const char *title=NULL);
    39     MBinning(Int_t nbins, Axis_t lo, Axis_t hi, const char *name, const char *opt="", const char *title=NULL);
     39    MBinning(Int_t nbins, Axis_t lo, Axis_t hi, const char *name=0, const char *opt="", const char *title=NULL);
    4040
    4141    void SetEdges(const TArrayD &arr)
  • trunk/MagicSoft/Mars/mhbase/MH.cc

    r5060 r5143  
    483483        return;
    484484
     485    const Bool_t haserr = h.GetSumw2N()>0;
     486
    485487    const Int_t n0 = h.GetNbinsX();
    486488    if (n0<2)
     
    488490
    489491    TArrayD val(n0-1);
    490     TArrayD err(n0-1);
     492    TArrayD err(haserr ? n0-1 : 0);
    491493    for (int i=1; i<n0; i++)
    492494    {
    493495        val[i-1] = h.GetBinContent(i+1);
    494         err[i-1] = h.GetBinError(i+1);
     496        if (haserr)
     497            err[i-1] = h.GetBinError(i+1);
    495498    }
    496499
     
    505508    {
    506509        h.SetBinContent(i, val[i-1]);
    507         h.SetBinError(i, err[i-1]);
     510        if (haserr)
     511            h.SetBinError(i, err[i-1]);
    508512    }
    509513}
  • trunk/MagicSoft/Mars/mhflux/MHEffectiveOnTime.cc

    r5012 r5143  
    304304    // within the range (yq[0], yq[1]) there must be no empty bin;
    305305    // choose pedestrian approach as long as GetQuantiles is not available
    306     Double_t xq[2] = { 0.05, 0.95 };
     306    Double_t xq[2] = { 0.6, 0.99 };
    307307    Double_t yq[2];
    308308    h->GetQuantiles(2, yq, xq);
     
    321321    //func.SetParNames("lambda", "N0", "del");
    322322
    323     func.SetParameter(0, 100);       // Hz
     323    func.SetParameter(0, 200);       // Hz
    324324    func.SetParameter(1, Nm);
    325325    func.FixParameter(2, Nmdel/Nm);
     
    335335
    336336    // was fit successful ?
    337     const Bool_t ok = NDF>0 && chi2<2.5*NDF;
     337    const Bool_t ok = NDF>0 && chi2<3*NDF;
    338338
    339339    if (paint)
     
    343343        func.Paint("same");
    344344    }
    345 
    346     if (!ok)
    347         return kFALSE;
    348345
    349346    const Double_t lambda = func.GetParameter(0);
     
    385382    res[5] = NDF;
    386383
     384    // Chi2
     385    res[6] = chi2;
     386
    387387    // Rdead (from fit) is the fraction from real time lost by the dead time
    388388    //fHRdead.SetBinContent(i, Rdead);
    389389    //fHRdead.SetBinError  (i,dRdead);
    390390
    391     return kTRUE;
     391    return ok;
    392392}
    393393
     
    415415        h = fH2DeltaT.ProjectionX(name, i, i, "E");
    416416
    417         Double_t res[6];
     417        Double_t res[7];
    418418        if (!FitH(h, res))
    419419            continue;
     
    457457    // Fit histogram
    458458    //
    459     Double_t res[6];
     459    Double_t res[7];
    460460    if (!FitH(&fH1DeltaT, res))
    461461        return;
     
    551551
    552552    //
    553     // If we reached the event number limit for the time-bins fit the histogram
    554     //
    555     if (fH1DeltaT.GetEntries()>=fNumEvents)
     553    // If we reached the event number limit for the time-bins fit the
     554    // histogram - if it fails try again when 1.6% more events available
     555    //
     556    const Int_t n = (Int_t)fH1DeltaT.GetEntries();
     557    if (n>=fNumEvents && n%(fNumEvents/60)==0)
    556558        FitTimeBin();
    557559
     
    592594void MHEffectiveOnTime::PaintText(Double_t *res) const
    593595{
    594     TLatex text(0.25, 0.94, Form("T_{eff}=%.1fs\\pm%.1fs  \\labda=%.1f\\pm%.1f  p=%.1f%%  NDF=%d",
    595                                  res[0], res[1], res[3], res[4], res[2], res[5]));
     596    TLatex text(0.27, 0.94, Form("T_{eff}=%.1fs\\pm%.1fs  \\lambda=%.1f\\pm%.1fHz  p=%.1f%%  \\chi^{2}/%d=%.1f",
     597                                 res[0], res[1], res[3], res[4], res[2], (int)res[5], res[6]/res[5]));
    596598    text.SetBit(TLatex::kTextNDC);
    597599    text.SetTextSize(0.04);
     
    613615        return;
    614616
    615     TLatex text(0.45, 0.94, Form("\\bar{p} = %.1f%%  (n=%d)", sum/n, n));
     617    TLatex text(0.47, 0.94, Form("\\bar{p} = %.1f%%", sum/n));
    616618    text.SetBit(TLatex::kTextNDC);
    617619    text.SetTextSize(0.04);
     
    692694        if ((h = (TH1D*)gPad->FindObject(fNameProjDeltaT)))
    693695        {
    694             Double_t res[6];
     696            Double_t res[7];
    695697            FitH(h, res, kTRUE);
    696698            PaintText(res);
  • trunk/MagicSoft/Mars/mhflux/MHFalseSource.cc

    r5100 r5143  
    290290    // for the current pointing position and add a offset in the
    291291    // Fill function!
    292     fRa  = fPointPos->GetRa();
    293     fDec = fPointPos->GetDec();
     292    fRa  = fPointPos ? fPointPos->GetRa()  :  0;
     293    fDec = fPointPos ? fPointPos->GetDec() : 90;
    294294
    295295    return kTRUE;
     
    592592    stars->ReadBSC("bsc5.dat");
    593593
    594     *fLog << err << "FIXME - The catalog will never be deleted, because this crashes!" << endl;
    595 
    596 //    stars->SetBit(kCanDelete);
    597 
     594    stars->SetBit(kCanDelete);
    598595    return stars;
    599596}
     
    612609    pad->Divide(1, 2, 0, 0.03);
    613610
    614     *fLog << err << "FIXME - Plotting the catalog is broken!" << endl;
    615 
    616611    TObject *catalog = GetCatalog();
    617612
    618613    // Initialize upper part
    619614    pad->cd(1);
     615    // Make sure that the catalog is deleted only once
     616    gROOT->GetListOfCleanups()->Add(gPad);
    620617    gPad->SetBorderMode(0);
    621618    gPad->Divide(3, 1);
     
    662659    // Initialize lower part
    663660    pad->cd(2);
     661    // Make sure that the catalog is deleted only once
     662    gROOT->GetListOfCleanups()->Add(gPad);
    664663    gPad->SetBorderMode(0);
    665664    gPad->Divide(3, 1);
     
    673672    h1->SetXTitle(fHist.GetZaxis()->GetTitle());
    674673    h1->SetYTitle("Counts");
    675     h1->Draw(opt);
     674    h1->Draw();
    676675    h1->SetBit(kCanDelete);
    677676
     
    942941
    943942
    944     TF2 f2d("Gaus-2D", FcnGauss2d, -1.5, 1.5, -1.5, 1.5, 6);
     943    const Double_t maxr = 0.9*TMath::Abs(fHist.GetBinCenter(1));
     944    TF2 f2d("Gaus-2D", FcnGauss2d, -maxr, maxr, -maxr, maxr, 6);
    945945    f2d.SetLineWidth(1);
    946946    f2d.SetParName(0, "Max   sigma");
     
    950950    f2d.SetParName(4, "Sigma_2 deg");
    951951    f2d.SetParName(5, "Phi     deg");
    952     f2d.SetParLimits(1, -1, 1);    // mu_1
    953     f2d.SetParLimits(3, -1, 1);    // mu_2
    954     f2d.SetParLimits(2, 0, 1);     // sigma_1
    955     f2d.SetParLimits(4, 0, 1);     // sigma_2
    956     f2d.SetParLimits(5, 0, 90);    // phi
    957     f2d.SetParameter(0, maxs);     // A
    958     f2d.SetParameter(1, 0);        // mu_1
    959     f2d.SetParameter(2, 0.5);      // sigma_1
    960     f2d.SetParameter(3, 0);        // mu_2
    961     f2d.SetParameter(4, 0.5);      // sigma_2
    962     f2d.SetParameter(5, 0);        // phi
    963     hist->Fit(&f2d, "NI0");
     952    f2d.SetParLimits(1, -maxr/2, maxr/2); // mu_1
     953    f2d.SetParLimits(3, -maxr/2, maxr/2); // mu_2
     954    f2d.SetParLimits(2, 0, maxr);         // sigma_1
     955    f2d.SetParLimits(4, 0, maxr);         // sigma_2
     956    f2d.SetParLimits(5, 0, 45);           // phi
     957    f2d.SetParameter(0, maxs);            // A
     958    f2d.SetParameter(1, hist->GetXaxis()->GetBinCenter(maxx)); // mu_1
     959    f2d.SetParameter(2, 0.1);             // sigma_1
     960    f2d.SetParameter(3, hist->GetYaxis()->GetBinCenter(maxy)); // mu_2
     961    f2d.SetParameter(4, 0.1);             // sigma_2
     962    f2d.FixParameter(5, 0);               // phi
     963    hist->Fit(&f2d, "NI0R");
    964964    f2d.DrawCopy("cont2same");
    965965
  • trunk/MagicSoft/Mars/mhist/MHCamEvent.cc

    r2893 r5143  
    3030// currents or enything else derived from MCamEvent
    3131//
     32// To plot the variance instead of the rms use:
     33//    MHCamEvent::SetBit(MHCamera::kVariance);
     34//
     35// Axis titles
     36// ===========
     37//
     38// 1) If no other title is given 'a.u.' is used.
     39// 2) If the title of MHCamEvent is different from the default,
     40//    it is used as histogram title. You can use this to set the
     41//    axis title, too. For more information see TH1::SetTitle, eg.
     42//       SetTitle("MyHist;;y[cm];Counts");
     43//    Make sure to set an empty x-axis title.
     44//
     45//
     46// For example:
     47//   MHCamEvent myhist("Titele;;y [cm]");
     48//
     49//
    3250/////////////////////////////////////////////////////////////////////////////
    3351#include "MHCamEvent.h"
    3452
    3553#include <TCanvas.h>
     54#include <TPaveStats.h>
    3655
    3756#include "MLog.h"
     
    4867using namespace std;
    4968
    50 // --------------------------------------------------------------------------
    51 //
    52 // Initialize the name and title of the task.
    53 // Resets the sum histogram
    54 //
    55 MHCamEvent::MHCamEvent(const char *name, const char *title)
    56     : fSum(NULL), fRms(NULL), fEvt(NULL), fType(0)
     69const TString MHCamEvent::gsDefName  = "MHCamEvent";
     70const TString MHCamEvent::gsDefTitle = "Average of MCamEvents";
     71
     72// --------------------------------------------------------------------------
     73//
     74// Initialize the name and title of the task
     75//
     76void MHCamEvent::Init(const char *name, const char *title)
    5777{
    5878    //
    5979    //   set the name and title of this object
    6080    //
    61     fName  = name  ? name  : "MHCamEvent";
    62     fTitle = title ? title : "Average of MCamEvents";
     81    fName  = name  ? name  : gsDefName.Data();
     82    fTitle = title ? title : gsDefTitle.Data();
     83}
     84
     85// --------------------------------------------------------------------------
     86//
     87// Initialize the name and title of the task. Set fType to 0
     88//
     89MHCamEvent::MHCamEvent(const char *name, const char *title)
     90    : fSum(NULL), fEvt(NULL), fType(0)
     91{
     92    Init(name, title);
     93}
     94
     95// --------------------------------------------------------------------------
     96//
     97// Initialize the name and title of the task. Set fType to type
     98//
     99MHCamEvent::MHCamEvent(Int_t type, const char *name, const char *title)
     100    : fSum(NULL), fEvt(NULL), fType(type)
     101{
     102    Init(name, title);
    63103}
    64104
     
    71111    if (fSum)
    72112        delete fSum;
    73     if (fRms)
    74         delete fRms;
    75113}
    76114
     
    104142    if (fSum)
    105143        delete (fSum);
    106     if (fRms)
    107         delete (fRms);
    108144
    109145    const TString name = fNameEvt.IsNull() ? fName : fNameEvt;
    110146
    111     fSum = new MHCamera(*cam, name+";avg", fTitle);
    112     fSum->SetYTitle("a.u.");
     147    fSum = new MHCamera(*cam, name+";avg");
     148    if (fTitle!=gsDefTitle)
     149        fSum->SetTitle(fTitle);
     150    if (!fTitle.Contains(";"))
     151        fSum->SetYTitle("a.u.");
    113152    fSum->SetBit(MHCamera::kProfile);
    114     if(TestBit(MHCamera::kVariance))
    115       fSum->SetBit(MHCamera::kVariance);
    116 
    117     fRms = new MHCamera(*cam, name+";rms", fTitle);
    118     fRms->SetYTitle("a.u.");
     153    if (TestBit(MHCamera::kVariance))
     154        fSum->SetBit(MHCamera::kVariance);
    119155
    120156    return kTRUE;
     
    134170    }
    135171    fSum->AddCamContent(*evt, fType);
    136     fRms->SetCamContent(*fSum, 1);
    137     return kTRUE;
    138 }
    139 
    140 // --------------------------------------------------------------------------
    141 //
    142 // Scale the sum container with the number of entries
    143 //
    144 Bool_t MHCamEvent::Finalize()
    145 {
    146     //fRms->AddCamContent(*fSum, 1);
    147172    return kTRUE;
    148173}
     
    176201TH1 *MHCamEvent::GetHistByName(const TString name)
    177202{
    178 //    name.ToLower();
    179 
    180     if (name=="sum")
    181         return fSum;
    182     if (name=="rms")
    183         return fRms;
    184 
    185     return NULL;
     203    return fSum;
     204}
     205
     206void MHCamEvent::Paint(Option_t *)
     207{
     208    TVirtualPad *pad = gPad;
     209
     210    pad->cd(2);
     211    if (gPad->FindObject(Form("Proj_%p", this)))
     212    {
     213        TH1 *h=fSum->Projection(Form("Proj_%p", this));
     214        if (h->GetMaximum()>0)
     215            gPad->SetLogy();
     216    }
     217
     218    pad->cd(5);
     219    if (gPad->FindObject(Form("ProfR_%p", this)))
     220        fSum->RadialProfile(Form("ProfR_%p", this));
     221
     222    pad->cd(6);
     223    if (gPad->FindObject(Form("ProfA_%p", this)))
     224        fSum->AzimuthProfile(Form("ProfA_%p", this));
     225
     226    pad->cd(4);
     227    gPad->cd(1);
     228    MHCamera *cam = (MHCamera*)gPad->FindObject(Form("Err_%p", this));
     229    if (cam)
     230        cam->SetCamContent(*fSum, 1);
    186231}
    187232
     
    191236    pad->SetBorderMode(0);
    192237
    193     pad->Divide(1,2);
     238    AppendPad();
     239
     240    TString name = Form("%s_5", pad->GetName());
     241    TPad *p = new TPad(name,name,6./8,0.25,0.99,0.5,pad->GetFillColor(),0,0);
     242    p->SetNumber(5);
     243    p->Draw();
     244
     245    name = Form("%s_6", pad->GetName());
     246    p = new TPad(name,name,6./8,0.01,0.99,0.25,pad->GetFillColor(),0,0);
     247    p->SetNumber(6);
     248    p->Draw();
     249
     250    pad->Divide(2,2);
    194251
    195252    pad->cd(1);
    196253    gPad->SetBorderMode(0);
     254    gPad->SetPad(0.01, 0.5, 0.66, 0.99);
    197255    fSum->Draw("EPhist");
    198256
    199257    pad->cd(2);
    200258    gPad->SetBorderMode(0);
    201     gPad->Divide(2, 1);
    202     pad = gPad;
    203 
    204     pad->cd(1);
     259    gPad->SetPad(0.66, 0.5, 0.99, 0.99);
     260    TH1 *h = fSum->Projection(Form("Proj_%p", this), 50);
     261    h->SetTitle("Projection");
     262    h->SetBit(kCanDelete);
     263    h->Draw();
     264
     265    pad->cd(3);
     266    gPad->SetPad(0.01, 0.01, 3./8, 0.5);
    205267    gPad->SetBorderMode(0);
    206268    fSum->Draw();
    207269
    208     pad->cd(2);
    209     gPad->SetBorderMode(0);
    210     fRms->Draw();
    211 }
     270    pad->cd(4);
     271    gPad->SetPad(3./8, 0.01, 6./8, 0.5);
     272    gPad->SetBorderMode(0);
     273
     274    MHCamera *cam = new MHCamera(*fSum->GetGeometry());
     275    cam->SetName(Form("Err_%p", this));
     276    cam->SetTitle(TestBit(MHCamera::kVariance)?"Variance":"Root Mean Squared (rms)");
     277    cam->SetYTitle(fSum->GetYaxis()->GetTitle());
     278    cam->SetCamContent(*fSum, 1);
     279    cam->SetBit(kCanDelete);
     280    cam->Draw();
     281
     282    pad->cd(5);
     283    h = (TH1*)fSum->RadialProfile(Form("ProfR_%p", this), 20);
     284    h->SetTitle("Radial Profile");
     285    h->SetBit(kCanDelete|TH1::kNoStats);
     286    h->Draw();
     287
     288    pad->cd(6);
     289    h = (TH1*)fSum->AzimuthProfile(Form("ProfA_%p", this), 30);
     290    h->SetTitle("Azimuth Profile");
     291    h->SetBit(kCanDelete|TH1::kNoStats);
     292    h->Draw();
     293}
  • trunk/MagicSoft/Mars/mhist/MHCamEvent.h

    r2550 r5143  
    1212{
    1313private:
     14    static const TString gsDefName;
     15    static const TString gsDefTitle;
     16
    1417    MHCamera  *fSum; // storing the sum
    15     MHCamera  *fRms; // storing the rms
    1618    MCamEvent *fEvt; //! the current event
    1719
     
    2022    Int_t fType;
    2123
     24    void Init(const char *name, const char *title);
     25
    2226    Bool_t SetupFill(const MParList *pList);
    2327    Bool_t Fill(const MParContainer *par, const Stat_t w=1);
    24     Bool_t Finalize();
    2528
    2629public:
    2730    MHCamEvent(const char *name=NULL, const char *title=NULL);
     31    MHCamEvent(Int_t type, const char *name=NULL, const char *title=NULL);
    2832    ~MHCamEvent();
    2933
     
    3337    TH1 *GetHistByName(const TString name="");
    3438
     39    void Paint(Option_t *o="");
    3540    void Draw(Option_t *o="");
    3641
  • trunk/MagicSoft/Mars/mhist/MHCamera.cc

    r4915 r5143  
    7575
    7676#include "MH.h"
     77#include "MBinning.h"
    7778#include "MHexagon.h"
    7879
     
    576577    if (!h1)
    577578    {
    578         Double_t min = GetMinimumSectors(sector, aidx);
    579         Double_t max = GetMaximumSectors(sector, aidx);
    580 
    581         Int_t newbins=0;
    582 
    583         THLimitsFinder::OptimizeLimits(nbins, newbins, min, max, kFALSE);
    584 
    585         h1 = new TH1D(pname, GetTitle(), nbins, min, max);
    586         h1->SetDirectory(pname.IsNull() ? NULL : gROOT);
     579        h1 = new TH1D;
     580        h1->UseCurrentStyle();
     581        h1->SetName(pname);
     582        h1->SetTitle(GetTitle());
     583        h1->SetDirectory(0);
    587584        h1->SetXTitle(GetYaxis()->GetTitle());
    588585        h1->SetYTitle("Counts");
    589586        //h1->Sumw2();
    590587    }
     588
     589    Double_t min = GetMinimumSectors(sector, aidx);
     590    Double_t max = GetMaximumSectors(sector, aidx);
     591
     592    if (min==max && max>0)
     593        min=0;
     594    if (min==max && min<0)
     595        max=0;
     596
     597    Int_t newbins=0;
     598    THLimitsFinder::OptimizeLimits(nbins, newbins, min, max, kFALSE);
     599
     600    MBinning bins(nbins, min, max);
     601    bins.Apply(*h1);
    591602
    592603    // Fill the projected histogram
     
    630641TProfile *MHCamera::RadialProfileS(const TArrayI &sector, const TArrayI &aidx, const char *name, const Int_t nbins) const
    631642{
     643    // Create the projection histogram
     644    TString pname(name);
     645    if (name=="_rad")
     646    {
     647        pname.Prepend(GetName());
     648        if (sector.GetSize()>0)
     649        {
     650            pname += ";";
     651            for (int i=0; i<sector.GetSize(); i++)
     652                pname += sector[i];
     653        }
     654        if (aidx.GetSize()>0)
     655        {
     656            pname += ";";
     657            for (int i=0; i<aidx.GetSize(); i++)
     658                pname += aidx[i];
     659        }
     660    }
     661
     662    TProfile *h1=0;
     663
     664    //check if histogram with identical name exist
     665    TObject *h1obj = gROOT->FindObject(pname);
     666    if (h1obj && h1obj->InheritsFrom("TProfile")) {
     667        h1 = (TProfile*)h1obj;
     668        h1->Reset();
     669    }
     670
     671    if (!h1)
     672    {
     673        h1 = new TProfile;
     674        h1->UseCurrentStyle();
     675        h1->SetName(pname);
     676        h1->SetTitle(GetTitle());
     677        h1->SetDirectory(0);
     678        h1->SetXTitle("Radius from camera center [mm]");
     679        h1->SetYTitle(GetYaxis()->GetTitle());
     680    }
     681
     682    Double_t min = 0.;
     683    Double_t max = fGeomCam->GetMaxRadius();
     684
     685    Int_t newbins=0;
     686
     687    THLimitsFinder::OptimizeLimits(nbins, newbins, min, max, kFALSE);
     688
     689    MBinning bins(nbins, min, max);
     690    bins.Apply(*h1);
    632691 
    633   // Create the projection histogram
    634   TString pname(name);
    635   if (name=="_rad")
    636     {
    637       pname.Prepend(GetName());
    638       if (sector.GetSize()>0)
    639         {
    640           pname += ";";
    641           for (int i=0; i<sector.GetSize(); i++)
    642             pname += sector[i];
    643         }
    644       if (aidx.GetSize()>0)
    645         {
    646           pname += ";";
    647           for (int i=0; i<aidx.GetSize(); i++)
    648             pname += aidx[i];
    649         }
    650     }
    651  
    652   TProfile *h1=0;
    653  
    654   //check if histogram with identical name exist
    655   TObject *h1obj = gROOT->FindObject(pname);
    656   if (h1obj && h1obj->InheritsFrom("TProfile")) {
    657     h1 = (TProfile*)h1obj;
    658     h1->Reset();
    659   }
    660  
    661   if (!h1)
    662     {
    663      
    664       Double_t min = 0.;
    665       Double_t max = fGeomCam->GetMaxRadius();
    666      
    667       Int_t newbins=0;
    668      
    669       THLimitsFinder::OptimizeLimits(nbins, newbins, min, max, kFALSE);
    670      
    671       h1 = new TProfile(pname, GetTitle(), nbins, min, max);
    672       h1->SetDirectory(pname.IsNull() ? NULL : gROOT);
    673       h1->SetXTitle("Radius from camera center [mm]");
    674       h1->SetYTitle(GetYaxis()->GetTitle());
    675     }
    676  
    677   // Fill the projected histogram
    678   for (Int_t idx=0; idx<fNcells-2; idx++)
    679     if (IsUsed(idx) && MatchSector(idx, sector, aidx))
    680       h1->Fill(TMath::Hypot((*fGeomCam)[idx].GetX(),(*fGeomCam)[idx].GetY()),
    681                GetBinContent(idx+1));
    682   return h1;
     692    // Fill the projected histogram
     693    for (Int_t idx=0; idx<fNcells-2; idx++)
     694        if (IsUsed(idx) && MatchSector(idx, sector, aidx))
     695            h1->Fill(TMath::Hypot((*fGeomCam)[idx].GetX(),(*fGeomCam)[idx].GetY()),
     696                     GetBinContent(idx+1));
     697    return h1;
    683698}
    684699
     
    710725TProfile *MHCamera::AzimuthProfileA(const TArrayI &aidx, const char *name, const Int_t nbins) const
    711726{
    712  
    713   // Create the projection histogram
    714   TString pname(name);
    715   if (name=="_azi")
    716     {
    717       pname.Prepend(GetName());
    718       if (aidx.GetSize()>0)
     727    // Create the projection histogram
     728    TString pname(name);
     729    if (name=="_azi")
     730    {
     731        pname.Prepend(GetName());
     732        if (aidx.GetSize()>0)
    719733        {
    720           pname += ";";
    721           for (int i=0; i<aidx.GetSize(); i++)
    722             pname += aidx[i];
     734            pname += ";";
     735            for (int i=0; i<aidx.GetSize(); i++)
     736                pname += aidx[i];
    723737        }
    724738    }
    725  
    726   TProfile *h1=0;
    727  
    728   //check if histogram with identical name exist
    729   TObject *h1obj = gROOT->FindObject(pname);
    730   if (h1obj && h1obj->InheritsFrom("TProfile")) {
    731     h1 = (TProfile*)h1obj;
    732     h1->Reset();
    733   }
    734  
    735   if (!h1)
    736     {
    737      
    738       Double_t min = -0.5;
    739       Double_t max = 359.5;
    740      
    741       Int_t newbins=0;
    742      
    743       THLimitsFinder::OptimizeLimits(nbins, newbins, min, max, kFALSE);
    744      
    745       h1 = new TProfile(pname, GetTitle(), nbins, min, max);
    746       h1->SetDirectory(pname.IsNull() ? NULL : gROOT);
    747       h1->SetXTitle("Azimuth in camera [deg]");
    748       h1->SetYTitle(GetYaxis()->GetTitle());
    749     }
    750  
    751   // Fill the projected histogram
    752   for (Int_t idx=0; idx<fNcells-2; idx++)
    753     {
    754       if (IsUsed(idx) && MatchSector(idx, TArrayI(), aidx))
    755         h1->Fill(TMath::ATan2((*fGeomCam)[idx].GetY(),(*fGeomCam)[idx].GetX())*180./TMath::Pi()+180.,
    756                  GetPixContent(idx));
    757      
    758     }
    759  
    760   return h1;
     739
     740    TProfile *h1=0;
     741
     742    //check if histogram with identical name exist
     743    TObject *h1obj = gROOT->FindObject(pname);
     744    if (h1obj && h1obj->InheritsFrom("TProfile")) {
     745        h1 = (TProfile*)h1obj;
     746        h1->Reset();
     747    }
     748
     749    if (!h1)
     750    {
     751
     752        h1 = new TProfile;
     753        h1->UseCurrentStyle();
     754        h1->SetName(pname);
     755        h1->SetTitle(GetTitle());
     756        h1->SetDirectory(0);
     757        h1->SetXTitle("Azimuth in camera [deg]");
     758        h1->SetYTitle(GetYaxis()->GetTitle());
     759    }
     760
     761    Double_t min = 0;
     762    Double_t max = 360;
     763
     764    Int_t newbins=0;
     765    THLimitsFinder::OptimizeLimits(nbins, newbins, min, max, kFALSE);
     766
     767    MBinning bins(nbins, min, max);
     768    bins.Apply(*h1);
     769
     770    // Fill the projected histogram
     771    for (Int_t idx=0; idx<fNcells-2; idx++)
     772    {
     773        if (IsUsed(idx) && MatchSector(idx, TArrayI(), aidx))
     774            h1->Fill(TMath::ATan2((*fGeomCam)[idx].GetY(),(*fGeomCam)[idx].GetX())*TMath::RadToDeg()+180,
     775                     GetPixContent(idx));
     776
     777    }
     778
     779    return h1;
    761780}
    762781
     
    15991618        return TObject::GetObjectInfo(px, py);
    16001619
    1601     sprintf(info, "Software Pixel Index: %d (Hardware Id=%d)", idx, idx+1);
     1620    sprintf(info, "Software Pixel Idx: %d (Hardware Id=%d) c=%.1f <%s>",
     1621            idx, idx+1, GetBinContent(idx+1), IsUsed(idx)?"on":"off");
    16021622    return info;
    16031623}
  • trunk/MagicSoft/Mars/mhist/MHCamera.h

    r4883 r5143  
    262262    TH1D    *ProjectionS(const TArrayI &sector, const TArrayI &aidx, const char *name="_py", const Int_t nbins=50) const;
    263263
    264     TProfile *RadialProfile(const char *name="_rad") const { return  RadialProfileS(TArrayI(), TArrayI(), name);}
     264    TProfile *RadialProfile(const char *name="_rad", Int_t nbins=25) const { return  RadialProfileS(TArrayI(), TArrayI(), name, nbins);}
    265265    TProfile *RadialProfileS(Int_t sector, Int_t aidx, const char *name="_rad", const Int_t nbins=25) const
    266266    {
     
    269269    TProfile *RadialProfileS(const TArrayI &sector, const TArrayI &aidx, const char *name="_rad", const Int_t nbins=25) const;
    270270
    271     TProfile *AzimuthProfile(const char *name="_azi") const { return  AzimuthProfileA(TArrayI(), name);  }
     271    TProfile *AzimuthProfile(const char *name="_azi", Int_t nbins=25) const { return  AzimuthProfileA(TArrayI(), name, nbins);  }
    272272    TProfile *AzimuthProfile(Int_t aidx, const char *name="_rad", const Int_t nbins=25) const
    273273      {
  • trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc

    r5035 r5143  
    306306    MBadPixelsTreat        treat;
    307307
    308     MHCamEvent evt0("PedestalFLG");
    309     MHCamEvent evt1("Extra'd");
    310     MHCamEvent evt2("PedPhot");
    311     MHCamEvent evt3("Interp'd");
    312     MHCamEvent evt4("Unsuitable");
    313     MHCamEvent evt5("Times");
    314     evt0.SetType(0);
    315     evt1.SetType(0);
    316     evt2.SetType(0);
    317     evt3.SetType(0);
    318     evt4.SetType(2);
    319     evt5.SetType(0);
     308    MHCamEvent evt0(0, "PedestalFLG", "Pedestal from Lo Gain;;P [fadc/sl]");
     309    MHCamEvent evt1(0, "Extra'd",     "Extracted Signal;;S [fadc/sl]");
     310    MHCamEvent evt2(0, "PedPhot",     "Calibrated Pedestal;;P [\\gamma]");
     311    MHCamEvent evt3(1, "PedRMS",      "Calibrated Pedestal RMS;;\\sigma_{p} [\\gamma]");
     312    MHCamEvent evt4(0, "Interp'd",    "Interpolated Signal;;S [\\gamma]");
     313    MHCamEvent evt5(2, "Unsuitable",  "Unsuitable event ratio;;%");
     314    MHCamEvent evt6(0, "Times",       "Arrival Time;;T [slice]");
     315
    320316    MFillH fill0(&evt0, "MPedestalCam",        "FillPedestalFLG");
    321317    MFillH fill1(&evt1, "MExtractedSignalCam", "FillExtracted");
    322318    MFillH fill2(&evt2, "MPedPhotCam",         "FillPedPhot");
    323     MFillH fill3(&evt3, "MCerPhotEvt",         "FillInterpolated");
    324     MFillH fill4(&evt4, "MBadPixelsCam",       "FillUnsuitable");
    325     MFillH fill5(&evt5, "MArrivalTime",        "FillTimes");
     319    MFillH fill3(&evt3, "MPedPhotCam",         "FillPedRMS");
     320    MFillH fill4(&evt4, "MCerPhotEvt",         "FillInterpolated");
     321    MFillH fill5(&evt5, "MBadPixelsCam",       "FillUnsuitable");
     322    MFillH fill6(&evt6, "MArrivalTime",        "FillTimes");
    326323
    327324    MWriteRootFile write(2, Form("%s{s/_D_/_Y_}", fPathOut.Data()), fOverwrite);
     
    386383    tlist2.AddToList(&fill4);
    387384    tlist2.AddToList(&fill5);
     385    tlist2.AddToList(&fill6);
    388386
    389387    // Setup List for Drive-tree
  • trunk/MagicSoft/Mars/mjobs/MJStar.cc

    r5067 r5143  
    169169    MGeomApply             apply; // Only necessary to craete geometry
    170170    MEventRateCalc         rate;
     171    MEventRateCalc         rate1; // 5min
     172    rate.SetNumEvents(1200);
     173    rate1.SetNumEvents(60000);
     174    rate1.SetNameEventRate("MEventRate2");
     175    rate1.SetNameTimeRate("MTimeRate2");
    171176/*
    172177    MEventRateCalc         rate10000;
     
    179184
    180185    // ------------------ Setup histograms and fill tasks ----------------
    181     MHCamEvent evt0("Cleaned");
     186    MHCamEvent evt0("Cleaned", "Signal after Cleaning;;S [\\gamma]");
    182187    evt0.SetType(0);
    183188
    184189    MH3 h1("MEventRate.fRate");
    185190    h1.SetName("MHEventRate");
     191    h1.SetTitle("Event Rate distribution;R [Hz];Counts");
    186192    h1.SetLogy();
    187193/*
     
    194200    plist.AddToList(&b1);
    195201
    196     MFillH fill0(&evt0, "MCerPhotEvt",            "FillCerPhotEvt");
     202    MHVsTime hvs("MEventRate.fRate");
     203    hvs.SetTitle("Rate per 500 events;R [Hz];Counts");
     204    hvs.SetNumEvents(500);
     205
     206    MContinue cont1("MEventRate2.fRate/MEventRate.fRate>1.1");
     207    MContinue cont2("MEventRate.fRate/MEventRate2.fRate>1.1");
     208
     209    MFillH fillvs(&hvs,           "MTime",        "FillEventRate10s");
     210
     211    MFillH fill0(&evt0,           "MCerPhotEvt",  "FillCerPhotEvt");
    197212    MFillH fill1("MHHillas",      "MHillas",      "FillHillas");
    198213    MFillH fill2("MHHillasExt",   "",             "FillHillasExt");
     
    257272        tlist2.AddToList(&cont);
    258273        tlist2.AddToList(&rate);
    259         //tlist2.AddToList(&rate10000);
     274        tlist2.AddToList(&rate1);
     275        tlist2.AddToList(&fillvs);
     276        tlist2.AddToList(&cont1);
     277        tlist2.AddToList(&cont2);
    260278        tlist2.AddToList(&fill8);
    261279        tlist2.AddToList(&fill9);
  • trunk/MagicSoft/Mars/mmain/MEventDisplay.cc

    r5114 r5143  
    602602        return;
    603603
     604    UnLock();
     605
    604606    //
    605607    // Get parlist
  • trunk/MagicSoft/Mars/msignal/MArrivalTime.cc

    r4828 r5143  
    6363void MArrivalTime::Reset()
    6464{
    65   fData.Reset(-1);
    66   fDataErr.Reset(-1);
     65    fData.Reset(-1);
     66    fDataErr.Reset(-1);
    6767}
    6868
    6969void MArrivalTime::InitSize(const UInt_t i)
    7070{
    71   fData.Set(i);
    72   fDataErr.Set(i);
     71    fData.Set(i);
     72    fDataErr.Set(i);
    7373}
    7474
     
    112112    {
    113113    case 0:
    114     case 1:
    115114        val = fData[idx];
    116115        break;
     116    default:
     117        return kFALSE;
    117118    }
    118119
    119     return kTRUE;
     120    return val>=0;
    120121}
    121122
Note: See TracChangeset for help on using the changeset viewer.