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 nested loops *
19 * authors: Naomi van der Kolk *
22 * (snelling@nikhef.nl) *
25 * *******************************/
29 class AliAnalysisTaskSE;
31 #include "Riostream.h"
32 #include "AliFlowEventSimple.h"
33 #include "AliAnalysisTaskNestedLoops.h"
34 #include "AliFlowAnalysisWithNestedLoops.h"
36 ClassImp(AliAnalysisTaskNestedLoops)
38 //================================================================================================================
40 AliAnalysisTaskNestedLoops::AliAnalysisTaskNestedLoops(const char *name, Bool_t useParticleWeights):
41 AliAnalysisTaskSE(name),
46 fOppositeChargesPOI(kFALSE),
47 fEvaluateDifferential3pCorrelator(kFALSE),
48 fUseParticleWeights(useParticleWeights),
49 fUsePhiWeights(kFALSE),
50 fUsePtWeights(kFALSE),
51 fUseEtaWeights(kFALSE),
53 fEvaluateNestedLoopsForRAD(kTRUE),
54 fEvaluateNestedLoopsForQC(kFALSE),
55 fEvaluateNestedLoopsForMH(kFALSE)
58 cout<<"AliAnalysisTaskNestedLoops::AliAnalysisTaskNestedLoops(const char *name, Bool_t useParticleWeights)"<<endl;
60 // Define input and output slots here
61 // Input slot #0 works with an AliFlowEventSimple
62 DefineInput(0, AliFlowEventSimple::Class());
63 // Input slot #1 is needed for the weights input file:
64 if(useParticleWeights)
66 DefineInput(1, TList::Class());
68 // Output slot #0 is reserved
69 // Output slot #1 writes into a TList container
70 DefineOutput(1, TList::Class());
73 AliAnalysisTaskNestedLoops::AliAnalysisTaskNestedLoops():
79 fOppositeChargesPOI(kFALSE),
80 fEvaluateDifferential3pCorrelator(kFALSE),
81 fUseParticleWeights(kFALSE),
82 fUsePhiWeights(kFALSE),
83 fUsePtWeights(kFALSE),
84 fUseEtaWeights(kFALSE),
86 fEvaluateNestedLoopsForRAD(kFALSE),
87 fEvaluateNestedLoopsForQC(kFALSE),
88 fEvaluateNestedLoopsForMH(kFALSE)
91 cout<<"AliAnalysisTaskNestedLoops::AliAnalysisTaskNestedLoops()"<<endl;
94 //================================================================================================================
96 void AliAnalysisTaskNestedLoops::UserCreateOutputObjects()
98 // Called at every worker node to initialize
99 cout<<"AliAnalysisTaskNestedLoops::UserCreateOutputObjects()"<<endl;
102 fNL = new AliFlowAnalysisWithNestedLoops();
104 fNL->SetHarmonic(fHarmonic);
105 fNL->SetOppositeChargesPOI(fOppositeChargesPOI);
106 fNL->SetEvaluateDifferential3pCorrelator(fEvaluateDifferential3pCorrelator);
108 if(fUseParticleWeights)
110 // Pass the flags to class:
111 if(fUsePhiWeights) fNL->SetUsePhiWeights(fUsePhiWeights);
112 if(fUsePtWeights) fNL->SetUsePtWeights(fUsePtWeights);
113 if(fUseEtaWeights) fNL->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) fNL->SetWeightsList(fWeightsList);
123 fNL->SetEvaluateNestedLoopsForRAD(fEvaluateNestedLoopsForRAD);
124 fNL->SetEvaluateNestedLoopsForQC(fEvaluateNestedLoopsForQC);
125 fNL->SetEvaluateNestedLoopsForMH(fEvaluateNestedLoopsForMH);
129 if(fNL->GetHistList())
131 fListHistos = fNL->GetHistList();
132 // fListHistos->Print();
135 Printf("ERROR: Could not retrieve histogram list (NL, Task::UserCreateOutputObjects()) !!!!");
138 PostData(1,fListHistos);
140 } // end of void AliAnalysisTaskNestedLoops::UserCreateOutputObjects()
142 //================================================================================================================
144 void AliAnalysisTaskNestedLoops::UserExec(Option_t *)
146 // main loop (called for each event)
147 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
155 cout<<"WARNING: No input data (NL, Task::UserExec()) !!!!"<<endl;
159 PostData(1,fListHistos);
162 //================================================================================================================
164 void AliAnalysisTaskNestedLoops::Terminate(Option_t *)
166 //accessing the merged output list:
167 fListHistos = (TList*)GetOutputData(1);
169 fNL = new AliFlowAnalysisWithNestedLoops();
173 fNL->GetOutputHistograms(fListHistos);
175 PostData(1,fListHistos);
178 cout<<" WARNING: histogram list pointer is empty (NL, Task::Terminate()) !!!!"<<endl;
182 } // end of void AliAnalysisTaskNestedLoops::Terminate(Option_t *)