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[0] = fVertexResolution[1] = 999.;
58 fVertexDispersion[0] = fVertexDispersion[0] = 999.;
61 //_______________________________________
62 AliHFEreducedEvent::AliHFEreducedEvent(const AliHFEreducedEvent &ref):
66 fNtracks(ref.fNtracks),
67 fNmcparticles(ref.fNmcparticles),
68 fRunNumber(ref.fRunNumber),
69 fTrigger(ref.fTrigger),
70 fSPDMultiplicity(ref.fSPDMultiplicity),
71 fPileupFlag(ref.fPileupFlag)
76 fTracks = new TObjArray;
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))));
84 memcpy(fCentrality, ref.fCentrality, sizeof(Float_t) * kCentBuff);
85 memcpy(fV0Multiplicity, ref.fV0Multiplicity, sizeof(Float_t) * 2);
86 memcpy(fZDCEnergy, ref.fZDCEnergy, sizeof(Float_t) *4);
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);
90 memcpy(fVMC, ref.fVMC, sizeof(Double_t)*3);
91 memcpy(fVertexResolution, ref.fVertexResolution, sizeof(Float_t)*2);
92 memcpy(fVertexDispersion, ref.fVertexDispersion, sizeof(Float_t)*2);
93 memcpy(fNContrib, ref.fNContrib, sizeof(Int_t) * 2);
96 //_______________________________________
97 AliHFEreducedEvent &AliHFEreducedEvent::operator=(const AliHFEreducedEvent &ref){
99 // Assignment operator
102 TObject::operator=(ref);
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;
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);
118 memcpy(fVMC, ref.fVMC, sizeof(Double_t)*3);
119 memcpy(fNContrib, ref.fNContrib, sizeof(Int_t) * 2);
120 memcpy(fVertexResolution, ref.fVertexResolution, sizeof(Float_t)*2);
121 memcpy(fVertexDispersion, ref.fVertexDispersion, sizeof(Float_t)*2);
122 fSPDMultiplicity = ref.fSPDMultiplicity;
123 fPileupFlag = ref.fPileupFlag;
124 memcpy(fCentrality, ref.fCentrality, sizeof(Float_t) * kCentBuff);
125 memcpy(fV0Multiplicity, ref.fV0Multiplicity, sizeof(Float_t) * 2);
126 memcpy(fZDCEnergy, ref.fZDCEnergy, sizeof(Float_t) *4);
131 //_______________________________________
132 AliHFEreducedEvent::~AliHFEreducedEvent(){
134 // Destructor: Clear tracks an MC particles
140 //_______________________________________
141 void AliHFEreducedEvent::AddTrack(const AliHFEreducedTrack *track){
143 // Add track to the event
145 fTracks->Add(new AliHFEreducedTrack(*track));
149 //_______________________________________
150 const AliHFEreducedTrack *AliHFEreducedEvent::GetTrack(Int_t itrk) const {
154 if(itrk < 0 || itrk >= fNtracks) return NULL;
155 return dynamic_cast<const AliHFEreducedTrack *>(fTracks->At(itrk));
158 //_______________________________________
159 void AliHFEreducedEvent::AddMCParticle(const AliHFEreducedMCParticle *track){
161 // Add MC particle to the Event
163 fMCparticles->Add(new AliHFEreducedMCParticle(*track));
167 //_______________________________________
168 const AliHFEreducedMCParticle *AliHFEreducedEvent::GetMCParticle(Int_t itrk) const {
172 if(itrk < 0 || itrk >= fNmcparticles) return NULL;
173 return dynamic_cast<const AliHFEreducedMCParticle *>(fMCparticles->At(itrk));