Changeset 9079
- Timestamp:
- 08/04/08 12:15:20 (16 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r9077 r9079 21 21 2008/08/04 Thomas Bretz 22 22 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) 25 36 26 37 -
trunk/MagicSoft/Mars/mbase/MParEmulated.cc
r9043 r9079 42 42 #include <TMethodCall.h> 43 43 #include <TStreamerElement.h> 44 #include <TVirtualCollectionProxy.h> 44 45 #if ROOT_VERSION_CODE>ROOT_VERSION(5,12,00) 45 46 #include <TVirtualStreamerInfo.h> … … 80 81 } 81 82 83 int 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 } 88 Int_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 } 93 double 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 } 98 unsigned 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 82 104 // -------------------------------------------------------------------------- 83 105 // … … 85 107 // 86 108 #if ROOT_VERSION_CODE<ROOT_VERSION(5,18,00) 87 TStreamerInfo *MParEmulated::GetStreamerInfo(const TString &clsname ) const88 #else 89 TVirtualStreamerInfo *MParEmulated::GetStreamerInfo(const TString &clsname ) const109 TStreamerInfo *MParEmulated::GetStreamerInfo(const TString &clsname, TVirtualCollectionProxy * &proxy, Int_t &offset) const 110 #else 111 TVirtualStreamerInfo *MParEmulated::GetStreamerInfo(const TString &clsname, TVirtualCollectionProxy * &proxy, Int_t &offset) const 90 112 #endif 91 113 { … … 97 119 } 98 120 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 99 134 #if ROOT_VERSION_CODE<ROOT_VERSION(5,18,00) 100 135 TStreamerInfo *info = cls->GetStreamerInfo(); … … 116 151 // MParContainer::fgListmethodCall 117 152 // 118 TMethodCall *MParEmulated::GetMethodCall(const char *get, Int_t offset) const 119 { 120 TMethodCall *call = new TMethodCall(MParEmulated::Class(), get, Form("%d", offset));; 153 TMethodCall *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)); 121 161 fgListMethodCall.Add(call); 122 162 return call; … … 130 170 TMethodCall *MParEmulated::GetterMethod(const char *name, TString clsname, Int_t offset) const 131 171 { 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); 136 182 #endif 137 183 if (!info) … … 140 186 const TString arg(name); 141 187 142 const Ssiz_t p = arg. First('.');188 const Ssiz_t p = arg.Last('.'); 143 189 144 190 const TString nam = p<0 ? arg : arg(0, p); 145 191 192 // Get the streamer element to the data member and 193 // and the offset from the base of the object 146 194 Int_t off; 147 195 TStreamerElement *el = info->GetStreamerElement(nam, off); 148 196 if (!el) 149 197 { 150 *fLog << err << dbginf << "ERROR - No TStreamer Infofor " << nam << " [" << clsname << "]" << endl;198 *fLog << err << dbginf << "ERROR - No TStreamerElement for " << nam << " [" << clsname << "]" << endl; 151 199 return 0; 152 200 } … … 155 203 156 204 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); 159 210 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 } 161 216 162 217 if (p<0) 163 218 { 164 *fLog << err << dbginf << "ERROR - No TStreamerInfofor " << nam << "." << type << " [" << clsname << "]" << endl;219 *fLog << err << dbginf << "ERROR - Variable name missing for " << nam << "." << type << " [" << clsname << "]" << endl; 165 220 return 0; 166 221 } 167 222 168 223 const TString var = arg(p+1, arg.Length()); 169 return GetterMethod(var, type, offset+off);224 return GetterMethod(var, type, arroff+offset+off); 170 225 } 171 226 … … 176 231 void MParEmulated::Print(TPRegexp ®ex, TString clsname, TString prefix, Int_t offset) const 177 232 { 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); 182 239 #endif 183 240 if (!info) … … 197 254 const TString type(el->GetTypeNameBasic()); 198 255 199 cout << fName << "." << str << "[" << type << "]\t";256 cout << fName << (arroff?"[0]":"") << "." << str << " [" << type << "]" << " \t"; 200 257 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); 203 261 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); 205 265 206 266 cout << endl; … … 211 271 { 212 272 Print(regex, el->GetTypeNameBasic(), str+".", 213 el->GetOffset()+ offset);273 el->GetOffset()+arroff+offset); 214 274 continue; 215 275 } -
trunk/MagicSoft/Mars/mbase/MParEmulated.h
r9043 r9079 14 14 #ifndef __CINT__ 15 15 #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 } 17 21 #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 } 19 27 #endif 20 28 #endif 21 TMethodCall *GetMethodCall(const char *get, Int_t offset ) const;29 TMethodCall *GetMethodCall(const char *get, Int_t offset, TVirtualCollectionProxy *proxy=0) const; 22 30 23 31 public: … … 28 36 Byte_t **GetPtr() { return &fPtr; } 29 37 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; 32 47 33 48 TMethodCall *GetterMethod(const char *name, TString cls, Int_t offset=0) const;
Note:
See TracChangeset
for help on using the changeset viewer.