Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 9300)
+++ trunk/MagicSoft/Mars/Changelog	(revision 9301)
@@ -18,4 +18,36 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2009/02/07 Thomas Bretz
+
+   * sponde.rc:
+     - fixed a typo
+
+   * datacenter/scripts/runcorsika:
+     - added a comment
+
+   * mbase/MContinue.h:
+     - changed a comment
+
+   * mbase/MEnv.h:
+     - Do not assign a temporary TString to const char *
+
+   * mcamera/MCameraCentralPix.[h,cc]:
+     - changed fDC from Float_t to Int_t 
+
+   * mhflux/MHCollectionArea.cc, mhflux/MHDisp.cc, mhflux/MHEnergyEst.cc,
+     mhflux/MHFalseSource.cc, mhflux/MHThreshold.cc:
+     - use MString::Format instead of Form
+
+   * msim/MHPhotonEvent.cc:
+     - don't fill kNightSky primaries
+
+   * msim/MPhotonEvent.[h,cc]:
+     - return the number of non NightSky photons
+
+   * msimcamera/MSimPSF.cc:
+     - changed default for fSigma from 1 to -1
+
+
 
  2009/02/06 Daniela Dorner
Index: trunk/MagicSoft/Mars/datacenter/scripts/runcorsika
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runcorsika	(revision 9300)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runcorsika	(revision 9301)
@@ -62,4 +62,6 @@
    echo "OBSLEV 2200.E2"
    # From www.noaa.gov/geomagmodels roughly for January 2009. (was 29.5 and 23.0)
+   # MAGNET BX BZ (BX is the horizontal component (muT) to the x-direction of
+   # the detector, BZ is the vertical component (muT) downwards)
    echo "MAGNET 30.3 24.1"
    # Atmosphere
Index: trunk/MagicSoft/Mars/mbase/MContinue.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MContinue.h	(revision 9300)
+++ trunk/MagicSoft/Mars/mbase/MContinue.h	(revision 9301)
@@ -57,5 +57,5 @@
     void Print(Option_t *o="") const; //*MENU*
 
-    ClassDef(MContinue, 2) //Task returning kCONTINUE
+    ClassDef(MContinue, 2) //Task returning kCONTINUE (or any other return code)
 };
 
Index: trunk/MagicSoft/Mars/mbase/MEnv.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEnv.h	(revision 9300)
+++ trunk/MagicSoft/Mars/mbase/MEnv.h	(revision 9301)
@@ -40,4 +40,6 @@
     Double_t    GetValue(const char *name, Double_t dflt);
     const char *GetValue(const char *name, const char *dflt);
+
+    // GetValue: regexp
 
     const char *GetName() const;
Index: trunk/MagicSoft/Mars/mcamera/MCameraCentralPix.cc
===================================================================
--- trunk/MagicSoft/Mars/mcamera/MCameraCentralPix.cc	(revision 9300)
+++ trunk/MagicSoft/Mars/mcamera/MCameraCentralPix.cc	(revision 9301)
@@ -29,5 +29,5 @@
 // Class Version 2:
 // ----------------
-//   + Float_t fDC
+//   + Int_t fDC
 //
 /////////////////////////////////////////////////////////////////////////////
Index: trunk/MagicSoft/Mars/mcamera/MCameraCentralPix.h
===================================================================
--- trunk/MagicSoft/Mars/mcamera/MCameraCentralPix.h	(revision 9300)
+++ trunk/MagicSoft/Mars/mcamera/MCameraCentralPix.h	(revision 9301)
@@ -13,8 +13,8 @@
     Bool_t fStatus; // Status of central pixel
 
-    Float_t fDC;    // [nA]
+    Int_t fDC;     // DC current in ADC counts
 
 public:
