Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 1234)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 1235)
@@ -1,3 +1,11 @@
                                                                   -*-*- END -*-*-
+
+ 2002/03/07: Thomas Bretz
+
+   * mbase/MParContainer.[h,cc], MWriteAsciiFile.[h,cc]:
+     - added a scale value which can be used in case you are writing
+       single data mambers
+
+
 
  2002/03/04: Thomas Bretz
Index: /trunk/MagicSoft/Mars/NEWS
===================================================================
--- /trunk/MagicSoft/Mars/NEWS	(revision 1234)
+++ /trunk/MagicSoft/Mars/NEWS	(revision 1235)
@@ -5,4 +5,15 @@
    - Ascii Output can now also be used for parameter containers which
      doesn't overload MParCointainer::AsciiWrite
+
+   - The Ascii Output is now also capable of writing single data members
+     of one container
+
+   - You are now able to change the order of the values written to the
+     ascii file
+
+   - You can now specify a conversion factor for each data member written
+     to an ascii file. This may be usefull to change the units of the 
+     data member (eg. degrees instead of millimeters in case of the 
+     hillas parameters)
 
    - replaced old MHillas by a new structure which allows you to extend
@@ -23,6 +34,7 @@
    - it is now possible to write single data members of a class object to
      an output stream instead of the whole container only
- 
- 
+
+
+
  *** Version 0.6 (2001/01/15)
 
Index: /trunk/MagicSoft/Mars/mbase/MParContainer.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 1234)
+++ /trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 1235)
@@ -217,5 +217,5 @@
 //  Write out a data member given as a TDataMember object to an output stream.
 //
-Bool_t MParContainer::WriteDataMember(ostream &out, const TDataMember *member) const
+Bool_t MParContainer::WriteDataMember(ostream &out, const TDataMember *member, Double_t scale) const
 {
     if (!member)
@@ -245,5 +245,5 @@
         Double_t d;
         call->Execute((void*)this, d); // FIXME: const, root
-        out << d << " ";
+        out << (scale*d) << " ";
         return kTRUE;
 
@@ -260,5 +260,5 @@
 //  Write out a data member given by name to an output stream.
 //
-Bool_t MParContainer::WriteDataMember(ostream &out, const char *member) const
+Bool_t MParContainer::WriteDataMember(ostream &out, const char *member, Double_t scale) const
 {
     /*const*/ TClass *cls = IsA()->GetBaseDataMember(member);
@@ -266,5 +266,5 @@
         return kFALSE;
 
-    return WriteDataMember(out, cls->GetDataMember(member));
+    return WriteDataMember(out, cls->GetDataMember(member), scale);
 }
 
Index: /trunk/MagicSoft/Mars/mbase/MParContainer.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 1234)
+++ /trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 1235)
@@ -66,6 +66,6 @@
     virtual void   SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; }
 
-    Bool_t WriteDataMember(ostream &out, const char *member) const;
-    Bool_t WriteDataMember(ostream &out, const TDataMember *member) const;
+    Bool_t WriteDataMember(ostream &out, const char *member, Double_t scale=1) const;
+    Bool_t WriteDataMember(ostream &out, const TDataMember *member, Double_t scale=1) const;
     Bool_t WriteDataMember(ostream &out, const TList *list) const;
 
Index: /trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.cc	(revision 1234)
+++ /trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.cc	(revision 1235)
@@ -148,5 +148,5 @@
     while ((cont=(MParContainer*)NextCont()))
     {
-        const TObject *memb = NextMemb();
+        const MScale *memb = (MScale*)NextMemb();
 
         if (!cont->IsReadyToSave())
@@ -160,5 +160,5 @@
         else
         {
-            if (!cont->WriteDataMember(*fOut, memb->GetName()))
+            if (!cont->WriteDataMember(*fOut, memb->GetName(), memb->GetScale()))
                 continue;
         }
@@ -196,9 +196,9 @@
 Bool_t MWriteAsciiFile::GetContainer(MParList *pList)
 {
-    TObject *obj = NULL;
+    MScale *obj = NULL;
 
     TIter Next(&fContNames);
 
-    while ((obj=Next()))
+    while ((obj=(MScale*)Next()))
     {
         const char *name = obj->GetName();
@@ -211,5 +211,5 @@
         }
 
-        AddContainer(cont, obj->GetTitle());
+        AddContainer(cont, obj->GetTitle(), obj->GetScale());
     }
 
@@ -223,11 +223,17 @@
 // If you want to write only one data member of the container
 // specify the name of the data member (eg. fAlpha) Make sure,
-// that a "GetteMethod" for this data type exists (strif the f and
+// that a "GetteMethod" for this data type exists (strip the f and
 // replace it by Get)
-//
-void MWriteAsciiFile::AddContainer(const char *cname, const char *member)
-{
-    TNamed *named = new TNamed(cname, member);
-    fContNames.AddLast(named);
+// If you specify a single data member you can add a scale-factor which
+// is (in case of the data member being a floating point value) multiplied
+// with the data member value. This is usefull if you are want to
+// change the scale (unit) of a data member for writing (eg.
+// writing degrees for the hillas parameters instead of the internally
+// used millimeters)
+//
+void MWriteAsciiFile::AddContainer(const char *cname, const char *member, Double_t scale)
+{
+    MScale *name = new MScale(cname, member, scale);
+    fContNames.AddLast(name);
 }
 
@@ -238,13 +244,19 @@
 // If you want to write only one data member of the container
 // specify the name of the data member (eg. fAlpha) Make sure,
-// that a "GetteMethod" for this data type exists (strif the f and
+// that a "GetteMethod" for this data type exists (strip the f and
 // replace it by Get)
-//
-void MWriteAsciiFile::AddContainer(MParContainer *cont, const char *member)
+// If you specify a single data member you can add a scale-factor which
+// is (in case of the data member being a floating point value) multiplied
+// with the data member value. This is usefull if you are want to
+// change the scale (unit) of a data member for writing (eg.
+// writing degrees for the hillas parameters instead of the internally
+// used millimeters)
+//
+void MWriteAsciiFile::AddContainer(MParContainer *cont, const char *member, Double_t scale)
 {
     fContainer.AddLast(cont);
 
-    TNamed *named = new TNamed(member, "");
-    fMembers.AddLast(named);
-}
-
+    MScale *name = new MScale(member, "", scale);
+    fMembers.AddLast(name);
+}
+
Index: /trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.h	(revision 1234)
+++ /trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.h	(revision 1235)
@@ -12,4 +12,14 @@
 {
 private:
+    class MScale : public TNamed
+    {
+    private:
+        Double_t fScale;
+    public:
+        MScale(const char *name, const char *title, Double_t scale)
+            : TNamed(name, title), fScale(scale) {}
+        Double_t GetScale() const { return fScale; }
+    };
+
     ofstream *fOut;
 
@@ -17,4 +27,5 @@
     TObjArray fContainer;
     TObjArray fMembers;
+    TObjArray fScale;
 
     TString fNameFile;
@@ -34,6 +45,6 @@
     ~MWriteAsciiFile();
 
-    void AddContainer(const char *cname, const char *member="");
-    void AddContainer(MParContainer *cont, const char *member="");
+    void AddContainer(const char *cname, const char *member="", Double_t scale=1);
+    void AddContainer(MParContainer *cont, const char *member="", Double_t scale=1);
 
     ClassDef(MWriteAsciiFile, 0) // Class to write one container to an ascii file
