Index: trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.cc
===================================================================
--- trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.cc	(revision 2800)
+++ trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.cc	(revision 2953)
@@ -58,7 +58,9 @@
 
 Int_t MHMcTriggerLvl2::fColorLps = 1;
+Int_t MHMcTriggerLvl2::fColorCps = 1;
 Int_t MHMcTriggerLvl2::fColorSbc = 1;
 Int_t MHMcTriggerLvl2::fColorPs = 1;
 Int_t MHMcTriggerLvl2::fColorPsE = 1;
+Int_t MHMcTriggerLvl2::fColorCPsE = 1;
 Int_t MHMcTriggerLvl2::fColorLPsE = 1;
 Int_t MHMcTriggerLvl2::fColorSBCE = 1;
@@ -79,11 +81,13 @@
     fTitle = title ? title : "Trigger L2 image parameters";
 
-    fHistLutPseudoSize  = new TH1F("fHistLutPseudoSize",  "number of compact pixels in one lut",                13,   0, 13);
-    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",            37,   0, 37);
-
-    fHistLutPseudoSizeNorm  = new TH1F("fHistLutPseudoSizeNorm",  "Normalized Number of compact pixels in one lut",                13,   0, 13);
-    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",            37,   0, 37);
+    fHistLutPseudoSize = new TH1F("fHistLutPseudoSize",  "Lut Pseudo Size",                13,   0, 13);
+    fHistPseudoSize = new TH1F("fHistPseudoSize",   "Pseudo Size",    397,   0, 397);
+    fHistCellPseudoSize = new TH1F("fHistCellPseudoSize",   "Cell Pseudo Size",    37,   0, 37);
+    fHistSizeBiggerCell = new TH1F("fHistSizeBiggerCell",   "Size in Bigger Cell",            37,   0, 37);
+
+    fHistLutPseudoSizeNorm = new TH1F("fHistLutPseudoSizeNorm",  "Normalized Lut Pseudo Size",                13,   0, 13);
+    fHistPseudoSizeNorm = new TH1F("fHistPseudoSizeNorm",   "Normalized Pseudo Size",    397,   0, 397);
+    fHistSizeBiggerCellNorm = new TH1F("fHistSizeBiggerCellNorm",   "Normalized Size in Bigger Cell",            37,   0, 37);
+    fHistCellPseudoSizeNorm = new TH1F("fHistCellPseudoSizeNorm",   "Normalized Cell Pseudo Size",    37,   0, 37);
 
     fHistLutPseudoSize->SetDirectory(NULL);
@@ -93,4 +97,6 @@
     fHistSizeBiggerCell->SetDirectory(NULL);
     fHistSizeBiggerCellNorm->SetDirectory(NULL);
+    fHistCellPseudoSize->SetDirectory(NULL);
+    fHistCellPseudoSizeNorm->SetDirectory(NULL);
 
     fHistLutPseudoSize->SetXTitle("Number of Pixels");
@@ -100,4 +106,6 @@
     fHistSizeBiggerCell->SetXTitle("Number of Pixels");
     fHistSizeBiggerCellNorm->SetXTitle("Number of Pixels");
+    fHistCellPseudoSize->SetXTitle("Number of Pixels");
+    fHistCellPseudoSizeNorm->SetXTitle("Number of Pixels");
 
     fHistLutPseudoSize->SetYTitle("Counts");
@@ -107,6 +115,9 @@
     fHistSizeBiggerCell->SetYTitle("Counts");
     fHistSizeBiggerCellNorm->SetYTitle("Counts/Total Counts");
+    fHistCellPseudoSize->SetYTitle("Counts");
+    fHistCellPseudoSizeNorm->SetYTitle("Counts/Total Counts");
 
     fHistPseudoSizeEnergy = new TH2D("fHistPseudoSizeEnergy","Ps Size vs Energy", 40, 1, 5, 397, 0,397);
+    fHistCellPseudoSizeEnergy = new TH2D("fHistCellPseudoSizeEnergy","CPS Size vs Energy", 40, 1, 5, 397, 0,397);
     fHistLutPseudoSizeEnergy = new TH2D("fHistLutPseudoSizeEnergy","Ps Size vs Energy", 40, 1, 5, 397, 0,397);
     fHistSizeBiggerCellEnergy = new TH2D("fHistSizeBiggerCellEnergy","Ps Size vs Energy", 40, 1, 5, 397, 0,397);
@@ -117,4 +128,9 @@
     fHistPseudoSizeEnergy->SetYTitle("PseudoSize");
 
+    fHistCellPseudoSizeEnergy->SetName("fHistCellPseudoSizeEnergy");
+    fHistCellPseudoSizeEnergy->SetTitle("CellPseudoSize vs. Energy");
+    fHistCellPseudoSizeEnergy->SetXTitle("Log(E[GeV])");
+    fHistCellPseudoSizeEnergy->SetYTitle("CellPseudoSize");
+
     fHistLutPseudoSizeEnergy->SetName("fHistLutPseudoSizeEnergy");
     fHistLutPseudoSizeEnergy->SetTitle("LutPseudoSize vs. Energy");
