PreReading of MC information on demand.
[u/mrichter/AliRoot.git] / STEER / AliMCEvent.h
CommitLineData
415d9f5c 1// -*- mode: C++ -*-
2#ifndef ALIMCEVENT_H
3#define ALIMCEVENT_H
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
7
8/* $Id$ */
9
10//-------------------------------------------------------------------------
11// Class AliMCEvent
12//
13// Origin: Andreas.Morsch, CERN, andreas.morsch@cern.ch
14//-------------------------------------------------------------------------
15
16
17#include <TTree.h>
93df0e9b 18#include <TRefArray.h>
7aad0c47 19#include <TClonesArray.h>
415d9f5c 20
21#include <AliVEvent.h>
22#include "AliVHeader.h"
7aad0c47 23#include "AliVParticle.h"
415d9f5c 24#include "AliMCParticle.h"
25
26class AliStack;
27class AliHeader;
28class AliGenEventHeader;
29
30class TClonesArray;
93836e1b 31class TList;
415d9f5c 32
33class AliMCEvent : public AliVEvent {
34
35public:
36
37 AliMCEvent();
38 virtual ~AliMCEvent() {;}
39 AliMCEvent(const AliMCEvent& mcEvnt);
40 AliMCEvent& operator=(const AliMCEvent& mcEvnt);
41 //
42 // Methods implementing the interface
43 //
44 // Services
45 virtual void AddObject(TObject* /*obj*/) {;}
46 virtual TObject* FindListObject(const char */*name*/) {return 0;}
47 virtual TList* GetList() const {return 0;}
48 virtual void CreateStdContent() {;}
49 virtual void GetStdContent() {;}
1d0dd492 50 virtual void ReadFromTree(TTree * /*tree*/, Option_t* /*opt*/) {;}
f12d42ce 51 virtual void WriteToTree(TTree* /*tree*/) const {;}
415d9f5c 52
53 virtual void SetStdNames() {;}
54 virtual void Print(Option_t */*option=""*/) const {;}
35152e4b 55 virtual void PreReadAll();
415d9f5c 56
57 // Header
58 virtual AliVHeader* GetHeader() const {return 0;}
59
60 // Delegated methods for fESDRun or AODHeader
61
62 virtual void SetRunNumber(Int_t /*n*/) {;}
63 virtual void SetPeriodNumber(UInt_t /*n*/) {;}
64 virtual void SetMagneticField(Double_t /*mf*/) {;}
65
66
67 virtual Int_t GetRunNumber() const {return 0;}
7aad0c47 68 virtual UInt_t GetPeriodNumber() const {return 0;}
415d9f5c 69 virtual Double_t GetMagneticField() const {return 0.;}
70
71 // Setters not needed
72 virtual void SetOrbitNumber(UInt_t /*n*/) {;}
73 virtual void SetBunchCrossNumber(UShort_t /*n*/) {;}
74 virtual void SetEventType(UInt_t /*eventType*/) {;}
75 virtual void SetTriggerMask(ULong64_t /*n*/) {;}
76 virtual void SetTriggerCluster(UChar_t /*n*/) {;}
77
7aad0c47 78 virtual UInt_t GetOrbitNumber() const {return 0;}
79 virtual UShort_t GetBunchCrossNumber() const {return 0;}
415d9f5c 80
7aad0c47 81 virtual UInt_t GetEventType() const {return 0;}
415d9f5c 82
a85132e7 83 virtual ULong64_t GetTriggerMask() const {return 0;}
84 virtual UChar_t GetTriggerCluster() const {return 0;}
85 virtual Double_t GetZDCN1Energy() const {return 0.;}
86 virtual Double_t GetZDCP1Energy() const {return 0.;}
87 virtual Double_t GetZDCN2Energy() const {return 0.;}
88 virtual Double_t GetZDCP2Energy() const {return 0.;}
eee13e8d 89 virtual Double_t GetZDCEMEnergy(Int_t /*i*/)
90 const {return 0.;}
415d9f5c 91 // Tracks
7aad0c47 92 virtual AliVParticle *GetTrack(Int_t i) const;
415d9f5c 93 virtual Int_t GetNumberOfTracks() const {return fNparticles;}
c1b93f02 94 virtual Int_t GetNumberOfV0s() const {return -1;}
bc0379e5 95 virtual Int_t GetNumberOfCascades() const {return -1;}
415d9f5c 96
97 //
98 // MC Specific methods
99 //
100 // Getters
101 AliStack* Stack() {return fStack;}
102 AliHeader* Header() {return fHeader;}
103 AliGenEventHeader* GenEventHeader();
104 // Services
105 virtual void ConnectTreeE (TTree* tree);
106 virtual void ConnectTreeK (TTree* tree);
107 virtual void ConnectTreeTR(TTree* tree);
108 virtual void Clean();
93836e1b 109 virtual void InitEvent();
415d9f5c 110 virtual void FinishEvent();
111 virtual Int_t GetParticleAndTR(Int_t i, TParticle*& particle, TClonesArray*& trefs);
112 virtual void DrawCheck(Int_t i, Int_t search);
93836e1b 113 virtual void AddSubsidiaryEvent(AliMCEvent* event);
114 virtual Int_t GetNumberOfPrimaries() {return fNprimaries;}
115 virtual Int_t GetPrimaryOffset() const {return fPrimaryOffset;}
116 virtual Int_t GetSecondaryOffset() const {return fSecondaryOffset;}
117 virtual void SetPrimaryOffset(Int_t ioff) {fPrimaryOffset = ioff;}
118 virtual void SetSecondaryOffset(Int_t ioff) {fSecondaryOffset = ioff;}
119 virtual Bool_t IsPhysicalPrimary(Int_t i);
120 virtual Int_t BgLabelToIndex(Int_t label);
121 static Int_t BgLabelOffset() {return fgkBgLabelOffset;}
7aad0c47 122 // External particle array
123 virtual void SetParticleArray(TClonesArray* mcParticles)
124 {fMCParticles = mcParticles; fNparticles = fMCParticles->GetEntries(); fExternal = kTRUE;}
125
126
415d9f5c 127private:
128 virtual void ReorderAndExpandTreeTR();
93836e1b 129 virtual Int_t FindIndexAndEvent(Int_t oldidx, AliMCEvent*& event) const;
130private:
7aad0c47 131 // Stanndard implementation for ESD production
93836e1b 132 AliStack *fStack; // Current pointer to stack
133 TClonesArray *fMCParticles; // Pointer to list of particles
134 TRefArray *fMCParticleMap; // Map of MC Particles
135 AliHeader *fHeader; // Current pointer to header
136 TClonesArray *fTRBuffer; // Track reference buffer
137 TClonesArray *fTrackReferences; // Array of track references
138 TTree *fTreeTR; // Pointer to Track Reference Tree
139 TTree *fTmpTreeTR; // Temporary tree TR to read old format
140 TFile *fTmpFileTR; // Temporary file with TreeTR to read old format
141 Int_t fNprimaries; // Number of primaries
142 Int_t fNparticles; // Number of particles
143 TList *fSubsidiaryEvents; // List of possible subsidiary events (for example merged underlying event)
144 Int_t fPrimaryOffset; // Offset for primaries
145 Int_t fSecondaryOffset; // Offset for secondaries
7aad0c47 146 Bool_t fExternal; // True if external particle array
93836e1b 147 static Int_t fgkBgLabelOffset; // Standard branch name
e337635e 148 ClassDef(AliMCEvent, 1) // AliVEvent realisation for MC data
415d9f5c 149};
150
151
152#endif
153