1 /**************************************************************************
2 * Copyright(c) 1998-1999, 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 **************************************************************************/
27 #include <TDirectory.h>
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"
42 #include "AliTPCCalPad.h"
45 #include "AliTPCdataQA.h"
49 ClassImp(AliTPCdataQA)
51 AliTPCdataQA::AliTPCdataQA() : /*FOLD00*/
58 fROC(AliTPCROC::Instance()),
69 // default constructor
74 //_____________________________________________________________________
75 AliTPCdataQA::AliTPCdataQA(const AliTPCdataQA &ped) : /*FOLD00*/
77 fFirstTimeBin(ped.GetFirstTimeBin()),
78 fLastTimeBin(ped.GetLastTimeBin()),
79 fAdcMin(ped.GetAdcMin()),
80 fAdcMax(ped.GetAdcMax()),
81 fOldRCUformat(ped.fOldRCUformat),
82 fROC(AliTPCROC::Instance()),
92 //_____________________________________________________________________
93 AliTPCdataQA& AliTPCdataQA::operator = (const AliTPCdataQA &source)
96 // assignment operator
98 if (&source == this) return *this;
99 new (this) AliTPCdataQA(source);
105 //_____________________________________________________________________
106 AliTPCdataQA::~AliTPCdataQA() /*FOLD00*/
112 // do not delete fMapping, because we do not own it.
119 //_____________________________________________________________________
120 Bool_t AliTPCdataQA::ProcessEventFast(AliTPCRawStreamFast *rawStreamFast)
123 // Event Processing loop - AliTPCRawStream
125 Bool_t withInput = kFALSE;
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();
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);
147 //_____________________________________________________________________
148 Bool_t AliTPCdataQA::ProcessEventFast(AliRawReader *rawReader)
151 // Event processing loop - AliRawReader
153 AliTPCRawStreamFast *rawStreamFast = new AliTPCRawStreamFast(rawReader, (AliAltroMapping**)fMapping);
154 Bool_t res=ProcessEventFast(rawStreamFast);
155 delete rawStreamFast;
159 //_____________________________________________________________________
160 Bool_t AliTPCdataQA::ProcessEvent(AliTPCRawStream *rawStream)
163 // Event Processing loop - AliTPCRawStream
166 rawStream->SetOldRCUFormat(fOldRCUformat);
168 Bool_t withInput = kFALSE;
170 while (rawStream->Next()) {
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
178 Update(iSector,iRow,iPad,iTimeBin,signal);
186 //_____________________________________________________________________
187 Bool_t AliTPCdataQA::ProcessEvent(AliRawReader *rawReader)
190 // Event processing loop - AliRawReader
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);
200 //_____________________________________________________________________
201 Bool_t AliTPCdataQA::ProcessEvent(eventHeaderStruct *event)
204 // process date event
207 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
208 Bool_t result=ProcessEvent(rawReader);
215 //_____________________________________________________________________
216 void AliTPCdataQA::DumpToFile(const Char_t *filename, const Char_t *dir, Bool_t append) /*FOLD00*/
219 // Write class to file
230 TDirectory *backup = gDirectory;
231 TFile f(filename,option.Data());
233 if ( !sDir.IsNull() ){
234 f.mkdir(sDir.Data());
240 if ( backup ) backup->cd();
244 //_____________________________________________________________________
245 Int_t AliTPCdataQA::Update(const Int_t icsector, /*FOLD00*/
248 const Int_t icTimeBin,
249 const Float_t csignal)
252 // Signal filling method
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");
263 if (csignal>fMaxCharge->GetCalROC(icsector)->GetValue(icRow, icPad)){
264 fMaxCharge->GetCalROC(icsector)->SetValue(icRow, icPad,csignal);
269 Int_t count = fOverThreshold0->GetCalROC(icsector)->GetValue(icRow, icPad);
270 fOverThreshold0->GetCalROC(icsector)->SetValue(icRow, icPad,count+1);
274 Int_t count = fOverThreshold5->GetCalROC(icsector)->GetValue(icRow, icPad);
275 fOverThreshold5->GetCalROC(icsector)->SetValue(icRow, icPad,count+1);
278 Int_t count = fOverThreshold10->GetCalROC(icsector)->GetValue(icRow, icPad);
279 fOverThreshold10->GetCalROC(icsector)->SetValue(icRow, icPad,count+1);
282 Int_t count = fOverThreshold20->GetCalROC(icsector)->GetValue(icRow, icPad);
283 fOverThreshold20->GetCalROC(icsector)->SetValue(icRow, icPad,count+1);
286 Int_t count = fOverThreshold30->GetCalROC(icsector)->GetValue(icRow, icPad);
287 fOverThreshold30->GetCalROC(icsector)->SetValue(icRow, icPad,count+1);
294 void AliTPCdataQA::Analyse(){
296 // analyze acumulated data