]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowLYZEventPlane.cxx
new methods and possiility to run all methods in same run
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowLYZEventPlane.cxx
CommitLineData
f1d945a1 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 AliFlowAnalysisWithLYZEventPlane_cxx
ca88d423 17
18// AliFlowLYZEventPlane:
19//
20// Class to calculate the event plane and event weight from the LYZ method
21// It needs input from the standard LYZ first and second run
22// author: N. van der Kolk (kolk@nikhef.nl)
f1d945a1 23
24#include "Riostream.h"
25#include "TProfile.h"
26#include "TFile.h"
27#include "TComplex.h"
9d062fe3 28#include "TList.h"
f1d945a1 29
ca88d423 30#include "AliFlowVector.h"
f1d945a1 31#include "AliFlowLYZConstants.h"
32#include "AliFlowEventSimple.h"
33#include "AliFlowLYZEventPlane.h"
34
35class AliFlowTrackSimple;
36
f1d945a1 37ClassImp(AliFlowLYZEventPlane)
38
39 //-----------------------------------------------------------------------
40
41AliFlowLYZEventPlane::AliFlowLYZEventPlane():
9d062fe3 42 fSecondRunList(0),
f1d945a1 43 fWR(0),
44 fPsi(0),
45 fSecondReDtheta(0),
46 fSecondImDtheta(0),
47 fFirstr0theta(0)
48{
49 // Constructor.
ca88d423 50
f1d945a1 51}
52//-----------------------------------------------------------------------
53
54
55AliFlowLYZEventPlane::~AliFlowLYZEventPlane()
56{
57 //destructor
9d062fe3 58 delete fSecondRunList;
f1d945a1 59}
60
61
62//-----------------------------------------------------------------------
63void AliFlowLYZEventPlane::Init()
64{
65 //Declare histograms & get input files
66 cout<<"---Lee Yang Zeros Event Plane Method---"<<endl;
67
68 //input histograms
9d062fe3 69 if (fSecondRunList) {
70 fSecondReDtheta = (TProfile*)fSecondRunList->FindObject("Second_FlowPro_ReDtheta_LYZ");
71 fSecondImDtheta = (TProfile*)fSecondRunList->FindObject("Second_FlowPro_ImDtheta_LYZ");
72 fFirstr0theta = (TProfile*)fSecondRunList->FindObject("First_FlowPro_r0theta_LYZ");
73
74 //warnings
75 if (!fSecondReDtheta) {cout<<"fSecondReDtheta is NULL!"<<endl; }
76 if (!fSecondImDtheta) {cout<<"fSecondImDtheta is NULL!"<<endl; }
77 if (!fFirstr0theta) {cout<<"fFirstr0theta is NULL!"<<endl; }
f1d945a1 78 }
79
9d062fe3 80
f1d945a1 81}
82
f1d945a1 83//-----------------------------------------------------------------------
882ffd6a 84void AliFlowLYZEventPlane::CalculateRPandW(AliFlowVector aQ)
f1d945a1 85{
86 //declare variables
882ffd6a 87 Int_t iNtheta = AliFlowLYZConstants::kTheta;
88 Double_t dCosTerm = 0;
89 Double_t dSinTerm = 0;
90 TComplex cDtheta;
91 TComplex cRatio;
9d062fe3 92
93 if (aQ.Mod()==0.) { cout<<"Q vector is NULL"<<endl; }
94 else {
95 for (Int_t theta=0;theta<iNtheta;theta++) {
96 Double_t dTheta = ((float)theta/iNtheta)*TMath::Pi()/2;
97 //Calculate Qtheta
98 Double_t dQtheta = aQ.X()*cos(2*dTheta)+aQ.Y()*sin(2*dTheta); //get Qtheta from Q vector
f1d945a1 99
9d062fe3 100 //get R0
101 Double_t dR0 = fFirstr0theta->GetBinContent(theta+1);
102 //cerr<<"dR0 = "<<dR0<<endl;
103
104 //get Dtheta
105 Double_t dReDtheta = fSecondReDtheta->GetBinContent(theta+1);
106 //cerr<<"dReDtheta = "<<dReDtheta<<endl;
107 Double_t dImDtheta = fSecondImDtheta->GetBinContent(theta+1);
108 //cerr<<"dImDtheta = "<<dImDtheta<<endl;
109 cDtheta(dReDtheta,dImDtheta);
f1d945a1 110
9d062fe3 111 TComplex cExpo(0.,dR0*dQtheta); //Complex number: 0 +(i r0 Qtheta)
112 if (cDtheta.Rho()!=0.) { cRatio =(TComplex::Exp(cExpo))/cDtheta; } //(e^(i r0 Qtheta))/Dtheta
113 else { cRatio(0.,0.); }
f1d945a1 114
9d062fe3 115 //sum over theta
116 dCosTerm += cRatio.Re() * TMath::Cos(2*dTheta); //Re{(e^(i r0 Qtheta))/Dtheta } cos(2 theta)
117 dSinTerm += cRatio.Re() * TMath::Sin(2*dTheta); //Re{(e^(i r0 Qtheta))/Dtheta } sin(2 theta)
f1d945a1 118
9d062fe3 119 }//loop over theta
f1d945a1 120
9d062fe3 121 //average over theta
122 dCosTerm /= iNtheta;
123 dSinTerm /= iNtheta;
124 //cerr<<"cosTerm & sinTerm are: "<<dCosTerm<<" & "<<dSinTerm<<endl;
f1d945a1 125
9d062fe3 126 //calculate fWR
127 fWR = TMath::Sqrt(dCosTerm*dCosTerm + dSinTerm*dSinTerm);
f1d945a1 128
9d062fe3 129 //calculate fRP
130 fPsi = 0.5*TMath::ATan2(dSinTerm,dCosTerm); //takes care of the signs correctly!
131 if (fPsi < 0.) { fPsi += TMath::Pi(); } //to shift distribution from (-pi/2 to pi/2) to (0 to pi)
132 }
133
ca88d423 134}
f1d945a1 135