Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 1933)
+++ trunk/MagicSoft/Mars/Changelog	(revision 1934)
@@ -1,3 +1,14 @@
                                                  -*-*- END OF LINE -*-*-
+
+ 2003/04/09: Thomas Bretz
+ 
+   * manalysis/MCT1SupercutsCalc.[h,cc]:
+     - moved last changes from MFCT1Supercuts to MCT1SupercutsCalc
+
+   * mhist/MHMcTriggerLvl2.[h,cc]:
+     - fixed a warning
+     - removed global variables
+
+
 
  2003/04/09: Abelardo Moralejo
Index: trunk/MagicSoft/Mars/manalysis/MCT1SupercutsCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCT1SupercutsCalc.cc	(revision 1933)
+++ trunk/MagicSoft/Mars/manalysis/MCT1SupercutsCalc.cc	(revision 1934)
@@ -46,4 +46,90 @@
 ClassImp(MCT1SupercutsCalc);
 
+void MCT1SupercutsCalc::InitParams()
+{
+    //---------------------------------
+    // cut parameters
+    fLengthUp[0] = 0.315585; 
+    fLengthUp[1] = 0.001455; 
+    fLengthUp[2] = 0.203198; 
+    fLengthUp[3] = 0.005532; 
+    fLengthUp[4] =-0.001670;
+    fLengthUp[5] =-0.020362; 
+    fLengthUp[6] = 0.007388; 
+    fLengthUp[7] =-0.013463;
+
+    fWidthUp[0] = 0.145412; 
+    fWidthUp[1] =-0.001771; 
+    fWidthUp[2] = 0.054462; 
+    fWidthUp[3] = 0.022280; 
+    fWidthUp[4] =-0.009893;
+    fWidthUp[5] = 0.056353; 
+    fWidthUp[6] = 0.020711; 
+    fWidthUp[7] =-0.016703;
+
+    fDistUp[0] = 1.787943; 
+    fDistUp[1] = 0.; 
+    fDistUp[2] = 2.942310; 
+    fDistUp[3] = 0.199815; 
+    fDistUp[4] = 0.; 
+    fDistUp[5] = 0.249909;
+    fDistUp[6] = 0.189697; 
+    fDistUp[7] = 0.;
+
+    fLengthLo[0] = 0.151530; 
+    fLengthLo[1] = 0.028323; 
+    fLengthLo[2] = 0.510707; 
+    fLengthLo[3] = 0.053089; 
+    fLengthLo[4] = 0.013708;
+    fLengthLo[5] = 2.357993; 
+    fLengthLo[6] = 0.000080; 
+    fLengthLo[7] =-0.007157;
+
+    fWidthLo[0] = 0.089187; 
+    fWidthLo[1] =-0.006430; 
+    fWidthLo[2] = 0.074442; 
+    fWidthLo[3] = 0.003738;
+    fWidthLo[4] =-0.004256; 
+    fWidthLo[5] =-0.014101; 
+    fWidthLo[6] = 0.006126; 
+    fWidthLo[7] =-0.002849;
+
+    fDistLo[0] = 0.589406;
+    fDistLo[1] = 0.;
+    fDistLo[2] =-0.083964;
+    fDistLo[3] =-0.007975;
+    fDistLo[4] = 0.;
+    fDistLo[5] = 0.045374;
+    fDistLo[6] =-0.001750;
+    fDistLo[7] = 0.;
+
+    fAsymUp[0] = 0.061267; 
+    fAsymUp[1] = 0.014462; 
+    fAsymUp[2] = 0.014327; 
+    fAsymUp[3] = 0.014540; 
+    fAsymUp[4] = 0.013391;
+    fAsymUp[5] = 0.012319; 
+    fAsymUp[6] = 0.010444; 
+    fAsymUp[7] = 0.008328;
+
+    fAsymLo[0] =-0.012055; 
+    fAsymLo[1] = 0.009157; 
+    fAsymLo[2] = 0.005441; 
+    fAsymLo[3] = 0.000399; 
+    fAsymLo[4] = 0.001433;
+    fAsymLo[5] =-0.002050; 
+    fAsymLo[6] =-0.000104; 
+    fAsymLo[7] =-0.001188;
+
+    fAlphaUp[0] = 13.123440; 
+    fAlphaUp[1] = 0.; 
+    fAlphaUp[2] = 0.; 
+    fAlphaUp[3] = 0.; 
+    fAlphaUp[4] = 0.; 
+    fAlphaUp[5] = 0.; 
+    fAlphaUp[6] = 0.; 
+    fAlphaUp[7] = 0.;
+    //---------------------------------
+}
 
 // --------------------------------------------------------------------------
