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
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"
35 // AliFlowAnalysisWithScalarProduct:
37 // Maker to analyze Flow with the Scalar product method.
39 // author: N. van der Kolk (kolk@nikhef.nl)
41 ClassImp(AliFlowAnalysisWithScalarProduct)
43 //-----------------------------------------------------------------------
45 AliFlowAnalysisWithScalarProduct::AliFlowAnalysisWithScalarProduct():
56 fQ.Set(0.,0.); // flow vector
57 fU.Set(0.,0.); // particle unit vector
60 //-----------------------------------------------------------------------
63 AliFlowAnalysisWithScalarProduct::~AliFlowAnalysisWithScalarProduct()
70 //-----------------------------------------------------------------------
71 void AliFlowAnalysisWithScalarProduct::Init() {
73 //Define all histograms
74 cout<<"---Analysis with the Scalar Product Method---"<<endl;
76 Int_t fNbinsPt = AliFlowCommonConstants::GetNbinsPt();
77 Double_t fPtMin = AliFlowCommonConstants::GetPtMin();
78 Double_t fPtMax = AliFlowCommonConstants::GetPtMax();
80 // analysis file (output)
81 fHistFile = new TFile(fHistFileName.Data(),"RECREATE") ;
83 fHistProUQ = new TProfile("Flow_UQ_SP","Flow_UQ_SP",fNbinsPt,fPtMin,fPtMax);
84 fHistProUQ->SetXTitle("p_t (GeV)");
85 fHistProUQ->SetYTitle("<uQ>");
87 fCommonHists = new AliFlowCommonHist("SP");
88 //fCommonHistsRes = new AliFlowCommonHistResults("SP");
90 fEventNumber = 0; //set number of events to zero
94 //-----------------------------------------------------------------------
96 void AliFlowAnalysisWithScalarProduct::Make(AliFlowEventSimple* anEvent) {
101 //fill control histograms
102 fCommonHists->FillControlHistograms(anEvent);
104 //get the Q vector from the FlowEvent
105 fQ = anEvent->GetQ();
106 //Double_t fMult = fQ.GetMult();
108 //loop over the tracks of the event
109 Int_t fNumberOfTracks = anEvent->NumberOfTracks();
110 for (Int_t i=0;i<fNumberOfTracks;i++)
113 fTrack = anEvent->GetTrack(i) ;
115 if (fTrack->UseForDifferentialFlow()) {
116 Double_t fPhi = fTrack->Phi();
119 Double_t fUX = TMath::Cos(2*fPhi);
120 Double_t fUY = TMath::Sin(2*fPhi);
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;
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;
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);
144 cout<<"@@@@@ "<<fEventNumber<<" events processed"<<endl;
148 //--------------------------------------------------------------------
149 void AliFlowAnalysisWithScalarProduct::Finish() {
151 //*************make histograms etc.
152 if (fDebug) cout<<"AliFlowAnalysisWithScalarProduct::Terminate()"<<endl;
159 cout<<".....finished"<<endl;