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