]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FLOW/AliFlowTasks/AliAnalysisTaskMCEventPlane.cxx
c4469fe8e636807757f33dc3b46f17c8f82b711e
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowTasks / AliAnalysisTaskMCEventPlane.cxx
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 #include "Riostream.h" //needed as include
17 #include "TProfile.h"
18 #include "TProfile2D.h"
19 #include "TList.h"
20
21
22 class AliAnalysisTaskSE;
23 #include "AliAnalysisManager.h"
24 #include "AliFlowEventSimple.h"
25
26
27 #include "AliAnalysisTaskMCEventPlane.h"
28 #include "AliFlowAnalysisWithMCEventPlane.h"
29 #include "AliFlowCommonHist.h"
30 #include "AliFlowCommonHistResults.h"
31
32 // AliAnalysisTaskMCEventPlane:
33 //
34 // analysis task for Monte Carlo Event Plane
35 //
36 // Author: Naomi van der Kolk (kolk@nikhef.nl)
37
38 ClassImp(AliAnalysisTaskMCEventPlane)
39
40 //________________________________________________________________________
41 AliAnalysisTaskMCEventPlane::AliAnalysisTaskMCEventPlane(const char *name) : 
42   AliAnalysisTaskSE(name), 
43   fEvent(NULL),
44   fMc(NULL),
45   fListHistos(NULL),
46   fEvaluateMixedHarmonics(kFALSE),
47   fnBinsMult(10000),
48   fMinMult(0.),  
49   fMaxMult(10000.),    
50   fNinCorrelator(2),
51   fMinCorrelator(2),
52   fXinPairAngle(0.5) 
53 {
54   // Constructor
55   cout<<"AliAnalysisTaskMCEventPlane::AliAnalysisTaskMCEventPlane(const char *name)"<<endl;
56
57   // Define input and output slots here
58   // Input slot #0 works with a TChain
59   DefineInput(0, AliFlowEventSimple::Class());
60   // Output slot #0 writes into a TList container
61   DefineOutput(1, TList::Class()); 
62 }
63
64 //________________________________________________________________________
65 AliAnalysisTaskMCEventPlane::AliAnalysisTaskMCEventPlane() : 
66   AliAnalysisTaskSE(),
67   fEvent(NULL),
68   fMc(NULL),
69   fListHistos(NULL),
70   fEvaluateMixedHarmonics(kFALSE),
71   fnBinsMult(0),
72   fMinMult(0.0),  
73   fMaxMult(0.0),     
74   fNinCorrelator(0),
75   fMinCorrelator(0),
76   fXinPairAngle(0.0) 
77 {
78   // Constructor
79   cout<<"AliAnalysisTaskMCEventPlane::AliAnalysisTaskMCEventPlane()"<<endl;
80
81 }
82
83 //________________________________________________________________________
84 AliAnalysisTaskMCEventPlane::~AliAnalysisTaskMCEventPlane()
85 {
86
87   //destructor
88
89 }
90
91 //________________________________________________________________________
92 void AliAnalysisTaskMCEventPlane::UserCreateOutputObjects() 
93 {
94   // Called once
95   cout<<"AliAnalysisTaskMCEventPlane::CreateOutputObjects()"<<endl;
96
97   //Analyser
98   fMc  = new AliFlowAnalysisWithMCEventPlane() ;
99   
100   // Setters for mixed harmonics study:
101   fMc->SetEvaluateMixedHarmonics(fEvaluateMixedHarmonics);
102   fMc->SetNinCorrelator(fNinCorrelator);
103   fMc->SetMinCorrelator(fMinCorrelator);
104   fMc->SetXinPairAngle(fXinPairAngle);
105   fMc->SetnBinsMult(fnBinsMult);
106   fMc->SetMinMult(fMinMult);
107   fMc->SetMaxMult(fMaxMult);
108   
109   // Initialized:    
110   fMc-> Init();
111
112   if (fMc->GetHistList()) {
113     //fMc->GetHistList()->Print();
114     fListHistos = fMc->GetHistList();
115     //fListHistos->Print();
116   }
117   else {Printf("ERROR: Could not retrieve histogram list"); }
118
119  PostData(1,fListHistos);
120
121 }
122
123 //________________________________________________________________________
124 void AliAnalysisTaskMCEventPlane::UserExec(Option_t *) 
125 {
126   // Main loop
127   // Called for each event
128
129   fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
130   if (fEvent){
131     fMc->Make(fEvent);
132   }
133   else {
134     cout << "Warning no input data!!!" << endl;
135   }
136
137   PostData(1,fListHistos); 
138 }      
139
140
141 //________________________________________________________________________
142 void AliAnalysisTaskMCEventPlane::Terminate(Option_t *) 
143 {
144   // Called once at the end of the query
145   AliFlowAnalysisWithMCEventPlane* fMcTerm = new AliFlowAnalysisWithMCEventPlane() ;
146
147   //Get output data
148   fListHistos = (TList*)GetOutputData(1);
149   if (fListHistos) {
150     fMcTerm->GetOutputHistograms(fListHistos);
151     fMcTerm->Finish();
152     PostData(1,fListHistos);
153   } else 
154     { 
155       cout << "histogram list pointer is empty" << endl;
156     }
157 }
158