]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/AliAODevent.cxx
Another round of effc++ changes
[u/mrichter/AliRoot.git] / ANALYSIS / AliAODevent.cxx
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 //-------------------------------------------------------------------------
17 //     Implementation of the Analysis Oriented Data (AOD) event summary
18 //     Purpose : container of event important information for soft analysis
19 //     Author : Renaud Vernet, IPHC, Strasbourg
20 //-------------------------------------------------------------------------
21
22 #include "AliAODevent.h"
23 #include "AliESDVertex.h"
24 #include "AliESD.h"
25 #include "AliAODv0.h"
26 #include "AliAODxi.h"
27
28 ClassImp(AliAODevent)
29
30 AliAODevent::AliAODevent() {
31   fV0s      = new TClonesArray("AliAODv0");
32   fCascades = new TClonesArray("AliAODxi");
33 }
34
35 AliAODevent::~AliAODevent() {
36   delete fV0s;
37 }
38
39 AliAODevent::AliAODevent(AliESD* e) {
40   fV0s      = new TClonesArray("AliAODv0");
41   fCascades = new TClonesArray("AliAODxi");
42   fRunNumber        = (UInt_t)e->GetRunNumber();
43   fEventNumber      = (UInt_t)e->GetEventNumber();
44   fNumberOfTracks   = (UInt_t)e->GetNumberOfTracks();
45
46   const AliESDVertex* V = e->GetVertex();
47   fPrimVertexX = V->GetXv();
48   fPrimVertexY = V->GetYv();
49   fPrimVertexZ = V->GetZv();
50
51   for (Int_t i=0; i<e->GetNumberOfV0s(); i++) {
52     AliAODv0* v=new AliAODv0(e->GetV0(i),e);
53     this->AddV0(v);
54     delete v;
55   }
56   
57   for (Int_t i=0; i<e->GetNumberOfCascades(); i++) {
58     AliAODxi* c=new AliAODxi(e->GetCascade(i),e);
59     this->AddCascade(c);
60     delete c;
61   }
62 }
63
64 AliAODevent::AliAODevent(const AliAODevent& aod) :
65   TObject(aod),
66   fV0s((TClonesArray*)aod.fV0s->Clone()),
67   fCascades((TClonesArray*)aod.fCascades->Clone()),
68   fPrimVertexX(aod.fPrimVertexX),
69   fPrimVertexY(aod.fPrimVertexY),
70   fPrimVertexZ(aod.fPrimVertexZ),
71   fRunNumber(aod.fRunNumber),
72   fEventNumber(aod.fEventNumber),
73   fNumberOfTracks(aod.fNumberOfTracks)
74 {
75   //copy constructor
76 }
77
78
79 AliAODevent& AliAODevent::operator=(const AliAODevent& aod){
80   // assignment operator
81   if(this!=&aod) {
82     fPrimVertexX    = aod.fPrimVertexX;
83     fPrimVertexY    = aod.fPrimVertexY;
84     fPrimVertexZ    = aod.fPrimVertexZ;
85     fRunNumber      = aod.fRunNumber;
86     fEventNumber    = aod.fEventNumber;
87     fNumberOfTracks = aod.fNumberOfTracks;
88
89     delete fV0s;
90     delete fCascades;
91     fV0s=(TClonesArray*)aod.fV0s->Clone();
92     fCascades=(TClonesArray*)aod.fCascades->Clone();
93   } 
94   return *this;
95 }
96
97
98 void AliAODevent::AddV0(AliAODv0* v0) {
99   Int_t idx=fV0s->GetEntries();
100   TClonesArray& arr=*fV0s;
101   new(arr[idx]) AliAODv0(*v0);
102 }
103
104 void AliAODevent::AddCascade(AliAODxi* xi) {
105   Int_t idx=fCascades->GetEntries();
106   TClonesArray& arr=*fCascades;
107   new(arr[idx]) AliAODxi(*xi);
108 }