Index: trunk/MagicSoft/Mars/manalysis/MCerPhotCalc2.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotCalc2.cc	(revision 1439)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotCalc2.cc	(revision 1443)
@@ -73,4 +73,6 @@
     AddToBranchList("MRawEvtData.fHiGainFadcSamples");
     AddToBranchList("MRawEvtData.fLoGainFadcSamples");
+
+    SetDefaultWeights();
 }
 
@@ -115,5 +117,5 @@
     // Calculate quadratic sum of weights:
     fSumQuadWeights = 0.;
-    for (Int_t i = 0; i < 15; i++)
+    for (Int_t i = 0; i < fWeight.GetSize(); i++)
       fSumQuadWeights += fWeight[i]*fWeight[i];
 
@@ -138,7 +140,7 @@
     }
 
-    if (fRunHeader->GetNumSamplesHiGain() != 15)
-    {
-        *fLog << dbginf << "Number of FADC slices (" << fRunHeader->GetNumSamplesHiGain() <<") is different from expected (15)... aborting." << endl;
+    if (fRunHeader->GetNumSamplesHiGain() != fWeight.GetSize())
+    {
+        *fLog << dbginf << "Number of FADC slices (" << fRunHeader->GetNumSamplesHiGain() <<") is different from assumed one (" << fWeight.GetSize() << ")... aborting." << endl;
         return kFALSE;
     }
@@ -171,5 +173,5 @@
     MRawEvtPixelIter pixel(fRawEvt);
 
-    Float_t BinSignal[15];
+    TArrayF BinSignal(fWeight.GetSize());
 
     while (pixel.Next())
@@ -194,5 +196,5 @@
 	Float_t nphot = 0.;
 
-	for(Int_t i = 0; i<15; i++)
+	for(Int_t i = 0; i<fWeight.GetSize(); i++)
 	  {
 	    BinSignal[i] =  (Float_t) ptr[i] - mean;
@@ -212,4 +214,17 @@
 }
 
-// Default weights: 
-Float_t MCerPhotCalc2::fWeight[] = {0, 0.0809835, 0.289593, 0.366926, 0.211665, 0.0508328, 0., 0., 0., 0., 0., 0., 0., 0., 0.};
+//
+// Set default values for the number of slices and weights:
+//
+
+void MCerPhotCalc2::SetDefaultWeights()
+{
+  const Float_t dummy[15] = {0, 0.0809835, 0.289593, 0.366926, 0.211665, 0.0508328, 0., 0., 0., 0., 0., 0., 0., 0., 0.};
+
+  fWeight.Set(15,dummy);
+  return;
+}
+
+
+
+
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotCalc2.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotCalc2.h	(revision 1439)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotCalc2.h	(revision 1443)
@@ -15,8 +15,11 @@
 #endif
 
+#include <TArrayF.h>
+
 class MRawEvtData;
 class MPedestalCam;
 class MCerPhotEvt;
 class MRawRunHeader;
+class TArrayF;
 
 class MCerPhotCalc2 : public MTask
@@ -29,6 +32,8 @@
     Bool_t          fEnableFix;  // fix for a bug in files from older camera versions (<=40)
 
-    static Float_t  fWeight[15];  // Weights for adding up the ADC slices
+    TArrayF         fWeight;  // Weights for adding up the ADC slices
     Float_t         fSumQuadWeights;
+
+    void SetDefaultWeights();
 
 public:
@@ -39,5 +44,5 @@
     Bool_t ReInit(MParList *pList);
 
-    void   SetWeights(Float_t *w) {memcpy(fWeight,w,15*sizeof(Float_t));}
+    void   SetWeights(TArrayF w) {fWeight.Set(w.GetSize(),w.GetArray());}
 
     ClassDef(MCerPhotCalc2, 0)   // Task to calculate cerenkov photons from raw data
