Index: trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.cc
===================================================================
--- trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.cc	(revision 2314)
+++ trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.cc	(revision 2365)
@@ -33,6 +33,7 @@
 #include "MHMcTriggerLvl2.h"
 
-#include <math.h>
-
+#include <TMath.h>
+
+#include <TH2.h>
 #include <TH1.h>
 #include <TF1.h>
@@ -48,27 +49,6 @@
 
 #include "MMcTriggerLvl2.h"
-#include "MGeomCam.h"
-#include "MBinning.h"
 
 using namespace std;
-
-/*
- Please, DON'T USE IFDEFS IN SUCH A CONTEXT, Thomas.
- --------------------------------------------------
-#ifndef COLOR_LINELPS
-#define COLOR_LINELPS Int_t colorlps = 1
-COLOR_LINELPS;
-#endif
-
-#ifndef COLOR_LINESBC
-#define COLOR_LINESBC Int_t colorsbc = 1
-COLOR_LINESBC;
-#endif
-
-#ifndef COLOR_LINEPS
-#define COLOR_LINEPS Int_t colorps = 1
-COLOR_LINEPS;
-#endif
-*/
 
 /* Use this insteadif you want to have some value which is the same for all
@@ -80,4 +60,5 @@
 Int_t MHMcTriggerLvl2::fColorSbc = 1;
 Int_t MHMcTriggerLvl2::fColorPs = 1;
+Int_t MHMcTriggerLvl2::fColorPsE = 1;
 
 ClassImp(MHMcTriggerLvl2);
@@ -95,11 +76,11 @@
     fTitle = title ? title : "Trigger L2 image parameters";
 
-    fHistLutPseudoSize  = new TH1F("fHistLutPseudoSize",  "number of compact pixels in one lut",                13,   0, 12);
-    fHistPseudoSize     = new TH1F("fHistPseudoSize",   "Multiplicity of the cluster identified by the L2T",    41,   0, 40);
-    fHistSizeBiggerCell  = new TH1F("fHistSizeBiggerCell",   "Number of fired pixel in bigger cell",            37,   0, 36);
-
-    fHistLutPseudoSizeNorm  = new TH1F("fHistLutPseudoSizeNorm",  "Normalized Number of compact pixels in one lut",                13,   0, 12);
-    fHistPseudoSizeNorm     = new TH1F("fHistPseudoSizeNorm",   "Normalized Multiplicity of the cluster identified by the L2T",    41,   0, 40);
-    fHistSizeBiggerCellNorm  = new TH1F("fHistSizeBiggerCellNorm",   "Normalized Number of fired pixel in bigger cell",            37,   0, 36);
+    fHistLutPseudoSize  = new TH1F("fHistLutPseudoSize",  "number of compact pixels in one lut",                12,   0, 12);
+    fHistPseudoSize     = new TH1F("fHistPseudoSize",   "Multiplicity of the cluster identified by the L2T",    397,   0, 397);
+    fHistSizeBiggerCell  = new TH1F("fHistSizeBiggerCell",   "Number of fired pixel in bigger cell",            36,   0, 36);
+
+    fHistLutPseudoSizeNorm  = new TH1F("fHistLutPseudoSizeNorm",  "Normalized Number of compact pixels in one lut",                12,   0, 12);
+    fHistPseudoSizeNorm     = new TH1F("fHistPseudoSizeNorm",   "Normalized Multiplicity of the cluster identified by the L2T",    397,   0, 397);
+    fHistSizeBiggerCellNorm  = new TH1F("fHistSizeBiggerCellNorm",   "Normalized Number of fired pixel in bigger cell",            36,   0, 36);
 
     fHistLutPseudoSize->SetDirectory(NULL);
@@ -124,5 +105,12 @@
     fHistSizeBiggerCellNorm->SetYTitle("Counts/Total Counts");
 
-    fFNorm = new TF1("FNorm", "1", -1, 40);
+    fHistPseudoSizeEnergy = new TH2D("fHistPseudoSizeEnergy","Ps Size vs Energy", 40, 1, 5, 397, 0,397);
+ 
+    fHistPseudoSizeEnergy->SetName("fHistPseudoSizeEnergy");
+    fHistPseudoSizeEnergy->SetTitle("PseudoSize vs. Energy");
+    fHistPseudoSizeEnergy->SetXTitle("Log(E[GeV])");
+    fHistPseudoSizeEnergy->SetYTitle("PseudoSize");
+
+    fFNorm = new TF1("FNorm", "1", -1, 397);
 }
 
@@ -139,7 +127,9 @@
     delete fHistPseudoSizeNorm;
     delete fHistSizeBiggerCellNorm;
+    delete fHistPseudoSizeEnergy;
 
     delete fFNorm;
 }
+
 
 // --------------------------------------------------------------------------
@@ -155,7 +145,11 @@
   fHistPseudoSize->Fill(h.GetPseudoSize());
   fHistSizeBiggerCell->Fill(h.GetSizeBiggerCell());
+  //fHistPseudoSizeEnergy->Fill(TMath::Log10(h.GetEnergy()), h.GetPseudoSize());
+  fHistPseudoSizeEnergy->Fill(TMath::Log10(h.GetEnergy()), h.GetLutPseudoSize());
 
   return kTRUE;
 }
+
+
 
 
@@ -186,4 +180,29 @@
     histNorm.SetLineColor(col);
     histNorm.DrawCopy(same?"same":"");
+
+    return c;
+}
+
+
+// --------------------------------------------------------------------------
+//
+// This is the private function member which draw a clone of a 2D-histogram. 
+// This method is called by the DrawClone method.
+//
+TObject *MHMcTriggerLvl2::Draw2DHist(TH1 &hist, const TString &canvasname, Int_t &col) const
+{
+    col++;
+
+    TCanvas *c = (TCanvas*)gROOT->FindObject(canvasname);
+
+    Bool_t same = kTRUE;
+    if (!c)
+    {
+        c = MakeDefCanvas(canvasname,canvasname, 800, 600);
+        same = kFALSE;
+    }
+
+    hist.SetLineColor(col);
+    hist.DrawCopy(same?"same":"");
 
     return c;
@@ -213,5 +232,6 @@
     if (!str.Contains("lps", TString::kIgnoreCase) &&
         !str.Contains("sbc", TString::kIgnoreCase) &&
-        !str.Contains("ps",  TString::kIgnoreCase))
+        !str.Contains("ps",  TString::kIgnoreCase) &&
+        !str.Contains("energy",  TString::kIgnoreCase))
     {
         *fLog << "ARGH!@! Possible options are \"lps\", \"sbc\", \"ps\" or NULL!" <<endl;
@@ -219,17 +239,21 @@
     }
 
-    TH1 *hist=NormalizeHist(fHistLutPseudoSizeNorm, fHistLutPseudoSize);
-
-    if (!hist)
-        return NULL;
-
-    if (str.Contains("lps",TString::kIgnoreCase))
-        return DrawHist(*fHistLutPseudoSize, *hist, "CanvasLPS", fColorLps);
-
-    if (str.Contains("sbc",TString::kIgnoreCase))
-        return DrawHist(*fHistSizeBiggerCell, *hist, "CanvasSBC", fColorSbc);
-
-    if (str.Contains("ps",TString::kIgnoreCase))
-        return DrawHist(*fHistPseudoSize, *hist, "CanvasPS", fColorPs);
+    if (str.Contains("lps",TString::kIgnoreCase)){
+      TH1 *hist=NormalizeHist(fHistLutPseudoSizeNorm, fHistLutPseudoSize);
+      return DrawHist(*fHistLutPseudoSize, *hist, "CanvasLPS", fColorLps);
+    }
+
+    if (str.Contains("sbc",TString::kIgnoreCase)){
+      TH1 *hist=NormalizeHist(fHistSizeBiggerCellNorm, fHistSizeBiggerCell);
+      return DrawHist(*fHistSizeBiggerCell, *hist, "CanvasSBC", fColorSbc);
+    }
+
+    if (str.Contains("ps",TString::kIgnoreCase)){
+      TH1 *hist=NormalizeHist(fHistPseudoSizeNorm, fHistPseudoSize);
+      return DrawHist(*fHistPseudoSize, *hist, "CanvasPS", fColorPs);
+    }
+
+    if (str.Contains("energy",TString::kIgnoreCase))
+      return Draw2DHist(*fHistPseudoSizeEnergy, "CanvasPSE", fColorPsE);
 
     return NULL;
Index: trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.h
===================================================================
--- trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.h	(revision 2314)
+++ trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.h	(revision 2365)
@@ -6,4 +6,5 @@
 #endif
 
+class TH2D;
 class TH1F;
 class TF1;
@@ -20,5 +21,5 @@
     TH1F *fHistSizeBiggerCell;       // Histogram of fSizeBiggerCell
     TH1F *fHistSizeBiggerCellNorm;   // Histogram of fSizeBiggerCell normalized on integral of distribution
-
+    TH2D *fHistPseudoSizeEnergy;           // 2D-Histogram of fPseudoSize vs. Energy
     TF1* fFNorm;                     // Function used to normalize histograms
 
@@ -26,6 +27,8 @@
     static Int_t fColorSbc;
     static Int_t fColorPs;
+    static Int_t fColorPsE;
 
     TObject *DrawHist(TH1 &hist, TH1 &histNorm, const TString &canvasname, Int_t &colore) const;
+    TObject *Draw2DHist(TH1 &hist, const TString &canvasname, Int_t &col) const;
     
 public:
@@ -34,5 +37,5 @@
 
     Bool_t Fill(const MParContainer *par, const Stat_t w=1);
-
+    //    Bool_t Fill(const Double_t energy, const MParContainer *par, const Stat_t w=1);
     TH1 *GetHistByName(const TString name);
 
@@ -43,4 +46,5 @@
     TH1F *GetHistSizeBiggerCell()  const { return fHistSizeBiggerCell; }
     TH1F *GetHistSizeBiggerCellNorm()  const { return fHistSizeBiggerCellNorm; }
+    TH2D *GetHistPseudoSizeEnergy() const { return fHistPseudoSizeEnergy; }
 
     void Draw(Option_t *opt=NULL);
