Changeset 5490 for trunk


Ignore:
Timestamp:
11/28/04 15:46:12 (20 years ago)
Author:
mazin
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mtemp/mmpi
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mtemp/mmpi/MSkyPlot.cc

    r5349 r5490  
    123123#include <TLatex.h>
    124124#include <TCanvas.h>
     125#include <TPaveLabel.h>
    125126#include <TPaveText.h>
    126127#include <TStopwatch.h>
     
    281282    }
    282283
     284    kSaveAlphaPlots=kTRUE;
     285    kSaveSkyPlots=kTRUE;
     286    kSaveNexPlot=kTRUE;
    283287    fAlphaHName = "alphaplot.root";
    284288    fSkyHName   = "skyplot.root";
     289    fNexHName   = "Nexcess.gif";
    285290}
    286291
     
    352357    fMinYGrid    = ymin;
    353358    fMaxYGrid    = ymax;
     359   
     360    *fLog << endl <<  inf << " SetSkyPlot: fMinXGrid, fMaxXGrid, fMinYGrid, fMaxYGrid, fBinStepGrid: " << endl;
     361    *fLog << inf << "           " << fMinXGrid << ", " << fMaxXGrid << ", " << fMinYGrid << ", "
     362                 << fMaxYGrid<< ", " << fBinStepGrid << endl;
    354363}
    355364
     
    473482    // for the current pointing position and add a offset in the
    474483    // Fill function!
    475     kSaveAlphaPlots=kTRUE;
    476     kSaveSkyPlots=kTRUE;
    477484
    478485   // prepare skyplot
     
    480487    fNumStepsY     =  (int) ((fMaxYGrid - fMinYGrid) / fBinStepGrid + 1.5);
    481488    fNumalphahist  =  (int) (fNumStepsX * fNumStepsY  + 0.5);
     489
     490    *fLog << inf << "SetSkyPlot: fNumStepsX, fNumStepsY, fNumalphahist: "
     491                 << fNumStepsX << ", " << fNumStepsY << ", " << fNumalphahist << endl;
    482492
    483493   // fHistSignif.SetName("SPSignif2ndOrder");
     
    519529        fHistAlpha[i].SetDirectory(NULL);
    520530    }
     531//cout  << " fHistAlpha[10].GetBinContent(5) " << fHistAlpha[10].GetBinContent(5) << endl;
    521532
    522533    delete temp;
     
    626637*/
    627638
     639// make the center of the plot different from the center of the camera
    628640/*
    629641    x_0 = fPntPosCam->GetX()*fMm2Deg;
    630642    y_0 = fPntPosCam->GetY()*fMm2Deg;
    631643*/     
    632     x_0 = 0.;
     644    x_0 = 0.; 
    633645    y_0 = 0.;
    634646
     
    641653        for (Int_t gridx = 0; gridx < fNumStepsX; gridx++)
    642654        {
     655
    643656           xsource = fMinXGrid + gridx * fBinStepGrid;
     657
    644658 /*     derotation    : rotate  into camera coordinates */
    645659 /*     formel: (x_cam)    (cos(gam)  -sin(gam))   (xtilde)   (x_0)
     
    649663           xsourcam = cosgam * xsource - singam * ysource + x_0;
    650664           ysourcam = singam * xsource + cosgam * ysource + y_0;
     665
     666
    651667 /*    end derotatiom    */
     668//           xsourcam = xsource;
     669//           ysourcam = ysource;
    652670
    653671       /* calculate ALPHA und DIST according to the source position */
     
    698716    const Int_t onbinsalpha = TMath::Nint(fAlphaONMax/fHistAlphaBinWidth);
    699717
    700 // fit with gaus
    701     fHistSignifGaus.Fit("gaus");
    702718
    703719// fit function for the background
     
    713729    alpha_iterator = fHistAlpha.begin();
    714730
     731    fHistNexcess.Reset();
     732    fHistOn.Reset();
     733    fHistSignif.Reset();   
     734    fHistSignifGaus.Reset();
     735   
    715736    while( alpha_iterator != fHistAlpha.end() ) {
    716737         // find the bin in the 2dim histogram
     
    751772    }
    752773
     774// fit with gaus
     775    fHistSignifGaus.Fit("gaus","N");
     776
     777
    753778//temp
    754779/*
     
    770795//  TString stri2 = "skyplots.root";
    771796  if(kSaveSkyPlots==kTRUE) SaveSkyPlots(fSkyHName);
     797
     798// save nex plot:
     799  if(kSaveNexPlot==kTRUE) SaveNexPlot(fNexHName);
    772800
    773801  fHistAlpha.clear();
     
    800828}
    801829
     830void MSkyPlot::SaveNexPlot(TString nexplotname)
     831{
     832    gStyle->SetCanvasBorderMode(0);
     833    gStyle->SetCanvasBorderSize(0);
     834    gStyle->SetCanvasColor(10);
     835//    gStyle->SetPadBorderMode(0);
     836//    gStyle->SetPadBorderSize(0);
     837    gStyle->SetPadColor(10);
     838    gStyle->SetOptFit(0);
     839    gStyle->SetOptStat(0);
     840    gStyle->SetStatColor(10);
     841    gStyle->SetPalette(1);
     842    gStyle->SetPadRightMargin(0.16);
     843    gStyle->SetPadLeftMargin(0.13);
     844
     845    TH2D tmp = fHistNexcess;
     846    tmp.SetMaximum(470);
     847    tmp.SetMinimum(-90);
     848    TCanvas can("SkyPlot","SkyPlot", 0, 0, 800, 400);
     849    can.Divide(2,1);
     850    can.cd(1);
     851    tmp.GetYaxis()->SetTitleOffset(1.3);
     852    tmp.Draw("colz");
     853    TPaveLabel myname(fMinXGrid-0.5,fMinYGrid-0.4,fMinXGrid+0.3,fMinYGrid-0.2,"by D. Mazin");
     854    myname.Draw();
     855
     856    can.cd(2);
     857    fHistNexcess.SetMaximum(470);   
     858    fHistNexcess.SetMinimum(-40);   
     859    fHistNexcess.GetXaxis()->SetTitleOffset(1.3);
     860    fHistNexcess.GetYaxis()->SetTitleOffset(1.6);
     861    gPad->SetTheta(20);
     862    fHistNexcess.Draw("lego2");
     863    can.Print(nexplotname); 
     864//    can.Print("test.root");
     865}
    802866
    803867void MSkyPlot::SaveSkyPlots(TString skyplotfilename)
  • trunk/MagicSoft/Mars/mtemp/mmpi/MSkyPlot.h

    r5349 r5490  
    8080    Bool_t kSaveAlphaPlots;
    8181    Bool_t kSaveSkyPlots;
     82    Bool_t kSaveNexPlot;
    8283
    8384    Float_t fMinXGrid;                  //  [deg] , left edge of the skyplot
     
    105106    TString fAlphaHName;          // name for histogram with alpha plots
    106107    TString fSkyHName;            // name for histogram with sky plots
     108    TString fNexHName;            // name for canvas with Nex plot
    107109
    108110    Int_t DistancetoPrimitive(Int_t px, Int_t py);
     
    128130    void SetSizeMin(Float_t size) { fSizeMin = size; } // Absolute minimum Size
    129131    void SetSizeMax(Float_t size) { fSizeMax = size; } // Absolute maximum Size
    130 //    void SetMinLD(Float_t ratio)  { fMinLD = ratio; }  // Minimum ratio between length/dist
    131 //    void SetMaxLD(Float_t ratio)  { fMaxLD = ratio; }  // Maximum ratio between length/dist
    132132    void ReadCuts(const TString parSCinit);
    133133    void SetSkyPlot(Float_t xmin, Float_t xmax, Float_t ymin, Float_t ymax, Float_t step);
    134134    Double_t CalcLimit(Double_t *a, Double_t ls, Double_t ls2, Double_t dd2);
    135     //void SaveSkyPlots(const TString skyplotfilename="skyplots.root");
     135
     136    void SetOutputSkyName(TString outname2)     { fSkyHName = outname2; }
     137    void SaveSkyPlots(TString stri);
     138    void SetNotSaveSkyPlots()                   { kSaveSkyPlots = kFALSE; }
     139
    136140
    137141    void SetOutputAlphaName(TString outname1)   { fAlphaHName = outname1; }
    138     void SaveSkyPlots(TString stri);
     142    void SaveAlphaPlots(const TString stri2);
     143    void SetNotSaveAlphaPlots()                 { kSaveAlphaPlots = kFALSE; }
    139144
     145    void SetOutputNexName(TString outname3)     { fNexHName = outname3; }
     146    void SaveNexPlot(const TString stri3);
     147    void SetNotSaveNexPlot()                    { kSaveNexPlot = kFALSE; }
    140148
    141     //void SaveAlphaPlots(const TString alphaplotfilename="alphaplots.root");
    142     void SetOutputSkyName(TString outname2)     { fSkyHName = outname2; }
    143     void SaveAlphaPlots(const TString stri2);
    144149
    145150    void SetAlphaCut(Float_t alpha);
Note: See TracChangeset for help on using the changeset viewer.