1 /**************************************************************************
2 * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /////////////////////////////////////////////////////////////
18 // Class to analyze ZDC data //
20 /////////////////////////////////////////////////////////////
28 #include "AliAnalysisManager.h"
29 #include "AliInputEventHandler.h"
30 #include "AliVEvent.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 "AliAODHeader.h"
40 #include "AliAODVertex.h"
41 #include "AliAODVZERO.h"
42 #include "AliAODZDC.h"
43 #include "AliAODMCHeader.h"
44 #include "AliMCEventHandler.h"
45 #include "AliMCEvent.h"
46 #include "AliHeader.h"
47 #include "AliAODMCParticle.h"
48 #include "AliAnalysisTaskSE.h"
49 #include "AliGenEventHeader.h"
50 #include "AliGenHijingEventHeader.h"
51 #include "AliPhysicsSelectionTask.h"
52 #include "AliPhysicsSelection.h"
53 #include "AliTriggerAnalysis.h"
54 #include "AliCentrality.h"
55 #include "AliAnalysisTaskZDCpAcalib.h"
57 ClassImp(AliAnalysisTaskZDCpAcalib)
60 //________________________________________________________________________
61 AliAnalysisTaskZDCpAcalib::AliAnalysisTaskZDCpAcalib():
64 fAnalysisInput("ESD"),
66 fUseSpecialOutput(kFALSE),
70 fIsEventSelected(kFALSE),
74 // Default constructor
76 for(Int_t itow=0; itow<5; itow++){
88 for(Int_t ihit=0; ihit<4; ihit++){
96 //________________________________________________________________________
97 AliAnalysisTaskZDCpAcalib::AliAnalysisTaskZDCpAcalib(const char *name):
98 AliAnalysisTaskSE(name),
100 fAnalysisInput("ESD"),
102 fUseSpecialOutput(kFALSE),
104 fCentralityTree(0x0),
106 fIsEventSelected(kFALSE),
110 // Default constructor
112 for(Int_t itow=0; itow<5; itow++){
115 fZNCtowerLG[itow]=0.;
116 fZNAtowerLG[itow]=0.;
119 fZPCtowerLG[itow]=0.;
120 fZPAtowerLG[itow]=0.;
124 for(Int_t ihit=0; ihit<4; ihit++){
131 // Output slot #1 writes into a TList container
132 DefineOutput(1, TList::Class());
136 //________________________________________________________________________
137 AliAnalysisTaskZDCpAcalib::~AliAnalysisTaskZDCpAcalib()
140 if(fOutput && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()){
141 delete fOutput; fOutput=0;
143 if(fCentralityTree && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()){
144 delete fCentralityTree; fCentralityTree=0;
149 //________________________________________________________________________
150 void AliAnalysisTaskZDCpAcalib::UserCreateOutputObjects()
152 // Create the output containers
153 if(fDebug>1) printf("AnalysisTaskZDCpAcalib::UserCreateOutputObjects() \n");
155 if (fUseSpecialOutput) OpenFile(1);
157 // Several histograms are more conveniently managed in a TList
160 //fOutput->SetName("output");
162 fCentralityTree = new TTree("fCentralityTree", "Centrality vs. multiplicity tree");
164 fCentralityTree->Branch("trigClass",&fTrigClass,"trigClass/C");
165 fCentralityTree->Branch("eventSelected",&fIsEventSelected,"eventSelected/O");
166 fCentralityTree->Branch("isV0ATriggered", &fIsV0ATriggered,"isV0ATriggered/I");
167 fCentralityTree->Branch("isV0CTriggered", &fIsV0CTriggered,"isV0CTriggered/I");
168 fCentralityTree->Branch("znctower", fZNCtower, "znctower[5]/F");
169 fCentralityTree->Branch("znatower", fZNAtower, "znatower[5]/F");
170 fCentralityTree->Branch("znctowerLG", fZNCtowerLG, "znctowerLG[5]/F");
171 fCentralityTree->Branch("znatowerLG", fZNAtowerLG, "znatowerLG[5]/F");
172 fCentralityTree->Branch("zpctower", fZNCtower, "znctower[5]/F");
173 fCentralityTree->Branch("zpatower", fZNAtower, "znatower[5]/F");
174 fCentralityTree->Branch("zpctowerLG", fZNCtowerLG, "znctowerLG[5]/F");
175 fCentralityTree->Branch("zpatowerLG", fZNAtowerLG, "znatowerLG[5]/F");
176 fCentralityTree->Branch("tdcZNC", fZNCtdc, "tdcZNC[4]/I");
177 fCentralityTree->Branch("tdcZNA", fZNAtdc, "tdcZNA[4]/I");
178 fCentralityTree->Branch("tdcZPC", fZPCtdc, "tdcZPC[4]/I");
179 fCentralityTree->Branch("tdcZPA", fZPAtdc, "tdcZPA[4]/I");
181 fOutput->Add(fCentralityTree);
182 PostData(1, fOutput);
186 //________________________________________________________________________
187 void AliAnalysisTaskZDCpAcalib::UserExec(Option_t */*option*/)
189 // Execute analysis for current event:
190 if(fDebug>1) printf(" **** AliAnalysisTaskZDCpAcalib::UserExec() \n");
193 Printf("ERROR: InputEvent not available");
197 if(fAnalysisInput.CompareTo("ESD")==0){
199 //printf(" \t ***Analizing ESD ev. %d\n",fNev);
201 AliESDEvent* esd = dynamic_cast<AliESDEvent*> (InputEvent());
204 // Select PHYSICS events (type=7, for data)
205 if(!fIsMCInput && esd->GetEventType()!=7) return;
207 // ***** Trigger selection
208 TString triggerClass = esd->GetFiredTriggerClasses();
209 sprintf(fTrigClass,"%s",triggerClass.Data());
211 // use response of AliPhysicsSelection
212 fIsEventSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kCINT5);
215 AliESDVZERO *vzeroAOD = esd->GetVZEROData();
216 fIsV0ATriggered = vzeroAOD->GetV0ADecision();
217 fIsV0CTriggered = vzeroAOD->GetV0CDecision();
219 AliESDZDC *esdZDC = esd->GetESDZDC();
221 const Double_t * towZNC = esdZDC->GetZN1TowerEnergy();
222 const Double_t * towZNA = esdZDC->GetZN2TowerEnergy();
223 const Double_t * towZPC = esdZDC->GetZP1TowerEnergy();
224 const Double_t * towZPA = esdZDC->GetZP2TowerEnergy();
226 const Double_t * towZNCLG = esdZDC->GetZN1TowerEnergyLR();
227 const Double_t * towZNALG = esdZDC->GetZN2TowerEnergyLR();
228 const Double_t * towZPCLG = esdZDC->GetZP1TowerEnergyLR();
229 const Double_t * towZPALG = esdZDC->GetZP2TowerEnergyLR();
231 for(Int_t it=0; it<5; it++){
232 fZNCtower[it] = (Float_t) (towZNC[it]);
233 fZNAtower[it] = (Float_t) (towZNA[it]);
234 fZNCtowerLG[it] = (Float_t) (towZNCLG[it]);
235 fZNAtowerLG[it] = (Float_t) (towZNALG[it]);
236 fZPCtower[it] = (Float_t) (towZPC[it]);
237 fZPAtower[it] = (Float_t) (towZPA[it]);
238 fZPCtowerLG[it] = (Float_t) (towZPCLG[it]);
239 fZPAtowerLG[it] = (Float_t) (towZPALG[it]);
242 for(Int_t i=0; i<4; i++){
243 fZNCtdc[i] = esdZDC->GetZDCTDCCorrected(10, i);
244 fZPCtdc[i] = esdZDC->GetZDCTDCCorrected(11, i);
245 fZNAtdc[i] = esdZDC->GetZDCTDCCorrected(12, i);
246 fZPAtdc[i] = esdZDC->GetZDCTDCCorrected(13, i);
251 fCentralityTree->Fill();
253 PostData(1, fOutput);
260 //________________________________________________________________________
261 void AliAnalysisTaskZDCpAcalib::Terminate(Option_t */*option*/)
263 // Terminate analysis
265 printf(" **** AliAnalysisTaskZDCpAcalib::Terminate() \n");