Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 9078)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 9079)
@@ -21,6 +21,17 @@
  2008/08/04 Thomas Bretz
 
-   * added a filter against very bright events cleaning the 
-     bad pixel plot
+   * mjobs/MJCalibrateSignal.cc:
+     - added a filter against very bright events cleaning the 
+       bad pixel plot
+
+   * ganymed.rc, ganymed_wobble.rc, ganymed_onoff.rc:
+     - slightly tightened the spark cut in length vs size
+
+   * ganymed_wobble.rc:
+     - now uses the default (still 3) for the number of wobble
+       positions
+
+   * mbase/MParEmulated.[h,cc]:
+     - some improvements to support collection (still not finished)
 
 
Index: /trunk/MagicSoft/Mars/mbase/MParEmulated.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MParEmulated.cc	(revision 9078)
+++ /trunk/MagicSoft/Mars/mbase/MParEmulated.cc	(revision 9079)
@@ -42,4 +42,5 @@
 #include <TMethodCall.h>
 #include <TStreamerElement.h>
+#include <TVirtualCollectionProxy.h>
 #if ROOT_VERSION_CODE>ROOT_VERSION(5,12,00)
 #include <TVirtualStreamerInfo.h>
@@ -80,4 +81,25 @@
 }
 
+int MParEmulated::GetPInt(TVirtualCollectionProxy *proxy, Int_t offset) const
+{
+    const TVirtualCollectionProxy::TPushPop pp(proxy, fPtr);
+    return *reinterpret_cast<int*>((char*)proxy->At(0)+offset);
+}
+Int_t MParEmulated::GetPInt_t(TVirtualCollectionProxy *proxy, Int_t offset) const
+{
+    const TVirtualCollectionProxy::TPushPop pp(proxy, fPtr);
+    return *reinterpret_cast<Int_t*>((char*)proxy->At(0)+offset);
+}
+double MParEmulated::GetPDouble(TVirtualCollectionProxy *proxy, Int_t offset) const
+{
+    const TVirtualCollectionProxy::TPushPop pp(proxy, fPtr);
+    return *reinterpret_cast<double*>((char*)proxy->At(0)+offset);
+}
+unsigned long long MParEmulated::GetPULongLong(TVirtualCollectionProxy *proxy, Int_t offset) const
+{
+    const TVirtualCollectionProxy::TPushPop pp(proxy, fPtr);
+    return *reinterpret_cast<unsigned long long*>((char*)proxy->At(0)+offset);
+}
+
 // --------------------------------------------------------------------------
 //
@@ -85,7 +107,7 @@
 //
 #if ROOT_VERSION_CODE<ROOT_VERSION(5,18,00)
-TStreamerInfo *MParEmulated::GetStreamerInfo(const TString &clsname) const
-#else
-TVirtualStreamerInfo *MParEmulated::GetStreamerInfo(const TString &clsname) const
+TStreamerInfo *MParEmulated::GetStreamerInfo(const TString &clsname, TVirtualCollectionProxy * &proxy, Int_t &offset) const
+#else
+TVirtualStreamerInfo *MParEmulated::GetStreamerInfo(const TString &clsname, TVirtualCollectionProxy * &proxy, Int_t &offset) const
 #endif
 {
@@ -97,4 +119,17 @@
     }
 
+    proxy = cls->GetCollectionProxy();
+    if (proxy)
+    {
+        cls = proxy->GetValueClass();
+
+        proxy->PushProxy(fPtr);
+        // proxy->GetSize()  // Number of elements in array
+        if (proxy->At(0))
+            offset = (char*)proxy->At(0)-(char*)fPtr;
+        proxy->PopProxy();
+
+    }
+
 #if ROOT_VERSION_CODE<ROOT_VERSION(5,18,00)
     TStreamerInfo *info = cls->GetStreamerInfo();
@@ -116,7 +151,12 @@
 // MParContainer::fgListmethodCall
 //
