]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowAnalysisWithScalarProduct.cxx
Inherit from TOject for persistency
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowAnalysisWithScalarProduct.cxx
CommitLineData
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
20#include "TMath.h"
21#include "TProfile.h"
22#include "TVector2.h"
23
24class TH1F;
25
26#include "AliFlowCommonConstants.h" //needed as include
27#include "AliFlowEventSimple.h"
28#include "AliFlowTrackSimple.h"
29#include "AliFlowCommonHist.h"
30//#include "AliFlowCommonHistResults.h"
31#include "AliFlowAnalysisWithScalarProduct.h"
32
33class AliFlowVector;
34
35// AliFlowAnalysisWithScalarProduct:
36// Description:
37// Maker to analyze Flow with the Scalar product method.
38//
39// author: N. van der Kolk (kolk@nikhef.nl)
40
41ClassImp(AliFlowAnalysisWithScalarProduct)
42
43 //-----------------------------------------------------------------------
44
45 AliFlowAnalysisWithScalarProduct::AliFlowAnalysisWithScalarProduct():
0092f3c2 46 fQ(NULL),
47 fU(NULL),
48 fEventNumber(0),
49 fTrack(NULL),
50 fDebug(kFALSE),
51 fHistFileName(0),
52 fHistFile(NULL),
53 fHistProUQ(NULL),
54 fCommonHists(NULL)
8d312f00 55{
56
57 // Constructor.
0092f3c2 58 fU = new TVector2;
59 fQ = new AliFlowVector;
60 // fQ.Set(0.,0.); // flow vector
61 // fU.Set(0.,0.); // particle unit vector
8d312f00 62
63}
64 //-----------------------------------------------------------------------
65
66
67 AliFlowAnalysisWithScalarProduct::~AliFlowAnalysisWithScalarProduct()
68 {
0092f3c2 69 delete fU;
70 delete fQ;
8d312f00 71 //destructor
72
73 }
74
75
76//-----------------------------------------------------------------------
77void AliFlowAnalysisWithScalarProduct::Init() {
78
79 //Define all histograms
80 cout<<"---Analysis with the Scalar Product Method---"<<endl;
81
82 Int_t fNbinsPt = AliFlowCommonConstants::GetNbinsPt();
83 Double_t fPtMin = AliFlowCommonConstants::GetPtMin();
84 Double_t fPtMax = AliFlowCommonConstants::GetPtMax();
85
86 // analysis file (output)
87 fHistFile = new TFile(fHistFileName.Data(),"RECREATE") ;
88
89 fHistProUQ = new TProfile("Flow_UQ_SP","Flow_UQ_SP",fNbinsPt,fPtMin,fPtMax);
90 fHistProUQ->SetXTitle("p_t (GeV)");
91 fHistProUQ->SetYTitle("<uQ>");
92
93 fCommonHists = new AliFlowCommonHist("SP");
94 //fCommonHistsRes = new AliFlowCommonHistResults("SP");
95
96 fEventNumber = 0; //set number of events to zero
97
98}
99
100//-----------------------------------------------------------------------
101
8232a5ec 102void AliFlowAnalysisWithScalarProduct::Make(AliFlowEventSimple* anEvent) {
8d312f00 103
104 //Fill histogram
8232a5ec 105 if (anEvent) {
8d312f00 106
107 //fill control histograms
8232a5ec 108 fCommonHists->FillControlHistograms(anEvent);
8d312f00 109
110 //get the Q vector from the FlowEvent
0092f3c2 111 *fQ = anEvent->GetQ();
8d312f00 112 //Double_t fMult = fQ.GetMult();
113
114 //loop over the tracks of the event
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
152
153 fEventNumber++;
154 cout<<"@@@@@ "<<fEventNumber<<" events processed"<<endl;
155 }
156}
157
158 //--------------------------------------------------------------------
159void AliFlowAnalysisWithScalarProduct::Finish() {
160
161 //*************make histograms etc.
162 if (fDebug) cout<<"AliFlowAnalysisWithScalarProduct::Terminate()"<<endl;
163
164 fHistProUQ->Draw();
165
166 // write to file
167 fHistFile->Write();
168
169 cout<<".....finished"<<endl;
170 }
8232a5ec 171
172