@@ -57,4 +143,6 @@
     fHilName    = hilname;
     fHilSrcName = hilsrcname;
+
+    InitParams();
 }
 
@@ -109,92 +197,4 @@
     fMm2Deg = fCam->GetConvMm2Deg();
 
-    //*fLog << "fMm2Deg = " << fMm2Deg << endl;
-
-
-    //---------------------------------
-    // cut parameters
-       
-    lengthup[0] = 0.315585; 
-    lengthup[1] = 0.001455; 
-    lengthup[2] = 0.203198; 
-    lengthup[3] = 0.005532; 
-    lengthup[4] =-0.001670;
-    lengthup[5] =-0.020362; 
-    lengthup[6] = 0.007388; 
-    lengthup[7] =-0.013463;
-
-    widthup[0] = 0.145412; 
-    widthup[1] =-0.001771; 
-    widthup[2] = 0.054462; 
-    widthup[3] = 0.022280; 
-    widthup[4] =-0.009893;
-    widthup[5] = 0.056353; 
-    widthup[6] = 0.020711; 
-    widthup[7] =-0.016703;
-
-    distup[0] = 1.787943; 
-    distup[1] = 0.; 
-    distup[2] = 2.942310; 
-    distup[3] = 0.199815; 
-    distup[4] = 0.; 
-    distup[5] = 0.249909;
-    distup[6] = 0.189697; 
-    distup[7] = 0.;
-
-    lengthlow[0] = 0.151530; 
-    lengthlow[1] = 0.028323; 
-    lengthlow[2] = 0.510707; 
-    lengthlow[3] = 0.053089; 
-    lengthlow[4] = 0.013708;
-    lengthlow[5] = 2.357993; 
-    lengthlow[6] = 0.000080; 
-    lengthlow[7] =-0.007157;
-
-    widthlow[0] = 0.089187; 
-    widthlow[1] =-0.006430; 
-    widthlow[2] = 0.074442; 
-    widthlow[3] = 0.003738;
-    widthlow[4] =-0.004256; 
-    widthlow[5] =-0.014101; 
-    widthlow[6] = 0.006126; 
-    widthlow[7] =-0.002849;
-
-    distlow[0] = 0.589406; 
-    distlow[1] = 0.; 
-    distlow[2] =-0.083964; 
-    distlow[3] =-0.007975; 
-    distlow[4] = 0.; 
-    distlow[5] = 0.045374;
-    distlow[6] =-0.001750; 
-    distlow[7] = 0.;
-
-    asymup[0] = 0.061267; 
-    asymup[1] = 0.014462; 
-    asymup[2] = 0.014327; 
-    asymup[3] = 0.014540; 
-    asymup[4] = 0.013391;
-    asymup[5] = 0.012319; 
-    asymup[6] = 0.010444; 
-    asymup[7] = 0.008328;
-
-    asymlow[0] =-0.012055; 
-    asymlow[1] = 0.009157; 
-    asymlow[2] = 0.005441; 
-    asymlow[3] = 0.000399; 
-    asymlow[4] = 0.001433;
-    asymlow[5] =-0.002050; 
-    asymlow[6] =-0.000104; 
-    asymlow[7] =-0.001188;
-
-    alphaup[0] = 13.123440; 
-    alphaup[1] = 0.; 
-    alphaup[2] = 0.; 
-    alphaup[3] = 0.; 
-    alphaup[4] = 0.; 
-    alphaup[5] = 0.; 
-    alphaup[6] = 0.; 
-    alphaup[7] = 0.;
-    //---------------------------------
-
     return kTRUE;
 }