-    MCameraCentralPix() : fDC(-1)
+    MCameraCentralPix() : fDC(0)
     {
         fName  = "MCameraCentralPix";
@@ -25,4 +25,6 @@
     Bool_t GetStatusCPix() const { return fStatus; } // deprecated - for compatibility only
 
+    Int_t GetDC() const { return fDC; }
+
     ClassDef(MCameraCentralPix, 2) // Container storing information about the Central Pixel status
 };
Index: trunk/MagicSoft/Mars/mhflux/MHCollectionArea.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHCollectionArea.cc	(revision 9300)
+++ trunk/MagicSoft/Mars/mhflux/MHCollectionArea.cc	(revision 9301)
@@ -45,4 +45,5 @@
 #include "MLogManip.h"
 
+#include "MString.h"
 #include "MBinning.h"
 
@@ -300,6 +301,6 @@
         //                         GetCollectionAreaEff(),
         //                         GetCollectionAreaAbs(), fMcAreaRadius);
-        const TString txt = Form("r_{max}=%.0fm --> A_{max}=%.0fm^{2}",
-                                 fMcAreaRadius, GetCollectionAreaAbs());
+        const TString txt = MString::Format("r_{max}=%.0fm --> A_{max}=%.0fm^{2}",
+                                            fMcAreaRadius, GetCollectionAreaAbs());
 
         TLatex text(0.31, 0.95, txt);
Index: trunk/MagicSoft/Mars/mhflux/MHDisp.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHDisp.cc	(revision 9300)
+++ trunk/MagicSoft/Mars/mhflux/MHDisp.cc	(revision 9301)
@@ -624,5 +624,6 @@
             h2->Fit(&func, "IQ", "", 0, 1.0);
 
-            h2->SetTitle(Form("P=(%.2f\\circ/%.2f\\circ) \\omega=%.2f\\circ f=%.2f", x0, y0, func.GetParameter(2), TMath::Abs(scale)));
+            h2->SetTitle(MString::Format("P=(%.2f\\circ/%.2f\\circ) \\omega=%.2f\\circ f=%.2f",
+                                         x0, y0, func.GetParameter(2), TMath::Abs(scale)));
         }
     }
Index: trunk/MagicSoft/Mars/mhflux/MHEnergyEst.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHEnergyEst.cc	(revision 9300)
+++ trunk/MagicSoft/Mars/mhflux/MHEnergyEst.cc	(revision 9301)
@@ -399,5 +399,5 @@
 TH1 *MHEnergyEst::MakeProf(TH2 &h)
 {
-    TH1 *p = h.ProfileX(Form("Prof%s", h.GetName()), -1, -1, "s");
+    TH1 *p = h.ProfileX(MString::Format("Prof%s", h.GetName()), -1, -1, "s");
     p->SetDirectory(NULL);
     p->SetBit(kCanDelete);
Index: trunk/MagicSoft/Mars/mhflux/MHFalseSource.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHFalseSource.cc	(revision 9300)
+++ trunk/MagicSoft/Mars/mhflux/MHFalseSource.cc	(revision 9301)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MHFalseSource.cc,v 1.23 2008-11-11 11:42:14 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MHFalseSource.cc,v 1.24 2009-02-07 16:11:57 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -144,4 +144,5 @@
 #include "MAlphaFitter.h"
 
+#include "MString.h"
 #include "MBinning.h"
 #include "MParList.h"
@@ -409,5 +410,5 @@
     const Float_t cut1 = axe.GetBinLowEdge(f);
     const Float_t cut2 = axe.GetBinUpEdge(l);
-    h2->SetTitle(Form("Distribution of %.1f\\circ<|\\alpha|<%.1f\\circ in x,y", cut1, cut2));
+    h2->SetTitle(MString::Format("Distribution of %.1f\\circ<|\\alpha|<%.1f\\circ in x,y", cut1, cut2));
 
     // Get projection for range
@@ -446,5 +447,5 @@
     axe.SetRangeUser(0, fAlphaCut);
     const Float_t cut = axe.GetBinUpEdge(axe.GetLast());
-    h3->SetTitle(Form("Distribution of |\\alpha|<%.1f\\circ in x,y", cut));
+    h3->SetTitle(MString::Format("Distribution of |\\alpha|<%.1f\\circ in x,y", cut));
 
     // Get projection for range
@@ -606,5 +607,5 @@
             // Than for their projections
             TH1 *h = fHist.ProjectionZ("Alpha_z", maxx, maxx, maxy, maxy);
-            h->SetTitle(Form("Distribution of \\alpha for x=%.2f y=%.2f (S_{max}=%.1f\\sigma)", x, y, s));
+            h->SetTitle(MString::Format("Distribution of \\alpha for x=%.2f y=%.2f (S_{max}=%.1f\\sigma)", x, y, s));
 
             TH1D *ho=0;
@@ -934,6 +935,6 @@
     histb->Reset();
     hist->SetNameTitle("Significance",
-                       Form("Fit Region: Signal<%.1f\\circ, %.1f\\circ<Bg<%.1f\\circ",
-                            sigmax, bgmin, bgmax));
+                       MString::Format("Fit Region: Signal<%.1f\\circ, %.1f\\circ<Bg<%.1f\\circ",
+                                       sigmax, bgmin, bgmax));
     hists->SetName("Excess");
     histb->SetName("Background");
