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 **************************************************************************/
17 // the tree is represented as reduced events
20 // M.Fasel <M.Fasel@gsi.de>
23 #include "TObjArray.h"
24 #include "AliHFEreducedTrack.h"
25 #include "AliHFEreducedMCParticle.h"
26 #include "AliHFEreducedEvent.h"
28 ClassImp(AliHFEreducedEvent)
30 //_______________________________________
31 AliHFEreducedEvent::AliHFEreducedEvent():
43 // Default constructor
45 fTracks = new TObjArray;
47 fMCparticles = new TObjArray;
48 fMCparticles->SetOwner();
49 memset(fCentrality, 0, sizeof(Float_t) * kCentBuff);
50 memset(fV0Multiplicity, 0, sizeof(Float_t) * 2);
51 memset(fZDCEnergy, 0, sizeof(Float_t) * 4);
52 memset(fVX, 0, sizeof(Float_t)*2);
53 memset(fVY, 0, sizeof(Float_t)*2);
54 memset(fVZ, 0, sizeof(Float_t)*2);
55 memset(fVMC, 0, sizeof(Double_t)*3);
56 memset(fNContrib, 0, sizeof(Int_t) * 2);
57 fVertexResolution[1] = 999.;
58 fVertexResolution[0] = fVertexResolution[1];
59 fVertexDispersion[0] = 999.;
60 fVertexDispersion[1] = fVertexDispersion[0];
63 //_______________________________________
64 AliHFEreducedEvent::AliHFEreducedEvent(const AliHFEreducedEvent &ref):
68 fNtracks(ref.fNtracks),
69 fNmcparticles(ref.fNmcparticles),
70 fRunNumber(ref.fRunNumber),
71 fTrigger(ref.fTrigger),
72 fSPDMultiplicity(ref.fSPDMultiplicity),
73 fPileupFlag(ref.fPileupFlag)
78 fTracks = new TObjArray;
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))));
86 memcpy(fCentrality, ref.fCentrality, sizeof(Float_t) * kCentBuff);
87 memcpy(fV0Multiplicity, ref.fV0Multiplicity, sizeof(Float_t) * 2);
88 memcpy(fZDCEnergy, ref.fZDCEnergy, sizeof(Float_t) *4);
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);
92 memcpy(fVMC, ref.fVMC, sizeof(Double_t)*3);
93 memcpy(fVertexResolution, ref.fVertexResolution, sizeof(Float_t)*2);
94 memcpy(fVertexDispersion, ref.fVertexDispersion, sizeof(Float_t)*2);
95 memcpy(fNContrib, ref.fNContrib, sizeof(Int_t) * 2);
98 //_______________________________________
99 AliHFEreducedEvent &AliHFEreducedEvent::operator=(const AliHFEreducedEvent &ref){
101 // Assignment operator
104 TObject::operator=(ref);
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;
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);
120 memcpy(fVMC, ref.fVMC, sizeof(Double_t)*3);
121 memcpy(fNContrib, ref.fNContrib, sizeof(Int_t) * 2);
122 memcpy(fVertexResolution, ref.fVertexResolution, sizeof(Float_t)*2);
123 memcpy(fVertexDispersion, ref.fVertexDispersion, sizeof(Float_t)*2);
124 fSPDMultiplicity = ref.fSPDMultiplicity;
125 fPileupFlag = ref.fPileupFlag;
126 memcpy(fCentrality, ref.fCentrality, sizeof(Float_t) * kCentBuff);
127 memcpy(fV0Multiplicity, ref.fV0Multiplicity, sizeof(Float_t) * 2);
128 memcpy(fZDCEnergy, ref.fZDCEnergy, sizeof(Float_t) *4);
133 //_______________________________________
134 AliHFEreducedEvent::~AliHFEreducedEvent(){
136 // Destructor: Clear tracks an MC particles
142 //_______________________________________
143 void AliHFEreducedEvent::AddTrack(const AliHFEreducedTrack *track){
145 // Add track to the event
147 fTracks->Add(new AliHFEreducedTrack(*track));
151 //_______________________________________
152 const AliHFEreducedTrack *AliHFEreducedEvent::GetTrack(Int_t itrk) const {
156 if(itrk < 0 || itrk >= fNtracks) return NULL;
157 return dynamic_cast<const AliHFEreducedTrack *>(fTracks->At(itrk));
160 //_______________________________________
161 void AliHFEreducedEvent::AddMCParticle(const AliHFEreducedMCParticle *track){
163 // Add MC particle to the Event
165 fMCparticles->Add(new AliHFEreducedMCParticle(*track));
169 //_______________________________________
170 const AliHFEreducedMCParticle *AliHFEreducedEvent::GetMCParticle(Int_t itrk) const {
174 if(itrk < 0 || itrk >= fNmcparticles) return NULL;
175 return dynamic_cast<const AliHFEreducedMCParticle *>(fMCparticles->At(itrk));