Ignore:
Timestamp:
09/29/03 17:39:49 (21 years ago)
Author:
stamerra
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhistmc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.cc

    r2173 r2365  
    3333#include "MHMcTriggerLvl2.h"
    3434
    35 #include <math.h>
    36 
     35#include <TMath.h>
     36
     37#include <TH2.h>
    3738#include <TH1.h>
    3839#include <TF1.h>
     
    4849
    4950#include "MMcTriggerLvl2.h"
    50 #include "MGeomCam.h"
    51 #include "MBinning.h"
    5251
    5352using namespace std;
    54 
    55 /*
    56  Please, DON'T USE IFDEFS IN SUCH A CONTEXT, Thomas.
    57  --------------------------------------------------
    58 #ifndef COLOR_LINELPS
    59 #define COLOR_LINELPS Int_t colorlps = 1
    60 COLOR_LINELPS;
    61 #endif
    62 
    63 #ifndef COLOR_LINESBC
    64 #define COLOR_LINESBC Int_t colorsbc = 1
    65 COLOR_LINESBC;
    66 #endif
    67 
    68 #ifndef COLOR_LINEPS
    69 #define COLOR_LINEPS Int_t colorps = 1
    70 COLOR_LINEPS;
    71 #endif
    72 */
    7353
    7454/* Use this insteadif you want to have some value which is the same for all
     
    8060Int_t MHMcTriggerLvl2::fColorSbc = 1;
    8161Int_t MHMcTriggerLvl2::fColorPs = 1;
     62Int_t MHMcTriggerLvl2::fColorPsE = 1;
    8263
    8364ClassImp(MHMcTriggerLvl2);
     
    9576    fTitle = title ? title : "Trigger L2 image parameters";
    9677
    97     fHistLutPseudoSize  = new TH1F("fHistLutPseudoSize",  "number of compact pixels in one lut",                13,   0, 12);
    98     fHistPseudoSize     = new TH1F("fHistPseudoSize",   "Multiplicity of the cluster identified by the L2T",    41,   0, 40);
    99     fHistSizeBiggerCell  = new TH1F("fHistSizeBiggerCell",   "Number of fired pixel in bigger cell",            37,   0, 36);
    100 
    101     fHistLutPseudoSizeNorm  = new TH1F("fHistLutPseudoSizeNorm",  "Normalized Number of compact pixels in one lut",                13,   0, 12);
    102     fHistPseudoSizeNorm     = new TH1F("fHistPseudoSizeNorm",   "Normalized Multiplicity of the cluster identified by the L2T",    41,   0, 40);
    103     fHistSizeBiggerCellNorm  = new TH1F("fHistSizeBiggerCellNorm",   "Normalized Number of fired pixel in bigger cell",            37,   0, 36);
     78    fHistLutPseudoSize  = new TH1F("fHistLutPseudoSize",  "number of compact pixels in one lut",                12,   0, 12);
     79    fHistPseudoSize     = new TH1F("fHistPseudoSize",   "Multiplicity of the cluster identified by the L2T",    397,   0, 397);
     80    fHistSizeBiggerCell  = new TH1F("fHistSizeBiggerCell",   "Number of fired pixel in bigger cell",            36,   0, 36);
     81
     82    fHistLutPseudoSizeNorm  = new TH1F("fHistLutPseudoSizeNorm",  "Normalized Number of compact pixels in one lut",                12,   0, 12);
     83    fHistPseudoSizeNorm     = new TH1F("fHistPseudoSizeNorm",   "Normalized Multiplicity of the cluster identified by the L2T",    397,   0, 397);
     84    fHistSizeBiggerCellNorm  = new TH1F("fHistSizeBiggerCellNorm",   "Normalized Number of fired pixel in bigger cell",            36,   0, 36);
    10485
    10586    fHistLutPseudoSize->SetDirectory(NULL);
     
    124105    fHistSizeBiggerCellNorm->SetYTitle("Counts/Total Counts");
    125106
    126     fFNorm = new TF1("FNorm", "1", -1, 40);
     107    fHistPseudoSizeEnergy = new TH2D("fHistPseudoSizeEnergy","Ps Size vs Energy", 40, 1, 5, 397, 0,397);
     108 
     109    fHistPseudoSizeEnergy->SetName("fHistPseudoSizeEnergy");
     110    fHistPseudoSizeEnergy->SetTitle("PseudoSize vs. Energy");
     111    fHistPseudoSizeEnergy->SetXTitle("Log(E[GeV])");
     112    fHistPseudoSizeEnergy->SetYTitle("PseudoSize");
     113
     114    fFNorm = new TF1("FNorm", "1", -1, 397);
    127115}
    128116
     
    139127    delete fHistPseudoSizeNorm;
    140128    delete fHistSizeBiggerCellNorm;
     129    delete fHistPseudoSizeEnergy;
    141130
    142131    delete fFNorm;
    143132}
     133
    144134
    145135// --------------------------------------------------------------------------
     
    155145  fHistPseudoSize->Fill(h.GetPseudoSize());
    156146  fHistSizeBiggerCell->Fill(h.GetSizeBiggerCell());
     147  //fHistPseudoSizeEnergy->Fill(TMath::Log10(h.GetEnergy()), h.GetPseudoSize());
     148  fHistPseudoSizeEnergy->Fill(TMath::Log10(h.GetEnergy()), h.GetLutPseudoSize());
    157149
    158150  return kTRUE;
    159151}
     152
     153
    160154
    161155
     
    186180    histNorm.SetLineColor(col);
    187181    histNorm.DrawCopy(same?"same":"");
     182
     183    return c;
     184}
     185
     186
     187// --------------------------------------------------------------------------
     188//
     189// This is the private function member which draw a clone of a 2D-histogram.
     190// This method is called by the DrawClone method.
     191//
     192TObject *MHMcTriggerLvl2::Draw2DHist(TH1 &hist, const TString &canvasname, Int_t &col) const
     193{
     194    col++;
     195
     196    TCanvas *c = (TCanvas*)gROOT->FindObject(canvasname);
     197
     198    Bool_t same = kTRUE;
     199    if (!c)
     200    {
     201        c = MakeDefCanvas(canvasname,canvasname, 800, 600);
     202        same = kFALSE;
     203    }
     204
     205    hist.SetLineColor(col);
     206    hist.DrawCopy(same?"same":"");
    188207
    189208    return c;
     
    213232    if (!str.Contains("lps", TString::kIgnoreCase) &&
    214233        !str.Contains("sbc", TString::kIgnoreCase) &&
    215         !str.Contains("ps",  TString::kIgnoreCase))
     234        !str.Contains("ps",  TString::kIgnoreCase) &&
     235        !str.Contains("energy",  TString::kIgnoreCase))
    216236    {
    217237        *fLog << "ARGH!@! Possible options are \"lps\", \"sbc\", \"ps\" or NULL!" <<endl;
     
    219239    }
    220240
    221     TH1 *hist=NormalizeHist(fHistLutPseudoSizeNorm, fHistLutPseudoSize);
    222 
    223     if (!hist)
    224         return NULL;
    225 
    226     if (str.Contains("lps",TString::kIgnoreCase))
    227         return DrawHist(*fHistLutPseudoSize, *hist, "CanvasLPS", fColorLps);
    228 
    229     if (str.Contains("sbc",TString::kIgnoreCase))
    230         return DrawHist(*fHistSizeBiggerCell, *hist, "CanvasSBC", fColorSbc);
    231 
    232     if (str.Contains("ps",TString::kIgnoreCase))
    233         return DrawHist(*fHistPseudoSize, *hist, "CanvasPS", fColorPs);
     241    if (str.Contains("lps",TString::kIgnoreCase)){
     242      TH1 *hist=NormalizeHist(fHistLutPseudoSizeNorm, fHistLutPseudoSize);
     243      return DrawHist(*fHistLutPseudoSize, *hist, "CanvasLPS", fColorLps);
     244    }
     245
     246    if (str.Contains("sbc",TString::kIgnoreCase)){
     247      TH1 *hist=NormalizeHist(fHistSizeBiggerCellNorm, fHistSizeBiggerCell);
     248      return DrawHist(*fHistSizeBiggerCell, *hist, "CanvasSBC", fColorSbc);
     249    }
     250
     251    if (str.Contains("ps",TString::kIgnoreCase)){
     252      TH1 *hist=NormalizeHist(fHistPseudoSizeNorm, fHistPseudoSize);
     253      return DrawHist(*fHistPseudoSize, *hist, "CanvasPS", fColorPs);
     254    }
     255
     256    if (str.Contains("energy",TString::kIgnoreCase))
     257      return Draw2DHist(*fHistPseudoSizeEnergy, "CanvasPSE", fColorPsE);
    234258
    235259    return NULL;
  • trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.h

    r2043 r2365  
    66#endif
    77
     8class TH2D;
    89class TH1F;
    910class TF1;
     
    2021    TH1F *fHistSizeBiggerCell;       // Histogram of fSizeBiggerCell
    2122    TH1F *fHistSizeBiggerCellNorm;   // Histogram of fSizeBiggerCell normalized on integral of distribution
    22 
     23    TH2D *fHistPseudoSizeEnergy;           // 2D-Histogram of fPseudoSize vs. Energy
    2324    TF1* fFNorm;                     // Function used to normalize histograms
    2425
     
    2627    static Int_t fColorSbc;
    2728    static Int_t fColorPs;
     29    static Int_t fColorPsE;
    2830
    2931    TObject *DrawHist(TH1 &hist, TH1 &histNorm, const TString &canvasname, Int_t &colore) const;
     32    TObject *Draw2DHist(TH1 &hist, const TString &canvasname, Int_t &col) const;
    3033   
    3134public:
     
    3437
    3538    Bool_t Fill(const MParContainer *par, const Stat_t w=1);
    36 
     39    //    Bool_t Fill(const Double_t energy, const MParContainer *par, const Stat_t w=1);
    3740    TH1 *GetHistByName(const TString name);
    3841
     
    4346    TH1F *GetHistSizeBiggerCell()  const { return fHistSizeBiggerCell; }
    4447    TH1F *GetHistSizeBiggerCellNorm()  const { return fHistSizeBiggerCellNorm; }
     48    TH2D *GetHistPseudoSizeEnergy() const { return fHistPseudoSizeEnergy; }
    4549
    4650    void Draw(Option_t *opt=NULL);
Note: See TracChangeset for help on using the changeset viewer.