Changeset 9079


Ignore:
Timestamp:
08/04/08 12:15:20 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r9077 r9079  
    2121 2008/08/04 Thomas Bretz
    2222
    23    * added a filter against very bright events cleaning the
    24      bad pixel plot
     23   * mjobs/MJCalibrateSignal.cc:
     24     - added a filter against very bright events cleaning the
     25       bad pixel plot
     26
     27   * ganymed.rc, ganymed_wobble.rc, ganymed_onoff.rc:
     28     - slightly tightened the spark cut in length vs size
     29
     30   * ganymed_wobble.rc:
     31     - now uses the default (still 3) for the number of wobble
     32       positions
     33
     34   * mbase/MParEmulated.[h,cc]:
     35     - some improvements to support collection (still not finished)
    2536
    2637
  • trunk/MagicSoft/Mars/mbase/MParEmulated.cc

    r9043 r9079  
    4242#include <TMethodCall.h>
    4343#include <TStreamerElement.h>
     44#include <TVirtualCollectionProxy.h>
    4445#if ROOT_VERSION_CODE>ROOT_VERSION(5,12,00)
    4546#include <TVirtualStreamerInfo.h>
     
    8081}
    8182
     83int MParEmulated::GetPInt(TVirtualCollectionProxy *proxy, Int_t offset) const
     84{
     85    const TVirtualCollectionProxy::TPushPop pp(proxy, fPtr);
     86    return *reinterpret_cast<int*>((char*)proxy->At(0)+offset);
     87}
     88Int_t MParEmulated::GetPInt_t(TVirtualCollectionProxy *proxy, Int_t offset) const
     89{
     90    const TVirtualCollectionProxy::TPushPop pp(proxy, fPtr);
     91    return *reinterpret_cast<Int_t*>((char*)proxy->At(0)+offset);
     92}
     93double MParEmulated::GetPDouble(TVirtualCollectionProxy *proxy, Int_t offset) const
     94{
     95    const TVirtualCollectionProxy::TPushPop pp(proxy, fPtr);
     96    return *reinterpret_cast<double*>((char*)proxy->At(0)+offset);
     97}
     98unsigned long long MParEmulated::GetPULongLong(TVirtualCollectionProxy *proxy, Int_t offset) const
     99{
     100    const TVirtualCollectionProxy::TPushPop pp(proxy, fPtr);
     101    return *reinterpret_cast<unsigned long long*>((char*)proxy->At(0)+offset);
     102}
     103
    82104// --------------------------------------------------------------------------
    83105//
     
    85107//
    86108#if ROOT_VERSION_CODE<ROOT_VERSION(5,18,00)
    87 TStreamerInfo *MParEmulated::GetStreamerInfo(const TString &clsname) const
    88 #else
    89 TVirtualStreamerInfo *MParEmulated::GetStreamerInfo(const TString &clsname) const
     109TStreamerInfo *MParEmulated::GetStreamerInfo(const TString &clsname, TVirtualCollectionProxy * &proxy, Int_t &offset) const
     110#else
     111TVirtualStreamerInfo *MParEmulated::GetStreamerInfo(const TString &clsname, TVirtualCollectionProxy * &proxy, Int_t &offset) const
    90112#endif
    91113{
     
    97119    }
    98120
     121    proxy = cls->GetCollectionProxy();
     122    if (proxy)
     123    {
     124        cls = proxy->GetValueClass();
     125
     126        proxy->PushProxy(fPtr);
     127        // proxy->GetSize()  // Number of elements in array
     128        if (proxy->At(0))
     129            offset = (char*)proxy->At(0)-(char*)fPtr;
     130        proxy->PopProxy();
     131
     132    }
     133
    99134#if ROOT_VERSION_CODE<ROOT_VERSION(5,18,00)
    100135    TStreamerInfo *info = cls->GetStreamerInfo();
     
    116151// MParContainer::fgListmethodCall
    117152//
    118 TMethodCall *MParEmulated::GetMethodCall(const char *get, Int_t offset) const
    119 {
    120     TMethodCall *call = new TMethodCall(MParEmulated::Class(), get, Form("%d", offset));;
     153TMethodCall *MParEmulated::GetMethodCall(const char *get, Int_t offset, TVirtualCollectionProxy *proxy) const
     154{
     155    TString name(get);
     156    if (proxy)
     157        name.Prepend("P");
     158    name.Prepend("Get");
     159
     160    TMethodCall *call = new TMethodCall(MParEmulated::Class(), name, proxy?Form("%p,%d", proxy, offset):Form("%d", offset));
    121161    fgListMethodCall.Add(call);
    122162    return call;
     
    130170TMethodCall *MParEmulated::GetterMethod(const char *name, TString clsname, Int_t offset) const
    131171{
    132 #if ROOT_VERSION_CODE<ROOT_VERSION(5,18,00)
    133     TStreamerInfo *info = GetStreamerInfo(clsname);
    134 #else
    135     TVirtualStreamerInfo *info = GetStreamerInfo(clsname);
     172    TVirtualCollectionProxy *proxy = 0;
     173
     174    // Get the streamer info for the class and the offset to the
     175    // first element of a possible array
     176    Int_t arroff = 0;
     177
     178#if ROOT_VERSION_CODE<ROOT_VERSION(5,18,00)
     179    TStreamerInfo *info = GetStreamerInfo(clsname, proxy, arroff);
     180#else
     181    TVirtualStreamerInfo *info = GetStreamerInfo(clsname, proxy, arroff);
    136182#endif
    137183    if (!info)
     
    140186    const TString arg(name);
    141187
    142     const Ssiz_t p = arg.First('.');
     188    const Ssiz_t p = arg.Last('.');
    143189
    144190    const TString nam = p<0 ? arg : arg(0, p);
    145191
     192    // Get the streamer element to the data member and
     193    // and the offset from the base of the object
    146194    Int_t off;
    147195    TStreamerElement *el = info->GetStreamerElement(nam, off);
    148196    if (!el)
    149197    {
    150         *fLog << err << dbginf << "ERROR - No TStreamerInfo for " << nam << " [" << clsname << "]" << endl;
     198        *fLog << err << dbginf << "ERROR - No TStreamerElement for " << nam << " [" << clsname << "]" << endl;
    151199        return 0;
    152200    }
     
    155203
    156204    if (type=="int")
    157         return GetMethodCall("GetInt", offset+off);
    158 
     205        return GetMethodCall("Int", arroff+offset+off, proxy);
     206    if (type=="Int_t")
     207        return GetMethodCall("Int_t", arroff+offset+off, proxy);
     208    if (type=="unisgned long long")
     209        return GetMethodCall("ULongLong", arroff+offset+off, proxy);
    159210    if (type=="double")
    160         return GetMethodCall("GetDouble", offset+off);
     211    {
     212        cout << name << ": " << arroff << " " << offset << " " << off << " " << fPtr << endl;
     213
     214        return GetMethodCall("Double", arroff+offset+off, proxy);
     215    }
    161216
    162217    if (p<0)
    163218    {
    164         *fLog << err << dbginf << "ERROR - No TStreamerInfo for " << nam << "." << type << " [" << clsname << "]" << endl;
     219        *fLog << err << dbginf << "ERROR - Variable name missing for " << nam << "." << type << " [" << clsname << "]" << endl;
    165220        return 0;
    166221    }
    167222
    168223    const TString var = arg(p+1, arg.Length());
    169     return GetterMethod(var, type, offset+off);
     224    return GetterMethod(var, type, arroff+offset+off);
    170225}
    171226
     
    176231void MParEmulated::Print(TPRegexp &regex, TString clsname, TString prefix, Int_t offset) const
    177232{
    178 #if ROOT_VERSION_CODE<ROOT_VERSION(5,18,00)
    179     TStreamerInfo *info = GetStreamerInfo(clsname);
    180 #else
    181     TVirtualStreamerInfo *info = GetStreamerInfo(clsname);
     233    Int_t arroff = 0;
     234
     235#if ROOT_VERSION_CODE<ROOT_VERSION(5,18,00)
     236    TStreamerInfo *info = GetStreamerInfo(clsname, arroff);
     237#else
     238    TVirtualStreamerInfo *info = GetStreamerInfo(clsname, arroff);
    182239#endif
    183240    if (!info)
     
    197254            const TString type(el->GetTypeNameBasic());
    198255
    199             cout << fName << "." << str << "[" << type << "] \t";
     256            cout << fName << (arroff?"[0]":"") << "." << str << " [" << type << "]"  << " \t";
    200257            if (type=="int")
    201                 cout << GetInt(el->GetOffset()+offset);
    202 
     258                cout << GetInt(el->GetOffset()+arroff+offset);
     259            if (type=="Int_t")
     260                cout << GetInt_t(el->GetOffset()+arroff+offset);
    203261            if (type=="double")
    204                 cout << GetDouble(el->GetOffset()+offset);
     262                cout << GetDouble(el->GetOffset()+arroff+offset);
     263            if (type=="unsigned long long")
     264                cout << GetULongLong(el->GetOffset()+arroff+offset);
    205265
    206266            cout << endl;
     
    211271        {
    212272            Print(regex, el->GetTypeNameBasic(), str+".",
    213                   el->GetOffset()+offset);
     273                  el->GetOffset()+arroff+offset);
    214274            continue;
    215275        }
  • trunk/MagicSoft/Mars/mbase/MParEmulated.h

    r9043 r9079  
    1414#ifndef __CINT__
    1515#if ROOT_VERSION_CODE<ROOT_VERSION(5,18,00)
    16     TStreamerInfo *GetStreamerInfo(const TString &clsname) const;
     16    TStreamerInfo *GetStreamerInfo(const TString &cls, TVirtualCollectionProxy* &proxy, Int_t &offset) const;
     17    TStreamerInfo *GetStreamerInfo(const TString &cls, Int_t &offset) const
     18    {
     19        TVirtualCollectionProxy *proxy = 0; return GetStreamerInfo(cls, proxy, offset);
     20    }
    1721#else
    18     TVirtualStreamerInfo *GetStreamerInfo(const TString &clsname) const;
     22    TVirtualStreamerInfo *GetStreamerInfo(const TString &cls, TVirtualCollectionProxy* &proxy, Int_t &offset) const;
     23    TVirtualStreamerInfo *GetStreamerInfo(const TString &cls, Int_t &offset) const
     24    {
     25        TVirtualCollectionProxy *proxy = 0; return GetStreamerInfo(cls, proxy, offset);
     26    }
    1927#endif
    2028#endif
    21     TMethodCall *GetMethodCall(const char *get, Int_t offset) const;
     29    TMethodCall *GetMethodCall(const char *get, Int_t offset, TVirtualCollectionProxy *proxy=0) const;
    2230
    2331public:
     
    2836    Byte_t **GetPtr() { return &fPtr; }
    2937
    30     Int_t    GetInt(Int_t offset) const { return *reinterpret_cast<Int_t*>   (fPtr+offset); }
    31     Double_t GetDouble(Int_t offset) const { return *reinterpret_cast<Double_t*>(fPtr+offset); }
     38    int      GetInt(Int_t offset) const { return *reinterpret_cast<int*>(fPtr+offset); }
     39    Int_t    GetInt_t(Int_t offset) const { return *reinterpret_cast<Int_t*>(fPtr+offset); }
     40    double   GetDouble(Int_t offset) const { return *reinterpret_cast<double*>(fPtr+offset); }
     41    unsigned long long GetULongLong(Int_t offset) const { return *reinterpret_cast<unsigned long long*>(fPtr+offset); }
     42
     43    int      GetPInt(TVirtualCollectionProxy *proxy, Int_t offset) const;
     44    Int_t    GetPInt_t(TVirtualCollectionProxy *proxy, Int_t offset) const;
     45    double   GetPDouble(TVirtualCollectionProxy *proxy, Int_t offset) const;
     46    unsigned long long GetPULongLong(TVirtualCollectionProxy *proxy, Int_t offset) const;
    3247
    3348    TMethodCall *GetterMethod(const char *name, TString cls, Int_t offset=0) const;
Note: See TracChangeset for help on using the changeset viewer.