]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/FLOW/Tasks/AliAnalysisTaskMCEventPlane.cxx
fix typo in partial derivative which is used to calculate correlated errors
[u/mrichter/AliRoot.git] / PWG / FLOW / Tasks / 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 using std::endl;
39 using std::cout;
40 ClassImp(AliAnalysisTaskMCEventPlane)
41
42 //________________________________________________________________________
43 AliAnalysisTaskMCEventPlane::AliAnalysisTaskMCEventPlane(const char *name) : 
44   AliAnalysisTaskSE(name), 
45   fEvent(NULL),
46   fMc(NULL),
47   fListHistos(NULL),
48   fHarmonic(2),
49   fEvaluateMixedHarmonics(kFALSE),
50   fnBinsMult(10000),
51   fMinMult(0.),  
52   fMaxMult(10000.),    
53   fNinCorrelator(2),
54   fMinCorrelator(2),
55   fXinPairAngle(0.5) 
56 {
57   // Constructor
58   cout<<"AliAnalysisTaskMCEventPlane::AliAnalysisTaskMCEventPlane(const char *name)"<<endl;
59
60   // Define input and output slots here
61   // Input slot #0 works with a TChain
62   DefineInput(0, AliFlowEventSimple::Class());
63   // Output slot #0 writes into a TList container
64   DefineOutput(1, TList::Class()); 
65 }
66
67 //________________________________________________________________________
68 AliAnalysisTaskMCEventPlane::AliAnalysisTaskMCEventPlane() : 
69   AliAnalysisTaskSE(),
70   fEvent(NULL),
71   fMc(NULL),
72   fListHistos(NULL),
73   fHarmonic(0),
74   fEvaluateMixedHarmonics(kFALSE),
75   fnBinsMult(0),
76   fMinMult(0.0),  
77   fMaxMult(0.0),     
78   fNinCorrelator(0),
79   fMinCorrelator(0),
80   fXinPairAngle(0.0) 
81 {
82   // Constructor
83   cout<<"AliAnalysisTaskMCEventPlane::AliAnalysisTaskMCEventPlane()"<<endl;
84
85 }
86
87 //________________________________________________________________________
88 AliAnalysisTaskMCEventPlane::~AliAnalysisTaskMCEventPlane()
89 {
90
91   //destructor
92
93 }
94
95 //________________________________________________________________________
96 void AliAnalysisTaskMCEventPlane::UserCreateOutputObjects() 
97 {
98   // Called once
99   cout<<"AliAnalysisTaskMCEventPlane::CreateOutputObjects()"<<endl;
100
101   //Analyser
102   fMc  = new AliFlowAnalysisWithMCEventPlane() ;
103   
104   fMc->SetHarmonic(fHarmonic);
105   
106   // Setters for mixed harmonics study:
107   fMc->SetEvaluateMixedHarmonics(fEvaluateMixedHarmonics);
108   fMc->SetNinCorrelator(fNinCorrelator);
109   fMc->SetMinCorrelator(fMinCorrelator);
110   fMc->SetXinPairAngle(fXinPairAngle);
111   fMc->SetnBinsMult(fnBinsMult);
112   fMc->SetMinMult(fMinMult);
113   fMc->SetMaxMult(fMaxMult);
114   
115   // Initialized:    
116   fMc-> Init();
117
118   if (fMc->GetHistList()) {
119     //fMc->GetHistList()->Print();
120     fListHistos = fMc->GetHistList();
121     //fListHistos->Print();
122   }
123   else {Printf("ERROR: Could not retrieve histogram list"); }
124
125  PostData(1,fListHistos);
126
127 }
128
129 //________________________________________________________________________
130 void AliAnalysisTaskMCEventPlane::UserExec(Option_t *) 
131 {
132   // Main loop
133   // Called for each event
134
135   fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
136   if (fEvent){
137     fMc->Make(fEvent);
138   }
139   else {
140     cout << "Warning no input data!!!" << endl;
141   }
142
143   PostData(1,fListHistos); 
144 }      
145
146
147 //________________________________________________________________________
148 void AliAnalysisTaskMCEventPlane::Terminate(Option_t *) 
149 {
150   // Called once at the end of the query
151   AliFlowAnalysisWithMCEventPlane* fMcTerm = new AliFlowAnalysisWithMCEventPlane() ;
152
153   //Get output data
154   fListHistos = (TList*)GetOutputData(1);
155   if (fListHistos) {
156     fMcTerm->GetOutputHistograms(fListHistos);
157     fMcTerm->Finish();
158     PostData(1,fListHistos);
159   } else 
160     { 
161       cout << "histogram list pointer is empty" << endl;
162     }
163 }
164