]>
Commit | Line | Data |
---|---|---|
b2a297fa | 1 | /************************************************************************* |
2 | * Copyright(c) 1998-2009, 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 | ||
16 | /////////////////////////////////////////////////////////////////////////// | |
17 | // // | |
18 | // Basic Analysis Task // | |
19 | // // | |
20 | /////////////////////////////////////////////////////////////////////////// | |
21 | ||
22 | #include <TChain.h> | |
61d106d3 | 23 | #include <TH1D.h> |
b2a297fa | 24 | |
25 | #include <AliCFContainer.h> | |
572b0139 | 26 | #include <AliInputEventHandler.h> |
27 | #include <AliESDInputHandler.h> | |
28 | #include <AliAnalysisManager.h> | |
b2a297fa | 29 | #include <AliVEvent.h> |
30 | ||
31 | #include "AliDielectron.h" | |
32 | #include "AliDielectronHistos.h" | |
33 | #include "AliDielectronCF.h" | |
572b0139 | 34 | #include "AliDielectronMC.h" |
b2a297fa | 35 | #include "AliAnalysisTaskMultiDielectron.h" |
36 | ||
37 | ClassImp(AliAnalysisTaskMultiDielectron) | |
38 | ||
39 | //_________________________________________________________________________________ | |
40 | AliAnalysisTaskMultiDielectron::AliAnalysisTaskMultiDielectron() : | |
41 | AliAnalysisTaskSE(), | |
42 | fListDielectron(), | |
43 | fListHistos(), | |
572b0139 | 44 | fListCF(), |
61d106d3 | 45 | fSelectPhysics(kFALSE), |
46 | fTriggerMask(AliVEvent::kMB), | |
47 | fEventStat(0x0) | |
b2a297fa | 48 | { |
49 | // | |
50 | // Constructor | |
51 | // | |
52 | } | |
53 | ||
54 | //_________________________________________________________________________________ | |
55 | AliAnalysisTaskMultiDielectron::AliAnalysisTaskMultiDielectron(const char *name) : | |
56 | AliAnalysisTaskSE(name), | |
57 | fListDielectron(), | |
58 | fListHistos(), | |
572b0139 | 59 | fListCF(), |
61d106d3 | 60 | fSelectPhysics(kFALSE), |
61 | fTriggerMask(AliVEvent::kMB), | |
62 | fEventStat(0x0) | |
b2a297fa | 63 | { |
64 | // | |
65 | // Constructor | |
66 | // | |
67 | DefineInput(0,TChain::Class()); | |
68 | DefineOutput(1, TList::Class()); | |
69 | DefineOutput(2, TList::Class()); | |
61d106d3 | 70 | DefineOutput(3, TH1D::Class()); |
b2a297fa | 71 | fListHistos.SetName("Dielectron_Histos_Multi"); |
72 | fListCF.SetName("Dielectron_CF_Multi"); | |
73 | } | |
74 | ||
75 | ||
76 | //_________________________________________________________________________________ | |
77 | void AliAnalysisTaskMultiDielectron::UserCreateOutputObjects() | |
78 | { | |
79 | // | |
80 | // Add all histogram manager histogram lists to the output TList | |
81 | // | |
82 | ||
572b0139 | 83 | if (!fListHistos.IsEmpty()||!fListCF.IsEmpty()) return; //already initialised |
b2a297fa | 84 | |
85 | TIter nextDie(&fListDielectron); | |
86 | AliDielectron *die=0; | |
87 | while ( (die=static_cast<AliDielectron*>(nextDie())) ){ | |
88 | die->Init(); | |
89 | if (die->GetHistogramList()) fListHistos.Add(const_cast<THashList*>(die->GetHistogramList())); | |
90 | if (die->GetCFManagerPair()) fListCF.Add(const_cast<AliCFContainer*>(die->GetCFManagerPair()->GetContainer())); | |
91 | } | |
61d106d3 | 92 | |
93 | if (!fEventStat){ | |
94 | fEventStat=new TH1D("hEventStat","Event statistics",5,0,5); | |
95 | fEventStat->GetXaxis()->SetBinLabel(1,"Before Phys. Sel."); | |
96 | fEventStat->GetXaxis()->SetBinLabel(2,"After Phys. Sel."); | |
97 | } | |
98 | ||
99 | PostData(1, &fListHistos); | |
100 | PostData(2, &fListCF); | |
101 | PostData(3, fEventStat); | |
b2a297fa | 102 | } |
103 | ||
104 | //_________________________________________________________________________________ | |
105 | void AliAnalysisTaskMultiDielectron::UserExec(Option_t *) | |
106 | { | |
107 | // | |
108 | // Main loop. Called for every event | |
109 | // | |
110 | ||
572b0139 | 111 | if (fListHistos.IsEmpty()&&fListCF.IsEmpty()) return; |
112 | ||
113 | AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager(); | |
114 | AliESDInputHandler *esdHandler=0x0; | |
115 | if ( (esdHandler=dynamic_cast<AliESDInputHandler*>(man->GetInputEventHandler())) && esdHandler->GetESDpid() ){ | |
116 | AliDielectronVarManager::SetESDpid(esdHandler->GetESDpid()); | |
117 | } else { | |
118 | //load esd pid bethe bloch parameters depending on the existance of the MC handler | |
119 | // yes: MC parameters | |
120 | // no: data parameters | |
121 | if (!AliDielectronVarManager::GetESDpid()){ | |
122 | if (AliDielectronMC::Instance()->HasMC()) { | |
123 | AliDielectronVarManager::InitESDpid(); | |
124 | } else { | |
125 | AliDielectronVarManager::InitESDpid(1); | |
126 | } | |
127 | } | |
128 | } | |
129 | // Was event selected ? | |
130 | AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler()); | |
61d106d3 | 131 | UInt_t isSelected = AliVEvent::kAny; |
572b0139 | 132 | if( fSelectPhysics && inputHandler && inputHandler->GetEventSelection() ) { |
133 | isSelected = inputHandler->IsEventSelected(); | |
61d106d3 | 134 | isSelected&=fTriggerMask; |
572b0139 | 135 | } |
136 | ||
61d106d3 | 137 | //Before physics selection |
138 | fEventStat->Fill(0.); | |
139 | if (isSelected==0) { | |
140 | PostData(3,fEventStat); | |
141 | return; | |
142 | } | |
143 | //after physics selection | |
144 | fEventStat->Fill(1.); | |
b2a297fa | 145 | |
146 | //bz for AliKF | |
147 | Double_t bz = InputEvent()->GetMagneticField(); | |
148 | AliKFParticle::SetField( bz ); | |
149 | ||
150 | //Process event in all AliDielectron instances | |
151 | TIter nextDie(&fListDielectron); | |
152 | AliDielectron *die=0; | |
153 | while ( (die=static_cast<AliDielectron*>(nextDie())) ){ | |
b2a297fa | 154 | die->Process(InputEvent()); |
b2a297fa | 155 | } |
156 | ||
157 | PostData(1, &fListHistos); | |
158 | PostData(2, &fListCF); | |
61d106d3 | 159 | PostData(3,fEventStat); |
b2a297fa | 160 | } |
161 | ||
572b0139 | 162 | //_________________________________________________________________________________ |
163 | void AliAnalysisTaskMultiDielectron::FinishTaskOutput() | |
164 | { | |
165 | // | |
166 | // Write debug tree | |
167 | // | |
168 | TIter nextDie(&fListDielectron); | |
169 | AliDielectron *die=0; | |
170 | while ( (die=static_cast<AliDielectron*>(nextDie())) ){ | |
171 | die->SaveDebugTree(); | |
172 | } | |
173 | } | |
174 |