Changeset 1235
- Timestamp:
- 03/07/02 15:28:30 (23 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1230 r1235 1 1 -*-*- END -*-*- 2 3 2002/03/07: Thomas Bretz 4 5 * mbase/MParContainer.[h,cc], MWriteAsciiFile.[h,cc]: 6 - added a scale value which can be used in case you are writing 7 single data mambers 8 9 2 10 3 11 2002/03/04: Thomas Bretz -
trunk/MagicSoft/Mars/NEWS
r1219 r1235 5 5 - Ascii Output can now also be used for parameter containers which 6 6 doesn't overload MParCointainer::AsciiWrite 7 8 - The Ascii Output is now also capable of writing single data members 9 of one container 10 11 - You are now able to change the order of the values written to the 12 ascii file 13 14 - You can now specify a conversion factor for each data member written 15 to an ascii file. This may be usefull to change the units of the 16 data member (eg. degrees instead of millimeters in case of the 17 hillas parameters) 7 18 8 19 - replaced old MHillas by a new structure which allows you to extend … … 23 34 - it is now possible to write single data members of a class object to 24 35 an output stream instead of the whole container only 25 26 36 37 38 27 39 *** Version 0.6 (2001/01/15) 28 40 -
trunk/MagicSoft/Mars/mbase/MParContainer.cc
r1229 r1235 217 217 // Write out a data member given as a TDataMember object to an output stream. 218 218 // 219 Bool_t MParContainer::WriteDataMember(ostream &out, const TDataMember *member ) const219 Bool_t MParContainer::WriteDataMember(ostream &out, const TDataMember *member, Double_t scale) const 220 220 { 221 221 if (!member) … … 245 245 Double_t d; 246 246 call->Execute((void*)this, d); // FIXME: const, root 247 out << d<< " ";247 out << (scale*d) << " "; 248 248 return kTRUE; 249 249 … … 260 260 // Write out a data member given by name to an output stream. 261 261 // 262 Bool_t MParContainer::WriteDataMember(ostream &out, const char *member ) const262 Bool_t MParContainer::WriteDataMember(ostream &out, const char *member, Double_t scale) const 263 263 { 264 264 /*const*/ TClass *cls = IsA()->GetBaseDataMember(member); … … 266 266 return kFALSE; 267 267 268 return WriteDataMember(out, cls->GetDataMember(member) );268 return WriteDataMember(out, cls->GetDataMember(member), scale); 269 269 } 270 270 -
trunk/MagicSoft/Mars/mbase/MParContainer.h
r1222 r1235 66 66 virtual void SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; } 67 67 68 Bool_t WriteDataMember(ostream &out, const char *member ) const;69 Bool_t WriteDataMember(ostream &out, const TDataMember *member ) const;68 Bool_t WriteDataMember(ostream &out, const char *member, Double_t scale=1) const; 69 Bool_t WriteDataMember(ostream &out, const TDataMember *member, Double_t scale=1) const; 70 70 Bool_t WriteDataMember(ostream &out, const TList *list) const; 71 71 -
trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.cc
r1222 r1235 148 148 while ((cont=(MParContainer*)NextCont())) 149 149 { 150 const TObject *memb =NextMemb();150 const MScale *memb = (MScale*)NextMemb(); 151 151 152 152 if (!cont->IsReadyToSave()) … … 160 160 else 161 161 { 162 if (!cont->WriteDataMember(*fOut, memb->GetName() ))162 if (!cont->WriteDataMember(*fOut, memb->GetName(), memb->GetScale())) 163 163 continue; 164 164 } … … 196 196 Bool_t MWriteAsciiFile::GetContainer(MParList *pList) 197 197 { 198 TObject*obj = NULL;198 MScale *obj = NULL; 199 199 200 200 TIter Next(&fContNames); 201 201 202 while ((obj= Next()))202 while ((obj=(MScale*)Next())) 203 203 { 204 204 const char *name = obj->GetName(); … … 211 211 } 212 212 213 AddContainer(cont, obj->GetTitle() );213 AddContainer(cont, obj->GetTitle(), obj->GetScale()); 214 214 } 215 215 … … 223 223 // If you want to write only one data member of the container 224 224 // specify the name of the data member (eg. fAlpha) Make sure, 225 // that a "GetteMethod" for this data type exists (stri fthe f and225 // that a "GetteMethod" for this data type exists (strip the f and 226 226 // replace it by Get) 227 // 228 void MWriteAsciiFile::AddContainer(const char *cname, const char *member) 229 { 230 TNamed *named = new TNamed(cname, member); 231 fContNames.AddLast(named); 227 // If you specify a single data member you can add a scale-factor which 228 // is (in case of the data member being a floating point value) multiplied 229 // with the data member value. This is usefull if you are want to 230 // change the scale (unit) of a data member for writing (eg. 231 // writing degrees for the hillas parameters instead of the internally 232 // used millimeters) 233 // 234 void MWriteAsciiFile::AddContainer(const char *cname, const char *member, Double_t scale) 235 { 236 MScale *name = new MScale(cname, member, scale); 237 fContNames.AddLast(name); 232 238 } 233 239 … … 238 244 // If you want to write only one data member of the container 239 245 // specify the name of the data member (eg. fAlpha) Make sure, 240 // that a "GetteMethod" for this data type exists (stri fthe f and246 // that a "GetteMethod" for this data type exists (strip the f and 241 247 // replace it by Get) 242 // 243 void MWriteAsciiFile::AddContainer(MParContainer *cont, const char *member) 248 // If you specify a single data member you can add a scale-factor which 249 // is (in case of the data member being a floating point value) multiplied 250 // with the data member value. This is usefull if you are want to 251 // change the scale (unit) of a data member for writing (eg. 252 // writing degrees for the hillas parameters instead of the internally 253 // used millimeters) 254 // 255 void MWriteAsciiFile::AddContainer(MParContainer *cont, const char *member, Double_t scale) 244 256 { 245 257 fContainer.AddLast(cont); 246 258 247 TNamed *named = new TNamed(member, "");248 fMembers.AddLast(name d);249 } 250 259 MScale *name = new MScale(member, "", scale); 260 fMembers.AddLast(name); 261 } 262 -
trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.h
r1219 r1235 12 12 { 13 13 private: 14 class MScale : public TNamed 15 { 16 private: 17 Double_t fScale; 18 public: 19 MScale(const char *name, const char *title, Double_t scale) 20 : TNamed(name, title), fScale(scale) {} 21 Double_t GetScale() const { return fScale; } 22 }; 23 14 24 ofstream *fOut; 15 25 … … 17 27 TObjArray fContainer; 18 28 TObjArray fMembers; 29 TObjArray fScale; 19 30 20 31 TString fNameFile; … … 34 45 ~MWriteAsciiFile(); 35 46 36 void AddContainer(const char *cname, const char *member="" );37 void AddContainer(MParContainer *cont, const char *member="" );47 void AddContainer(const char *cname, const char *member="", Double_t scale=1); 48 void AddContainer(MParContainer *cont, const char *member="", Double_t scale=1); 38 49 39 50 ClassDef(MWriteAsciiFile, 0) // Class to write one container to an ascii file
Note:
See TracChangeset
for help on using the changeset viewer.