1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 //-----------------------------------------------------------------------
19 // Simulation event header class
20 // Collaborates with AliRun, AliStack, and AliGenReaderTreeK classes
21 // Many other classes depend on it
23 //-----------------------------------------------------------------------
27 #include <TObjArray.h>
30 #include "AliHeader.h"
31 #include "AliDetectorEventHeader.h"
32 #include "AliGenEventHeader.h"
37 //_______________________________________________________________________
38 AliHeader::AliHeader():
50 // Default constructor
54 //_______________________________________________________________________
55 AliHeader::AliHeader(const AliHeader& head):
73 //_______________________________________________________________________
74 AliHeader::AliHeader(Int_t run, Int_t event):
86 // Standard constructor
90 //_______________________________________________________________________
91 AliHeader::AliHeader(Int_t run, Int_t event, Int_t evNumber):
97 fEventNrInRun(evNumber),
103 // Standard constructor
107 AliHeader::~AliHeader()
113 fDetHeaders->Delete();
121 //_______________________________________________________________________
122 void AliHeader::Reset(Int_t run, Int_t event)
125 // Resets the header with new run and event number
132 if (fDetHeaders) fDetHeaders->Delete();
135 //_______________________________________________________________________
136 void AliHeader::Reset(Int_t run, Int_t event, Int_t evNumber)
139 // Resets the header with new run and event number
146 fEventNrInRun=evNumber;
147 if (fDetHeaders) fDetHeaders->Clear();
150 //_______________________________________________________________________
151 void AliHeader::Print(const char*) const
154 // Dumps header content
157 "\n=========== Header for run %d Event %d = beginning ======================================\n",
159 printf(" Number of Vertex %d\n",fNvertex);
160 printf(" Number of Primary %d\n",fNprimary);
161 printf(" Number of Tracks %d\n",fNtrack);
163 "=========== Header for run %d Event %d = end ============================================\n\n",
168 //_______________________________________________________________________
169 AliStack* AliHeader::Stack() const
171 // Return pointer to stack
175 //_______________________________________________________________________
176 void AliHeader::SetStack(AliStack* stack)
178 // Set pointer to stack
182 //_______________________________________________________________________
183 void AliHeader::SetGenEventHeader(AliGenEventHeader* header)
185 // Set pointer to header for generated event
189 void AliHeader::AddDetectorEventHeader(AliDetectorEventHeader* header)
191 // Add a detector specific header
193 // Create the array of headers
194 if (!fDetHeaders) fDetHeaders = new TObjArray(77);
199 Warning("AddDetectorEventHeader","Detector %s tries to add empty header \n", header->GetName());
203 if (strlen(header->GetName()) == 0) {
204 Warning("AddDetectorEventHeader","Detector %s tries to add header without name \n", header->GetName());
208 TObject *mod=fDetHeaders->FindObject(header->GetName());
210 Warning("AddDetectorEventHeader","Detector %s tries to add more than one header \n", header->GetName());
215 // Add the header to the list
216 fDetHeaders->Add(header);
219 AliDetectorEventHeader* AliHeader::GetDetectorEventHeader(const char *name) const
222 // Returns detector specific event header
225 Warning("GetDetectorEventHeader","There are no detector specific headers for this event");
228 return dynamic_cast<AliDetectorEventHeader*>(fDetHeaders->FindObject(name)) ;
232 //_______________________________________________________________________
233 AliGenEventHeader* AliHeader::GenEventHeader() const
235 // Get pointer to header for generated event
239 //_______________________________________________________________________
240 void AliHeader::Copy(TObject&) const
242 AliFatal("Not implemented");