]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/AliAODevent.cxx
Pass execution mode to event handler.
[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   // Constructor from an ESD.
41   fV0s      = new TClonesArray("AliAODv0");
42   fCascades = new TClonesArray("AliAODxi");
43   fRunNumber        = (UInt_t)e->GetRunNumber();
44   fEventNumber      = (UInt_t)e->GetEventNumberInFile(); // This is most likely NOT the event number you'd like to use. It has nothing to do with the 'real' event number.
45   fNumberOfTracks   = (UInt_t)e->GetNumberOfTracks();
46
47   const AliESDVertex* esdVertex = e->GetVertex();
48   fPrimVertexX = esdVertex->GetXv();
49   fPrimVertexY = esdVertex->GetYv();
50   fPrimVertexZ = esdVertex->GetZv();
51
52   for (Int_t i=0; i<e->GetNumberOfV0s(); i++) {
53     AliAODv0* v=new AliAODv0(e->GetV0(i),e);
54     this->AddV0(v);
55     delete v;
56   }
57   
58   for (Int_t i=0; i<e->GetNumberOfCascades(); i++) {
59     AliAODxi* c=new AliAODxi(e->GetCascade(i),e);
60     this->AddCascade(c);
61     delete c;
62   }
63 }
64
65 AliAODevent::AliAODevent(const AliAODevent& aod) :
66   TObject(aod),
67   fV0s((TClonesArray*)aod.fV0s->Clone()),
68   fCascades((TClonesArray*)aod.fCascades->Clone()),
69   fPrimVertexX(aod.fPrimVertexX),
70   fPrimVertexY(aod.fPrimVertexY),
71   fPrimVertexZ(aod.fPrimVertexZ),
72   fRunNumber(aod.fRunNumber),
73   fEventNumber(aod.fEventNumber),
74   fNumberOfTracks(aod.fNumberOfTracks)
75 {
76   // Copy constructor.
77 }
78
79
80 AliAODevent& AliAODevent::operator=(const AliAODevent& aod){
81   // Assignment operator
82   if(this!=&aod) {
83     fPrimVertexX    = aod.fPrimVertexX;
84     fPrimVertexY    = aod.fPrimVertexY;
85     fPrimVertexZ    = aod.fPrimVertexZ;
86     fRunNumber      = aod.fRunNumber;
87     fEventNumber    = aod.fEventNumber;
88     fNumberOfTracks = aod.fNumberOfTracks;
89
90     delete fV0s;
91     delete fCascades;
92     fV0s=(TClonesArray*)aod.fV0s->Clone();
93     fCascades=(TClonesArray*)aod.fCascades->Clone();
94   } 
95   return *this;
96 }
97
98
99 void AliAODevent::AddV0(AliAODv0* v0) {
100   // Adds a V0 in the list.
101   Int_t idx=fV0s->GetEntries();
102   TClonesArray& arr=*fV0s;
103   new(arr[idx]) AliAODv0(*v0);
104 }
105
106 void AliAODevent::AddCascade(AliAODxi* xi) {
107   // Adds a cascade in the list.
108   Int_t idx=fCascades->GetEntries();
109   TClonesArray& arr=*fCascades;
110   new(arr[idx]) AliAODxi(*xi);
111 }