@@ -205,5 +205,5 @@
 //
 Double_t MCT1SupercutsCalc::CtsMCut(Double_t *a,  Double_t ls, Double_t ct,
-                                 Double_t ls2, Double_t dd2)
+                                    Double_t ls2, Double_t dd2)
 {
   // define cut-function
@@ -218,7 +218,8 @@
   //    dd2: DIST^2
 
-  Double_t limit = *a + *(a+1) * dd2  + *(a+2) * ct 
-                      + ls  * (*(a+3) + *(a+4) * dd2 + *(a+5) * ct)
-                      + ls2 * (*(a+6) + *(a+7) * dd2);
+    const Double_t limit =
+               a[0] + a[1] * dd2 + a[2] * ct  +
+        ls  * (a[3] + a[4] * dd2 + a[5] * ct) +
+        ls2 * (a[6] + a[7] * dd2);
 
   //*fLog << "MCT1SupercutsCalc::CtsMCut; *a = "
@@ -274,15 +275,15 @@
 
   if (    newdist  < 1.05
-       && newdist  < CtsMCut (distup,    dmls, dmcza, dmls2, dd2)
-       && newdist  > CtsMCut (distlow,   dmls, dmcza, dmls2, dd2)
+       && newdist  < CtsMCut (fDistUp,   dmls, dmcza, dmls2, dd2)
+       && newdist  > CtsMCut (fDistLo,   dmls, dmcza, dmls2, dd2)
        && dist     < 1.05
-       && length   < CtsMCut (lengthup,  dmls, dmcza, dmls2, dd2)
-       && length   > CtsMCut (lengthlow, dmls, dmcza, dmls2, dd2)
-       && width    < CtsMCut (widthup,   dmls, dmcza, dmls2, dd2)
-       && width    > CtsMCut (widthlow,  dmls, dmcza, dmls2, dd2)
+       && length   < CtsMCut (fLengthUp, dmls, dmcza, dmls2, dd2)
+       && length   > CtsMCut (fLengthLo, dmls, dmcza, dmls2, dd2)
+       && width    < CtsMCut (fWidthUp,  dmls, dmcza, dmls2, dd2)
+       && width    > CtsMCut (fWidthLo,  dmls, dmcza, dmls2, dd2)
        //&& asym   < CtsMCut (asymup,    dmls, dmcza, dmls2, dd2)
        //&& asym   > CtsMCut (asymlow,   dmls, dmcza, dmls2, dd2)
-       && dist     < CtsMCut (distup,    dmls, dmcza, dmls2, dd2)
-       && dist     > CtsMCut (distlow,   dmls, dmcza, dmls2, dd2)  )
+       && dist     < CtsMCut (fDistUp,   dmls, dmcza, dmls2, dd2)
+       && dist     > CtsMCut (fDistLo,   dmls, dmcza, dmls2, dd2)  )
     fHadronness->SetHadronness(0.25);
   else
Index: trunk/MagicSoft/Mars/manalysis/MCT1SupercutsCalc.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCT1SupercutsCalc.h	(revision 1933)
+++ trunk/MagicSoft/Mars/manalysis/MCT1SupercutsCalc.h	(revision 1934)
@@ -36,19 +36,18 @@
     Double_t    fMm2Deg;
 
-
     //---------------------------------
     // cut parameters
-       
-    double lengthup[8];
-    double widthup[8];
-    double distup[8];
-    double lengthlow[8];
-    double widthlow[8];
-    double distlow[8];
-    double asymup[8];
-    double asymlow[8];
-    double alphaup[8];
+    Double_t fLengthUp[8];
+    Double_t fWidthUp[8];
+    Double_t fDistUp[8];
+    Double_t fLengthLo[8];
+    Double_t fWidthLo[8];
+    Double_t fDistLo[8];
+    Double_t fAsymUp[8];
+    Double_t fAsymLo[8];
+    Double_t fAlphaUp[8];
     //---------------------------------
 
+    void InitParams();
 
 public:
Index: trunk/MagicSoft/Mars/mhist/MHMcTriggerLvl2.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMcTriggerLvl2.cc	(revision 1933)
+++ trunk/MagicSoft/Mars/mhist/MHMcTriggerLvl2.cc	(revision 1934)
@@ -16,7 +16,7 @@
 !
 !
-!   Author(s): Nicola Galante 2003 <mailto:nicola.galante@pi.infn.it>
-!!
-!   Copyright: MAGIC Software Development, 2000-2002
+!   Author(s): Nicola Galante, 2003 <mailto:nicola.galante@pi.infn.it>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
 !
 !
@@ -51,4 +51,7 @@
 #include "MBinning.h"
 
+/*
+ Please, DON'T USE IFDEFS IN SUCH A CONTEXT, Thomas.
+ --------------------------------------------------
 #ifndef COLOR_LINELPS
 #define COLOR_LINELPS Int_t colorlps = 1
@@ -65,4 +68,14 @@
 COLOR_LINEPS;
 #endif
+*/
+
+/* Use this insteadif you want to have some value which is the same for all
+ your instances of MHMcTriggerLvl2, if not define the values in the constructor
+ and remove the 'static'
+ */
+
+Int_t MHMcTriggerLvl2::fColorLps = 1;
+Int_t MHMcTriggerLvl2::fColorSbc = 1;
+Int_t MHMcTriggerLvl2::fColorPs = 1;
 
 ClassImp(MHMcTriggerLvl2);
@@ -145,34 +158,29 @@
 // This method is called by the DrawClone method.
 //
