]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowAnalysisWithScalarProduct.cxx
some protection
[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
88e00a8a 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
25class 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
34class 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
42ClassImp(AliFlowAnalysisWithScalarProduct)
43
44 //-----------------------------------------------------------------------
45
46 AliFlowAnalysisWithScalarProduct::AliFlowAnalysisWithScalarProduct():
e35ddff0 47 fEventNumber(0),
48 fDebug(kFALSE),
49 fHistList(NULL),
50 fHistProUQ(NULL),
51 fCommonHists(NULL)
8d312f00 52{
8d312f00 53 // Constructor.
e35ddff0 54 fHistList = new TList();
8d312f00 55}
56 //-----------------------------------------------------------------------
57
58
59 AliFlowAnalysisWithScalarProduct::~AliFlowAnalysisWithScalarProduct()
60 {
61 //destructor
e35ddff0 62 delete fHistList;
8d312f00 63 }
64
65
66//-----------------------------------------------------------------------
67void AliFlowAnalysisWithScalarProduct::Init() {
68
69 //Define all histograms
d7eb18ec 70 cout<<"---Analysis with the Scalar Product Method--- Init"<<endl;
8d312f00 71
e35ddff0 72 Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt();
73 Double_t dPtMin = AliFlowCommonConstants::GetPtMin();
74 Double_t dPtMax = AliFlowCommonConstants::GetPtMax();
8d312f00 75
e35ddff0 76 fHistProUQ = new TProfile("Flow_UQ_SP","Flow_UQ_SP",iNbinsPt,dPtMin,dPtMax);
8d312f00 77 fHistProUQ->SetXTitle("p_t (GeV)");
78 fHistProUQ->SetYTitle("<uQ>");
d7eb18ec 79 fHistList->Add(fHistProUQ);
8d312f00 80
81 fCommonHists = new AliFlowCommonHist("SP");
20c03187 82 // fHistList->Add(fCommonHists->GetHistList());
83
099e1753 84 fHistList->Add(fCommonHists);
20c03187 85 // commented for test writing full object
88e00a8a 86 fHistList->Add(fCommonHists->GetHistMultOrig());
87 fHistList->Add(fCommonHists->GetHistMultInt());
88 fHistList->Add(fCommonHists->GetHistMultDiff());
89 fHistList->Add(fCommonHists->GetHistPtInt());
90 fHistList->Add(fCommonHists->GetHistPtDiff());
91 fHistList->Add(fCommonHists->GetHistPhiInt());
92 fHistList->Add(fCommonHists->GetHistPhiDiff());
93 fHistList->Add(fCommonHists->GetHistEtaInt());
94 fHistList->Add(fCommonHists->GetHistEtaDiff());
95 fHistList->Add(fCommonHists->GetHistProMeanPtperBin());
96 fHistList->Add(fCommonHists->GetHistQ());
20c03187 97 // end test
98
8d312f00 99 //fCommonHistsRes = new AliFlowCommonHistResults("SP");
e35ddff0 100
e2d51347 101 fEventNumber = 0; //set number of events to zero
102}
103
8d312f00 104//-----------------------------------------------------------------------
105
8232a5ec 106void AliFlowAnalysisWithScalarProduct::Make(AliFlowEventSimple* anEvent) {
8d312f00 107
108 //Fill histogram
8232a5ec 109 if (anEvent) {
8d312f00 110
111 //fill control histograms
8232a5ec 112 fCommonHists->FillControlHistograms(anEvent);
8d312f00 113
114 //get the Q vector from the FlowEvent
e35ddff0 115 AliFlowVector vQ = anEvent->GetQ();
116
8d312f00 117 //loop over the tracks of the event
e35ddff0 118 AliFlowTrackSimple* pTrack = NULL;
119 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
120 for (Int_t i=0;i<iNumberOfTracks;i++)
8d312f00 121 {
e35ddff0 122 pTrack = anEvent->GetTrack(i) ;
123 if (pTrack){
124 if (pTrack->UseForDifferentialFlow()) {
125 Double_t dPhi = pTrack->Phi();
126
127 //calculate vU
128 TVector2 vU;
129 Double_t dUX = TMath::Cos(2*dPhi);
130 Double_t dUY = TMath::Sin(2*dPhi);
131 vU.Set(dUX,dUY);
132 Double_t dModulus = vU.Mod();
133 if (dModulus!=0.) vU.Set(dUX/dModulus,dUY/dModulus); // make length 1
134 else cerr<<"dModulus is zero!"<<endl;
135
136 TVector2 vQm = vQ;
8d312f00 137 //subtrackt particle from the flowvector if used to define it
e35ddff0 138 if (pTrack->UseForIntegratedFlow()) {
139 Double_t dQmX = vQm.X() - dUX;
140 Double_t dQmY = vQm.Y() - dUY;
141 vQm.Set(dQmX,dQmY);
8d312f00 142 }
143
e35ddff0 144 //dUQ = scalar product of vU and vQm
145 Double_t dUQ = vU * vQm;
146 Double_t dPt = pTrack->Pt();
8d312f00 147 //fill the profile histogram
e35ddff0 148 fHistProUQ->Fill(dPt,dUQ);
8d312f00 149 }
150 }//track selected
151 }//loop over tracks
d7eb18ec 152
8d312f00 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();
e35ddff0 165
8d312f00 166 cout<<".....finished"<<endl;
167 }
8232a5ec 168
169