]>
Commit | Line | Data |
---|---|---|
1ee7b96d | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
da219175 | 3 | * * |
1ee7b96d | 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 | /* $Id$ */ | |
17 | // | |
18 | // An analysis task to check the ESD VZERO data in simulated data | |
da219175 | 19 | // An analysis task to check the ESD VZERO data in simulated data |
20 | // An analysis task to check the ESD VZERO data in simulated data | |
21 | // An analysis task to check the ESD VZERO data in simulated data | |
22 | // An analysis task to check the ESD VZERO data in simulated data | |
1ee7b96d | 23 | // |
24 | ////////////////////////////////////////////////////////////////////////////// | |
25 | ||
26 | ||
27 | #include <TROOT.h> | |
28 | #include <TChain.h> | |
29 | #include <TH1.h> | |
1ee7b96d | 30 | #include <TCanvas.h> |
1ee7b96d | 31 | #include <TFile.h> |
1f588058 | 32 | #include <TString.h> |
1ee7b96d | 33 | |
34 | #include "AliVZEROQATask.h" | |
35 | #include "AliESD.h" | |
36 | #include "AliESDVZERO.h" | |
37 | #include "AliLog.h" | |
38 | ||
39 | //______________________________________________________________________________ | |
40 | AliVZEROQATask::AliVZEROQATask(const char *name) : | |
41 | AliAnalysisTask(name,""), | |
42 | fChain(0), | |
43 | fESD(0), | |
44 | fOutputContainer(0), | |
45 | fhVZERONbPMA(0), | |
46 | fhVZERONbPMC(0), | |
47 | fhVZEROMultA(0), | |
48 | fhVZEROMultC(0) | |
49 | ||
50 | { | |
51 | // Constructor. | |
52 | // Input slot #0 works with an Ntuple | |
53 | DefineInput(0, TChain::Class()); | |
54 | // Output slot #0 writes into a TH1 container | |
55 | DefineOutput(0, TObjArray::Class()) ; | |
56 | } | |
57 | ||
da219175 | 58 | AliVZEROQATask::AliVZEROQATask(const AliVZEROQATask& ta) : |
59 | AliAnalysisTask(ta.GetName(),""), | |
60 | fChain(ta.fChain), | |
61 | fESD(ta.fESD), | |
62 | fOutputContainer(ta.fOutputContainer), | |
63 | fhVZERONbPMA(ta.fhVZERONbPMA), | |
64 | fhVZERONbPMC(ta.fhVZERONbPMC), | |
65 | fhVZEROMultA(ta.fhVZEROMultA), | |
66 | fhVZEROMultC(ta.fhVZEROMultC) | |
67 | ||
68 | { | |
69 | // copy constructor | |
70 | } | |
71 | ||
72 | //_____________________________________________________________________________ | |
73 | AliVZEROQATask& AliVZEROQATask::operator = (const AliVZEROQATask& ap) | |
74 | { | |
75 | // assignment operator | |
76 | ||
77 | this->~AliVZEROQATask(); | |
78 | new(this) AliVZEROQATask(ap); | |
79 | return *this; | |
80 | } | |
81 | ||
1ee7b96d | 82 | //______________________________________________________________________________ |
83 | AliVZEROQATask::~AliVZEROQATask() | |
84 | { | |
85 | // dtor | |
86 | ||
87 | fOutputContainer->Clear(); | |
88 | delete fOutputContainer; | |
89 | ||
90 | delete fhVZERONbPMA; | |
91 | delete fhVZERONbPMC; | |
92 | delete fhVZEROMultA; | |
93 | delete fhVZEROMultC; | |
94 | } | |
95 | ||
96 | //______________________________________________________________________________ | |
97 | void AliVZEROQATask::ConnectInputData(const Option_t*) | |
98 | { | |
99 | // Initialises branch container and histograms | |
100 | ||
101 | AliInfo(Form("*** Initialization of %s", GetName())) ; | |
102 | ||
103 | // Gets input data | |
104 | fChain = dynamic_cast<TChain *>(GetInputData(0)) ; | |
105 | if (!fChain) { | |
106 | AliError(Form("Input 0 for %s not found\n", GetName())); | |
107 | return ; | |
108 | } | |
109 | ||
110 | // One should first check if the branch address was taken by some other task | |
111 | char ** address = (char **)GetBranchAddress(0, "ESD"); | |
112 | if (address) { | |
113 | fESD = (AliESD*)(*address); | |
114 | } else { | |
115 | fESD = new AliESD(); | |
116 | SetBranchAddress(0, "ESD", &fESD); | |
117 | } | |
118 | } | |
119 | ||
120 | //________________________________________________________________________ | |
121 | void AliVZEROQATask::CreateOutputObjects() | |
122 | { | |
123 | // Creates histograms | |
124 | ||
1e20f195 | 125 | OpenFile(0) ; |
126 | ||
1ee7b96d | 127 | fhVZERONbPMA = new TH1I("Nb of fired PMs in V0A", "VZERONbPMA" ,100 ,0 ,99); |
128 | fhVZERONbPMC = new TH1I("Nb of fired PMs in V0C", "VZERONbPMC" ,100 ,0 ,99); | |
129 | fhVZEROMultA = new TH1I("Multiplicity in V0A", "VZEROMultA" ,50 ,0 ,49); | |
130 | fhVZEROMultC = new TH1I("Multiplicity in V0C", "VZEROMultC" ,50 ,0 ,49); | |
131 | ||
132 | // Creates output container | |
133 | ||
134 | fOutputContainer = new TObjArray(4); | |
135 | fOutputContainer->SetName(GetName()) ; | |
136 | fOutputContainer->AddAt(fhVZERONbPMA, 0); | |
137 | fOutputContainer->AddAt(fhVZERONbPMC, 1); | |
138 | fOutputContainer->AddAt(fhVZEROMultA, 2); | |
139 | fOutputContainer->AddAt(fhVZEROMultC, 3); | |
140 | ||
141 | } | |
142 | ||
143 | //______________________________________________________________________________ | |
144 | void AliVZEROQATask::Exec(Option_t *) | |
145 | { | |
146 | // Processing of one event | |
147 | Long64_t entry = fChain->GetReadEntry() ; | |
148 | ||
149 | if (!fESD) { | |
150 | AliError("fESD is not connected to the input!") ; | |
151 | return ; | |
152 | } | |
153 | ||
154 | if ( !((entry-1)%100) ) | |
155 | AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ; | |
156 | ||
157 | AliESDVZERO *esdVZERO=fESD->GetVZEROData(); | |
158 | ||
159 | if (esdVZERO) { | |
160 | fhVZERONbPMA->Fill(esdVZERO->GetNbPMV0A()); | |
161 | fhVZERONbPMC->Fill(esdVZERO->GetNbPMV0C()); | |
162 | fhVZEROMultA->Fill(esdVZERO->GetMTotV0A()); | |
163 | fhVZEROMultC->Fill(esdVZERO->GetMTotV0C()); | |
164 | } | |
165 | PostData(0, fOutputContainer); | |
166 | ||
167 | } | |
168 | ||
169 | //______________________________________________________________________________ | |
170 | void AliVZEROQATask::Terminate(Option_t *) | |
171 | { | |
172 | // Processed when the event loop is ended | |
173 | ||
174 | fOutputContainer = (TObjArray*)GetOutputData(0); | |
175 | fhVZERONbPMA = (TH1I*)fOutputContainer->At(0); | |
176 | fhVZERONbPMC = (TH1I*)fOutputContainer->At(1); | |
177 | fhVZEROMultA = (TH1I*)fOutputContainer->At(2); | |
178 | fhVZEROMultC = (TH1I*)fOutputContainer->At(3); | |
179 | ||
2704006a | 180 | Bool_t problem = kFALSE ; |
84eb42a1 | 181 | AliInfo(Form(" *** %s Report:", GetName())) ; |
182 | printf(" V0A Multiplicity Mean : %5.3f , RMS : %5.3f \n",fhVZEROMultA->GetMean(),fhVZEROMultA->GetRMS()); | |
183 | printf(" V0C Multiplicity Mean : %5.3f , RMS : %5.3f \n",fhVZEROMultC->GetMean(),fhVZEROMultC->GetRMS()); | |
1ee7b96d | 184 | |
185 | TCanvas * c1 = new TCanvas("Number of PMs fired in V0A", "Number of PMs fired in V0A", 1); | |
186 | fhVZERONbPMA->SetAxisRange(0, 99); | |
187 | fhVZERONbPMA->SetLineColor(2); | |
188 | fhVZERONbPMA->Draw("SAME"); | |
189 | c1->Update(); | |
190 | ||
191 | TCanvas * c2 = new TCanvas("Number of PMs fired in V0C", "Number of PMs fired in V0C", 1); | |
192 | fhVZERONbPMC->SetAxisRange(0,99); | |
193 | fhVZERONbPMC->SetLineColor(2); | |
194 | fhVZERONbPMC->Draw("SAME"); | |
195 | c2->Update(); | |
196 | ||
197 | TCanvas * c3 = new TCanvas("Multiplicity in V0A", "Multiplicity in V0A", 1); | |
198 | fhVZEROMultA->SetAxisRange(0, 49); | |
199 | fhVZEROMultA->SetLineColor(2); | |
200 | fhVZEROMultA->Draw("SAME"); | |
201 | c3->Update(); | |
202 | ||
203 | TCanvas * c4 = new TCanvas("Multiplicity in V0C", "Multiplicity in V0C", 1); | |
204 | fhVZEROMultC->SetAxisRange(0,49); | |
205 | fhVZEROMultC->SetLineColor(2); | |
206 | fhVZEROMultC->Draw("SAME"); | |
207 | c4->Update(); | |
208 | ||
209 | c1->Print("V0AMultiplicity.eps"); | |
210 | c2->Print("V0CMultiplicity.eps"); | |
211 | c3->Print("NumberV0APMs.eps"); | |
212 | c4->Print("NumberV0CPMs.eps"); | |
213 | ||
214 | char line[1024] ; | |
84eb42a1 | 215 | sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ; |
1ee7b96d | 216 | gROOT->ProcessLine(line); |
217 | sprintf(line, ".!rm -fR *.eps"); | |
218 | gROOT->ProcessLine(line); | |
219 | ||
2704006a | 220 | AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! ", GetName())) ; |
221 | ||
1f588058 | 222 | TString report ; |
2704006a | 223 | if(problem) |
224 | report="Problems found, please check!!!"; | |
225 | else | |
226 | report="OK"; | |
227 | ||
1f588058 | 228 | AliInfo(Form("*** %s Summary Report: %s\n",GetName(), report.Data())) ; |
1ee7b96d | 229 | |
230 | } |