8d312f00 |
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 | #define AliFlowAnalysisWithScalarProduct_cxx |
17 | |
18 | #include "Riostream.h" //needed as include |
19 | #include "TFile.h" //needed as include |
d7eb18ec |
20 | #include "TList.h" |
8d312f00 |
21 | #include "TMath.h" |
22 | #include "TProfile.h" |
23 | #include "TVector2.h" |
24 | |
25 | class TH1F; |
26 | |
27 | #include "AliFlowCommonConstants.h" //needed as include |
28 | #include "AliFlowEventSimple.h" |
29 | #include "AliFlowTrackSimple.h" |
30 | #include "AliFlowCommonHist.h" |
31 | //#include "AliFlowCommonHistResults.h" |
32 | #include "AliFlowAnalysisWithScalarProduct.h" |
33 | |
34 | class AliFlowVector; |
35 | |
36 | // AliFlowAnalysisWithScalarProduct: |
37 | // Description: |
38 | // Maker to analyze Flow with the Scalar product method. |
39 | // |
40 | // author: N. van der Kolk (kolk@nikhef.nl) |
41 | |
42 | ClassImp(AliFlowAnalysisWithScalarProduct) |
43 | |
44 | //----------------------------------------------------------------------- |
45 | |
46 | AliFlowAnalysisWithScalarProduct::AliFlowAnalysisWithScalarProduct(): |
0092f3c2 |
47 | fQ(NULL), |
48 | fU(NULL), |
49 | fEventNumber(0), |
0092f3c2 |
50 | fDebug(kFALSE), |
d7eb18ec |
51 | fHistList(NULL), |
0092f3c2 |
52 | fHistProUQ(NULL), |
53 | fCommonHists(NULL) |
8d312f00 |
54 | { |
8d312f00 |
55 | // Constructor. |
0092f3c2 |
56 | fU = new TVector2; |
57 | fQ = new AliFlowVector; |
d7eb18ec |
58 | fHistList = new TList(); |
0092f3c2 |
59 | // fQ.Set(0.,0.); // flow vector |
60 | // fU.Set(0.,0.); // particle unit vector |
8d312f00 |
61 | } |
62 | //----------------------------------------------------------------------- |
63 | |
64 | |
65 | AliFlowAnalysisWithScalarProduct::~AliFlowAnalysisWithScalarProduct() |
66 | { |
0092f3c2 |
67 | delete fU; |
68 | delete fQ; |
d7eb18ec |
69 | delete fHistList; |
8d312f00 |
70 | //destructor |
71 | |
72 | } |
73 | |
74 | |
75 | //----------------------------------------------------------------------- |
76 | void AliFlowAnalysisWithScalarProduct::Init() { |
77 | |
78 | //Define all histograms |
d7eb18ec |
79 | cout<<"---Analysis with the Scalar Product Method--- Init"<<endl; |
8d312f00 |
80 | |
81 | Int_t fNbinsPt = AliFlowCommonConstants::GetNbinsPt(); |
82 | Double_t fPtMin = AliFlowCommonConstants::GetPtMin(); |
83 | Double_t fPtMax = AliFlowCommonConstants::GetPtMax(); |
84 | |
85 | // analysis file (output) |
8d312f00 |
86 | |
87 | fHistProUQ = new TProfile("Flow_UQ_SP","Flow_UQ_SP",fNbinsPt,fPtMin,fPtMax); |
88 | fHistProUQ->SetXTitle("p_t (GeV)"); |
89 | fHistProUQ->SetYTitle("<uQ>"); |
d7eb18ec |
90 | fHistList->Add(fHistProUQ); |
8d312f00 |
91 | |
92 | fCommonHists = new AliFlowCommonHist("SP"); |
93 | //fCommonHistsRes = new AliFlowCommonHistResults("SP"); |
d7eb18ec |
94 | fHistList->Add(fCommonHists); |
95 | |
e2d51347 |
96 | fEventNumber = 0; //set number of events to zero |
97 | } |
98 | |
8d312f00 |
99 | //----------------------------------------------------------------------- |
100 | |
8232a5ec |
101 | void AliFlowAnalysisWithScalarProduct::Make(AliFlowEventSimple* anEvent) { |
8d312f00 |
102 | |
103 | //Fill histogram |
8232a5ec |
104 | if (anEvent) { |
8d312f00 |
105 | |
106 | //fill control histograms |
8232a5ec |
107 | fCommonHists->FillControlHistograms(anEvent); |
8d312f00 |
108 | |
109 | //get the Q vector from the FlowEvent |
0092f3c2 |
110 | *fQ = anEvent->GetQ(); |
8d312f00 |
111 | //Double_t fMult = fQ.GetMult(); |
112 | |
113 | //loop over the tracks of the event |
d7eb18ec |
114 | AliFlowTrackSimple* fTrack = NULL; |
8232a5ec |
115 | Int_t fNumberOfTracks = anEvent->NumberOfTracks(); |
8d312f00 |
116 | for (Int_t i=0;i<fNumberOfTracks;i++) |
117 | { |
118 | |
8232a5ec |
119 | fTrack = anEvent->GetTrack(i) ; |
8d312f00 |
120 | if (fTrack){ |
121 | if (fTrack->UseForDifferentialFlow()) { |
122 | Double_t fPhi = fTrack->Phi(); |
123 | |
124 | //calculate fU |
125 | Double_t fUX = TMath::Cos(2*fPhi); |
126 | Double_t fUY = TMath::Sin(2*fPhi); |
0092f3c2 |
127 | // fU.Set(fUX,fUY); |
128 | fU->Set(fUX,fUY); |
129 | // Double_t fModulus = fU.Mod(); |
130 | Double_t fModulus = fU->Mod(); |
131 | // if (fModulus!=0.) fU.Set(fUX/fModulus,fUY/fModulus); // make length 1 |
132 | if (fModulus!=0.) fU->Set(fUX/fModulus,fUY/fModulus); // make length 1 |
8d312f00 |
133 | else cerr<<"fModulus is zero!"<<endl; |
134 | |
0092f3c2 |
135 | TVector2 fQm = *fQ; |
8d312f00 |
136 | //subtrackt particle from the flowvector if used to define it |
137 | if (fTrack->UseForIntegratedFlow()) { |
138 | Double_t fQmX = fQm.X() - fUX; |
139 | Double_t fQmY = fQm.Y() - fUY; |
140 | fQm.Set(fQmX,fQmY); |
141 | } |
142 | |
143 | //Double_t fUQ = scalar product of fU and fQm |
0092f3c2 |
144 | // Double_t fUQ = fU*fQm; |
145 | Double_t fUQ = *fU * fQm; |
8d312f00 |
146 | Double_t fPt = fTrack->Pt(); |
147 | //fill the profile histogram |
148 | fHistProUQ->Fill(fPt,fUQ); |
149 | } |
150 | }//track selected |
151 | }//loop over tracks |
d7eb18ec |
152 | |
8d312f00 |
153 | fEventNumber++; |
154 | cout<<"@@@@@ "<<fEventNumber<<" events processed"<<endl; |
155 | } |
156 | } |
157 | |
158 | //-------------------------------------------------------------------- |
159 | void AliFlowAnalysisWithScalarProduct::Finish() { |
160 | |
161 | //*************make histograms etc. |
162 | if (fDebug) cout<<"AliFlowAnalysisWithScalarProduct::Terminate()"<<endl; |
163 | |
164 | fHistProUQ->Draw(); |
165 | |
166 | // write to file |
d7eb18ec |
167 | // fHistFile->Write(); |
8d312f00 |
168 | |
169 | cout<<".....finished"<<endl; |
170 | } |
8232a5ec |
171 | |
172 | |