Index: trunk/MagicSoft/Mars/mraw/MRawEvtData.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawEvtData.cc	(revision 9219)
+++ trunk/MagicSoft/Mars/mraw/MRawEvtData.cc	(revision 9226)
@@ -284,4 +284,5 @@
     name += pix.GetPixelId();
 
+
     Bool_t same = str.Contains("same");
 
@@ -392,4 +393,14 @@
 }
 
+void MRawEvtData::ResetPixels()
+{
+    if (!fRunHeader)
+        return;
+
+    // FIXME: Better give NumNormalPixels if numconnected==0 ?
+
+    ResetPixels(fRunHeader->GetNumNormalPixels(), fRunHeader->GetNumNormalPixels()-1);
+}
+
 // --------------------------------------------------------------------------
 //
@@ -435,5 +446,15 @@
 void MRawEvtData::Set(const MArrayI &data)
 {
-    const UInt_t n = fRunHeader->GetNumSamples()*fConnectedPixels;
+    fConnectedPixels = fHiGainPixId->GetSize();
+
+    UInt_t n = fConnectedPixels*fRunHeader->GetNumSamplesHiGain();
+    if (n!=data.GetSize())
+    {
+        *fLog << err << "MRawEvtData::Set: Size mismatch." << endl;
+        *fLog << " fConnectedPixels="   << fConnectedPixels << endl;
+        *fLog << " NumHiGainSamples="   << fRunHeader->GetNumSamplesHiGain() << endl;
+        *fLog << " data.GetSize()="     << data.GetSize() << endl;
+        return;
+    }
 
     Byte_t *dest = fHiGainFadcSamples->GetArray();
@@ -448,5 +469,5 @@
             Byte_t *ptr = reinterpret_cast<Byte_t*>(dest);
             while (src<end)
-                *ptr++ = *src++;
+                *ptr++ = Byte_t(*src++);
         }
         return;
@@ -456,5 +477,5 @@
             UShort_t *ptr = reinterpret_cast<UShort_t*>(dest);
             while (src<end)
-                *ptr++ = *src++;
+                *ptr++ = UShort_t(*src++);
         }
         return;
@@ -464,4 +485,18 @@
         return;
     }
+}
+
+void MRawEvtData::SetIndices(const MArrayS &idx)
+{
+    if (idx.GetSize()!=fHiGainPixId->GetSize())
+        return;
+
+    memcpy(fHiGainPixId->GetArray(), idx.GetArray(), idx.GetSize()*sizeof(UShort_t));
+}
+
+void MRawEvtData::SetIndices()
+{
+    for (UInt_t i=0; i<fHiGainPixId->GetSize(); i++)
+        (*fHiGainPixId)[i] = i;
 }
 
Index: trunk/MagicSoft/Mars/mraw/MRawEvtData.h
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawEvtData.h	(revision 9219)
+++ trunk/MagicSoft/Mars/mraw/MRawEvtData.h	(revision 9226)
@@ -57,4 +57,5 @@
     }
 
+
 public:
     MRawEvtData(const char *name=NULL, const char *title=NULL);
@@ -74,7 +75,10 @@
     void Draw (Option_t * = NULL);
 
+    void ResetPixels();
     void ResetPixels(UShort_t npix, UShort_t maxid);
     void AddPixel(UShort_t nOfPixel, const TArrayC &data);
     void Set(const MArrayI &data);
+    void SetIndices(const MArrayS &idx);
+    void SetIndices();
 
     UShort_t GetNumHiGainSamples() const;
