1 /**************************************************************************
\r
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
\r
4 * Author: The ALICE Off-line Project. *
\r
5 * Contributors are mentioned in the code where appropriate. *
\r
7 * Permission to use, copy, modify and distribute this software and its *
\r
8 * documentation strictly for non-commercial purposes is hereby granted *
\r
9 * without fee, provided that the above copyright notice appears in all *
\r
10 * copies and that both the copyright notice and this permission notice *
\r
11 * appear in the supporting documentation. The authors make no claims *
\r
12 * about the suitability of this software for any purpose. It is *
\r
13 * provided "as is" without express or implied warranty. *
\r
14 **************************************************************************/
\r
16 // Produces the data needed to calculate the quality assurance.
\r
17 // All data must be mergeable objects.
\r
22 // Luciano Diaz Gonzalez <luciano.diaz@nucleares.unam.mx> (ICN-UNAM)
\r
23 // Mario Rodriguez Cahuantzi <mrodrigu@mail.cern.ch> (FCFM-BUAP)
\r
24 // Arturo Fernandez Tellez <afernan@mail.cern.ch (FCFM-BUAP)
\r
26 // Created: June 13th 2008
\r
28 // Last update: Sept. 29th. 2011 (by Mario RC: mrodrigu@mail.cern.ch)
\r
29 // --> ACOMultiSL0_DQM_Shifter filling histogram fixed
\r
30 // --> Expert histogram updated: 2 histograms (Checks the hits for SL0 and AMU mode)
\r
31 // --> To be include in the next update: threshold settings from AliACORDEQAThreshold class (not yet)
\r
32 // Last update: May 5th. 2011 (by Mario RC: mrodrigu@mail.cern.ch) -->Creates QA expert histograms
\r
33 // and QA-shifter histograms also with threshold lines and visual alarm
\r
34 // Last Update: Aug. 27th 2008 --> Implementation to declare QA expert histogram
\r
35 // Last update: Nov. 14t 2009 --> MRC <mrodrigu@mail.cern.ch> (FCFM-BUAP)
\r
36 // |--> Change in Multiplicity histogram for AMORE (to detect empty triggers events of ACORDE)
\r
40 // --- ROOT system ---
\r
41 #include <TClonesArray.h>
\r
44 #include <TDirectory.h>
\r
45 #include <TPaveText.h>
\r
46 // --- Standard library ---
\r
48 // --- AliRoot header files ---
\r
49 #include "AliESDEvent.h"
\r
51 #include "AliACORDEdigit.h"
\r
52 #include "AliACORDEhit.h"
\r
53 #include "AliACORDEQADataMakerRec.h"
\r
54 #include "AliQAChecker.h"
\r
55 #include "AliACORDERawReader.h"
\r
56 #include "AliACORDERawStream.h"
\r
57 ClassImp(AliACORDEQADataMakerRec)
\r
59 //____________________________________________________________________________
\r
60 AliACORDEQADataMakerRec::AliACORDEQADataMakerRec():AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kACORDE), "ACORDE Quality Assurance Data Maker")
\r
64 //____________________________________________________________________________
\r
65 AliACORDEQADataMakerRec::AliACORDEQADataMakerRec(const AliACORDEQADataMakerRec& qadm):
\r
68 SetName((const char*)qadm.GetName()) ;
\r
69 SetTitle((const char*)qadm.GetTitle());
\r
72 //__________________________________________________________________
\r
73 AliACORDEQADataMakerRec::~AliACORDEQADataMakerRec()
\r
77 //__________________________________________________________________
\r
78 AliACORDEQADataMakerRec& AliACORDEQADataMakerRec::operator = (const AliACORDEQADataMakerRec& qadm )
\r
81 this->~AliACORDEQADataMakerRec();
\r
82 new(this) AliACORDEQADataMakerRec(qadm);
\r
85 //____________________________________________________________________________
\r
86 void AliACORDEQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
\r
88 //Detector specific actions at end of cycle
\r
89 // do the QA checking
\r
90 ResetEventTrigClasses(); // reset triggers list to select all histos
\r
91 // Update for DQM GUI
\r
94 for (Int_t specie = 0; specie < AliRecoParam::kNSpecies ; specie++) {
\r
95 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) continue ;
\r
97 // RS Set event specie
\r
98 SetEventSpecie(AliRecoParam::ConvertIndex(specie));
\r
100 for (int itc=-1;itc<GetNTrigClasses();itc++) { // RS Loop over the trigger classes
\r
102 TObjArray * parr = GetRawsDataOfTrigClass(itc);
\r
103 if (!parr) continue;
\r
104 TObjArray &harr = *parr;
\r
105 TH1* h0 = (TH1*)harr[0];
\r
106 TH1* h2 = (TH1*)harr[2];
\r
107 if (!h0 || !h2) continue;
\r
109 Double_t integralSL0 = 0;
\r
110 Double_t integralAMU = 0;
\r
112 if ((itc==-1) && ( (integralAMU=h2->Integral()==0) || (integralSL0=h0->Integral()==0) ) ) continue;
\r
114 Float_t maxSL0 = 1.1*h0->GetMaximum();
\r
115 Float_t scaleSL0 = 0.;
\r
116 if (maxSL0!=0) scaleSL0 = 1./maxSL0;
\r
117 else scaleSL0 = 1.;
\r
118 h0->Scale(scaleSL0);
\r
121 Float_t maxAMU = 1.1*h2->GetMaximum();
\r
122 Float_t scaleAMU = 0.;
\r
123 if (maxAMU!=0) scaleAMU = 1./maxAMU;
\r
124 else scaleAMU = 1.;
\r
125 h2->Scale(scaleAMU);
\r
127 Int_t indexActiveModuleSL0 = 0;
\r
128 Int_t indexActiveModuleAMU = 0;
\r
130 for(Int_t iModule = 0; iModule < 60; iModule++){
\r
131 if (h0->GetBinContent(iModule) > 0) indexActiveModuleSL0++;
\r
132 if (h2->GetBinContent(iModule) > 0) indexActiveModuleAMU++;
\r
135 Float_t meanHitsSL0 = 0.;
\r
136 Float_t meanHitsAMU = 0.;
\r
137 if ((indexActiveModuleSL0==0) || (indexActiveModuleAMU == 0)) continue;
\r
139 meanHitsSL0 = h0->Integral()/indexActiveModuleSL0;
\r
140 meanHitsAMU = h2->Integral()/indexActiveModuleAMU;
\r
142 TH1* h4 = (TH1*)harr[4];
\r
143 TH1* h5 = (TH1*)harr[5];
\r
145 if (h4 && h5 && meanHitsAMU!=0 && meanHitsSL0!=0){
\r
146 for (Int_t iModule = 0; iModule < 60; iModule++){
\r
147 h4->Fill(h0->GetBinContent(iModule)/meanHitsSL0-1);
\r
148 h5->Fill(h2->GetBinContent(iModule)/meanHitsAMU-1);
\r
152 } // end of trigger classes loop
\r
153 } // end specie loop
\r
154 // QA Checker standar (to be updated)
\r
156 AliQAChecker::Instance()->Run(AliQAv1::kACORDE, task, list) ;
\r
159 //____________________________________________________________________________
\r
160 void AliACORDEQADataMakerRec::StartOfDetectorCycle()
\r
162 //Detector specific actions at start of cycle
\r
166 //____________________________________________________________________________
\r
167 void AliACORDEQADataMakerRec::InitRaws()
\r
169 // create Raw histograms in Raw subdir
\r
171 const Bool_t expert = kTRUE ;
\r
172 const Bool_t saveCorr = kTRUE ;
\r
173 const Bool_t image = kTRUE ;
\r
174 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
\r
175 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
\r
176 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
\r
177 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
\r
178 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)
\r
179 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)
\r
180 // Expert histograms
\r
181 // Check the hits multiplicity from trigger configuration
\r
182 Add2RawsList(fhACORDEBitPatternCheckDQMSL0,4,expert,image,!saveCorr);
\r
183 fhACORDEBitPatternCheckDQMSL0->SetFillColor(kOrange);
\r
184 Add2RawsList(fhACORDEBitPatternCheckDQMAMU,5,expert,image,!saveCorr);
\r
185 fhACORDEBitPatternCheckDQMAMU->SetFillColor(kRed+2);
\r
188 // AMORE diplay settings for shifter on GUI
\r
190 // For SL0 ACO trigger mode
\r
192 Add2RawsList(fhACORDEBitPatternDQM,0,!expert,image,!saveCorr);
\r
193 ForbidCloning(fhACORDEBitPatternDQM);
\r
194 Add2RawsList(fhACORDEMultiplicitySL0DQM,1,!expert,image,!saveCorr);
\r
195 ForbidCloning(fhACORDEMultiplicitySL0DQM);
\r
197 // For Hits distribution on ACORDE
\r
199 fhACORDEBitPatternDQM->SetFillColor(kMagenta+2);
\r
201 // For ACORDE Multiplicity distribution of fired modules
\r
203 fhACORDEMultiplicitySL0DQM->SetFillColor(kMagenta);
\r
205 // For AMU ACO trigger mode
\r
207 Add2RawsList(fhACORDEBitPatternAMUDQM,2,!expert,image,!saveCorr);
\r
208 Add2RawsList(fhACORDEMultiplicityAMUDQM,3,!expert,image,!saveCorr);
\r
210 // For Hits distribution on ACORDE
\r
212 fhACORDEBitPatternAMUDQM->SetFillColor(kViolet+7);
\r
214 // For ACORDE Multiplicity distribution of fired modules
\r
216 fhACORDEMultiplicityAMUDQM->SetFillColor(kViolet+6);
\r
219 ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
\r
222 //____________________________________________________________________________
\r
223 void AliACORDEQADataMakerRec::InitDigits()
\r
225 // create Digits histograms in Digits subdir
\r
227 const Bool_t expert = kTRUE ;
\r
228 const Bool_t image = kTRUE ;
\r
229 TH1F * fhDigitsModule;
\r
230 const char *acoModule[60]={"0_0","0_1","0_2","0_3","0_4","0_5","0_6","0_7","0_8","0_9",
\r
231 "1_0","1_1","1_2","1_3","1_4","1_5","1_6","1_7","1_8","1_9",
\r
232 "2_0","2_1","2_2","2_3","2_4","2_5","2_6","2_7","2_8","2_9",
\r
233 "3_0","3_1","3_2","3_3","3_4","3_5","3_6","3_7","3_8","3_9",
\r
234 "4_0","4_1","4_2","4_3","4_4","4_5","4_6","4_7","4_8","4_9",
\r
235 "5_0","5_1","5_2","5_3","5_4","5_5","5_6","5_7","5_8","5_9"};
\r
238 fhDigitsModule = new TH1F("ACORDEBitPatternfromDigits","Distribution of ACORDE from DIGITS;Modules;Counts",60,1,60);
\r
239 Add2DigitsList(fhDigitsModule,0,!expert,image);
\r
240 for (Int_t i=0;i<60;i++) fhDigitsModule->GetXaxis()->SetBinLabel(i+1,acoModule[i]);
\r
242 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
\r
245 //____________________________________________________________________________
\r
247 void AliACORDEQADataMakerRec::InitRecPoints()
\r
249 // create cluster histograms in RecPoint subdir
\r
250 // Not needed for ACORDE by now !!!
\r
252 ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
\r
255 //____________________________________________________________________________
\r
256 void AliACORDEQADataMakerRec::InitESDs()
\r
258 //create ESDs histograms in ESDs subdir
\r
260 const Bool_t expert = kTRUE ;
\r
261 const Bool_t image = kTRUE ;
\r
263 TH1F * fhESDsSingle;
\r
264 TH1F * fhESDsMulti;
\r
265 TH1F * fhESDsMultiplicity;
\r
266 const char *acoModule[60]={"0_0","0_1","0_2","0_3","0_4","0_5","0_6","0_7","0_8","0_9",
\r
267 "1_0","1_1","1_2","1_3","1_4","1_5","1_6","1_7","1_8","1_9",
\r
268 "2_0","2_1","2_2","2_3","2_4","2_5","2_6","2_7","2_8","2_9",
\r
269 "3_0","3_1","3_2","3_3","3_4","3_5","3_6","3_7","3_8","3_9",
\r
270 "4_0","4_1","4_2","4_3","4_4","4_5","4_6","4_7","4_8","4_9",
\r
271 "5_0","5_1","5_2","5_3","5_4","5_5","5_6","5_7","5_8","5_9"};
\r
274 fhESDsSingle = new TH1F("ACORDEBitPatternfromESDsSingle","Distribution of ACORDE fired modules from ESDs-Single;Modules;Counts",60,1,60);
\r
275 Add2ESDsList(fhESDsSingle,0,!expert,image);
\r
277 fhESDsMulti = new TH1F("ACORDEBitPatternfromESDsMulti","Distribution of ACORDE fired modules from ESDs-Multi;Modules;Counts",60,1,60);
\r
278 Add2ESDsList(fhESDsMulti,1,!expert,image);
\r
280 fhESDsMultiplicity = new TH1F("ACORDEMultiplicityfromESD","Number of fired ACORDE modules; No. of fired ACORDE modules;No. of events in ACORDE",60,-0.5,60);
\r
281 Add2ESDsList(fhESDsMultiplicity,2,!expert,image);
\r
282 for (Int_t i=0;i<60;i++)
\r
284 fhESDsSingle->GetXaxis()->SetBinLabel(i+1,acoModule[i]);
\r
285 fhESDsMulti->GetXaxis()->SetBinLabel(i+1,acoModule[i]);
\r
288 ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
\r
290 //____________________________________________________________________________
\r
291 void AliACORDEQADataMakerRec::MakeRaws(AliRawReader* rawReader)
\r
293 //fills QA histos for RAW
\r
294 IncEvCountCycleRaws();
\r
295 IncEvCountTotalRaws();
\r
296 rawReader->Reset();
\r
297 AliACORDERawStream rawStream(rawReader);
\r
298 size_t contSingle=0;
\r
299 size_t contMulti=0;
\r
302 bool kroSingle[60],kroMulti[60];
\r
305 for(Int_t m=0;m<60;m++) {kroSingle[m]=0;kroMulti[m]=0;}
\r
307 if(rawStream.Next())
\r
309 dy[0]=rawStream.GetWord(0);
\r
310 dy[1]=rawStream.GetWord(1);
\r
311 dy[2]=rawStream.GetWord(2);
\r
312 dy[3]=rawStream.GetWord(3);
\r
314 for(Int_t r=0;r<30;r++)
\r
316 kroSingle[r] = tmpDy & 1;
\r
320 for(Int_t r=30;r<60;r++)
\r
322 kroSingle[r] = tmpDy & 1;
\r
326 for(Int_t r=0;r<30;r++)
\r
328 kroMulti[r] = tmpDy & 1;
\r
332 for(Int_t r=30;r<60;r++)
\r
334 kroMulti[r] = tmpDy & 1;
\r
339 for(Int_t r=0;r<60;r++)
\r
341 if(kroSingle[r]==1)
\r
344 //FillRawsData(4,r);
\r
350 //FillRawsData(6,r);
\r
355 FillRawsData(1,contSingle);
\r
356 FillRawsData(3,contMulti);
\r
357 // FillRawsData(7,contMulti);
\r
360 //____________________________________________________________________________
\r
361 void AliACORDEQADataMakerRec::MakeDigits( TTree *digitsTree)
\r
363 //fills QA histos for Digits
\r
364 IncEvCountCycleDigits();
\r
365 IncEvCountTotalDigits();
\r
368 fDigitsArray->Clear() ;
\r
370 fDigitsArray = new TClonesArray("AliACORDEdigit",1000);
\r
371 TBranch * branch = digitsTree->GetBranch("ACORDEdigit");
\r
373 AliWarning("ACORDE branch in Digits Tree not found");
\r
375 branch->SetAddress(&fDigitsArray);
\r
376 for(Int_t track = 0 ; track < branch->GetEntries() ; track++) {
\r
377 branch->GetEntry(track);
\r
378 for(Int_t idigit = 0 ; idigit < fDigitsArray->GetEntriesFast() ; idigit++) {
\r
379 AliACORDEdigit *AcoDigit = (AliACORDEdigit*) fDigitsArray->UncheckedAt(idigit);
\r
381 AliError("The unchecked digit doesn't exist");
\r
384 FillDigitsData(0,AcoDigit->GetModule()-1);
\r
390 //____________________________________________________________________________
\r
391 void AliACORDEQADataMakerRec::MakeESDs(AliESDEvent * esd)
\r
393 //fills QA histos for ESD
\r
394 IncEvCountCycleESDs();
\r
395 IncEvCountTotalESDs();
\r
397 AliESDACORDE * fESDACORDE= esd->GetACORDEData();
\r
399 for(int i=0;i<60;i++)
\r
401 if(fESDACORDE->GetHitChannel(i))
\r
403 FillESDsData(0,i+1);
\r
404 FillESDsData(1,i+1);
\r
407 } FillESDsData(2,acoMulti);
\r