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():
42 // Default constructor
44 fTracks = new TObjArray;
46 fMCparticles = new TObjArray;
47 fMCparticles->SetOwner();
48 memset(fCentrality, 0, sizeof(Float_t) * kCentBuff);
49 memset(fV0Multiplicity, 0, sizeof(Float_t) * 2);
50 memset(fZDCEnergy, 0, sizeof(Float_t) * 4);
51 memset(fVX, 0, sizeof(Float_t)*2);
52 memset(fVY, 0, sizeof(Float_t)*2);
53 memset(fVZ, 0, sizeof(Float_t)*2);
54 memset(fNContrib, 0, sizeof(Int_t) * 2);
55 memset(fVertexResolution, 0, sizeof(Float_t)*2);
58 //_______________________________________
59 AliHFEreducedEvent::AliHFEreducedEvent(const AliHFEreducedEvent &ref):
63 fNtracks(ref.fNtracks),
64 fNmcparticles(ref.fNmcparticles),
65 fRunNumber(ref.fRunNumber),
66 fTrigger(ref.fTrigger),
67 fSPDMultiplicity(ref.fSPDMultiplicity)
72 fTracks = new TObjArray;
74 for(int itrk = 0; itrk < ref.GetNumberOfTracks(); itrk++)
75 fTracks->Add(new AliHFEreducedTrack(*(ref.GetTrack(itrk))));
76 fMCparticles = new TObjArray;
77 fMCparticles->SetOwner();
78 for(int iprt = 0; iprt < ref.GetNumberOfMCParticles(); iprt++)
79 fMCparticles->Add(new AliHFEreducedMCParticle(*(ref.GetMCParticle(iprt))));
80 memcpy(fCentrality, ref.fCentrality, sizeof(Float_t) * kCentBuff);
81 memcpy(fV0Multiplicity, ref.fV0Multiplicity, sizeof(Float_t) * 2);
82 memcpy(fZDCEnergy, ref.fZDCEnergy, sizeof(Float_t) *4);
83 memcpy(fVX, ref.fVX, sizeof(Float_t)*2);
84 memcpy(fVY, ref.fVY, sizeof(Float_t)*2);
85 memcpy(fVZ, ref.fVZ, sizeof(Float_t)*2);
86 memcpy(fVertexResolution, ref.fVertexResolution, sizeof(Float_t)*2);
87 memcpy(fNContrib, ref.fNContrib, sizeof(Int_t) * 2);
90 //_______________________________________
91 AliHFEreducedEvent &AliHFEreducedEvent::operator=(const AliHFEreducedEvent &ref){
93 // Assignment operator
96 TObject::operator=(ref);
99 for(int itrk = 0; itrk < ref.GetNumberOfTracks(); itrk++)
100 fTracks->Add(new AliHFEreducedTrack(*(ref.GetTrack(itrk))));
101 fMCparticles->Clear();
102 fMCparticles->SetOwner();
103 for(int iprt = 0; iprt < ref.GetNumberOfMCParticles(); iprt++)
104 fMCparticles->Add(new AliHFEreducedMCParticle(*(ref.GetMCParticle(iprt))));
105 fNtracks = ref.fNtracks;
106 fNmcparticles = ref.fNmcparticles;
107 fRunNumber = ref.fRunNumber;
108 fTrigger = ref.fTrigger;
109 memcpy(fVX, ref.fVX, sizeof(Float_t)*2);
110 memcpy(fVY, ref.fVY, sizeof(Float_t)*2);
111 memcpy(fVZ, ref.fVZ, sizeof(Float_t)*2);
112 memcpy(fNContrib, ref.fNContrib, sizeof(Int_t) * 2);
113 memcpy(fVertexResolution, ref.fVertexResolution, sizeof(Float_t)*2);
114 fSPDMultiplicity = ref.fSPDMultiplicity;
115 memcpy(fCentrality, ref.fCentrality, sizeof(Float_t) * kCentBuff);
116 memcpy(fV0Multiplicity, ref.fV0Multiplicity, sizeof(Float_t) * 2);
117 memcpy(fZDCEnergy, ref.fZDCEnergy, sizeof(Float_t) *4);
122 //_______________________________________
123 AliHFEreducedEvent::~AliHFEreducedEvent(){
125 // Destructor: Clear tracks an MC particles
131 //_______________________________________
132 void AliHFEreducedEvent::AddTrack(const AliHFEreducedTrack *track){
134 // Add track to the event
136 fTracks->Add(new AliHFEreducedTrack(*track));
140 //_______________________________________
141 const AliHFEreducedTrack *AliHFEreducedEvent::GetTrack(Int_t itrk) const {
145 if(itrk < 0 || itrk >= fNtracks) return NULL;
146 return dynamic_cast<const AliHFEreducedTrack *>(fTracks->At(itrk));
149 //_______________________________________
150 void AliHFEreducedEvent::AddMCParticle(const AliHFEreducedMCParticle *track){
152 // Add MC particle to the Event
154 fMCparticles->Add(new AliHFEreducedMCParticle(*track));
158 //_______________________________________
159 const AliHFEreducedMCParticle *AliHFEreducedEvent::GetMCParticle(Int_t itrk) const {
163 if(itrk < 0 || itrk >= fNmcparticles) return NULL;
164 return dynamic_cast<const AliHFEreducedMCParticle *>(fMCparticles->At(itrk));