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