]>
Commit | Line | Data |
---|---|---|
8d312f00 | 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 | ||
a554b203 | 16 | /////////////////////////////////////////////// |
17 | // AliAnalysisTaskScalarProduct: | |
18 | // | |
19 | // analysis task for Scalar Product Method | |
20 | // | |
21 | // Author: Naomi van der Kolk (kolk@nikhef.nl) | |
22 | /////////////////////////////////////////////// | |
23 | ||
24 | ||
8d312f00 | 25 | #include "Riostream.h" //needed as include |
8d312f00 | 26 | |
395fadba | 27 | class TFile; |
28 | class TList; | |
ea456d37 | 29 | class AliAnalysisTaskSE; |
395fadba | 30 | |
31 | #include "TProfile.h" //needed as include | |
8d312f00 | 32 | #include "AliAnalysisManager.h" |
dc3481ef | 33 | #include "AliFlowEventSimple.h" |
88e00a8a | 34 | |
8d312f00 | 35 | #include "AliAnalysisTaskScalarProduct.h" |
8d312f00 | 36 | #include "AliFlowAnalysisWithScalarProduct.h" |
04f6283b | 37 | #include "AliFlowCommonHist.h" |
dc3481ef | 38 | #include "AliFlowCommonHistResults.h" |
8d312f00 | 39 | |
8d312f00 | 40 | ClassImp(AliAnalysisTaskScalarProduct) |
41 | ||
42 | //________________________________________________________________________ | |
29195b69 | 43 | AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct(const char *name, Bool_t usePhiWeights) : |
ea456d37 | 44 | AliAnalysisTaskSE(name), |
dc3481ef | 45 | fEvent(NULL), |
d7eb18ec | 46 | fSP(NULL), |
29195b69 | 47 | fListHistos(NULL), |
48 | fUsePhiWeights(usePhiWeights), | |
a554b203 | 49 | fListWeights(NULL), |
3c5d5752 | 50 | fRelDiffMsub(1.0), |
50fe33aa | 51 | fApplyCorrectionForNUA(kFALSE), |
52 | fHarmonic(2) | |
29195b69 | 53 | { |
8d312f00 | 54 | // Constructor |
55 | cout<<"AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct(const char *name)"<<endl; | |
56 | ||
57 | // Define input and output slots here | |
dc3481ef | 58 | // Input slot #0 works with an AliFlowEventSimple |
59 | DefineInput(0, AliFlowEventSimple::Class()); | |
29195b69 | 60 | // Input slot #1 is needed for the weights input file |
61 | if(usePhiWeights) { | |
62 | DefineInput(1, TList::Class()); } | |
8d312f00 | 63 | // Output slot #0 writes into a TList container |
ea456d37 | 64 | DefineOutput(1, TList::Class()); |
e2d51347 | 65 | } |
66 | ||
882ffd6a | 67 | //________________________________________________________________________ |
68 | AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct() : | |
ea456d37 | 69 | AliAnalysisTaskSE(), |
dc3481ef | 70 | fEvent(NULL), |
882ffd6a | 71 | fSP(NULL), |
29195b69 | 72 | fListHistos(NULL), |
73 | fUsePhiWeights(kFALSE), | |
a554b203 | 74 | fListWeights(NULL), |
3c5d5752 | 75 | fRelDiffMsub(1.0), |
50fe33aa | 76 | fApplyCorrectionForNUA(kFALSE), |
77 | fHarmonic(0) | |
dc3481ef | 78 | { |
882ffd6a | 79 | // Constructor |
80 | cout<<"AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct()"<<endl; | |
81 | } | |
82 | ||
e2d51347 | 83 | //________________________________________________________________________ |
84 | AliAnalysisTaskScalarProduct::~AliAnalysisTaskScalarProduct() | |
85 | { | |
86 | // | |
87 | // Destructor | |
88 | // | |
89 | ||
90 | // histograms are in the output list and deleted when the output | |
91 | // list is deleted by the TSelector dtor | |
92 | ||
93 | // if (ListHistos) { | |
94 | // delete fListHistos; | |
95 | // fListHistos = NULL; | |
96 | // } | |
8d312f00 | 97 | } |
98 | ||
99 | //________________________________________________________________________ | |
ea456d37 | 100 | void AliAnalysisTaskScalarProduct::UserCreateOutputObjects() |
8d312f00 | 101 | { |
e2d51347 | 102 | // Called at every worker node to initialize |
8d312f00 | 103 | cout<<"AliAnalysisTaskScalarProduct::CreateOutputObjects()"<<endl; |
dc3481ef | 104 | |
e2d51347 | 105 | //Analyser |
a554b203 | 106 | fSP = new AliFlowAnalysisWithScalarProduct(); |
107 | ||
108 | //set the allowed relative difference in the subevent multiplicities | |
109 | fSP->SetRelDiffMsub(fRelDiffMsub); | |
1073c74a | 110 | |
3c5d5752 | 111 | //apply automatic correction for non-uniform acceptance: |
1073c74a | 112 | if (fApplyCorrectionForNUA) { |
113 | cout<<"Corrections for non-uniform acceptance applied in the Scalar Product method"<<endl; | |
114 | } | |
3c5d5752 | 115 | fSP->SetApplyCorrectionForNUA(fApplyCorrectionForNUA); |
50fe33aa | 116 | // harmonic: |
117 | fSP->SetHarmonic(fHarmonic); | |
29195b69 | 118 | |
119 | //for using phi weights: | |
120 | if(fUsePhiWeights) { | |
121 | //pass the flag to the analysis class: | |
122 | fSP->SetUsePhiWeights(fUsePhiWeights); | |
123 | //get data from input slot #1 which is used for weights: | |
124 | if(GetNinputs()==2) { | |
125 | fListWeights = (TList*)GetInputData(1); | |
126 | } | |
127 | //pass the list with weights to the analysis class: | |
128 | if(fListWeights) fSP->SetWeightsList(fListWeights); | |
129 | } | |
d7eb18ec | 130 | |
29195b69 | 131 | fSP-> Init(); |
8d312f00 | 132 | |
d7eb18ec | 133 | if (fSP->GetHistList()) { |
dc3481ef | 134 | fListHistos = fSP->GetHistList(); |
8d312f00 | 135 | } |
d7eb18ec | 136 | else {Printf("ERROR: Could not retrieve histogram list"); } |
61e0c8c0 | 137 | |
138 | PostData(1,fListHistos); | |
139 | ||
8d312f00 | 140 | } |
141 | ||
142 | //________________________________________________________________________ | |
ea456d37 | 143 | void AliAnalysisTaskScalarProduct::UserExec(Option_t *) |
8d312f00 | 144 | { |
145 | // Main loop | |
146 | // Called for each event | |
147 | ||
882ffd6a | 148 | |
dc3481ef | 149 | fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0)); |
150 | if (fEvent){ | |
8d312f00 | 151 | fSP->Make(fEvent); |
8d312f00 | 152 | } |
dc3481ef | 153 | else { |
29195b69 | 154 | cout << "Warning no input data for Scalar Product task!!!" << endl; |
8d312f00 | 155 | } |
88e00a8a | 156 | |
88e00a8a | 157 | //fListHistos->Print(); |
ea456d37 | 158 | PostData(1,fListHistos); |
dc3481ef | 159 | |
882ffd6a | 160 | } |
8d312f00 | 161 | |
162 | //________________________________________________________________________ | |
163 | void AliAnalysisTaskScalarProduct::Terminate(Option_t *) | |
164 | { | |
395fadba | 165 | // Called once at the end of the query |
166 | AliFlowAnalysisWithScalarProduct* fSPTerm = new AliFlowAnalysisWithScalarProduct() ; | |
ea456d37 | 167 | fListHistos = (TList*)GetOutputData(1); |
395fadba | 168 | if (fListHistos) { |
fd46c3dd | 169 | fSPTerm -> GetOutputHistograms(fListHistos); |
395fadba | 170 | fSPTerm -> Finish(); |
ea456d37 | 171 | PostData(1,fListHistos); |
395fadba | 172 | } |
fd46c3dd | 173 | |
395fadba | 174 | else { cout << "histgram list pointer is empty in Scalar Product" << endl; } |
9d062fe3 | 175 | |
df802279 | 176 | } |