]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEventforRP.cxx
Fix XML list creation from tag cuts - reset list counter for each file tag
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowTasks / AliAnalysisTaskFlowEventforRP.cxx
CommitLineData
0692a009 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////////////////////////////////////////////////////
17// AliAnalysisTaskFlowEventforRP:
18//
19// analysis task for filling the flow event
20// from MCEvent, ESD
21// and put it in an output stream so the calculated
22// Reaction Plane can be stored in the AODHeader
23// when the AOD is made from the ESD
24// for cuts the correction framework is used
25// which also outputs QA histograms to view
26// the effects of the cuts
27////////////////////////////////////////////////////
28
29#include "Riostream.h" //needed as include
30#include "TChain.h"
31#include "TTree.h"
32#include "TFile.h" //needed as include
33#include "TList.h"
34#include "TRandom3.h"
35#include "TTimeStamp.h"
36
37// ALICE Analysis Framework
fbdb53fa 38#include "AliAnalysisTaskSE.h"
0692a009 39#include "AliAnalysisManager.h"
40
41// ESD interface
42#include "AliESDEvent.h"
43#include "AliESDInputHandler.h"
44
45// AOD interface
46#include "AliAODEvent.h"
47#include "AliAODInputHandler.h"
48
49// Monte Carlo Eventp
713d0676 50#include "AliAODHandler.h"
0692a009 51#include "AliMCEventHandler.h"
52#include "AliMCEvent.h"
53
54// ALICE Correction Framework
55#include "AliCFManager.h"
56
57// Interface to Event generators to get Reaction Plane Angle
58#include "AliGenCocktailEventHeader.h"
59#include "AliGenHijingEventHeader.h"
60#include "AliGenGeVSimEventHeader.h"
f6f8c3fc 61#include "AliGenEposEventHeader.h"
0692a009 62
63// Interface to make the Flow Event Simple used in the flow analysis methods
f6f8c3fc 64#include "AliFlowEvent.h"
0692a009 65#include "AliFlowVector.h"
713d0676 66#include "AliAnalysisTaskFlowEventforRP.h"
0692a009 67
0692a009 68
69ClassImp(AliAnalysisTaskFlowEventforRP)
70
71//________________________________________________________________________
713d0676 72AliAnalysisTaskFlowEventforRP::AliAnalysisTaskFlowEventforRP(const char *name) :
0692a009 73 AliAnalysisTaskSE(name),
0692a009 74 fAnalysisType("ESD"),
75 fCFManager1(NULL),
76 fCFManager2(NULL),
0692a009 77 fMinMult(0),
78 fMaxMult(10000000),
713d0676 79 fMCReactionPlaneAngle(0.)
f6f8c3fc 80
0692a009 81{
82 // Constructor
83 cout<<"AliAnalysisTaskFlowEventforRP::AliAnalysisTaskFlowEventforRP(const char *name)"<<endl;
84
85 // Define input and output slots here
86 // Input slot #0 works with a TChain
87 DefineInput(0, TChain::Class());
88 // Define here the flow event output
89 DefineOutput(0, AliFlowEventSimple::Class());
713d0676 90
0692a009 91}
92
93//________________________________________________________________________
94AliAnalysisTaskFlowEventforRP::AliAnalysisTaskFlowEventforRP() :
0692a009 95 fAnalysisType("ESD"),
96 fCFManager1(NULL),
97 fCFManager2(NULL),
0692a009 98 fMinMult(0),
99 fMaxMult(10000000),
713d0676 100 fMCReactionPlaneAngle(0.)
0692a009 101{
102 // Constructor
103 cout<<"AliAnalysisTaskFlowEventforRP::AliAnalysisTaskFlowEventforRP()"<<endl;
104}
105
0692a009 106
107//________________________________________________________________________
108AliAnalysisTaskFlowEventforRP::~AliAnalysisTaskFlowEventforRP()
109{
110 //
111 // Destructor
112 //
713d0676 113
0692a009 114}
115
116
117//________________________________________________________________________
118void AliAnalysisTaskFlowEventforRP::UserCreateOutputObjects()
119{
120 // Called at every worker node to initialize
121 cout<<"AliAnalysisTaskFlowEventforRP::UserCreateOutputObjects()"<<endl;
122
713d0676 123 if (!(fAnalysisType == "ESD")) {
124 cout<<"WRONG ANALYSIS TYPE! only ESD for this method."<<endl;
0692a009 125 exit(1);
126 }
f6f8c3fc 127
0692a009 128}
129
130//________________________________________________________________________
131void AliAnalysisTaskFlowEventforRP::UserExec(Option_t *)
132{
133 // Main loop
134
135 AliESDEvent* esd = dynamic_cast<AliESDEvent*>(InputEvent());
f6f8c3fc 136 AliFlowEvent* fEvent = NULL;
137 AliMCEvent* mcEvent = MCEvent();
0692a009 138 Double_t fRP = 0.; // the monte carlo reaction plane angle
713d0676 139
f6f8c3fc 140 // Fill the FlowEventSimple for ESD input
141 if (fAnalysisType == "ESD") {
142 if (!(fCFManager1&&fCFManager2))
143 {
144 cout << "ERROR: No pointer to correction framework cuts! " << endl;
145 return;
713d0676 146 }
f6f8c3fc 147 if (!esd)
148 {
149 AliError("ERROR: ESD not available");
150 return;
713d0676 151 }
f6f8c3fc 152
153 //check the offline trigger (check if the event has the correct trigger)
154 //AliInfo(Form("ESD has %d tracks", fInputEvent->GetNumberOfTracks()));
155
156 //check multiplicity
157 if (!fCFManager1->CheckEventCuts(AliCFManager::kEvtRecCuts,esd))
158 {
159 cout << "Event does not pass multiplicity cuts" << endl;
160 return;
713d0676 161 }
0692a009 162
f6f8c3fc 163 // make the flowevent
164 fEvent = new AliFlowEvent(esd,fCFManager1,fCFManager2);
0692a009 165
f6f8c3fc 166 if (mcEvent && mcEvent->GenEventHeader())
167 {
168 fEvent->SetMCReactionPlaneAngle(mcEvent);
169 fRP = fEvent->GetMCReactionPlaneAngle();
170 }
171
172 //check final event cuts
173 Int_t mult = fEvent->NumberOfTracks();
174 cout << "FlowEvent has "<<mult<<" tracks"<<endl;
175 if (mult<fMinMult || mult>fMaxMult)
176 {
177 cout << "FlowEvent cut on multiplicity" << endl;
178 return;
179 }
180
181
182 // get the flow vector
713d0676 183 AliFlowVector vQ = fEvent->GetQ();
f6f8c3fc 184 Double_t dRP[1] = {0.0};
185 // Phi is a Double_t, but SetQTheta() needs as input Double_t*,
186 // an array of doubles.
713d0676 187 dRP[0] = vQ.Phi()/2;
0692a009 188
713d0676 189 cout<<"The reaction plane from MC is "<<fRP<<endl;
0692a009 190 cout<<"The calculated reaction plane is "<<dRP[0]<<endl;
713d0676 191
0692a009 192
193 // Update the header
0692a009 194 AliAODHeader* header = AODEvent()->GetHeader();
0692a009 195 header->SetRunNumber(esd->GetRunNumber());
0692a009 196 header->SetQTheta(dRP,1);
713d0676 197
0692a009 198 }
0692a009 199
0692a009 200 PostData(0,fEvent);
713d0676 201
f6f8c3fc 202
0692a009 203}
204
205//________________________________________________________________________
206void AliAnalysisTaskFlowEventforRP::Terminate(Option_t *)
207{
208 // Called once at the end of the query -- do not call in case of CAF
713d0676 209
0692a009 210}
211
212