]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Possibility to add and write detector specific headers.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 18 Nov 2004 07:16:37 +0000 (07:16 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 18 Nov 2004 07:16:37 +0000 (07:16 +0000)
STEER/AliDetectorEventHeader.cxx [new file with mode: 0644]
STEER/AliDetectorEventHeader.h [new file with mode: 0644]
STEER/AliHeader.cxx
STEER/AliHeader.h
STEER/STEERLinkDef.h
STEER/libSTEER.pkg

diff --git a/STEER/AliDetectorEventHeader.cxx b/STEER/AliDetectorEventHeader.cxx
new file mode 100644 (file)
index 0000000..fb622bb
--- /dev/null
@@ -0,0 +1,45 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+//---------------------------------------------------------------------
+// Event header base class for detectors. 
+// Stores detector specific information 
+// per event.
+//
+// Author: andreas.morsch@cern.ch
+//---------------------------------------------------------------------
+
+#include "AliDetectorEventHeader.h"
+ClassImp(AliDetectorEventHeader)
+
+
+//_______________________________________________________________________
+AliDetectorEventHeader::AliDetectorEventHeader()
+{
+  //
+  // Default Constructor
+  //
+}
+
+//_______________________________________________________________________
+AliDetectorEventHeader::AliDetectorEventHeader(const char * name):
+  TNamed(name, "Detector Event Header")
+{
+  //
+  // Constructor
+  //
+}
diff --git a/STEER/AliDetectorEventHeader.h b/STEER/AliDetectorEventHeader.h
new file mode 100644 (file)
index 0000000..9b33c99
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef ALIDETECTOREVENTHEADER_H
+#define ALIDETECTOREVENTHEADER_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+//---------------------------------------------------------------------
+// Event header base class for detetors 
+// Stores detector specific information
+// Author: andreas.morsch@cern.ch
+//---------------------------------------------------------------------
+
+#include <TNamed.h>
+class AliDetectorEventHeader : public TNamed
+{
+ public:
+
+  AliDetectorEventHeader(const char* name);
+  AliDetectorEventHeader();
+  virtual ~AliDetectorEventHeader() {}
+protected:
+  ClassDef(AliDetectorEventHeader,0) // Event header for detectors
+};
+
+#endif
index 5b6c2922be811a98becc4ecdb95d01989b698b34..aa3dc1dea46153a0c9df67780d5152e336e3e34d 100644 (file)
 //     Author:
 //-----------------------------------------------------------------------
 
+
 #include <stdio.h>
+#include <TObjArray.h>
 
 #include "AliLog.h"
 #include "AliHeader.h"
+#include "AliDetectorEventHeader.h"
+#include "AliGenEventHeader.h"
+    
  
 ClassImp(AliHeader)
 
@@ -38,7 +43,8 @@ AliHeader::AliHeader():
   fEvent(0),
   fEventNrInRun(0),
   fStack(0),
-  fGenHeader(0)
+  fGenHeader(0),
+  fDetHeaders(0)
 {
   //
   // Default constructor
@@ -55,7 +61,8 @@ AliHeader::AliHeader(const AliHeader& head):
   fEvent(0),
   fEventNrInRun(0),
   fStack(0),
-  fGenHeader(0)
+  fGenHeader(0),
+  fDetHeaders(0)
 {
   //
   // Copy constructor
@@ -72,7 +79,8 @@ AliHeader::AliHeader(Int_t run, Int_t event):
   fEvent(event),
   fEventNrInRun(0),
   fStack(0),
-  fGenHeader(0)
+  fGenHeader(0), 
+  fDetHeaders(0) 
 {
   //
   // Standard constructor
@@ -88,13 +96,28 @@ AliHeader::AliHeader(Int_t run, Int_t event, Int_t evNumber):
   fEvent(event),
   fEventNrInRun(evNumber),
   fStack(0),
-  fGenHeader(0)
+  fGenHeader(0), 
+  fDetHeaders(0) 
 {
   //
   // Standard constructor
   //
 }
 
+AliHeader::~AliHeader()
+{
+    //
+    // Destructor
+    //
+    if (fDetHeaders) {
+       fDetHeaders->Delete();
+       delete fDetHeaders;
+    }
+    delete fGenHeader;
+}
+
+
+
 //_______________________________________________________________________
 void AliHeader::Reset(Int_t run, Int_t event)
 {
@@ -106,6 +129,7 @@ void AliHeader::Reset(Int_t run, Int_t event)
   fNprimary=0;
   fNtrack=0;
   fEvent=event;
+  if (fDetHeaders) fDetHeaders->Clear();
 }
 
 //_______________________________________________________________________
@@ -120,6 +144,7 @@ void AliHeader::Reset(Int_t run, Int_t event, Int_t evNumber)
   fNtrack=0;
   fEvent=event;
   fEventNrInRun=evNumber;
+  if (fDetHeaders) fDetHeaders->Clear();
 }
 
 //_______________________________________________________________________
@@ -161,6 +186,49 @@ void AliHeader::SetGenEventHeader(AliGenEventHeader* header)
     fGenHeader = header;
 }
 
+void AliHeader::AddDetectorEventHeader(AliDetectorEventHeader* header)
+{
+// Add a detector specific header
+//
+//  Create the array of headers
+    if (!fDetHeaders) fDetHeaders = new TObjArray(77);
+
+//  Some basic checks
+
+    if (!header) {
+       Warning("AddDetectorEventHeader","Detector %s tries to add empty header \n", header->GetName());
+       return;
+    }
+    
+    if (strlen(header->GetName()) == 0) {
+       Warning("AddDetectorEventHeader","Detector %s tries to add header without name \n", header->GetName());
+       return;
+    }
+    
+    TObject *mod=fDetHeaders->FindObject(header->GetName());
+    if(mod) {
+       Warning("AddDetectorEventHeader","Detector %s tries to add more than one header \n", header->GetName());
+       return;
+    }
+    
+
+//  Add the header to the list 
+    fDetHeaders->Add(header);
+}
+
+AliDetectorEventHeader* AliHeader::GetDetectorEventHeader(const char *name) const
+{
+//
+// Returns detector specific event header
+//
+    if (!fDetHeaders) {
+       Warning("GetDetectorEventHeader","There are no  detector specific headers for this event");
+       return 0x0;
+    }
+    return  dynamic_cast<AliDetectorEventHeader*>(fDetHeaders->FindObject(name)) ;
+}
+
+
 //_______________________________________________________________________
 AliGenEventHeader*  AliHeader::GenEventHeader() const
 {
index 68d2447ff45630014d9a0c1a35e8a0d47256a6cf..f4ec8e576c5d3026690ab83b2d91d313852e6bd7 100644 (file)
 
 class AliStack;
 class AliGenEventHeader;
+class AliDetectorEventHeader;
+class TObjArray;
+
 class AliHeader : public TObject {
 public:
   AliHeader();
   AliHeader(const AliHeader& head);
   AliHeader(Int_t run, Int_t event);
   AliHeader(Int_t run, Int_t eventSerialNr, Int_t evNrInRun);
-  virtual ~AliHeader() {}
+  virtual ~AliHeader();
+  
 
   virtual void Reset(Int_t run, Int_t event);
   virtual void Reset(Int_t run, Int_t eventSerialNr, Int_t evNrInRun);
@@ -52,6 +55,10 @@ public:
   virtual  void SetGenEventHeader(AliGenEventHeader* header);
   virtual  AliGenEventHeader*  GenEventHeader() const;
 
+  virtual void AddDetectorEventHeader(AliDetectorEventHeader* header);
+  virtual AliDetectorEventHeader* GetDetectorEventHeader(const char *name) const;
+  
+  
   virtual void Print(const char *opt=0) const;
 
   AliHeader& operator=(const AliHeader& head) 
@@ -61,16 +68,17 @@ protected:
 
   void Copy(TObject& head) const;
 
-  Int_t         fRun;         //Run number
-  Int_t         fNvertex;     //Number of vertices
-  Int_t         fNprimary;    //Number of primary tracks
-  Int_t         fNtrack;      //Number of tracks
-  Int_t         fEvent;       //Event number (serial in the file)
-  Int_t         fEventNrInRun; //Unique Event number within the run
-  AliStack     *fStack;       //Pointer to stack
-  AliGenEventHeader* fGenHeader;    //Event Header for Generator  
-  
-  ClassDef(AliHeader,2) //Alice event header    
+  Int_t         fRun;               //Run number
+  Int_t         fNvertex;           //Number of vertices
+  Int_t         fNprimary;          //Number of primary tracks
+  Int_t         fNtrack;            //Number of tracks
+  Int_t         fEvent;             //Event number (serial in the file)
+  Int_t         fEventNrInRun;      //Unique Event number within the run
+  AliStack     *fStack;             //Pointer to stack
+  AliGenEventHeader* fGenHeader;    //Event Header for Generator
+  TObjArray*         fDetHeaders;   //Event Headers for detector specific information 
+
+  ClassDef(AliHeader,3) //Alice event header    
 };
 
 #endif
index af1d1cee4aefd660ea31848fae12176a33a118ee..4f9472481a4e9eee18cdd31345d70da6e23c56d6 100644 (file)
@@ -73,4 +73,5 @@
 #pragma link C++ class  AliReconstruction+;
 #pragma link C++ class  AliVertexGenFile+;
 #pragma link C++ class  AliVertexer+;
+#pragma link C++ class  AliDetectorEventHeader+;
 #endif
index 8ae10d78b988205980583aa9529be420e90e05c4..caf232a16a90d1bba5621546a482343e13db8e2b 100644 (file)
@@ -18,7 +18,8 @@ AliTrackMap.cxx AliTrackMapper.cxx AliCollisionGeometry.cxx \
 AliMemoryWatcher.cxx \
 AliVertexer.cxx \
 AliMC.cxx AliSimulation.cxx AliReconstruction.cxx AliVertexGenFile.cxx \
-AliReconstructor.cxx
+AliReconstructor.cxx \
+AliDetectorEventHeader.cxx
 
 HDRS:= $(SRCS:.cxx=.h)