]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCdataQA.cxx
Add the call to Iouris residual calculation
[u/mrichter/AliRoot.git] / TPC / AliTPCdataQA.cxx
CommitLineData
0ffacf98 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/* $Id$ */
18
19
20//Root includes
21#include <TH1F.h>
22#include <TH2F.h>
23#include <TString.h>
24#include <TMath.h>
25#include <TF1.h>
26#include <TRandom.h>
27#include <TDirectory.h>
28#include <TFile.h>
29//AliRoot includes
30#include "AliRawReader.h"
31#include "AliRawReaderRoot.h"
32#include "AliRawReaderDate.h"
33#include "AliTPCRawStream.h"
34#include "AliTPCCalROC.h"
35#include "AliTPCROC.h"
36#include "AliMathBase.h"
37#include "TTreeStream.h"
38#include "AliTPCRawStreamFast.h"
39
40//date
41#include "event.h"
42#include "AliTPCCalPad.h"
43
44//header file
45#include "AliTPCdataQA.h"
46
47
48
49ClassImp(AliTPCdataQA)
50
51AliTPCdataQA::AliTPCdataQA() : /*FOLD00*/
52 TObject(),
53 fFirstTimeBin(60),
54 fLastTimeBin(1000),
55 fAdcMin(1),
56 fAdcMax(100),
57 fOldRCUformat(kTRUE),
58 fROC(AliTPCROC::Instance()),
59 fMapping(NULL),
60 fMaxCharge(0),
61 fOverThreshold0(0),
62 fOverThreshold5(0),
63 fOverThreshold10(0),
64 fOverThreshold20(0),
65 fOverThreshold30(0),
66 fEventCounter(0)
67{
68 //
69 // default constructor
70 //
71}
72
73
74//_____________________________________________________________________
75AliTPCdataQA::AliTPCdataQA(const AliTPCdataQA &ped) : /*FOLD00*/
76 TObject(ped),
77 fFirstTimeBin(ped.GetFirstTimeBin()),
78 fLastTimeBin(ped.GetLastTimeBin()),
79 fAdcMin(ped.GetAdcMin()),
80 fAdcMax(ped.GetAdcMax()),
81 fOldRCUformat(ped.fOldRCUformat),
82 fROC(AliTPCROC::Instance()),
83 fMapping(NULL)
84{
85 //
86 // copy constructor
87 //
88
89}
90
91
92//_____________________________________________________________________
93AliTPCdataQA& AliTPCdataQA::operator = (const AliTPCdataQA &source)
94{
95 //
96 // assignment operator
97 //
98 if (&source == this) return *this;
99 new (this) AliTPCdataQA(source);
100
101 return *this;
102}
103
104
105//_____________________________________________________________________
106AliTPCdataQA::~AliTPCdataQA() /*FOLD00*/
107{
108 //
109 // destructor
110 //
111
112 // do not delete fMapping, because we do not own it.
113
114}
115
116
117
118
119//_____________________________________________________________________
120Bool_t AliTPCdataQA::ProcessEventFast(AliTPCRawStreamFast *rawStreamFast)
121{
122 //
123 // Event Processing loop - AliTPCRawStream
124 //
125 Bool_t withInput = kFALSE;
126
127 while ( rawStreamFast->NextDDL() ){
128 while ( rawStreamFast->NextChannel() ){
129 Int_t isector = rawStreamFast->GetSector(); // current sector
130 Int_t iRow = rawStreamFast->GetRow(); // current row
131 Int_t iPad = rawStreamFast->GetPad(); // current pad
132 Int_t startTbin = (Int_t)rawStreamFast->GetStartTimeBin();
133 Int_t endTbin = (Int_t)rawStreamFast->GetEndTimeBin();
134
135 while ( rawStreamFast->NextBunch() ){
136 for (Int_t iTimeBin = startTbin; iTimeBin < endTbin; iTimeBin++){
137 Float_t signal=(Float_t)rawStreamFast->GetSignals()[iTimeBin-startTbin];
138 Update(isector,iRow,iPad,iTimeBin+1,signal);
139 withInput = kTRUE;
140 }
141 }
142 }
143 }
144
145 return withInput;
146}
147//_____________________________________________________________________
148Bool_t AliTPCdataQA::ProcessEventFast(AliRawReader *rawReader)
149{
150 //
151 // Event processing loop - AliRawReader
152 //
153 AliTPCRawStreamFast *rawStreamFast = new AliTPCRawStreamFast(rawReader, (AliAltroMapping**)fMapping);
154 Bool_t res=ProcessEventFast(rawStreamFast);
155 delete rawStreamFast;
156 return res;
157}
158
159//_____________________________________________________________________
160Bool_t AliTPCdataQA::ProcessEvent(AliTPCRawStream *rawStream)
161{
162 //
163 // Event Processing loop - AliTPCRawStream
164 //
165
166 rawStream->SetOldRCUFormat(fOldRCUformat);
167
168 Bool_t withInput = kFALSE;
169
170 while (rawStream->Next()) {
171
172 Int_t iSector = rawStream->GetSector(); // current ROC
173 Int_t iRow = rawStream->GetRow(); // current row
174 Int_t iPad = rawStream->GetPad(); // current pad
175 Int_t iTimeBin = rawStream->GetTime(); // current time bin
176 Float_t signal = rawStream->GetSignal(); // current ADC signal
177
178 Update(iSector,iRow,iPad,iTimeBin,signal);
179 withInput = kTRUE;
180 }
181
182 return withInput;
183}
184
185
186//_____________________________________________________________________
187Bool_t AliTPCdataQA::ProcessEvent(AliRawReader *rawReader)
188{
189 //
190 // Event processing loop - AliRawReader
191 //
192
193 // if fMapping is NULL the rawstream will crate its own mapping
194 AliTPCRawStream rawStream(rawReader, (AliAltroMapping**)fMapping);
195 rawReader->Select("TPC");
196 return ProcessEvent(&rawStream);
197}
198
199
200//_____________________________________________________________________
201Bool_t AliTPCdataQA::ProcessEvent(eventHeaderStruct *event)
202{
203 //
204 // process date event
205 //
206
207 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
208 Bool_t result=ProcessEvent(rawReader);
209 delete rawReader;
210 return result;
211}
212
213
214
215//_____________________________________________________________________
216void AliTPCdataQA::DumpToFile(const Char_t *filename, const Char_t *dir, Bool_t append) /*FOLD00*/
217{
218 //
219 // Write class to file
220 //
221
222 TString sDir(dir);
223 TString option;
224
225 if ( append )
226 option = "update";
227 else
228 option = "recreate";
229
230 TDirectory *backup = gDirectory;
231 TFile f(filename,option.Data());
232 f.cd();
233 if ( !sDir.IsNull() ){
234 f.mkdir(sDir.Data());
235 f.cd(sDir);
236 }
237 this->Write();
238 f.Close();
239
240 if ( backup ) backup->cd();
241}
242
243
244//_____________________________________________________________________
245Int_t AliTPCdataQA::Update(const Int_t icsector, /*FOLD00*/
246 const Int_t icRow,
247 const Int_t icPad,
248 const Int_t icTimeBin,
249 const Float_t csignal)
250{
251 //
252 // Signal filling method
253 //
254 if (icTimeBin<fFirstTimeBin) return 0;
255 if (icTimeBin>fLastTimeBin) return 0;
256 if (!fMaxCharge) fMaxCharge = new AliTPCCalPad("MaxCharge","MaxCharge");
257 if (!fOverThreshold0) fOverThreshold0 = new AliTPCCalPad("OverThreshold0","OverThreshold0");
258 if (!fOverThreshold5) fOverThreshold5 = new AliTPCCalPad("OverThreshold5","OverThreshold5");
259 if (!fOverThreshold10) fOverThreshold10 = new AliTPCCalPad("OverThreshold10","OverThreshold10");
260 if (!fOverThreshold20) fOverThreshold20 = new AliTPCCalPad("OverThreshold20","OverThreshold20");
261 if (!fOverThreshold30) fOverThreshold30 = new AliTPCCalPad("OverThreshold30","OverThreshold30");
262 //
263 if (csignal>fMaxCharge->GetCalROC(icsector)->GetValue(icRow, icPad)){
264 fMaxCharge->GetCalROC(icsector)->SetValue(icRow, icPad,csignal);
265 }
266
267 //
268 if (csignal>0){
269 Int_t count = fOverThreshold0->GetCalROC(icsector)->GetValue(icRow, icPad);
270 fOverThreshold0->GetCalROC(icsector)->SetValue(icRow, icPad,count+1);
271 };
272 //
273 if (csignal>5){
274 Int_t count = fOverThreshold5->GetCalROC(icsector)->GetValue(icRow, icPad);
275 fOverThreshold5->GetCalROC(icsector)->SetValue(icRow, icPad,count+1);
276 };
277 if (csignal>10){
278 Int_t count = fOverThreshold10->GetCalROC(icsector)->GetValue(icRow, icPad);
279 fOverThreshold10->GetCalROC(icsector)->SetValue(icRow, icPad,count+1);
280 };
281 if (csignal>20){
282 Int_t count = fOverThreshold20->GetCalROC(icsector)->GetValue(icRow, icPad);
283 fOverThreshold20->GetCalROC(icsector)->SetValue(icRow, icPad,count+1);
284 };
285 if (csignal>30){
286 Int_t count = fOverThreshold30->GetCalROC(icsector)->GetValue(icRow, icPad);
287 fOverThreshold30->GetCalROC(icsector)->SetValue(icRow, icPad,count+1);
288 };
289
290 return 0;
291}
11ccf1c1 292
293
294void AliTPCdataQA::Analyse(){
295 //
296 // analyze acumulated data
297 //
298}