Line data Source code
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 : // Produces the data needed to calculate the quality assurance.
17 : // All data must be mergeable objects.
18 :
19 :
20 : // Authors:
21 : //
22 : // Luciano Diaz Gonzalez <luciano.diaz@nucleares.unam.mx> (ICN-UNAM)
23 : // Mario Rodriguez Cahuantzi <mrodrigu@mail.cern.ch> (FCFM-BUAP)
24 : // Arturo Fernandez Tellez <afernan@mail.cern.ch (FCFM-BUAP)
25 : //
26 : // Created: June 13th 2008
27 : //---
28 : // Last update: Sept. 29th. 2011 (by Mario RC: mrodrigu@mail.cern.ch)
29 : // --> ACOMultiSL0_DQM_Shifter filling histogram fixed
30 : // --> Expert histogram updated: 2 histograms (Checks the hits for SL0 and AMU mode)
31 : // --> To be include in the next update: threshold settings from AliACORDEQAThreshold class (not yet)
32 : // Last update: May 5th. 2011 (by Mario RC: mrodrigu@mail.cern.ch) -->Creates QA expert histograms
33 : // and QA-shifter histograms also with threshold lines and visual alarm
34 : // Last Update: Aug. 27th 2008 --> Implementation to declare QA expert histogram
35 : // Last update: Nov. 14t 2009 --> MRC <mrodrigu@mail.cern.ch> (FCFM-BUAP)
36 : // |--> Change in Multiplicity histogram for AMORE (to detect empty triggers events of ACORDE)
37 :
38 :
39 :
40 : // --- ROOT system ---
41 : #include <TClonesArray.h>
42 : #include <TFile.h>
43 : #include <TH1F.h>
44 : #include <TDirectory.h>
45 : #include <TPaveText.h>
46 : // --- Standard library ---
47 :
48 : // --- AliRoot header files ---
49 : #include "AliESDEvent.h"
50 : #include "AliLog.h"
51 : #include "AliACORDEdigit.h"
52 : #include "AliACORDEhit.h"
53 : #include "AliACORDEQADataMakerRec.h"
54 : #include "AliQAChecker.h"
55 : #include "AliACORDERawReader.h"
56 : #include "AliACORDERawStream.h"
57 12 : ClassImp(AliACORDEQADataMakerRec)
58 :
59 : //____________________________________________________________________________
60 6 : AliACORDEQADataMakerRec::AliACORDEQADataMakerRec():AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kACORDE), "ACORDE Quality Assurance Data Maker")
61 10 : {
62 :
63 4 : }
64 : //____________________________________________________________________________
65 : AliACORDEQADataMakerRec::AliACORDEQADataMakerRec(const AliACORDEQADataMakerRec& qadm):
66 0 : AliQADataMakerRec()
67 0 : {
68 0 : SetName((const char*)qadm.GetName()) ;
69 0 : SetTitle((const char*)qadm.GetTitle());
70 0 : }
71 :
72 : //__________________________________________________________________
73 : AliACORDEQADataMakerRec::~AliACORDEQADataMakerRec()
74 0 : {
75 0 : }
76 :
77 : //__________________________________________________________________
78 : AliACORDEQADataMakerRec& AliACORDEQADataMakerRec::operator = (const AliACORDEQADataMakerRec& qadm )
79 : {
80 : // Equal operator.
81 0 : this->~AliACORDEQADataMakerRec();
82 0 : new(this) AliACORDEQADataMakerRec(qadm);
83 0 : return *this;
84 0 : }
85 : //____________________________________________________________________________
86 : void AliACORDEQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
87 : {
88 : //Detector specific actions at end of cycle
89 : // do the QA checking
90 0 : ResetEventTrigClasses(); // reset triggers list to select all histos
91 : // Update for DQM GUI
92 : //
93 :
94 0 : for (Int_t specie = 0; specie < AliRecoParam::kNSpecies ; specie++) {
95 0 : if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) continue ;
96 : //
97 : // RS Set event specie
98 0 : SetEventSpecie(AliRecoParam::ConvertIndex(specie));
99 : //
100 0 : for (int itc=-1;itc<GetNTrigClasses();itc++) { // RS Loop over the trigger classes
101 : //
102 0 : TObjArray * parr = GetRawsDataOfTrigClass(itc);
103 0 : if (!parr) continue;
104 : TObjArray &harr = *parr;
105 0 : TH1* h0 = (TH1*)harr[0];
106 0 : TH1* h2 = (TH1*)harr[2];
107 0 : if (!h0 || !h2) continue;
108 :
109 : Double_t integralSL0 = 0;
110 : Double_t integralAMU = 0;
111 :
112 0 : if ((itc==-1) && ( (integralAMU=h2->Integral()==0) || (integralSL0=h0->Integral()==0) ) ) continue;
113 :
114 0 : Float_t maxSL0 = 1*h0->GetMaximum();
115 : Float_t scaleSL0 = 0.;
116 0 : if (maxSL0!=0) scaleSL0 = 1/maxSL0;
117 : else scaleSL0 = 1.;
118 0 : h0->Scale(scaleSL0);
119 :
120 :
121 0 : Float_t maxAMU = 1*h2->GetMaximum();
122 : Float_t scaleAMU = 0.;
123 0 : if (maxAMU!=0) scaleAMU = 1/maxAMU;
124 : else scaleAMU = 1.;
125 0 : h2->Scale(scaleAMU);
126 :
127 : Int_t indexActiveModuleSL0 = 0;
128 : Int_t indexActiveModuleAMU = 0;
129 :
130 0 : for(Int_t iModule = 0; iModule < 60; iModule++){
131 0 : if (h0->GetBinContent(iModule) > 0) indexActiveModuleSL0++;
132 0 : if (h2->GetBinContent(iModule) > 0) indexActiveModuleAMU++;
133 : }
134 :
135 : Float_t meanHitsSL0 = 0.;
136 : Float_t meanHitsAMU = 0.;
137 : //if ((indexActiveModuleSL0==0) || (indexActiveModuleAMU == 0)) continue;
138 0 : if (indexActiveModuleAMU == 0) continue;
139 :
140 0 : meanHitsSL0 = h0->Integral()/indexActiveModuleSL0;
141 0 : meanHitsAMU = h2->Integral()/indexActiveModuleAMU;
142 :
143 0 : TH1* h6 = (TH1*)harr[6];
144 : //TH1* h7 = (TH1*)harr[7];
145 :
146 : //Int_t goodModulesSL0 = 0;
147 : //Int_t badModulesSL0 = 0;
148 : Int_t goodModulesAMU = 0;
149 : Int_t badModulesAMU = 0;
150 :
151 0 : for (Int_t imod = 0; imod < 60; imod++)
152 : {
153 : //if (TMath::Abs(h0->GetBinContent(imod)/meanHitsSL0-1) < 0.65) goodModulesSL0++;
154 : //else badModulesSL0++;
155 0 : if (meanHitsAMU!=0)
156 : {
157 0 : if (TMath::Abs(h2->GetBinContent(imod)/meanHitsAMU-1) <= 0.90) goodModulesAMU++;
158 0 : else badModulesAMU++;
159 : }
160 :
161 : }
162 0 : h6->Fill(1,goodModulesAMU);
163 0 : h6->Fill(2,badModulesAMU);
164 :
165 0 : Float_t maxMod = 1*h6->GetMaximum();
166 : Float_t scaleMaxMod = 0;
167 0 : if (maxMod!=0) scaleMaxMod = 1./maxMod;
168 : else scaleMaxMod = 0;
169 0 : h6->Scale(scaleMaxMod);
170 :
171 0 : TH1* h4 = (TH1*)harr[4];
172 0 : TH1* h5 = (TH1*)harr[5];
173 :
174 0 : if (h4 && h5 && meanHitsAMU!=0 && meanHitsSL0!=0){
175 0 : for (Int_t iModule = 0; iModule < 60; iModule++){
176 0 : h4->Fill(h0->GetBinContent(iModule)/meanHitsSL0-1);
177 0 : h5->Fill(h2->GetBinContent(iModule)/meanHitsAMU-1);
178 : }
179 0 : }
180 :
181 0 : } // end of trigger classes loop
182 0 : } // end specie loop
183 : // QA Checker standar (to be updated)
184 : //
185 0 : AliQAChecker::Instance()->Run(AliQAv1::kACORDE, task, list) ;
186 0 : }
187 :
188 : //____________________________________________________________________________
189 : void AliACORDEQADataMakerRec::StartOfDetectorCycle()
190 : {
191 : //Detector specific actions at start of cycle
192 :
193 0 : }
194 :
195 : //____________________________________________________________________________
196 : void AliACORDEQADataMakerRec::InitRaws()
197 : {
198 : // create Raw histograms in Raw subdir
199 :
200 : const Bool_t expert = kTRUE ;
201 : const Bool_t saveCorr = kTRUE ;
202 : const Bool_t image = kTRUE ;
203 0 : TH1F * fhACORDEBitPatternDQM = new TH1F("ACOHitsSL0_DQM_Shifter","Distribution of ACORDE fired modules for DQM shifter; No. of module; Counts",60,-0.5,59.5);// Hits histogram for QA-shifter ACO-SL0 trigger mode
204 0 : TH1F * fhACORDEMultiplicitySL0DQM = new TH1F("ACOMultiSL0_DQM_Shifter","Multiplicity of ACORDE fired modules for DQM shifter; No. of fired modules; No. of events",62,-1,60); // Multiplicity histo. for QA-shifter ACO-SL0 trigger mode
205 0 : TH1F * fhACORDEBitPatternAMUDQM = new TH1F("ACOHitsAMU_DQM_Shifter","Distribution of ACORDE fired modules for DQM shifter; No. of module; Counts",60,-0.5,59.5);// Hits histogram for QA-shifter ACO-SL0 trigger mode
206 0 : TH1F * fhACORDEMultiplicityAMUDQM = new TH1F("ACOMultiAMU_DQM_Shifter","Multiplicity of ACORDE fired modules for DQM shifter; No. of fired modules; No. of events",62,-1,60); // Multiplicity histo. for QA-shifter ACO-SL0 trigger mode
207 0 : TH1F * fhACORDEBitPatternCheckDQMSL0 = new TH1F("ACOHitsTriggerCheck_DQMExpertSL0","Check the activity of ACORDE's modules; Hits per module/mean of Hits; Counts",100,-3,5); // Check the trigger status of ACORDE (SL0 vs AMU)
208 0 : TH1F * fhACORDEBitPatternCheckDQMAMU = new TH1F("ACOHitsTriggerCheck_DQMExpertAMU","Check the activity of ACORDE's modules; Hits per module/mean of Hits; Counts",100,-3,5); // Check the trigger status of ACORDE (SL0 vs AMU)
209 :
210 : //const char *acoStatus[4]={"O.K.","High","Low","Not O.K."};
211 0 : const char *acoStatus[2]={"STABLE RATE","FLUCTUATING RATE"};
212 :
213 :
214 :
215 0 : TH1F * fhACORDEStatusAMU_DQM = new TH1F("fhACORDEStatusAMU_DQM","Status of rate for ACORDE's modules (AMU mode)",2,1,3);
216 0 : for (Int_t i=0;i<2;i++)
217 : {
218 0 : fhACORDEStatusAMU_DQM->GetXaxis()->SetBinLabel(i+1,acoStatus[i]);
219 : }
220 0 : fhACORDEStatusAMU_DQM->SetYTitle("No. of modules (Norm.)");
221 :
222 0 : Add2RawsList(fhACORDEStatusAMU_DQM,6,!expert,image,!saveCorr);
223 :
224 0 : fhACORDEStatusAMU_DQM->SetFillColor(kAzure-7);
225 :
226 :
227 : // Expert histograms
228 : // Check the hits multiplicity from trigger configuration
229 0 : Add2RawsList(fhACORDEBitPatternCheckDQMSL0,4,expert,image,!saveCorr);
230 0 : fhACORDEBitPatternCheckDQMSL0->SetFillColor(kOrange);
231 0 : Add2RawsList(fhACORDEBitPatternCheckDQMAMU,5,expert,image,!saveCorr);
232 0 : fhACORDEBitPatternCheckDQMAMU->SetFillColor(kRed+2);
233 :
234 :
235 : // AMORE diplay settings for shifter on GUI
236 :
237 : // For SL0 ACO trigger mode
238 :
239 0 : Add2RawsList(fhACORDEBitPatternDQM,0,expert,image,!saveCorr);
240 0 : ForbidCloning(fhACORDEBitPatternDQM);
241 0 : Add2RawsList(fhACORDEMultiplicitySL0DQM,1,expert,image,!saveCorr);
242 0 : ForbidCloning(fhACORDEMultiplicitySL0DQM);
243 :
244 : // For Hits distribution on ACORDE
245 :
246 0 : fhACORDEBitPatternDQM->SetFillColor(kMagenta+2);
247 :
248 : // For ACORDE Multiplicity distribution of fired modules
249 :
250 0 : fhACORDEMultiplicitySL0DQM->SetFillColor(kMagenta);
251 :
252 : // For AMU ACO trigger mode
253 :
254 0 : Add2RawsList(fhACORDEBitPatternAMUDQM,2,expert,image,!saveCorr);
255 0 : Add2RawsList(fhACORDEMultiplicityAMUDQM,3,expert,image,!saveCorr);
256 :
257 : // For Hits distribution on ACORDE
258 :
259 0 : fhACORDEBitPatternAMUDQM->SetFillColor(kViolet+7);
260 :
261 : // For ACORDE Multiplicity distribution of fired modules
262 :
263 0 : fhACORDEMultiplicityAMUDQM->SetFillColor(kViolet+6);
264 :
265 : //
266 0 : ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
267 0 : }
268 :
269 : //____________________________________________________________________________
270 : void AliACORDEQADataMakerRec::InitDigits()
271 : {
272 : // create Digits histograms in Digits subdir
273 :
274 : const Bool_t expert = kTRUE ;
275 : const Bool_t image = kTRUE ;
276 : TH1F * fhDigitsModule;
277 0 : const char *acoModule[60]={"0_0","0_1","0_2","0_3","0_4","0_5","0_6","0_7","0_8","0_9",
278 : "1_0","1_1","1_2","1_3","1_4","1_5","1_6","1_7","1_8","1_9",
279 : "2_0","2_1","2_2","2_3","2_4","2_5","2_6","2_7","2_8","2_9",
280 : "3_0","3_1","3_2","3_3","3_4","3_5","3_6","3_7","3_8","3_9",
281 : "4_0","4_1","4_2","4_3","4_4","4_5","4_6","4_7","4_8","4_9",
282 : "5_0","5_1","5_2","5_3","5_4","5_5","5_6","5_7","5_8","5_9"};
283 :
284 :
285 0 : fhDigitsModule = new TH1F("ACORDEBitPatternfromDigits","Distribution of ACORDE from DIGITS;Modules;Counts",60,1,60);
286 0 : Add2DigitsList(fhDigitsModule,0,!expert,image);
287 0 : for (Int_t i=0;i<60;i++) fhDigitsModule->GetXaxis()->SetBinLabel(i+1,acoModule[i]);
288 : //
289 0 : ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
290 0 : }
291 :
292 : //____________________________________________________________________________
293 :
294 : void AliACORDEQADataMakerRec::InitRecPoints()
295 : {
296 : // create cluster histograms in RecPoint subdir
297 : // Not needed for ACORDE by now !!!
298 : //
299 0 : ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
300 0 : }
301 :
302 : //____________________________________________________________________________
303 : void AliACORDEQADataMakerRec::InitESDs()
304 : {
305 : //create ESDs histograms in ESDs subdir
306 :
307 : const Bool_t expert = kTRUE ;
308 : const Bool_t image = kTRUE ;
309 :
310 : TH1F * fhESDsSingle;
311 : TH1F * fhESDsMulti;
312 : TH1F * fhESDsMultiplicity;
313 0 : const char *acoModule[60]={"0_0","0_1","0_2","0_3","0_4","0_5","0_6","0_7","0_8","0_9",
314 : "1_0","1_1","1_2","1_3","1_4","1_5","1_6","1_7","1_8","1_9",
315 : "2_0","2_1","2_2","2_3","2_4","2_5","2_6","2_7","2_8","2_9",
316 : "3_0","3_1","3_2","3_3","3_4","3_5","3_6","3_7","3_8","3_9",
317 : "4_0","4_1","4_2","4_3","4_4","4_5","4_6","4_7","4_8","4_9",
318 : "5_0","5_1","5_2","5_3","5_4","5_5","5_6","5_7","5_8","5_9"};
319 :
320 :
321 0 : fhESDsSingle = new TH1F("ACORDEBitPatternfromESDsSingle","Distribution of ACORDE fired modules from ESDs-Single;Modules;Counts",60,1,60);
322 0 : Add2ESDsList(fhESDsSingle,0,!expert,image);
323 :
324 0 : fhESDsMulti = new TH1F("ACORDEBitPatternfromESDsMulti","Distribution of ACORDE fired modules from ESDs-Multi;Modules;Counts",60,1,60);
325 0 : Add2ESDsList(fhESDsMulti,1,!expert,image);
326 :
327 0 : fhESDsMultiplicity = new TH1F("ACORDEMultiplicityfromESD","Number of fired ACORDE modules; No. of fired ACORDE modules;No. of events in ACORDE",60,-0.5,60);
328 0 : Add2ESDsList(fhESDsMultiplicity,2,!expert,image);
329 0 : for (Int_t i=0;i<60;i++)
330 : {
331 0 : fhESDsSingle->GetXaxis()->SetBinLabel(i+1,acoModule[i]);
332 0 : fhESDsMulti->GetXaxis()->SetBinLabel(i+1,acoModule[i]);
333 : }
334 : //
335 0 : ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
336 0 : }
337 : //____________________________________________________________________________
338 : void AliACORDEQADataMakerRec::MakeRaws(AliRawReader* rawReader)
339 : {
340 : //fills QA histos for RAW
341 0 : IncEvCountCycleRaws();
342 0 : IncEvCountTotalRaws();
343 0 : rawReader->Reset();
344 0 : AliACORDERawStream rawStream(rawReader);
345 : size_t contSingle=0;
346 : size_t contMulti=0;
347 : UInt_t dy[4];
348 :
349 0 : bool kroSingle[60],kroMulti[60];
350 : UInt_t tmpDy;
351 :
352 0 : for(Int_t m=0;m<60;m++) {kroSingle[m]=0;kroMulti[m]=0;}
353 :
354 0 : if(rawStream.Next())
355 : {
356 0 : dy[0]=rawStream.GetWord(0);
357 0 : dy[1]=rawStream.GetWord(1);
358 0 : dy[2]=rawStream.GetWord(2);
359 0 : dy[3]=rawStream.GetWord(3);
360 : tmpDy=dy[0];
361 0 : for(Int_t r=0;r<30;r++)
362 : {
363 0 : kroSingle[r] = tmpDy & 1;
364 0 : tmpDy>>=1;
365 : }
366 : tmpDy=dy[1];
367 0 : for(Int_t r=30;r<60;r++)
368 : {
369 0 : kroSingle[r] = tmpDy & 1;
370 0 : tmpDy>>=1;
371 : }
372 : tmpDy=dy[2];
373 0 : for(Int_t r=0;r<30;r++)
374 : {
375 0 : kroMulti[r] = tmpDy & 1;
376 0 : tmpDy>>=1;
377 : }
378 : tmpDy=dy[3];
379 0 : for(Int_t r=30;r<60;r++)
380 : {
381 0 : kroMulti[r] = tmpDy & 1;
382 0 : tmpDy>>=1;
383 : }
384 : contSingle=0;
385 : contMulti=0;
386 0 : for(Int_t r=0;r<60;r++)
387 : {
388 0 : if(kroSingle[r]==1)
389 : {
390 0 : FillRawsData(0,r);
391 : //FillRawsData(4,r);
392 0 : contSingle++;
393 0 : }
394 0 : if(kroMulti[r]==1)
395 : {
396 0 : FillRawsData(2,r);
397 : //FillRawsData(6,r);
398 0 : contMulti++;
399 0 : }
400 :
401 : }
402 0 : FillRawsData(1,contSingle);
403 0 : FillRawsData(3,contMulti);
404 : // FillRawsData(7,contMulti);
405 : }
406 0 : }
407 : //____________________________________________________________________________
408 : void AliACORDEQADataMakerRec::MakeDigits( TTree *digitsTree)
409 : {
410 : //fills QA histos for Digits
411 0 : IncEvCountCycleDigits();
412 0 : IncEvCountTotalDigits();
413 :
414 0 : if (fDigitsArray)
415 0 : fDigitsArray->Clear() ;
416 : else
417 0 : fDigitsArray = new TClonesArray("AliACORDEdigit",1000);
418 0 : TBranch * branch = digitsTree->GetBranch("ACORDEdigit");
419 0 : if (!branch) {
420 0 : AliWarning("ACORDE branch in Digits Tree not found");
421 0 : } else {
422 0 : branch->SetAddress(&fDigitsArray);
423 0 : for(Int_t track = 0 ; track < branch->GetEntries() ; track++) {
424 0 : branch->GetEntry(track);
425 0 : for(Int_t idigit = 0 ; idigit < fDigitsArray->GetEntriesFast() ; idigit++) {
426 0 : AliACORDEdigit *AcoDigit = (AliACORDEdigit*) fDigitsArray->UncheckedAt(idigit);
427 0 : if (!AcoDigit) {
428 0 : AliError("The unchecked digit doesn't exist");
429 0 : continue ;
430 : }
431 0 : FillDigitsData(0,AcoDigit->GetModule()-1);
432 0 : }
433 : }
434 : }
435 0 : }
436 :
437 : //____________________________________________________________________________
438 : void AliACORDEQADataMakerRec::MakeESDs(AliESDEvent * esd)
439 : {
440 : //fills QA histos for ESD
441 0 : IncEvCountCycleESDs();
442 0 : IncEvCountTotalESDs();
443 : //
444 0 : AliESDACORDE * fESDACORDE= esd->GetACORDEData();
445 : Int_t acoMulti=0;
446 0 : for(int i=0;i<60;i++)
447 : {
448 0 : if(fESDACORDE->GetHitChannel(i))
449 : {
450 0 : FillESDsData(0,i+1);
451 0 : FillESDsData(1,i+1);
452 0 : acoMulti++;
453 0 : }
454 0 : } FillESDsData(2,acoMulti);
455 :
456 0 : }
|