]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraAODEventCuts.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraAODEventCuts.cxx
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / PiKaPr / TestAOD / AliSpectraAODEventCuts.cxx
CommitLineData
c88234ad 1
2/**************************************************************************
3 * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
4 * *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16
17//-----------------------------------------------------------------
18// AliSpectraAODEventCuts class
19//-----------------------------------------------------------------
20
21#include "TChain.h"
22#include "TTree.h"
23#include "TLegend.h"
24#include "TH1F.h"
829b5a81 25#include "TH1I.h"
c88234ad 26#include "TH2F.h"
27#include "TCanvas.h"
93db93de 28#include "TProfile.h"
c88234ad 29#include "AliAnalysisTask.h"
30#include "AliAnalysisManager.h"
31#include "AliAODTrack.h"
32#include "AliAODMCParticle.h"
33#include "AliAODEvent.h"
34#include "AliAODInputHandler.h"
35#include "AliAnalysisTaskESDfilter.h"
36#include "AliAnalysisDataContainer.h"
93db93de 37#include "AliESDVZERO.h"
38#include "AliAODVZERO.h"
c88234ad 39#include "AliSpectraAODEventCuts.h"
f6a38178 40#include "AliSpectraAODTrackCuts.h"
c88234ad 41#include <iostream>
42
43using namespace std;
44
45ClassImp(AliSpectraAODEventCuts)
46
93db93de 47AliSpectraAODEventCuts::AliSpectraAODEventCuts(const char *name) :
48 TNamed(name, "AOD Event Cuts"),
49 fAOD(0),
50 fSelectBit(AliVEvent::kMB),
51 fCentralityMethod("V0M"),
52 fTrackBits(1),
53 fIsMC(0),
48c4d28e 54 fIsLHC10h(1),
93db93de 55 fTrackCuts(0),
56 fIsSelected(0),
57 fCentralityCutMin(0.),
58 fCentralityCutMax(999),
59 fQVectorCutMin(-999.),
60 fQVectorCutMax(999.),
a162b3e2 61 fVertexCutMin(-10.),
62 fVertexCutMax(10.),
93db93de 63 fMultiplicityCutMin(-999.),
64 fMultiplicityCutMax(99999.),
48c4d28e 65 fqV0C(-999.),
66 fqV0A(-999.),
4fd2f0ad
LM
67 fqV0Cx(-999.),
68 fqV0Ax(-999.),
69 fqV0Cy(-999.),
70 fqV0Ay(-999.),
fdbff5a1 71 fPsiV0C(-999.),
72 fPsiV0A(-999.),
48c4d28e 73 fCent(-999.),
93db93de 74 fOutput(0),
75 fCalib(0),
76 fRun(-1),
77 fMultV0(0),
78 fV0Cpol1(-1),
79 fV0Cpol2(-1),
80 fV0Cpol3(-1),
81 fV0Cpol4(-1),
82 fV0Apol1(-1),
83 fV0Apol2(-1),
84 fV0Apol3(-1),
85 fV0Apol4(-1)
c88234ad 86{
f6a38178 87 // Constructor
93db93de 88 fOutput=new TList();
89 fOutput->SetOwner();
90 fOutput->SetName("fOutput");
91
92 fCalib=new TList();
93 fCalib->SetOwner();
94 fCalib->SetName("fCalib");
95
96 TH1I *fHistoCuts = new TH1I("fHistoCuts", "Event Cuts", kNVtxCuts, -0.5, kNVtxCuts - 0.5);
23f51e78 97 TH1F *fHistoVtxBefSel = new TH1F("fHistoVtxBefSel", "Vtx distr before event selection;z (cm)",500,-15,15);
98 TH1F *fHistoVtxAftSel = new TH1F("fHistoVtxAftSel", "Vtx distr after event selection;z (cm)",500,-15,15);
99 TH1F *fHistoEtaBefSel = new TH1F("fHistoEtaBefSel", "Eta distr before event selection;eta",500,-2,2);
100 TH1F *fHistoEtaAftSel = new TH1F("fHistoEtaAftSel", "Eta distr after event selection;eta",500,-2,2);
101 TH1F *fHistoNChAftSel = new TH1F("fHistoNChAftSel", "NCh distr after event selection;Nch",2000,-0.5,1999.5);
102 TH2F *fHistoQVector = new TH2F("fHistoQVector", "QVector with VZERO distribution;centrality;Q vector from EP task",20,0,100,100,0,10);
103 TH2F *fHistoEP = new TH2F("fHistoEP", "EP with VZERO distribution;centrality;Psi_{EP} from EP task",20,0,100,100,-2,2);
104 TH2F *fPsiACor = new TH2F("fPsiACor", "EP with VZERO A distribution;centrality;Psi_{EP} VZERO-A",20,0,100,100,-2,2);
105 TH2F *fPsiCCor = new TH2F("fPsiCCor", "EP with VZERO C distribution;centrality;Psi_{EP} VZERO-C",20,0,100,100,-2,2);
106 TH2F *fQVecACor = new TH2F("fQVecACor", "QVec VZERO A;centrality;Qvector VZERO-A",20,0,100,100,0,10);
107 TH2F *fQVecCCor = new TH2F("fQVecCCor", "QVec VZERO C;centrality;Qvector VZERO-C",20,0,100,100,0,10);
108 TH2F *fV0M = new TH2F("fV0M", "V0 Multiplicity, before correction;V0 sector",64,-.5,63.5,500,0,1000);
109 TH2F *fV0MCor = new TH2F("fV0MCor", "V0 Multiplicity, after correction;V0 sector",64,-.5,63.5,500,0,1000);
93db93de 110
111 fOutput->Add(fHistoCuts);
112 fOutput->Add(fHistoVtxBefSel);
113 fOutput->Add(fHistoVtxAftSel);
114 fOutput->Add(fHistoEtaBefSel);
115 fOutput->Add(fHistoEtaAftSel);
116 fOutput->Add(fHistoNChAftSel);
117 fOutput->Add(fHistoQVector);
118 fOutput->Add(fHistoEP);
119 fOutput->Add(fPsiACor);
120 fOutput->Add(fPsiCCor);
121 fOutput->Add(fQVecACor);
122 fOutput->Add(fQVecCCor);
23f51e78 123 fOutput->Add(fV0M);
124 fOutput->Add(fV0MCor);
93db93de 125
126 for (Int_t i = 0; i<10; i++){
127 fMeanQxa2[i] = -1;
128 fMeanQya2[i] = -1;
129 fMeanQxc2[i] = -1;
130 fMeanQyc2[i] = -1;
131 }
c88234ad 132}
133
134//______________________________________________________
f6a38178 135Bool_t AliSpectraAODEventCuts::IsSelected(AliAODEvent * aod,AliSpectraAODTrackCuts *trackcuts)
c88234ad 136{
f6a38178 137 // Returns true if Event Cuts are selected and applied
138 fAOD = aod;
31579941 139 fTrackCuts = trackcuts; // FIXME: if track cuts is 0, do not set (use the pre-set member). Do we need to pass this here at all??
140 // FIXME: all those references by name are slow.
93db93de 141 ((TH1I*)fOutput->FindObject("fHistoCuts"))->Fill(kProcessedEvents);
142 Bool_t IsPhysSel = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & fSelectBit);
decf69d9 143 if(!IsPhysSel)return IsPhysSel;
93db93de 144 ((TH1I*)fOutput->FindObject("fHistoCuts"))->Fill(kPhysSelEvents);
f6a38178 145 //loop on tracks, before event selection, filling QA histos
146 AliAODVertex * vertex = fAOD->GetPrimaryVertex();//FIXME vertex is recreated
93db93de 147 if(vertex)((TH1F*)fOutput->FindObject("fHistoVtxBefSel"))->Fill(vertex->GetZ());
decf69d9 148 fIsSelected =kFALSE;
10a8ccbe 149 if(CheckVtxRange() && CheckCentralityCut() && CheckMultiplicityCut()){ //selection on vertex and Centrality
00493191 150 fIsSelected=CheckQVectorCut(); // QVector is calculated only if the centrality and vertex are correct (performance)
decf69d9 151 }
f6a38178 152 if(fIsSelected){
93db93de 153 ((TH1I*)fOutput->FindObject("fHistoCuts"))->Fill(kAcceptedEvents);
154 if(vertex)((TH1F*)fOutput->FindObject("fHistoVtxAftSel"))->Fill(vertex->GetZ());
f6a38178 155 }
ae0fdd7d 156 Int_t Nch=0;
f6a38178 157 for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++) {
158 AliAODTrack* track = fAOD->GetTrack(iTracks);
decf69d9 159 if (!fTrackCuts->IsSelected(track,kFALSE)) continue;
93db93de 160 ((TH1F*)fOutput->FindObject("fHistoEtaBefSel"))->Fill(track->Eta());
ae0fdd7d 161 if(fIsSelected){
93db93de 162 ((TH1F*)fOutput->FindObject("fHistoEtaAftSel"))->Fill(track->Eta());
ae0fdd7d 163 Nch++;
164 }
f6a38178 165 }
93db93de 166 if(fIsSelected)((TH1F*)fOutput->FindObject("fHistoNChAftSel"))->Fill(Nch);
f6a38178 167 return fIsSelected;
c88234ad 168}
169
170//______________________________________________________
171Bool_t AliSpectraAODEventCuts::CheckVtxRange()
172{
173 // reject events outside of range
f6a38178 174 AliAODVertex * vertex = fAOD->GetPrimaryVertex();
264de30e 175 //when moving to 2011 wìone has to add a cut using SPD vertex.
176 //The point is that for events with |z|>20 the vertexer tracks is not working (only 2011!). One has to put a safety cut using SPD vertex large e.g. 15cm
f6a38178 177 if (!vertex)
178 {
93db93de 179 ((TH1I*)fOutput->FindObject("fHistoCuts"))->Fill(kVtxNoEvent);
c88234ad 180 return kFALSE;
f6a38178 181 }
10a8ccbe 182 if (vertex->GetZ() > fVertexCutMin && vertex->GetZ() < fVertexCutMax)
f6a38178 183 {
c88234ad 184 return kTRUE;
f6a38178 185 }
93db93de 186 ((TH1I*)fOutput->FindObject("fHistoCuts"))->Fill(kVtxRange);
f6a38178 187 return kFALSE;
c88234ad 188}
189
190//______________________________________________________
191Bool_t AliSpectraAODEventCuts::CheckCentralityCut()
192{
f6a38178 193 // Check centrality cut
48c4d28e 194 fCent=-999.;
195 fCent=fAOD->GetCentrality()->GetCentralityPercentile(fCentralityMethod.Data());
196 if ( (fCent <= fCentralityCutMax) && (fCent >= fCentralityCutMin) ) return kTRUE;
93db93de 197 ((TH1I*)fOutput->FindObject("fHistoCuts"))->Fill(kVtxCentral);
f6a38178 198 return kFALSE;
c88234ad 199}
200
10a8ccbe 201//______________________________________________________
202Bool_t AliSpectraAODEventCuts::CheckMultiplicityCut()
203{
204 // Check multiplicity cut
31579941 205 // FIXME: why this is not tracket in the track stats histos?
10a8ccbe 206 Int_t Ncharged=0;
207 for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++){
208 AliAODTrack* track = fAOD->GetTrack(iTracks);
209 if (!fTrackCuts->IsSelected(track,kFALSE)) continue;
210 Ncharged++;
211 }
10a8ccbe 212 if(Ncharged>fMultiplicityCutMin && Ncharged<fMultiplicityCutMax)return kTRUE;
213
214 return kFALSE;
215}
216
decf69d9 217//______________________________________________________
218Bool_t AliSpectraAODEventCuts::CheckQVectorCut()
23f51e78 219{
48c4d28e 220 Double_t qxEPVZERO = -999., qyEPVZERO = -999.;
fdbff5a1 221 Double_t qVZERO = -999.;
222 Double_t psi=-999.;
223
224 if(fIsLHC10h){
225 qVZERO=CalculateQVectorLHC10h();
226 psi=fPsiV0A;
227 }else{
228 psi=fAOD->GetEventplane()->CalculateVZEROEventPlane(fAOD,10,2,qxEPVZERO,qyEPVZERO);//FIXME we can a flag for 2010 and 2011
229 qVZERO= TMath::Sqrt(qxEPVZERO*qxEPVZERO + qyEPVZERO*qyEPVZERO);
230 }
231
232 //cut on q vector
16ee3540 233 if(qVZERO<fQVectorCutMin || qVZERO>fQVectorCutMax)return kFALSE;
23f51e78 234 Double_t cent=fAOD->GetCentrality()->GetCentralityPercentile(fCentralityMethod.Data());
235 ((TH2F*)fOutput->FindObject("fHistoQVector"))->Fill(cent,qVZERO);
236 ((TH2F*)fOutput->FindObject("fHistoEP"))->Fill(cent,psi);
93db93de 237 ((TH1I*)fOutput->FindObject("fHistoCuts"))->Fill(kQVector);
23f51e78 238
fdbff5a1 239
decf69d9 240 return kTRUE;
decf69d9 241}
242
93db93de 243//______________________________________________________
93db93de 244Double_t AliSpectraAODEventCuts::CalculateQVectorLHC10h(){
245
246 Int_t run = fAOD->GetRunNumber();
247 if(run != fRun){
248 // Load the calibrations run dependent
249 if(OpenInfoCalbration(run))fRun=run;
48c4d28e 250 else{
251 fqV0C=-999.;
252 fqV0A=-999.;
253 return -999.;
254 }
93db93de 255 }
256
257 //V0 info
258 Double_t Qxa2 = 0, Qya2 = 0;
259 Double_t Qxc2 = 0, Qyc2 = 0;
260 Double_t sumMc = 0, sumMa = 0;
261
262 AliAODVZERO* aodV0 = fAOD->GetVZEROData();
263
264 for (Int_t iv0 = 0; iv0 < 64; iv0++) {
265
266 Double_t phiV0 = TMath::PiOver4()*(0.5 + iv0 % 8);
267
268 Float_t multv0 = aodV0->GetMultiplicity(iv0);
23f51e78 269 ((TH2F*)fOutput->FindObject("fV0M"))->Fill(iv0,multv0);
270
93db93de 271 if (iv0 < 32){
272
273 Double_t multCorC = -10;
274
275 if (iv0 < 8)
276 multCorC = multv0*fV0Cpol1/fMultV0->GetBinContent(iv0+1);
277 else if (iv0 >= 8 && iv0 < 16)
278 multCorC = multv0*fV0Cpol2/fMultV0->GetBinContent(iv0+1);
279 else if (iv0 >= 16 && iv0 < 24)
280 multCorC = multv0*fV0Cpol3/fMultV0->GetBinContent(iv0+1);
281 else if (iv0 >= 24 && iv0 < 32)
282 multCorC = multv0*fV0Cpol4/fMultV0->GetBinContent(iv0+1);
283
284 if (multCorC < 0){
285 cout<<"Problem with multiplicity in V0C"<<endl;
48c4d28e 286 fqV0C=-999.;
287 fqV0A=-999.;
288 return -999.;
93db93de 289 }
290
291 Qxc2 += TMath::Cos(2*phiV0) * multCorC;
292 Qyc2 += TMath::Sin(2*phiV0) * multCorC;
293
294 sumMc += multCorC;
23f51e78 295 ((TH2F*)fOutput->FindObject("fV0MCor"))->Fill(iv0,multCorC);
93db93de 296
297 } else {
298
299 Double_t multCorA = -10;
300
301 if (iv0 >= 32 && iv0 < 40)
302 multCorA = multv0*fV0Apol1/fMultV0->GetBinContent(iv0+1);
303 else if (iv0 >= 40 && iv0 < 48)
304 multCorA = multv0*fV0Apol2/fMultV0->GetBinContent(iv0+1);
305 else if (iv0 >= 48 && iv0 < 56)
306 multCorA = multv0*fV0Apol3/fMultV0->GetBinContent(iv0+1);
307 else if (iv0 >= 56 && iv0 < 64)
308 multCorA = multv0*fV0Apol4/fMultV0->GetBinContent(iv0+1);
309
310 if (multCorA < 0){
311 cout<<"Problem with multiplicity in V0A"<<endl;
48c4d28e 312 fqV0C=-999.;
313 fqV0A=-999.;
314 return -999.;
93db93de 315 }
316
317 Qxa2 += TMath::Cos(2*phiV0) * multCorA;
318 Qya2 += TMath::Sin(2*phiV0) * multCorA;
319
320 sumMa += multCorA;
23f51e78 321 ((TH2F*)fOutput->FindObject("fV0MCor"))->Fill(iv0,multCorA);
93db93de 322 }
323 }
324
325 Short_t centrV0 = GetCentrCode(fAOD);
326
6a6d2363 327 Double_t Qxamean2 = 0.;
328 Double_t Qyamean2 = 0.;
329 Double_t Qxcmean2 = 0.;
330 Double_t Qycmean2 = 0.;
331
332 if(centrV0!=-1){
333 Qxamean2 = fMeanQxa2[centrV0];
334 Qyamean2 = fMeanQya2[centrV0];
335 Qxcmean2 = fMeanQxc2[centrV0];
336 Qycmean2 = fMeanQyc2[centrV0];
337 }
93db93de 338
339 Double_t QxaCor2 = Qxa2 - Qxamean2*sumMa;
340 Double_t QyaCor2 = Qya2 - Qyamean2*sumMa;
341 Double_t QxcCor2 = Qxc2 - Qxcmean2*sumMc;
342 Double_t QycCor2 = Qyc2 - Qycmean2*sumMc;
343
fdbff5a1 344 fPsiV0A = TMath::ATan2(QyaCor2, QxaCor2)/2.;
345 fPsiV0C = TMath::ATan2(QycCor2, QxcCor2)/2.;
93db93de 346
fdbff5a1 347 ((TH2F*)fOutput->FindObject("fPsiACor"))->Fill((Float_t)fAOD->GetCentrality()->GetCentralityPercentile("V0M"), fPsiV0A);
348 ((TH2F*)fOutput->FindObject("fPsiCCor"))->Fill((Float_t)fAOD->GetCentrality()->GetCentralityPercentile("V0M"), fPsiV0C);
93db93de 349
48c4d28e 350 fqV0A = TMath::Sqrt((QxaCor2*QxaCor2 + QyaCor2*QyaCor2)/sumMa);
fdbff5a1 351 fqV0C = TMath::Sqrt((QxcCor2*QxcCor2 + QycCor2*QycCor2)/sumMc);
4fd2f0ad
LM
352 fqV0Ax = QxaCor2*TMath::Sqrt(1./sumMa);
353 fqV0Cx = QxcCor2*TMath::Sqrt(1./sumMc);
354 fqV0Ay = QyaCor2*TMath::Sqrt(1./sumMa);
355 fqV0Cy = QycCor2*TMath::Sqrt(1./sumMc);
48c4d28e 356
357 ((TH2F*)fOutput->FindObject("fQVecACor"))->Fill((Float_t)fAOD->GetCentrality()->GetCentralityPercentile("V0M"), fqV0A);
358 ((TH2F*)fOutput->FindObject("fQVecCCor"))->Fill((Float_t)fAOD->GetCentrality()->GetCentralityPercentile("V0M"), fqV0C);
93db93de 359
fdbff5a1 360 return fqV0A; //FIXME we have to combine VZERO-A and C
93db93de 361}
362
fdbff5a1 363//______________________________________________________
93db93de 364Short_t AliSpectraAODEventCuts::GetCentrCode(AliVEvent* ev)
365{
366
367 Short_t centrCode = -1;
368
369 AliCentrality* centrality = 0;
370 AliAODEvent* aod = (AliAODEvent*)ev;
371 centrality = aod->GetHeader()->GetCentralityP();
372
373 Float_t centV0 = centrality->GetCentralityPercentile("V0M");
374 Float_t centTrk = centrality->GetCentralityPercentile("TRK");
375
376
377 if (TMath::Abs(centV0 - centTrk) < 5.0 && centV0 <= 80 && centV0 > 0){
378
379 if ((centV0 > 0) && (centV0 <= 5.0))
380 centrCode = 0;
381 else if ((centV0 > 5.0) && (centV0 <= 10.0))
382 centrCode = 1;
383 else if ((centV0 > 10.0) && (centV0 <= 20.0))
384 centrCode = 2;
385 else if ((centV0 > 20.0) && (centV0 <= 30.0))
386 centrCode = 3;
387 else if ((centV0 > 30.0) && (centV0 <= 40.0))
388 centrCode = 4;
389 else if ((centV0 > 40.0) && (centV0 <= 50.0))
390 centrCode = 5;
391 else if ((centV0 > 50.0) && (centV0 <= 60.0))
392 centrCode = 6;
393 else if ((centV0 > 60.0) && (centV0 <= 70.0))
394 centrCode = 7;
395 else if ((centV0 > 70.0) && (centV0 <= 80.0))
396 centrCode = 8;
397 }
398
399 return centrCode;
400
401}
402
c88234ad 403//______________________________________________________
404void AliSpectraAODEventCuts::PrintCuts()
405{
f6a38178 406 // print info about event cuts
407 cout << "Event Stats" << endl;
93db93de 408 cout << " > Trigger Selection: " << fSelectBit << endl;
409 cout << " > Centrality estimator: " << fCentralityMethod << endl;
410 cout << " > Number of accepted events: " << NumberOfEvents() << endl;
411 cout << " > Number of processed events: " << NumberOfProcessedEvents() << endl;
412 cout << " > Number of PhysSel events: " << NumberOfPhysSelEvents() << endl;
413 cout << " > Vertex out of range: " << ((TH1I*)fOutput->FindObject("fHistoCuts"))->GetBinContent(kVtxRange + 1) << endl;
414 cout << " > Events cut by centrality: " << ((TH1I*)fOutput->FindObject("fHistoCuts"))->GetBinContent(kVtxCentral + 1) << endl;
415 cout << " > Events without vertex: " << ((TH1I*)fOutput->FindObject("fHistoCuts"))->GetBinContent(kVtxNoEvent + 1) << endl;
416 cout << " > QVector cut: " << ((TH1I*)fOutput->FindObject("fHistoCuts"))->GetBinContent(kQVector + 1) << endl;
829b5a81 417 cout << " > Track type used for the QVector calculation: " << fTrackBits << endl;
16ee3540 418 cout << " > QRange: [" << fQVectorCutMin <<"," <<fQVectorCutMax<<"]"<< endl;
10a8ccbe 419 cout << " > Vertex: [" << fVertexCutMin <<"," <<fVertexCutMax<<"]"<< endl;
420 cout << " > Multiplicity: [" << fMultiplicityCutMin <<"," <<fMultiplicityCutMax<<"]"<< endl;
829b5a81 421 cout << " > Centrality: [" << fCentralityCutMin <<"," <<fCentralityCutMax<<"]"<< endl;
f6a38178 422}
c88234ad 423
93db93de 424//_____________________________________________________________________________
425Bool_t AliSpectraAODEventCuts::OpenInfoCalbration(Int_t run)
972a21ad 426{
93db93de 427
428 AliOADBContainer* cont = (AliOADBContainer*) fCalib->FindObject("hMultV0BefCorr");
429 if(!cont){
430 printf("OADB object hMultV0BefCorr is not available in the file\n");
431 return 0;
432 }
433
434 if(!(cont->GetObject(run))){
435 printf("OADB object hMultV0BefCorr is not available for run %i\n",run);
436 return 0;
437 }
438 fMultV0 = ((TH2F*) cont->GetObject(run))->ProfileX();
439
440 TF1* fpolc1 = new TF1("fpolc1","pol0", 0, 7);
441 fMultV0->Fit(fpolc1, "RN");
442 fV0Cpol1 = fpolc1->GetParameter(0);
443
444 TF1* fpolc2 = new TF1("fpolc2","pol0", 8, 15);
445 fMultV0->Fit(fpolc2, "RN");
446 fV0Cpol2 = fpolc2->GetParameter(0);
447
448 TF1* fpolc3 = new TF1("fpolc3","pol0", 16, 23);
449 fMultV0->Fit(fpolc3, "RN");
450 fV0Cpol3 = fpolc3->GetParameter(0);
451
452 TF1* fpolc4 = new TF1("fpolc4","pol0", 24, 31);
453 fMultV0->Fit(fpolc4, "RN");
454 fV0Cpol4 = fpolc4->GetParameter(0);
455
456 TF1* fpola1 = new TF1("fpola1","pol0", 32, 39);
6a6d2363 457 fMultV0->Fit(fpola1, "RN");
93db93de 458 fV0Apol1 = fpola1->GetParameter(0);
459
460 TF1* fpola2 = new TF1("fpola2","pol0", 40, 47);
461 fMultV0->Fit(fpola2, "RN");
462 fV0Apol2 = fpola2->GetParameter(0);
a162b3e2 463
93db93de 464 TF1* fpola3 = new TF1("fpola3","pol0", 48, 55);
465 fMultV0->Fit(fpola3, "RN");
466 fV0Apol3 = fpola3->GetParameter(0);
467
468 TF1* fpola4 = new TF1("fpola4","pol0", 56, 63);
469 fMultV0->Fit(fpola4, "RN");
470 fV0Apol4 = fpola4->GetParameter(0);
471
93db93de 472 for(Int_t i=0; i < 10; i++){
473
474 char nameQxa2[100];
6a6d2363 475 snprintf(nameQxa2,100, "hQxa2m_%i", i);
93db93de 476
477 char nameQya2[100];
6a6d2363 478 snprintf(nameQya2,100, "hQya2m_%i", i);
93db93de 479
480 char nameQxc2[100];
6a6d2363 481 snprintf(nameQxc2,100, "hQxc2m_%i", i);
93db93de 482
483 char nameQyc2[100];
6a6d2363 484 snprintf(nameQyc2,100, "hQyc2m_%i", i);
93db93de 485
486 AliOADBContainer* contQxa2 = (AliOADBContainer*) fCalib->FindObject(nameQxa2);
487 if(!contQxa2){
488 printf("OADB object %s is not available in the file\n", nameQxa2);
489 return 0;
490 }
491
492 if(!(contQxa2->GetObject(run))){
493 printf("OADB object %s is not available for run %i\n", nameQxa2, run);
494 return 0;
495 }
496
497 fMeanQxa2[i] = ((TH1F*) contQxa2->GetObject(run))->GetMean();
498
499
500 AliOADBContainer* contQya2 = (AliOADBContainer*) fCalib->FindObject(nameQya2);
501 if(!contQya2){
502 printf("OADB object %s is not available in the file\n", nameQya2);
503 return 0;
504 }
505
506 if(!(contQya2->GetObject(run))){
507 printf("OADB object %s is not available for run %i\n", nameQya2, run);
508 return 0;
509 }
510
511 fMeanQya2[i] = ((TH1F*) contQya2->GetObject(run))->GetMean();
512
513
514 AliOADBContainer* contQxc2 = (AliOADBContainer*) fCalib->FindObject(nameQxc2);
515 if(!contQxc2){
516 printf("OADB object %s is not available in the file\n", nameQxc2);
517 return 0;
518 }
519
520 if(!(contQxc2->GetObject(run))){
521 printf("OADB object %s is not available for run %i\n", nameQxc2, run);
522 return 0;
523 }
524
525 fMeanQxc2[i] = ((TH1F*) contQxc2->GetObject(run))->GetMean();
526
527
528 AliOADBContainer* contQyc2 = (AliOADBContainer*) fCalib->FindObject(nameQyc2);
529 if(!contQyc2){
530 printf("OADB object %s is not available in the file\n", nameQyc2);
531 return 0;
532 }
533
534 if(!(contQyc2->GetObject(run))){
535 printf("OADB object %s is not available for run %i\n", nameQyc2, run);
536 return 0;
537 }
538
539 fMeanQyc2[i] = ((TH1F*) contQyc2->GetObject(run))->GetMean();
540
541 }
542 return 1;
972a21ad 543}
544
545//______________________________________________________
546
547
c88234ad 548Long64_t AliSpectraAODEventCuts::Merge(TCollection* list)
549{
550 // Merge a list of AliSpectraAODEventCuts objects with this.
551 // Returns the number of merged objects (including this).
93db93de 552
553 AliInfo("Merging");
554
c88234ad 555 if (!list)
556 return 0;
557
558 if (list->IsEmpty())
559 return 1;
93db93de 560
c88234ad 561 TIterator* iter = list->MakeIterator();
562 TObject* obj;
93db93de 563
c88234ad 564 // collections of all histograms
93db93de 565 TList collections;
566
c88234ad 567 Int_t count = 0;
568
569 while ((obj = iter->Next())) {
570 AliSpectraAODEventCuts* entry = dynamic_cast<AliSpectraAODEventCuts*> (obj);
571 if (entry == 0)
572 continue;
573
93db93de 574 TList * l = entry->GetOutputList();
575 collections.Add(l);
c88234ad 576 count++;
577 }
578
93db93de 579 fOutput->Merge(&collections);
c88234ad 580
581 delete iter;
582
583 return count+1;
584}
585