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 * *******************************/
30 class AliAnalysisTaskSE;
32 #include "Riostream.h"
33 #include "AliFlowEventSimple.h"
34 #include "AliAnalysisTaskNestedLoops.h"
35 #include "AliFlowAnalysisWithNestedLoops.h"
39 ClassImp(AliAnalysisTaskNestedLoops)
41 //================================================================================================================
43 AliAnalysisTaskNestedLoops::AliAnalysisTaskNestedLoops(const char *name, Bool_t useParticleWeights):
44 AliAnalysisTaskSE(name),
49 fOppositeChargesPOI(kFALSE),
50 fEvaluateDifferential3pCorrelator(kFALSE),
51 fUseParticleWeights(useParticleWeights),
52 fUsePhiWeights(kFALSE),
53 fUsePtWeights(kFALSE),
54 fUseEtaWeights(kFALSE),
56 fEvaluateNestedLoopsForRAD(kTRUE),
57 fEvaluateNestedLoopsForQC(kFALSE),
58 fEvaluateNestedLoopsForMH(kFALSE)
61 cout<<"AliAnalysisTaskNestedLoops::AliAnalysisTaskNestedLoops(const char *name, Bool_t useParticleWeights)"<<endl;
63 // Define input and output slots here
64 // Input slot #0 works with an AliFlowEventSimple
65 DefineInput(0, AliFlowEventSimple::Class());
66 // Input slot #1 is needed for the weights input file:
67 if(useParticleWeights)
69 DefineInput(1, TList::Class());
71 // Output slot #0 is reserved
72 // Output slot #1 writes into a TList container
73 DefineOutput(1, TList::Class());
76 AliAnalysisTaskNestedLoops::AliAnalysisTaskNestedLoops():
82 fOppositeChargesPOI(kFALSE),
83 fEvaluateDifferential3pCorrelator(kFALSE),
84 fUseParticleWeights(kFALSE),
85 fUsePhiWeights(kFALSE),
86 fUsePtWeights(kFALSE),
87 fUseEtaWeights(kFALSE),
89 fEvaluateNestedLoopsForRAD(kFALSE),
90 fEvaluateNestedLoopsForQC(kFALSE),
91 fEvaluateNestedLoopsForMH(kFALSE)
94 cout<<"AliAnalysisTaskNestedLoops::AliAnalysisTaskNestedLoops()"<<endl;
97 //================================================================================================================
99 void AliAnalysisTaskNestedLoops::UserCreateOutputObjects()
101 // Called at every worker node to initialize
102 cout<<"AliAnalysisTaskNestedLoops::UserCreateOutputObjects()"<<endl;
105 fNL = new AliFlowAnalysisWithNestedLoops();
107 fNL->SetHarmonic(fHarmonic);
108 fNL->SetOppositeChargesPOI(fOppositeChargesPOI);
109 fNL->SetEvaluateDifferential3pCorrelator(fEvaluateDifferential3pCorrelator);
111 if(fUseParticleWeights)
113 // Pass the flags to class:
114 if(fUsePhiWeights) fNL->SetUsePhiWeights(fUsePhiWeights);
115 if(fUsePtWeights) fNL->SetUsePtWeights(fUsePtWeights);
116 if(fUseEtaWeights) fNL->SetUseEtaWeights(fUseEtaWeights);
117 // Get data from input slot #1 which is used for weights:
120 fWeightsList = (TList*)GetInputData(1);
122 // Pass the list with weights to class:
123 if(fWeightsList) fNL->SetWeightsList(fWeightsList);
126 fNL->SetEvaluateNestedLoopsForRAD(fEvaluateNestedLoopsForRAD);
127 fNL->SetEvaluateNestedLoopsForQC(fEvaluateNestedLoopsForQC);
128 fNL->SetEvaluateNestedLoopsForMH(fEvaluateNestedLoopsForMH);
132 if(fNL->GetHistList())
134 fListHistos = fNL->GetHistList();
135 // fListHistos->Print();
138 Printf("ERROR: Could not retrieve histogram list (NL, Task::UserCreateOutputObjects()) !!!!");
141 PostData(1,fListHistos);
143 } // end of void AliAnalysisTaskNestedLoops::UserCreateOutputObjects()
145 //================================================================================================================
147 void AliAnalysisTaskNestedLoops::UserExec(Option_t *)
149 // main loop (called for each event)
150 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
158 cout<<"WARNING: No input data (NL, Task::UserExec()) !!!!"<<endl;
162 PostData(1,fListHistos);
165 //================================================================================================================
167 void AliAnalysisTaskNestedLoops::Terminate(Option_t *)
169 //accessing the merged output list:
170 fListHistos = (TList*)GetOutputData(1);
172 fNL = new AliFlowAnalysisWithNestedLoops();
176 fNL->GetOutputHistograms(fListHistos);
178 PostData(1,fListHistos);
181 cout<<" WARNING: histogram list pointer is empty (NL, Task::Terminate()) !!!!"<<endl;
185 } // end of void AliAnalysisTaskNestedLoops::Terminate(Option_t *)