Changeset 1883 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 03/31/03 15:17:50 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHArray.cc
r1833 r1883 182 182 }; 183 183 184 void MHArray::Init(const char *name) 185 { 186 fName = name ? name : "MHArray"; 187 188 fMapIdx = new MMap; 189 190 fArray = new TList; 191 fArray->SetOwner(); 192 } 193 194 // -------------------------------------------------------------------------- 195 // 196 // Can replace a constructor. Use the default constructor and afterwards 197 // the Set function of your need. 198 // 199 void MHArray::Set(const TString hname, Bool_t istempl) 200 { 201 if (fTemplate || fClass || fTemplateName!="<dummy>") 202 { 203 *fLog << warn << "WARNING - MHArray already setup... Set ignored." << endl; 204 return; 205 } 206 207 if (istempl) 208 { 209 fTemplateName = hname; 210 return; 211 } 212 213 // 214 // try to get class from root environment 215 // 216 fClass = gROOT->GetClass(hname); 217 if (!fClass) 218 { 219 // 220 // if class is not existing in the root environment 221 // 222 *fLog << err << dbginf << "Class '" << hname << "' not existing in dictionary." << endl; 223 } 224 225 // 226 // check for ineritance from MH 227 // 228 if (!fClass->InheritsFrom(MH::Class())) 229 { 230 // 231 // if class doesn't inherit from MH --> error 232 // 233 *fLog << err << dbginf << "Class '" << hname << "' doesn't inherit from MH." << endl; 234 fClass = NULL; 235 } 236 } 237 238 // -------------------------------------------------------------------------- 239 // 240 // Can replace a constructor. Use the default constructor and afterwards 241 // the Set function of your need. 242 // 243 void MHArray::Set(const MH *hist) 244 { 245 fIdx=0; 246 fClass=NULL; 247 fTemplate=hist; 248 fTemplateName="<dummy>"; 249 } 250 251 184 252 // -------------------------------------------------------------------------- 185 253 // … … 200 268 // set the name and title of this object 201 269 // 202 fName = name ? name : "MHArray";270 Init(name); 203 271 fTitle = title ? TString(title) : (TString("Base class for Mars histogram arrays:") + hname); 204 272 205 fMapIdx = new MMap; 206 207 fArray = new TList; 208 fArray->SetOwner(); 209 210 if (istempl) 211 { 212 fTemplateName = hname; 213 return; 214 } 215 216 // 217 // try to get class from root environment 218 // 219 fClass = gROOT->GetClass(hname); 220 if (!fClass) 221 { 222 // 223 // if class is not existing in the root environment 224 // 225 *fLog << err << dbginf << "Class '" << hname << "' not existing in dictionary." << endl; 226 } 227 228 // 229 // check for ineritance from MH 230 // 231 if (!fClass->InheritsFrom(MH::Class())) 232 { 233 // 234 // if class doesn't inherit from MH --> error 235 // 236 *fLog << err << dbginf << "Class '" << hname << "' doesn't inherit from MH." << endl; 237 fClass = NULL; 238 } 239 } 240 241 // -------------------------------------------------------------------------- 242 // 243 // Default Constructor. hname is the name of the histogram class which 244 // is in the array. 273 Set(hname, istempl); 274 } 275 276 // -------------------------------------------------------------------------- 277 // 278 // Default constructor. Use MHArray::Set to setup the MHArray afterwards 279 // 280 MHArray::MHArray(const char *name=NULL, const char *title=NULL) 281 : fIdx(0), fClass(NULL), fTemplate(NULL), fTemplateName("<dummy>") 282 { 283 // 284 // set the name and title of this object 285 // 286 Init(name); 287 fTitle = title ? title : "A Mars histogram array"; 288 } 289 290 // -------------------------------------------------------------------------- 291 // 292 // hname is the name of the histogram class which is in the array. 245 293 // 246 294 // istempl=kTRUE tells MHArray to use the first histogram retrieved from the … … 258 306 // set the name and title of this object 259 307 // 260 fName = name ? name : "MHArray";308 Init(name); 261 309 fTitle = title ? TString(title) : (TString("Base class for Mars histogram arrays:") + hist->GetName()); 262 263 fMapIdx = new MMap;264 265 fArray = new TList;266 fArray->SetOwner();267 310 } 268 311 -
trunk/MagicSoft/Mars/mhist/MHArray.h
r1834 r1883 30 30 enum { kUseTemplate=BIT(14) }; 31 31 32 void Init(const char *name); 33 32 34 public: 35 MHArray(const char *name=NULL, const char *title=NULL); 33 36 MHArray(const TString hname, Bool_t istempl=kFALSE, const char *name=NULL, const char *title=NULL); 34 37 MHArray(const MH *hist, const char *name=NULL, const char *title=NULL); 35 38 ~MHArray(); 39 40 void Set(const TString hname, Bool_t istempl=kFALSE); 41 void Set(const MH *hist); 36 42 37 43 virtual Bool_t SetupFill(const MParList *pList);
Note:
See TracChangeset
for help on using the changeset viewer.