]>
Commit | Line | Data |
---|---|---|
d42843d3 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2008, 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 | // Class to analyze ZDC data // | |
19 | // // | |
20 | ///////////////////////////////////////////////////////////// | |
21 | ||
22 | #include <TList.h> | |
23 | #include <TH2F.h> | |
24 | #include <TH1F.h> | |
25 | #include <TFile.h> | |
26 | #include <TString.h> | |
27 | ||
28 | #include "AliAnalysisManager.h" | |
29 | #include "AliInputEventHandler.h" | |
30 | #include "AliVEvent.h" | |
31 | #include "AliESD.h" | |
32 | #include "AliESDEvent.h" | |
33 | #include "AliESDHeader.h" | |
34 | #include "AliESDInputHandler.h" | |
35 | #include "AliESDZDC.h" | |
36 | #include "AliMultiplicity.h" | |
37 | #include "AliAODHandler.h" | |
38 | #include "AliAODEvent.h" | |
39 | #include "AliAODVertex.h" | |
40 | #include "AliAODMCHeader.h" | |
41 | #include "AliMCEventHandler.h" | |
42 | #include "AliMCEvent.h" | |
43 | #include "AliHeader.h" | |
44 | #include "AliAODMCParticle.h" | |
45 | #include "AliAnalysisTaskSE.h" | |
46 | #include "AliGenEventHeader.h" | |
47 | #include "AliGenHijingEventHeader.h" | |
48 | #include "AliPhysicsSelectionTask.h" | |
49 | #include "AliPhysicsSelection.h" | |
50 | #include "AliBackgroundSelection.h" | |
51 | #include "AliTriggerAnalysis.h" | |
52 | #include "AliCentrality.h" | |
53 | #include "AliAnalysisTaskZDC.h" | |
54 | ||
55 | ClassImp(AliAnalysisTaskZDC) | |
56 | ||
57 | ||
58 | //________________________________________________________________________ | |
59 | AliAnalysisTaskZDC::AliAnalysisTaskZDC(): | |
60 | AliAnalysisTaskSE(), | |
61 | fDebug(0), | |
62 | fIsMCInput(kFALSE), | |
63 | fOutput(0x0), | |
64 | fhTDCZNSum(0x0), | |
65 | fhTDCZNDiff(0x0), | |
66 | fhZNCSpectrum(0x0), | |
67 | fhZNASpectrum(0x0), | |
68 | fhZPCSpectrum(0x0), | |
69 | fhZPASpectrum(0x0), | |
70 | fhZEM1Spectrum(0x0), | |
71 | fhZEM2Spectrum(0x0), | |
72 | fhZNCpmc(0x0), | |
73 | fhZNApmc(0x0), | |
74 | fhZPCpmc(0x0), | |
75 | fhZPApmc(0x0), | |
76 | fhZNCCentroid(0x0), | |
77 | fhZNACentroid(0x0), | |
78 | fhZNCemd(0x0), | |
79 | fhZNAemd(0x0), | |
80 | fhPMCZNCemd(0x0), | |
81 | fhPMCZNAemd(0x0), | |
82 | fDebunch(0x0) | |
83 | { | |
84 | // Default constructor | |
85 | } | |
86 | ||
87 | //________________________________________________________________________ | |
88 | AliAnalysisTaskZDC::AliAnalysisTaskZDC(const char *name): | |
89 | AliAnalysisTaskSE(name), | |
90 | fDebug(0), | |
91 | fIsMCInput(kFALSE), | |
92 | fOutput(0x0), | |
93 | fhTDCZNSum(0x0), | |
94 | fhTDCZNDiff(0x0), | |
95 | fhZNCSpectrum(0x0), | |
96 | fhZNASpectrum(0x0), | |
97 | fhZPCSpectrum(0x0), | |
98 | fhZPASpectrum(0x0), | |
99 | fhZEM1Spectrum(0x0), | |
100 | fhZEM2Spectrum(0x0), | |
101 | fhZNCpmc(0x0), | |
102 | fhZNApmc(0x0), | |
103 | fhZPCpmc(0x0), | |
104 | fhZPApmc(0x0), | |
105 | fhZNCCentroid(0x0), | |
106 | fhZNACentroid(0x0), | |
107 | fhZNCemd(0x0), | |
108 | fhZNAemd(0x0), | |
109 | fhPMCZNCemd(0x0), | |
110 | fhPMCZNAemd(0x0), | |
111 | fDebunch(0x0) | |
112 | { | |
113 | // Output slot #1 writes into a TList container | |
114 | DefineOutput(1, TList::Class()); | |
115 | ||
116 | } | |
117 | ||
118 | //________________________________________________________________________ | |
119 | AliAnalysisTaskZDC& AliAnalysisTaskZDC::operator=(const AliAnalysisTaskZDC& c) | |
120 | { | |
121 | // | |
122 | // Assignment operator | |
123 | // | |
124 | if (this!=&c) { | |
125 | AliAnalysisTaskSE::operator=(c); | |
126 | } | |
127 | return *this; | |
128 | } | |
129 | ||
130 | //________________________________________________________________________ | |
131 | AliAnalysisTaskZDC::AliAnalysisTaskZDC(const AliAnalysisTaskZDC& ana): | |
132 | AliAnalysisTaskSE(ana), | |
133 | fDebug(ana.fDebug), | |
134 | fIsMCInput(ana.fIsMCInput), | |
135 | fOutput(ana.fOutput), | |
136 | fhTDCZNSum(ana.fhTDCZNSum), | |
137 | fhTDCZNDiff(ana.fhTDCZNDiff), | |
138 | fhZNCSpectrum(ana.fhZNCSpectrum), | |
139 | fhZNASpectrum(ana.fhZNASpectrum), | |
140 | fhZPCSpectrum(ana.fhZPCSpectrum), | |
141 | fhZPASpectrum(ana.fhZPASpectrum), | |
142 | fhZEM1Spectrum(ana.fhZEM1Spectrum), | |
143 | fhZEM2Spectrum(ana.fhZEM2Spectrum), | |
144 | fhZNCpmc(ana.fhZNCpmc), | |
145 | fhZNApmc(ana.fhZNApmc), | |
146 | fhZPCpmc(ana.fhZPCpmc), | |
147 | fhZPApmc(ana.fhZPApmc), | |
148 | fhZNCCentroid(ana.fhZNCCentroid), | |
149 | fhZNACentroid(ana.fhZNACentroid), | |
150 | fhZNCemd(ana.fhZNCemd), | |
151 | fhZNAemd(ana.fhZNAemd), | |
152 | fhPMCZNCemd(ana.fhPMCZNCemd), | |
153 | fhPMCZNAemd(ana.fhPMCZNAemd), | |
154 | fDebunch(ana.fDebunch) | |
155 | { | |
156 | // | |
157 | // Copy Constructor | |
158 | // | |
159 | } | |
160 | ||
161 | //________________________________________________________________________ | |
162 | AliAnalysisTaskZDC::~AliAnalysisTaskZDC() | |
163 | { | |
164 | // Destructor | |
165 | if(fOutput && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()){ | |
166 | delete fOutput; fOutput=0; | |
167 | } | |
168 | ||
169 | } | |
170 | ||
171 | //________________________________________________________________________ | |
172 | void AliAnalysisTaskZDC::UserCreateOutputObjects() | |
173 | { | |
174 | // Create the output containers | |
175 | ||
176 | fOutput = new TList; | |
177 | fOutput->SetOwner(); | |
178 | //fOutput->SetName("output"); | |
179 | ||
a81cad3f | 180 | fhTDCZNSum = new TH1F("fhTDCZNSum","TDC_{ZNC}+TDC_{ZNA}",60,-100.,-40.); |
d42843d3 | 181 | fhTDCZNSum->GetXaxis()->SetTitle("TDC_{ZNC}+TDC_{ZNA} (ns)"); |
182 | fOutput->Add(fhTDCZNSum); | |
183 | ||
184 | fhTDCZNDiff = new TH1F("fhTDCZNDiff","TDC_{ZNC}-TDC_{ZNA}",60,-30.,30.); | |
185 | fhTDCZNDiff->GetXaxis()->SetTitle("TDC_{ZNC}-TDC_{ZNA} (ns)"); | |
186 | fOutput->Add(fhTDCZNDiff); | |
187 | ||
a81cad3f | 188 | fhZNCSpectrum = new TH1F("fhZNCSpectrum", "ZNC signal", 200,0., 140000.); |
d42843d3 | 189 | fOutput->Add(fhZNCSpectrum); |
a81cad3f | 190 | fhZNASpectrum = new TH1F("fhZNASpectrum", "ZNA signal", 200,0., 140000.) ; |
d42843d3 | 191 | fOutput->Add(fhZNASpectrum); |
a81cad3f | 192 | fhZPCSpectrum = new TH1F("fhZPCSpectrum", "ZPC signal", 200,0., 50000.) ; |
d42843d3 | 193 | fOutput->Add(fhZPCSpectrum); |
a81cad3f | 194 | fhZPASpectrum = new TH1F("fhZPASpectrum", "ZPA signal", 200,0., 50000.) ; |
d42843d3 | 195 | fOutput->Add(fhZPASpectrum); |
196 | fhZEM1Spectrum = new TH1F("fhZEM1Spectrum", "ZEM1 signal", 100,0., 2500.); | |
197 | fOutput->Add(fhZEM1Spectrum); | |
198 | fhZEM2Spectrum = new TH1F("fhZEM2Spectrum", "ZEM2 signal", 100,0., 2500.); | |
199 | fOutput->Add(fhZEM2Spectrum); | |
200 | ||
a81cad3f | 201 | fhZNCpmc = new TH1F("fhZNCpmc","ZNC PMC",200, 0., 160000.); |
d42843d3 | 202 | fOutput->Add(fhZNCpmc); |
a81cad3f | 203 | fhZNApmc = new TH1F("fhZNApmc","ZNA PMC",200, 0., 160000.); |
d42843d3 | 204 | fOutput->Add(fhZNApmc); |
a81cad3f | 205 | fhZPCpmc = new TH1F("fhZPCpmc","ZPC PMC",200, 0., 40000.); |
d42843d3 | 206 | fOutput->Add(fhZPCpmc); |
a81cad3f | 207 | fhZPApmc = new TH1F("fhZPApmc","ZPA PMC",200, 0., 40000.); |
d42843d3 | 208 | fOutput->Add(fhZPApmc); |
209 | ||
210 | fhZNCCentroid = new TH2F("fhZNCCentroid","Centroid over ZNC",70,-3.5,3.5,70,-3.5,3.5); | |
211 | fOutput->Add(fhZNCCentroid); | |
212 | fhZNACentroid = new TH2F("fhZNACentroid","Centroid over ZNA",70,-3.5,3.5,70,-3.5,3.5); | |
213 | fOutput->Add(fhZNACentroid); | |
214 | ||
a81cad3f | 215 | fhZNCemd = new TH1F("fhZNCemd","ZNC signal lg",200,0.,6000.); |
d42843d3 | 216 | fOutput->Add(fhZNCemd); |
a81cad3f | 217 | fhZNAemd = new TH1F("fhZNAemd","ZNA signal lg",200,0.,6000.); |
d42843d3 | 218 | fOutput->Add(fhZNAemd); |
a81cad3f | 219 | fhPMCZNCemd = new TH1F("fhPMCZNCemd","ZNC PMC lg",200, 10., 6000.); |
d42843d3 | 220 | fOutput->Add(fhPMCZNCemd); |
a81cad3f | 221 | fhPMCZNAemd = new TH1F("fhPMCZNAemd","ZNA PMC lg",200, 10., 6000.); |
d42843d3 | 222 | fOutput->Add(fhPMCZNAemd); |
223 | ||
224 | fDebunch = new TH2F("fDebunch","ZN TDC sum vs. diff", 120,-30,30,120,-100,-40); | |
225 | fOutput->Add(fDebunch); | |
226 | ||
227 | PostData(1, fOutput); | |
228 | } | |
229 | ||
230 | //________________________________________________________________________ | |
231 | void AliAnalysisTaskZDC::UserExec(Option_t */*option*/) | |
232 | { | |
233 | // Execute analysis for current event: | |
234 | if(fDebug>1) printf(" **** AliAnalysisTaskZDC::UserExec() \n"); | |
235 | ||
236 | if (!InputEvent()) { | |
237 | Printf("ERROR: InputEvent not available"); | |
238 | return; | |
239 | } | |
240 | ||
241 | ||
242 | AliESDEvent* esd = dynamic_cast<AliESDEvent*> (InputEvent()); | |
37efa503 | 243 | if(!esd) return; |
d42843d3 | 244 | // Select PHYSICS events (type=7, for data) |
245 | if(!fIsMCInput && esd->GetEventType()!=7) return; | |
246 | ||
247 | // ********* MC INFO ********************************* | |
248 | if(fIsMCInput){ | |
249 | ||
250 | AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); | |
251 | if (!eventHandler) { | |
252 | Printf("ERROR: Could not retrieve MC event handler"); | |
253 | return; | |
254 | } | |
255 | ||
256 | AliMCEvent* mcEvent = eventHandler->MCEvent(); | |
257 | if (!mcEvent) { | |
258 | Printf("ERROR: Could not retrieve MC event"); | |
259 | return; | |
260 | } | |
261 | ||
262 | AliGenEventHeader* genHeader = mcEvent->GenEventHeader(); | |
263 | if(!genHeader){ | |
264 | printf(" Event generator header not available!!!\n"); | |
265 | return; | |
266 | } | |
267 | ||
5090ab18 | 268 | /*if(genHeader->InheritsFrom(AliGenHijingEventHeader::Class())){ |
d42843d3 | 269 | Float_t bMC = ((AliGenHijingEventHeader*) genHeader)->ImpactParameter(); |
270 | Int_t specNeutronProj = ((AliGenHijingEventHeader*) genHeader)->ProjSpectatorsn(); | |
271 | Int_t specProtonProj = ((AliGenHijingEventHeader*) genHeader)->ProjSpectatorsp(); | |
272 | Int_t specNeutronTarg = ((AliGenHijingEventHeader*) genHeader)->TargSpectatorsn(); | |
273 | Int_t specProtonTarg = ((AliGenHijingEventHeader*) genHeader)->TargSpectatorsp(); | |
274 | Int_t npartTargMC = 208-(specNeutronTarg+specProtonTarg); | |
275 | Int_t npartProjMC = 208-(specNeutronProj+specProtonProj); | |
5090ab18 | 276 | }*/ |
d42843d3 | 277 | |
278 | } | |
279 | // **************************************************** | |
280 | ||
281 | AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager(); | |
593ced83 | 282 | |
283 | AliESDZDC *esdZDC = esd->GetESDZDC(); | |
d42843d3 | 284 | |
8c03b6e8 | 285 | if((((AliInputEventHandler*)(am->GetInputEventHandler()))->IsEventSelected())){ |
d42843d3 | 286 | |
a81cad3f | 287 | fhZNCSpectrum->Fill(esdZDC->GetZDCN1Energy()); |
d42843d3 | 288 | fhZNASpectrum->Fill(esdZDC->GetZDCN2Energy()); |
a81cad3f | 289 | fhZPCSpectrum->Fill(esdZDC->GetZDCP1Energy()); |
290 | fhZPASpectrum->Fill(esdZDC->GetZDCP2Energy()); | |
291 | fhZEM1Spectrum->Fill(esdZDC->GetZDCEMEnergy(0)/8.); | |
292 | fhZEM2Spectrum->Fill(esdZDC->GetZDCEMEnergy(1)/8.); | |
d42843d3 | 293 | |
294 | const Double_t * towZNC = esdZDC->GetZN1TowerEnergy(); | |
295 | const Double_t * towZPC = esdZDC->GetZP1TowerEnergy(); | |
296 | const Double_t * towZNA = esdZDC->GetZN2TowerEnergy(); | |
297 | const Double_t * towZPA = esdZDC->GetZP2TowerEnergy(); | |
298 | // | |
299 | fhZNCpmc->Fill(towZNC[0]); | |
593ced83 | 300 | fhZNApmc->Fill(towZNA[0]); |
301 | fhZPCpmc->Fill(towZPC[0]); | |
d42843d3 | 302 | fhZPApmc->Fill(towZPA[0]); |
303 | ||
304 | Double_t xyZNC[2]={-99.,-99.}, xyZNA[2]={-99.,-99.}; | |
a81cad3f | 305 | esdZDC->GetZNCentroidInPbPb(1380., xyZNC, xyZNA); |
306 | //esdZDC->GetZNCentroidInpp(xyZNC, xyZNA); | |
d42843d3 | 307 | |
308 | fhZNCCentroid->Fill(xyZNC[0], xyZNC[1]); | |
309 | fhZNACentroid->Fill(xyZNA[0], xyZNA[1]); | |
310 | ||
311 | const Double_t * towZNCLG = esdZDC->GetZN1TowerEnergyLR(); | |
312 | const Double_t * towZNALG = esdZDC->GetZN2TowerEnergyLR(); | |
313 | Double_t znclg=0., znalg=0.; | |
314 | for(Int_t iq=0; iq<5; iq++){ | |
315 | znclg += towZNCLG[iq]; | |
316 | znalg += towZNALG[iq]; | |
317 | } | |
593ced83 | 318 | fhZNCemd->Fill(znclg/2.); |
319 | fhZNAemd->Fill(znalg/2.); | |
d42843d3 | 320 | fhPMCZNCemd->Fill(towZNCLG[0]); |
321 | fhPMCZNAemd->Fill(towZNALG[0]); | |
d42843d3 | 322 | |
323 | } | |
593ced83 | 324 | |
f2772cc0 | 325 | Float_t tdcC=999., tdcA=999; |
326 | Float_t tdcSum=999., tdcDiff=999; | |
6f22a0ed | 327 | if(esdZDC->GetZDCTDCData(10,0)>1e-4){ |
f2772cc0 | 328 | tdcC = esdZDC->GetZDCTDCCorrected(10,0)-esdZDC->GetZDCTDCCorrected(15,0); |
6f22a0ed | 329 | if(esdZDC->GetZDCTDCData(12,0)>1e-4){ |
f4d55584 | 330 | tdcA = esdZDC->GetZDCTDCCorrected(12,0)-esdZDC->GetZDCTDCCorrected(15,0); |
331 | tdcSum = tdcC+tdcA; | |
332 | tdcDiff = tdcC-tdcA; | |
333 | } | |
f2772cc0 | 334 | } |
593ced83 | 335 | //for(Int_t i=0; i<4; i++){ |
f4d55584 | 336 | if(tdcSum!=999.){ |
337 | fhTDCZNSum->Fill(tdcSum); | |
338 | fDebunch->Fill(tdcDiff, tdcSum); | |
339 | } | |
f2772cc0 | 340 | if(tdcDiff!=999.)fhTDCZNDiff->Fill(tdcDiff); |
593ced83 | 341 | //} |
593ced83 | 342 | |
343 | PostData(1, fOutput); | |
d42843d3 | 344 | |
345 | } | |
346 | ||
347 | ||
348 | ||
349 | //________________________________________________________________________ | |
350 | void AliAnalysisTaskZDC::Terminate(Option_t */*option*/) | |
351 | { | |
352 | // Terminate analysis | |
353 | // | |
354 | } |