1 /*************************************************************************
2 * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 #define AliFlowAnalysisWithScalarProduct_cxx
18 #include "Riostream.h" //needed as include
19 #include "TFile.h" //needed as include
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"
36 // AliFlowAnalysisWithScalarProduct:
38 // Maker to analyze Flow with the Scalar product method.
40 // author: N. van der Kolk (kolk@nikhef.nl)
42 ClassImp(AliFlowAnalysisWithScalarProduct)
44 //-----------------------------------------------------------------------
46 AliFlowAnalysisWithScalarProduct::AliFlowAnalysisWithScalarProduct():
57 fQ = new AliFlowVector;
58 fHistList = new TList();
59 // fQ.Set(0.,0.); // flow vector
60 // fU.Set(0.,0.); // particle unit vector
62 //-----------------------------------------------------------------------
65 AliFlowAnalysisWithScalarProduct::~AliFlowAnalysisWithScalarProduct()
75 //-----------------------------------------------------------------------
76 void AliFlowAnalysisWithScalarProduct::Init() {
78 //Define all histograms
79 cout<<"---Analysis with the Scalar Product Method--- Init"<<endl;
81 Int_t fNbinsPt = AliFlowCommonConstants::GetNbinsPt();
82 Double_t fPtMin = AliFlowCommonConstants::GetPtMin();
83 Double_t fPtMax = AliFlowCommonConstants::GetPtMax();
85 // analysis file (output)
87 fHistProUQ = new TProfile("Flow_UQ_SP","Flow_UQ_SP",fNbinsPt,fPtMin,fPtMax);
88 fHistProUQ->SetXTitle("p_t (GeV)");
89 fHistProUQ->SetYTitle("<uQ>");
90 fHistList->Add(fHistProUQ);
92 fCommonHists = new AliFlowCommonHist("SP");
93 //fCommonHistsRes = new AliFlowCommonHistResults("SP");
94 // fHistList->Add(fCommonHists);
96 fEventNumber = 0; //set number of events to zero
99 //-----------------------------------------------------------------------
101 void AliFlowAnalysisWithScalarProduct::Make(AliFlowEventSimple* anEvent) {
106 //fill control histograms
107 fCommonHists->FillControlHistograms(anEvent);
109 //get the Q vector from the FlowEvent
110 *fQ = anEvent->GetQ();
111 //Double_t fMult = fQ.GetMult();
113 //loop over the tracks of the event
114 AliFlowTrackSimple* fTrack = NULL;
115 Int_t fNumberOfTracks = anEvent->NumberOfTracks();
116 for (Int_t i=0;i<fNumberOfTracks;i++)
119 fTrack = anEvent->GetTrack(i) ;
121 if (fTrack->UseForDifferentialFlow()) {
122 Double_t fPhi = fTrack->Phi();
125 Double_t fUX = TMath::Cos(2*fPhi);
126 Double_t fUY = TMath::Sin(2*fPhi);
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
133 else cerr<<"fModulus is zero!"<<endl;
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;
143 //Double_t fUQ = scalar product of fU and fQm
144 // Double_t fUQ = fU*fQm;
145 Double_t fUQ = *fU * fQm;
146 Double_t fPt = fTrack->Pt();
147 //fill the profile histogram
148 fHistProUQ->Fill(fPt,fUQ);
154 cout<<"@@@@@ "<<fEventNumber<<" events processed"<<endl;
158 //--------------------------------------------------------------------
159 void AliFlowAnalysisWithScalarProduct::Finish() {
161 //*************make histograms etc.
162 if (fDebug) cout<<"AliFlowAnalysisWithScalarProduct::Terminate()"<<endl;
167 // fHistFile->Write();
169 cout<<".....finished"<<endl;