Fix for FPE in the reconstruction QA of simulated raw data (Laurent)
[u/mrichter/AliRoot.git] / MUON / AliMUONQADataMakerRec.cxx
CommitLineData
04236e67 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
bf4d93eb 16// $Id$
17
b1341ab0 18// --- MUON header files ---
19#include "AliMUONQADataMakerRec.h"
04236e67 20
f587a77d 21#include "AliMUON2DMap.h"
04236e67 22#include "AliMUONCluster.h"
b1341ab0 23#include "AliMUONConstants.h"
2346e1ad 24#include "AliMUONDDLTrigger.h"
2346e1ad 25#include "AliMUONDarcHeader.h"
f587a77d 26#include "AliMUONDigitMaker.h"
b9bd355c 27#include "AliMUONQAMappingCheck.h"
2346e1ad 28#include "AliMUONLocalStruct.h"
f587a77d 29#include "AliMUONLocalTrigger.h"
30#include "AliMUONRawStreamTracker.h"
31#include "AliMUONRawStreamTrigger.h"
32#include "AliMUONRegHeader.h"
b6f591ae 33#include "AliMUONTrackerDataMaker.h"
aef183f7 34#include "AliMUONTriggerDisplay.h"
f587a77d 35#include "AliMUONVCluster.h"
36#include "AliMUONVClusterStore.h"
37#include "AliMUONVDigit.h"
38#include "AliMUONVDigitStore.h"
39#include "AliMUONVTrackerData.h"
40#include "AliMUONVTriggerStore.h"
c92a8c85 41#include "AliMUONTrack.h"
42#include "AliMUONTrackParam.h"
43#include "AliMUONESDInterface.h"
49e110ec 44#include "AliMUONCalibrationData.h"
5bb54f70 45#include "AliMpBusPatch.h"
f587a77d 46#include "AliMpCDB.h"
2346e1ad 47#include "AliMpConstants.h"
f587a77d 48#include "AliMpDDLStore.h"
49#include "AliMpDEIterator.h"
50#include "AliMpDEManager.h"
8f29b706 51#include "AliMpDetElement.h"
b1341ab0 52#include "AliMpLocalBoard.h"
f587a77d 53#include "AliMpStationType.h"
54#include "AliMpTriggerCrate.h"
49e110ec 55#include "AliMpDCSNamer.h"
f587a77d 56#include "AliRawEventHeaderBase.h"
2346e1ad 57
b1341ab0 58// --- AliRoot header files ---
f587a77d 59#include "AliCDBManager.h"
60#include "AliCDBStorage.h"
b1341ab0 61#include "AliESDEvent.h"
62#include "AliESDMuonTrack.h"
63#include "AliESDMuonCluster.h"
64#include "AliLog.h"
65#include "AliRawReader.h"
66#include "AliQAChecker.h"
f587a77d 67#include "AliCodeTimer.h"
49e110ec 68#include "AliDCSValue.h"
44ed7a66 69#include "AliMUONVDigit.h"
b1341ab0 70
71// --- ROOT system ---
72#include <TClonesArray.h>
73#include <TFile.h>
74#include <TH1F.h>
75#include <TH1I.h>
76#include <TH2F.h>
8f29b706 77#include <TLine.h>
78#include <TPaveText.h>
b1341ab0 79#include <Riostream.h>
8f29b706 80#include <TMath.h>
04236e67 81
82//-----------------------------------------------------------------------------
83/// \class AliMUONQADataMakerRec
84///
85/// MUON base class for quality assurance data (histo) maker
86///
f587a77d 87/// \author C. Finck, D. Stocco, L. Aphecetche
04236e67 88
89/// \cond CLASSIMP
90ClassImp(AliMUONQADataMakerRec)
91/// \endcond
92
8f29b706 93
94namespace {
95
96 int trim(Int_t n,
97 Double_t* x,
98 Double_t alpha,
99 Double_t& tmean,
100 Double_t& tvar,
101 Double_t& min,
102 Double_t& max)
103 {
104 //
105 // Calculates the trimmed (tmean) mean
106 // of a sample (x) and estimates the variance (tvar)
107 // of that mean.
108 //
109
110 // First check input parameters
111
112 // number of observations
113 if ( n < 2 )
114 {
115 return -1;
116 }
117
118 if ( alpha < 0 || alpha >= 0.5 )
119 // proportion of observations
120 // to be trimmed at each end of the sorted sample
121 {
122 return -2;
123 }
124
125 // Input parameters are good. Let's move on.
126
127 // Insure we use a sample sorted into ascending order.
128
129 Int_t* indices = new Int_t[n];
130
131 TMath::Sort(n,x,indices,kFALSE);
132
133 Double_t* sx = new Double_t[n];
134
135 for ( Int_t i = 0; i < n; ++i )
136 {
137 sx[i] = x[indices[i]];
138 }
139 delete[] indices;
140
141
142 // Number of observations trimmed at each end.
143
144 Int_t k = static_cast<Int_t>(floorf(alpha * n));
145
146 double sum = 0.0;
147
148 for ( Int_t i = k; i < n - k ; ++i )
149 {
150 sum += sx[i];
151 }
152
153 tmean = sum / ( n - 2 * k );
154
155 double t2 = 0.0;
156
157 for ( Int_t i = k; i < n - k; ++i )
158 {
159 t2 += (sx[i] - tmean) * (sx[i] - tmean);
160 }
161
162 tvar = (
163 t2 +
164 k * (sx[k] - tmean) * (sx[k] - tmean) +
165 k * (sx[n - k - 1] - tmean) * (sx[n - k - 1] - tmean)
166 ) / (n * n);
167
168 // get the min and max for the non-rejected values
169 min = DBL_MAX;
170 max = 0.0;
171
172 for ( Int_t i = k; i < n-k; ++i )
173 {
174 min = TMath::Min(min,sx[i]);
175 max = TMath::Max(max,sx[i]);
176 }
177
178 delete[] sx;
179
180 return 0;
181 }
182}
183
04236e67 184//____________________________________________________________________________
b8bd1ab8 185AliMUONQADataMakerRec::AliMUONQADataMakerRec() :
4e25ac79 186AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kMUON), "MUON Quality Assurance Data Maker"),
f587a77d 187fDigitStore(0x0),
188fTriggerStore(0x0),
189fDigitMaker(0x0),
190fClusterStore(0x0),
b9bd355c 191fTrackerDataMaker(0x0),
192fMappingCheckRecPoints(0x0)
04236e67 193{
194 /// ctor
f587a77d 195
5379c4a3 196 AliDebug(AliQAv1::GetQADebugLevel(),"");
d874bd09 197
f587a77d 198 Ctor();
199}
200
201//____________________________________________________________________________
202void
203AliMUONQADataMakerRec::Ctor()
204{
205 /// Init some members
b9bd355c 206 AliCodeTimerAuto("");
f587a77d 207 fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV1");
208 fDigitMaker = new AliMUONDigitMaker(kTRUE);
04236e67 209}
210
211//____________________________________________________________________________
212AliMUONQADataMakerRec::AliMUONQADataMakerRec(const AliMUONQADataMakerRec& qadm) :
f587a77d 213AliQADataMakerRec(qadm),
f587a77d 214fDigitStore(0x0),
215fTriggerStore(0x0),
216fDigitMaker(0x0),
217fClusterStore(0x0),
b9bd355c 218fTrackerDataMaker(0x0),
219fMappingCheckRecPoints(0x0)
04236e67 220{
221 ///copy ctor
d874bd09 222
5379c4a3 223 AliDebug(AliQAv1::GetQADebugLevel(),"");
d874bd09 224
225
04236e67 226 SetName((const char*)qadm.GetName()) ;
227 SetTitle((const char*)qadm.GetTitle());
7035694f 228
f587a77d 229 // Do not copy the digit store and digit maker, but create its own ones
230
231 Ctor();
232
04236e67 233}
234
235//__________________________________________________________________
236AliMUONQADataMakerRec& AliMUONQADataMakerRec::operator = (const AliMUONQADataMakerRec& qadm )
237{
7035694f 238 /// Assignment operator
239
5379c4a3 240 AliDebug(AliQAv1::GetQADebugLevel(),"");
d874bd09 241
7035694f 242 // check assignment to self
243 if (this == &qadm) return *this;
244
245 this->~AliMUONQADataMakerRec();
246 new(this) AliMUONQADataMakerRec(qadm);
247 return *this;
04236e67 248}
249
250//__________________________________________________________________
251AliMUONQADataMakerRec::~AliMUONQADataMakerRec()
252{
253 /// dtor
f587a77d 254
5379c4a3 255 AliDebug(AliQAv1::GetQADebugLevel(),"");
d874bd09 256
f587a77d 257 AliCodeTimerAuto("");
258
259 delete fDigitStore;
260 delete fTriggerStore;
261 delete fDigitMaker;
c92a8c85 262 delete fClusterStore;
263 delete fTrackerDataMaker;
b9bd355c 264 delete fMappingCheckRecPoints;
04236e67 265}
266
267//____________________________________________________________________________
4e25ac79 268void AliMUONQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray** list)
04236e67 269{
b9bd355c 270 /// Detector specific actions at end of cycle
c92a8c85 271
5bb54f70 272 AliCodeTimerAuto("");
8f29b706 273
c455c5fb 274 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
275 {
b9bd355c 276 if (! IsValidEventSpecie(specie, list) ) continue;
277
278 SetEventSpecie(AliRecoParam::ConvertIndex(specie));
c455c5fb 279
b9bd355c 280 if ( task == AliQAv1::kRAWS && fTrackerDataMaker )
281 {
282 // export trackerdata as is, and also make a summarized version (buspatchoccupancy)
283 EndOfDetectorCycleRaws(specie,list);
284 }
285
286 if ( task == AliQAv1::kRECPOINTS )
287 {
288 // normalize recpoints histograms
289 EndOfDetectorCycleRecPoints(specie,list);
290 }
291
292 if ( task == AliQAv1::kESDS )
293 {
294 // normalize esds histograms
295 EndOfDetectorCycleESDs();
296 }
297
298 // Display trigger histos in a more user friendly way
299 DisplayTriggerInfo(task);
300
301 } // loop on specie
302
303 // do the QA checking
304 AliQAChecker::Instance()->Run(AliQAv1::kMUON,task,list);
305}
306
307//____________________________________________________________________________
308void AliMUONQADataMakerRec::InsertTrackerData(Int_t specie, TObjArray** list,
309 TObject* object, Int_t indexNumber,
310 Bool_t replace)
311{
312 /// Insert an object to a given list
313
314 TIter next(list[specie]);
315 TObject* o;
316 TObject* old(0x0);
317 Bool_t alreadyThere(kFALSE);
318 while ( ( o = next() ) && !alreadyThere )
319 {
320 TString classname(o->ClassName());
321 if ( classname.Contains("TrackerData") )
322 {
323 alreadyThere = kTRUE;
324 old = o;
325 }
326 }
327 if ( (!alreadyThere && object) || (alreadyThere && replace) )
328 {
329 delete old;
330 AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding %s to the list of qa objects",object->GetName()));
331 list[specie]->AddAt(object,indexNumber);
332 }
333}
334
335//____________________________________________________________________________
336void AliMUONQADataMakerRec::EndOfDetectorCycleESDs()
337{
338 /// Normalize ESD histograms
339
340 if (!GetESDsData(kESDnClustersPerTrack)) return;
341
342 Double_t nTracks = GetESDsData(kESDnClustersPerTrack)->GetEntries();
343 if (nTracks <= 0) return;
344
345 TH1* hESDnClustersPerCh = GetESDsData(kESDnClustersPerCh);
346 TH1* hESDnClustersPerDE = GetESDsData(kESDnClustersPerDE);
347 TH1* hESDClusterChargePerChMean = GetESDsData(kESDClusterChargePerChMean);
348 TH1* hESDClusterChargePerChSigma = GetESDsData(kESDClusterChargePerChSigma);
349 TH1* hESDClusterSizePerChMean = GetESDsData(kESDClusterSizePerChMean);
350 TH1* hESDClusterSizePerChSigma = GetESDsData(kESDClusterSizePerChSigma);
351 TH1* hESDResidualXPerChMean = GetESDsData(kESDResidualXPerChMean);
352 TH1* hESDResidualXPerChSigma = GetESDsData(kESDResidualXPerChSigma);
353 TH1* hESDResidualYPerChMean = GetESDsData(kESDResidualYPerChMean);
354 TH1* hESDResidualYPerChSigma = GetESDsData(kESDResidualYPerChSigma);
355 TH1* hESDLocalChi2XPerChMean = GetESDsData(kESDLocalChi2XPerChMean);
356 TH1* hESDLocalChi2YPerChMean = GetESDsData(kESDLocalChi2YPerChMean);
357 TH1* hESDLocalChi2PerChMean = GetESDsData(kESDLocalChi2PerChMean);
358 TH1* hESDClusterChargePerDE = GetESDsData(kESDClusterChargePerDE);
359 TH1* hESDClusterSizePerDE = GetESDsData(kESDClusterSizePerDE);
360 TH1* hESDResidualXPerDEMean = GetESDsData(kESDResidualXPerDEMean);
361 TH1* hESDResidualXPerDESigma = GetESDsData(kESDResidualXPerDESigma);
362 TH1* hESDResidualYPerDEMean = GetESDsData(kESDResidualYPerDEMean);
363 TH1* hESDResidualYPerDESigma = GetESDsData(kESDResidualYPerDESigma);
364 TH1* hESDLocalChi2XPerDEMean = GetESDsData(kESDLocalChi2XPerDEMean);
365 TH1* hESDLocalChi2YPerDEMean = GetESDsData(kESDLocalChi2YPerDEMean);
366 TH1* hESDLocalChi2PerDEMean = GetESDsData(kESDLocalChi2PerDEMean);
367 TH1* hESDnTotClustersPerCh = GetESDsData(kESDnTotClustersPerCh);
368 TH1* hESDnTotClustersPerDE = GetESDsData(kESDnTotClustersPerDE);
369 TH1* hESDnTotFullClustersPerDE = GetESDsData(kESDnTotFullClustersPerDE);
370 TH1* hESDSumClusterChargePerDE = GetESDsData(kESDSumClusterChargePerDE);
371 TH1* hESDSumClusterSizePerDE = GetESDsData(kESDSumClusterSizePerDE);
372 TH1* hESDSumResidualXPerDE = GetESDsData(kESDSumResidualXPerDE);
373 TH1* hESDSumResidualYPerDE = GetESDsData(kESDSumResidualYPerDE);
374 TH1* hESDSumResidualX2PerDE = GetESDsData(kESDSumResidualX2PerDE);
375 TH1* hESDSumResidualY2PerDE = GetESDsData(kESDSumResidualY2PerDE);
376 TH1* hESDSumLocalChi2XPerDE = GetESDsData(kESDSumLocalChi2XPerDE);
377 TH1* hESDSumLocalChi2YPerDE = GetESDsData(kESDSumLocalChi2YPerDE);
378 TH1* hESDSumLocalChi2PerDE = GetESDsData(kESDSumLocalChi2PerDE);
379
380 hESDnClustersPerCh->Reset();
381 hESDnClustersPerDE->Reset();
382 hESDnClustersPerCh->Add(hESDnTotClustersPerCh, 1./nTracks);
383 hESDnClustersPerDE->Add(hESDnTotClustersPerDE, 1./nTracks);
384
385 // loop over chambers
386 for (Int_t iCh = 0; iCh < AliMUONConstants::NTrackingCh(); iCh++) {
387
388 TH1* hESDClusterChargeInCh = GetESDsData(kESDClusterChargeInCh+iCh);
389 Double_t sigmaCharge = hESDClusterChargeInCh->GetRMS();
390 hESDClusterChargePerChMean->SetBinContent(iCh+1, hESDClusterChargeInCh->GetMean());
391 hESDClusterChargePerChMean->SetBinError(iCh+1, hESDClusterChargeInCh->GetMeanError());
392 hESDClusterChargePerChSigma->SetBinContent(iCh+1, sigmaCharge);
393 hESDClusterChargePerChSigma->SetBinError(iCh+1, hESDClusterChargeInCh->GetRMSError());
394
395 TH1* hESDClusterSizeInCh = GetESDsData(kESDClusterSizeInCh+iCh);
396 Double_t sigmaSize = hESDClusterSizeInCh->GetRMS();
397 hESDClusterSizePerChMean->SetBinContent(iCh+1, hESDClusterSizeInCh->GetMean());
398 hESDClusterSizePerChMean->SetBinError(iCh+1, hESDClusterSizeInCh->GetMeanError());
399 hESDClusterSizePerChSigma->SetBinContent(iCh+1, sigmaSize);
400 hESDClusterSizePerChSigma->SetBinError(iCh+1, hESDClusterSizeInCh->GetRMSError());
2d114b34 401
b9bd355c 402 TH1* hESDResidualXInCh = GetESDsData(kESDResidualXInCh+iCh);
403 Double_t sigmaResidualX = hESDResidualXInCh->GetRMS();
404 hESDResidualXPerChMean->SetBinContent(iCh+1, hESDResidualXInCh->GetMean());
405 hESDResidualXPerChMean->SetBinError(iCh+1, hESDResidualXInCh->GetMeanError());
406 hESDResidualXPerChSigma->SetBinContent(iCh+1, sigmaResidualX);
407 hESDResidualXPerChSigma->SetBinError(iCh+1, hESDResidualXInCh->GetRMSError());
408
409 TH1* hESDResidualYInCh = GetESDsData(kESDResidualYInCh+iCh);
410 Double_t sigmaResidualY = hESDResidualYInCh->GetRMS();
411 hESDResidualYPerChMean->SetBinContent(iCh+1, hESDResidualYInCh->GetMean());
412 hESDResidualYPerChMean->SetBinError(iCh+1, hESDResidualYInCh->GetMeanError());
413 hESDResidualYPerChSigma->SetBinContent(iCh+1, sigmaResidualY);
414 hESDResidualYPerChSigma->SetBinError(iCh+1, hESDResidualYInCh->GetRMSError());
415
416 TH1* hESDLocalChi2XInCh = GetESDsData(kESDLocalChi2XInCh+iCh);
417 Double_t sigmaLocalChi2X = hESDLocalChi2XInCh->GetRMS();
418 hESDLocalChi2XPerChMean->SetBinContent(iCh+1, hESDLocalChi2XInCh->GetMean());
419 hESDLocalChi2XPerChMean->SetBinError(iCh+1, hESDLocalChi2XInCh->GetMeanError());
420
421 TH1* hESDLocalChi2YInCh = GetESDsData(kESDLocalChi2YInCh+iCh);
422 Double_t sigmaLocalChi2Y = hESDLocalChi2YInCh->GetRMS();
423 hESDLocalChi2YPerChMean->SetBinContent(iCh+1, hESDLocalChi2YInCh->GetMean());
424 hESDLocalChi2YPerChMean->SetBinError(iCh+1, hESDLocalChi2YInCh->GetMeanError());
425
426 TH1* hESDLocalChi2InCh = GetESDsData(kESDLocalChi2InCh+iCh);
427 Double_t sigmaLocalChi2 = hESDLocalChi2InCh->GetRMS();
428 hESDLocalChi2PerChMean->SetBinContent(iCh+1, hESDLocalChi2InCh->GetMean());
429 hESDLocalChi2PerChMean->SetBinError(iCh+1, hESDLocalChi2InCh->GetMeanError());
430
431 // loop over DE into chamber iCh
432 AliMpDEIterator it;
433 it.First(iCh);
434 while ( !it.IsDone()) {
2d114b34 435
b9bd355c 436 Int_t iDE = it.CurrentDEId();
2d114b34 437
b9bd355c 438 Double_t nClusters = hESDnTotClustersPerDE->GetBinContent(iDE+1);
439 if (nClusters > 1) {
eca4fa66 440
b9bd355c 441 hESDClusterChargePerDE->SetBinContent(iDE+1, hESDSumClusterChargePerDE->GetBinContent(iDE+1)/nClusters);
442 hESDClusterChargePerDE->SetBinError(iDE+1, sigmaCharge/TMath::Sqrt(nClusters));
eca4fa66 443
b9bd355c 444 Double_t meanResX = hESDSumResidualXPerDE->GetBinContent(iDE+1)/nClusters;
445 hESDResidualXPerDEMean->SetBinContent(iDE+1, meanResX);
446 hESDResidualXPerDEMean->SetBinError(iDE+1, sigmaResidualX/TMath::Sqrt(nClusters));
447 hESDResidualXPerDESigma->SetBinContent(iDE+1, TMath::Sqrt(hESDSumResidualX2PerDE->GetBinContent(iDE+1)/nClusters - meanResX*meanResX));
448 hESDResidualXPerDESigma->SetBinError(iDE+1, sigmaResidualX/TMath::Sqrt(2.*nClusters));
449
450 Double_t meanResY = hESDSumResidualYPerDE->GetBinContent(iDE+1)/nClusters;
451 hESDResidualYPerDEMean->SetBinContent(iDE+1, meanResY);
452 hESDResidualYPerDEMean->SetBinError(iDE+1, sigmaResidualY/TMath::Sqrt(nClusters));
453 hESDResidualYPerDESigma->SetBinContent(iDE+1, TMath::Sqrt(hESDSumResidualY2PerDE->GetBinContent(iDE+1)/nClusters - meanResY*meanResY));
454 hESDResidualYPerDESigma->SetBinError(iDE+1, sigmaResidualY/TMath::Sqrt(2.*nClusters));
455
456 hESDLocalChi2XPerDEMean->SetBinContent(iDE+1, hESDSumLocalChi2XPerDE->GetBinContent(iDE+1)/nClusters);
457 hESDLocalChi2XPerDEMean->SetBinError(iDE+1, sigmaLocalChi2X/TMath::Sqrt(nClusters));
458
459 hESDLocalChi2YPerDEMean->SetBinContent(iDE+1, hESDSumLocalChi2YPerDE->GetBinContent(iDE+1)/nClusters);
460 hESDLocalChi2YPerDEMean->SetBinError(iDE+1, sigmaLocalChi2Y/TMath::Sqrt(nClusters));
461
462 hESDLocalChi2PerDEMean->SetBinContent(iDE+1, hESDSumLocalChi2PerDE->GetBinContent(iDE+1)/nClusters);
463 hESDLocalChi2PerDEMean->SetBinError(iDE+1, sigmaLocalChi2/TMath::Sqrt(nClusters));
464
465 } else {
466
467 hESDClusterChargePerDE->SetBinContent(iDE+1, hESDSumClusterChargePerDE->GetBinContent(iDE+1));
468 hESDClusterChargePerDE->SetBinError(iDE+1, hESDClusterChargeInCh->GetXaxis()->GetXmax());
469
470 hESDResidualXPerDEMean->SetBinContent(iDE+1, hESDSumResidualXPerDE->GetBinContent(iDE+1));
471 hESDResidualXPerDEMean->SetBinError(iDE+1, hESDResidualXInCh->GetXaxis()->GetXmax());
472 hESDResidualXPerDESigma->SetBinContent(iDE+1, 0.);
473 hESDResidualXPerDESigma->SetBinError(iDE+1, hESDResidualXInCh->GetXaxis()->GetXmax());
474
475 hESDResidualYPerDEMean->SetBinContent(iDE+1, hESDSumResidualYPerDE->GetBinContent(iDE+1));
476 hESDResidualYPerDEMean->SetBinError(iDE+1, hESDResidualYInCh->GetXaxis()->GetXmax());
477 hESDResidualYPerDESigma->SetBinContent(iDE+1, 0.);
478 hESDResidualYPerDESigma->SetBinError(iDE+1, hESDResidualYInCh->GetXaxis()->GetXmax());
479
480 hESDLocalChi2XPerDEMean->SetBinContent(iDE+1, hESDSumLocalChi2XPerDE->GetBinContent(iDE+1));
481 hESDLocalChi2XPerDEMean->SetBinError(iDE+1, hESDLocalChi2XInCh->GetXaxis()->GetXmax());
482
483 hESDLocalChi2YPerDEMean->SetBinContent(iDE+1, hESDSumLocalChi2YPerDE->GetBinContent(iDE+1));
484 hESDLocalChi2YPerDEMean->SetBinError(iDE+1, hESDLocalChi2YInCh->GetXaxis()->GetXmax());
485
486 hESDLocalChi2PerDEMean->SetBinContent(iDE+1, hESDSumLocalChi2PerDE->GetBinContent(iDE+1));
487 hESDLocalChi2PerDEMean->SetBinError(iDE+1, hESDLocalChi2InCh->GetXaxis()->GetXmax());
488
489 }
490
491 Double_t nFullClusters = hESDnTotFullClustersPerDE->GetBinContent(iDE+1);
492 if (nFullClusters > 1) {
493
494 hESDClusterSizePerDE->SetBinContent(iDE+1, hESDSumClusterSizePerDE->GetBinContent(iDE+1)/nFullClusters);
495 hESDClusterSizePerDE->SetBinError(iDE+1, sigmaSize/TMath::Sqrt(nFullClusters));
496
497 } else {
498
499 hESDClusterSizePerDE->SetBinContent(iDE+1, hESDSumClusterSizePerDE->GetBinContent(iDE+1));
500 hESDClusterSizePerDE->SetBinError(iDE+1, hESDClusterSizeInCh->GetXaxis()->GetXmax());
eca4fa66 501
2d114b34 502 }
503
b9bd355c 504 it.Next();
2d114b34 505 }
b9bd355c 506
507 }
508
509}
510
511//____________________________________________________________________________
512void AliMUONQADataMakerRec::EndOfDetectorCycleRecPoints(Int_t specie, TObjArray** list)
513{
514 /// Normalize RecPoints histograms
515
516 if (!GetRecPointsData(kTrackerClusterChargePerChMean)) return;
517
518 TH1* hTrackerClusterChargePerChMean = GetRecPointsData(kTrackerClusterChargePerChMean);
519 TH1* hTrackerClusterChargePerChSigma = GetRecPointsData(kTrackerClusterChargePerChSigma);
520 TH1* hTrackerClusterMultiplicityPerChMean = GetRecPointsData(kTrackerClusterMultiplicityPerChMean);
521 TH1* hTrackerClusterMultiplicityPerChSigma = GetRecPointsData(kTrackerClusterMultiplicityPerChSigma);
522 TH1* hTrackerClusterChargePerDEMean = GetRecPointsData(kTrackerClusterChargePerDEMean);
523 TH1* hTrackerClusterMultiplicityPerDEMean = GetRecPointsData(kTrackerClusterMultiplicityPerDEMean);
524
525 // loop over chambers
526 for (Int_t iCh = 0; iCh < AliMUONConstants::NTrackingCh(); iCh++) {
2d114b34 527
b9bd355c 528 TH1* hTrackerClusterChargePerChamber = GetRecPointsData(kTrackerClusterChargePerChamber+iCh);
529 Double_t sigmaCharge = hTrackerClusterChargePerChamber->GetRMS();
530 hTrackerClusterChargePerChMean->SetBinContent(iCh+1, hTrackerClusterChargePerChamber->GetMean());
531 hTrackerClusterChargePerChMean->SetBinError(iCh+1, hTrackerClusterChargePerChamber->GetMeanError());
532 hTrackerClusterChargePerChSigma->SetBinContent(iCh+1, sigmaCharge);
533 hTrackerClusterChargePerChSigma->SetBinError(iCh+1, hTrackerClusterChargePerChamber->GetRMSError());
534
535 TH1* hTrackerClusterMultiplicityPerChamber = GetRecPointsData(kTrackerClusterMultiplicityPerChamber+iCh);
536 Double_t sigmaSize = hTrackerClusterMultiplicityPerChamber->GetRMS();
537 hTrackerClusterMultiplicityPerChMean->SetBinContent(iCh+1, hTrackerClusterMultiplicityPerChamber->GetMean());
538 hTrackerClusterMultiplicityPerChMean->SetBinError(iCh+1, hTrackerClusterMultiplicityPerChamber->GetMeanError());
539 hTrackerClusterMultiplicityPerChSigma->SetBinContent(iCh+1, sigmaSize);
540 hTrackerClusterMultiplicityPerChSigma->SetBinError(iCh+1, hTrackerClusterMultiplicityPerChamber->GetRMSError());
541
542 // loop over DE into chamber iCh
543 AliMpDEIterator it;
544 it.First(iCh);
545 while ( !it.IsDone()) {
5a240757 546
b9bd355c 547 Int_t iDE = it.CurrentDEId();
d1e6fdee 548
b9bd355c 549 TH1* hTrackerClusterChargePerDE = GetRecPointsData(kTrackerClusterChargePerDE+iDE);
550 hTrackerClusterChargePerDEMean->SetBinContent(iDE+1, hTrackerClusterChargePerDE->GetMean());
551 Double_t nClusters = hTrackerClusterChargePerDE->GetEntries();
552 if (nClusters > 1) hTrackerClusterChargePerDEMean->SetBinError(iDE+1, sigmaCharge/TMath::Sqrt(nClusters));
553 else hTrackerClusterChargePerDEMean->SetBinError(iDE+1, hTrackerClusterChargePerChamber->GetXaxis()->GetXmax());
c92a8c85 554
b9bd355c 555 TH1* hTrackerClusterMultiplicityPerDE = GetRecPointsData(kTrackerClusterMultiplicityPerDE+iDE);
556 hTrackerClusterMultiplicityPerDEMean->SetBinContent(iDE+1, hTrackerClusterMultiplicityPerDE->GetMean());
557 nClusters = hTrackerClusterMultiplicityPerDE->GetEntries();
558 if (nClusters > 1) hTrackerClusterMultiplicityPerDEMean->SetBinError(iDE+1, sigmaSize/TMath::Sqrt(nClusters));
559 else hTrackerClusterMultiplicityPerDEMean->SetBinError(iDE+1, hTrackerClusterMultiplicityPerChamber->GetXaxis()->GetXmax());
5a240757 560
b9bd355c 561 it.Next();
435844ac 562 }
b9bd355c 563 }
564
565 if ( fMappingCheckRecPoints ) InsertTrackerData(specie,list,fMappingCheckRecPoints->CreateData("RecPoints"),kTrackerRecPoints,kTRUE);
566}
567
568
569//____________________________________________________________________________
570void AliMUONQADataMakerRec::EndOfDetectorCycleRaws(Int_t specie, TObjArray** list)
571{
572 /// create Raws histograms in Raws subdir
573
574 if ( !GetRawsData(kTrackerBusPatchOccupancy) ) return;
575
576 if ( fTrackerDataMaker )
577 {
578 InsertTrackerData(specie,list,fTrackerDataMaker->Data(),kTrackerData);
579
580 TH1* hbp = GetRawsData(kTrackerBusPatchOccupancy);
581 hbp->Reset();
582 TIter nextBP(AliMpDDLStore::Instance()->CreateBusPatchIterator());
583 AliMpBusPatch* bp(0x0);
584 AliMUONVTrackerData* data = fTrackerDataMaker->Data();
585 Int_t occDim = 2;
5a240757 586
b9bd355c 587 while ( ( bp = static_cast<AliMpBusPatch*>(nextBP())) )
588 {
589 Int_t busPatchId = bp->GetId();
590 Int_t bin = hbp->FindBin(busPatchId);
591 hbp->SetBinContent(bin,data->BusPatch(busPatchId,occDim)*100.0); // occupancy, in percent
592 }
8f29b706 593
b9bd355c 594 BeautifyTrackerBusPatchOccupancy(*hbp);
595 }
04236e67 596}
597
598//____________________________________________________________________________
599void AliMUONQADataMakerRec::InitRaws()
600{
601 /// create Raws histograms in Raws subdir
f587a77d 602
5bb54f70 603 AliCodeTimerAuto("");
604
7d297381 605 const Bool_t expert = kTRUE ;
606 const Bool_t saveCorr = kTRUE ;
607 const Bool_t image = kTRUE ;
719914e0 608
609 TString boardName = "Local board Id";
5bb54f70 610
43b113b8 611 TString histoName, histoTitle;
612 for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
613 TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
614 for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
615 histoName = Form("hTriggerScalers%sChamber%i", cathName.Data(), 11+iChamber);
616 histoTitle = Form("Chamber %i - %s: trigger scaler counts", 11+iChamber, cathName.Data());
617 TH2F* h3 = new TH2F(histoName.Data(), histoTitle.Data(),
618 234, 0.5, 234.5,
619 16, -0.5, 15.5);
620 h3->GetXaxis()->SetTitle(boardName.Data());
621 h3->GetYaxis()->SetTitle("Strip");
622 Add2RawsList(h3, kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber, expert, !image, !saveCorr);
623 }
624 }
f587a77d 625
626 AliMUONTriggerDisplay triggerDisplay;
f587a77d 627 for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
628 TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
629 for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
43b113b8 630 histoName = Form("hScalersDisplay%sChamber%i", cathName.Data(), 11+iChamber);
719914e0 631 histoTitle = Form("Chamber %i - %s: Hit rate from scalers (Hz/cm^{2})", 11+iChamber, cathName.Data());
f587a77d 632 TH2F* h5 = (TH2F*)triggerDisplay.GetEmptyDisplayHisto(histoName, AliMUONTriggerDisplay::kDisplayStrips,
c92a8c85 633 iCath, iChamber, histoTitle);
7d297381 634 Add2RawsList(h5, kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber, !expert, image, !saveCorr);
f587a77d 635 }
636 }
49e110ec 637
719914e0 638 FillTriggerDCSHistos();
49e110ec 639
719914e0 640 TH1F* h10 = new TH1F("hTriggerScalersTime", "Acquisition time from trigger scalers", 1, 0.5, 1.5);
eb3886c8 641 h10->GetXaxis()->SetBinLabel(1, "One-bin histogram: bin is filled at each scaler event.");
642 h10->GetYaxis()->SetTitle("Cumulated scaler time (s)");
719914e0 643 Add2RawsList(h10, kTriggerScalersTime, !expert, !image, !saveCorr);
f587a77d 644
8f29b706 645 Int_t bpmin(999999);
646 Int_t bpmax(0);
647
5bb54f70 648 TIter next(AliMpDDLStore::Instance()->CreateBusPatchIterator());
8f29b706 649 AliMpBusPatch* bp(0x0);
650 while ( ( bp = static_cast<AliMpBusPatch*>(next())) )
5bb54f70 651 {
8f29b706 652 bpmin = TMath::Min(bpmin,bp->GetId());
653 bpmax = TMath::Max(bpmax,bp->GetId());
5bb54f70 654 }
655
8f29b706 656 Double_t xmin = bpmin-0.5;
657 Double_t xmax = bpmax+0.5;
658 Int_t nbins = bpmax-bpmin+1;
5bb54f70 659
8f29b706 660 TH1* hbp = new TH1F("hTrackerBusPatchOccupancy","Occupancy of bus patches",nbins,xmin,xmax);
661
3b7f2f85 662 TH1* hbpnpads = new TH1F("hTrackerBusPatchNofPads","Number of pads per bus patch",nbins,xmin,xmax);
8f29b706 663
3b7f2f85 664 TH1* hbpnmanus = new TH1F("hTrackerBusPatchNofManus","Number of manus per bus patch",nbins,xmin,xmax);
8f29b706 665
7d297381 666 Add2RawsList(hbp,kTrackerBusPatchOccupancy, !expert, image, !saveCorr);
8f29b706 667 Add2RawsList(hbpnpads,kTrackerBusPatchNofPads, expert, !image, !saveCorr);
668 Add2RawsList(hbpnmanus,kTrackerBusPatchNofManus, expert, !image, !saveCorr);
de1d4a53 669
670 const Bool_t histogram(kFALSE);
b6f591ae 671
b9bd355c 672 if(!fTrackerDataMaker)
673 {
674 fTrackerDataMaker = new AliMUONTrackerDataMaker(GetMUONRecoParam(),
675 AliCDBManager::Instance()->GetRun(),
676 0x0,
677 "",
678 "NOGAIN",
679 histogram,
680 0.0,0.0);
681 }
682
de1d4a53 683 fTrackerDataMaker->Data()->DisableChannelLevel(); // to save up disk space, we only store starting at the manu level
b9bd355c 684
de1d4a53 685 fTrackerDataMaker->SetRunning(kTRUE);
f587a77d 686}
04236e67 687
44ed7a66 688//__________________________________________________________________
689void AliMUONQADataMakerRec::InitDigits()
690{
691 /// Initialized Digits spectra
692 const Bool_t expert = kTRUE ;
693 const Bool_t image = kTRUE ;
694
db72ff3b 695 TH1I* h0 = new TH1I("hDigitsDetElem", "Detection element distribution in Digits;Detection element Id;Counts", 1400, 100, 1500);
44ed7a66 696 Add2DigitsList(h0, 0, !expert, image);
697
db72ff3b 698 TH1I* h1 = new TH1I("hDigitsADC", "ADC distribution in Digits;ACD value;Counts", 4096, 0, 4095);
699 Add2DigitsList(h1, 1, !expert, image);
44ed7a66 700}
701
f587a77d 702//____________________________________________________________________________
703void AliMUONQADataMakerRec::InitRecPoints()
704{
705 /// create Reconstructed Points histograms in RecPoints subdir
5bb54f70 706
707 AliCodeTimerAuto("");
708
f587a77d 709 InitRecPointsTrigger();
710 InitRecPointsTracker();
711}
712
713//____________________________________________________________________________
714void AliMUONQADataMakerRec::InitRecPointsTracker()
715{
2d114b34 716 /// create Reconstructed Points histograms in RecPoints subdir for the
717 /// MUON tracker subsystem.
7d297381 718 const Bool_t expert = kTRUE ;
719 const Bool_t image = kTRUE ;
2d114b34 720
5bb54f70 721 AliCodeTimerAuto("");
722
2d114b34 723 TH1I *h1I;
724 TH1F *h1F;
725 TH2F *h2F;
5bb54f70 726
2d114b34 727 // histograms per chamber
728 Int_t nCh = AliMpConstants::NofTrackingChambers();
729 for ( Int_t i = 0; i < nCh; ++i )
730 {
db72ff3b 731 h1I = new TH1I(Form("hTrackerClusterMultiplicityForChamber%d",i+1), Form("cluster size distribution in chamber %d;size (n_{pads};Counts)",i+1), 100,0,100);
7d297381 732 Add2RecPointsList(h1I,kTrackerClusterMultiplicityPerChamber+i, expert, !image);
2d114b34 733
4eb3ad98 734 h1I = new TH1I(Form("hTrackerClusterChargeForChamber%d",i+1), Form("cluster charge distribution in chamber %d;charge (fC);Counts",i+1), 100,0,1000);
7d297381 735 Add2RecPointsList(h1I,kTrackerClusterChargePerChamber+i, expert, !image);
2d114b34 736
737 Float_t rMax = AliMUONConstants::Rmax(i/2);
738 h2F = new TH2F(Form("hTrackerClusterHitMapForChamber%d",i+1), Form("cluster position distribution in chamber %d;X (cm);Y (cm)",i+1), 100, -rMax, rMax, 100, -rMax, rMax);
7d297381 739 Add2RecPointsList(h2F, kTrackerClusterHitMapPerChamber+i, expert, !image);
2d114b34 740 }
741
742 // summary histograms per chamber
743 h1I = new TH1I("hTrackerNumberOfClustersPerChamber", "Number of clusters per chamber;chamber ID;n_{clusters}", nCh,-0.5,nCh-0.5);
d1e6fdee 744 Add2RecPointsList(h1I,kTrackerNumberOfClustersPerChamber, !expert, image);
2d114b34 745
746 h1F = new TH1F("hTrackerClusterMultiplicityPerChMean", "cluster mean size per chamber;chamber ID;<size> (n_{pads})", nCh,-0.5,nCh-0.5);
747 h1F->SetOption("P");
748 h1F->SetMarkerStyle(kFullDotMedium);
749 h1F->SetMarkerColor(kRed);
d1e6fdee 750 Add2RecPointsList(h1F, kTrackerClusterMultiplicityPerChMean, !expert, image);
2d114b34 751
752 h1F = new TH1F("hTrackerClusterMultiplicityPerChSigma", "cluster size dispersion per chamber;chamber ID;#sigma_{size} (n_{pads})", nCh,-0.5,nCh-0.5);
753 h1F->SetOption("P");
754 h1F->SetMarkerStyle(kFullDotMedium);
755 h1F->SetMarkerColor(kRed);
d1e6fdee 756 Add2RecPointsList(h1F, kTrackerClusterMultiplicityPerChSigma, !expert, image);
2d114b34 757
4eb3ad98 758 h1F = new TH1F("hTrackerClusterChargePerChMean", "cluster mean charge per chamber;chamber ID;<charge> (fC)", nCh,-0.5,nCh-0.5);
2d114b34 759 h1F->SetOption("P");
760 h1F->SetMarkerStyle(kFullDotMedium);
761 h1F->SetMarkerColor(kRed);
d1e6fdee 762 Add2RecPointsList(h1F, kTrackerClusterChargePerChMean, !expert, image);
2d114b34 763
4eb3ad98 764 h1F = new TH1F("hTrackerClusterChargePerChSigma", "cluster charge dispersion per chamber;chamber ID;#sigma_{charge} (fC)", nCh,-0.5,nCh-0.5);
2d114b34 765 h1F->SetOption("P");
766 h1F->SetMarkerStyle(kFullDotMedium);
767 h1F->SetMarkerColor(kRed);
d1e6fdee 768 Add2RecPointsList(h1F, kTrackerClusterChargePerChSigma, !expert, image);
2d114b34 769
770 // histograms per DE
771 Int_t ndes(0);
772 AliMpDEIterator it;
773 it.First();
774 while ( !it.IsDone())
775 {
776 Int_t detElemId = it.CurrentDEId();
777
778 if ( AliMpDEManager::GetStationType(detElemId) != AliMp::kStationTrigger )
779 {
780 ndes = TMath::Max(ndes,detElemId);
781
782 h1I = new TH1I(Form("hTrackerClusterMultiplicityForDE%04d",detElemId), Form("cluster size distribution in detection element %d;size (n_{pads})",detElemId), 100,0,100);
7d297381 783 Add2RecPointsList(h1I,kTrackerClusterMultiplicityPerDE+detElemId, expert, !image);
2d114b34 784
4eb3ad98 785 h1I = new TH1I(Form("hTrackerClusterChargeForDE%04d",detElemId), Form("cluster charge distribution in detection element %d;charge (fC)",detElemId), 100,0,1000);
7d297381 786 Add2RecPointsList(h1I,kTrackerClusterChargePerDE+detElemId, expert, !image);
2d114b34 787 }
788
789 it.Next();
790 }
791
792 // summary histograms per DE
793 h1I = new TH1I("hTrackerNumberOfClustersPerDE", "Number of clusters per detection element;DetElem ID;n_{clusters}", ndes+1,-0.5,ndes+0.5);
7d297381 794 Add2RecPointsList(h1I, kTrackerNumberOfClustersPerDE, !expert, image);
2d114b34 795
796 h1F = new TH1F("hTrackerClusterMultiplicityPerDEMean", "cluster mean size per DE;DetElem ID;<size> (n_{pads})", ndes+1,-0.5,ndes+0.5);
797 h1F->SetOption("P");
798 h1F->SetMarkerStyle(kFullDotMedium);
799 h1F->SetMarkerColor(kRed);
d1e6fdee 800 Add2RecPointsList(h1F, kTrackerClusterMultiplicityPerDEMean, !expert, image);
2d114b34 801
4eb3ad98 802 h1F = new TH1F("hTrackerClusterChargePerDEMean", "cluster mean charge per DE;DetElem ID;<charge> (fC)", ndes+1,-0.5,ndes+0.5);
2d114b34 803 h1F->SetOption("P");
804 h1F->SetMarkerStyle(kFullDotMedium);
805 h1F->SetMarkerColor(kRed);
d1e6fdee 806 Add2RecPointsList(h1F, kTrackerClusterChargePerDEMean, !expert, image);
b9bd355c 807
808 if (!fMappingCheckRecPoints) fMappingCheckRecPoints = new AliMUONQAMappingCheck(fRun);
04236e67 809}
810
811//____________________________________________________________________________
f587a77d 812void AliMUONQADataMakerRec::InitRecPointsTrigger()
04236e67 813{
f587a77d 814 /// create Reconstructed Points histograms in RecPoints subdir for the
815 /// MUON Trigger subsystem.
816
7d297381 817 const Bool_t expert = kTRUE ;
818 const Bool_t image = kTRUE ;
719914e0 819
820 TString boardName = "Local board Id";
43b113b8 821
822 TString histoName, histoTitle;
823 for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
824 TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
825 for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
826 histoName = Form("hTriggerDigits%sChamber%i", cathName.Data(), 11+iChamber);
827 histoTitle = Form("Chamber %i - %s: counts per strip", 11+iChamber, cathName.Data());
828 TH2F* h0 = new TH2F(histoName.Data(), histoTitle.Data(),
829 234, 0.5, 234.5,
830 16, -0.5, 15.5);
831 h0->GetXaxis()->SetTitle(boardName.Data());
832 h0->GetYaxis()->SetTitle("Strip");
833 Add2RecPointsList(h0, kTriggerDigits + AliMpConstants::NofTriggerChambers()*iCath + iChamber, expert, !image);
834 }
835 }
2346e1ad 836
837 TH1F* h2 = new TH1F("hTriggeredBoards", "Triggered boards", 234, 0.5, 234.5);
7d297381 838 Add2RecPointsList(h2, kTriggeredBoards, expert, !image);
2346e1ad 839
aef183f7 840 AliMUONTriggerDisplay triggerDisplay;
aef183f7 841 for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
842 TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
843 for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
43b113b8 844 histoName = Form("hTriggerDigitsDisplay%sChamber%i", cathName.Data(), 11+iChamber);
719914e0 845 histoTitle = Form("Chamber %i - %s: Occupancy per strip (counts/event)", 11+iChamber, cathName.Data());
aef183f7 846 TH2F* h3 = (TH2F*)triggerDisplay.GetEmptyDisplayHisto(histoName, AliMUONTriggerDisplay::kDisplayStrips,
847 iCath, iChamber, histoTitle);
7d297381 848 Add2RecPointsList(h3, kTriggerDigitsDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber, !expert, image);
aef183f7 849 }
850 }
851
852 TH2F* h4 = (TH2F*)triggerDisplay.GetEmptyDisplayHisto("hFiredBoardsDisplay", AliMUONTriggerDisplay::kDisplayBoards,
719914e0 853 0, 0, "Local board triggers / event");
7d297381 854 Add2RecPointsList(h4, kTriggerBoardsDisplay, !expert, image);
719914e0 855
77bd5fcf 856 TH1F* h5 = new TH1F("hNAnalyzedEvents", "Number of analyzed events per specie", 1, 0.5, 1.5);
857 Int_t esindex = AliRecoParam::AConvert(fEventSpecie);
858 h5->GetXaxis()->SetBinLabel(1, AliRecoParam::GetEventSpecieName(esindex));
719914e0 859 h5->GetYaxis()->SetTitle("Number of analyzed events");
860 Add2RecPointsList(h5, kNAnalyzedEvents, !expert, image);
04236e67 861}
862
863
864//____________________________________________________________________________
865void AliMUONQADataMakerRec::InitESDs()
866{
c92a8c85 867 ///create ESDs histograms in ESDs subdir
5bb54f70 868
7d297381 869 const Bool_t expert = kTRUE ;
870 const Bool_t image = kTRUE ;
5bb54f70 871
c92a8c85 872 Int_t nCh = AliMUONConstants::NTrackingCh();
873 Int_t nDE = 1100;
874
875 // track info
5a240757 876 TH1F* hESDnTracks = new TH1F("hESDnTracks", "number of tracks;n_{tracks}", 20, 0., 20.);
7d297381 877 Add2ESDsList(hESDnTracks, kESDnTracks, !expert, image);
04236e67 878
5a240757 879 TH1F* hESDMatchTrig = new TH1F("hESDMatchTrig", "number of tracks matched with trigger;n_{tracks}", 20, 0., 20.);
7d297381 880 Add2ESDsList(hESDMatchTrig, kESDMatchTrig, !expert, image);
c92a8c85 881
5a240757 882 TH1F* hESDMomentum = new TH1F("hESDMomentum", "momentum distribution;p (GeV/c)", 300, 0., 300);
d1e6fdee 883 Add2ESDsList(hESDMomentum, kESDMomentum, !expert, image);
04236e67 884
5a240757 885 TH1F* hESDPt = new TH1F("hESDPt", "transverse momentum distribution;p_{t} (GeV/c)", 200, 0., 50);
d1e6fdee 886 Add2ESDsList(hESDPt, kESDPt, !expert, image);
04236e67 887
5a240757 888 TH1F* hESDRapidity = new TH1F("hESDRapidity", "rapidity distribution;rapidity", 200, -4.5, -2.);
d1e6fdee 889 Add2ESDsList(hESDRapidity, kESDRapidity, !expert, image);
b62881f2 890
5a240757 891 TH1F* hESDChi2 = new TH1F("hESDChi2", "normalized #chi^{2} distribution;#chi^{2} / ndf", 500, 0., 50.);
d1e6fdee 892 Add2ESDsList(hESDChi2, kESDChi2, !expert, image);
c92a8c85 893
5a240757 894 TH1F* hESDProbChi2 = new TH1F("hESDProbChi2", "distribution of probability of #chi^{2};prob(#chi^{2})", 100, 0., 1.);
d1e6fdee 895 Add2ESDsList(hESDProbChi2, kESDProbChi2, !expert, image);
896
897 TH1F* hESDThetaX = new TH1F("hESDThetaX", "#theta_{X} distribution;#theta_{X} (degree)", 360, -180., 180);
898 Add2ESDsList(hESDThetaX, kESDThetaX, !expert, image);
899
900 TH1F* hESDThetaY = new TH1F("hESDThetaY", "#theta_{Y} distribution;#theta_{Y} (degree)", 360, -180., 180);
901 Add2ESDsList(hESDThetaY, kESDThetaY, !expert, image);
5a240757 902
c92a8c85 903 // cluster info
904 for (Int_t i = 0; i < nCh; i++) {
905 Float_t rMax = AliMUONConstants::Rmax(i/2);
5a240757 906 TH2F* hESDClusterHitMap = new TH2F(Form("hESDClusterHitMap%d",i+1), Form("cluster position distribution in chamber %d;X (cm);Y (cm)",i+1),
c92a8c85 907 100, -rMax, rMax, 100, -rMax, rMax);
7d297381 908 Add2ESDsList(hESDClusterHitMap, kESDClusterHitMap+i, expert, !image);
c92a8c85 909 }
910
5a240757 911 TH1F* hESDnClustersPerTrack = new TH1F("hESDnClustersPerTrack", "number of associated clusters per track;n_{clusters}", 20, 0., 20.);
7d297381 912 Add2ESDsList(hESDnClustersPerTrack, kESDnClustersPerTrack, !expert, image);
c92a8c85 913
2d114b34 914 TH1F* hESDnClustersPerCh = new TH1F("hESDnClustersPerCh", "averaged number of clusters per chamber per track;chamber ID;<n_{clusters}>", nCh, -0.5, nCh-0.5);
c92a8c85 915 hESDnClustersPerCh->SetFillColor(kRed);
d1e6fdee 916 Add2ESDsList(hESDnClustersPerCh, kESDnClustersPerCh, !expert, image);
c92a8c85 917
2d114b34 918 TH1F* hESDnClustersPerDE = new TH1F("hESDnClustersPerDE", "averaged number of clusters per DE per track;DetElem ID;<n_{clusters}>", nDE+1, -0.5, nDE+0.5);
c92a8c85 919 hESDnClustersPerDE->SetFillColor(kRed);
d1e6fdee 920 Add2ESDsList(hESDnClustersPerDE, kESDnClustersPerDE, !expert, image);
c92a8c85 921
c92a8c85 922 for (Int_t i = 0; i < nCh; i++) {
4eb3ad98 923 TH1F* hESDClusterChargeInCh = new TH1F(Form("hESDClusterChargeInCh%d",i+1), Form("cluster charge distribution in chamber %d;charge (fC)",i+1), 100, 0., 1000.);
7d297381 924 Add2ESDsList(hESDClusterChargeInCh, kESDClusterChargeInCh+i, expert, !image);
c92a8c85 925 }
926
4eb3ad98 927 TH1F* hESDClusterChargePerChMean = new TH1F("hESDClusterChargePerChMean", "cluster mean charge per chamber;chamber ID;<charge> (fC)", nCh, -0.5, nCh-0.5);
5a240757 928 hESDClusterChargePerChMean->SetOption("P");
929 hESDClusterChargePerChMean->SetMarkerStyle(kFullDotMedium);
930 hESDClusterChargePerChMean->SetMarkerColor(kRed);
d1e6fdee 931 Add2ESDsList(hESDClusterChargePerChMean, kESDClusterChargePerChMean, !expert, image);
5a240757 932
4eb3ad98 933 TH1F* hESDClusterChargePerChSigma = new TH1F("hESDClusterChargePerChSigma", "cluster charge dispersion per chamber;chamber ID;#sigma_{charge} (fC)", nCh, -0.5, nCh-0.5);
5a240757 934 hESDClusterChargePerChSigma->SetOption("P");
935 hESDClusterChargePerChSigma->SetMarkerStyle(kFullDotMedium);
936 hESDClusterChargePerChSigma->SetMarkerColor(kRed);
d1e6fdee 937 Add2ESDsList(hESDClusterChargePerChSigma, kESDClusterChargePerChSigma, !expert, image);
5a240757 938
4eb3ad98 939 TH1F* hESDClusterChargePerDE = new TH1F("hESDClusterChargePerDE", "cluster mean charge per DE;DetElem ID;<charge> (fC)", nDE+1, -0.5, nDE+0.5);
c92a8c85 940 hESDClusterChargePerDE->SetOption("P");
941 hESDClusterChargePerDE->SetMarkerStyle(kFullDotMedium);
942 hESDClusterChargePerDE->SetMarkerColor(kRed);
d1e6fdee 943 Add2ESDsList(hESDClusterChargePerDE, kESDClusterChargePerDE, !expert, image);
c92a8c85 944
c92a8c85 945 for (Int_t i = 0; i < nCh; i++) {
5a240757 946 TH1F* hESDClusterSizeInCh = new TH1F(Form("hESDClusterSizeInCh%d",i+1), Form("cluster size distribution in chamber %d;size (n_{pads})",i+1), 200, 0., 200.);
7d297381 947 Add2ESDsList(hESDClusterSizeInCh, kESDClusterSizeInCh+i, expert, !image);
b62881f2 948 }
b1341ab0 949
2d114b34 950 TH1F* hESDClusterSizePerChMean = new TH1F("hESDClusterSizePerChMean", "cluster mean size per chamber;chamber ID;<size> (n_{pads})", nCh, -0.5, nCh-0.5);
5a240757 951 hESDClusterSizePerChMean->SetOption("P");
952 hESDClusterSizePerChMean->SetMarkerStyle(kFullDotMedium);
953 hESDClusterSizePerChMean->SetMarkerColor(kRed);
d1e6fdee 954 Add2ESDsList(hESDClusterSizePerChMean, kESDClusterSizePerChMean, !expert, image);
c92a8c85 955
2d114b34 956 TH1F* hESDClusterSizePerChSigma = new TH1F("hESDClusterSizePerChSigma", "cluster size dispersion per chamber;chamber ID;#sigma_{size} (n_{pads})", nCh, -0.5, nCh-0.5);
5a240757 957 hESDClusterSizePerChSigma->SetOption("P");
958 hESDClusterSizePerChSigma->SetMarkerStyle(kFullDotMedium);
959 hESDClusterSizePerChSigma->SetMarkerColor(kRed);
d1e6fdee 960 Add2ESDsList(hESDClusterSizePerChSigma, kESDClusterSizePerChSigma, !expert, image);
c92a8c85 961
2d114b34 962 TH1F* hESDClusterSizePerDE = new TH1F("hESDClusterSizePerDE", "cluster mean size per DE;DetElem ID;<size> (n_{pads})", nDE+1, -0.5, nDE+0.5);
5a240757 963 hESDClusterSizePerDE->SetOption("P");
964 hESDClusterSizePerDE->SetMarkerStyle(kFullDotMedium);
965 hESDClusterSizePerDE->SetMarkerColor(kRed);
d1e6fdee 966 Add2ESDsList(hESDClusterSizePerDE, kESDClusterSizePerDE, !expert, image);
c92a8c85 967
5a240757 968 // cluster - track info
c92a8c85 969 for (Int_t i = 0; i < nCh; i++) {
5a240757 970 TH1F* hESDResidualXInCh = new TH1F(Form("hESDResidualXInCh%d",i+1), Form("cluster-track residual-X distribution in chamber %d;#Delta_{X} (cm)",i+1), 1000, -5., 5.);
7d297381 971 Add2ESDsList(hESDResidualXInCh, kESDResidualXInCh+i, expert, !image);
c92a8c85 972
5a240757 973 TH1F* hESDResidualYInCh = new TH1F(Form("hESDResidualYInCh%d",i+1), Form("cluster-track residual-Y distribution in chamber %d;#Delta_{Y} (cm)",i+1), 1000, -1., 1.);
7d297381 974 Add2ESDsList(hESDResidualYInCh, kESDResidualYInCh+i, expert, !image);
5a240757 975
976 TH1F* hESDLocalChi2XInCh = new TH1F(Form("hESDLocalChi2XInCh%d",i+1), Form("local chi2-X distribution in chamber %d;local #chi^{2}_{X}",i+1), 1000, 0., 25);
7d297381 977 Add2ESDsList(hESDLocalChi2XInCh, kESDLocalChi2XInCh+i, expert, !image);
5a240757 978
979 TH1F* hESDLocalChi2YInCh = new TH1F(Form("hESDLocalChi2YInCh%d",i+1), Form("local chi2-Y distribution in chamber %d;local #chi^{2}_{Y}",i+1), 1000, 0., 25);
7d297381 980 Add2ESDsList(hESDLocalChi2YInCh, kESDLocalChi2YInCh+i, expert, !image);
d1e6fdee 981
982 TH1F* hESDLocalChi2InCh = new TH1F(Form("hESDLocalChi2InCh%d",i+1), Form("local chi2 (~0.5*(#chi^{2}_{X}+#chi^{2}_{Y})) distribution in chamber %d;local #chi^{2}",i+1), 1000, 0., 25);
983 Add2ESDsList(hESDLocalChi2InCh, kESDLocalChi2InCh+i, expert, !image);
c92a8c85 984 }
985
2d114b34 986 TH1F* hESDResidualXPerChMean = new TH1F("hESDResidualXPerChMean", "cluster-track residual-X per Ch: mean;chamber ID;<#Delta_{X}> (cm)", nCh, -0.5, nCh-0.5);
5a240757 987 hESDResidualXPerChMean->SetOption("P");
988 hESDResidualXPerChMean->SetMarkerStyle(kFullDotMedium);
989 hESDResidualXPerChMean->SetMarkerColor(kRed);
d1e6fdee 990 Add2ESDsList(hESDResidualXPerChMean, kESDResidualXPerChMean, !expert, image);
5a240757 991
2d114b34 992 TH1F* hESDResidualYPerChMean = new TH1F("hESDResidualYPerChMean", "cluster-track residual-Y per Ch: mean;chamber ID;<#Delta_{Y}> (cm)", nCh, -0.5, nCh-0.5);
5a240757 993 hESDResidualYPerChMean->SetOption("P");
994 hESDResidualYPerChMean->SetMarkerStyle(kFullDotMedium);
995 hESDResidualYPerChMean->SetMarkerColor(kRed);
d1e6fdee 996 Add2ESDsList(hESDResidualYPerChMean, kESDResidualYPerChMean, !expert, image);
5a240757 997
2d114b34 998 TH1F* hESDResidualXPerChSigma = new TH1F("hESDResidualXPerChSigma", "cluster-track residual-X per Ch: sigma;chamber ID;#sigma_{X} (cm)", nCh, -0.5, nCh-0.5);
5a240757 999 hESDResidualXPerChSigma->SetOption("P");
1000 hESDResidualXPerChSigma->SetMarkerStyle(kFullDotMedium);
1001 hESDResidualXPerChSigma->SetMarkerColor(kRed);
d1e6fdee 1002 Add2ESDsList(hESDResidualXPerChSigma, kESDResidualXPerChSigma, !expert, image);
5a240757 1003
2d114b34 1004 TH1F* hESDResidualYPerChSigma = new TH1F("hESDResidualYPerChSigma", "cluster-track residual-Y per Ch: sigma;chamber ID;#sigma_{Y} (cm)", nCh, -0.5, nCh-0.5);
5a240757 1005 hESDResidualYPerChSigma->SetOption("P");
1006 hESDResidualYPerChSigma->SetMarkerStyle(kFullDotMedium);
1007 hESDResidualYPerChSigma->SetMarkerColor(kRed);
d1e6fdee 1008 Add2ESDsList(hESDResidualYPerChSigma, kESDResidualYPerChSigma, !expert, image);
5a240757 1009
4eb3ad98 1010 TH1F* hESDLocalChi2XPerChMean = new TH1F("hESDLocalChi2XPerCh", "local chi2-X per Ch: mean;chamber ID;<local #chi^{2}_{X}>", nCh, -0.5, nCh-0.5);
5a240757 1011 hESDLocalChi2XPerChMean->SetOption("P");
1012 hESDLocalChi2XPerChMean->SetMarkerStyle(kFullDotMedium);
1013 hESDLocalChi2XPerChMean->SetMarkerColor(kRed);
d1e6fdee 1014 Add2ESDsList(hESDLocalChi2XPerChMean, kESDLocalChi2XPerChMean, !expert, image);
5a240757 1015
4eb3ad98 1016 TH1F* hESDLocalChi2YPerChMean = new TH1F("hESDLocalChi2YPerCh", "local chi2-Y per Ch: mean;chamber ID;<local #chi^{2}_{Y}>", nCh, -0.5, nCh-0.5);
5a240757 1017 hESDLocalChi2YPerChMean->SetOption("P");
1018 hESDLocalChi2YPerChMean->SetMarkerStyle(kFullDotMedium);
1019 hESDLocalChi2YPerChMean->SetMarkerColor(kRed);
d1e6fdee 1020 Add2ESDsList(hESDLocalChi2YPerChMean, kESDLocalChi2YPerChMean, !expert, image);
1021
4eb3ad98 1022 TH1F* hESDLocalChi2PerChMean = new TH1F("hESDLocalChi2PerCh", "local chi2 (~0.5*(#chi^{2}_{X}+#chi^{2}_{Y})) per Ch: mean;chamber ID;<local #chi^{2}>", nCh, -0.5, nCh-0.5);
d1e6fdee 1023 hESDLocalChi2PerChMean->SetOption("P");
1024 hESDLocalChi2PerChMean->SetMarkerStyle(kFullDotMedium);
1025 hESDLocalChi2PerChMean->SetMarkerColor(kRed);
1026 Add2ESDsList(hESDLocalChi2PerChMean, kESDLocalChi2PerChMean, !expert, image);
5a240757 1027
2d114b34 1028 TH1F* hESDResidualXPerDEMean = new TH1F("hESDResidualXPerDEMean", "cluster-track residual-X per DE: mean;DetElem ID;<#Delta_{X}> (cm)", nDE+1, -0.5, nDE+0.5);
c92a8c85 1029 hESDResidualXPerDEMean->SetOption("P");
1030 hESDResidualXPerDEMean->SetMarkerStyle(kFullDotMedium);
1031 hESDResidualXPerDEMean->SetMarkerColor(kRed);
d1e6fdee 1032 Add2ESDsList(hESDResidualXPerDEMean, kESDResidualXPerDEMean, !expert, image);
c92a8c85 1033
2d114b34 1034 TH1F* hESDResidualYPerDEMean = new TH1F("hESDResidualYPerDEMean", "cluster-track residual-Y per DE: mean;DetElem ID;<#Delta_{Y}> (cm)", nDE+1, -0.5, nDE+0.5);
c92a8c85 1035 hESDResidualYPerDEMean->SetOption("P");
1036 hESDResidualYPerDEMean->SetMarkerStyle(kFullDotMedium);
1037 hESDResidualYPerDEMean->SetMarkerColor(kRed);
d1e6fdee 1038 Add2ESDsList(hESDResidualYPerDEMean, kESDResidualYPerDEMean, !expert, image);
c92a8c85 1039
2d114b34 1040 TH1F* hESDResidualXPerDESigma = new TH1F("hESDResidualXPerDESigma", "cluster-track residual-X per DE: sigma;DetElem ID;#sigma_{X} (cm)", nDE+1, -0.5, nDE+0.5);
c92a8c85 1041 hESDResidualXPerDESigma->SetOption("P");
1042 hESDResidualXPerDESigma->SetMarkerStyle(kFullDotMedium);
1043 hESDResidualXPerDESigma->SetMarkerColor(kRed);
d1e6fdee 1044 Add2ESDsList(hESDResidualXPerDESigma, kESDResidualXPerDESigma, !expert, image);
c92a8c85 1045
2d114b34 1046 TH1F* hESDResidualYPerDESigma = new TH1F("hESDResidualYPerDESigma", "cluster-track residual-Y per DE: sigma;DetElem ID;#sigma_{Y} (cm)", nDE+1, -0.5, nDE+0.5);
c92a8c85 1047 hESDResidualYPerDESigma->SetOption("P");
1048 hESDResidualYPerDESigma->SetMarkerStyle(kFullDotMedium);
1049 hESDResidualYPerDESigma->SetMarkerColor(kRed);
d1e6fdee 1050 Add2ESDsList(hESDResidualYPerDESigma, kESDResidualYPerDESigma, !expert, image);
c92a8c85 1051
4eb3ad98 1052 TH1F* hESDLocalChi2XPerDEMean = new TH1F("hESDLocalChi2XPerDE", "local chi2-X per DE: mean;DetElem ID;<local #chi^{2}_{X}>", nDE+1, -0.5, nDE+0.5);
5a240757 1053 hESDLocalChi2XPerDEMean->SetOption("P");
1054 hESDLocalChi2XPerDEMean->SetMarkerStyle(kFullDotMedium);
1055 hESDLocalChi2XPerDEMean->SetMarkerColor(kRed);
d1e6fdee 1056 Add2ESDsList(hESDLocalChi2XPerDEMean, kESDLocalChi2XPerDEMean, !expert, image);
5a240757 1057
4eb3ad98 1058 TH1F* hESDLocalChi2YPerDEMean = new TH1F("hESDLocalChi2YPerDE", "local chi2-Y per DE: mean;DetElem ID;<local #chi^{2}_{Y}>", nDE+1, -0.5, nDE+0.5);
5a240757 1059 hESDLocalChi2YPerDEMean->SetOption("P");
1060 hESDLocalChi2YPerDEMean->SetMarkerStyle(kFullDotMedium);
1061 hESDLocalChi2YPerDEMean->SetMarkerColor(kRed);
d1e6fdee 1062 Add2ESDsList(hESDLocalChi2YPerDEMean, kESDLocalChi2YPerDEMean, !expert, image);
1063
4eb3ad98 1064 TH1F* hESDLocalChi2PerDEMean = new TH1F("hESDLocalChi2PerDE", "local chi2 (~0.5*(#chi^{2}_{X}+#chi^{2}_{Y})) per DE: mean;DetElem ID;<local #chi^{2}>", nDE+1, -0.5, nDE+0.5);
d1e6fdee 1065 hESDLocalChi2PerDEMean->SetOption("P");
1066 hESDLocalChi2PerDEMean->SetMarkerStyle(kFullDotMedium);
1067 hESDLocalChi2PerDEMean->SetMarkerColor(kRed);
1068 Add2ESDsList(hESDLocalChi2PerDEMean, kESDLocalChi2PerDEMean, !expert, image);
5a240757 1069
abcfd6d0 1070 // intermediate histograms
2d114b34 1071 TH1F* hESDnTotClustersPerCh = new TH1F("hESDnTotClustersPerCh", "total number of associated clusters per chamber;chamber ID;#Sigma(n_{clusters})", nCh, -0.5, nCh-0.5);
7d297381 1072 Add2ESDsList(hESDnTotClustersPerCh, kESDnTotClustersPerCh, expert, !image);
2d114b34 1073 TH1F* hESDnTotClustersPerDE = new TH1F("hESDnTotClustersPerDE", "total number of associated clusters per DE;DetElem ID;#Sigma(n_{clusters})", nDE+1, -0.5, nDE+0.5);
7d297381 1074 Add2ESDsList(hESDnTotClustersPerDE, kESDnTotClustersPerDE, expert, !image);
2d114b34 1075 TH1F* hESDnTotFullClustersPerDE = new TH1F("hESDnTotFullClustersPerDE", "total number of associated clusters containing pad info per DE;DetElem ID;#Sigma(n_{full clusters})", nDE+1, -0.5, nDE+0.5);
7d297381 1076 Add2ESDsList(hESDnTotFullClustersPerDE, kESDnTotFullClustersPerDE, expert, !image);
4eb3ad98 1077 TH1F* hESDSumClusterChargePerDE = new TH1F("hESDSumClusterChargePerDE", "sum of cluster charge per DE;DetElem ID;#Sigma(charge) (fC)", nDE+1, -0.5, nDE+0.5);
7d297381 1078 Add2ESDsList(hESDSumClusterChargePerDE, kESDSumClusterChargePerDE, expert, !image);
2d114b34 1079 TH1F* hESDSumClusterSizePerDE = new TH1F("hESDSumClusterSizePerDE", "sum of cluster size per DE;DetElem ID;#Sigma(size) (n_{pads})", nDE+1, -0.5, nDE+0.5);
7d297381 1080 Add2ESDsList(hESDSumClusterSizePerDE, kESDSumClusterSizePerDE, expert, !image);
2d114b34 1081 TH1F* hESDSumResidualXPerDE = new TH1F("hESDSumResidualXPerDE", "sum of cluster-track residual-X per DE;DetElem ID;#Sigma(#Delta_{X}) (cm)", nDE+1, -0.5, nDE+0.5);
7d297381 1082 Add2ESDsList(hESDSumResidualXPerDE, kESDSumResidualXPerDE, expert, !image);
2d114b34 1083 TH1F* hESDSumResidualYPerDE = new TH1F("hESDSumResidualYPerDE", "sum of cluster-track residual-Y per DE;DetElem ID;#Sigma(#Delta_{Y}) (cm)", nDE+1, -0.5, nDE+0.5);
7d297381 1084 Add2ESDsList(hESDSumResidualYPerDE, kESDSumResidualYPerDE, expert, !image);
2d114b34 1085 TH1F* hESDSumResidualX2PerDE = new TH1F("hESDSumResidualX2PerDE", "sum of cluster-track residual-X**2 per DE;DetElem ID;#Sigma(#Delta_{X}^{2}) (cm^{2})", nDE+1, -0.5, nDE+0.5);
7d297381 1086 Add2ESDsList(hESDSumResidualX2PerDE, kESDSumResidualX2PerDE, expert, !image);
2d114b34 1087 TH1F* hESDSumResidualY2PerDE = new TH1F("hESDSumResidualY2PerDE", "sum of cluster-track residual-Y**2 per DE;DetElem ID;#Sigma(#Delta_{Y}^{2}) (cm^{2})", nDE+1, -0.5, nDE+0.5);
7d297381 1088 Add2ESDsList(hESDSumResidualY2PerDE, kESDSumResidualY2PerDE, expert, !image);
2d114b34 1089 TH1F* hESDSumLocalChi2XPerDE = new TH1F("hESDSumLocalChi2XPerDE", "sum of local chi2-X per DE;DetElem ID;#Sigma(local #chi^{2}_{X})", nDE+1, -0.5, nDE+0.5);
7d297381 1090 Add2ESDsList(hESDSumLocalChi2XPerDE, kESDSumLocalChi2XPerDE, expert, !image);
2d114b34 1091 TH1F* hESDSumLocalChi2YPerDE = new TH1F("hESDSumLocalChi2YPerDE", "sum of local chi2-Y per DE;DetElem ID;#Sigma(local #chi^{2}_{Y})", nDE+1, -0.5, nDE+0.5);
7d297381 1092 Add2ESDsList(hESDSumLocalChi2YPerDE, kESDSumLocalChi2YPerDE, expert, !image);
d1e6fdee 1093 TH1F* hESDSumLocalChi2PerDE = new TH1F("hESDSumLocalChi2PerDE", "sum of local chi2 (~0.5*(#chi^{2}_{X}+#chi^{2}_{Y})) per DE;DetElem ID;#Sigma(local #chi^{2})", nDE+1, -0.5, nDE+0.5);
1094 Add2ESDsList(hESDSumLocalChi2PerDE, kESDSumLocalChi2PerDE, expert, !image);
04236e67 1095}
1096
1097//____________________________________________________________________________
1098void AliMUONQADataMakerRec::MakeRaws(AliRawReader* rawReader)
1099{
1100 /// make QA for rawdata
b1341ab0 1101
eca4fa66 1102 // Check id histograms already created for this Event Specie
77bd5fcf 1103
1104 AliDebug(AliQAv1::GetQADebugLevel(),
1105 Form("RAW event type %s", AliRawEventHeaderBase::GetTypeName(rawReader->GetType())));
eca4fa66 1106
f587a77d 1107 if ( rawReader->GetType() == AliRawEventHeaderBase::kPhysicsEvent )
1108 {
04236e67 1109 rawReader->Reset();
f587a77d 1110 MakeRawsTracker(rawReader);
1111 }
04236e67 1112
719914e0 1113 if ( rawReader->GetType() == AliRawEventHeaderBase::kPhysicsEvent ||
1114 rawReader->GetType() == AliRawEventHeaderBase::kCalibrationEvent )
1115 {
1116 rawReader->Reset();
1117 MakeRawsTrigger(rawReader);
1118 }
f587a77d 1119}
2346e1ad 1120
f587a77d 1121//____________________________________________________________________________
1122void AliMUONQADataMakerRec::MakeRawsTracker(AliRawReader* rawReader)
1123{
1124 /// make QA for rawdata tracker
de1d4a53 1125
bb22d2a6 1126 /// forces init
1127 GetRawsData(kTrackerBusPatchOccupancy);
1128
b6f591ae 1129 ((AliMUONTrackerDataMaker*)fTrackerDataMaker)->SetRawReader(rawReader);
f587a77d 1130
1131 fTrackerDataMaker->ProcessEvent();
1132}
2346e1ad 1133
f587a77d 1134//____________________________________________________________________________
1135void AliMUONQADataMakerRec::MakeRawsTrigger(AliRawReader* rawReader)
1136{
1137 /// make QA for rawdata trigger
1138
2346e1ad 1139 // Get trigger scalers
1140
1141 Int_t loCircuit=0;
1142 AliMpCDB::LoadDDLStore();
1143
1144 AliMUONRawStreamTrigger rawStreamTrig(rawReader);
1145 while (rawStreamTrig.NextDDL())
1146 {
1147 // If not a scaler event, do nothing
1148 Bool_t scalerEvent = rawReader->GetDataHeader()->GetL1TriggerMessage() & 0x1;
719914e0 1149 if ( !scalerEvent ) continue;
2346e1ad 1150
77bd5fcf 1151 AliDebug(AliQAv1::GetQADebugLevel(),"Filling trigger scalers");
1152
2346e1ad 1153 AliMUONDDLTrigger* ddlTrigger = rawStreamTrig.GetDDLTrigger();
1154 AliMUONDarcHeader* darcHeader = ddlTrigger->GetDarcHeader();
1155
eb3886c8 1156 if (darcHeader->GetGlobalFlag()){
1157 UInt_t nOfClocks = darcHeader->GetGlobalClock();
1158 Double_t nOfSeconds = ((Double_t) nOfClocks) / 40e6; // 1 clock each 25 ns
1159 ((TH1F*)GetRawsData(kTriggerScalersTime))->Fill(1., nOfSeconds);
1160 }
1161
2346e1ad 1162 Int_t nReg = darcHeader->GetRegHeaderEntries();
1163
1164 for(Int_t iReg = 0; iReg < nReg ;iReg++)
1165 { //reg loop
1166
1167 // crate info
1168 AliMpTriggerCrate* crate = AliMpDDLStore::Instance()->
1169 GetTriggerCrate(rawStreamTrig.GetDDL(), iReg);
1170
1171 AliMUONRegHeader* regHeader = darcHeader->GetRegHeaderEntry(iReg);
1172
1173 // loop over local structures
1174 Int_t nLocal = regHeader->GetLocalEntries();
1175 for(Int_t iLocal = 0; iLocal < nLocal; iLocal++)
1176 {
1177 AliMUONLocalStruct* localStruct = regHeader->GetLocalEntry(iLocal);
1178
1179 // if card exist
1180 if (!localStruct) continue;
1181
1182 loCircuit = crate->GetLocalBoardId(localStruct->GetId());
1183
1184 if ( !loCircuit ) continue; // empty slot
1185
1186 AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit, false);
1187
1188 // skip copy cards
1189 if( !localBoard->IsNotified())
1190 continue;
1191
1192 Int_t cathode = localStruct->GetComptXY()%2;
1193
2346e1ad 1194 // loop over strips
1195 for (Int_t ibitxy = 0; ibitxy < 16; ++ibitxy) {
1196 if(localStruct->GetXY1(ibitxy) > 0)
43b113b8 1197 ((TH2F*)GetRawsData(kTriggerScalers + AliMpConstants::NofTriggerChambers()*cathode + 0))
1198 ->Fill(loCircuit, ibitxy, 2*localStruct->GetXY1(ibitxy));
2346e1ad 1199 if(localStruct->GetXY2(ibitxy) > 0)
43b113b8 1200 ((TH2F*)GetRawsData(kTriggerScalers + AliMpConstants::NofTriggerChambers()*cathode + 1))
1201 ->Fill(loCircuit, ibitxy, 2*localStruct->GetXY2(ibitxy));
2346e1ad 1202 if(localStruct->GetXY3(ibitxy) > 0)
43b113b8 1203 ((TH2F*)GetRawsData(kTriggerScalers + AliMpConstants::NofTriggerChambers()*cathode + 2))
1204 ->Fill(loCircuit, ibitxy, 2*localStruct->GetXY3(ibitxy));
2346e1ad 1205 if(localStruct->GetXY4(ibitxy) > 0)
43b113b8 1206 ((TH2F*)GetRawsData(kTriggerScalers + AliMpConstants::NofTriggerChambers()*cathode + 3))
1207 ->Fill(loCircuit, ibitxy, 2*localStruct->GetXY4(ibitxy));
2346e1ad 1208 } // loop on strips
1209 } // iLocal
1210 } // iReg
1211 } // NextDDL
04236e67 1212}
1213
44ed7a66 1214//__________________________________________________________________
1215void AliMUONQADataMakerRec::MakeDigits(TTree* digitsTree)
1216{
1217 /// makes data from Digits
eca4fa66 1218
77bd5fcf 1219 // Do nothing in case of calibration event
1220 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return;
1221
44ed7a66 1222 if (!fDigitStore)
1223 fDigitStore = AliMUONVDigitStore::Create(*digitsTree);
1224 fDigitStore->Connect(*digitsTree, false);
1225 digitsTree->GetEvent(0);
1226
1227 TIter next(fDigitStore->CreateIterator());
1228
1229 AliMUONVDigit* dig = 0x0;
1230
1231 while ( ( dig = static_cast<AliMUONVDigit*>(next()) ) )
1232 {
1233 GetDigitsData(0)->Fill(dig->DetElemId());
1234 GetDigitsData(1)->Fill(dig->ADC());
1235 }
1236}
1237
04236e67 1238//____________________________________________________________________________
1239void AliMUONQADataMakerRec::MakeRecPoints(TTree* clustersTree)
1240{
f587a77d 1241 /// Fill histograms from treeR
77bd5fcf 1242
1243 // Do nothing in case of calibration event
1244 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return;
f587a77d 1245
77bd5fcf 1246 GetRecPointsData(kNAnalyzedEvents)->Fill(1.);
719914e0 1247
bb22d2a6 1248 MakeRecPointsTracker(clustersTree);
1249 MakeRecPointsTrigger(clustersTree);
f587a77d 1250}
1251
b9bd355c 1252
1253
f587a77d 1254//____________________________________________________________________________
1255void AliMUONQADataMakerRec::MakeRecPointsTracker(TTree* clustersTree)
1256{
1257 /// Fill histograms related to tracker clusters
1258
1259 // First things first : do we have clusters in the TreeR ?
1260 // In "normal" production mode, it should be perfectly normal
1261 // *not* to have them.
1262 // But if for some reason we de-activated the combined tracking,
1263 // then we have clusters in TreeR, so let's take that opportunity
1264 // to QA them...
1265
b9bd355c 1266 AliCodeTimerAuto("");
1267
1268 // Do nothing in case of calibration event
1269 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return;
1270
f587a77d 1271 if (!fClusterStore)
1272 {
1273 AliCodeTimerAuto("ClusterStore creation");
1274 fClusterStore = AliMUONVClusterStore::Create(*clustersTree);
1275 if (!fClusterStore)
1276 {
f587a77d 1277 return;
1278 }
1279 }
1280
f587a77d 1281 fClusterStore->Connect(*clustersTree,kFALSE);
1282 clustersTree->GetEvent(0);
1283
1284 TIter next(fClusterStore->CreateIterator());
1285 AliMUONVCluster* cluster;
1286
b9bd355c 1287 if ( fMappingCheckRecPoints ) fMappingCheckRecPoints->NewEvent();
1288
f587a77d 1289 while ( ( cluster = static_cast<AliMUONVCluster*>(next()) ) )
1290 {
1291 Int_t detElemId = cluster->GetDetElemId();
1292 Int_t chamberId = AliMpDEManager::GetChamberId(detElemId);
1293
1294 GetRecPointsData(kTrackerNumberOfClustersPerDE)->Fill(detElemId);
1295 GetRecPointsData(kTrackerClusterChargePerDE+detElemId)->Fill(cluster->GetCharge());
1296 GetRecPointsData(kTrackerClusterMultiplicityPerDE+detElemId)->Fill(cluster->GetNDigits());
b1341ab0 1297
f587a77d 1298 GetRecPointsData(kTrackerNumberOfClustersPerChamber)->Fill(chamberId);
1299 GetRecPointsData(kTrackerClusterChargePerChamber+chamberId)->Fill(cluster->GetCharge());
1300 GetRecPointsData(kTrackerClusterMultiplicityPerChamber+chamberId)->Fill(cluster->GetNDigits());
2d114b34 1301 GetRecPointsData(kTrackerClusterHitMapPerChamber+chamberId)->Fill(cluster->GetX(),cluster->GetY());
f587a77d 1302
b9bd355c 1303 if ( fMappingCheckRecPoints ) fMappingCheckRecPoints->Store(*cluster);
1304
f587a77d 1305 }
1306
1307 fClusterStore->Clear();
1308}
1309
1310//____________________________________________________________________________
1311void AliMUONQADataMakerRec::MakeRecPointsTrigger(TTree* clustersTree)
1312{
1313 /// makes data from trigger response
b9bd355c 1314
1315 AliCodeTimerAuto("");
1316
7035694f 1317 // Fired pads info
1318 fDigitStore->Clear();
1319
1320 if (!fTriggerStore) fTriggerStore = AliMUONVTriggerStore::Create(*clustersTree);
1321 fTriggerStore->Clear();
1322 fTriggerStore->Connect(*clustersTree, false);
04236e67 1323 clustersTree->GetEvent(0);
04236e67 1324
7035694f 1325 AliMUONLocalTrigger* locTrg;
1326 TIter nextLoc(fTriggerStore->CreateLocalIterator());
1327
1328 while ( ( locTrg = static_cast<AliMUONLocalTrigger*>(nextLoc()) ) )
1329 {
1330 if (locTrg->IsNull()) continue;
1331
1332 TArrayS xyPattern[2];
1333 locTrg->GetXPattern(xyPattern[0]);
1334 locTrg->GetYPattern(xyPattern[1]);
1335
1336 Int_t nBoard = locTrg->LoCircuit();
2346e1ad 1337
d72d7b9e 1338 Bool_t xTrig=locTrg->IsTrigX();
1339 Bool_t yTrig=locTrg->IsTrigY();
2346e1ad 1340
1341 if (xTrig && yTrig)
1342 ((TH1F*)GetRecPointsData(kTriggeredBoards))->Fill(nBoard);
1343
1344 fDigitMaker->TriggerDigits(nBoard, xyPattern, *fDigitStore);
7035694f 1345 }
04236e67 1346
7035694f 1347 TIter nextDigit(fDigitStore->CreateIterator());
1348 AliMUONVDigit* mDigit;
1349 while ( ( mDigit = static_cast<AliMUONVDigit*>(nextDigit()) ) )
04236e67 1350 {
7035694f 1351 Int_t detElemId = mDigit->DetElemId();
2346e1ad 1352 Int_t ch = detElemId/100;
1353 Int_t localBoard = mDigit->ManuId();
1354 Int_t channel = mDigit->ManuChannel();
7035694f 1355 Int_t cathode = mDigit->Cathode();
43b113b8 1356 Int_t iChamber = ch - 11;
b62881f2 1357
43b113b8 1358 ((TH2F*)GetRecPointsData(kTriggerDigits + AliMpConstants::NofTriggerChambers()*cathode + iChamber))
1359 ->Fill(localBoard, channel);
04236e67 1360 }
1361}
1362
1363//____________________________________________________________________________
1364void AliMUONQADataMakerRec::MakeESDs(AliESDEvent* esd)
1365{
c92a8c85 1366 /// make QA data from ESDs
77bd5fcf 1367
b9bd355c 1368 AliCodeTimerAuto("");
1369
77bd5fcf 1370 // Do nothing in case of calibration event
1371 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return;
c92a8c85 1372
c92a8c85 1373 // load ESD event in the interface
1374 AliMUONESDInterface esdInterface;
ac624e6b 1375 if (GetMUONRecoParam()) AliMUONESDInterface::ResetTracker(GetMUONRecoParam());
c92a8c85 1376 else AliError("Unable to get recoParam: use default ones for residual calculation");
1377 esdInterface.LoadEvent(*esd);
1378
1379 GetESDsData(kESDnTracks)->Fill(esdInterface.GetNTracks());
1380
1381 Int_t nTrackMatchTrig = 0;
1382
1383 // loop over tracks
1384 Int_t nTracks = (Int_t) esd->GetNumberOfMuonTracks();
1385 for (Int_t iTrack = 0; iTrack < nTracks; ++iTrack) {
1386
1387 // get the ESD track and skip "ghosts"
1388 AliESDMuonTrack* esdTrack = esd->GetMuonTrack(iTrack);
1389 if (!esdTrack->ContainTrackerData()) continue;
1390
1391 // get corresponding MUON track
1392 AliMUONTrack* track = esdInterface.FindTrack(esdTrack->GetUniqueID());
1393
1394 if (esdTrack->ContainTriggerData()) nTrackMatchTrig++;
1395
1396 GetESDsData(kESDMomentum)->Fill(esdTrack->P());
1397 GetESDsData(kESDPt)->Fill(esdTrack->Pt());
1398 GetESDsData(kESDRapidity)->Fill(esdTrack->Y());
1399 GetESDsData(kESDChi2)->Fill(track->GetNormalizedChi2());
5a240757 1400 GetESDsData(kESDProbChi2)->Fill(TMath::Prob(track->GetGlobalChi2(),track->GetNDF()));
d1e6fdee 1401 GetESDsData(kESDThetaX)->Fill(esdTrack->GetThetaXUncorrected() / TMath::Pi() * 180.);
1402 GetESDsData(kESDThetaY)->Fill(esdTrack->GetThetaYUncorrected() / TMath::Pi() * 180.);
c92a8c85 1403 GetESDsData(kESDnClustersPerTrack)->Fill(track->GetNClusters());
1404
1405 // loop over clusters
1406 AliMUONTrackParam* trackParam = static_cast<AliMUONTrackParam*>(track->GetTrackParamAtCluster()->First());
1407 while (trackParam) {
b1fea02e 1408
c92a8c85 1409 AliMUONVCluster* cluster = trackParam->GetClusterPtr();
1410 Int_t chId = cluster->GetChamberId();
1411 Int_t deID = cluster->GetDetElemId();
1412 Double_t residualX = cluster->GetX() - trackParam->GetNonBendingCoor();
1413 Double_t residualY = cluster->GetY() - trackParam->GetBendingCoor();
d1e6fdee 1414 Double_t sigmaResidualX2 = cluster->GetErrX2() - trackParam->GetCovariances()(0,0);
1415 Double_t sigmaResidualY2 = cluster->GetErrY2() - trackParam->GetCovariances()(2,2);
1416 Double_t localChi2X = (sigmaResidualX2 > 0.) ? residualX*residualX/sigmaResidualX2 : 0.;
1417 Double_t localChi2Y = (sigmaResidualY2 > 0.) ? residualY*residualY/sigmaResidualY2 : 0.;
1418 Double_t localChi2 = 0.5 * trackParam->GetLocalChi2();
b1fea02e 1419
c92a8c85 1420 GetESDsData(kESDClusterHitMap+chId)->Fill(cluster->GetX(), cluster->GetY());
1421
abcfd6d0 1422 GetESDsData(kESDnTotClustersPerCh)->Fill(chId);
1423 GetESDsData(kESDnTotClustersPerDE)->Fill(deID);
c92a8c85 1424
c92a8c85 1425 GetESDsData(kESDClusterChargeInCh+chId)->Fill(cluster->GetCharge());
abcfd6d0 1426 GetESDsData(kESDSumClusterChargePerDE)->Fill(deID, cluster->GetCharge());
c92a8c85 1427
1428 if (cluster->GetNDigits() > 0) { // discard clusters with pad not stored in ESD
abcfd6d0 1429 GetESDsData(kESDnTotFullClustersPerDE)->Fill(deID);
5a240757 1430 GetESDsData(kESDClusterSizeInCh+chId)->Fill(cluster->GetNDigits());
abcfd6d0 1431 GetESDsData(kESDSumClusterSizePerDE)->Fill(deID, cluster->GetNDigits());
b62881f2 1432 }
c92a8c85 1433
c92a8c85 1434 GetESDsData(kESDResidualXInCh+chId)->Fill(residualX);
1435 GetESDsData(kESDResidualYInCh+chId)->Fill(residualY);
abcfd6d0 1436 GetESDsData(kESDSumResidualXPerDE)->Fill(deID, residualX);
1437 GetESDsData(kESDSumResidualYPerDE)->Fill(deID, residualY);
1438 GetESDsData(kESDSumResidualX2PerDE)->Fill(deID, residualX*residualX);
1439 GetESDsData(kESDSumResidualY2PerDE)->Fill(deID, residualY*residualY);
5a240757 1440
1441 GetESDsData(kESDLocalChi2XInCh+chId)->Fill(localChi2X);
1442 GetESDsData(kESDLocalChi2YInCh+chId)->Fill(localChi2Y);
d1e6fdee 1443 GetESDsData(kESDLocalChi2InCh+chId)->Fill(localChi2);
abcfd6d0 1444 GetESDsData(kESDSumLocalChi2XPerDE)->Fill(deID, localChi2X);
1445 GetESDsData(kESDSumLocalChi2YPerDE)->Fill(deID, localChi2Y);
d1e6fdee 1446 GetESDsData(kESDSumLocalChi2PerDE)->Fill(deID, localChi2);
c92a8c85 1447
1448 trackParam = static_cast<AliMUONTrackParam*>(track->GetTrackParamAtCluster()->After(trackParam));
b9bd355c 1449
04236e67 1450 }
c92a8c85 1451
1452 }
b9bd355c 1453
c92a8c85 1454 GetESDsData(kESDMatchTrig)->Fill(nTrackMatchTrig);
1455
04236e67 1456}
1457
1458//____________________________________________________________________________
1459void AliMUONQADataMakerRec::StartOfDetectorCycle()
1460{
1461 /// Detector specific actions at start of cycle
1462
1463}
2346e1ad 1464
1465//____________________________________________________________________________
4e25ac79 1466void AliMUONQADataMakerRec::DisplayTriggerInfo(AliQAv1::TASKINDEX_t task)
2346e1ad 1467{
1468 //
1469 /// Display trigger information in a user-friendly way:
1470 /// from local board and strip numbers to their position on chambers
1471 //
eca4fa66 1472
49e110ec 1473
4e25ac79 1474 if(task!=AliQAv1::kRECPOINTS && task!=AliQAv1::kRAWS) return;
2346e1ad 1475
c455c5fb 1476 // check we get histograms, otherwise return right now
1477 if ( task == AliQAv1::kRECPOINTS )
1478 {
43b113b8 1479 if ( !GetRecPointsData(kTriggerDigits) ) return;
c455c5fb 1480 }
1481
1482 if ( task == AliQAv1::kRAWS )
1483 {
43b113b8 1484 if ( !GetRawsData(kTriggerScalers) ) return;
c455c5fb 1485 }
1486
aef183f7 1487 AliMUONTriggerDisplay triggerDisplay;
1488
43b113b8 1489 TH2F* histoStrips=0x0;
2346e1ad 1490 TH2F* histoDisplayStrips=0x0;
719914e0 1491 AliMUONTriggerDisplay::EDisplayOption displayOption = AliMUONTriggerDisplay::kDefaultDisplay;
1492 if(task == AliQAv1::kRAWS) displayOption = AliMUONTriggerDisplay::kNormalizeToArea;
2346e1ad 1493
aef183f7 1494 for (Int_t iCath = 0; iCath < AliMpConstants::NofCathodes(); iCath++)
43b113b8 1495 {
aef183f7 1496 for (Int_t iChamber = 0; iChamber < AliMpConstants::NofTriggerChambers(); iChamber++)
2346e1ad 1497 {
43b113b8 1498 if(task==AliQAv1::kRECPOINTS){
1499 histoStrips = (TH2F*)GetRecPointsData(kTriggerDigits + AliMpConstants::NofTriggerChambers()*iCath + iChamber);
1500 }
1501 else if(task==AliQAv1::kRAWS){
1502 histoStrips = (TH2F*)GetRawsData(kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber);
1503 }
1504
1505 if(histoStrips->GetEntries()==0) continue; // No events found => No need to display
1506
4e25ac79 1507 if(task==AliQAv1::kRECPOINTS){
aef183f7 1508 histoDisplayStrips = (TH2F*)GetRecPointsData(kTriggerDigitsDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber);
2346e1ad 1509 }
4e25ac79 1510 else if(task==AliQAv1::kRAWS){
aef183f7 1511 histoDisplayStrips = (TH2F*)GetRawsData(kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber);
2346e1ad 1512 }
43b113b8 1513
1514 triggerDisplay.FillDisplayHistogram(histoStrips, histoDisplayStrips,
1515 AliMUONTriggerDisplay::kDisplayStrips, iCath, iChamber, displayOption);
719914e0 1516
1517 Float_t scaleValue = 0.;
4e25ac79 1518 if(task==AliQAv1::kRAWS) {
719914e0 1519 scaleValue = ((TH1F*)GetRawsData(kTriggerScalersTime))->GetBinContent(1);
eb3886c8 1520 }
719914e0 1521 else if ( task == AliQAv1::kRECPOINTS ) {
77bd5fcf 1522 scaleValue = GetRecPointsData(kNAnalyzedEvents)->GetBinContent(1);
719914e0 1523 }
1524 if(scaleValue>0.) histoDisplayStrips->Scale(1./scaleValue);
2346e1ad 1525 } // iChamber
1526 } // iCath
2346e1ad 1527
4e25ac79 1528 if(task==AliQAv1::kRECPOINTS){
49e110ec 1529 TH1F* histoBoards = (TH1F*)GetRecPointsData(kTriggeredBoards);
1530 TH2F* histoDisplayBoards = (TH2F*)GetRecPointsData(kTriggerBoardsDisplay);
1531 triggerDisplay.FillDisplayHistogram(histoBoards, histoDisplayBoards, AliMUONTriggerDisplay::kDisplayBoards, 0, 0);
77bd5fcf 1532 Float_t scaleValue = GetRecPointsData(kNAnalyzedEvents)->GetBinContent(1);
719914e0 1533 if(scaleValue>0.) histoDisplayBoards->Scale(1./scaleValue);
49e110ec 1534 }
1535}
1536
1537
1538//_____________________________________________________________________________
1539Bool_t
1540AliMUONQADataMakerRec::FillTriggerDCSHistos()
1541{
1542 /// Get HV and currents values for one trigger chamber
1543
1544 AliCodeTimerAuto("");
1545
49e110ec 1546 AliMUONCalibrationData calibrationData(AliCDBManager::Instance()->GetRun());
1547
1548 TMap* triggerDcsMap = calibrationData.TriggerDCS();
1549
2d114b34 1550 if ( !triggerDcsMap )
1551 {
1552 AliError("Cannot fill DCS histos, as triggerDcsMap is NULL");
1553 return kFALSE;
1554 }
1555
1556 AliMpDEIterator deIt;
1557
1558 deIt.First();
1559
49e110ec 1560 AliMpDCSNamer triggerDcsNamer("TRIGGER");
1561
1562 TH2* currHisto = 0x0;
719914e0 1563 Int_t histoIndex = 0;
1564 TString histoName, histoTitle;
49e110ec 1565
1566 Bool_t error = kFALSE;
719914e0 1567 Bool_t expert = kTRUE;
1568 Bool_t saveCorr = kTRUE;
1569 Bool_t image = kTRUE;
49e110ec 1570
1571 while ( !deIt.IsDone() )
1572 {
1573 Int_t detElemId = deIt.CurrentDEId();
1574
1575 if ( AliMpDEManager::GetStationType(detElemId) == AliMp::kStationTrigger) {
1576
1577 Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);
1578 Int_t slat = detElemId%100;
1579
1580 for(Int_t iMeas=0; iMeas<AliMpDCSNamer::kNDCSMeas; iMeas++){
1581 TString currAlias = triggerDcsNamer.DCSChannelName(detElemId, 0, iMeas);
1582
5379c4a3 1583 AliDebug(AliQAv1::GetQADebugLevel(), Form("\nDetElemId %i dcsAlias %s", detElemId, currAlias.Data()));
49e110ec 1584
1585 TPair* triggerDcsPair = static_cast<TPair*>(triggerDcsMap->FindObject(currAlias.Data()));
1586
1587 if (!triggerDcsPair)
1588 {
1589 AliError(Form("Did not find expected alias (%s) for DE %d",
1590 currAlias.Data(),detElemId));
1591 error = kTRUE;
1592 }
1593 else
1594 {
1595 TObjArray* values = static_cast<TObjArray*>(triggerDcsPair->Value());
1596 if (!values)
1597 {
1598 AliError(Form("Could not get values for alias %s",currAlias.Data()));
1599 error = kTRUE;
1600 }
1601 else
1602 {
1603 TIter next(values);
719914e0 1604 AliDCSValue* val = 0x0;
1605
1606 Int_t ich = iChamber - AliMpConstants::NofTrackingChambers();
1607
1608 switch(iMeas){
1609 case AliMpDCSNamer::kDCSI:
1610 histoIndex = kTriggerRPCi + ich;
1611 histoName = Form("hRPCIChamber%i", 11+ich);
1612 histoTitle = Form("Chamber %i: RPC Currents (#muA)", 11+ich);
1613 break;
1614 case AliMpDCSNamer::kDCSHV:
1615 histoIndex = kTriggerRPChv + ich;
1616 histoName = Form("hRPCHVChamber%i", 11+ich);
1617 histoTitle = Form("Chamber %i: RPC HV (V)", 11+ich);
1618 break;
1619 }
1620
1621 currHisto = (TH2F*) GetRawsData(histoIndex);
1622
1623 if(!currHisto){
1624 Int_t npoints = values->GetEntries();
1625 TArrayF axisSlat(18+1), axisTime(npoints+1);
1626 for(Int_t islat=0; islat<=18; islat++){
1627 axisSlat[islat] = -0.5 + (Float_t)islat;
1628 }
1629 for(Int_t ientry=0; ientry<npoints; ientry++){
1630 val = static_cast<AliDCSValue*>(values->At(ientry));
1631 axisTime[ientry] = val->GetTimeStamp();
1632 }
1633 axisTime[npoints] = val->GetTimeStamp() + 100;
1634
1635 currHisto = new TH2F(histoName.Data(), histoTitle.Data(),
1636 npoints, axisTime.GetArray(),
1637 18, axisSlat.GetArray());
1638 currHisto->GetXaxis()->SetTitle("Time");
1639 currHisto->GetXaxis()->SetTimeDisplay(1);
1640 //currHisto->GetXaxis()->SetTimeFormat("%d%b%y %H:%M:%S");
1641 currHisto->GetYaxis()->SetTitle("RPC");
1642 Add2RawsList(currHisto, histoIndex, !expert, image, !saveCorr);
1643 }
49e110ec 1644
1645 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
1646 {
1647 Float_t hvi = val->GetFloat();
1648
5379c4a3 1649 AliDebug(AliQAv1::GetQADebugLevel(), Form("Value %f", hvi));
719914e0 1650
1651 currHisto->Fill(1.0001 * val->GetTimeStamp(), slat, hvi);
49e110ec 1652 } // loop on values
1653 } // if (!values)
1654 } // if (!triggerDcsPair)
1655 } // loop on measured types (HV and currents)
1656 } // if (stationType == kStationTrigger)
1657
1658 deIt.Next();
1659 }
1660 return error;
2346e1ad 1661}
de1d4a53 1662
1663//____________________________________________________________________________
1664AliMUONVTrackerData* AliMUONQADataMakerRec::GetTrackerData() const
1665{
cddcc1f3 1666/// Return tracker data
de1d4a53 1667
1668 return fTrackerDataMaker->Data();
1669
1670}
8f29b706 1671
1672//____________________________________________________________________________
1673void
1674AliMUONQADataMakerRec::BeautifyTrackerBusPatchOccupancy(TH1& hbp)
1675{
1676 /// Put labels, limits and so on on the TrackerBusPatchOccupancy histogram
1677
1678 hbp.SetXTitle("Absolute Bus Patch Id");
1679 hbp.SetYTitle("Occupancy (percent)");
1680 hbp.SetStats(kFALSE);
1681
1682 Double_t xmin = hbp.GetXaxis()->GetXmin();
1683 Double_t xmax = hbp.GetXaxis()->GetXmax();
1684
1685 Double_t occMax(0.1); // 0.1% y-limit for the plot
1686 Double_t occError(1.0); // 1.0% y-limit to count the "errors"
1687
1688 TLine* line = new TLine(xmin,occError,xmax,occError);
1689 line->SetLineColor(2);
1690 line->SetLineWidth(3);
1691
1692 hbp.GetListOfFunctions()->Add(line);
1693
1694 TH1* hnpads = GetRawsData(kTrackerBusPatchNofPads);
1695 hnpads->SetStats(kFALSE);
1696 TH1* hnmanus = GetRawsData(kTrackerBusPatchNofManus);
1697 hnmanus->SetStats(kFALSE);
1698
1699 TIter next(AliMpDDLStore::Instance()->CreateBusPatchIterator());
1700 AliMpBusPatch* bp(0x0);
1701 while ( ( bp = static_cast<AliMpBusPatch*>(next())) )
1702 {
1703 Int_t n(0);
1704 for ( Int_t imanu = 0; imanu < bp->GetNofManus(); ++imanu )
1705 {
1706 Int_t manuId = bp->GetManuId(imanu);
1707 AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(bp->GetDEId());
1708 n += de->NofChannelsInManu(manuId);
1709 }
1710 hnpads->Fill(bp->GetId(),n*1.0);
1711 hnmanus->Fill(bp->GetId(),bp->GetNofManus()*1.0);
1712 }
1713
1714 next.Reset();
1715
1716 Int_t nMissingPads(0);
1717 Int_t nPads(0);
1718 Int_t nBusPatches(0);
1719 Int_t nMissingBusPatches(0);
1720
1721 while ( ( bp = static_cast<AliMpBusPatch*>(next())) )
1722 {
1723 Int_t bin = hbp.FindBin(bp->GetId());
1724 Int_t n = hnpads->GetBinContent(bin);
1725
1726 ++nBusPatches;
1727
1728 nPads += n;
1729
1730 if ( hbp.GetBinContent(bin) <= 0 )
1731 {
1732 nMissingPads += n;
1733 ++nMissingBusPatches;
1734 }
1735 }
1736
1737 next.Reset();
1738
b9bd355c 1739 Int_t ok(-1);
8f29b706 1740 Int_t n(0);
1741 Int_t nBusPatchesAboveLimit(0);
b9bd355c 1742 Double_t alpha(0.1); // trim 10% of data
1743 Double_t tmean(0.0),tvar(0.0);
1744 Double_t ymin(0.0),ymax(0.0);
8f29b706 1745
b9bd355c 1746
1747 if ( nBusPatches )
8f29b706 1748 {
b9bd355c 1749 Double_t* x = new Double_t[nBusPatches];
1750
1751 while ( ( bp = static_cast<AliMpBusPatch*>(next())) )
8f29b706 1752 {
b9bd355c 1753 Int_t bin = hbp.FindBin(bp->GetId());
1754 if ( hbp.GetBinContent(bin) > 0 )
1755 {
1756 x[n] = hbp.GetBinContent(bin);
1757 ++n;
1758 }
1759 if ( hbp.GetBinContent(bin) > occError )
1760 {
1761 ++nBusPatchesAboveLimit;
1762 }
8f29b706 1763 }
8f29b706 1764
b9bd355c 1765 // computed the truncated mean of the occupancy values, in order to get a
1766 // reasonable y-range for the histogram (without giant peaks to the roof
1767 // for misbehaving buspatches).
f17dd500 1768 ok = trim(n,x,alpha,tmean,tvar,ymin,ymax);
b9bd355c 1769
1770 delete[] x;
1771 }
8f29b706 1772
1773 if ( ok < 0 )
1774 {
1775 ymax = occMax;
1776 }
1777 else
1778 {
1779 ymax = TMath::Max(ymax,occMax);
1780 }
1781
1782 hbp.SetMaximum(ymax*1.4);
1783
1784 TPaveText* text = new TPaveText(0.55,0.85,0.99,0.99,"NDC");
1785
1786 if (ok < 0 )
1787 {
1788 text->AddText("Could not compute truncated mean. Not enough events ?");
1789 text->SetFillColor(2);
1790 }
1791 else if (!nPads || !nBusPatches)
1792 {
1793 text->AddText("Could not get the total number of pads. ERROR !!!");
1794 text->SetFillColor(2);
1795 }
1796 else
1797 {
1798 Float_t missingPadFraction = nMissingPads*100.0/nPads;
1799 Float_t missingBusPatchFraction = nMissingBusPatches*100.0/nBusPatches;
1800 Float_t aboveLimitFraction = nBusPatchesAboveLimit*100.0/nBusPatches;
1801
1802 text->AddText(Form("%5.2f %% of missing buspatches (%d out of %d)",missingBusPatchFraction,nMissingBusPatches,nBusPatches));
1803 text->AddText(Form("%5.2f %% of missing pads (%d out of %d)",missingPadFraction,nMissingPads,nPads));
1804 text->AddText(Form("%5.2f %% bus patches above the %5.2f %% limit",aboveLimitFraction,occError));
1805 text->AddText(Form("Truncated mean at %2d %% is %7.2f %%",(Int_t)(alpha*100),tmean));
1806
1807 if ( missingPadFraction > 10.0 || aboveLimitFraction > 5.0 )
1808 {
1809 text->SetFillColor(2);
1810 }
1811 else
1812 {
1813 text->SetFillColor(3);
1814 }
1815 }
1816
1817 hbp.GetListOfFunctions()->Add(text);
1818}
1819
b9bd355c 1820
1821