-TObject *MHMcTriggerLvl2::DrawHist(TH1 *hist, TH1 *histNorm, const char *canvasname, Int_t *colore) const
-{
-  ++(*colore);
-
-  if((gROOT->FindObject(canvasname) != NULL)){
-    hist->SetLineColor(*colore);
-    ((TCanvas *)gROOT->FindObject(canvasname))->cd(1);
-    hist->DrawCopy("same");
-    
-    ((TCanvas *)gROOT->FindObject(canvasname))->cd(2);
-    histNorm->SetLineColor(*colore);
-    histNorm->DrawCopy("same");
-    ((TCanvas *)gROOT->FindObject(canvasname))->cd(2);
-    return gROOT->FindObject(canvasname);
-  }
-  else{
-    TCanvas *c3 = MakeDefCanvas(canvasname,canvasname, 800, 610);
-    c3->Divide(2,1);
-    c3->cd(1);
-    hist->SetLineColor(*colore);
-    hist->DrawCopy();
-
-    c3->cd(2);
-    histNorm->SetLineColor(*colore);
-    histNorm->DrawCopy();
-
-    return c3;
-  }
-}
- 
+TObject *MHMcTriggerLvl2::DrawHist(TH1 &hist, TH1 &histNorm, 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, 610);
+        c->Divide(2,1);
+        same = kFALSE;
+    }
+
+    c->cd(1);
+    hist.SetLineColor(col);
+    hist.DrawCopy(same?"same":"");
+
+    c->cd(2);
+    histNorm.SetLineColor(col);
+    histNorm.DrawCopy(same?"same":"");
+
+    return c;
+}
+
 
 // --------------------------------------------------------------------------
@@ -191,20 +199,32 @@
 TObject *MHMcTriggerLvl2::DrawClone(Option_t *opt) const
 {
-  TString *def = new TString("ps");
-  TString str(opt);
-   
-  if(*opt == NULL) str = *def;  // Default option
-  
-  if (str.Contains("lps",TString::kIgnoreCase))
-    return this->DrawHist(hfLutPseudoSize,this->NormalizeHist(hfLutPseudoSizeNorm,hfLutPseudoSize),"CanvasLPS",&colorlps);
-  else if (str.Contains("sbc",TString::kIgnoreCase))
-    return this->DrawHist(hfSizeBiggerCell,this->NormalizeHist(hfSizeBiggerCellNorm,hfSizeBiggerCell),"CanvasSBC",&colorsbc);
-  else if (str.Contains("ps",TString::kIgnoreCase))
-    return this->DrawHist(hfPseudoSize,this->NormalizeHist(hfPseudoSizeNorm,hfPseudoSize),"CanvasPS",&colorps);
-  else{
-    *fLog << "ARGH!@! Possible options are \"lps\", \"sbc\", \"ps\" or NULL!" <<endl;
+    TString str(opt);
+
+    if (str.IsNull())
+        str = "ps";
+
+    if (!str.Contains("lps", TString::kIgnoreCase) &&
+        !str.Contains("sbc", TString::kIgnoreCase) &&
+        !str.Contains("ps",  TString::kIgnoreCase))
+    {
+        *fLog << "ARGH!@! Possible options are \"lps\", \"sbc\", \"ps\" or NULL!" <<endl;
+        return NULL;
+    }
+
+    TH1 *hist=NormalizeHist(hfLutPseudoSizeNorm, hfLutPseudoSize);
+
+    if (!hist)
+        return NULL;
+
+    if (str.Contains("lps",TString::kIgnoreCase))
+        return DrawHist(*hfLutPseudoSize, *hist, "CanvasLPS", fColorLps);
+
+    if (str.Contains("sbc",TString::kIgnoreCase))
+        return DrawHist(*hfSizeBiggerCell, *hist, "CanvasSBC", fColorSbc);
+
+    if (str.Contains("ps",TString::kIgnoreCase))
+        return DrawHist(*hfPseudoSize, *hist, "CanvasPS", fColorPs);
+
     return NULL;
-  }
-
 }
 
Index: trunk/MagicSoft/Mars/mhist/MHMcTriggerLvl2.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMcTriggerLvl2.h	(revision 1933)
+++ trunk/MagicSoft/Mars/mhist/MHMcTriggerLvl2.h	(revision 1934)
@@ -25,4 +25,8 @@
 
     TF1* f1;                      // Function used to normalize histograms
+
+    static Int_t fColorLps;
+    static Int_t fColorSbc;
+    static Int_t fColorPs;
     
 public:
@@ -50,5 +54,5 @@
 private:
 
-    TObject *DrawHist(TH1 *hist, TH1 *histNorm, const char *canvasname, Int_t *colore) const;
+    TObject *DrawHist(TH1 &hist, TH1 &histNorm, const TString &canvasname, Int_t &colore) const;
 
 };