@@ -1052,6 +1053,6 @@
     h0b.GetXaxis()->SetRangeUser(0, maxalpha0*1.5);
 
-    hists->SetTitle(Form("Excess events for \\alpha<%.0f\\circ (N_{max}=%d)", sigint, (int)hists->GetMaximum()));
-    histb->SetTitle(Form("Background events for \\alpha<%.0f\\circ", sigint));
+    hists->SetTitle(MString::Format("Excess events for \\alpha<%.0f\\circ (N_{max}=%d)", sigint, (int)hists->GetMaximum()));
+    histb->SetTitle(MString::Format("Background events for \\alpha<%.0f\\circ", sigint));
 
     //hists->SetMinimum(GetMinimumGT(*hists));
@@ -1142,7 +1143,7 @@
     if (maxx>0 && maxy>0)
     {
-        const char *title = Form(" \\alpha for x=%.2f y=%.2f (S_{max}=%.1f\\sigma) ",
-                                 hist->GetXaxis()->GetBinCenter(maxx),
-                                 hist->GetYaxis()->GetBinCenter(maxy), maxs);
+        const char *title = MString::Format(" \\alpha for x=%.2f y=%.2f (S_{max}=%.1f\\sigma) ",
+                                            hist->GetXaxis()->GetBinCenter(maxx),
+                                            hist->GetYaxis()->GetBinCenter(maxy), maxs);
 
         h = fHist.ProjectionZ("AlphaFit", maxx, maxx, maxy, maxy);
@@ -1188,6 +1189,6 @@
         }
 
-        TF1 f1("f1", Form("gaus(0) + pol%d(3)", fHistOff ? 0 : polynom), 0, 90);
-        TF1 f2("f2", Form("gaus(0) + pol%d(3)", fHistOff ? 0 : polynom), 0, 90);
+        TF1 f1("f1", MString::Format("gaus(0) + pol%d(3)", fHistOff ? 0 : polynom), 0, 90);
+        TF1 f2("f2", MString::Format("gaus(0) + pol%d(3)", fHistOff ? 0 : polynom), 0, 90);
         f1.SetParameters(maxpar.GetArray());
         f2.SetParameters(maxpar.GetArray());
@@ -1204,14 +1205,14 @@
         leg->SetBorderSize(1);
         leg->SetTextSize(0.04);