-TMethodCall *MParEmulated::GetMethodCall(const char *get, Int_t offset) const
-{
-    TMethodCall *call = new TMethodCall(MParEmulated::Class(), get, Form("%d", offset));;
+TMethodCall *MParEmulated::GetMethodCall(const char *get, Int_t offset, TVirtualCollectionProxy *proxy) const
+{
+    TString name(get);
+    if (proxy)
+        name.Prepend("P");
+    name.Prepend("Get");
+
+    TMethodCall *call = new TMethodCall(MParEmulated::Class(), name, proxy?Form("%p,%d", proxy, offset):Form("%d", offset));
     fgListMethodCall.Add(call);
     return call;
@@ -130,8 +170,14 @@
 TMethodCall *MParEmulated::GetterMethod(const char *name, TString clsname, Int_t offset) const
 {
-#if ROOT_VERSION_CODE<ROOT_VERSION(5,18,00)
-    TStreamerInfo *info = GetStreamerInfo(clsname);
-#else
-    TVirtualStreamerInfo *info = GetStreamerInfo(clsname);
+    TVirtualCollectionProxy *proxy = 0;
+
+    // Get the streamer info for the class and the offset to the
+    // first element of a possible array
+    Int_t arroff = 0;
+
+#if ROOT_VERSION_CODE<ROOT_VERSION(5,18,00)
+    TStreamerInfo *info = GetStreamerInfo(clsname, proxy, arroff);
+#else
+    TVirtualStreamerInfo *info = GetStreamerInfo(clsname, proxy, arroff);
 #endif
     if (!info)
@@ -140,13 +186,15 @@
     const TString arg(name);
 
-    const Ssiz_t p = arg.First('.');
+    const Ssiz_t p = arg.Last('.');
 
     const TString nam = p<0 ? arg : arg(0, p);
 
+    // Get the streamer element to the data member and
+    // and the offset from the base of the object
     Int_t off;
     TStreamerElement *el = info->GetStreamerElement(nam, off);
     if (!el)
     {
-        *fLog << err << dbginf << "ERROR - No TStreamerInfo for " << nam << " [" << clsname << "]" << endl;
+        *fLog << err << dbginf << "ERROR - No TStreamerElement for " << nam << " [" << clsname << "]" << endl;
         return 0;
     }
@@ -155,17 +203,24 @@
 
     if (type=="int")
-        return GetMethodCall("GetInt", offset+off);
-
+        return GetMethodCall("Int", arroff+offset+off, proxy);
+    if (type=="Int_t")
+        return GetMethodCall("Int_t", arroff+offset+off, proxy);
+    if (type=="unisgned long long")
+        return GetMethodCall("ULongLong", arroff+offset+off, proxy);
     if (type=="double")
-        return GetMethodCall("GetDouble", offset+off);
+    {
+        cout << name << ": " << arroff << " " << offset << " " << off << " " << fPtr << endl;
+
+        return GetMethodCall("Double", arroff+offset+off, proxy);
+    }
 
     if (p<0)
     {
-        *fLog << err << dbginf << "ERROR - No TStreamerInfo for " << nam << "." << type << " [" << clsname << "]" << endl;
+        *fLog << err << dbginf << "ERROR - Variable name missing for " << nam << "." << type << " [" << clsname << "]" << endl;
         return 0;
     }
 
     const TString var = arg(p+1, arg.Length());
-    return GetterMethod(var, type, offset+off);
+    return GetterMethod(var, type, arroff+offset+off);
 }
 
@@ -176,8 +231,10 @@
 void MParEmulated::Print(TPRegexp &regex, TString clsname, TString prefix, Int_t offset) const
 {
-#if ROOT_VERSION_CODE<ROOT_VERSION(5,18,00)
-    TStreamerInfo *info = GetStreamerInfo(clsname);
-#else
-    TVirtualStreamerInfo *info = GetStreamerInfo(clsname);
+    Int_t arroff = 0;
+
+#if ROOT_VERSION_CODE<ROOT_VERSION(5,18,00)
+    TStreamerInfo *info = GetStreamerInfo(clsname, arroff);
+#else
+    TVirtualStreamerInfo *info = GetStreamerInfo(clsname, arroff);
 #endif
     if (!info)
@@ -197,10 +254,13 @@
             const TString type(el->GetTypeNameBasic());
 
-            cout << fName << "." << str << "[" << type << "] \t";
+            cout << fName << (arroff?"[0]":"") << "." << str << " [" << type << "]"  << " \t";
             if (type=="int")
-                cout << GetInt(el->GetOffset()+offset);
-
+                cout << GetInt(el->GetOffset()+arroff+offset);
+            if (type=="Int_t")
+                cout << GetInt_t(el->GetOffset()+arroff+offset);
             if (type=="double")
-                cout << GetDouble(el->GetOffset()+offset);
+                cout << GetDouble(el->GetOffset()+arroff+offset);
+            if (type=="unsigned long long")
+                cout << GetULongLong(el->GetOffset()+arroff+offset);
 
             cout << endl;
@@ -211,5 +271,5 @@
         {
             Print(regex, el->GetTypeNameBasic(), str+".",
-                  el->GetOffset()+offset);
+                  el->GetOffset()+arroff+offset);
             continue;
         }
Index: /trunk/MagicSoft/Mars/mbase/MParEmulated.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MParEmulated.h	(revision 9078)
+++ /trunk/MagicSoft/Mars/mbase/MParEmulated.h	(revision 9079)
@@ -14,10 +14,18 @@
 #ifndef __CINT__
 #if ROOT_VERSION_CODE<ROOT_VERSION(5,18,00)
-    TStreamerInfo *GetStreamerInfo(const TString &clsname) const;
+    TStreamerInfo *GetStreamerInfo(const TString &cls, TVirtualCollectionProxy* &proxy, Int_t &offset) const;
+    TStreamerInfo *GetStreamerInfo(const TString &cls, Int_t &offset) const
+    {
+        TVirtualCollectionProxy *proxy = 0; return GetStreamerInfo(cls, proxy, offset);
+    }
 #else
-    TVirtualStreamerInfo *GetStreamerInfo(const TString &clsname) const;
+    TVirtualStreamerInfo *GetStreamerInfo(const TString &cls, TVirtualCollectionProxy* &proxy, Int_t &offset) const;
+    TVirtualStreamerInfo *GetStreamerInfo(const TString &cls, Int_t &offset) const
+    {
+        TVirtualCollectionProxy *proxy = 0; return GetStreamerInfo(cls, proxy, offset);
+    }
 #endif
 #endif
-    TMethodCall *GetMethodCall(const char *get, Int_t offset) const;
+    TMethodCall *GetMethodCall(const char *get, Int_t offset, TVirtualCollectionProxy *proxy=0) const;
 
 public:
@@ -28,6 +36,13 @@
     Byte_t **GetPtr() { return &fPtr; }
 
-    Int_t    GetInt(Int_t offset) const { return *reinterpret_cast<Int_t*>   (fPtr+offset); }
-    Double_t GetDouble(Int_t offset) const { return *reinterpret_cast<Double_t*>(fPtr+offset); }
+    int      GetInt(Int_t offset) const { return *reinterpret_cast<int*>(fPtr+offset); }
+    Int_t    GetInt_t(Int_t offset) const { return *reinterpret_cast<Int_t*>(fPtr+offset); }
+    double   GetDouble(Int_t offset) const { return *reinterpret_cast<double*>(fPtr+offset); }
+    unsigned long long GetULongLong(Int_t offset) const { return *reinterpret_cast<unsigned long long*>(fPtr+offset); }
+
+    int      GetPInt(TVirtualCollectionProxy *proxy, Int_t offset) const;
+    Int_t    GetPInt_t(TVirtualCollectionProxy *proxy, Int_t offset) const;
+    double   GetPDouble(TVirtualCollectionProxy *proxy, Int_t offset) const;
+    unsigned long long GetPULongLong(TVirtualCollectionProxy *proxy, Int_t offset) const;
 
     TMethodCall *GetterMethod(const char *name, TString cls, Int_t offset=0) const;
