]>
Commit | Line | Data |
---|---|---|
a6f3cc02 | 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 | // Produces the data needed to calculate the quality assurance | |
18 | // All data must be mergeable objects | |
19 | // Handles ESDs and Raws | |
20 | // Histos defined will be used for Raw Data control and monitoring | |
21 | ||
22 | // --- ROOT system --- | |
23 | #include <TClonesArray.h> | |
24 | #include <TFile.h> | |
25 | #include <TF1.h> | |
26 | #include <TH1F.h> | |
27 | #include <TH1I.h> | |
28 | #include <TH2I.h> | |
29 | #include <TH2F.h> | |
30 | #include <TGraph.h> | |
31 | #include <TParameter.h> | |
32 | #include <TTimeStamp.h> | |
33 | ||
34 | // --- Standard library --- | |
35 | ||
36 | // --- AliRoot header files --- | |
37 | #include "AliESDEvent.h" | |
38 | #include "AliLog.h" | |
39 | #include "AliCDBManager.h" | |
40 | #include "AliCDBStorage.h" | |
41 | #include "AliCDBEntry.h" | |
42 | #include "AliADQADataMakerRec.h" | |
43 | #include "AliQAChecker.h" | |
44 | #include "AliRawReader.h" | |
45 | #include "AliADRawStream.h" | |
46 | #include "AliADdigit.h" | |
47 | #include "AliADConst.h" | |
48 | #include "AliADReconstructor.h" | |
49 | //#include "AliADTrending.h" | |
50 | #include "AliADCalibData.h" | |
51 | #include "AliCTPTimeParams.h" | |
52 | #include "event.h" | |
53 | ||
54 | ClassImp(AliADQADataMakerRec) | |
55 | ||
56 | //____________________________________________________________________________ | |
57 | AliADQADataMakerRec::AliADQADataMakerRec() : | |
58 | AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kAD), "AD Quality Assurance Data Maker"), | |
59 | fCalibData(0x0), | |
60 | fTrendingUpdateTime(0), | |
61 | fCycleStartTime(0), | |
62 | fCycleStopTime(0), | |
63 | fTimeSlewing(0) | |
64 | ||
65 | { | |
66 | // Constructor | |
67 | ||
68 | AliDebug(AliQAv1::GetQADebugLevel(), "Construct AD QA Object"); | |
69 | ||
70 | for(Int_t i=0; i<16; i++){ | |
71 | fEven[i] = 0; | |
72 | fOdd[i] = 0; | |
73 | } | |
74 | ||
75 | for(Int_t i=0; i<32; i++){ | |
76 | fADCmean[i] = 0.0; } | |
77 | } | |
78 | ||
79 | //____________________________________________________________________________ | |
80 | AliADQADataMakerRec::AliADQADataMakerRec(const AliADQADataMakerRec& qadm) : | |
81 | AliQADataMakerRec(), | |
82 | fCalibData(0x0), | |
83 | fTrendingUpdateTime(0), | |
84 | fCycleStartTime(0), | |
85 | fCycleStopTime(0), | |
86 | fTimeSlewing(0) | |
87 | ||
88 | { | |
89 | // Copy constructor | |
90 | ||
91 | SetName((const char*)qadm.GetName()) ; | |
92 | SetTitle((const char*)qadm.GetTitle()); | |
93 | } | |
94 | ||
95 | //__________________________________________________________________ | |
96 | AliADQADataMakerRec& AliADQADataMakerRec::operator = (const AliADQADataMakerRec& qadm ) | |
97 | { | |
98 | // Equal operator | |
99 | ||
100 | this->~AliADQADataMakerRec(); | |
101 | new(this) AliADQADataMakerRec(qadm); | |
102 | return *this; | |
103 | } | |
104 | ||
105 | //____________________________________________________________________________ | |
106 | AliADCalibData* AliADQADataMakerRec::GetCalibData() const | |
107 | ||
108 | { | |
109 | AliCDBManager *man = AliCDBManager::Instance(); | |
110 | ||
111 | AliCDBEntry *entry=0; | |
112 | ||
fcb6ff8b | 113 | //entry = man->Get("AD/Calib/Data",fRun); |
114 | //if(!entry){ | |
115 | //AliWarning("Load of calibration data from default storage failed!"); | |
116 | //AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)"); | |
a6f3cc02 | 117 | |
118 | man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); | |
119 | entry = man->Get("AD/Calib/Data",fRun); | |
fcb6ff8b | 120 | //} |
a6f3cc02 | 121 | // Retrieval of data in directory AD/Calib/Data: |
122 | ||
123 | AliADCalibData *calibdata = 0; | |
124 | ||
125 | if (entry) calibdata = (AliADCalibData*) entry->GetObject(); | |
126 | if (!calibdata) AliFatal("No calibration data from calibration database !"); | |
127 | ||
128 | return calibdata; | |
129 | } | |
130 | //____________________________________________________________________________ | |
131 | void AliADQADataMakerRec::StartOfDetectorCycle() | |
132 | { | |
133 | // Detector specific actions at start of cycle | |
134 | ||
135 | // Reset of the histogram used - to have the trend versus time - | |
136 | ||
137 | fCalibData = GetCalibData(); | |
138 | ||
139 | AliCDBEntry *entry = AliCDBManager::Instance()->Get("GRP/CTP/CTPtiming"); | |
140 | if (!entry) AliFatal("CTP timing parameters are not found in OCDB !"); | |
141 | AliCTPTimeParams *ctpParams = (AliCTPTimeParams*)entry->GetObject(); | |
142 | Float_t l1Delay = (Float_t)ctpParams->GetDelayL1L0()*25.0; | |
143 | ||
144 | AliCDBEntry *entry1 = AliCDBManager::Instance()->Get("GRP/CTP/TimeAlign"); | |
145 | if (!entry1) AliFatal("CTP time-alignment is not found in OCDB !"); | |
146 | AliCTPTimeParams *ctpTimeAlign = (AliCTPTimeParams*)entry1->GetObject(); | |
147 | l1Delay += ((Float_t)ctpTimeAlign->GetDelayL1L0()*25.0); | |
69e96215 | 148 | /*/ |
a6f3cc02 | 149 | AliCDBEntry *entry2 = AliCDBManager::Instance()->Get("AD/Calib/TimeDelays"); |
150 | if (!entry2) AliFatal("AD time delays are not found in OCDB !"); | |
151 | TH1F *delays = (TH1F*)entry2->GetObject(); | |
152 | ||
153 | AliCDBEntry *entry3 = AliCDBManager::Instance()->Get("AD/Calib/TimeSlewing"); | |
154 | if (!entry3) AliFatal("AD time slewing function is not found in OCDB !"); | |
155 | fTimeSlewing = (TF1*)entry3->GetObject(); | |
69e96215 | 156 | /*/ |
a6f3cc02 | 157 | |
158 | for(Int_t i = 0 ; i < 16; ++i) { | |
159 | //Int_t board = AliADCalibData::GetBoardNumber(i); | |
160 | fTimeOffset[i] = ( | |
161 | // ((Float_t)fCalibData->GetTriggerCountOffset(board) - | |
162 | // (Float_t)fCalibData->GetRollOver(board))*25.0 + | |
163 | // fCalibData->GetTimeOffset(i) - | |
164 | // l1Delay+ | |
69e96215 | 165 | //delays->GetBinContent(i+1)//+ |
a6f3cc02 | 166 | // kV0Offset |
69e96215 | 167 | 0 |
a6f3cc02 | 168 | ); |
169 | // AliInfo(Form(" fTimeOffset[%d] = %f kV0offset %f",i,fTimeOffset[i],kV0Offset)); | |
170 | } | |
171 | ||
172 | ||
173 | ||
174 | ||
175 | ||
176 | TTimeStamp currentTime; | |
177 | fCycleStartTime = currentTime.GetSec(); | |
178 | ||
179 | // fNTotEvents = 0; | |
180 | } | |
181 | //____________________________________________________________________________ | |
182 | void AliADQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list) | |
183 | { | |
184 | // Detector specific actions at end of cycle | |
185 | // Does the QA checking | |
186 | ResetEventTrigClasses(); | |
187 | // | |
188 | AliQAChecker::Instance()->Run(AliQAv1::kAD, task, list) ; | |
189 | ||
190 | if(task == AliQAv1::kRAWS){ | |
191 | TTimeStamp currentTime; | |
192 | fCycleStopTime = currentTime.GetSec(); | |
193 | } | |
194 | ||
195 | for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { | |
196 | if (! IsValidEventSpecie(specie, list)) continue ; | |
197 | SetEventSpecie(AliRecoParam::ConvertIndex(specie)); | |
198 | if(task == AliQAv1::kRAWS) { | |
199 | } else if (task == AliQAv1::kESDS) { | |
200 | } | |
201 | } | |
202 | } | |
203 | ||
204 | //____________________________________________________________________________ | |
205 | void AliADQADataMakerRec::InitESDs() | |
206 | { | |
207 | // Creates histograms to control ESDs | |
208 | } | |
209 | ||
210 | //____________________________________________________________________________ | |
211 | void AliADQADataMakerRec::InitDigits() | |
212 | { | |
213 | ||
214 | } | |
215 | ||
216 | //____________________________________________________________________________ | |
217 | void AliADQADataMakerRec::MakeDigits() | |
218 | { | |
219 | ||
220 | } | |
221 | ||
222 | //____________________________________________________________________________ | |
fcb6ff8b | 223 | void AliADQADataMakerRec::MakeDigits(TTree* /*digitTree*/) |
a6f3cc02 | 224 | { |
225 | ||
226 | } | |
227 | ||
228 | ||
229 | //____________________________________________________________________________ | |
fcb6ff8b | 230 | void AliADQADataMakerRec::MakeESDs(AliESDEvent* /*esd*/) |
a6f3cc02 | 231 | { |
232 | ||
233 | } | |
234 | ||
235 | //____________________________________________________________________________ | |
236 | void AliADQADataMakerRec::InitRaws() | |
237 | { | |
238 | // Creates RAW histograms in Raws subdir | |
239 | ||
240 | const Bool_t expert = kTRUE ; | |
241 | const Bool_t saveCorr = kTRUE ; | |
242 | const Bool_t image = kTRUE ; | |
243 | ||
244 | const Int_t kNintegrator = 2; | |
245 | ||
246 | const Int_t kNTdcTimeBins = 1280; | |
247 | const Float_t kTdcTimeMin = 0.; | |
248 | const Float_t kTdcTimeMax = 75.; | |
249 | const Int_t kNTdcWidthBins = 256; | |
250 | const Float_t kTdcWidthMin = 0; | |
251 | const Float_t kTdcWidthMax = 200.; | |
252 | const Int_t kNChargeBins = 1024; | |
253 | const Float_t kChargeMin = 0; | |
254 | const Float_t kChargeMax = 1024; | |
255 | const Int_t kNChannelBins = 16; | |
256 | const Float_t kChannelMin = 0; | |
257 | const Float_t kChannelMax = 16; | |
258 | const Int_t kNPedestalBins = 200; | |
259 | const Float_t kPedestalMin = 0; | |
69e96215 | 260 | const Float_t kPedestalMax = 200; |
261 | const Int_t kNPairBins = 8; | |
262 | const Float_t kPairMin = 0; | |
263 | const Float_t kPairMax = 8; | |
a6f3cc02 | 264 | |
265 | TH2I * h2i; | |
266 | TH2F * h2d; | |
267 | TH1I * h1i; | |
268 | TH1F * h1d; | |
269 | ||
270 | int iHisto =0; | |
271 | ||
272 | // Creation of Cell Multiplicity Histograms | |
69e96215 | 273 | h1i = new TH1I("H1I_Multiplicity_ADA", "Number of fired cells in ADA;# of Cells;Entries", 10, 0, 10) ; |
a6f3cc02 | 274 | Add2RawsList(h1i,kMultiADA, !expert, image, saveCorr); iHisto++; |
69e96215 | 275 | h1i = new TH1I("H1I_Multiplicity_ADC", "Number of fired cells in ADC;# of Cells;Entries", 10, 0, 10) ; |
a6f3cc02 | 276 | Add2RawsList(h1i,kMultiADC, !expert, image, saveCorr); iHisto++; |
277 | ||
278 | // Creation of Total Charge Histograms | |
279 | h1d = new TH1F("H1D_Charge_ADA", "Total Charge in ADA;Charge [ADC counts];Counts", 4000, 0, 30000) ; | |
280 | Add2RawsList(h1d,kChargeADA, !expert, image, saveCorr); iHisto++; | |
281 | h1d = new TH1F("H1D_Charge_ADC", "Total Charge in ADC;Charge [ADC counts];Counts", 4000, 0, 50000) ; | |
282 | Add2RawsList(h1d,kChargeADC, !expert, image, saveCorr); iHisto++; | |
283 | h1d = new TH1F("H1D_Charge_AD", "Total Charge in AD;Charge [ADC counts];Counts", 4000, 0, 80000) ; | |
284 | Add2RawsList(h1d,kChargeAD, !expert, image, saveCorr); iHisto++; | |
285 | ||
286 | ||
287 | // Creation of Charge EoI histogram | |
288 | h2d = new TH2F("H2D_ChargeEoI", "Charge Event of Interest;Channel Number;Charge [ADC counts]" | |
289 | ,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, 2.*kChargeMax); | |
290 | Add2RawsList(h2d,kChargeEoI, !expert, image, saveCorr); iHisto++; | |
291 | ||
292 | for(Int_t iInt=0;iInt<kNintegrator;iInt++){ | |
293 | // Creation of Pedestal histograms | |
294 | h2i = new TH2I(Form("H2I_Pedestal_Int%d",iInt), Form("Pedestal (Int%d);Channel;Pedestal [ADC counts]",iInt) | |
295 | ,kNChannelBins, kChannelMin, kChannelMax,kNPedestalBins,kPedestalMin ,kPedestalMax ); | |
296 | Add2RawsList(h2i,(iInt == 0 ? kPedestalInt0 : kPedestalInt1), !expert, image, saveCorr); iHisto++; | |
297 | ||
298 | ||
299 | // Creation of Charge EoI histograms | |
300 | h2i = new TH2I(Form("H2I_ChargeEoI_Int%d",iInt), Form("Charge EoI (Int%d);Channel;Charge [ADC counts]",iInt) | |
301 | ,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax); | |
302 | Add2RawsList(h2i,(iInt == 0 ? kChargeEoIInt0 : kChargeEoIInt1), !expert, image, saveCorr); iHisto++; | |
303 | ||
304 | } | |
305 | ||
306 | // Creation of Time histograms | |
307 | h2i = new TH2I("H2I_Width", "HPTDC Width;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax); | |
308 | Add2RawsList(h2i,kWidth, !expert, image, saveCorr); iHisto++; | |
cf283524 | 309 | |
310 | h2i = new TH2I("H2I_Width_BB", "HPTDC Width w/ BB Flag condition;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax); | |
311 | Add2RawsList(h2i,kWidthBB, !expert, image, saveCorr); iHisto++; | |
312 | ||
313 | h2i = new TH2I("H2I_Width_BG", "HPTDC Width w/ BG Flag condition;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax); | |
314 | Add2RawsList(h2i,kWidthBG, !expert, image, saveCorr); iHisto++; | |
a6f3cc02 | 315 | |
316 | h2i = new TH2I("H2I_HPTDCTime", "HPTDC Time;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax); | |
317 | Add2RawsList(h2i,kHPTDCTime, !expert, image, saveCorr); iHisto++; | |
cf283524 | 318 | |
319 | h2i = new TH2I("H2I_HPTDCTime_BB", "HPTDC Time w/ BB Flag condition;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax); | |
320 | Add2RawsList(h2i,kHPTDCTimeBB, !expert, image, !saveCorr); iHisto++; | |
321 | ||
322 | h2i = new TH2I("H2I_HPTDCTime_BG", "HPTDC Time w/ BG Flag condition;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax); | |
323 | Add2RawsList(h2i,kHPTDCTimeBG, !expert, image, !saveCorr); iHisto++; | |
a6f3cc02 | 324 | |
325 | h1d = new TH1F("H1D_ADA_Time", "ADA Time;Time [ns];Counts",kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax); | |
326 | Add2RawsList(h1d,kADATime, !expert, image, saveCorr); iHisto++; | |
327 | ||
328 | h1d = new TH1F("H1D_ADC_Time", "ADC Time;Time [ns];Counts",kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax); | |
329 | Add2RawsList(h1d,kADCTime, !expert, image, saveCorr); iHisto++; | |
330 | ||
331 | h1d = new TH1F("H1D_Diff_Time","Diff ADA-ADC Time;Time [ns];Counts",kNTdcTimeBins, -50., 50.); | |
332 | Add2RawsList(h1d,kDiffTime, !expert, image, saveCorr); iHisto++; | |
333 | ||
334 | h2d = new TH2F("H2D_TimeADA_ADC", "Mean Time in ADC versus ADA;Time ADA [ns];Time ADC [ns]", kNTdcTimeBins/8, kTdcTimeMin,kTdcTimeMax,kNTdcTimeBins/8, kTdcTimeMin,kTdcTimeMax) ; | |
335 | Add2RawsList(h2d,kTimeADAADC, !expert, image, saveCorr); iHisto++; | |
336 | ||
69e96215 | 337 | //Creation of pair coincidence histograms |
b8cf9c79 | 338 | h1i = new TH1I("H1I_MultiCoincidence_ADA", "Number of coincidences in ADA;# of Coincidences;Entries", 5, 0, 5) ; |
69e96215 | 339 | Add2RawsList(h1i,kNCoincADA, !expert, image, saveCorr); iHisto++; |
b8cf9c79 | 340 | h1i = new TH1I("H1I_MultiCoincidence_ADC", "Number of coincidences in ADC;# of Coincidences;Entries", 5, 0, 5) ; |
69e96215 | 341 | Add2RawsList(h1i,kNCoincADC, !expert, image, saveCorr); iHisto++; |
342 | ||
b8cf9c79 | 343 | h2d = new TH2F("H2D_Pair_Diff_Time","Diff Pair Time;Pair number;Time [ns]",kNPairBins, kPairMin, kPairMax,kNTdcTimeBins, -50., 50.); |
69e96215 | 344 | Add2RawsList(h2d,kPairDiffTime, !expert, image, saveCorr); iHisto++; |
b8cf9c79 | 345 | |
346 | h2d = new TH2F("H2D_Pair_Diff_Charge","Diff Pair Charge;Pair number;Charge [ADC counts]",kNPairBins, kPairMin, kPairMax, 2*kNChargeBins, -kChargeMax, kChargeMax); | |
347 | Add2RawsList(h2d,kPairDiffCharge, !expert, image, saveCorr); iHisto++; | |
a6f3cc02 | 348 | |
cf283524 | 349 | //Creation of Clock histograms |
350 | h2d = new TH2F("H2D_BBFlagVsClock", "BB-Flags Versus LHC-Clock;Channel;LHC Clocks",kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 ); | |
351 | Add2RawsList(h2d,kBBFlagVsClock, !expert, image, saveCorr); iHisto++; | |
352 | ||
353 | h2d = new TH2F("H2D_BGFlagVsClock", "BG-Flags Versus LHC-Clock;Channel;LHC Clocks",kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 ); | |
354 | Add2RawsList(h2d,kBGFlagVsClock, !expert, image, saveCorr); iHisto++; | |
355 | ||
356 | for(Int_t iInt=0;iInt<kNintegrator;iInt++){ | |
357 | h2d = new TH2F(Form("H2D_ChargeVsClock_Int%d",iInt), Form("Charge Versus LHC-Clock (Int%d);Channel;LHCClock;Charge [ADC counts]",iInt),kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 ); | |
358 | Add2RawsList(h2d,(iInt == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 ), expert, !image, !saveCorr); iHisto++; | |
359 | } | |
360 | ||
78c1b015 | 361 | h2d = new TH2F("H2D_BBFlagPerChannel", "BB-Flags Versus Channel;Channel;BB Flags Count",kNChannelBins, kChannelMin, kChannelMax,22,-0.5,21.5); |
95930403 | 362 | Add2RawsList(h2d,kBBFlagsPerChannel, !expert, image, saveCorr); iHisto++; |
363 | ||
364 | h2d = new TH2F("H2D_BGFlagPerChannel", "BG-Flags Versus Channel;Channel;BG Flags Count",kNChannelBins, kChannelMin, kChannelMax,22,-0.5,21.5); | |
365 | Add2RawsList(h2d,kBGFlagsPerChannel, !expert, image, saveCorr); iHisto++; | |
69e96215 | 366 | |
a6f3cc02 | 367 | AliDebug(AliQAv1::GetQADebugLevel(), Form("%d Histograms has been added to the Raws List",iHisto)); |
368 | // | |
369 | ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line | |
370 | } | |
371 | ||
372 | //____________________________________________________________________________ | |
373 | void AliADQADataMakerRec::MakeRaws(AliRawReader* rawReader) | |
374 | { | |
375 | // Fills histograms with Raws, computes average ADC values dynamically (pedestal subtracted) | |
376 | ||
377 | ||
378 | // Check id histograms already created for this Event Specie | |
379 | if ( ! GetRawsData(kPedestalInt0) ) | |
380 | InitRaws() ; | |
381 | ||
382 | rawReader->Reset() ; | |
383 | AliADRawStream* rawStream = new AliADRawStream(rawReader); | |
384 | if(!(rawStream->Next())) return; | |
385 | ||
386 | eventTypeType eventType = rawReader->GetType(); | |
387 | ||
388 | Int_t mulADA = 0 ; | |
389 | Int_t mulADC = 0 ; | |
390 | Double_t timeADA =0., timeADC = 0.; | |
391 | Double_t weightADA =0., weightADC = 0.; | |
392 | UInt_t itimeADA=0, itimeADC=0; | |
393 | Double_t chargeADA=0., chargeADC=0.; | |
394 | ||
395 | Double_t diffTime=-100000.; | |
69e96215 | 396 | |
397 | Int_t pmulADA = 0; | |
398 | Int_t pmulADC = 0; | |
399 | Double_t pDiffTime =-100000.; | |
a6f3cc02 | 400 | |
401 | ||
402 | switch (eventType){ | |
403 | case PHYSICS_EVENT: | |
404 | ||
405 | // fNTotEvents++; // Use framework counters instead | |
406 | ||
407 | Int_t iFlag=0; | |
408 | Int_t pedestal; | |
69e96215 | 409 | Int_t integrator[16]; |
a6f3cc02 | 410 | Bool_t flagBB[16]; |
411 | Bool_t flagBG[16]; | |
412 | Float_t charge; | |
413 | Int_t offlineCh; | |
414 | Float_t adc[16], time[16], width[16], timeCorr[16]; | |
69e96215 | 415 | Int_t iPair=0; |
a6f3cc02 | 416 | |
417 | for(Int_t iChannel=0; iChannel<16; iChannel++) { // BEGIN : Loop over channels | |
418 | ||
419 | offlineCh = rawStream->GetOfflineChannel(iChannel); | |
420 | ||
421 | // Fill Pedestal histograms | |
422 | ||
423 | for(Int_t j=15; j<21; j++) { | |
424 | if((rawStream->GetBGFlag(iChannel,j) || rawStream->GetBBFlag(iChannel,j))) iFlag++; | |
425 | } | |
426 | ||
427 | if(iFlag == 0){ //No Flag found | |
428 | for(Int_t j=15; j<21; j++){ | |
429 | pedestal= (Int_t) rawStream->GetPedestal(iChannel, j); | |
69e96215 | 430 | integrator[offlineCh] = rawStream->GetIntegratorFlag(iChannel, j); |
a6f3cc02 | 431 | |
69e96215 | 432 | FillRawsData((integrator[offlineCh] == 0 ? kPedestalInt0 : kPedestalInt1),offlineCh,pedestal); |
a6f3cc02 | 433 | } |
434 | } | |
435 | ||
436 | // Fill Charge EoI histograms | |
437 | ||
438 | adc[offlineCh] = 0.0; | |
439 | ||
440 | // Search for the maximum charge in the train of 21 LHC clocks | |
441 | // regardless of the integrator which has been operated: | |
442 | Float_t maxadc = 0; | |
443 | Int_t imax = -1; | |
444 | Float_t adcPedSub[21]; | |
445 | for(Int_t iClock=0; iClock<21; iClock++){ | |
446 | Bool_t iIntegrator = rawStream->GetIntegratorFlag(iChannel,iClock); | |
69e96215 | 447 | Int_t k = offlineCh+16*iIntegrator; |
a6f3cc02 | 448 | |
a6f3cc02 | 449 | adcPedSub[iClock] = rawStream->GetPedestal(iChannel,iClock) - fCalibData->GetPedestal(k); |
450 | // if(adcPedSub[iClock] <= GetRecoParam()->GetNSigmaPed()*fCalibData->GetSigma(k)) { | |
451 | if(adcPedSub[iClock] <= 2.*fCalibData->GetSigma(k)) { | |
452 | adcPedSub[iClock] = 0; | |
453 | continue; | |
454 | } | |
455 | // if(iClock < GetRecoParam()->GetStartClock() || iClock > GetRecoParam()->GetEndClock()) continue; | |
456 | if(iClock < 8 || iClock > 12) continue; | |
457 | if(adcPedSub[iClock] > maxadc) { | |
458 | maxadc = adcPedSub[iClock]; | |
459 | imax = iClock; | |
460 | } | |
461 | } | |
462 | //printf(Form("Channel %d (online), %d (offline)\n",iChannel,j)); | |
463 | if (imax != -1) { | |
464 | // Int_t start = imax - GetRecoParam()->GetNPreClocks(); | |
465 | Int_t start = imax - 2; | |
466 | if (start < 0) start = 0; | |
467 | // Int_t end = imax + GetRecoParam()->GetNPostClocks(); | |
468 | Int_t end = imax + 1; | |
469 | if (end > 20) end = 20; | |
470 | for(Int_t iClock = start; iClock <= end; iClock++) { | |
471 | adc[offlineCh] += adcPedSub[iClock]; | |
472 | } | |
473 | } | |
474 | ||
475 | ||
476 | Int_t iClock = imax; | |
477 | charge = rawStream->GetPedestal(iChannel,iClock); // Charge at the maximum | |
478 | ||
69e96215 | 479 | integrator[offlineCh] = rawStream->GetIntegratorFlag(iChannel,iClock); |
a6f3cc02 | 480 | flagBB[offlineCh] = rawStream->GetBBFlag(iChannel, iClock); |
481 | flagBG[offlineCh] = rawStream->GetBGFlag(iChannel,iClock ); | |
482 | Int_t board = AliADCalibData::GetBoardNumber(offlineCh); | |
483 | time[offlineCh] = rawStream->GetTime(iChannel)*fCalibData->GetTimeResolution(board); | |
484 | width[offlineCh] = rawStream->GetWidth(iChannel)*fCalibData->GetWidthResolution(board); | |
485 | ||
486 | if (time[offlineCh] >= 1e-6) FillRawsData(kChargeEoI,offlineCh,adc[offlineCh]); | |
487 | ||
69e96215 | 488 | FillRawsData((integrator[offlineCh] == 0 ? kChargeEoIInt0 : kChargeEoIInt1),offlineCh,charge); |
a6f3cc02 | 489 | |
69e96215 | 490 | Float_t sigma = fCalibData->GetSigma(offlineCh+16*integrator[offlineCh]); |
a6f3cc02 | 491 | |
492 | if((adc[offlineCh] > 2.*sigma) && !(time[offlineCh] <1.e-6)){ | |
493 | if(offlineCh<8) { | |
494 | mulADC++; | |
495 | chargeADC += adc[offlineCh]; | |
496 | ||
497 | } else { | |
498 | mulADA++; | |
499 | chargeADA += adc[offlineCh]; | |
500 | } | |
501 | } | |
502 | ||
503 | ||
504 | // Fill HPTDC Time Histograms | |
505 | timeCorr[offlineCh] = CorrectLeadingTime(offlineCh,time[offlineCh],adc[offlineCh]); | |
506 | ||
fcb6ff8b | 507 | //const Float_t p1 = 2.50; // photostatistics term in the time resolution |
508 | //const Float_t p2 = 3.00; // sleewing related term in the time resolution | |
a6f3cc02 | 509 | if(timeCorr[offlineCh]>-1024 + 1.e-6){ |
fcb6ff8b | 510 | //Float_t nphe = adc[offlineCh]*kChargePerADC/(fCalibData->GetGain(offlineCh)*TMath::Qe()); |
69e96215 | 511 | Float_t timeErr = 1; |
512 | /*/ | |
a6f3cc02 | 513 | if (nphe>1.e-6) timeErr = TMath::Sqrt(kIntTimeRes*kIntTimeRes+ |
514 | p1*p1/nphe+ | |
515 | p2*p2*(fTimeSlewing->GetParameter(0)*fTimeSlewing->GetParameter(1))*(fTimeSlewing->GetParameter(0)*fTimeSlewing->GetParameter(1))* | |
516 | TMath::Power(adc[offlineCh]/fCalibData->GetCalibDiscriThr(offlineCh,kTRUE),2.*(fTimeSlewing->GetParameter(1)-1.))/ | |
69e96215 | 517 | (fCalibData->GetCalibDiscriThr(offlineCh,kTRUE)*fCalibData->GetCalibDiscriThr(offlineCh,kTRUE)));/*/ |
a6f3cc02 | 518 | |
519 | if (timeErr>1.e-6) { | |
520 | if (offlineCh<8) { | |
521 | itimeADC++; | |
522 | timeADC += timeCorr[offlineCh]/(timeErr*timeErr); | |
523 | weightADC += 1./(timeErr*timeErr); | |
524 | }else{ | |
525 | itimeADA++; | |
526 | timeADA += timeCorr[offlineCh]/(timeErr*timeErr); | |
527 | weightADA += 1./(timeErr*timeErr); | |
528 | } | |
529 | } | |
530 | } | |
cf283524 | 531 | |
95930403 | 532 | // Fill Flag and Charge Versus LHC-Clock histograms |
78c1b015 | 533 | Int_t nbbFlag = 0; |
95930403 | 534 | Int_t nbgFlag = 0; |
78c1b015 | 535 | |
cf283524 | 536 | for(Int_t iEvent=0; iEvent<21; iEvent++){ |
537 | charge = rawStream->GetPedestal(iChannel,iEvent); | |
538 | Int_t intgr = rawStream->GetIntegratorFlag(iChannel,iEvent); | |
539 | Bool_t bbFlag = rawStream->GetBBFlag(iChannel, iEvent); | |
540 | Bool_t bgFlag = rawStream->GetBGFlag(iChannel,iEvent ); | |
78c1b015 | 541 | if(bbFlag) nbbFlag++; |
95930403 | 542 | if(bgFlag) nbgFlag++; |
78c1b015 | 543 | |
cf283524 | 544 | FillRawsData((intgr == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 ), offlineCh,(float)iEvent-10,(float)charge); |
545 | FillRawsData(kBBFlagVsClock, offlineCh,(float)iEvent-10,(float)bbFlag); | |
546 | FillRawsData(kBGFlagVsClock, offlineCh,(float)iEvent-10,(float)bgFlag); | |
78c1b015 | 547 | |
cf283524 | 548 | } |
78c1b015 | 549 | FillRawsData(kBBFlagsPerChannel, offlineCh,nbbFlag); |
95930403 | 550 | FillRawsData(kBGFlagsPerChannel, offlineCh,nbgFlag); |
551 | ||
552 | FillRawsData(kHPTDCTime,offlineCh,timeCorr[offlineCh]); | |
553 | FillRawsData(kWidth,offlineCh,width[offlineCh]); | |
554 | //if(flagBB[offlineCh]) { | |
555 | if(nbbFlag > 0){ | |
556 | FillRawsData(kHPTDCTimeBB,offlineCh,timeCorr[offlineCh]); | |
557 | FillRawsData(kWidthBB,offlineCh,width[offlineCh]); | |
558 | } | |
559 | //if(flagBG[offlineCh]) { | |
560 | if(nbgFlag > 0){ | |
561 | FillRawsData(kHPTDCTimeBG,offlineCh,timeCorr[offlineCh]); | |
562 | FillRawsData(kWidthBG,offlineCh,width[offlineCh]); | |
563 | } | |
564 | ||
a6f3cc02 | 565 | |
566 | }// END of Loop over channels | |
69e96215 | 567 | |
568 | for(Int_t iChannel=0; iChannel<4; iChannel++) {//Loop over pairs ADC | |
569 | offlineCh = rawStream->GetOfflineChannel(iChannel); | |
570 | Float_t sigma = fCalibData->GetSigma(offlineCh+16*integrator[offlineCh]); | |
571 | Float_t sigma4 = fCalibData->GetSigma(offlineCh+4+16*integrator[offlineCh]); | |
572 | if( ((adc[offlineCh] > 2.*sigma) && !(time[offlineCh] <1.e-6)) && ((adc[offlineCh+4] > 2.*sigma4) && !(time[offlineCh+4] <1.e-6)) ){ | |
573 | pmulADC++; | |
574 | if(timeCorr[offlineCh]<-1024.+1.e-6 || timeCorr[offlineCh+4]<-1024.+1.e-6) pDiffTime = -1024.; | |
575 | else pDiffTime = timeCorr[offlineCh+4] - timeCorr[offlineCh]; | |
576 | FillRawsData(kPairDiffTime,iPair,pDiffTime); | |
69e96215 | 577 | } |
b8cf9c79 | 578 | FillRawsData(kPairDiffCharge,iPair,TMath::Abs(adc[offlineCh]-adc[offlineCh+4])); |
579 | iPair++; | |
69e96215 | 580 | } |
581 | for(Int_t iChannel=8; iChannel<12; iChannel++) {//Loop over pairs ADA | |
582 | offlineCh = rawStream->GetOfflineChannel(iChannel); | |
583 | Float_t sigma = fCalibData->GetSigma(offlineCh+16*integrator[offlineCh]); | |
584 | Float_t sigma4 = fCalibData->GetSigma(offlineCh+4+16*integrator[offlineCh]); | |
b8cf9c79 | 585 | if( ((adc[offlineCh] > 2.*sigma) && !(time[offlineCh] <1.e-6)) && ((adc[offlineCh+4] > 2.*sigma4) && !(time[offlineCh+4] <1.e-6)) ){ |
586 | pmulADA++; | |
587 | if(timeCorr[offlineCh]<-1024.+1.e-6 || timeCorr[offlineCh+4]<-1024.+1.e-6) pDiffTime = -1024.; | |
69e96215 | 588 | else pDiffTime = timeCorr[offlineCh+4] - timeCorr[offlineCh]; |
589 | FillRawsData(kPairDiffTime,iPair,pDiffTime); | |
b8cf9c79 | 590 | } |
591 | FillRawsData(kPairDiffCharge,iPair,TMath::Abs(adc[offlineCh]-adc[offlineCh+4])); | |
592 | iPair++; | |
69e96215 | 593 | } |
594 | FillRawsData(kNCoincADA,pmulADA); | |
595 | FillRawsData(kNCoincADC,pmulADC); | |
596 | ||
597 | ||
a6f3cc02 | 598 | if(weightADA>1.e-6) timeADA /= weightADA; |
599 | else timeADA = -1024.; | |
600 | if(weightADC>1.e-6) timeADC /= weightADC; | |
601 | else timeADC = -1024.; | |
602 | if(timeADA<-1024.+1.e-6 || timeADC<-1024.+1.e-6) diffTime = -1024.; | |
603 | else diffTime = timeADA - timeADC; | |
604 | ||
605 | ||
606 | ||
607 | FillRawsData(kADATime,timeADA); | |
608 | FillRawsData(kADCTime,timeADC); | |
609 | FillRawsData(kDiffTime,diffTime); | |
610 | FillRawsData(kTimeADAADC,timeADA,timeADC); | |
611 | ||
612 | FillRawsData(kMultiADA,mulADA); | |
613 | FillRawsData(kMultiADC,mulADC); | |
614 | ||
615 | FillRawsData(kChargeADA,chargeADA); | |
616 | FillRawsData(kChargeADC,chargeADC); | |
617 | FillRawsData(kChargeAD,chargeADA + chargeADC); | |
618 | ||
619 | break; | |
620 | } // END of SWITCH : EVENT TYPE | |
621 | ||
622 | TParameter<double> * p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kMultiADA)->GetName()))) ; | |
623 | if (p) p->SetVal((double)mulADA) ; | |
624 | ||
625 | p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kMultiADC)->GetName()))) ; | |
626 | if (p) p->SetVal((double)mulADC) ; | |
627 | ||
628 | p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeADA)->GetName()))) ; | |
629 | if (p) p->SetVal((double)chargeADA) ; | |
630 | ||
631 | p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeADC)->GetName()))) ; | |
632 | if (p) p->SetVal((double)chargeADC) ; | |
633 | ||
634 | p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeAD)->GetName()))) ; | |
635 | if (p) p->SetVal((double)(chargeADA + chargeADC)) ; | |
636 | ||
637 | p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kADATime)->GetName()))) ; | |
638 | if (p) p->SetVal((double)timeADA) ; | |
639 | ||
640 | p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kADCTime)->GetName()))) ; | |
641 | if (p) p->SetVal((double)timeADC) ; | |
642 | ||
643 | p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kDiffTime)->GetName()))) ; | |
644 | if (p) p->SetVal((double)diffTime) ; | |
645 | ||
646 | delete rawStream; rawStream = 0x0; | |
647 | // | |
648 | IncEvCountCycleRaws(); | |
649 | IncEvCountTotalRaws(); | |
650 | // | |
651 | } | |
652 | ||
653 | //____________________________________________________________________________ | |
fcb6ff8b | 654 | Float_t AliADQADataMakerRec::CorrectLeadingTime(Int_t /*i*/, Float_t time, Float_t /*adc*/) const |
a6f3cc02 | 655 | { |
656 | // Correct the leading time | |
657 | // for slewing effect and | |
658 | // misalignment of the channels | |
659 | if (time < 1e-6) return -1024; | |
660 | ||
661 | // Channel alignment and general offset subtraction | |
662 | // if (i < 32) time -= kV0CDelayCables; | |
663 | // time -= fTimeOffset[i]; | |
664 | //AliInfo(Form("time-offset %f", time)); | |
665 | ||
666 | // In case of pathological signals | |
69e96215 | 667 | //if (adc < 1e-6) return time; |
a6f3cc02 | 668 | |
669 | // Slewing correction | |
69e96215 | 670 | //Float_t thr = fCalibData->GetCalibDiscriThr(i,kTRUE); |
a6f3cc02 | 671 | //AliInfo(Form("adc %f thr %f dtime %f ", adc,thr,fTimeSlewing->Eval(adc/thr))); |
69e96215 | 672 | //time -= fTimeSlewing->Eval(adc/thr); |
a6f3cc02 | 673 | |
674 | return time; | |
675 | } | |
676 |