Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 3139)
+++ trunk/MagicSoft/Mars/Changelog	(revision 3140)
@@ -4,4 +4,37 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+
+ 2004/02/13: Wolfgang Wittek
+
+  * mcalib/MCalibrateData.[h,cc]
+    - new class; 
+      like MCalibrate, but in ReInit it fills the MPedPhot container
+      using informations from MPedestal, MExtracteSignalCam and 
+      MCalibrationCam
+
+  * mcalib/Makefile
+           CalibLinkDef.h
+    - added MCalibrateData
+
+  * manalysis/MPedestalWorkaround.[h,cc]
+    - create MMcEvt container and fill with theta = 10.0
+    - set pedestalRMS = 0. if it is > 10.0
+
+  * manalysis/MSupercuts.[h,cc]
+    - change default values of parameters
+
+  * manalysis/MSupercutsCalc.[h,cc]
+    - change dNOMLOGSIZE from 4.1 to 5.0
+
+
+  * mhist/MHBlindPixels.[h,cc]
+    - change MPedestalCam to MPedPhotCam
+
+  * mhist/MHSigmaTheta.[h,cc]
+    - automatic binning for pixel number doesn't work
+      use default binning
+
+
  2004/02/13: Markus Gaug
 
Index: trunk/MagicSoft/Mars/macros/ONOFFAnalysis.C
===================================================================
--- trunk/MagicSoft/Mars/macros/ONOFFAnalysis.C	(revision 3139)
+++ trunk/MagicSoft/Mars/macros/ONOFFAnalysis.C	(revision 3140)
@@ -80,5 +80,5 @@
 
         MBinning *binsdiff = new MBinning("BinningDiffsigma2");
-        binsdiff->SetEdges(100, -5.0, 20.0);
+        binsdiff->SetEdges(100, -10.0, 15.0);
         plist->AddToList(binsdiff);
 
@@ -176,5 +176,5 @@
       //const char *onfile  = "~magican/ct1test/wittek/mkn421_on.preproc"; 
       //      const char *onfile  = "~magican/ct1test/wittek/mkn421_00-01"; 
-      const char *onfile  = "/data/MAGIC/rootdata/2003_11_29/20031128_031*_D_Crab-Nebula_E.root"; 
+      const char *onfile  = "20040126_Crab_";
 
      const char *mcfile  = "/data/MAGIC/mc_eth/magLQE_3/gh/0/0/G_M0_00_0_550*.root";
@@ -184,8 +184,8 @@
 
       // path for input for Mars
-      TString inPath = "/data/MAGIC/scratch/wittek/";
+      TString inPath = "/.magic/magicserv01/scratch/";
 
       // path for output from Mars
-      TString outPath = "/data/MAGIC/scratch/wittek/";
+      TString outPath = "~wittek/datacrab/";
 
       //-----------------------------------------------
@@ -203,5 +203,5 @@
     //  - write root file for ON (or OFF or MC) data (ON1.root, ...);
 
-    Bool_t JobA    = kTRUE;  
+    Bool_t JobA    = kFALSE;  
     Bool_t GPad    = kFALSE;    // generate padding histograms?
     Bool_t WPad    = kFALSE;   // write out padding histograms ?
@@ -234,10 +234,10 @@
 
     Bool_t JobB_SC_UP  = kTRUE;
-    Bool_t CMatrix     = kTRUE;  // create training and test matrices 
-    Bool_t RMatrix     = kFALSE;  // read training and test matrices from file
-    Bool_t WOptimize   = kFALSE;  // do optimization using the training sample
+    Bool_t CMatrix     = kFALSE;  // create training and test matrices 
+    Bool_t RMatrix     = kTRUE;  // read training and test matrices from file
+    Bool_t WOptimize   = kTRUE;  // do optimization using the training sample
                                   // and write supercuts parameter values 
                                   // onto the file parSCfile
-    Bool_t RTest       = kFALSE;  // test the supercuts using the test matrix
+    Bool_t RTest       = kTRUE;  // test the supercuts using the test matrix
     Bool_t WSC         = kFALSE;  // update input root file ?
 
@@ -312,5 +312,9 @@
     // names of ON and OFF files to be read
     // for generating the histograms to be used in the padding 
-    TString fileON  = onfile;
+
+    TString fileON  = inPath;
+    fileON += onfile;
+    fileON += "CalibratedEvts";
+    fileON += ".root";
     TString fileOFF = offfile;
     TString fileMC  = mcfile;
@@ -333,13 +337,15 @@
     // name of input root file
     if (typeInput == "ON")
-      TString filenamein(onfile);
+      TString filenamein(fileON);
     else if (typeInput == "OFF")
-      TString filenamein(offfile);
+      TString filenamein(fileOFF);
     else if (typeInput == "MC")
-      TString filenamein(mcfile);
+      TString filenamein(fileMC);
     gLog << "data to be padded : " << filenamein << endl;
 
     // name of output root file
     TString outNameImage = outPath;
+    outNameImage += onfile;
+    outNameImage += "Hillas";
     outNameImage += typeInput;
     outNameImage += "1.root";
@@ -375,6 +381,6 @@
 
     MReadMarsFile  readON("Events", fileON);
-    read.DisableAutoScheme();
-      MCT1ReadPreProc readON(fileON);
+    readON.DisableAutoScheme();
+    //MCT1ReadPreProc readON(fileON);
 
       //MFSelBasic selthetaon;
@@ -454,5 +460,5 @@
 
     MReadMarsFile  readOFF("Events", fileOFF);
-    read.DisableAutoScheme();
+    readOFF.DisableAutoScheme();
     //      MCT1ReadPreProc readOFF(fileOFF);
 
@@ -534,5 +540,5 @@
 
     MReadMarsFile  readMC("Events", fileMC);
-    read.DisableAutoScheme();
+    readMC.DisableAutoScheme();
     //      MCT1ReadPreProc readMC(fileMC);
 