@@ -141,9 +157,12 @@
     delete fHistLutPseudoSize;
     delete fHistPseudoSize;
+    delete fHistCellPseudoSize;
     delete fHistSizeBiggerCell;
     delete fHistLutPseudoSizeNorm;
     delete fHistPseudoSizeNorm;
+    delete fHistCellPseudoSizeNorm;
     delete fHistSizeBiggerCellNorm;
     delete fHistPseudoSizeEnergy;
+    delete fHistCellPseudoSizeEnergy;
     delete fHistLutPseudoSizeEnergy;
     delete fHistSizeBiggerCellEnergy;
@@ -163,6 +182,8 @@
   fHistLutPseudoSize->Fill(h.GetLutPseudoSize());
   fHistPseudoSize->Fill(h.GetPseudoSize());
+  fHistCellPseudoSize->Fill(h.GetCellPseudoSize());
   fHistSizeBiggerCell->Fill(h.GetSizeBiggerCell());
   fHistPseudoSizeEnergy->Fill(TMath::Log10(h.GetEnergy()), h.GetPseudoSize());
+  fHistCellPseudoSizeEnergy->Fill(TMath::Log10(h.GetEnergy()), h.GetCellPseudoSize());
   fHistLutPseudoSizeEnergy->Fill(TMath::Log10(h.GetEnergy()), h.GetLutPseudoSize());
   fHistSizeBiggerCellEnergy->Fill(TMath::Log10(h.GetEnergy()), h.GetSizeBiggerCell());
@@ -255,26 +276,33 @@
 
     if (!str.Contains("lps", TString::kIgnoreCase) &&
+	!str.Contains("cps", TString::kIgnoreCase) &&
         !str.Contains("sbc", TString::kIgnoreCase) &&
         !str.Contains("ps",  TString::kIgnoreCase) &&
         !str.Contains("lut-energy",  TString::kIgnoreCase) &&
 	!str.Contains("size-energy",  TString::kIgnoreCase) &&
+	!str.Contains("cellsize-energy",  TString::kIgnoreCase) &&
 	!str.Contains("big-energy",  TString::kIgnoreCase))
     {
-        *fLog << "ARGH!@! Possible options are \"lps\", \"sbc\", \"ps\", \"lut-energy\", \"size-energy\", \"big-energy\" or NULL!" <<endl;
+        *fLog << "ARGH!@! Possible options are \"lps\", \"cps\", \"sbc\", \"ps\", \"lut-energy\", \"size-energy\", \"cellsize-energy\", \"big-energy\" or NULL!" <<endl;
         return NULL;
     }
 
     if (str.Contains("lps",TString::kIgnoreCase)){
-      TH1 *hist=NormalizeHist(fHistLutPseudoSizeNorm, fHistLutPseudoSize);
+      TH1 *hist=NormalizeHist(*fHistLutPseudoSizeNorm, fHistLutPseudoSize);
       return DrawHist(*fHistLutPseudoSize, *hist, "CanvasLPS", fColorLps);
     }
 
+    if (str.Contains("cps",TString::kIgnoreCase)){
+      TH1 *hist=NormalizeHist(*fHistCellPseudoSizeNorm, fHistCellPseudoSize);
+      return DrawHist(*fHistCellPseudoSize, *hist, "CanvasCPS", fColorCps);
+    }
+
     if (str.Contains("sbc",TString::kIgnoreCase)){
-      TH1 *hist=NormalizeHist(fHistSizeBiggerCellNorm, fHistSizeBiggerCell);
+      TH1 *hist=NormalizeHist(*fHistSizeBiggerCellNorm, fHistSizeBiggerCell);
       return DrawHist(*fHistSizeBiggerCell, *hist, "CanvasSBC", fColorSbc);
     }
 
     if (str.Contains("ps",TString::kIgnoreCase)){
-      TH1 *hist=NormalizeHist(fHistPseudoSizeNorm, fHistPseudoSize);
+      TH1 *hist=NormalizeHist(*fHistPseudoSizeNorm, fHistPseudoSize);
       return DrawHist(*fHistPseudoSize, *hist, "CanvasPS", fColorPs);
     }
@@ -282,4 +310,7 @@
     if (str.Contains("size-energy",TString::kIgnoreCase))
       return Draw2DHist(*fHistPseudoSizeEnergy, "CanvasPSE", fColorPsE);
+
+    if (str.Contains("cellsize-energy",TString::kIgnoreCase))
+      return Draw2DHist(*fHistCellPseudoSizeEnergy, "CanvasCPSE", fColorCPsE);
 
     if (str.Contains("lut-energy",TString::kIgnoreCase))
@@ -338,5 +369,16 @@
     if (name.Contains("fHistPseudoSizeEnergy", TString::kIgnoreCase))
         return fHistPseudoSizeEnergy;
