]>
Commit | Line | Data |
---|---|---|
3513afb7 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | // | |
16 | // Debug event | |
17 | // the tree is represented as reduced events | |
18 | // | |
19 | // Authors: | |
20 | // M.Fasel <M.Fasel@gsi.de> | |
21 | // | |
22 | ||
23 | #include "TObjArray.h" | |
24 | #include "AliHFEreducedTrack.h" | |
25 | #include "AliHFEreducedMCParticle.h" | |
26 | #include "AliHFEreducedEvent.h" | |
27 | ||
28 | ClassImp(AliHFEreducedEvent) | |
29 | ||
30 | //_______________________________________ | |
31 | AliHFEreducedEvent::AliHFEreducedEvent(): | |
32 | TObject(), | |
33 | fTracks(NULL), | |
34 | fMCparticles(NULL), | |
35 | fNtracks(0), | |
36 | fNmcparticles(0), | |
37 | fRunNumber(0), | |
38 | fTrigger(0), | |
afb48e1d | 39 | fSPDMultiplicity(0), |
40 | fPileupFlag(kFALSE) | |
3513afb7 | 41 | { |
42 | // | |
43 | // Default constructor | |
44 | // | |
45 | fTracks = new TObjArray; | |
46 | fTracks->SetOwner(); | |
47 | fMCparticles = new TObjArray; | |
48 | fMCparticles->SetOwner(); | |
4437a0d2 | 49 | memset(fCentrality, 0, sizeof(Float_t) * kCentBuff); |
3513afb7 | 50 | memset(fV0Multiplicity, 0, sizeof(Float_t) * 2); |
51 | memset(fZDCEnergy, 0, sizeof(Float_t) * 4); | |
7e695443 | 52 | memset(fVX, 0, sizeof(Float_t)*2); |
53 | memset(fVY, 0, sizeof(Float_t)*2); | |
54 | memset(fVZ, 0, sizeof(Float_t)*2); | |
afb48e1d | 55 | memset(fVMC, 0, sizeof(Double_t)*3); |
7e695443 | 56 | memset(fNContrib, 0, sizeof(Int_t) * 2); |
7d4e0c80 | 57 | fVertexResolution[1] = 999.; |
58 | fVertexResolution[0] = fVertexResolution[1]; | |
59 | fVertexDispersion[0] = 999.; | |
60 | fVertexDispersion[1] = fVertexDispersion[0]; | |
3513afb7 | 61 | } |
62 | ||
63 | //_______________________________________ | |
64 | AliHFEreducedEvent::AliHFEreducedEvent(const AliHFEreducedEvent &ref): | |
65 | TObject(ref), | |
66 | fTracks(NULL), | |
67 | fMCparticles(NULL), | |
68 | fNtracks(ref.fNtracks), | |
69 | fNmcparticles(ref.fNmcparticles), | |
70 | fRunNumber(ref.fRunNumber), | |
71 | fTrigger(ref.fTrigger), | |
afb48e1d | 72 | fSPDMultiplicity(ref.fSPDMultiplicity), |
73 | fPileupFlag(ref.fPileupFlag) | |
3513afb7 | 74 | { |
75 | // | |
76 | // Copy constructor | |
77 | // | |
78 | fTracks = new TObjArray; | |
79 | fTracks->SetOwner(); | |
80 | for(int itrk = 0; itrk < ref.GetNumberOfTracks(); itrk++) | |
81 | fTracks->Add(new AliHFEreducedTrack(*(ref.GetTrack(itrk)))); | |
82 | fMCparticles = new TObjArray; | |
83 | fMCparticles->SetOwner(); | |
84 | for(int iprt = 0; iprt < ref.GetNumberOfMCParticles(); iprt++) | |
85 | fMCparticles->Add(new AliHFEreducedMCParticle(*(ref.GetMCParticle(iprt)))); | |
4437a0d2 | 86 | memcpy(fCentrality, ref.fCentrality, sizeof(Float_t) * kCentBuff); |
3513afb7 | 87 | memcpy(fV0Multiplicity, ref.fV0Multiplicity, sizeof(Float_t) * 2); |
88 | memcpy(fZDCEnergy, ref.fZDCEnergy, sizeof(Float_t) *4); | |
7e695443 | 89 | memcpy(fVX, ref.fVX, sizeof(Float_t)*2); |
90 | memcpy(fVY, ref.fVY, sizeof(Float_t)*2); | |
91 | memcpy(fVZ, ref.fVZ, sizeof(Float_t)*2); | |
afb48e1d | 92 | memcpy(fVMC, ref.fVMC, sizeof(Double_t)*3); |
7e695443 | 93 | memcpy(fVertexResolution, ref.fVertexResolution, sizeof(Float_t)*2); |
afb48e1d | 94 | memcpy(fVertexDispersion, ref.fVertexDispersion, sizeof(Float_t)*2); |
7e695443 | 95 | memcpy(fNContrib, ref.fNContrib, sizeof(Int_t) * 2); |
3513afb7 | 96 | } |
97 | ||
98 | //_______________________________________ | |
99 | AliHFEreducedEvent &AliHFEreducedEvent::operator=(const AliHFEreducedEvent &ref){ | |
100 | // | |
101 | // Assignment operator | |
102 | // | |
103 | if(&ref != this){ | |
104 | TObject::operator=(ref); | |
105 | fTracks->SetOwner(); | |
106 | fTracks->Clear(); | |
107 | for(int itrk = 0; itrk < ref.GetNumberOfTracks(); itrk++) | |
108 | fTracks->Add(new AliHFEreducedTrack(*(ref.GetTrack(itrk)))); | |
109 | fMCparticles->Clear(); | |
110 | fMCparticles->SetOwner(); | |
111 | for(int iprt = 0; iprt < ref.GetNumberOfMCParticles(); iprt++) | |
112 | fMCparticles->Add(new AliHFEreducedMCParticle(*(ref.GetMCParticle(iprt)))); | |
113 | fNtracks = ref.fNtracks; | |
114 | fNmcparticles = ref.fNmcparticles; | |
115 | fRunNumber = ref.fRunNumber; | |
116 | fTrigger = ref.fTrigger; | |
7e695443 | 117 | memcpy(fVX, ref.fVX, sizeof(Float_t)*2); |
118 | memcpy(fVY, ref.fVY, sizeof(Float_t)*2); | |
119 | memcpy(fVZ, ref.fVZ, sizeof(Float_t)*2); | |
afb48e1d | 120 | memcpy(fVMC, ref.fVMC, sizeof(Double_t)*3); |
7e695443 | 121 | memcpy(fNContrib, ref.fNContrib, sizeof(Int_t) * 2); |
122 | memcpy(fVertexResolution, ref.fVertexResolution, sizeof(Float_t)*2); | |
afb48e1d | 123 | memcpy(fVertexDispersion, ref.fVertexDispersion, sizeof(Float_t)*2); |
3513afb7 | 124 | fSPDMultiplicity = ref.fSPDMultiplicity; |
afb48e1d | 125 | fPileupFlag = ref.fPileupFlag; |
4437a0d2 | 126 | memcpy(fCentrality, ref.fCentrality, sizeof(Float_t) * kCentBuff); |
3513afb7 | 127 | memcpy(fV0Multiplicity, ref.fV0Multiplicity, sizeof(Float_t) * 2); |
128 | memcpy(fZDCEnergy, ref.fZDCEnergy, sizeof(Float_t) *4); | |
129 | } | |
130 | return *this; | |
131 | } | |
132 | ||
133 | //_______________________________________ | |
134 | AliHFEreducedEvent::~AliHFEreducedEvent(){ | |
135 | // | |
136 | // Destructor: Clear tracks an MC particles | |
137 | // | |
138 | delete fTracks; | |
139 | delete fMCparticles; | |
140 | } | |
141 | ||
142 | //_______________________________________ | |
143 | void AliHFEreducedEvent::AddTrack(const AliHFEreducedTrack *track){ | |
144 | // | |
145 | // Add track to the event | |
146 | // | |
147 | fTracks->Add(new AliHFEreducedTrack(*track)); | |
148 | fNtracks++; | |
149 | } | |
150 | ||
151 | //_______________________________________ | |
152 | const AliHFEreducedTrack *AliHFEreducedEvent::GetTrack(Int_t itrk) const { | |
153 | // | |
154 | // Get Track | |
155 | // | |
156 | if(itrk < 0 || itrk >= fNtracks) return NULL; | |
157 | return dynamic_cast<const AliHFEreducedTrack *>(fTracks->At(itrk)); | |
158 | } | |
159 | ||
160 | //_______________________________________ | |
161 | void AliHFEreducedEvent::AddMCParticle(const AliHFEreducedMCParticle *track){ | |
162 | // | |
163 | // Add MC particle to the Event | |
164 | // | |
165 | fMCparticles->Add(new AliHFEreducedMCParticle(*track)); | |
166 | fNmcparticles++; | |
167 | } | |
168 | ||
169 | //_______________________________________ | |
170 | const AliHFEreducedMCParticle *AliHFEreducedEvent::GetMCParticle(Int_t itrk) const { | |
171 | // | |
172 | // Get MC particle | |
173 | // | |
174 | if(itrk < 0 || itrk >= fNmcparticles) return NULL; | |
175 | return dynamic_cast<const AliHFEreducedMCParticle *>(fMCparticles->At(itrk)); | |
176 | } |