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