-
+    if (name.Contains("fHistCellPseudoSizeEnergy", TString::kIgnoreCase))
+        return fHistCellPseudoSizeEnergy;
+
+    if (name.Contains("fHistLutPseudoSizeNorm", TString::kIgnoreCase))
+      return fHistLutPseudoSizeNorm;
+    if (name.Contains("fHistSizeBiggerCellNorm", TString::kIgnoreCase))
+        return fHistSizeBiggerCellNorm;
+    if (name.Contains("fHistPseudoSizeNorm", TString::kIgnoreCase))
+        return fHistPseudoSizeNorm;
+    if (name.Contains("fHistCellPseudoSizeNorm", TString::kIgnoreCase))
+        return fHistCellPseudoSizeNorm;
+	    
     if (name.Contains("fHistLutPseudoSize", TString::kIgnoreCase))
       return fHistLutPseudoSize;
@@ -345,12 +387,8 @@
     if (name.Contains("fHistPseudoSize", TString::kIgnoreCase))
         return fHistPseudoSize;
-
-    if (name.Contains("fHistLutPseudoSizeNorm", TString::kIgnoreCase))
-      return fHistLutPseudoSizeNorm;
-    if (name.Contains("fHistSizeBiggerCellNorm", TString::kIgnoreCase))
-        return fHistSizeBiggerCellNorm;
-    if (name.Contains("fHistPseudoSizeNorm", TString::kIgnoreCase))
-        return fHistPseudoSizeNorm;
-	    
+    if (name.Contains("fHistCellPseudoSize", TString::kIgnoreCase))
+        return fHistCellPseudoSize;
+
+    
     return NULL;
 }
@@ -365,7 +403,7 @@
 // the copy (histNorm) on its integral. It returns histNorm.
 //
-TH1 *MHMcTriggerLvl2::NormalizeHist(TH1 *histNorm, TH1 *hist) const
-{
-  if (histNorm == hist){
+TH1 *MHMcTriggerLvl2::NormalizeHist(TH1 &histNorm, TH1 *hist) const
+{
+  if (&histNorm == hist){
     *fLog << "ARGH!@! You cannot pass the same histogram into each argument!" << endl;
     return NULL;
@@ -377,8 +415,8 @@
   }
   
-  histNorm->Reset("ICE");
-  histNorm->Add(hist, 1);
-  histNorm->Divide(fFNorm, (Double_t)(hist->Integral()));
-
-  return histNorm;
-}
+  histNorm.Reset("ICE");
+  histNorm.Add(hist, 1);
+  histNorm.Divide(fFNorm, (Double_t)(hist->Integral()));
+
+  return &histNorm;
+}
Index: trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.h
===================================================================
--- trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.h	(revision 2800)
+++ trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.h	(revision 2953)
@@ -19,8 +19,11 @@
     TH1F *fHistPseudoSize;           // Histogram of fPseudoSize
     TH1F *fHistPseudoSizeNorm;       // Histogram of fPseudoSize normalized on integral of distribution
+    TH1F *fHistCellPseudoSize;           // Histogram of fCellPseudoSize
+    TH1F *fHistCellPseudoSizeNorm;       // Histogram of fCellPseudoSize normalized on integral of distribution
     TH1F *fHistSizeBiggerCell;       // Histogram of fSizeBiggerCell
     TH1F *fHistSizeBiggerCellNorm;   // Histogram of fSizeBiggerCell normalized on integral of distribution
     TH2D *fHistPseudoSizeEnergy;     // 2D-Histogram of fPseudoSize vs. Energy
     TH2D *fHistLutPseudoSizeEnergy;  // 2D-Histogram of fLutPseudoSize vs. Energy
+    TH2D *fHistCellPseudoSizeEnergy;  // 2D-Histogram of fCellPseudoSize vs. Energy
     TH2D *fHistSizeBiggerCellEnergy; // 2D-Histogram of fSizeBiggerCell vs. Energy
     TF1* fFNorm;                     // Function used to normalize histograms
@@ -29,6 +32,8 @@
     static Int_t fColorSbc;
     static Int_t fColorPs;
+    static Int_t fColorCps;
     static Int_t fColorPsE;
     static Int_t fColorLPsE;
+    static Int_t fColorCPsE;
     static Int_t fColorSBCE;
     
@@ -49,4 +54,6 @@
     TH1F *GetHistPseudoSize()  const { return fHistPseudoSize; }
     TH1F *GetHistPseudoSizeNorm()  const { return fHistPseudoSizeNorm; }
+    TH1F *GetHistCellPseudoSize()  const { return fHistCellPseudoSize; }
+    TH1F *GetHistCellPseudoSizeNorm()  const { return fHistCellPseudoSizeNorm; }
     TH1F *GetHistSizeBiggerCell()  const { return fHistSizeBiggerCell; }
     TH1F *GetHistSizeBiggerCellNorm()  const { return fHistSizeBiggerCellNorm; }
@@ -59,5 +66,5 @@
     TObject *DrawClone(Option_t *opt=NULL) const;
 
-    TH1 *NormalizeHist(TH1 *histNorm, TH1 *hist) const;
+    TH1 *NormalizeHist(TH1 &histNorm, TH1 *hist) const;
 
     ClassDef(MHMcTriggerLvl2, 1) // Container which holds histograms for the Trigger Level2 image parameters
