]>
Commit | Line | Data |
---|---|---|
1c5acb87 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, 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 | // An analysis task to check the trigger data in ESD | |
18 | // Creates an ntuple for 2x2 and NxN triggers | |
19 | // Each ntuple connects the maximum trigger amplitudes | |
20 | // and its positions with reconstructed clusters | |
6639984f | 21 | // and if MC stack available, with pt of parent. |
1c5acb87 | 22 | // |
23 | //*-- Yves Schutz (CERN) & Gustavo Conesa Balbastre (INFN-LNF) | |
24 | ////////////////////////////////////////////////////////////////////////////// | |
6639984f | 25 | //Root |
1c5acb87 | 26 | #include <TNtuple.h> |
27 | #include <TVector3.h> | |
28 | ||
6639984f | 29 | //Aliroot |
1c5acb87 | 30 | #include "AliAnaCaloTrigger.h" |
6639984f | 31 | #include "AliStack.h" |
1c5acb87 | 32 | #include "AliLog.h" |
33 | #include "AliESDCaloCluster.h" | |
6639984f | 34 | #include "AliMCEvent.h" |
35 | #include "AliESDEvent.h" | |
1c5acb87 | 36 | |
37 | //______________________________________________________________________________ | |
38 | AliAnaCaloTrigger::AliAnaCaloTrigger() : | |
1c5acb87 | 39 | fOutputContainer(0), |
40 | fCalorimeter("PHOS"), | |
41 | fNtTrigger22(0), | |
42 | fNtTriggerNN(0) | |
43 | ||
44 | { | |
45 | // Default Constructor. | |
46 | ||
47 | } | |
48 | ||
49 | //______________________________________________________________________________ | |
50 | AliAnaCaloTrigger::AliAnaCaloTrigger(const char *name) : | |
6639984f | 51 | AliAnalysisTaskSE(name), |
1c5acb87 | 52 | fOutputContainer(0), |
53 | fCalorimeter("PHOS"), | |
54 | fNtTrigger22(0), | |
55 | fNtTriggerNN(0) | |
56 | ||
57 | { | |
58 | // Constructor. | |
6639984f | 59 | // Output slot |
60 | DefineOutput(1, TList::Class()) ; | |
1c5acb87 | 61 | } |
6639984f | 62 | |
1c5acb87 | 63 | //____________________________________________________________________________ |
64 | AliAnaCaloTrigger::AliAnaCaloTrigger(const AliAnaCaloTrigger & ct) : | |
6639984f | 65 | AliAnalysisTaskSE(ct.GetName()), |
1c5acb87 | 66 | fOutputContainer(ct.fOutputContainer), fCalorimeter(ct. fCalorimeter), |
67 | fNtTrigger22(ct.fNtTrigger22), fNtTriggerNN(ct.fNtTriggerNN) | |
68 | { | |
69 | ||
70 | // cpy ctor | |
6639984f | 71 | |
1c5acb87 | 72 | } |
73 | ||
74 | //_________________________________________________________________________ | |
75 | AliAnaCaloTrigger & AliAnaCaloTrigger::operator = (const AliAnaCaloTrigger & source) | |
76 | { | |
77 | // assignment operator | |
78 | ||
6639984f | 79 | //if(&source == this) return *this; |
80 | this->~AliAnaCaloTrigger(); | |
81 | new(this) AliAnaCaloTrigger(source); | |
1c5acb87 | 82 | |
1c5acb87 | 83 | fOutputContainer = source.fOutputContainer ; |
84 | fCalorimeter = source. fCalorimeter ; | |
85 | fNtTrigger22 = source.fNtTrigger22 ; | |
86 | fNtTriggerNN = source.fNtTriggerNN ; | |
87 | ||
88 | return *this; | |
89 | ||
90 | } | |
91 | ||
92 | //______________________________________________________________________________ | |
93 | AliAnaCaloTrigger::~AliAnaCaloTrigger() | |
94 | { | |
95 | // dtor | |
6639984f | 96 | if(fOutputContainer){ |
97 | fOutputContainer->Clear() ; | |
98 | delete fOutputContainer ; | |
99 | } | |
1c5acb87 | 100 | } |
101 | ||
102 | ||
1c5acb87 | 103 | //________________________________________________________________________ |
104 | ||
6639984f | 105 | void AliAnaCaloTrigger::UserCreateOutputObjects() |
1c5acb87 | 106 | { |
107 | ||
108 | // Create the outputs containers | |
6639984f | 109 | OpenFile(1) ; |
1c5acb87 | 110 | |
111 | // create histograms | |
6639984f | 112 | fNtTrigger22 = new TNtuple(fCalorimeter+"trigger22", "Trigger data 2x2 patch", "a22:a220:ptGen:enMax:phEnMax:eta22:phi22:etaMax:phiMax:phEtaMax:phPhiMax"); |
113 | fNtTriggerNN = new TNtuple(fCalorimeter+"triggerNN", "Trigger data NxN patch", "aNN:aNN0:ptGen:enMax:phEnMax:etaNN:phiNN:etaMax:phiMax:phEtaMax:phPhiMax"); | |
1c5acb87 | 114 | |
115 | // create output container | |
116 | ||
6639984f | 117 | fOutputContainer = new TList() ; |
1c5acb87 | 118 | fOutputContainer->SetName(GetName()) ; |
119 | ||
120 | fOutputContainer->AddAt(fNtTrigger22, 0) ; | |
121 | fOutputContainer->AddAt(fNtTriggerNN, 1) ; | |
122 | ||
123 | } | |
124 | ||
125 | //______________________________________________________________________________ | |
6639984f | 126 | void AliAnaCaloTrigger::UserExec(Option_t *) |
1c5acb87 | 127 | { |
6639984f | 128 | // Processing of one event |
129 | ||
130 | if ( !((Entry()-1)%100) ) | |
131 | printf(" Processing event # %lld\n", Entry()) ; | |
132 | AliESDEvent* esd = (AliESDEvent*)InputEvent(); | |
133 | ||
134 | //Get MC data, if available | |
135 | AliStack* stack = 0x0; | |
136 | if(MCEvent()) | |
137 | stack = MCEvent()->Stack(); | |
138 | ||
139 | // Get trigger information of fCalorimeter | |
140 | TArrayF * triggerAmplitudes = 0x0 ; | |
141 | TArrayF * triggerPosition = 0x0 ; | |
142 | Int_t numberOfCaloClusters = esd->GetNumberOfCaloClusters() ; | |
143 | ||
144 | if(fCalorimeter == "PHOS"){ | |
145 | triggerAmplitudes = esd->GetPHOSTriggerAmplitudes(); | |
146 | triggerPosition = esd->GetPHOSTriggerPosition(); | |
1c5acb87 | 147 | } |
6639984f | 148 | else if(fCalorimeter == "EMCAL"){ |
149 | triggerAmplitudes = esd->GetEMCALTriggerAmplitudes(); | |
150 | triggerPosition = esd->GetEMCALTriggerPosition(); | |
151 | } | |
152 | ||
153 | if( triggerAmplitudes && triggerPosition ){ | |
154 | // trigger amplitudes | |
155 | const Float_t ka22 = static_cast<Float_t>(triggerAmplitudes->At(0)) ; | |
156 | const Float_t ka22O = static_cast<Float_t>(triggerAmplitudes->At(1)) ; | |
157 | const Float_t kaNN = static_cast<Float_t>(triggerAmplitudes->At(2)) ; | |
158 | const Float_t kaNNO = static_cast<Float_t>(triggerAmplitudes->At(3)) ; | |
159 | ||
160 | // trigger position | |
161 | const Float_t kx22 = static_cast<Float_t>(triggerPosition->At(0)) ; | |
162 | const Float_t ky22 = static_cast<Float_t>(triggerPosition->At(1)) ; | |
163 | const Float_t kz22 = static_cast<Float_t>(triggerPosition->At(2)) ; | |
164 | const Float_t kxNN = static_cast<Float_t>(triggerPosition->At(3)) ; | |
165 | const Float_t kyNN = static_cast<Float_t>(triggerPosition->At(4)) ; | |
166 | const Float_t kzNN = static_cast<Float_t>(triggerPosition->At(5)) ; | |
167 | ||
168 | //printf("ka22 %f, ka220 %f, kaNN %f, kaNN0 %f\n",ka22,ka22O,kaNN,kaNNO); | |
169 | //printf("kx22 %f, ky22 %f, kz22 %f, kxNN %f, kyNN %f, kzNN %f \n",kx22,ky22,kz22,kxNN,kyNN,kzNN); | |
170 | ||
171 | Float_t enMax = 0. ; | |
172 | Float_t phEnMax = 0. ; | |
173 | Float_t etaMax = 0.5 ; | |
174 | Float_t phiMax = 0. ; | |
175 | Float_t phEtaMax = 0.5 ; | |
176 | Float_t phPhiMax = 0. ; | |
177 | ||
178 | TVector3 vpos22(kx22, ky22, kz22) ; | |
179 | TVector3 vposNN(kxNN, kyNN, kzNN) ; | |
180 | Float_t eta22 = vpos22.Eta() ; | |
181 | Float_t phi22 = vpos22.Phi() * TMath::RadToDeg() + 360. ; | |
182 | Float_t etaNN = vposNN.Eta() ; | |
183 | Float_t phiNN = vposNN.Phi() * TMath::RadToDeg() + 360. ; | |
184 | ||
185 | ||
186 | Int_t icaloCluster = 0 ; | |
187 | Int_t labelmax = -1 ; | |
188 | // loop over the Calorimeters Clusters | |
189 | ||
190 | for(icaloCluster = 0 ; icaloCluster < numberOfCaloClusters ; icaloCluster++) { | |
191 | ||
192 | AliESDCaloCluster * cluster = esd->GetCaloCluster(icaloCluster) ; | |
193 | ||
194 | if (cluster && ( (fCalorimeter == "PHOS" && cluster->IsPHOS()) || | |
195 | (fCalorimeter == "EMCAL" && cluster->IsEMCAL()))) { | |
196 | ||
197 | Float_t cluEnergy = cluster->E() ; | |
198 | Float_t pos[3] ; | |
199 | TVector3 vpos ; | |
200 | ||
201 | cluster->GetPosition( pos ) ; | |
202 | ||
203 | if ( cluEnergy > enMax) { | |
204 | enMax = cluEnergy ; | |
205 | vpos.SetXYZ(pos[0], pos[1], pos[2]) ; | |
206 | etaMax = vpos.Eta() ; | |
207 | phiMax = vpos.Phi() ; | |
208 | labelmax = cluster->GetLabel(); | |
209 | } | |
210 | ||
211 | Double_t * pid = cluster->GetPid() ; | |
212 | ||
213 | if(pid[AliPID::kPhoton] > 0.9) { | |
214 | if ( cluEnergy > phEnMax) { | |
215 | phEnMax = cluEnergy ; | |
216 | vpos.SetXYZ(pos[0], pos[1], pos[2]) ; | |
217 | phEtaMax = vpos.Eta() ; | |
218 | phPhiMax = vpos.Phi() ; | |
219 | } | |
220 | } | |
221 | }//if cluster | |
222 | ||
223 | Float_t ptGen = -1; | |
224 | if(stack && labelmax < stack->GetNtrack() && labelmax >= 0 ){ | |
225 | TParticle * particle = stack->Particle(labelmax); | |
226 | ptGen = particle->Energy(); | |
227 | } | |
228 | ||
229 | fNtTrigger22->Fill(ka22, ka22O, ptGen, enMax, phEnMax, eta22, phi22, etaMax, phiMax * TMath::RadToDeg() + 360., phEtaMax, phPhiMax * TMath::RadToDeg() + 360.); | |
230 | fNtTriggerNN->Fill(kaNN, kaNNO, ptGen, enMax, phEnMax, etaNN, phiNN, etaMax, phiMax * TMath::RadToDeg() + 360., phEtaMax, phPhiMax * TMath::RadToDeg() + 360.); | |
231 | ||
232 | }//CaloCluster loop | |
233 | ||
234 | }//If trigger arrays filled | |
235 | ||
236 | PostData(1, fOutputContainer); | |
237 | ||
1c5acb87 | 238 | } |
239 | ||
240 | //______________________________________________________________________________ | |
241 | //void AliAnaCaloTrigger::Terminate(Option_t *) const | |
242 | //{ | |
243 | // // Processing when the event loop is ended | |
244 | // | |
245 | //} |