Moving the classes that belong to the following libraries: STEERBase, ESD, CDB, AOD...
[u/mrichter/AliRoot.git] / STEER / STEERBase / AliEventplane.cxx
CommitLineData
ce7adfe9 1/**************************************************************************
2 * Copyright(c) 1998-2008, 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// Class AliEventplane
18// author: Alberica Toia, Johanna Gramling
19//*****************************************************
20/// A container for the event plane stored in AOD in ESD
21
22#include "AliEventplane.h"
23#include "TVector2.h"
aa260dd1 24#include "AliVTrack.h"
ce7adfe9 25#include "TObjArray.h"
26#include "TArrayF.h"
27
28ClassImp(AliEventplane)
29
30AliEventplane::AliEventplane() : TNamed("Eventplane", "Eventplane"),
31 fQVector(0),
32 fQContributionX(0),
33 fQContributionY(0),
3e64f60c 34 fEventplaneQ(-1),
ce7adfe9 35 fQsub1(0),
36 fQsub2(0),
37 fQsubRes(0)
38{
39 /// constructor
3e64f60c 40 fQContributionX = new TArrayF(0);
41 fQContributionY = new TArrayF(0);
ce7adfe9 42}
43
44AliEventplane::AliEventplane(const AliEventplane& ep) :
45 TNamed(),
46 fQVector(0),
47 fQContributionX(0),
48 fQContributionY(0),
49 fEventplaneQ(0),
50 fQsub1(0),
51 fQsub2(0),
52 fQsubRes(0)
53{
54 /// Copy constructor
55 ((AliEventplane &) ep).CopyEP(*this);
56}
57
58AliEventplane& AliEventplane::operator=(const AliEventplane& ep)
59{
60 /// Assignment operator
61 if (this!=&ep)
62 ((AliEventplane &) ep).CopyEP(*this);
63
64 return *this;
65}
66
67void AliEventplane::CopyEP(AliEventplane& ep) const
68{ // copy function
69
70 AliEventplane& target = (AliEventplane &) ep;
71 if (fQContributionX)
72 target.fQContributionX = fQContributionX;
73 if (fQContributionY)
74 target.fQContributionY = fQContributionY;
75 if (fEventplaneQ)
76 target.fEventplaneQ = fEventplaneQ;
77 if (fQVector)
78 target.fQVector = dynamic_cast<TVector2*> (fQVector->Clone());
79 if (fQsub1)
80 target.fQsub1 = dynamic_cast<TVector2*> (fQsub1->Clone());
81 if (fQsub2)
82 target.fQsub2 = dynamic_cast<TVector2*> (fQsub2->Clone());
83 if (fQsubRes)
84 target.fQsubRes = fQsubRes;
85}
86
87AliEventplane::~AliEventplane()
88{
89 /// destructor
90 if (fQContributionX){
91 delete fQContributionX;
92 fQContributionX = 0;
93 }
94 if (fQContributionY){
95 delete fQContributionY;
96 fQContributionY = 0;
97 }
98 if (fQVector){
99 delete fQVector;
100 fQVector = 0;
101 }
102 if (fQsub1){
103 delete fQsub1;
104 fQsub1 = 0;
105 }
106 if (fQsub2){
107 delete fQsub2;
108 fQsub2 = 0;
109 }
110}
111
112TVector2* AliEventplane::GetQVector()
113{
114 return fQVector;
115}
116
117Double_t AliEventplane::GetEventplane(const char *x)
118{
119 TString method = x;
120 if(method.CompareTo("Q")==0) return fEventplaneQ;
121 return -1;
122}
123
124TVector2* AliEventplane::GetQsub1()
125{
126 return fQsub1;
127}
128
129TVector2* AliEventplane::GetQsub2()
130{
131 return fQsub2;
132}
133
134Double_t AliEventplane::GetQsubRes()
135{
136 return fQsubRes;
137}
138
139Bool_t AliEventplane::IsEventInEventplaneClass(Double_t a, Double_t b, const char *x)
140{
141 TString method = x;
142 if ((method.CompareTo("Q")==0) && (fEventplaneQ >=a && fEventplaneQ < b)) return kTRUE;
143 else return kFALSE;
144}
145
aa260dd1 146Double_t AliEventplane::GetQContributionX(AliVTrack* track)
ce7adfe9 147{
148 return fQContributionX->GetAt(track->GetID());
149}
150
aa260dd1 151Double_t AliEventplane::GetQContributionY(AliVTrack* track)
ce7adfe9 152{
153 return fQContributionY->GetAt(track->GetID());
154}
3e64f60c 155
156void AliEventplane::Reset()
157{
158 delete fQVector; fQVector=0;
159 fQContributionX->Reset();
160 fQContributionY->Reset();
161 fEventplaneQ = -1;
162 delete fQsub1; fQsub1=0;
163 delete fQsub2; fQsub2=0;
164 fQsubRes = 0;
165}