1 /*************************************************************************
2 * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /**************************************
17 * analysis task for mixed harmomics *
19 * authors: Naomi van der Kolk *
22 * (snelling@nikhef.nl) *
25 * ***********************************/
29 class AliAnalysisTaskSE;
31 #include "Riostream.h"
32 #include "AliFlowEventSimple.h"
33 #include "AliAnalysisTaskMixedHarmonics.h"
34 #include "AliFlowAnalysisWithMixedHarmonics.h"
36 ClassImp(AliAnalysisTaskMixedHarmonics)
38 //================================================================================================================
40 AliAnalysisTaskMixedHarmonics::AliAnalysisTaskMixedHarmonics(const char *name, Bool_t useParticleWeights):
41 AliAnalysisTaskSE(name),
45 fCorrelatorInteger(1),
46 fNoOfMultipicityBins(10),
47 fMultipicityBinWidth(2.),
49 fCorrectForDetectorEffects(kTRUE),
50 fUseParticleWeights(useParticleWeights),
51 fUsePhiWeights(kFALSE),
52 fUsePtWeights(kFALSE),
53 fUseEtaWeights(kFALSE),
57 cout<<"AliAnalysisTaskMixedHarmonics::AliAnalysisTaskMixedHarmonics(const char *name, Bool_t useParticleWeights)"<<endl;
59 // Define input and output slots here
60 // Input slot #0 works with an AliFlowEventSimple
61 DefineInput(0, AliFlowEventSimple::Class());
62 // Input slot #1 is needed for the weights input file:
63 if(useParticleWeights)
65 DefineInput(1, TList::Class());
67 // Output slot #0 is reserved
68 // Output slot #1 writes into a TList container
69 DefineOutput(1, TList::Class());
72 AliAnalysisTaskMixedHarmonics::AliAnalysisTaskMixedHarmonics():
77 fCorrelatorInteger(0),
78 fNoOfMultipicityBins(0),
79 fMultipicityBinWidth(0),
81 fCorrectForDetectorEffects(kFALSE),
82 fUseParticleWeights(kFALSE),
83 fUsePhiWeights(kFALSE),
84 fUsePtWeights(kFALSE),
85 fUseEtaWeights(kFALSE),
89 cout<<"AliAnalysisTaskMixedHarmonics::AliAnalysisTaskMixedHarmonics()"<<endl;
92 //================================================================================================================
94 void AliAnalysisTaskMixedHarmonics::UserCreateOutputObjects()
96 // Called at every worker node to initialize
97 cout<<"AliAnalysisTaskMixedHarmonics::UserCreateOutputObjects()"<<endl;
100 fMH = new AliFlowAnalysisWithMixedHarmonics();
103 fMH->SetCorrelatorInteger(fCorrelatorInteger);
104 fMH->SetNoOfMultipicityBins(fNoOfMultipicityBins);
105 fMH->SetMultipicityBinWidth(fMultipicityBinWidth);
106 fMH->SetMinMultiplicity(fMinMultiplicity);
107 fMH->SetCorrectForDetectorEffects(fCorrectForDetectorEffects);
108 if(fUseParticleWeights)
110 // Pass the flags to class:
111 if(fUsePhiWeights) fMH->SetUsePhiWeights(fUsePhiWeights);
112 if(fUsePtWeights) fMH->SetUsePtWeights(fUsePtWeights);
113 if(fUseEtaWeights) fMH->SetUseEtaWeights(fUseEtaWeights);
114 // Get data from input slot #1 which is used for weights:
117 fWeightsList = (TList*)GetInputData(1);
119 // Pass the list with weights to class:
120 if(fWeightsList) fMH->SetWeightsList(fWeightsList);
125 if(fMH->GetHistList())
127 fListHistos = fMH->GetHistList();
128 // fListHistos->Print();
131 Printf("ERROR: Could not retrieve histogram list (MH, Task::UserCreateOutputObjects()) !!!!");
134 PostData(1,fListHistos);
136 } // end of void AliAnalysisTaskMixedHarmonics::UserCreateOutputObjects()
138 //================================================================================================================
140 void AliAnalysisTaskMixedHarmonics::UserExec(Option_t *)
142 // main loop (called for each event)
143 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
151 cout<<"WARNING: No input data (MH, Task::UserExec()) !!!!"<<endl;
155 PostData(1,fListHistos);
158 //================================================================================================================
160 void AliAnalysisTaskMixedHarmonics::Terminate(Option_t *)
162 //accessing the merged output list:
163 fListHistos = (TList*)GetOutputData(1);
165 fMH = new AliFlowAnalysisWithMixedHarmonics();
169 fMH->GetOutputHistograms(fListHistos);
171 PostData(1,fListHistos);
174 cout<<" WARNING: histogram list pointer is empty (MH, Task::Terminate()) !!!!"<<endl;
178 } // end of void AliAnalysisTaskMixedHarmonics::Terminate(Option_t *)