]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/hfe/AliHFEreducedEvent.cxx
Update
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliHFEreducedEvent.cxx
CommitLineData
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
28ClassImp(AliHFEreducedEvent)
29
30//_______________________________________
31AliHFEreducedEvent::AliHFEreducedEvent():
32TObject(),
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);
afb48e1d 57 fVertexResolution[0] = fVertexResolution[1] = 999.;
58 fVertexDispersion[0] = fVertexDispersion[0] = 999.;
3513afb7 59}
60
61//_______________________________________
62AliHFEreducedEvent::AliHFEreducedEvent(const AliHFEreducedEvent &ref):
63 TObject(ref),
64 fTracks(NULL),
65 fMCparticles(NULL),
66 fNtracks(ref.fNtracks),
67 fNmcparticles(ref.fNmcparticles),
68 fRunNumber(ref.fRunNumber),
69 fTrigger(ref.fTrigger),
afb48e1d 70 fSPDMultiplicity(ref.fSPDMultiplicity),
71 fPileupFlag(ref.fPileupFlag)
3513afb7 72{
73 //
74 // Copy constructor
75 //
76 fTracks = new TObjArray;
77 fTracks->SetOwner();
78 for(int itrk = 0; itrk < ref.GetNumberOfTracks(); itrk++)
79 fTracks->Add(new AliHFEreducedTrack(*(ref.GetTrack(itrk))));
80 fMCparticles = new TObjArray;
81 fMCparticles->SetOwner();
82 for(int iprt = 0; iprt < ref.GetNumberOfMCParticles(); iprt++)
83 fMCparticles->Add(new AliHFEreducedMCParticle(*(ref.GetMCParticle(iprt))));
4437a0d2 84 memcpy(fCentrality, ref.fCentrality, sizeof(Float_t) * kCentBuff);
3513afb7 85 memcpy(fV0Multiplicity, ref.fV0Multiplicity, sizeof(Float_t) * 2);
86 memcpy(fZDCEnergy, ref.fZDCEnergy, sizeof(Float_t) *4);
7e695443 87 memcpy(fVX, ref.fVX, sizeof(Float_t)*2);
88 memcpy(fVY, ref.fVY, sizeof(Float_t)*2);
89 memcpy(fVZ, ref.fVZ, sizeof(Float_t)*2);
afb48e1d 90 memcpy(fVMC, ref.fVMC, sizeof(Double_t)*3);
7e695443 91 memcpy(fVertexResolution, ref.fVertexResolution, sizeof(Float_t)*2);
afb48e1d 92 memcpy(fVertexDispersion, ref.fVertexDispersion, sizeof(Float_t)*2);
7e695443 93 memcpy(fNContrib, ref.fNContrib, sizeof(Int_t) * 2);
3513afb7 94}
95
96//_______________________________________
97AliHFEreducedEvent &AliHFEreducedEvent::operator=(const AliHFEreducedEvent &ref){
98 //
99 // Assignment operator
100 //
101 if(&ref != this){
102 TObject::operator=(ref);
103 fTracks->SetOwner();
104 fTracks->Clear();
105 for(int itrk = 0; itrk < ref.GetNumberOfTracks(); itrk++)
106 fTracks->Add(new AliHFEreducedTrack(*(ref.GetTrack(itrk))));
107 fMCparticles->Clear();
108 fMCparticles->SetOwner();
109 for(int iprt = 0; iprt < ref.GetNumberOfMCParticles(); iprt++)
110 fMCparticles->Add(new AliHFEreducedMCParticle(*(ref.GetMCParticle(iprt))));
111 fNtracks = ref.fNtracks;
112 fNmcparticles = ref.fNmcparticles;
113 fRunNumber = ref.fRunNumber;
114 fTrigger = ref.fTrigger;
7e695443 115 memcpy(fVX, ref.fVX, sizeof(Float_t)*2);
116 memcpy(fVY, ref.fVY, sizeof(Float_t)*2);
117 memcpy(fVZ, ref.fVZ, sizeof(Float_t)*2);
afb48e1d 118 memcpy(fVMC, ref.fVMC, sizeof(Double_t)*3);
7e695443 119 memcpy(fNContrib, ref.fNContrib, sizeof(Int_t) * 2);
120 memcpy(fVertexResolution, ref.fVertexResolution, sizeof(Float_t)*2);
afb48e1d 121 memcpy(fVertexDispersion, ref.fVertexDispersion, sizeof(Float_t)*2);
3513afb7 122 fSPDMultiplicity = ref.fSPDMultiplicity;
afb48e1d 123 fPileupFlag = ref.fPileupFlag;
4437a0d2 124 memcpy(fCentrality, ref.fCentrality, sizeof(Float_t) * kCentBuff);
3513afb7 125 memcpy(fV0Multiplicity, ref.fV0Multiplicity, sizeof(Float_t) * 2);
126 memcpy(fZDCEnergy, ref.fZDCEnergy, sizeof(Float_t) *4);
127 }
128 return *this;
129}
130
131//_______________________________________
132AliHFEreducedEvent::~AliHFEreducedEvent(){
133 //
134 // Destructor: Clear tracks an MC particles
135 //
136 delete fTracks;
137 delete fMCparticles;
138}
139
140//_______________________________________
141void AliHFEreducedEvent::AddTrack(const AliHFEreducedTrack *track){
142 //
143 // Add track to the event
144 //
145 fTracks->Add(new AliHFEreducedTrack(*track));
146 fNtracks++;
147}
148
149//_______________________________________
150const AliHFEreducedTrack *AliHFEreducedEvent::GetTrack(Int_t itrk) const {
151 //
152 // Get Track
153 //
154 if(itrk < 0 || itrk >= fNtracks) return NULL;
155 return dynamic_cast<const AliHFEreducedTrack *>(fTracks->At(itrk));
156}
157
158//_______________________________________
159void AliHFEreducedEvent::AddMCParticle(const AliHFEreducedMCParticle *track){
160 //
161 // Add MC particle to the Event
162 //
163 fMCparticles->Add(new AliHFEreducedMCParticle(*track));
164 fNmcparticles++;
165}
166
167//_______________________________________
168const AliHFEreducedMCParticle *AliHFEreducedEvent::GetMCParticle(Int_t itrk) const {
169 //
170 // Get MC particle
171 //
172 if(itrk < 0 || itrk >= fNmcparticles) return NULL;
173 return dynamic_cast<const AliHFEreducedMCParticle *>(fMCparticles->At(itrk));
174}