Index: trunk/MagicSoft/Mars/mcalib/MCalibrationQECam.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationQECam.cc	(revision 5136)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationQECam.cc	(revision 5137)
@@ -74,19 +74,19 @@
 /////////////////////////////////////////////////////////////////////////////
 #include "MCalibrationQECam.h"
+#include "MCalibrationQEPix.h"
 
 #include <TOrdCollection.h>
+#include <TGraphErrors.h>
+#include <TH2D.h>
 
 #include "MLog.h"
 #include "MLogManip.h"
 
-#include "MCalibrationQEPix.h"
-
 ClassImp(MCalibrationQECam);
 
 using namespace std;
 
-const Float_t MCalibrationQECam::gkPlexiglassQE    = 0.96;
+const Float_t MCalibrationQECam::gkPlexiglassQE    = 0.92;
 const Float_t MCalibrationQECam::gkPlexiglassQEErr = 0.01;
-
 // --------------------------------------------------------------------------
 //
@@ -785,9 +785,141 @@
 }
 
-
-
-
-
-
-
-
+// --------------------------------------------------------------------------
+//
+// Returns a TGraphErrors correlating the corning blues with the 
+// calcualted quantum efficiency of each pixel, obtained with the F-Factor 
+// method.
+// 
+TGraphErrors *MCalibrationQECam::GetGraphQEvsCorningBlues() const
+{
+
+  const UInt_t size = GetSize();
+
+  if (fCorningBlues.GetSize() == 0)
+    {
+      *fLog << warn << "Size of intialized Cornings Blue is zero, please use MCalibrationQECamMagic" << endl;
+      return NULL;
+    }
+  
+  if (fCorningBlues.GetSize() != size)
+    *fLog << warn << "Sizes mismatch, cannot create Graph!! " << endl;
+
+  TArrayD qes(size);
+  TArrayD qeerrs(size);
+  TArrayD corns(size);
+  TArrayD cornerrs(size);
+  
+  Int_t cnt = 0;
+  
+  for (UInt_t i=0; i<size; i++)
+    {
+      MCalibrationQEPix &pix = (MCalibrationQEPix&)(*this)[i];
+      if (pix.IsFFactorMethodValid() && fCorningBlues[i] > 0. && pix.GetQECascadesFFactorErr() > 0.)
+        {
+          qes   [i] = pix.GetQECascadesFFactor();
+          qeerrs[i] = pix.GetQECascadesFFactorErr();
+          corns [i] = fCorningBlues[i];
+          cornerrs[i] = 0.05;
+          cnt++;
+        }
+    }
+  
+  TGraphErrors *gr = new TGraphErrors(cnt,
+                                     corns.GetArray(),qes.GetArray(),
+                                      cornerrs.GetArray(),qeerrs.GetArray());
+  return gr;
+}
+
+// --------------------------------------------------------------------------
+//
+// Returns a TGraphErrors correlating the corning reds with the 
+// calcualted quantum efficiency of each pixel, obtained with the F-Factor 
+// method.
+// 
+TGraphErrors *MCalibrationQECam::GetGraphQEvsCorningReds() const
+{
+
+  const UInt_t size = GetSize();
+
+  if (fCorningReds.GetSize() == 0)
+    {
+      *fLog << warn << "Size of intialized Cornings Red is zero, please use MCalibrationQECamMagic" << endl;
+      return NULL;
+    }
+  
+  if (fCorningReds.GetSize() != size)
+    *fLog << warn << "Sizes mismatch, cannot create Graph!! " << endl;
+
+  TArrayD qes(size);
+  TArrayD qeerrs(size);
+  TArrayD corns(size);
+  TArrayD cornerrs(size);
+
+  Int_t cnt = 0;
+
+  for (UInt_t i=0; i<size; i++)
+    {
+      MCalibrationQEPix &pix = (MCalibrationQEPix&)(*this)[i];
+      if (pix.IsFFactorMethodValid() && fCorningReds[i] > 0. && pix.GetQECascadesFFactorErr() > 0.)
+        {
+          qes     [i] = pix.GetQECascadesFFactor();
+          qeerrs  [i] = pix.GetQECascadesFFactorErr();
+          corns   [i] = fCorningReds[i];
+          cornerrs[i] = 0.05;
+          cnt++;
+        }
+      
+    }
+  
+  TGraphErrors *gr = new TGraphErrors(cnt,
+                                      corns.GetArray(),qes.GetArray(),
+                                      cornerrs.GetArray(),qeerrs.GetArray());
+  
+  return gr;
+}
+
+TH2D *MCalibrationQECam::GetHistQEvsCorningBlues( const Int_t nbins, const Axis_t first, const Axis_t last ) const
+{
+
+  const UInt_t size = GetSize();
+
+  if (fCorningBlues.GetSize() == 0)
+    return NULL;
+  
+  if (fCorningBlues.GetSize() != size)
+    *fLog << warn << "Sizes mismatch, cannot create Graph!! " << endl;
+
+  TH2D *h = new TH2D("hist","QE vs. Corning Blue",nbins,first,last,nbins,0.,0.35);
+  
+  for (UInt_t i=0; i<size; i++)
+    {
+      MCalibrationQEPix &pix = (MCalibrationQEPix&)(*this)[i];
+      if (pix.IsFFactorMethodValid() && fCorningBlues[i] > 0.)
+        h->Fill(fCorningBlues[i],pix.GetQECascadesFFactor());
+    }
+  
+  return h;
+}
+
+TH2D *MCalibrationQECam::GetHistQEvsCorningReds( const Int_t nbins, const Axis_t first, const Axis_t last ) const
+{
+
+  const UInt_t size = GetSize();
+
+  if (fCorningReds.GetSize() == 0)
+    return NULL;
+  
+  if (fCorningReds.GetSize() != size)
+    *fLog << warn << "Sizes mismatch, cannot create Graph!! " << endl;
+
+  TH2D *h = new TH2D("hist","QE vs. Corning Red",nbins,first,last,nbins,0.,0.35);
+
+  for (UInt_t i=0; i<size; i++)
+    {
+      MCalibrationQEPix &pix = (MCalibrationQEPix&)(*this)[i];
+      if (pix.IsFFactorMethodValid() && fCorningReds[i] > 0.)
+        h->Fill(fCorningReds[i],pix.GetQECascadesFFactor());
+    }
+  
+  return h;
+}
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationQECamMagic.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationQECamMagic.cc	(revision 5136)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationQECamMagic.cc	(revision 5137)
@@ -79,104 +79,105 @@
   
   Double_t creds[577];
