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