@@ -656,6 +662,4 @@
 
     MGeomApply        apply;
-    MMcPedestalCopy   pcopy;
-    MMcPedestalNSBAdd pnsb;
 
     MPedestalWorkaround waround;
@@ -667,9 +671,4 @@
     f2.SetName("Select Data");
 
-    MCerPhotCalc      ncalc;
-    ncalc.SetFilter(&f1);
-    MCerPhotAnal2     nanal;
-    nanal.SetFilter(&f2);
-
     //if (typeInput ==  "ON")
     //{
@@ -690,6 +689,6 @@
     contbasic.SetName("SelBasic");
 
-    MFillH fillblind("BlindPixels[MHBlindPixels]", "MBlindPixels");
-    fillblind.SetName("HBlind");
+    //MFillH fillblind("BlindPixels[MHBlindPixels]", "MBlindPixels");
+    //fillblind.SetName("HBlind");
 
     MSigmabarCalc sigbarcalc;
@@ -734,13 +733,13 @@
     selstandard.SetHillasName(fHilName);
     selstandard.SetImgParName(fImgParName);
-    selstandard.SetCuts(92, 4, 60, 0.4, 1.05, 0.0, 0.0);
+    selstandard.SetCuts(100, 4, 20, 0.0, 1.0, 0.0, 0.0);
     MContinue contstandard(&selstandard);
     contstandard.SetName("SelStandard");
 
-
+    
       MWriteRootFile write(outNameImage);
 
       write.AddContainer("MRawRunHeader", "RunHeaders");
-      write.AddContainer("MMcRunHeader",  "RunHeaders", kFALSE);
+      //write.AddContainer("MMcRunHeader",  "RunHeaders", kFALSE);
       //write.AddContainer("MTime",         "Events");
       write.AddContainer("MMcEvt",        "Events");
@@ -752,5 +751,5 @@
       write.AddContainer("MHillasSrc",    "Events");
       write.AddContainer("MNewImagePar",  "Events");
-
+    
 
     //*****************************
@@ -767,22 +766,18 @@
     tliston.AddToList(&read);
 
-    tliston.AddToList(&f1);
-    tliston.AddToList(&f2);
+    //tliston.AddToList(&f1);
+    //tliston.AddToList(&f2);
     tliston.AddToList(&apply);
-    tliston.AddToList(&pcopy);
-    //tliston.AddToList(&waround);
-
-    tliston.AddToList(&pnsb);
-    tliston.AddToList(&ncalc);
-    tliston.AddToList(&nanal);
-
-    tliston.AddToList(&blindbeforepad);
+    tliston.AddToList(&waround);
+
+    //tliston.AddToList(&blindbeforepad);
     //  tliston.AddToList(&pad); 
     //  if (typeInput ==  "ON")
     //  tliston.AddToList(&pointcorr);
-    tliston.AddToList(&blind);
+
+    //tliston.AddToList(&blind);
     tliston.AddToList(&contbasic);
 
-    tliston.AddToList(&fillblind);
+    //tliston.AddToList(&fillblind);
     tliston.AddToList(&sigbarcalc);
     tliston.AddToList(&fillsigtheta);
@@ -825,5 +820,5 @@
 
     pliston.FindObject("SigmaTheta", "MHSigmaTheta")->DrawClone();
-    pliston.FindObject("BlindPixels", "MHBlindPixels")->DrawClone();
+    //pliston.FindObject("BlindPixels", "MHBlindPixels")->DrawClone();
 
     pliston.FindObject("MHHillas")->DrawClone();
@@ -1770,8 +1765,18 @@
 
     TString parSCinit = outPath;
-    //parSCinit += "parSC_1709d";
-    parSCinit = "";
-
-    gLog << "parSCinit = " << parSCinit << endl;
+    parSCinit += "parSC_060204a";
+    //parSCinit = "";
+
+    if (parSCinit != "")
+    {
+      gLog << "Initial values of parameters are taken from file '" 
+           << parSCinit << "'" << endl;
+    }
+    else
+    {
+      gLog << "Initial values of parameters are taken from the constructor of MSupercuts" 
+           << endl;
+    }
+
 
     //---------------
@@ -1780,5 +1785,5 @@
 
     TString parSCfile = outPath;
-    parSCfile += "parSC_2310a";
+    parSCfile += "parSC_060204b";
 
     gLog << "parSCfile = " << parSCfile << endl;
@@ -1787,19 +1792,23 @@
     // file to be updated (either ON or MC)
 
-    //TString typeInput = "ON";
+    TString typeInput = "ON";
     //TString typeInput = "OFF";
-    TString typeInput = "MC";
+    //TString typeInput = "MC";
     gLog << "typeInput = " << typeInput << endl;
 
     // name of input root file
     TString filenameData = outPath;
+    filenameData += onfile;
+    filenameData += "Hillas";
     filenameData += typeInput;
-    filenameData += "2.root";
+    filenameData += "1.root";
     gLog << "filenameData = " << filenameData << endl; 
 
     // name of output root file
     TString outNameImage = outPath;
+    outNameImage += onfile;
+    outNameImage += "Hillas";
     outNameImage += typeInput;
-    outNameImage += "3.root";
+    outNameImage += "2.root";
     
 
@@ -1813,7 +1822,9 @@
     // for the training
     TString filenameTrain = outPath;
-    filenameTrain += "ON";
+    filenameTrain += onfile;
+    filenameTrain += "Hillas";
+    filenameTrain += typeInput;
     filenameTrain += "1.root";
-    Int_t howManyTrain = 800000;
+    Int_t howManyTrain = 7000;
     gLog << "filenameTrain = " << filenameTrain << ",   howManyTrain = "
          << howManyTrain  << endl; 
@@ -1821,7 +1832,9 @@
     // for testing
     TString filenameTest = outPath;
