]>
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), |
2a3b9289 | 52 | fHarmonic(2), |
02914cfa | 53 | fNormalizationType(1), |
2a3b9289 | 54 | fTotalQvector(NULL) |
29195b69 | 55 | { |
8d312f00 | 56 | // Constructor |
57 | cout<<"AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct(const char *name)"<<endl; | |
58 | ||
59 | // Define input and output slots here | |
dc3481ef | 60 | // Input slot #0 works with an AliFlowEventSimple |
61 | DefineInput(0, AliFlowEventSimple::Class()); | |
29195b69 | 62 | // Input slot #1 is needed for the weights input file |
63 | if(usePhiWeights) { | |
64 | DefineInput(1, TList::Class()); } | |
8d312f00 | 65 | // Output slot #0 writes into a TList container |
ea456d37 | 66 | DefineOutput(1, TList::Class()); |
2a3b9289 | 67 | |
68 | // Total Q-vector is: "QaQb" (means Qa+Qb), "Qa" or "Qb" | |
69 | fTotalQvector = new TString("QaQb"); | |
e2d51347 | 70 | } |
71 | ||
882ffd6a | 72 | //________________________________________________________________________ |
73 | AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct() : | |
ea456d37 | 74 | AliAnalysisTaskSE(), |
dc3481ef | 75 | fEvent(NULL), |
882ffd6a | 76 | fSP(NULL), |
29195b69 | 77 | fListHistos(NULL), |
78 | fUsePhiWeights(kFALSE), | |
a554b203 | 79 | fListWeights(NULL), |
3c5d5752 | 80 | fRelDiffMsub(1.0), |
50fe33aa | 81 | fApplyCorrectionForNUA(kFALSE), |
2a3b9289 | 82 | fHarmonic(0), |
02914cfa | 83 | fNormalizationType(1), |
2a3b9289 | 84 | fTotalQvector(NULL) |
dc3481ef | 85 | { |
882ffd6a | 86 | // Constructor |
87 | cout<<"AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct()"<<endl; | |
88 | } | |
89 | ||
e2d51347 | 90 | //________________________________________________________________________ |
91 | AliAnalysisTaskScalarProduct::~AliAnalysisTaskScalarProduct() | |
92 | { | |
93 | // | |
94 | // Destructor | |
95 | // | |
96 | ||
97 | // histograms are in the output list and deleted when the output | |
98 | // list is deleted by the TSelector dtor | |
99 | ||
100 | // if (ListHistos) { | |
101 | // delete fListHistos; | |
102 | // fListHistos = NULL; | |
103 | // } | |
8d312f00 | 104 | } |
105 | ||
106 | //________________________________________________________________________ | |
ea456d37 | 107 | void AliAnalysisTaskScalarProduct::UserCreateOutputObjects() |
8d312f00 | 108 | { |
e2d51347 | 109 | // Called at every worker node to initialize |
8d312f00 | 110 | cout<<"AliAnalysisTaskScalarProduct::CreateOutputObjects()"<<endl; |
dc3481ef | 111 | |
e2d51347 | 112 | //Analyser |
a554b203 | 113 | fSP = new AliFlowAnalysisWithScalarProduct(); |
114 | ||
115 | //set the allowed relative difference in the subevent multiplicities | |
02914cfa | 116 | //fSP->SetRelDiffMsub(fRelDiffMsub); |
1073c74a | 117 | |
3c5d5752 | 118 | //apply automatic correction for non-uniform acceptance: |
1073c74a | 119 | if (fApplyCorrectionForNUA) { |
120 | cout<<"Corrections for non-uniform acceptance applied in the Scalar Product method"<<endl; | |
121 | } | |
3c5d5752 | 122 | fSP->SetApplyCorrectionForNUA(fApplyCorrectionForNUA); |
50fe33aa | 123 | // harmonic: |
124 | fSP->SetHarmonic(fHarmonic); | |
02914cfa | 125 | fSP->SetNormalizationType( fNormalizationType ); |
2a3b9289 | 126 | // total Q-vector: |
02914cfa | 127 | Int_t totalQ = 0; |
128 | if( fTotalQvector->Contains("Qa") ) totalQ += 1; | |
129 | if( fTotalQvector->Contains("Qb") ) totalQ += 2; | |
130 | fSP->SetTotalQvector( totalQ ); | |
29195b69 | 131 | //for using phi weights: |
132 | if(fUsePhiWeights) { | |
133 | //pass the flag to the analysis class: | |
134 | fSP->SetUsePhiWeights(fUsePhiWeights); | |
135 | //get data from input slot #1 which is used for weights: | |
136 | if(GetNinputs()==2) { | |
137 | fListWeights = (TList*)GetInputData(1); | |
138 | } | |
139 | //pass the list with weights to the analysis class: | |
140 | if(fListWeights) fSP->SetWeightsList(fListWeights); | |
141 | } | |
d7eb18ec | 142 | |
29195b69 | 143 | fSP-> Init(); |
8d312f00 | 144 | |
d7eb18ec | 145 | if (fSP->GetHistList()) { |
dc3481ef | 146 | fListHistos = fSP->GetHistList(); |
8d312f00 | 147 | } |
d7eb18ec | 148 | else {Printf("ERROR: Could not retrieve histogram list"); } |
61e0c8c0 | 149 | |
150 | PostData(1,fListHistos); | |
151 | ||
8d312f00 | 152 | } |
153 | ||
154 | //________________________________________________________________________ | |
ea456d37 | 155 | void AliAnalysisTaskScalarProduct::UserExec(Option_t *) |
8d312f00 | 156 | { |
157 | // Main loop | |
158 | // Called for each event | |
159 | ||
882ffd6a | 160 | |
dc3481ef | 161 | fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0)); |
162 | if (fEvent){ | |
8d312f00 | 163 | fSP->Make(fEvent); |
8d312f00 | 164 | } |
dc3481ef | 165 | else { |
29195b69 | 166 | cout << "Warning no input data for Scalar Product task!!!" << endl; |
8d312f00 | 167 | } |
88e00a8a | 168 | |
88e00a8a | 169 | //fListHistos->Print(); |
ea456d37 | 170 | PostData(1,fListHistos); |
dc3481ef | 171 | |
882ffd6a | 172 | } |
8d312f00 | 173 | |
174 | //________________________________________________________________________ | |
175 | void AliAnalysisTaskScalarProduct::Terminate(Option_t *) | |
176 | { | |
395fadba | 177 | // Called once at the end of the query |
178 | AliFlowAnalysisWithScalarProduct* fSPTerm = new AliFlowAnalysisWithScalarProduct() ; | |
ea456d37 | 179 | fListHistos = (TList*)GetOutputData(1); |
395fadba | 180 | if (fListHistos) { |
fd46c3dd | 181 | fSPTerm -> GetOutputHistograms(fListHistos); |
395fadba | 182 | fSPTerm -> Finish(); |
ea456d37 | 183 | PostData(1,fListHistos); |
395fadba | 184 | } |
fd46c3dd | 185 | |
395fadba | 186 | else { cout << "histgram list pointer is empty in Scalar Product" << endl; } |
9d062fe3 | 187 | |
df802279 | 188 | } |