]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
first attempt to submit something to svn
authormisko <misko@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 2 Oct 2008 14:37:11 +0000 (14:37 +0000)
committermisko <misko@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 2 Oct 2008 14:37:11 +0000 (14:37 +0000)
UNICOR/AliDAnal.cxx [new file with mode: 0644]
UNICOR/AliDAnal.h [new file with mode: 0644]

diff --git a/UNICOR/AliDAnal.cxx b/UNICOR/AliDAnal.cxx
new file mode 100644 (file)
index 0000000..8de31f7
--- /dev/null
@@ -0,0 +1,40 @@
+// Author: Dariusz Miskowiec <mailto:d.miskowiec@gsi.de> 2007
+
+///////////////////////////////////////////////////////////////////////////////
+// Parent analysis class
+///////////////////////////////////////////////////////////////////////////////
+
+#include <TROOT.h>
+#include <TFile.h>
+#include "AliDAnal.h"
+
+ClassImp(AliDAnal)
+  
+TDatabasePDG *AliDAnal::fPDG = TDatabasePDG::Instance();
+
+/*****************************************************************************/
+AliDAnal::AliDAnal(char *nam) : TNamed(nam,nam), fHistos()  
+{
+  // constructor
+
+  fHistos.SetOwner(1);
+  TDirectory *dir = gROOT->mkdir(GetName());
+  dir->cd();
+
+  printf("%s object named %s created\n",ClassName(),GetName());
+}
+/*****************************************************************************/
+void AliDAnal::Save(const char *outfil, const char *mode) 
+{
+  // store histograms on file in a directory named after the object
+  // mode should be "update" (default) or "new"
+
+  printf("%s saving  histograms on %s (%s)\n",GetName(),outfil,mode);  
+  TFile * f = TFile::Open(outfil, mode);
+  TDirectory *dest = f->mkdir(GetName());
+  dest->cd();
+  fHistos.Write();
+  gROOT->cd();
+  f->Close();
+}
+/******************************************************************************/
diff --git a/UNICOR/AliDAnal.h b/UNICOR/AliDAnal.h
new file mode 100644 (file)
index 0000000..ee3ac95
--- /dev/null
@@ -0,0 +1,29 @@
+// Author: Dariusz Miskowiec <mailto:d.miskowiec@gsi.de> 2007
+
+#ifndef ALIDANAL_H
+#define ALIDANAL_H
+
+///////////////////////////////////////////////////////////////////////////////
+// Parent analysis class
+///////////////////////////////////////////////////////////////////////////////
+
+#include <TNamed.h>
+#include <TObjArray.h>
+#include <TDatabasePDG.h>
+
+/*****************************************************************************/
+class AliDAnal : public TNamed {
+   
+ public:
+  AliDAnal(char *nam);                        // constructor
+  virtual ~AliDAnal()                         {printf("AliDAnal object %s destroyed\n",GetName());}
+  void Save(const char *outfil, const char *mode="update");  // save histograms on root file
+
+ protected:
+  static TDatabasePDG *fPDG;               // particle database
+  TObjArray fHistos;                       // histograms
+
+  ClassDef(AliDAnal,1)
+};
+/*****************************************************************************/
+#endif