Changeset 4303


Ignore:
Timestamp:
06/17/04 19:51:18 (20 years ago)
Author:
reyes
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4301 r4303  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20
     21 2004/06/17: Markus Gaug
     22
     23  * mjobs/MJPedestal.[h,cc]
     24    - adapted display for the datacheck
     25
    2026
    2127 2004/06/17: Markus Gaug
  • trunk/MagicSoft/Mars/mjobs/MJPedestal.cc

    r4301 r4303  
    3333#include <TF1.h>
    3434#include <TFile.h>
    35 #include <TStyle.h>
    3635#include <TString.h>
    3736#include <TCanvas.h>
    3837#include <TSystem.h>
     38#include <TLine.h>
     39#include <TLegend.h>
     40#include <TLatex.h>
    3941
    4042#include "MLog.h"
     
    6870const Double_t MJPedestal::fgPedRmsMin   = 0.;
    6971const Double_t MJPedestal::fgPedRmsMax   = 20.;
     72const Float_t  MJPedestal::fgRefPedClosedLids    = 9.635;
     73const Float_t  MJPedestal::fgRefPedExtraGalactic = 9.93;
     74const Float_t  MJPedestal::fgRefPedGalactic      = 10.03;
     75const Float_t  MJPedestal::fgRefPedRmsClosedLids = 1.7;
     76const Float_t  MJPedestal::fgRefPedRmsExtraGalactic = 5.6;
     77const Float_t  MJPedestal::fgRefPedRmsGalactic      = 6.92;
    7078// --------------------------------------------------------------------------
    7179//
     
    173181    if (fDataCheck)
    174182      {
     183
    175184        c3.cd(1);
    176185        gPad->SetBorderMode(0);
     
    178187        MHCamera *obj1=(MHCamera*)disp0.DrawCopy("hist");
    179188        obj1->SetDirectory(NULL);
     189        //
     190        // for the datacheck, fix the ranges!!
     191        //
    180192        obj1->SetMinimum(fgPedestalMin);
    181193        obj1->SetMaximum(fgPedestalMax);
    182         gPad->Modified();
    183         gPad->Update();
    184 
     194        //
     195        // set reference lines
     196        //
     197        DisplayReferenceLines(obj1,0);
     198        //
     199        // end reference lines
     200        //
    185201        c3.cd(3);
    186202        gPad->SetBorderMode(0);
     
    191207        gPad->SetBorderMode(0);
    192208        gPad->SetTicks();
    193         disp0.DrawProjection(7);
    194         gPad->Modified();
    195         gPad->Update();
     209        obj1->DrawProjection(7);
    196210
    197211        c3.cd(2);
     
    202216        obj2->SetMinimum(fgPedRmsMin);
    203217        obj2->SetMaximum(fgPedRmsMax);
    204         gPad->Modified();
    205         gPad->Update();
     218        //
     219        // set reference lines
     220        //
     221        DisplayReferenceLines(obj1,1);
    206222
    207223        c3.cd(4);
     
    213229        gPad->SetBorderMode(0);
    214230        gPad->SetTicks();
    215         disp1.DrawProjection(6);
    216 
     231
     232        TArrayI inner(1);
     233        inner[0] = 0;
     234       
     235        TArrayI outer(1);
     236        outer[0] = 1;
     237
     238        if (geomcam.InheritsFrom("MGeomCamMagic"))
     239        {
     240          TArrayI s0(6);
     241          s0[0] = 6;
     242          s0[1] = 1;
     243          s0[2] = 2;
     244          s0[3] = 3;
     245          s0[4] = 4;
     246          s0[5] = 5;
     247
     248          TArrayI s1(3);
     249          s1[0] = 6;
     250          s1[1] = 1;
     251          s1[2] = 2;
     252         
     253          TArrayI s2(3);
     254          s2[0] = 3;
     255          s2[1] = 4;
     256          s2[2] = 5;
     257
     258          gPad->Clear();
     259          TVirtualPad *pad = gPad;
     260          pad->Divide(2,1);
     261         
     262          TH1D *inout[2];
     263          inout[0] = disp1.ProjectionS(s0, inner, "Inner");
     264          inout[1] = disp1.ProjectionS(s0, outer, "Outer");
     265         
     266          inout[0]->SetDirectory(NULL);
     267          inout[1]->SetDirectory(NULL);
     268
     269          for (int i=0; i<2; i++)
     270            {
     271              TLegend *leg2 = new TLegend(0.6,0.2,0.9,0.55);
     272              leg2->SetHeader(inout[i]->GetName());
     273              pad->cd(i+1);
     274              inout[i]->SetLineColor(kRed+i);
     275              inout[i]->SetBit(kCanDelete);
     276              inout[i]->Draw();
     277              inout[i]->Fit("gaus","Q");
     278              leg2->AddEntry(inout[i],inout[i]->GetName(),"l");
     279             
     280              //
     281              // Display the outliers as dead and noisy pixels
     282              //
     283              DisplayOutliers(inout[i]);
     284
     285              //
     286              // Display the two half of the camera separately
     287              //
     288              TH1D *half[2];
     289              half[0] = disp1.ProjectionS(s1, i==0 ? inner : outer , "Sector 6-1-2");
     290              half[1] = disp1.ProjectionS(s2, i==0 ? inner : outer , "Sector 3-4-5");
     291             
     292              for (int j=0; j<2; j++)
     293                {
     294                  half[j]->SetLineColor(kRed+i+2*j+1);
     295                  half[j]->SetDirectory(NULL);
     296                  half[j]->SetBit(kCanDelete);
     297                  half[j]->Draw("same");
     298                  leg2->AddEntry(half[j],half[j]->GetName(),"l");
     299                }
     300              leg2->Draw();
     301            }
     302        }
    217303      }
    218304    else
     
    221307        disp1.CamDraw(c3, 2, 2, 6);
    222308      }
     309}
     310
     311void  MJPedestal::DisplayReferenceLines(MHCamera *cam, const Int_t what) const
     312{
     313
     314  TLine *gala = new TLine(0,
     315                          what ? fgRefPedRmsGalactic : fgRefPedGalactic,cam->GetNbinsX(),
     316                          what ? fgRefPedRmsGalactic : fgRefPedGalactic);
     317  gala->SetBit(kCanDelete);
     318  gala->SetLineColor(4);
     319  gala->SetLineStyle(2);
     320  gala->SetLineWidth(3);
     321  gala->Draw();
     322  TLine *extr = new TLine(0,
     323                          what ? fgRefPedRmsExtraGalactic : fgRefPedExtraGalactic,cam->GetNbinsX(),
     324                          what ? fgRefPedRmsExtraGalactic : fgRefPedExtraGalactic); 
     325  extr->SetBit(kCanDelete);
     326  extr->SetLineColor(5);
     327  extr->SetLineStyle(2);
     328  extr->SetLineWidth(3);
     329  extr->Draw();
     330  TLine *close = new TLine(0,
     331                          what ? fgRefPedRmsClosedLids : fgRefPedClosedLids,cam->GetNbinsX(),
     332                          what ? fgRefPedRmsClosedLids : fgRefPedClosedLids); 
     333  close->SetBit(kCanDelete);
     334  close->SetLineColor(6);
     335  close->SetLineStyle(2);
     336  close->SetLineWidth(3);
     337  close->Draw();
     338  TLegend *leg = new TLegend(0.4,0.75,0.7,0.99);
     339  leg->SetBit(kCanDelete);
     340  leg->AddEntry(gala,"Galactic Source","l");
     341  leg->AddEntry(extr,"Extra-Galactic Source","l");
     342  leg->AddEntry(close,"Closed Lids","l");
     343  leg->Draw();
     344}
     345
     346void  MJPedestal::DisplayOutliers(TH1D *hist) const
     347{
     348 
     349  const Float_t mean  = hist->GetFunction("gaus")->GetParameter(1);
     350  const Float_t lolim = mean - 3.5*hist->GetFunction("gaus")->GetParameter(2);
     351  const Float_t uplim = mean + 3.5*hist->GetFunction("gaus")->GetParameter(2);
     352  const Stat_t  dead  = hist->Integral(0,hist->FindBin(lolim)-1);
     353  const Stat_t  noisy = hist->Integral(hist->FindBin(uplim)+1,hist->GetNbinsX()+1);
     354             
     355  TLatex deadtex;
     356  deadtex.SetTextSize(0.06);
     357  deadtex.DrawLatex(0.1,hist->GetBinContent(hist->GetMaximumBin())/1.1,Form("%3i dead pixels",(Int_t)dead));
     358 
     359  TLatex noisytex;
     360  noisytex.SetTextSize(0.06);
     361  noisytex.DrawLatex(0.1,hist->GetBinContent(hist->GetMaximumBin())/1.2,Form("%3i noisy pixels",(Int_t)noisy));
     362 
    223363}
    224364
  • trunk/MagicSoft/Mars/mjobs/MJPedestal.h

    r4301 r4303  
    1313class MRunIter;
    1414class MHCamera;
     15class TH1D;
    1516class MExtractor;
    1617class MJPedestal : public MParContainer 
     
    2223  static const Double_t fgPedRmsMin;
    2324  static const Double_t fgPedRmsMax; 
     25
     26  static const Float_t  fgRefPedClosedLids;
     27  static const Float_t  fgRefPedExtraGalactic;
     28  static const Float_t  fgRefPedGalactic;
     29
     30  static const Float_t  fgRefPedRmsClosedLids;
     31  static const Float_t  fgRefPedRmsExtraGalactic;
     32  static const Float_t  fgRefPedRmsGalactic;
    2433
    2534  TString fOutputPath;
     
    3746 
    3847  void   DisplayResult(MParList &plist);
     48  void   DisplayReferenceLines(MHCamera *cam, const Int_t what) const;
     49  void   DisplayOutliers(      TH1D *hist) const;
    3950 
    4051public:
Note: See TracChangeset for help on using the changeset viewer.