-  
-  creds[1] = 1.6;
-  creds[2] = 8.7;
-  creds[3] = 6.8;
-  creds[4] = 10.3;
-  creds[5] = 8.7;
-  creds[6] = -1.;
-  creds[7] = 1.3;
-  creds[8] = 0.4;
-  creds[9] = 7.7 ;
-  creds[10] = 9.8;
-  creds[11] = 5.9;
-  creds[12] = 7.4;
-  creds[13] = 7.4;
-  creds[14] = 7.0;
-  creds[15] = 7.2;
-  creds[16] = 6.8;
-  creds[17] = 6.9;
-  creds[18] = 6.6;
-  creds[19] = 1.8;
-  creds[20] = 4.9;
-  creds[21] = 7.1;
-  creds[22] = 7.7;
-  creds[23] = 8.9;
-  creds[24] = 11.9;
-  creds[25] = 1.6;
-  creds[26] = 9.3;
-  creds[27] = 5.8;
-  creds[28] = 9.0;
-  creds[29] = 6.5;
-  creds[30] = 6.1;
-  creds[31] = 8.1;
-  creds[32] = 6.7;
-  creds[33] = 7.0;
-  creds[34] = 7.1;
-  creds[35] = 7.8;
-  creds[36] = 6.9;
-  creds[37] = 0.9;
-  creds[38] = 3.3;
-  creds[39] = 7.1;
-  creds[40] = 5.8;
-  creds[41] = 4.4;
-  creds[42] = 8.1;
-  creds[43] = 6.0;
-  creds[44] = 6.3;
-  creds[45] = 6.0;
-  creds[46] = 8.0;
-  creds[47] = 0.6;
-  creds[48] = 7.2;
-  creds[49] = 5.6;
-  creds[50] = 7.3;
-  creds[51] = 8.0;
-  creds[52] = 9.1;
-  creds[53] = 1.4;
-  creds[54] = 6.9;
-  creds[55] = 9.1;
-  creds[56] = 6.4;
-  creds[57] = 6.1;
-  creds[58] = 6.2;
-  creds[59] = 7.7;
-  creds[60] = 5.1;
-  creds[61] = 7.9;
-  creds[62] = 6.9;
-  creds[63] = 3.3;
-  creds[64] = 3.7;
-  creds[65] = 5.8;
-  creds[66] = 8.0;
-  creds[67] = 7.3;
-  creds[68] = 7.3;
-  creds[69] = 9.1;
-  creds[70] = 4.0;
-  creds[71] = 8.2;
-  creds[72] = 8.7;
-  creds[73] = 9.1;
-  creds[74] = 8.2;
-  creds[75] = 9.0;
-  creds[76] = 7.8;
-  creds[77] = 7.5;
-  creds[78] = 1.3;
-  creds[79] = 6.9;
-  creds[80] = 8.7;
-  creds[81] = 7.6;
-  creds[82] = 5.6;
-  creds[83] = 10.4;
-  creds[84] = 6.1;
-  creds[85] = 0.9;
-  creds[86] = 7.7;
-  creds[87] = 7.4;
-  creds[88] = 6.9;
-  creds[89] = 7.0;
-  creds[90] = 3.3;
-  creds[91] = 7.1;
-  creds[92] = 5.8;
-  creds[93] = 7.2;
-  creds[94] = 5.4;
-  creds[95] = 7.4;
-  creds[96] = 6.6;
-  creds[97] = 0.0;
-  creds[98] = 6.9;
-  creds[99] = 7.3;
+
+  creds[0]   = -1.;
+  creds[1]   = 1.6;
+  creds[2]   = 8.7;
+  creds[3]   = 6.8;
+  creds[4]   = 10.3;
+  creds[5]   = 8.7;
+  creds[6]   = -1.;
+  creds[7]   = 1.3;
+  creds[8]   = 0.4;
+  creds[9]   = 7.7 ;
+  creds[10]  = 9.8;
+  creds[11]  = 5.9;
+  creds[12]  = 7.4;
+  creds[13]  = 7.4;
+  creds[14]  = 7.0;
+  creds[15]  = 7.2;
+  creds[16]  = 6.8;
+  creds[17]  = 6.9;
+  creds[18]  = 6.6;
+  creds[19]  = 1.8;
+  creds[20]  = 4.9;
+  creds[21]  = 7.1;
+  creds[22]  = 7.7;
+  creds[23]  = 8.9;
+  creds[24]  = 11.9;
+  creds[25]  = 1.6;
+  creds[26]  = 9.3;
+  creds[27]  = 5.8;
+  creds[28]  = 9.0;
+  creds[29]  = 6.5;
+  creds[30]  = 6.1;
+  creds[31]  = 8.1;
+  creds[32]  = 6.7;
+  creds[33]  = 7.0;
+  creds[34]  = 7.1;
+  creds[35]  = 7.8;
+  creds[36]  = 6.9;
+  creds[37]  = 0.9;
+  creds[38]  = 3.3;
+  creds[39]  = 7.1;
+  creds[40]  = 5.8;
+  creds[41]  = 4.4;
+  creds[42]  = 8.1;
+  creds[43]  = 6.0;
+  creds[44]  = 6.3;
+  creds[45]  = 6.0;
+  creds[46]  = 8.0;
+  creds[47]  = 0.6;
+  creds[48]  = 7.2;
+  creds[49]  = 5.6;
+  creds[50]  = 7.3;
+  creds[51]  = 8.0;
+  creds[52]  = 9.1;
+  creds[53]  = 1.4;
+  creds[54]  = 6.9;
+  creds[55]  = 9.1;
+  creds[56]  = 6.4;
+  creds[57]  = 6.1;
+  creds[58]  = 6.2;
+  creds[59]  = 7.7;
+  creds[60]  = 5.1;
+  creds[61]  = 7.9;
+  creds[62]  = 6.9;
+  creds[63]  = 3.3;
+  creds[64]  = 3.7;
+  creds[65]  = 5.8;
+  creds[66]  = 8.0;
+  creds[67]  = 7.3;
+  creds[68]  = 7.3;
+  creds[69]  = 9.1;
+  creds[70]  = 4.0;
+  creds[71]  = 8.2;
+  creds[72]  = 8.7;
+  creds[73]  = 9.1;
+  creds[74]  = 8.2;
+  creds[75]  = 9.0;
+  creds[76]  = 7.8;
+  creds[77]  = 7.5;
+  creds[78]  = 1.3;
+  creds[79]  = 6.9;
+  creds[80]  = 8.7;
+  creds[81]  = 7.6;
+  creds[82]  = 5.6;
+  creds[83]  = 10.4;
+  creds[84]  = 6.1;
+  creds[85]  = 0.9;
+  creds[86]  = 7.7;
+  creds[87]  = 7.4;
+  creds[88]  = 6.9;
+  creds[89]  = 7.0;
+  creds[90]  = 3.3;
+  creds[91]  = 7.1;
+  creds[92]  = 5.8;
+  creds[93]  = 7.2;
+  creds[94]  = 5.4;
+  creds[95]  = 7.4;
+  creds[96]  = 6.6;
+  creds[97]  = 0.0;
+  creds[98]  = 6.9;
+  creds[99]  = 7.3;
   creds[100] = 8.7;
   creds[101] = 6.5;