-        leg->AddText(0.5, 0.82, Form("A * exp(-(\\frac{x-\\mu}{\\sigma})^{2}/2) + pol%d", polynom))->SetTextAlign(22);
+        leg->AddText(0.5, 0.82, MString::Format("A * exp(-(\\frac{x-\\mu}{\\sigma})^{2}/2) + pol%d", polynom))->SetTextAlign(22);
         //leg->AddText(0.5, 0.82, "A * exp(-(\\frac{x-\\mu}{\\sigma})^{2}/2) + b*x^{2} + a")->SetTextAlign(22);
         leg->AddLine(0, 0.65, 0, 0.65);
-        leg->AddText(0.06, 0.54, Form("A=%.2f", maxpar[0]))->SetTextAlign(11);
-        leg->AddText(0.06, 0.34, Form("\\sigma=%.2f", maxpar[2]))->SetTextAlign(11);
-        leg->AddText(0.06, 0.14, Form("\\mu=%.2f (fix)", maxpar[1]))->SetTextAlign(11);
-        leg->AddText(0.60, 0.54, Form("a=%.2f", maxpar[3]))->SetTextAlign(11);
-        leg->AddText(0.60, 0.34, Form("b=%.2f (fix)", maxpar[4]))->SetTextAlign(11);
+        leg->AddText(0.06, 0.54, MString::Format("A=%.2f", maxpar[0]))->SetTextAlign(11);
+        leg->AddText(0.06, 0.34, MString::Format("\\sigma=%.2f", maxpar[2]))->SetTextAlign(11);
+        leg->AddText(0.06, 0.14, MString::Format("\\mu=%.2f (fix)", maxpar[1]))->SetTextAlign(11);
+        leg->AddText(0.60, 0.54, MString::Format("a=%.2f", maxpar[3]))->SetTextAlign(11);
+        leg->AddText(0.60, 0.34, MString::Format("b=%.2f (fix)", maxpar[4]))->SetTextAlign(11);
         if (polynom>1)
-            leg->AddText(0.60, 0.14, Form("c=%.2f", !fHistOff?maxpar[5]:0))->SetTextAlign(11);
+            leg->AddText(0.60, 0.14, MString::Format("c=%.2f", !fHistOff?maxpar[5]:0))->SetTextAlign(11);
         leg->SetBit(kCanDelete);
         leg->Draw();
@@ -1249,5 +1250,5 @@
         leg->SetBorderSize(1);
         leg->SetTextSize(0.1);
-        leg->AddText(Form("S_{max}=%.1f\\sigma at \\alpha_{max}=%d\\circ", maxsig, max));
+        leg->AddText(MString::Format("S_{max}=%.1f\\sigma at \\alpha_{max}=%d\\circ", maxsig, max));
         leg->SetBit(kCanDelete);
         leg->Draw();
@@ -1356,9 +1357,9 @@
     TString str2("el.SetY1(gPad->GetY1()+0.9*(gPad->GetY2()-gPad->GetY1()));");
 
-    str1.ReplaceAll("el.", Form("((TEllipse*)%p)->", el));
-    str2.ReplaceAll("el.", Form("((TEllipse*)%p)->", el));
-
-    str1.ReplaceAll("0.9", Form("%f", x0));
-    str2.ReplaceAll("0.9", Form("%f", y0));
+    str1.ReplaceAll("el.", MString::Format("((TEllipse*)%p)->", el));
+    str2.ReplaceAll("el.", MString::Format("((TEllipse*)%p)->", el));
+
+    str1.ReplaceAll("0.9", MString::Format("%f", x0));
+    str2.ReplaceAll("0.9", MString::Format("%f", y0));
 
     TLatex tex;
@@ -1391,6 +1392,6 @@
                  "y.GetBinLowEdge(y.GetLast()+1));");
 
-    str3.ReplaceAll("x.", Form("((TAxis*)%p)->", &x));
-    str3.ReplaceAll("y.", Form("((TAxis*)%p)->", &y));
+    str3.ReplaceAll("x.", MString::Format("((TAxis*)%p)->", &x));
+    str3.ReplaceAll("y.", MString::Format("((TAxis*)%p)->", &y));
     // str3.ReplaceAll("pad", Form("((TPad*)(%p))", pad));
 