-    filenameTest += "ON";
+    filenameTest += onfile;
+    filenameTest += "Hillas";
+    filenameTest += typeInput;
     filenameTest += "1.root";
-    Int_t howManyTest = 800000;
+    Int_t howManyTest = 7000;
 
     gLog << "filenameTest = " << filenameTest << ",   howManyTest = "
@@ -1930,25 +1943,26 @@
     TArrayD steps(0);
   
+
     if (parSCinit == "")
     {
       Double_t vparams[104] = {
       // LengthUp
-	0.315585,  0.001455, 0.203198, 0.005532, -0.001670, -0.020362,
-	0.007388, -0.013463,
+	0.2,       0.,       0.,       0.,        0.,        0.0,
+	0.,        0.,
       // LengthLo
-        0.151530,  0.028323, 0.510707, 0.053089,  0.013708,  2.357993,
-	0.000080, -0.007157,
+        0.,        0.,       0.,       0.,        0.,        0.0,
+	0.,        0.,
       // WidthUp
-        0.145412, -0.001771, 0.054462, 0.022280, -0.009893,  0.056353,
-        0.020711, -0.016703,
+        0.1,       0.,       0.,       0.,        0.,        0.0,
+	0.,        0.,
       // WidthLo
-        0.089187, -0.006430, 0.074442, 0.003738, -0.004256, -0.014101,
-        0.006126, -0.002849,
+        0.,        0.,       0.,       0.,        0.,        0.0,
+	0.,        0.,
       // DistUp
-        1.787943,  0.0,      2.942310, 0.199815,  0.0,       0.249909,
-        0.189697,  0.0,
+        0.,        0.,       0.,       0.,        0.,        0.0,
+	0.,        0.,
       // DistLo
-        0.589406,  0.0,     -0.083964,-0.007975,  0.0,       0.045374,
-       -0.001750,  0.0,
+        0.,        0.,       0.,       0.,        0.,        0.0,
+	0.,        0.,
       // AsymUp
         1.e10,     0.0,      0.0,      0.0,       0.0,       0.0,
@@ -1975,42 +1989,43 @@
       Double_t vsteps[104] = {
       // LengthUp
-        0.03,      0.0002,   0.02,     0.0006,    0.0002,    0.002,
-        0.0008,    0.002,
+	0.02,      0.,       0.,       0.,        0.,        0.0,
+	0.,        0.,
       // LengthLo
-        0.02,      0.003,    0.05,     0.006,     0.002,     0.3,
-        0.0001,    0.0008,
+        0.,        0.,       0.,       0.,        0.,        0.0,
+	0.,        0.,
       // WidthUp
-        0.02,      0.0002,   0.006,    0.003,     0.002,     0.006,
-        0.002,     0.002,
+        0.01,      0.,       0.,       0.,        0.,        0.0,
+	0.,        0.,
       // WidthLo
-        0.009,     0.0007,   0.008,    0.0004,    0.0005,    0.002,
-        0.0007,    0.003,
+        0.,        0.,       0.,       0.,        0.,        0.0,
+	0.,        0.,
       // DistUp
-        0.2,       0.0,      0.3,      0.02,      0.0,       0.03,
-        0.02,      0.0
+        0.,        0.,       0.,       0.,        0.,        0.0,
+	0.,        0.,
       // DistLo
-        0.06,      0.0,      0.009,    0.0008,    0.0,       0.005,
-        0.0002,    0.0
-      // AsymUp  
+        0.,        0.,       0.,       0.,        0.,        0.0,
+	0.,        0.,
+      // AsymUp
         0.0,       0.0,      0.0,      0.0,       0.0,       0.0,
         0.0,       0.0,
-      // AsymLo  
+      // AsymLo
         0.0,       0.0,      0.0,      0.0,       0.0,       0.0,
         0.0,       0.0,
-      // ConcUp  
+      // ConcUp
         0.0,       0.0,      0.0,      0.0,       0.0,       0.0,
         0.0,       0.0,
-      // ConcLo  
+      // ConcLo
         0.0,       0.0,      0.0,      0.0,       0.0,       0.0,
         0.0,       0.0,
-      // Leakage1Up  
+      // Leakage1Up
         0.0,       0.0,      0.0,      0.0,       0.0,       0.0,
         0.0,       0.0,
-      // Leakage1Lo  
+      // Leakage1Lo
         0.0,       0.0,      0.0,      0.0,       0.0,       0.0,
         0.0,       0.0,
-      // AlphaUp  
-        0.0,       0.0,      0.0,      0.0,       0.0,       0.0,
+      // AlphaUp
+	0.0,       0.0,      0.0,      0.0,       0.0,       0.0,
         0.0,       0.0                                                 };
+
 
       params.Set(104, vparams);
@@ -2142,7 +2157,7 @@
 
       write.AddContainer("MRawRunHeader", "RunHeaders");
-      write.AddContainer("MTime",         "Events");
+      //write.AddContainer("MTime",         "Events");
       write.AddContainer("MMcEvt",        "Events");
-      write.AddContainer("ThetaOrig",     "Events");
+      //write.AddContainer("ThetaOrig",     "Events");
       write.AddContainer("MSrcPosCam",    "Events");
       write.AddContainer("MSigmabar",     "Events");
@@ -2152,5 +2167,5 @@
       write.AddContainer("MNewImagePar",  "Events");
 
-      write.AddContainer("HadRF",         "Events");
+      //write.AddContainer("HadRF",         "Events");
       write.AddContainer(hadSCName,       "Events");
     
Index: trunk/MagicSoft/Mars/manalysis/MPedestalWorkaround.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPedestalWorkaround.cc	(revision 3139)
+++ trunk/MagicSoft/Mars/manalysis/MPedestalWorkaround.cc	(revision 3140)
@@ -51,7 +51,6 @@
 #include "MGeomCam.h"
 
-#include "MPedestalCam.h"
-#include "MPedestalPix.h"
 #include "MPedPhotCam.h"
+#include "MPedPhotPix.h"
 #include "MMcEvt.hxx"
 #include "MRawRunHeader.h"
@@ -73,4 +72,5 @@
 Int_t MPedestalWorkaround::PreProcess(MParList *pList)
 {
+  /*
    fPed = (MPedestalCam*)pList->FindObject("MPedestalCam");
    if (!fPed)
@@ -79,4 +79,5 @@
        return kFALSE;
      }
+  */
 
    fPedPhot = (MPedPhotCam*)pList->FindObject("MPedPhotCam");
@@ -101,5 +102,5 @@
    }
 
-   fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
+   fMcEvt = (MMcEvt*)pList->FindCreateObj("MMcEvt");
    if (!fMcEvt)
    {
@@ -119,21 +120,11 @@
   // from MPedPhotCam into MPedestalCam   
 
+  // set pedestalRMS = 0 if it is too high
   UInt_t imaxnumpix = fCam->GetNumPixels();
-
   for (UInt_t i=0; i<imaxnumpix; i++)
   {
-    Int_t type = 0;
-    Double_t val;
-    Float_t valout;
-    fPedPhot->GetPixelContent( val, i, *fCam, type);
-    valout = (*fPed)[i].GetPedestal();
-    (*fPed)[i].SetPedestal(val);
-    *fLog << "i, val, valout : " << i <<",  "<<  val<<",  " << valout << endl;
-    type = 1;
-    fPedPhot->GetPixelContent( val, i, *fCam, type);
-    valout = (*fPed)[i].GetPedestalRms();
-    (*fPed)[i].SetPedestalRms(val);
-    *fLog << "RMS : i, val, valout : " << i <<",  "<<  val<<",  " << valout 
-          << endl;
+    Double_t val = (*fPedPhot)[i].GetRms();
+    if (val < 0.0 || val > 10.0)
+      (*fPedPhot)[i].SetRms(0.0);
   }
 
@@ -142,7 +133,10 @@
   // put the zenith angle into MMcEvt
 
-  Int_t run = fRun->GetRunNumber();
   Double_t thetadeg;
   Double_t thetarad;
+
+
+  /*
+  Int_t run = fRun->GetRunNumber();
 
   if      (run == 3127)  thetadeg = 27.2;  // Crab
@@ -537,4 +531,8 @@
 
   thetarad = thetadeg / kRad2Deg;
+  */
+
+  thetadeg = 10.0;
+  thetarad = thetadeg / kRad2Deg;
   fMcEvt->SetTelescopeTheta(thetarad);
   
Index: trunk/MagicSoft/Mars/manalysis/MSupercuts.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MSupercuts.cc	(revision 3139)
+++ trunk/MagicSoft/Mars/manalysis/MSupercuts.cc	(revision 3140)
@@ -74,59 +74,59 @@
 {
     //---------------------------------------------------
-    //  these are Daniel's original values for Mkn 421
-
-    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;
-
-    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;
-
-    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;
-
-    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;
-
-    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;
-
-    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;
+    //  these are the default values
+
+    fLengthUp[0] =  0.2;
+    fLengthUp[1] =  0.0;
+    fLengthUp[2] =  0.0;
+    fLengthUp[3] =  0.0;
+    fLengthUp[4] =  0.0;
+    fLengthUp[5] =  0.0;
+    fLengthUp[6] =  0.0;
+    fLengthUp[7] =  0.0;
+
+    fLengthLo[0] =  0.;
+    fLengthLo[1] =  0.;
+    fLengthLo[2] =  0.;
+    fLengthLo[3] =  0.;
+    fLengthLo[4] =  0.;
+    fLengthLo[5] =  0.;
+    fLengthLo[6] =  0.;
+    fLengthLo[7] =  0.;
+
+    fWidthUp[0] =  0.1;
+    fWidthUp[1] =  0.0;
+    fWidthUp[2] =  0.0;
+    fWidthUp[3] =  0.0;
+    fWidthUp[4] =  0.0;
+    fWidthUp[5] =  0.0;
+    fWidthUp[6] =  0.0;
+    fWidthUp[7] =  0.0;
+
+    fWidthLo[0] =  0.;
+    fWidthLo[1] =  0.;
+    fWidthLo[2] =  0.;
+    fWidthLo[3] =  0.;
+    fWidthLo[4] =  0.;
+    fWidthLo[5] =  0.;
+    fWidthLo[6] =  0.;
+    fWidthLo[7] =  0.;
+
+    fDistUp[0] =  1.e10;
+    fDistUp[1] =  0.0;
+    fDistUp[2] =  0.0;
+    fDistUp[3] =  0.0;
+    fDistUp[4] =  0.0;
+    fDistUp[5] =  0.0;
+    fDistUp[6] =  0.0;
+    fDistUp[7] =  0.0;
+
+    fDistLo[0] =  0.0;
+    fDistLo[1] =  0.0;
+    fDistLo[2] =  0.0;
+    fDistLo[3] =  0.0;
+    fDistLo[4] =  0.0;
+    fDistLo[5] =  0.0;
+    fDistLo[6] =  0.0;
+    fDistLo[7] =  0.0;
     
 
@@ -202,61 +202,61 @@
 
     // LengthUp
-    fStepsizes[0] = 0.03;
-    fStepsizes[1] = 0.0002;
-    fStepsizes[2] = 0.02;
-    fStepsizes[3] = 0.0006;
-    fStepsizes[4] = 0.0002;
-    fStepsizes[5] = 0.002;
-    fStepsizes[6] = 0.0008;
-    fStepsizes[7] = 0.002;
+    fStepsizes[0] = 0.02;
+    fStepsizes[1] = 0.0;
+    fStepsizes[2] = 0.0;
+    fStepsizes[3] = 0.0;
+    fStepsizes[4] = 0.0;
+    fStepsizes[5] = 0.0;
+    fStepsizes[6] = 0.0;
+    fStepsizes[7] = 0.0;
 
     // LengthLo
-    fStepsizes[8]  = 0.02;
-    fStepsizes[9]  = 0.003;
-    fStepsizes[10] = 0.05;
-    fStepsizes[11] = 0.006;
-    fStepsizes[12] = 0.002;
-    fStepsizes[13] = 0.3;
-    fStepsizes[14] = 0.0001;
-    fStepsizes[15] = 0.0008;
+    fStepsizes[8]  = 0.0;
+    fStepsizes[9]  = 0.0;
+    fStepsizes[10] = 0.0;
+    fStepsizes[11] = 0.0;
+    fStepsizes[12] = 0.0;
+    fStepsizes[13] = 0.0;
+    fStepsizes[14] = 0.0;
+    fStepsizes[15] = 0.0;
 
     // WidthUp
-    fStepsizes[16] = 0.02;
-    fStepsizes[17] = 0.0002;
-    fStepsizes[18] = 0.006;
-    fStepsizes[19] = 0.003;
-    fStepsizes[20] = 0.002;
-    fStepsizes[21] = 0.006;
-    fStepsizes[22] = 0.002;
-    fStepsizes[23] = 0.002;
+    fStepsizes[16] = 0.01;
+    fStepsizes[17] = 0.0;
+    fStepsizes[18] = 0.0;
+    fStepsizes[19] = 0.0;
+    fStepsizes[20] = 0.0;
+    fStepsizes[21] = 0.0;
+    fStepsizes[22] = 0.0;
+    fStepsizes[23] = 0.0;
 
     // WidthLo
-    fStepsizes[24] = 0.009;
-    fStepsizes[25] = 0.0007;
-    fStepsizes[26] = 0.008;
-    fStepsizes[27] = 0.0004;
-    fStepsizes[28] = 0.0005;
-    fStepsizes[29] = 0.002;
-    fStepsizes[30] = 0.0007;
-    fStepsizes[31] = 0.003;
+    fStepsizes[24] = 0.0;
+    fStepsizes[25] = 0.0;
+    fStepsizes[26] = 0.0;
+    fStepsizes[27] = 0.0;
+    fStepsizes[28] = 0.0;
+    fStepsizes[29] = 0.0;
+    fStepsizes[30] = 0.0;
+    fStepsizes[31] = 0.0;
 
     // DistUp
-    fStepsizes[32] = 0.2;
+    fStepsizes[32] = 0.0;
     fStepsizes[33] = 0.0;
-    fStepsizes[34] = 0.3;
-    fStepsizes[35] = 0.02;
+    fStepsizes[34] = 0.0;
+    fStepsizes[35] = 0.0;
     fStepsizes[36] = 0.0;
-    fStepsizes[37] = 0.03;
-    fStepsizes[38] = 0.02;
+    fStepsizes[37] = 0.0;
+    fStepsizes[38] = 0.0;
     fStepsizes[39] = 0.0;
 
     // DistLo
-    fStepsizes[40] = 0.06;
+    fStepsizes[40] = 0.0;
     fStepsizes[41] = 0.0;
-    fStepsizes[42] = 0.009;
-    fStepsizes[43] = 0.0008;
+    fStepsizes[42] = 0.0;
+    fStepsizes[43] = 0.0;
     fStepsizes[44] = 0.0;
-    fStepsizes[45] = 0.005;
-    fStepsizes[46] = 0.0002;
+    fStepsizes[45] = 0.0;
+    fStepsizes[46] = 0.0;
     fStepsizes[47] = 0.0;
 
Index: trunk/MagicSoft/Mars/manalysis/MSupercutsCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MSupercutsCalc.cc	(revision 3139)
+++ trunk/MagicSoft/Mars/manalysis/MSupercutsCalc.cc	(revision 3140)
@@ -157,5 +157,5 @@
     // define cut-function
     //
-    //    dNOMLOGSIZE = 4.1 (=log(60.0)
+    //    dNOMLOGSIZE = 5.0 (=log(150.0)
     //    dNOMCOSZA   = 1.0
     //
Index: trunk/MagicSoft/Mars/mcalib/CalibLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/CalibLinkDef.h	(revision 3139)
+++ trunk/MagicSoft/Mars/mcalib/CalibLinkDef.h	(revision 3140)
@@ -6,4 +6,5 @@
 
 #pragma link C++ class MCalibrate+;
+#pragma link C++ class MCalibrateData+;
 
 #pragma link C++ class MCalibrationPix+;
Index: trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc	(revision 3140)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc	(revision 3140)
@@ -0,0 +1,336 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Javier Lopez    12/2003 <mailto:jlopez@ifae.es>
+!   Modified by: Javier Rico   01/2004 <mailto:jrico@ifae.es>
+!              Wolfgang Wittek 02/2004 <mailto:wittek@mppmu.mpg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
+!
+!
+\* ======================================================================== */
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//   MCalibrateData
+//
+//   This task takes the integrated charge from MExtractedSignal and apply
+//   the calibration constants from MCalibraitionCam to the charge. Then
+//   stores number of photons obtained in MCerPhotEvt. Selection of different
+//   calibration methods is allowed through SetCalibrationMode member function
+//
+//   in ReInit the MPedPhotCam container is filled using the information from
+//   MPedestalCam, MExtractedSignalCam and MCalibrationCam
+//
+//   Input Containers:
+//    MPedestalCam
+//    MExtractedSingalCam
+//    MCalibrationCam
+//
+//   Output Containers:
+//    MPedPhotCam
+//    MCerPhotEvt
+//
+//////////////////////////////////////////////////////////////////////////////
+#include "MCalibrateData.h"
+#include "MCalibrationConfig.h"
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "MParList.h"
+#include "MH.h"
+
+#include "MGeomCam.h"
+
+#include "MPedestalCam.h"
+#include "MPedestalPix.h"
+
+#include "MCalibrationCam.h"
+#include "MCalibrationPix.h"
+
+#include "MExtractedSignalCam.h"
+#include "MExtractedSignalPix.h"
+
+#include "MPedPhotCam.h"
+#include "MPedPhotPix.h"
+
+#include "MCerPhotEvt.h"
+
+ClassImp(MCalibrateData);
+
+using namespace std;
+// --------------------------------------------------------------------------
+//
+// Default constructor. 
+//
+MCalibrateData::MCalibrateData(CalibrationMode_t calmode,const char *name, const char *title) : fCalibrationMode(calmode)
+{
+    fName  = name  ? name  : "MCalibrateData";
+    fTitle = title ? title : "Task to calculate the number of photons in one event";
+}
+
+// --------------------------------------------------------------------------
+//
+// The PreProcess searches for the following input containers:
+//  - MGeomCam
+//  - MPedestalCam
+//  - MCalibrationCam
+//  - MExtractedSignalCam
+//
+// The following output containers are also searched and created if
+// they were not found:
+//
+//  - MPedPhotCam
+//  - MCerPhotEvt
+//
+Int_t MCalibrateData::PreProcess(MParList *pList)
+{
+    fPedestal = (MPedestalCam*)pList->FindObject(AddSerialNumber("MPedestalCam"));
+    if (!fPedestal)
+    {
+      *fLog << err << AddSerialNumber("MPedestalCam") << " not found ... aborting" << endl;
+        return kFALSE;
+    }
+
+    fSignals = (MExtractedSignalCam*)pList->FindObject(AddSerialNumber("MExtractedSignalCam"));
+    if (!fSignals)
+    {
+      *fLog << err << AddSerialNumber("MExtractedSignalCam") << " not found ... aborting" << endl;
+        return kFALSE;
+    }
+
+   if(fCalibrationMode>kNone)
+      {
+	fCalibrations = (MCalibrationCam*)pList->FindObject(AddSerialNumber("MCalibrationCam"));
+	if (!fCalibrations)
+	  {
+	    *fLog << err << AddSerialNumber("MCalibrationCam") << " not found ... aborting." << endl;
+	    return kFALSE;
+	  }
+      }
+
+    fPedPhot = (MPedPhotCam*)pList->FindCreateObj(AddSerialNumber("MPedPhotCam"));
+    if (!fPedPhot)
+        return kFALSE;
+
+    fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj(AddSerialNumber("MCerPhotEvt"));
+    if (!fCerPhotEvt)
+        return kFALSE;
+    
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Check for validity of the selected calibration method, switch to a 
+// different one in case of need
+//
+// fill the MPedPhotCam container using the information from MPedestalCam,
+// MExtractedSignalCam and MCalibrationCam
+//
+//
+Bool_t MCalibrateData::ReInit(MParList *pList)
+{
+
+  if(fCalibrationMode == kBlindPixel && !fCalibrations->IsBlindPixelMethodValid())
+    {
+      *fLog << warn << GetDescriptor() << "Warning: Blind pixel calibration method not valid, switching to F-factor method" << endl;
+      fCalibrationMode = kFfactor;
+    }
+
+  if(fCalibrationMode == kPinDiode && !fCalibrations->IsPINDiodeMethodValid())
+    { 
+      *fLog << warn << GetDescriptor() << "Warning: PIN diode calibration method not valid, switching to F-factor method" << endl;
+      fCalibrationMode = kFfactor;
+    }
+
+  //---------------------------------------------
+  // fill MPedPhot container using the informations from
+  // MPedestalCam, MExtractedSignalCam and MCalibrationCam
+
+  fNumUsedHiGainFADCSlices = fSignals->GetNumUsedHiGainFADCSlices();
+
+  // is pixid equal to pixidx ?
+  if (fPedestal->GetSize() != fSignals->GetSize())
+  {
+    *fLog << err << "MCalibrateData::ReInit(); sizes of MPedestalCam and MCalibrationCam are different" 
+          << endl;
+  } 
+
+  *fLog << all << "MCalibrateData::ReInit(); fill MPedPhotCam container"
+        << endl;
+  *fLog << all << "     fNumUsedHiGainADCSlices = " 
+        <<  fNumUsedHiGainFADCSlices << endl;
+  *fLog << all << "     pixid, calibrationConversionFactor, ped, pedRMS, pedphot, pedphotRMS :"
+        << endl;
+  for (Int_t pixid=0; pixid<fPedestal->GetSize(); pixid++)
+  {
+    const MPedestalPix    &ped = (*fPedestal)[pixid];
+
+    // pedestals/(used FADC slices)   in [ADC] counts
+    Float_t pedes  = ped.GetPedestal()    * fNumUsedHiGainFADCSlices;
+    Float_t pedrms = ped.GetPedestalRms() * sqrt(fNumUsedHiGainFADCSlices);
+
+    //----------------------------------
+    // get photon/ADC conversion factor
+
+    Float_t hiloconv;
+    Float_t hiloconverr;
+    Float_t calibrationConversionFactor;
+    Float_t calibrationConversionFactorError;
+
+    if ( !GetConversionFactor(pixid, hiloconv, hiloconverr,
+	  calibrationConversionFactor, calibrationConversionFactorError) )
+      continue;
+
+    //---------------------------------- 
+
+    // pedestals/(used FADC slices)   in [number of photons] 
+    Float_t pedphot    = pedes  * calibrationConversionFactor;
+    Float_t pedphotrms = pedrms * calibrationConversionFactor;
+
+    (*fPedPhot)[pixid].Set(pedphot, pedphotrms);
+
+    *fLog << all << pixid << ",  " << calibrationConversionFactor << ",  "
+          << ped.GetPedestal() << ",  " << ped.GetPedestalRms() << ",  " 
+          << pedphot << ",  " << pedphotrms << endl;
+  }
+
+  //---------------------------------------------
+
+  fPedPhot->SetReadyToSave();
+
+  return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Get conversion factor and its error from MCalibrationCam
+// 
+//
+Bool_t MCalibrateData::GetConversionFactor(UInt_t pixidx,
+ Float_t &hiloconv, Float_t &hiloconverr,
+ Float_t &calibrationConversionFactor, Float_t &calibrationConversionFactorError)
+{
+  hiloconv    = 1.;
+  hiloconverr = 0.;
+  calibrationConversionFactor      = 1.;
+  calibrationConversionFactorError = 0.;
+
+  if(fCalibrationMode!=kNone)
+  {
+    MCalibrationPix &pix = (*fCalibrations)[pixidx];       
+	  
+    if (!pix.IsChargeValid())
+      return kFALSE;
+	  
+    hiloconv   = pix.GetConversionHiLo();
+    hiloconverr= pix.GetConversionHiLoError();
+	  
+    switch(fCalibrationMode)
+    {
+      case kBlindPixel:
+      calibrationConversionFactor      = pix.GetMeanConversionBlindPixelMethod();
+      calibrationConversionFactorError = pix.GetErrorConversionBlindPixelMethod();
+      break;
+      case kFfactor:
+      calibrationConversionFactor      = pix.GetMeanConversionFFactorMethod();
+      calibrationConversionFactorError = pix.GetErrorConversionFFactorMethod();
+      break;
+      default:
+      *fLog << warn << "MCalibrateData::GetConversionFactor; Warning: Calibration mode value ("<<fCalibrationMode<<") not known" << endl;
+	      break;
+    }
+  }
+
+  return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Apply the calibration factors to the extracted signal according to the 
+// selected calibration method
+//
+Int_t MCalibrateData::Process()
+{
+  /*
+    if (fCalibrations->GetNumPixels() != (UInt_t)fSignals->GetSize())
+    {
+        // FIXME: MExtractedSignal must be of variable size -
+        //        like MCerPhotEvt - because we must be able
+        //        to reduce size by zero supression
+        //        For the moment this check could be done in ReInit...
+        *fLog << err << "MExtractedSignal and MCalibrationCam have different sizes... abort." << endl;
+        return kFALSE;
+    }
+  */
+
+  UInt_t npix = fSignals->GetSize();
+
+  Float_t hiloconv;
+  Float_t hiloconverr;
+  Float_t calibrationConversionFactor;
+  Float_t calibrationConversionFactorError;
+  
+  for (UInt_t pixidx=0; pixidx<npix; pixidx++)
+    {
+      if ( !GetConversionFactor(pixidx, hiloconv, hiloconverr,
+	    calibrationConversionFactor, calibrationConversionFactorError) )
+        continue;
+      
+      MExtractedSignalPix &sig =  (*fSignals)[pixidx];
+      
+      Float_t signal;
+      Float_t signalErr = 0.;
+      Float_t nphot,nphotErr;
+            
+      if (sig.IsLoGainUsed())
+        {
+          signal    = sig.GetExtractedSignalLoGain()*hiloconv;
+          signalErr = signal*hiloconverr;
+        }
+      else
+        {
+	  if (sig.GetExtractedSignalHiGain() > 9999.)
+	    {
+	      signal = 0.;
+	      signalErr = 0.;
+	    }
+	  else
+	    signal = sig.GetExtractedSignalHiGain();
+        }
+      
+      nphot    = signal*calibrationConversionFactor;
+      nphotErr = signal*calibrationConversionFactorError
+	*signal*calibrationConversionFactorError
+	+signalErr*calibrationConversionFactor
+	*signalErr*calibrationConversionFactor;
+      
+      nphotErr  = TMath::Sqrt(nphotErr);
+      
+      MCerPhotPix *cpix = fCerPhotEvt->AddPixel(pixidx, nphot, nphotErr);
+
+      if (sig.GetNumLoGainSaturated() > 0)
+	cpix->SetPixelSaturated();
+    }
+  
+  fCerPhotEvt->FixSize();
+  fCerPhotEvt->SetReadyToSave();
+  
+  return kTRUE;
+}
Index: trunk/MagicSoft/Mars/mcalib/MCalibrateData.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrateData.h	(revision 3140)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrateData.h	(revision 3140)
@@ -0,0 +1,69 @@
+#ifndef MARS_MCalibrateData
+#define MARS_MCalibrateData
+
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+// MCalibrateData
+//                                                                         //
+// Integrates the desired ADC time slices of one pixel and apply           //
+// calibration constants                                                   //
+//                                                                         //
+// Differences between MCalibrateData and MCalibrate :
+// in MCalibrateData
+// - in ReInit the MPedPhot container is filled using
+//      - the pedstals/slice from MPedestalCam
+//      - the number of used FADC slices from MExtractedSignalCam   
+//      - the photon/ADC conversion factor from MCalibrationCam
+//                                                                         //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
+#ifndef MARS_MTask
+#include "MTask.h"
+#endif
+
+class MGeomCam;
+class MPedestalCam;
+class MCalibrationCam;
+class MExtractedSignalCam;
+
+class MPedPhotCam;
+class MCerPhotEvt;
+
+class MCalibrateData : public MTask
+{
+private:
+    MPedestalCam        *fPedestal;     // Pedestals/slice [ADC counts]
+    MCalibrationCam     *fCalibrations; // Calibration constants 
+    MExtractedSignalCam *fSignals;      // Integrated charge in FADCs counts
+
+    MPedPhotCam         *fPedPhot;      // Pedestals/(used slices) [photons]
+    MCerPhotEvt         *fCerPhotEvt;   // Cerenkov Photon Event used for calculation
+
+    Float_t fNumUsedHiGainFADCSlices;
+    Float_t fNumUsedLoGainFADCSlices;
+
+    Float_t  fConversionHiLo;
+    UShort_t fCalibrationMode;
+
+    Bool_t GetConversionFactor(UInt_t, 
+                               Float_t &, Float_t &, Float_t &, Float_t &);    
+
+    Int_t  PreProcess(MParList *pList);
+    Bool_t ReInit(MParList *pList);
+    Int_t  Process();
+
+public:
+
+    enum CalibrationMode_t{kNone=0,kBlindPixel,kFfactor,kPinDiode,kCombined};
+    static const CalibrationMode_t kDefault = kBlindPixel;
+
+    MCalibrateData(CalibrationMode_t calmode = kDefault,const char *name=NULL, const char *title=NULL);
+
+    void SetConversionHiLo(Float_t conv) { fConversionHiLo = conv; };
+    void SetCalibrationMode(CalibrationMode_t calmode=kDefault){ fCalibrationMode=calmode;};
+    
+    ClassDef(MCalibrateData, 0)   // Task to calculate cerenkov photons using calibration constants
+};
+ 
+
+#endif
Index: trunk/MagicSoft/Mars/mcalib/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mcalib/Makefile	(revision 3139)
+++ trunk/MagicSoft/Mars/mcalib/Makefile	(revision 3140)
@@ -37,4 +37,5 @@
 
 SRCFILES = MCalibrate.cc \
+	   MCalibrateData.cc \
 	   MCalibrationCalc.cc \
            MCalibrationPix.cc  \
Index: trunk/MagicSoft/Mars/mhist/MHBlindPixels.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHBlindPixels.cc	(revision 3139)
+++ trunk/MagicSoft/Mars/mhist/MHBlindPixels.cc	(revision 3140)
@@ -35,5 +35,5 @@
 #include "MMcEvt.hxx"
 #include "MBlindPixels.h"
-#include "MPedestalCam.h"
+#include "MPedPhotCam.h"
 #include "MParList.h"
 #include "MBinning.h"
@@ -85,11 +85,12 @@
     }
 
-    fPed = (MPedestalCam*)plist->FindObject("MPedestalCam");
-    if (!fPed)
+    
+    fPedPhot = (MPedPhotCam*)plist->FindObject("MPedPhotCam");
+    if (!fPedPhot)
     {
-        *fLog << err << "MPedestalCam not found... aborting." << endl;
+        *fLog << err << "MPedPhotCam not found... aborting." << endl;
         return kFALSE;
     }
-
+    
 
     // Get Theta Binning
@@ -102,5 +103,5 @@
 
     // Get binning for pixel number
-    const UInt_t npix1 = fPed->GetSize()+1;
+    const UInt_t npix1 = fPedPhot->GetSize()+1;
 
     MBinning binspix("BinningPixel");
@@ -166,5 +167,5 @@
 
     // FIXME: Slow.
-    const UInt_t npix = fPed->GetSize();
+    const UInt_t npix = fPedPhot->GetSize();
 
     UInt_t nb = 0;
Index: trunk/MagicSoft/Mars/mhist/MHBlindPixels.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHBlindPixels.h	(revision 3139)
+++ trunk/MagicSoft/Mars/mhist/MHBlindPixels.h	(revision 3140)
@@ -9,5 +9,5 @@
 #endif
 
-class MPedestalCam;
+class MPedPhotCam;
 class MMcEvt;
 class MParList;
@@ -17,5 +17,5 @@
 {
 private:
-    MPedestalCam  *fPed;      //!
+    MPedPhotCam   *fPedPhot;      //!
     MMcEvt        *fMcEvt;    //!
 
Index: trunk/MagicSoft/Mars/mhist/MHSigmaTheta.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHSigmaTheta.cc	(revision 3139)
+++ trunk/MagicSoft/Mars/mhist/MHSigmaTheta.cc	(revision 3140)
@@ -95,6 +95,6 @@
     MBinning binst;
     MBinning binsd;
-    binsd.SetEdges(100, -5, 20);
-    binsb.SetEdges(100, 0, 5);
+    binsd.SetEdges(100, -10, 20);
+    binsb.SetEdges(100, 0, 10);
     binst.SetEdgesCos(10, 0, 90);
 
@@ -166,8 +166,11 @@
 
     // Get binning for pixel number
-    const UInt_t npix1 = fPed->GetSize()+1;
-
+    //const UInt_t npix1 = fPed->GetSize()+1;
+    //*fLog << "npix1 = " << npix1 << endl;
+    //MBinning binspix("BinningPixel");
+    //binspix.SetEdges(npix1, -0.5, npix1-0.5);
+    // the above gives npix1 = 1; therefore :
     MBinning binspix("BinningPixel");
-    binspix.SetEdges(npix1, -0.5, npix1-0.5);
+    binspix.SetEdges(578, -0.5, 577.5);
 
     // Set binnings in histograms
@@ -191,5 +194,8 @@
 {
     Double_t theta = fMcEvt ? fMcEvt->GetTelescopeTheta()*kRad2Deg : 0;
-    Double_t mysig = fSigmabar->Calc(*fCam, *fPed, *fEvt);
+    fSigmabar->Calc(*fCam, *fPed, *fEvt);
+    Double_t mysig = fSigmabar->GetSigmabarInner();
+
+    //*fLog << "theta, mysig = " << theta << ",  " << mysig << endl;
 
     fSigmaTheta.Fill(theta, mysig);
@@ -211,5 +217,5 @@
         const Double_t sigma = pix.GetRms();
 
-        fSigmaPixTheta.Fill(theta, (Double_t)id, sigma);
+        fSigmaPixTheta.Fill(theta, (Double_t)id, sigma*sqrt(ratio));
 
         const Double_t diff = sigma*sigma*ratio - mysig*mysig;