@@ -665,103 +666,104 @@
   Double_t cblues[577];
 
-  cblues[1] = 12.0;
-  cblues[2] = 12.2;
-  cblues[3] = 12.6;
-  cblues[4] = 12.7;
-  cblues[5] = 12.8;
-  cblues[6] = -1.;
-  cblues[7] = 10.8;
-  cblues[8] = 9.0;
-  cblues[9] = 12.2;
-  cblues[10] = 12.3;
-  cblues[11] = 11.7;
-  cblues[12] = 12.0;
-  cblues[13] = 12.1;
-  cblues[14] = 12.0;
-  cblues[15] = 12.6;
-  cblues[16] = 12.2;
-  cblues[17] = 12.6;
-  cblues[18] = 12.6;
-  cblues[19] = 11.5;
-  cblues[20] = 11.1;
-  cblues[21] = 11.2;
-  cblues[22] = 12.1;
-  cblues[23] = 12.8;
-  cblues[24] = 12.7;
-  cblues[25] = 12.8;
-  cblues[26] = 13.0;
-  cblues[27] = 13.0;
-  cblues[28] = 12.0;
-  cblues[29] = 12.4;
-  cblues[30] = 12.0;
-  cblues[31] = 12.1;
-  cblues[32] = 12.0;
-  cblues[33] = 12.2;
-  cblues[34] = 12.0;
-  cblues[35] = 12.5;
-  cblues[36] = 12.4;
-  cblues[37] = 10.3;
-  cblues[38] = 10.8;
-  cblues[39] = 11.4;
-  cblues[40] = 11.7;
-  cblues[41] = 12.1;
-  cblues[42] = 12.0;
-  cblues[43] = 12.4;
-  cblues[44] = 13.0;
-  cblues[45] = 12.7;
-  cblues[46] = 12.8;
-  cblues[47] = 10.5;
-  cblues[48] = 12.1;
-  cblues[49] = 12.1;
-  cblues[50] = 12.4;
-  cblues[51] = 12.3;
-  cblues[52] = 12.4;
-  cblues[53] = 11.7;
-  cblues[54] = 12.8;
-  cblues[55] = 12.0;
-  cblues[56] = 12.5;
-  cblues[57] = 12.2;
-  cblues[58] = 12.3;
-  cblues[59] = 12.3;
-  cblues[60] = 12.6;
-  cblues[61] = 11.6;
-  cblues[62] = 11.9;
-  cblues[63] = 11.8;
-  cblues[64] = 10.7;
-  cblues[65] = 10.9;
-  cblues[66] = 12.1;
-  cblues[67] = 12.5;
-  cblues[68] = 12.4;
-  cblues[69] = 12.1;
-  cblues[70] = 12.2;
-  cblues[71] = 13.1;
-  cblues[72] = 12.5;
-  cblues[73] = 12.4;
-  cblues[74] = 12.6;
-  cblues[75] = 12.5;
-  cblues[76] = 12.1;
-  cblues[77] = 12.5;
-  cblues[78] = 12.3;
-  cblues[79] = 12.0;
-  cblues[80] = 12.4;
-  cblues[81] = 12.4;
-  cblues[82] = 12.0;
-  cblues[83] = 12.3;
-  cblues[84] = 12.1;
-  cblues[85] = 11.3;
-  cblues[86] = 12.0;
-  cblues[87] = 12.0;
-  cblues[88] = 12.4;
-  cblues[89] = 12.3;
-  cblues[90] = 12.0;
-  cblues[91] = 11.4;
-  cblues[92] = 11.7;
-  cblues[93] = 11.9;
-  cblues[94] = 11.4;
-  cblues[95] = 11.1;
-  cblues[96] = 11.9;
-  cblues[97] = 9.2;
-  cblues[98] = 12.4;
-  cblues[99] = 11.5;
+  cblues[0]   = -1.;
+  cblues[1]   = 12.0;
+  cblues[2]   = 12.2;
+  cblues[3]   = 12.6;
+  cblues[4]   = 12.7;
+  cblues[5]   = 12.8;
+  cblues[6]   = -1.;
+  cblues[7]   = 10.8;
+  cblues[8]   = 9.0;
+  cblues[9]   = 12.2;
+  cblues[10]  = 12.3;
+  cblues[11]  = 11.7;
+  cblues[12]  = 12.0;
+  cblues[13]  = 12.1;
+  cblues[14]  = 12.0;
+  cblues[15]  = 12.6;
+  cblues[16]  = 12.2;
+  cblues[17]  = 12.6;
+  cblues[18]  = 12.6;
+  cblues[19]  = 11.5;
+  cblues[20]  = 11.1;
+  cblues[21]  = 11.2;
+  cblues[22]  = 12.1;
+  cblues[23]  = 12.8;
+  cblues[24]  = 12.7;
+  cblues[25]  = 12.8;
+  cblues[26]  = 13.0;
+  cblues[27]  = 13.0;
+  cblues[28]  = 12.0;
+  cblues[29]  = 12.4;
+  cblues[30]  = 12.0;
+  cblues[31]  = 12.1;
+  cblues[32]  = 12.0;
+  cblues[33]  = 12.2;
+  cblues[34]  = 12.0;
+  cblues[35]  = 12.5;
+  cblues[36]  = 12.4;
+  cblues[37]  = 10.3;
+  cblues[38]  = 10.8;
+  cblues[39]  = 11.4;
+  cblues[40]  = 11.7;
+  cblues[41]  = 12.1;
+  cblues[42]  = 12.0;
+  cblues[43]  = 12.4;
+  cblues[44]  = 13.0;
+  cblues[45]  = 12.7;
+  cblues[46]  = 12.8;
+  cblues[47]  = 10.5;
+  cblues[48]  = 12.1;
+  cblues[49]  = 12.1;
+  cblues[50]  = 12.4;
+  cblues[51]  = 12.3;
+  cblues[52]  = 12.4;
+  cblues[53]  = 11.7;
+  cblues[54]  = 12.8;
+  cblues[55]  = 12.0;
+  cblues[56]  = 12.5;
+  cblues[57]  = 12.2;
+  cblues[58]  = 12.3;
+  cblues[59]  = 12.3;
+  cblues[60]  = 12.6;
+  cblues[61]  = 11.6;
+  cblues[62]  = 11.9;
+  cblues[63]  = 11.8;
+  cblues[64]  = 10.7;
+  cblues[65]  = 10.9;
+  cblues[66]  = 12.1;
+  cblues[67]  = 12.5;
+  cblues[68]  = 12.4;
+  cblues[69]  = 12.1;
+  cblues[70]  = 12.2;
+  cblues[71]  = 13.1;
+  cblues[72]  = 12.5;
+  cblues[73]  = 12.4;
+  cblues[74]  = 12.6;
+  cblues[75]  = 12.5;
+  cblues[76]  = 12.1;
+  cblues[77]  = 12.5;
+  cblues[78]  = 12.3;
+  cblues[79]  = 12.0;
+  cblues[80]  = 12.4;
+  cblues[81]  = 12.4;
+  cblues[82]  = 12.0;
+  cblues[83]  = 12.3;
+  cblues[84]  = 12.1;
+  cblues[85]  = 11.3;
+  cblues[86]  = 12.0;
+  cblues[87]  = 12.0;
+  cblues[88]  = 12.4;
+  cblues[89]  = 12.3;
+  cblues[90]  = 12.0;
+  cblues[91]  = 11.4;
+  cblues[92]  = 11.7;
+  cblues[93]  = 11.9;
+  cblues[94]  = 11.4;
+  cblues[95]  = 11.1;
+  cblues[96]  = 11.9;
+  cblues[97]  = 9.2;
+  cblues[98]  = 12.4;
+  cblues[99]  = 11.5;
   cblues[100] = 12.3;
   cblues[101] = 11.0;