Index: trunk/MagicSoft/Mars/mhflux/MHThreshold.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHThreshold.cc	(revision 9300)
+++ trunk/MagicSoft/Mars/mhflux/MHThreshold.cc	(revision 9301)
@@ -46,4 +46,5 @@
 #include "MLogManip.h"
 
+#include "MString.h"
 #include "MBinning.h"
 
@@ -115,4 +116,5 @@
 
     TH1D h(fHEnergy);
+    h.SetDirectory(0);
 
 #if ROOT_VERSION_CODE<ROOT_VERSION(5,20,00)
@@ -138,7 +140,7 @@
     const Axis_t maxe = TMath::Sqrt(axe.GetBinLowEdge(bin)*axe.GetBinUpEdge(bin));
 
-    TLatex text(0.30, 0.95, Form("E_{max}=%dGeV (%dGeV,%dGeV)", TMath::Nint(maxe),
-                                 TMath::Nint(axe.GetBinLowEdge(bin)),
-                                 TMath::Nint(axe.GetBinUpEdge(bin))));
+    TLatex text(0.30, 0.95, MString::Format("E_{max}=%dGeV (%dGeV,%dGeV)", TMath::Nint(maxe),
+                                            TMath::Nint(axe.GetBinLowEdge(bin)),
+                                            TMath::Nint(axe.GetBinUpEdge(bin))));
     text.SetBit(TLatex::kTextNDC);
     text.SetTextSize(0.04);
Index: trunk/MagicSoft/Mars/msim/MPhotonEvent.cc
===================================================================
--- trunk/MagicSoft/Mars/msim/MPhotonEvent.cc	(revision 9300)
+++ trunk/MagicSoft/Mars/msim/MPhotonEvent.cc	(revision 9301)
@@ -213,4 +213,15 @@
 }
 
+Int_t MPhotonEvent::GetNumExternal() const
+{
+    Int_t n=0;
+
+    for (int i=0; i<GetNumPhotons(); i++)
+        if ((*this)[i].GetPrimary()!=MMcEvtBasic::kNightSky)
+            n++;
+
+    return n;
+}
+
 // --------------------------------------------------------------------------
 //
Index: trunk/MagicSoft/Mars/msim/MPhotonEvent.h
===================================================================
--- trunk/MagicSoft/Mars/msim/MPhotonEvent.h	(revision 9300)
+++ trunk/MagicSoft/Mars/msim/MPhotonEvent.h	(revision 9301)
@@ -78,4 +78,5 @@
     // Getter/Setter
     Int_t GetNumPhotons() const { return fData.GetEntriesFast(); }
+    Int_t GetNumExternal() const;
 
     TClonesArray &GetArray() { return fData; }
Index: trunk/MagicSoft/Mars/msimcamera/MSimPSF.cc
===================================================================
--- trunk/MagicSoft/Mars/msimcamera/MSimPSF.cc	(revision 9300)
+++ trunk/MagicSoft/Mars/msimcamera/MSimPSF.cc	(revision 9301)
@@ -58,5 +58,5 @@
 //
 MSimPSF::MSimPSF(const char* name, const char *title)
-    : fEvt(0), fSigma(1)
+    : fEvt(0), fSigma(-1)
 {
     fName  = name  ? name  : "MSimPSF";
Index: trunk/MagicSoft/Mars/sponde.rc
===================================================================
--- trunk/MagicSoft/Mars/sponde.rc	(revision 9300)
+++ trunk/MagicSoft/Mars/sponde.rc	(revision 9301)
@@ -63,5 +63,5 @@
 
 # You can apply a cut in addition to all other cuts to your data and
-# MOnte Carlos. This can be usefull for example to setup a second
+# Monte Carlos. This can be usefull for example to setup a second
 # MFMagicCuts with a tighter behaviour assuming that your ganymed
 # was written with a really loose cut.
