]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/GEO/AliAnalysisTaskZDCpAcalib.cxx
Ignoring coverity to compile
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / GEO / AliAnalysisTaskZDCpAcalib.cxx
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 <TTree.h>
23 #include <TList.h>
24 #include <TFile.h>
25 #include <TString.h>
26 #include <TCanvas.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 "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"
56
57 ClassImp(AliAnalysisTaskZDCpAcalib)
58
59
60 //________________________________________________________________________
61 AliAnalysisTaskZDCpAcalib::AliAnalysisTaskZDCpAcalib():
62   AliAnalysisTaskSE(),
63     fDebug(0),
64     fAnalysisInput("ESD"),
65     fIsMCInput(kFALSE),
66     fUseSpecialOutput(kFALSE),
67     fOutput(0x0),
68     fCentralityTree(0x0),
69    // fTrigClass(""),
70     fIsEventSelected(kFALSE),
71     fIsV0ATriggered(0),
72     fIsV0CTriggered(0)
73 {   
74    // Default constructor
75
76   for(Int_t itow=0; itow<5; itow++){
77      fZNCtower[itow]=0.;  
78      fZNAtower[itow]=0.;  
79      fZNCtowerLG[itow]=0.;
80      fZNAtowerLG[itow]=0.;
81      fZPCtower[itow]=0.;  
82      fZPAtower[itow]=0.;  
83      fZPCtowerLG[itow]=0.;
84      fZPAtowerLG[itow]=0.;
85
86   }
87   
88   for(Int_t ihit=0; ihit<4; ihit++){
89     fZNCtdc[ihit]=9999;
90     fZNAtdc[ihit]=9999;
91     fZPCtdc[ihit]=9999;
92     fZPAtdc[ihit]=9999;
93   }
94 }   
95
96 //________________________________________________________________________
97 AliAnalysisTaskZDCpAcalib::AliAnalysisTaskZDCpAcalib(const char *name):
98   AliAnalysisTaskSE(name),
99     fDebug(0),
100     fAnalysisInput("ESD"),
101     fIsMCInput(kFALSE),
102     fUseSpecialOutput(kFALSE),
103     fOutput(0x0),
104     fCentralityTree(0x0),
105   //  fTrigClass(""),
106     fIsEventSelected(kFALSE),
107     fIsV0ATriggered(0),
108     fIsV0CTriggered(0)
109 {
110   // Default constructor
111  
112   for(Int_t itow=0; itow<5; itow++){
113      fZNCtower[itow]=0.;  
114      fZNAtower[itow]=0.;  
115      fZNCtowerLG[itow]=0.;
116      fZNAtowerLG[itow]=0.;
117      fZPCtower[itow]=0.;  
118      fZPAtower[itow]=0.;  
119      fZPCtowerLG[itow]=0.;
120      fZPAtowerLG[itow]=0.;
121
122   }
123   
124   for(Int_t ihit=0; ihit<4; ihit++){
125      fZNCtdc[ihit]=9999;
126      fZNAtdc[ihit]=9999;
127      fZPCtdc[ihit]=9999;
128      fZPAtdc[ihit]=9999;
129   }
130   
131   // Output slot #1 writes into a TList container
132   DefineOutput(1, TList::Class()); 
133   
134 }
135  
136 //________________________________________________________________________
137 AliAnalysisTaskZDCpAcalib::~AliAnalysisTaskZDCpAcalib()
138 {
139   // Destructor
140   if(fOutput && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()){
141     delete fOutput; fOutput=0;
142   } 
143   if(fCentralityTree && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()){
144     delete fCentralityTree; fCentralityTree=0;
145   } 
146   
147 }  
148
149 //________________________________________________________________________
150 void AliAnalysisTaskZDCpAcalib::UserCreateOutputObjects()
151 {
152   // Create the output containers
153   if(fDebug>1) printf("AnalysisTaskZDCpAcalib::UserCreateOutputObjects() \n");
154
155   if (fUseSpecialOutput) OpenFile(1);
156
157   // Several histograms are more conveniently managed in a TList
158   fOutput = new TList;
159   fOutput->SetOwner();
160   //fOutput->SetName("output");
161
162     fCentralityTree = new TTree("fCentralityTree", "Centrality vs. multiplicity tree");
163     //
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");
180       
181     fOutput->Add(fCentralityTree);      
182     PostData(1, fOutput);
183   
184 }
185
186 //________________________________________________________________________
187 void AliAnalysisTaskZDCpAcalib::UserExec(Option_t */*option*/)
188 {
189   // Execute analysis for current event:
190   if(fDebug>1) printf(" **** AliAnalysisTaskZDCpAcalib::UserExec() \n");
191   
192   if (!InputEvent()) {
193     Printf("ERROR: InputEvent not available");
194     return;
195   }
196
197   if(fAnalysisInput.CompareTo("ESD")==0){
198       
199       //printf(" \t ***Analizing ESD ev. %d\n",fNev);
200       
201       AliESDEvent* esd = dynamic_cast<AliESDEvent*> (InputEvent());
202       if(!esd) return;
203       
204       // Select PHYSICS events (type=7, for data)
205       if(!fIsMCInput && esd->GetEventType()!=7) return; 
206       
207       // ***** Trigger selection
208       TString triggerClass = esd->GetFiredTriggerClasses();
209       sprintf(fTrigClass,"%s",triggerClass.Data());
210       
211       // use response of AliPhysicsSelection
212       fIsEventSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kCINT5);       
213
214           
215       AliESDVZERO *vzeroAOD = esd->GetVZEROData();
216       fIsV0ATriggered = vzeroAOD->GetV0ADecision();
217       fIsV0CTriggered = vzeroAOD->GetV0CDecision();
218         
219       AliESDZDC *esdZDC = esd->GetESDZDC();
220        
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();
225       //
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();
230       //
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]); 
240       }
241
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);
247       }      
248   }   
249   
250   
251   fCentralityTree->Fill();
252  
253   PostData(1, fOutput);
254   
255    
256 }
257
258
259
260 //________________________________________________________________________
261 void AliAnalysisTaskZDCpAcalib::Terminate(Option_t */*option*/)
262 {
263   // Terminate analysis
264   //
265   printf(" **** AliAnalysisTaskZDCpAcalib::Terminate() \n");
266 }