libANALYSIS must now be before libSTEER ... ?
[u/mrichter/AliRoot.git] / MUON / AliMUONTrackerQADataMakerRec.cxx
CommitLineData
b3d57767 1 /**************************************************************************
ece56eb9 2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16// $Id: AliMUONTrackerQADataMakerRec.cxx 35760 2009-10-21 21:45:42Z ivana $
17
18// --- MUON header files ---
19#include "AliMUONTrackerQADataMakerRec.h"
20
b3d57767 21#include "AliCDBManager.h"
22#include "AliCodeTimer.h"
b71c3d2d 23#include "AliDAQ.h"
b3d57767 24#include "AliESDEvent.h"
25#include "AliESDMuonTrack.h"
26#include "AliLog.h"
27#include "AliMUON2DMap.h"
28#include "AliMUONCalibParamND.h"
29#include "AliMUONCalibrationData.h"
ece56eb9 30#include "AliMUONConstants.h"
31#include "AliMUONDigitMaker.h"
b3d57767 32#include "AliMUONESDInterface.h"
33#include "AliMUONLogger.h"
34#include "AliMUONQADataMakerRec.h"
6482f70b 35#include "AliMUONQAIndices.h"
ece56eb9 36#include "AliMUONQAMappingCheck.h"
b3d57767 37#include "AliMUONTrack.h"
38#include "AliMUONTrackParam.h"
39#include "AliMUONTrackerData.h"
ece56eb9 40#include "AliMUONTrackerDataMaker.h"
41#include "AliMUONVCluster.h"
42#include "AliMUONVClusterStore.h"
43#include "AliMUONVDigit.h"
b3d57767 44#include "AliMUONVDigit.h"
ece56eb9 45#include "AliMUONVDigitStore.h"
ece56eb9 46#include "AliMpBusPatch.h"
47#include "AliMpConstants.h"
b3d57767 48#include "AliMpDDL.h"
ece56eb9 49#include "AliMpDDLStore.h"
50#include "AliMpDEIterator.h"
51#include "AliMpDEManager.h"
52#include "AliMpDetElement.h"
b3d57767 53#include "AliMpManuIterator.h"
54#include "AliQAv1.h"
ece56eb9 55#include "AliRawReader.h"
9074a9a9 56#include "AliRawEventHeaderBase.h"
b3d57767 57#include <Riostream.h>
ece56eb9 58#include <TH1F.h>
59#include <TH1I.h>
60#include <TH2F.h>
ece56eb9 61#include <TMath.h>
b3d57767 62#include <TObjArray.h>
64c2397e 63#include <TPaveText.h>
ece56eb9 64
65//-----------------------------------------------------------------------------
66/// \class AliMUONTrackerQADataMakerRec
67///
b3d57767 68/// Quality assurance data (histo) maker for MUON tracker
69///
70///
71/// Note that all the methods of this class shoud not be called when eventSpecie is AliRecoParam::kCalib !
ece56eb9 72///
73/// \author C. Finck, D. Stocco, L. Aphecetche
74
75/// \cond CLASSIMP
76ClassImp(AliMUONTrackerQADataMakerRec)
77/// \endcond
78
680e610f 79namespace
80{
81 Double_t ProtectedSqrt(Double_t x)
82 {
83 return ( x > 0.0 ? TMath::Sqrt(x) : 0.0 );
84 }
b3d57767 85
680e610f 86}
b3d57767 87
ece56eb9 88//____________________________________________________________________________
89AliMUONTrackerQADataMakerRec::AliMUONTrackerQADataMakerRec(AliQADataMakerRec* master) :
90AliMUONVQADataMakerRec(master),
b3d57767 91fDigitStore(0x0),
ece56eb9 92fDigitMaker(new AliMUONDigitMaker(kTRUE)),
93fClusterStore(0x0),
64c2397e 94fCalibrationData(new AliMUONCalibrationData(AliCDBManager::Instance()->GetRun())),
b3d57767 95fLogger(0x0),
96fBusPatchConfig(0x0),
97fBPxmin(0),
98fBPxmax(0),
99fBPnbins(0),
100fTrackerDataMakerArray(0x0),
101fTrackerCalDataArray(0x0),
102fTrackerRecDataArray(0x0),
103fMappingCheckRecPointsArray(0x0)
ece56eb9 104{
105 /// ctor
106}
107
108//__________________________________________________________________
109AliMUONTrackerQADataMakerRec::~AliMUONTrackerQADataMakerRec()
110{
111 /// dtor
112 delete fDigitStore;
113 delete fDigitMaker;
114 delete fClusterStore;
ece56eb9 115 delete fCalibrationData;
b3d57767 116 delete fMappingCheckRecPointsArray;
64c2397e 117 if (fLogger)
118 {
119 if ( fLogger->NumberOfEntries() != 0 )
120 {
121 AliError("Some unprocessed logged errors are still there... Please check");
122 }
123 delete fLogger;
124 }
b3d57767 125 delete fTrackerDataMakerArray;
126 delete fTrackerCalDataArray;
127 delete fTrackerRecDataArray;
128 delete fBusPatchConfig;
ece56eb9 129}
130
131//____________________________________________________________________________
b3d57767 132void AliMUONTrackerQADataMakerRec::InsertTrackerData(Int_t specie,
133 TObjArray** list,
134 TObject* object,
135 Int_t indexNumber,
ece56eb9 136 Bool_t replace)
137{
138 /// Insert an object to a given list
139
140 TIter next(list[specie]);
141 TObject* o;
142 TObject* old(0x0);
143 Bool_t alreadyThere(kFALSE);
b3d57767 144
ece56eb9 145 while ( ( o = next() ) && !alreadyThere )
146 {
147 TString classname(o->ClassName());
148 if ( classname.Contains("TrackerData") )
149 {
b3d57767 150 if ( !strcmp(object->GetName(),o->GetName()) )
151 {
152 alreadyThere = kTRUE;
153 old = o;
154 }
ece56eb9 155 }
156 }
157 if ( (!alreadyThere && object) || (alreadyThere && replace) )
158 {
159 delete old;
160 AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding %s to the list of qa objects",object->GetName()));
161 TNamed* named = static_cast<TNamed*>(object);
162 named->SetName(Form("%s_%s",AliRecoParam::GetEventSpecieName(specie),object->GetName()));
163 object->SetBit(AliQAv1::GetExpertBit());
164 list[specie]->AddAt(object,indexNumber);
165 }
166}
167
168//____________________________________________________________________________
169void AliMUONTrackerQADataMakerRec::EndOfDetectorCycleESDs(Int_t, TObjArray**)
170{
171 /// Normalize ESD histograms
92664bc8 172 //
173 Bool_t firstFill = kTRUE;
174 //
175 for (int itc=-1;itc<Master()->GetNTrigClasses();itc++) { // RS: loop over eventual clones per trigger class
176 //
177 TH1* hESDnClustersPerTr = Master()->GetESDsData(AliMUONQAIndices::kESDnClustersPerTrack, itc);
178 if (! hESDnClustersPerTr) continue;
179 Double_t nTracks = hESDnClustersPerTr->GetEntries();
180 if (nTracks <= 0) continue;
181 //
182 if (firstFill) { AliCodeTimerAuto("",0); firstFill = kFALSE;}
183
184 TH1* hESDnClustersPerCh = Master()->GetESDsData(AliMUONQAIndices::kESDnClustersPerCh,itc);
185 TH1* hESDnClustersPerDE = Master()->GetESDsData(AliMUONQAIndices::kESDnClustersPerDE,itc);
186 TH1* hESDClusterChargePerChMean = Master()->GetESDsData(AliMUONQAIndices::kESDClusterChargePerChMean,itc);
187 TH1* hESDClusterChargePerChSigma = Master()->GetESDsData(AliMUONQAIndices::kESDClusterChargePerChSigma,itc);
188 TH1* hESDClusterSizePerChMean = Master()->GetESDsData(AliMUONQAIndices::kESDClusterSizePerChMean,itc);
189 TH1* hESDClusterSizePerChSigma = Master()->GetESDsData(AliMUONQAIndices::kESDClusterSizePerChSigma,itc);
190 TH1* hESDResidualXPerChMean = Master()->GetESDsData(AliMUONQAIndices::kESDResidualXPerChMean,itc);
191 TH1* hESDResidualXPerChSigma = Master()->GetESDsData(AliMUONQAIndices::kESDResidualXPerChSigma,itc);
192 TH1* hESDResidualYPerChMean = Master()->GetESDsData(AliMUONQAIndices::kESDResidualYPerChMean,itc);
193 TH1* hESDResidualYPerChSigma = Master()->GetESDsData(AliMUONQAIndices::kESDResidualYPerChSigma,itc);
194 TH1* hESDLocalChi2XPerChMean = Master()->GetESDsData(AliMUONQAIndices::kESDLocalChi2XPerChMean,itc);
195 TH1* hESDLocalChi2YPerChMean = Master()->GetESDsData(AliMUONQAIndices::kESDLocalChi2YPerChMean,itc);
196 TH1* hESDLocalChi2PerChMean = Master()->GetESDsData(AliMUONQAIndices::kESDLocalChi2PerChMean,itc);
197 TH1* hESDClusterChargePerDE = Master()->GetESDsData(AliMUONQAIndices::kESDClusterChargePerDE,itc);
198 TH1* hESDClusterSizePerDE = Master()->GetESDsData(AliMUONQAIndices::kESDClusterSizePerDE,itc);
199 TH1* hESDResidualXPerDEMean = Master()->GetESDsData(AliMUONQAIndices::kESDResidualXPerDEMean,itc);
200 TH1* hESDResidualXPerDESigma = Master()->GetESDsData(AliMUONQAIndices::kESDResidualXPerDESigma,itc);
201 TH1* hESDResidualYPerDEMean = Master()->GetESDsData(AliMUONQAIndices::kESDResidualYPerDEMean,itc);
202 TH1* hESDResidualYPerDESigma = Master()->GetESDsData(AliMUONQAIndices::kESDResidualYPerDESigma,itc);
203 TH1* hESDLocalChi2XPerDEMean = Master()->GetESDsData(AliMUONQAIndices::kESDLocalChi2XPerDEMean,itc);
204 TH1* hESDLocalChi2YPerDEMean = Master()->GetESDsData(AliMUONQAIndices::kESDLocalChi2YPerDEMean,itc);
205 TH1* hESDLocalChi2PerDEMean = Master()->GetESDsData(AliMUONQAIndices::kESDLocalChi2PerDEMean,itc);
206 TH1* hESDnTotClustersPerCh = Master()->GetESDsData(AliMUONQAIndices::kESDnTotClustersPerCh,itc);
207 TH1* hESDnTotClustersPerDE = Master()->GetESDsData(AliMUONQAIndices::kESDnTotClustersPerDE,itc);
208 TH1* hESDnTotFullClustersPerDE = Master()->GetESDsData(AliMUONQAIndices::kESDnTotFullClustersPerDE,itc);
209 TH1* hESDSumClusterChargePerDE = Master()->GetESDsData(AliMUONQAIndices::kESDSumClusterChargePerDE,itc);
210 TH1* hESDSumClusterSizePerDE = Master()->GetESDsData(AliMUONQAIndices::kESDSumClusterSizePerDE,itc);
211 TH1* hESDSumResidualXPerDE = Master()->GetESDsData(AliMUONQAIndices::kESDSumResidualXPerDE,itc);
212 TH1* hESDSumResidualYPerDE = Master()->GetESDsData(AliMUONQAIndices::kESDSumResidualYPerDE,itc);
213 TH1* hESDSumResidualX2PerDE = Master()->GetESDsData(AliMUONQAIndices::kESDSumResidualX2PerDE,itc);
214 TH1* hESDSumResidualY2PerDE = Master()->GetESDsData(AliMUONQAIndices::kESDSumResidualY2PerDE,itc);
215 TH1* hESDSumLocalChi2XPerDE = Master()->GetESDsData(AliMUONQAIndices::kESDSumLocalChi2XPerDE,itc);
216 TH1* hESDSumLocalChi2YPerDE = Master()->GetESDsData(AliMUONQAIndices::kESDSumLocalChi2YPerDE,itc);
217 TH1* hESDSumLocalChi2PerDE = Master()->GetESDsData(AliMUONQAIndices::kESDSumLocalChi2PerDE,itc);
218 //
219 if (hESDnClustersPerCh && hESDnTotClustersPerCh) {
220 hESDnClustersPerCh->Reset();
221 hESDnClustersPerCh->Add(hESDnTotClustersPerCh, 1./nTracks);
222 }
223 if (hESDnClustersPerDE && hESDnTotClustersPerDE) {
224 hESDnClustersPerDE->Reset();
225 hESDnClustersPerDE->Add(hESDnTotClustersPerDE, 1./nTracks);
226 }
227 //
228 // loop over chambers
229 for (Int_t iCh = 0; iCh < AliMUONConstants::NTrackingCh(); iCh++) {
230 //
231 double sigmaCharge=0,sigmaSize=0,sigmaResidualX=0,sigmaResidualY=0,sigmaLocalChi2X=0,sigmaLocalChi2Y=0,sigmaLocalChi2=0;
232 //
233 TH1* hESDClusterChargeInCh = Master()->GetESDsData(AliMUONQAIndices::kESDClusterChargeInCh+iCh,itc);
234 if (hESDClusterChargeInCh) {
235 sigmaCharge = hESDClusterChargeInCh->GetRMS();
236 if (hESDClusterChargePerChMean) {
237 hESDClusterChargePerChMean->SetBinContent(iCh+1, hESDClusterChargeInCh->GetMean());
238 hESDClusterChargePerChMean->SetBinError(iCh+1, hESDClusterChargeInCh->GetMeanError());
239 }
240 if (hESDClusterChargePerChSigma) {
241 hESDClusterChargePerChSigma->SetBinContent(iCh+1, sigmaCharge);
242 hESDClusterChargePerChSigma->SetBinError(iCh+1, hESDClusterChargeInCh->GetRMSError());
243 }
ece56eb9 244 }
92664bc8 245 //
246 TH1* hESDClusterSizeInCh = Master()->GetESDsData(AliMUONQAIndices::kESDClusterSizeInCh+iCh,itc);
247 if (hESDClusterSizeInCh) {
248 sigmaSize = hESDClusterSizeInCh->GetRMS();
249 if (hESDClusterSizePerChMean) {
250 hESDClusterSizePerChMean->SetBinContent(iCh+1, hESDClusterSizeInCh->GetMean());
251 hESDClusterSizePerChMean->SetBinError(iCh+1, hESDClusterSizeInCh->GetMeanError());
252 }
253 if (hESDClusterSizePerChSigma) {
254 hESDClusterSizePerChSigma->SetBinContent(iCh+1, sigmaSize);
255 hESDClusterSizePerChSigma->SetBinError(iCh+1, hESDClusterSizeInCh->GetRMSError());
256 }
257 }
258 //
259 TH1* hESDResidualXInCh = Master()->GetESDsData(AliMUONQAIndices::kESDResidualXInCh+iCh,itc);
260 if (hESDResidualXInCh) {
261 sigmaResidualX = hESDResidualXInCh->GetRMS();
262 if (hESDResidualXPerChMean) {
263 hESDResidualXPerChMean->SetBinContent(iCh+1, hESDResidualXInCh->GetMean());
264 hESDResidualXPerChMean->SetBinError(iCh+1, hESDResidualXInCh->GetMeanError());
265 }
266 if (hESDResidualXPerChSigma) {
267 hESDResidualXPerChSigma->SetBinContent(iCh+1, sigmaResidualX);
268 hESDResidualXPerChSigma->SetBinError(iCh+1, hESDResidualXInCh->GetRMSError());
269 }
270 }
271 //
272 TH1* hESDResidualYInCh = Master()->GetESDsData(AliMUONQAIndices::kESDResidualYInCh+iCh,itc);
273 if (hESDResidualYInCh) {
274 sigmaResidualY = hESDResidualYInCh->GetRMS();
275 if (hESDResidualYPerChMean) {
276 hESDResidualYPerChMean->SetBinContent(iCh+1, hESDResidualYInCh->GetMean());
277 hESDResidualYPerChMean->SetBinError(iCh+1, hESDResidualYInCh->GetMeanError());
278 }
279 if (hESDResidualYPerChSigma) {
280 hESDResidualYPerChSigma->SetBinContent(iCh+1, sigmaResidualY);
281 hESDResidualYPerChSigma->SetBinError(iCh+1, hESDResidualYInCh->GetRMSError());
282 }
ece56eb9 283 }
92664bc8 284 //
285 TH1* hESDLocalChi2XInCh = Master()->GetESDsData(AliMUONQAIndices::kESDLocalChi2XInCh+iCh,itc);
286 if (hESDLocalChi2XInCh) {
287 sigmaLocalChi2X = hESDLocalChi2XInCh->GetRMS();
288 if (hESDLocalChi2XPerChMean) {
289 hESDLocalChi2XPerChMean->SetBinContent(iCh+1, hESDLocalChi2XInCh->GetMean());
290 hESDLocalChi2XPerChMean->SetBinError(iCh+1, hESDLocalChi2XInCh->GetMeanError());
291 }
292 }
293 //
294 TH1* hESDLocalChi2YInCh = Master()->GetESDsData(AliMUONQAIndices::kESDLocalChi2YInCh+iCh,itc);
295 if (hESDLocalChi2YInCh) {
296 sigmaLocalChi2Y = hESDLocalChi2YInCh->GetRMS();
297 if (hESDLocalChi2YPerChMean) {
298 hESDLocalChi2YPerChMean->SetBinContent(iCh+1, hESDLocalChi2YInCh->GetMean());
299 hESDLocalChi2YPerChMean->SetBinError(iCh+1, hESDLocalChi2YInCh->GetMeanError());
300 }
301 }
302 //
303 TH1* hESDLocalChi2InCh = Master()->GetESDsData(AliMUONQAIndices::kESDLocalChi2InCh+iCh,itc);
304 if (hESDLocalChi2InCh) {
305 sigmaLocalChi2 = hESDLocalChi2InCh->GetRMS();
306 if (hESDLocalChi2PerChMean) {
307 hESDLocalChi2PerChMean->SetBinContent(iCh+1, hESDLocalChi2InCh->GetMean());
308 hESDLocalChi2PerChMean->SetBinError(iCh+1, hESDLocalChi2InCh->GetMeanError());
309 }
310 }
311 //
312 // loop over DE into chamber iCh
313 AliMpDEIterator it;
314 it.First(iCh);
315 while ( !it.IsDone()) {
316
317 Int_t iDE = it.CurrentDEId();
318
319 Double_t nClusters = hESDnTotClustersPerDE ? hESDnTotClustersPerDE->GetBinContent(iDE+1) : 0;
320 if (nClusters > 1) {
321
322 if (hESDClusterChargePerDE && hESDSumClusterChargePerDE) {
323 hESDClusterChargePerDE->SetBinContent(iDE+1, hESDSumClusterChargePerDE->GetBinContent(iDE+1)/nClusters);
324 hESDClusterChargePerDE->SetBinError(iDE+1, sigmaCharge/TMath::Sqrt(nClusters));
325 }
326
327 if (hESDResidualXPerDEMean && hESDResidualXPerDESigma && hESDSumResidualXPerDE) {
328 Double_t meanResX = hESDSumResidualXPerDE->GetBinContent(iDE+1)/nClusters;
329 hESDResidualXPerDEMean->SetBinContent(iDE+1, meanResX);
330 hESDResidualXPerDEMean->SetBinError(iDE+1, sigmaResidualX/TMath::Sqrt(nClusters));
331 //
332 hESDResidualXPerDESigma->SetBinContent(iDE+1, ProtectedSqrt(hESDSumResidualX2PerDE->GetBinContent(iDE+1)/nClusters - meanResX*meanResX));
333 hESDResidualXPerDESigma->SetBinError(iDE+1, sigmaResidualX/TMath::Sqrt(2.*nClusters));
334 }
335 //
336 if (hESDResidualYPerDEMean && hESDResidualYPerDESigma && hESDSumResidualYPerDE) {
337 Double_t meanResY = hESDSumResidualYPerDE->GetBinContent(iDE+1)/nClusters;
338 hESDResidualYPerDEMean->SetBinContent(iDE+1, meanResY);
339 hESDResidualYPerDEMean->SetBinError(iDE+1, sigmaResidualY/TMath::Sqrt(nClusters));
340 hESDResidualYPerDESigma->SetBinContent(iDE+1, ProtectedSqrt(hESDSumResidualY2PerDE->GetBinContent(iDE+1)/nClusters - meanResY*meanResY));
341 hESDResidualYPerDESigma->SetBinError(iDE+1, sigmaResidualY/TMath::Sqrt(2.*nClusters));
342 }
343 //
344 if (hESDLocalChi2XPerDEMean && hESDSumLocalChi2XPerDE) {
345 hESDLocalChi2XPerDEMean->SetBinContent(iDE+1, hESDSumLocalChi2XPerDE->GetBinContent(iDE+1)/nClusters);
346 hESDLocalChi2XPerDEMean->SetBinError(iDE+1, sigmaLocalChi2X/TMath::Sqrt(nClusters));
347 }
348 //
349 if (hESDLocalChi2YPerDEMean && hESDSumLocalChi2YPerDE) {
350 hESDLocalChi2YPerDEMean->SetBinContent(iDE+1, hESDSumLocalChi2YPerDE->GetBinContent(iDE+1)/nClusters);
351 hESDLocalChi2YPerDEMean->SetBinError(iDE+1, sigmaLocalChi2Y/TMath::Sqrt(nClusters));
352 }
353 //
354 if (hESDLocalChi2PerDEMean && hESDSumLocalChi2PerDE) {
355 hESDLocalChi2PerDEMean->SetBinContent(iDE+1, hESDSumLocalChi2PerDE->GetBinContent(iDE+1)/nClusters);
356 hESDLocalChi2PerDEMean->SetBinError(iDE+1, sigmaLocalChi2/TMath::Sqrt(nClusters));
357 }
358 }
359 else {
f00a510a 360 if (hESDClusterChargePerDE && hESDClusterChargeInCh && hESDSumClusterChargePerDE) {
92664bc8 361 hESDClusterChargePerDE->SetBinContent(iDE+1, hESDSumClusterChargePerDE->GetBinContent(iDE+1));
362 hESDClusterChargePerDE->SetBinError(iDE+1, hESDClusterChargeInCh->GetXaxis()->GetXmax());
363 }
364 //
365 if (hESDResidualXPerDEMean && hESDResidualXPerDESigma && hESDSumResidualXPerDE && hESDResidualXInCh) {
366 hESDResidualXPerDEMean->SetBinContent(iDE+1, hESDSumResidualXPerDE->GetBinContent(iDE+1));
367 hESDResidualXPerDEMean->SetBinError(iDE+1, hESDResidualXInCh->GetXaxis()->GetXmax());
368 hESDResidualXPerDESigma->SetBinContent(iDE+1, 0.);
369 hESDResidualXPerDESigma->SetBinError(iDE+1, hESDResidualXInCh->GetXaxis()->GetXmax());
370 }
371 //
372 if (hESDResidualYPerDEMean && hESDResidualYPerDESigma && hESDSumResidualYPerDE && hESDResidualYInCh) {
373 hESDResidualYPerDEMean->SetBinContent(iDE+1, hESDSumResidualYPerDE->GetBinContent(iDE+1));
374 hESDResidualYPerDEMean->SetBinError(iDE+1, hESDResidualYInCh->GetXaxis()->GetXmax());
375 hESDResidualYPerDESigma->SetBinContent(iDE+1, 0.);
376 hESDResidualYPerDESigma->SetBinError(iDE+1, hESDResidualYInCh->GetXaxis()->GetXmax());
377 }
378 //
379 if (hESDLocalChi2XPerDEMean && hESDSumLocalChi2XPerDE && hESDLocalChi2XInCh) {
380 hESDLocalChi2XPerDEMean->SetBinContent(iDE+1, hESDSumLocalChi2XPerDE->GetBinContent(iDE+1));
381 hESDLocalChi2XPerDEMean->SetBinError(iDE+1, hESDLocalChi2XInCh->GetXaxis()->GetXmax());
382 }
383 //
384 if (hESDLocalChi2YPerDEMean && hESDSumLocalChi2YPerDE && hESDLocalChi2YInCh) {
385 hESDLocalChi2YPerDEMean->SetBinContent(iDE+1, hESDSumLocalChi2YPerDE->GetBinContent(iDE+1));
386 hESDLocalChi2YPerDEMean->SetBinError(iDE+1, hESDLocalChi2YInCh->GetXaxis()->GetXmax());
387 }
388 //
389 if (hESDLocalChi2PerDEMean && hESDSumLocalChi2PerDE && hESDLocalChi2InCh) {
390 hESDLocalChi2PerDEMean->SetBinContent(iDE+1, hESDSumLocalChi2PerDE->GetBinContent(iDE+1));
391 hESDLocalChi2PerDEMean->SetBinError(iDE+1, hESDLocalChi2InCh->GetXaxis()->GetXmax());
392 }
393 }
ece56eb9 394
92664bc8 395 Double_t nFullClusters = hESDnTotFullClustersPerDE ? hESDnTotFullClustersPerDE->GetBinContent(iDE+1) : 0;
396 if (nFullClusters > 1) {
397 if (hESDClusterSizePerDE && hESDSumClusterSizePerDE) {
398 hESDClusterSizePerDE->SetBinContent(iDE+1, hESDSumClusterSizePerDE->GetBinContent(iDE+1)/nFullClusters);
399 hESDClusterSizePerDE->SetBinError(iDE+1, sigmaSize/TMath::Sqrt(nFullClusters));
400 }
401 }
402 else {
403 if (hESDClusterSizePerDE && hESDSumClusterSizePerDE) {
404 hESDClusterSizePerDE->SetBinContent(iDE+1, hESDSumClusterSizePerDE->GetBinContent(iDE+1));
405 hESDClusterSizePerDE->SetBinError(iDE+1, hESDClusterSizeInCh->GetXaxis()->GetXmax());
406 }
407 }
408
409 it.Next();
410 } // while
411
412 } // iCh loop
ece56eb9 413
92664bc8 414 } // trigger classes loop
ece56eb9 415
416}
417
418//____________________________________________________________________________
419void AliMUONTrackerQADataMakerRec::EndOfDetectorCycleRecPoints(Int_t specie, TObjArray** list)
420{
421 /// Normalize RecPoints histograms
92664bc8 422 //
423 Bool_t firstFill=kTRUE, needIns0=kTRUE, needIns1=kTRUE;
424 //
425 for (int itc=-1;itc<Master()->GetNTrigClasses();itc++) { // RS: loop over eventual clones per trigger class
426
427 TH1* hTrackerClusterChargePerChMean = GetRecPointsData(AliMUONQAIndices::kTrackerClusterChargePerChMean,itc);
428 if (!hTrackerClusterChargePerChMean) continue;
429 //
430 if (firstFill) { AliCodeTimerAuto("",0); firstFill = kFALSE;}
431
432 TH1* hTrackerClusterChargePerChSigma = GetRecPointsData(AliMUONQAIndices::kTrackerClusterChargePerChSigma,itc);
433 TH1* hTrackerClusterMultiplicityPerChMean = GetRecPointsData(AliMUONQAIndices::kTrackerClusterMultiplicityPerChMean,itc);
434 TH1* hTrackerClusterMultiplicityPerChSigma = GetRecPointsData(AliMUONQAIndices::kTrackerClusterMultiplicityPerChSigma,itc);
435 TH1* hTrackerClusterChargePerDEMean = GetRecPointsData(AliMUONQAIndices::kTrackerClusterChargePerDEMean,itc);
436 TH1* hTrackerClusterMultiplicityPerDEMean = GetRecPointsData(AliMUONQAIndices::kTrackerClusterMultiplicityPerDEMean,itc);
437
438 // loop over chambers
439 for (Int_t iCh = 0; iCh < AliMUONConstants::NTrackingCh(); iCh++) {
ece56eb9 440
92664bc8 441 TH1* hTrackerClusterChargePerChamber = GetRecPointsData(AliMUONQAIndices::kTrackerClusterChargePerChamber+iCh,itc);
442 Double_t sigmaCharge = 0;
443 if (hTrackerClusterChargePerChamber) {
444 sigmaCharge = hTrackerClusterChargePerChamber->GetRMS();
445 hTrackerClusterChargePerChMean->SetBinContent(iCh+1, hTrackerClusterChargePerChamber->GetMean());
446 hTrackerClusterChargePerChMean->SetBinError(iCh+1, hTrackerClusterChargePerChamber->GetMeanError());
447 //
448 if (hTrackerClusterChargePerChSigma) {
449 hTrackerClusterChargePerChSigma->SetBinContent(iCh+1, sigmaCharge);
450 hTrackerClusterChargePerChSigma->SetBinError(iCh+1, hTrackerClusterChargePerChamber->GetRMSError());
451 }
452 }
453 //
454 TH1* hTrackerClusterMultiplicityPerChamber = GetRecPointsData(AliMUONQAIndices::kTrackerClusterMultiplicityPerChamber+iCh,itc);
455 Double_t sigmaSize = 0;
456 if (hTrackerClusterMultiplicityPerChamber) {
457 sigmaSize = hTrackerClusterMultiplicityPerChamber->GetRMS();
458 if (hTrackerClusterMultiplicityPerChMean) {
459 hTrackerClusterMultiplicityPerChMean->SetBinContent(iCh+1, hTrackerClusterMultiplicityPerChamber->GetMean());
460 hTrackerClusterMultiplicityPerChMean->SetBinError(iCh+1, hTrackerClusterMultiplicityPerChamber->GetMeanError());
461 }
462 if (hTrackerClusterMultiplicityPerChSigma) {
463 hTrackerClusterMultiplicityPerChSigma->SetBinContent(iCh+1, sigmaSize);
464 hTrackerClusterMultiplicityPerChSigma->SetBinError(iCh+1, hTrackerClusterMultiplicityPerChamber->GetRMSError());
465 }
466 }
467 //
468 // loop over DE into chamber iCh
469 AliMpDEIterator it;
470 it.First(iCh);
471 while ( !it.IsDone()) {
ece56eb9 472
92664bc8 473 Int_t iDE = it.CurrentDEId();
ece56eb9 474
92664bc8 475 TH1* hTrackerClusterChargePerDE = GetRecPointsData(AliMUONQAIndices::kTrackerClusterChargePerDE+iDE,itc);
476 if (hTrackerClusterChargePerDEMean && hTrackerClusterChargePerDE) {
477 hTrackerClusterChargePerDEMean->SetBinContent(iDE+1, hTrackerClusterChargePerDE->GetMean());
478 Double_t nClusters = hTrackerClusterChargePerDE->GetEntries();
479 if (nClusters > 1) hTrackerClusterChargePerDEMean->SetBinError(iDE+1, sigmaCharge/TMath::Sqrt(nClusters));
480 else hTrackerClusterChargePerDEMean->SetBinError(iDE+1, hTrackerClusterChargePerChamber ?
481 hTrackerClusterChargePerChamber->GetXaxis()->GetXmax() : 0);
482 }
483 TH1* hTrackerClusterMultiplicityPerDE = GetRecPointsData(AliMUONQAIndices::kTrackerClusterMultiplicityPerDE+iDE,itc);
484 if (hTrackerClusterMultiplicityPerDEMean && hTrackerClusterMultiplicityPerDE) {
485 hTrackerClusterMultiplicityPerDEMean->SetBinContent(iDE+1, hTrackerClusterMultiplicityPerDE->GetMean());
486 Double_t nClusters = hTrackerClusterMultiplicityPerDE->GetEntries();
487 if (nClusters > 1) hTrackerClusterMultiplicityPerDEMean->SetBinError(iDE+1, sigmaSize/TMath::Sqrt(nClusters));
488 else hTrackerClusterMultiplicityPerDEMean->SetBinError(iDE+1, hTrackerClusterMultiplicityPerChamber ?
489 hTrackerClusterMultiplicityPerChamber->GetXaxis()->GetXmax() : 0);
490 }
491 it.Next();
492 }
ece56eb9 493 }
ece56eb9 494
92664bc8 495 if (needIns0 && MappingCheckRecPoints(specie) ) { // RS: I guess this should not be in the itc loop, do this only once
496 InsertTrackerData(specie,list,MappingCheckRecPoints(specie)->CreateData("RecPoints"),AliMUONQAIndices::kTrackerRecPoints,kTRUE);
497 needIns0 = kFALSE;
498 }
b3d57767 499
92664bc8 500 if ( TrackerRecData(specie) ) {
501 /// put the trackerdata in the pipeline
502 if (needIns1) { // RS: I guess this should not be in the itc loop, do this only once
503 InsertTrackerData(specie,list,TrackerRecData(specie),AliMUONQAIndices::kTrackerData);
504 needIns1 = kFALSE;
505 }
506 TH1* hbp = GetRecPointsData(AliMUONQAIndices::kTrackerBusPatchOccupancy,itc);
507 TH1* hnevents = GetRecPointsData(AliMUONQAIndices::kTrackerNofGoodPhysicsEventsUsed,itc);
508 TH1* hddl = GetRecPointsData(AliMUONQAIndices::kTrackerDDLOccupancy,itc);
509 TH1* hddlevents = GetRecPointsData(AliMUONQAIndices::kTrackerDDLNofEventsUsed,itc);
b3d57767 510
92664bc8 511 if (itc==-1 && (!hbp || !hnevents || !hddl || !hddlevents)) { //RS: produce error only for trigger-blind class
512 AliError(Form("Missing some histograms : cannot work : hbp=%p hnevents=%p hddl=%p hddlevents=%p",hbp,hnevents,hddl,hddlevents));
513 continue; // return; // RS: the histos might be booked for some trigger class only
514 }
515 //
516 ProjectTrackerData(TrackerRecData(specie),*hbp,*hnevents,*hddl,*hddlevents);
b3d57767 517 }
92664bc8 518 else {
519 AliError(Form("TrackerRecData is null for specie %s",AliRecoParam::GetEventSpecieName(specie)));
520 }
521 } // RS: loop over eventual clones per trigger class
ece56eb9 522}
523
ece56eb9 524//____________________________________________________________________________
b3d57767 525void AliMUONTrackerQADataMakerRec::EndOfDetectorCycleDigits(Int_t specie, TObjArray** list)
ece56eb9 526{
b3d57767 527 /// create digits histograms in digits subdir
ece56eb9 528
b3d57767 529 if ( TrackerCalData(specie) )
ece56eb9 530 {
b3d57767 531 AliCodeTimerAuto("",0);
532
b71c3d2d 533 /// put the trackerdata in the pipeline
b3d57767 534 InsertTrackerData(specie,list,TrackerCalData(specie),AliMUONQAIndices::kTrackerData);
92664bc8 535 //
536 for (int itc=-1;itc<Master()->GetNTrigClasses();itc++) { // RS: loop over eventual clones per trigger class
537 //
538 TH1* hbp = GetDigitsData(AliMUONQAIndices::kTrackerBusPatchOccupancy, itc);
539 TH1* hnevents = GetDigitsData(AliMUONQAIndices::kTrackerNofGoodPhysicsEventsUsed, itc);
540 TH1* hddl = GetDigitsData(AliMUONQAIndices::kTrackerDDLOccupancy, itc);
541 TH1* hddlevents = GetDigitsData(AliMUONQAIndices::kTrackerDDLNofEventsUsed, itc);
b3d57767 542
92664bc8 543 if (itc==-1 && (!hbp || !hnevents || !hddl || !hddlevents) ) { // RS: produce error only for trigger-blind class
544 AliError(Form("Missing some histograms : cannot work : hbp=%p hnevents=%p hddl=%p hddlevents=%p",hbp,hnevents,hddl,hddlevents));
545 continue; //return; // RS
546 }
547 //
548 ProjectTrackerData(TrackerCalData(specie), *hbp,*hnevents,*hddl,*hddlevents);
549 } // RS: loop over eventual clones per trigger class
b3d57767 550 }
551}
552
553//____________________________________________________________________________
554AliMUONQADataMakerRec* AliMUONTrackerQADataMakerRec::Master() const
555{
556 /// Get our master
557 return static_cast<AliMUONQADataMakerRec*>(fMaster);
558}
559
560//____________________________________________________________________________
561void AliMUONTrackerQADataMakerRec::ProjectTrackerData(AliMUONVTrackerData* data,
562 TH1& hbp,
563 TH1& hnevents,
564 TH1& hddl,
565 TH1& hddlevents)
566{
567 /// Project tracker data into shifter-friendly histograms
568
569 AliCodeTimerAuto(Form("%s",data->Name()),0);
570
571 /// project the tracerdata into buspatch occupancies (for the experts)
572 hbp.Reset();
573 hbp.SetStats(kFALSE);
574
575 TIter nextBP(AliMpDDLStore::Instance()->CreateBusPatchIterator());
576 AliMpBusPatch* bp(0x0);
577 Int_t occDim = 2;
578
579 while ( ( bp = static_cast<AliMpBusPatch*>(nextBP())) )
580 {
581 Int_t busPatchId = bp->GetId();
582 Int_t bin = hbp.FindBin(busPatchId);
583 if ( data->HasBusPatch(busPatchId) )
64c2397e 584 {
b3d57767 585 hbp.SetBinContent(bin,data->BusPatch(busPatchId,occDim)*100.0); // occupancy, in percent
64c2397e 586 }
b3d57767 587 }
588
589 /// log the readout errors (for the shifter)
590 hnevents.Reset();
591 hnevents.SetStats(kFALSE);
592 hnevents.SetBinContent(1,data->NumberOfEvents(-1));
593
594 /// project tracker data into DDL occupancies (for the shifter)
595 hddl.Reset();
596 hddl.SetStats(kFALSE);
597 hddlevents.Reset();
598 hddlevents.SetStats(kFALSE);
599
600 const Int_t nddls = AliDAQ::NumberOfDdls("MUONTRK");
601 const Int_t offset = AliDAQ::DdlIDOffset("MUONTRK");
602
603 for ( Int_t iddl = 0; iddl < nddls; ++iddl )
604 {
605 AliMpDDL* ddl = AliMpDDLStore::Instance()->GetDDL(iddl);
606
607 Int_t ddlId = offset + ddl->GetId();
608 Int_t npads = 0;
609
610 Int_t nevents = data->NumberOfEvents(iddl);
b71c3d2d 611
b3d57767 612 hddlevents.Fill(ddlId,nevents);
b71c3d2d 613
b3d57767 614 Double_t occ(0.0);
615
616 if ( nevents > 0 )
b71c3d2d 617 {
b71c3d2d 618 for ( Int_t ide = 0; ide < ddl->GetNofDEs(); ++ide )
619 {
620 Int_t de = ddl->GetDEId(ide);
621
622 npads += TMath::Nint(data->DetectionElement(de,3));
623
624 occ += data->DetectionElement(de,4);
625 }
626
b3d57767 627 if ( npads > 0 )
b71c3d2d 628 {
629 occ = occ/npads/nevents;
630 }
b3d57767 631 else
632 {
633 occ = 0.0;
634 }
b71c3d2d 635 }
b3d57767 636
637 hddl.Fill(ddlId,100.0*occ); // occ in percent
64c2397e 638 }
b3d57767 639
640 TPaveText* text = new TPaveText(0.50,0.8,0.9,0.9,"NDC");
641
642 text->AddText(Form("MCH RUN %d - %d events",AliCDBManager::Instance()->GetRun(),data->NumberOfEvents(-1)));
643
644 hddl.GetListOfFunctions()->Add(text);
64c2397e 645}
646
647//____________________________________________________________________________
b3d57767 648void AliMUONTrackerQADataMakerRec::EndOfDetectorCycleRaws(Int_t specie, TObjArray** list)
649{
650 /// create Raws histograms in Raws subdir
651
652 if ( TrackerDataMaker(specie) && TrackerDataMaker(specie)->Data() )
653 {
654 AliCodeTimerAuto("",0);
655
656 /// put the trackerdata in the pipeline
657 InsertTrackerData(specie,list,TrackerDataMaker(specie)->Data(),AliMUONQAIndices::kTrackerData);
658 TrackerDataMaker(specie)->SetOwnerOfData(kFALSE); // now that it's attached to list, list will take care of the deletion
92664bc8 659 //
660 for (int itc=-1;itc<Master()->GetNTrigClasses();itc++) { // RS: loop over eventual clones per trigger class
661
662 TH1* hbp = GetRawsData(AliMUONQAIndices::kTrackerBusPatchOccupancy, itc);
663 TH1* hnevents = GetRawsData(AliMUONQAIndices::kTrackerNofGoodPhysicsEventsUsed, itc);
664 TH1* hddl = GetRawsData(AliMUONQAIndices::kTrackerDDLOccupancy, itc);
665 TH1* hddlevents = GetRawsData(AliMUONQAIndices::kTrackerDDLNofEventsUsed, itc);
666 //
667 if (!hbp || !hnevents || !hddl || !hddlevents) {
668 if (itc==-1) AliError(Form("Missing some histograms : cannot work : hbp=%p hnevents=%p hddl=%p hddlevents=%p",hbp,hnevents,hddl,hddlevents));
669 continue; // return; // RS
670 }
671 //
672 ProjectTrackerData(TrackerDataMaker(specie)->Data(), *hbp,*hnevents,*hddl,*hddlevents);
673 //
674 FillReadoutStatus(*fLogger,TrackerDataMaker(specie)->Data(), itc);
675 } // RS: loop over eventual clones per trigger class
676 //
b3d57767 677 }
678}
679
680//____________________________________________________________________________
92664bc8 681void AliMUONTrackerQADataMakerRec::FillReadoutStatus(AliMUONLogger& log, AliMUONVTrackerData* data, Int_t trigCl)
64c2397e 682{
92664bc8 683 // RS: I am not sure if this part is valid for looping over trigger classes (loggers are not cloned)
684 if (trigCl!=-1) return; // For the moment only trigCl==-1 will be processed (i.e. trigger-blind histos)
685
64c2397e 686 log.ResetItr();
687
688 TString msg;
689 Int_t occurence;
690
92664bc8 691 TH1* hparity = GetRawsData(AliMUONQAIndices::kTrackerBusPatchParityErrors, trigCl);
64c2397e 692
92664bc8 693 TH1* htoken = GetRawsData(AliMUONQAIndices::kTrackerBusPatchTokenLostErrors, trigCl);
64c2397e 694
92664bc8 695 TH1* hpadding = GetRawsData(AliMUONQAIndices::kTrackerBusPatchPaddingErrors, trigCl);
64c2397e 696
92664bc8 697 TH1* hrostatus = GetRawsData(AliMUONQAIndices::kTrackerReadoutStatus, trigCl);
64c2397e 698
92664bc8 699 TH1* hnevents = GetRawsData(AliMUONQAIndices::kTrackerNofPhysicsEventsSeen, trigCl);
700
701 //
702 if (!hparity || !htoken || !hpadding || !hrostatus || !hnevents) return;
64c2397e 703
704 Int_t nevents = TMath::Nint(hnevents->GetBinContent(1));
705
706 if ( !nevents )
707 {
708 TPaveText* text = new TPaveText(0,0,0.99,0.99,"NDC");
709 text->AddText("FATAL : 0 event seen ? That's NOT normal...");
710 text->SetFillColor(2); // red = FATAL
67a44dc3 711 hrostatus->GetListOfFunctions()->Delete();
b3d57767 712 hrostatus->GetListOfFunctions()->Add(text);
64c2397e 713 return;
714 }
715
b3d57767 716 /////////////////////////////////////////////////////////////////
717 /// Start by counting the number of errors
718 /////////////////////////////////////////////////////////////////
719
64c2397e 720 while ( log.Next(msg,occurence) )
721 {
722 AliDebug(1,Form("msg=%s occurence=%d",msg.Data(),occurence));
723
724 if ( msg.Contains("token") )
725 {
f2e6387f 726 Int_t dsp(-1),iddl(-1),ecode(-1);
64c2397e 727
d7c41dfc 728 sscanf(msg.Data(),"Lost token error detected with address 0x%10X of DDL %10d and code %10d.",
f2e6387f 729 &dsp,&iddl,&ecode);
64c2397e 730 Int_t localBP = ((dsp >> 16)- 4)*5 + 1;
f2e6387f 731 Int_t buspatch = localBP + iddl*100;
732
733 // Let's try to get all the suspected bus patches (i.e. one full FRT, as currently
734 // we don't have more precise information to locate the faulty bus patch(es)).
735
b3d57767 736 AliMpBusPatch* bp = AliMpDDLStore::Instance()->GetBusPatch(buspatch,kFALSE);
737 if (bp)
f2e6387f 738 {
b3d57767 739 Int_t frt = bp->GetFrtId();
740 AliMpDDL* ddl = AliMpDDLStore::Instance()->GetDDL(bp->GetDdlId());
741 Int_t* b = new Int_t[ddl->GetMaxDsp()];
742 ddl->GetBusPerDsp(b);
743 Int_t nbus(0);
744 for ( Int_t i = 0; i < ddl->GetNofFrts() && !nbus; ++i )
f2e6387f 745 {
b3d57767 746 if ( ddl->GetFrtId(i) == frt )
747 {
748 nbus = b[i];
749 }
f2e6387f 750 }
b3d57767 751 if (nbus<=0)
752 {
753 AliError("GOT NBUS<=0 ! THAT IS BAD ! CHECK !");
754 nbus=1;
755 }
756 delete[] b;
f2e6387f 757
b3d57767 758 while (nbus) {
759 htoken->Fill(buspatch+nbus-1,occurence);
760 --nbus;
761 }
f2e6387f 762 }
b3d57767 763 hrostatus->Fill(1.0*AliMUONQAIndices::kTrackerRawNofTokenLostErrors,occurence);
64c2397e 764 }
765
766 if ( msg.Contains("Parity") )
767 {
768 Int_t buspatch;
769 sscanf(msg.Data(),"Parity error in buspatch %d (0x%X).",&buspatch,&buspatch);
770 hparity->Fill(buspatch,occurence);
b3d57767 771 hrostatus->Fill(1.0*AliMUONQAIndices::kTrackerRawNofParityErrors,occurence);
64c2397e 772 }
773
774 if ( msg.Contains("Glitch") )
775 {
b3d57767 776 hrostatus->Fill(1.0*AliMUONQAIndices::kTrackerRawNofGlitchErrors,occurence);
64c2397e 777 }
778
779 if ( msg.Contains("Padding") )
780 {
781 Int_t block, dsp, buspatch;
782 sscanf(msg.Data(),"Padding word error for iBlock %d, iDsp %d, iBus %d.",&block,&dsp,&buspatch);
783 hpadding->Fill(buspatch,occurence);
b3d57767 784 hrostatus->Fill(1.0*AliMUONQAIndices::kTrackerRawNofPaddingErrors,occurence);
785 }
786 }
787
788 /////////////////////////////////////////////////////////////////
789 ///
790 /// Then make the status about number of missing bus patches
791 ///
792 /////////////////////////////////////////////////////////////////
793
794 Int_t nofBusPatchesNotInConfig(0);
795
796 for ( int i = 1; i <= fBusPatchConfig->GetNbinsX(); ++i )
797 {
798 Double_t buspatchId = fBusPatchConfig->GetBinCenter(i);
799 if ( TMath::Nint(buspatchId) != i )
800 {
801 AliError(Form("buspathId=%e i=%d",buspatchId,i));
64c2397e 802 }
b3d57767 803 Double_t content = fBusPatchConfig->GetBinContent(i);
804
805 if ( content <= 0. /* no content */
806 &&
807 AliMpDDLStore::Instance()->GetBusPatch(i,kFALSE) /* but a valid bus patch */ )
808 {
809 ++nofBusPatchesNotInConfig;
810 }
811 }
812
813 Double_t nbuspatches = fBusPatchConfig->GetEntries();
814
9074a9a9 815 Int_t bin = hrostatus->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofMissingBusPatchesFromConfig);
816 hrostatus->SetBinContent(bin,nofBusPatchesNotInConfig*nevents/nbuspatches);
b3d57767 817
818 Double_t nofBusPatchesNotInData(0);
819
820 TIter next(AliMpDDLStore::Instance()->CreateBusPatchIterator());
821 AliMpBusPatch* bp;
822
823 while ( ( bp = static_cast<AliMpBusPatch*>(next()) ) )
824 {
825 if ( !data->HasBusPatch(bp->GetId()) ) ++nofBusPatchesNotInData;
ece56eb9 826 }
64c2397e 827
9074a9a9 828 bin = hrostatus->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofMissingBusPatchesFromDataStream);
829 hrostatus->SetBinContent(bin,nofBusPatchesNotInData*nevents/nbuspatches);
ece56eb9 830}
831
b3d57767 832//____________________________________________________________________________
9074a9a9 833void AliMUONTrackerQADataMakerRec::FillEventSize(AliRawReader* rawReader)
b3d57767 834{
835 /// Fill event size histogram(s)
92664bc8 836 // RS: substituted explicit histo filling by QA framework filling accounting for cloned histos
b3d57767 837
92664bc8 838 FillRawsData(AliMUONQAIndices::kTrackerNofPhysicsEventsSeen,0.0);
b3d57767 839
9074a9a9 840 Int_t offset = AliDAQ::DdlIDOffset("MUONTRK");
841
842 for ( int i = 0; i < AliDAQ::NumberOfDdls("MUONTRK"); ++i )
b3d57767 843 {
9074a9a9 844 rawReader->Reset();
845 rawReader->Select("MUONTRK",i,i);
846 if (rawReader->ReadHeader() )
b3d57767 847 {
9074a9a9 848 UInt_t ddlsize = rawReader->GetEquipmentSize();
92664bc8 849 FillRawsData(AliMUONQAIndices::kTrackerDDLEventSize,i+offset,ddlsize);
850 FillRawsData(AliMUONQAIndices::kTrackerDDLNofEventsSeen,i+offset);
9074a9a9 851 }
852 }
853 rawReader->Reset();
b3d57767 854}
64c2397e 855
ece56eb9 856//____________________________________________________________________________
b3d57767 857void AliMUONTrackerQADataMakerRec::InitCommon()
858{
859 if (!fBusPatchConfig)
860 {
861 Int_t bpmin(999999);
862 Int_t bpmax(0);
863
864 TIter next(AliMpDDLStore::Instance()->CreateBusPatchIterator());
865 AliMpBusPatch* bp(0x0);
866 while ( ( bp = static_cast<AliMpBusPatch*>(next())) )
867 {
868 bpmin = TMath::Min(bpmin,bp->GetId());
869 bpmax = TMath::Max(bpmax,bp->GetId());
870 }
871
872 fBPxmin = bpmin-0.5;
873 fBPxmax = bpmax+0.5;
874 fBPnbins = TMath::Nint(fBPxmax-fBPxmin);
875
876 AliMUONVStore* config = fCalibrationData->Config();
877
878 if (config)
879 {
880 fBusPatchConfig = new TH1F("hTrackerBusPatchConfig","Configuration of bus patches",fBPnbins,fBPxmin,fBPxmax);
881 fBusPatchConfig->SetDirectory(0);
882 }
883 else
884 {
885 AliWarning("Tracker configuration not found. Will not be able to cut on low occupancies");
886 }
887
888 next.Reset();
889 while ( ( bp = static_cast<AliMpBusPatch*>(next())) )
890 {
891 if ( config )
892 {
893 Int_t nofManusInConfig(0);
894
895 for ( Int_t imanu = 0; imanu < bp->GetNofManus(); ++imanu )
896 {
897 Int_t manuId = bp->GetManuId(imanu);
898 if ( config->FindObject(bp->GetDEId(),manuId)) ++nofManusInConfig;
899 }
900
901 if ( nofManusInConfig > 0 )
902 {
903 fBusPatchConfig->Fill(bp->GetId(),1.0);
904 }
905 else
906 {
907 fBusPatchConfig->Fill(bp->GetId(),0.0);
908 }
909 }
910 else // no config, we assume all is there...
911 {
912 fBusPatchConfig->Fill(bp->GetId());
913 }
914 }
915 }
916}
917
918//____________________________________________________________________________
919void AliMUONTrackerQADataMakerRec::BookHistograms(AliQAv1::TASKINDEX_t task)
ece56eb9 920{
ece56eb9 921 AliCodeTimerAuto("",0);
b3d57767 922
923 InitCommon();
ece56eb9 924
925 const Bool_t expert = kTRUE ;
926 const Bool_t saveCorr = kTRUE ;
927 const Bool_t image = kTRUE ;
ece56eb9 928
b3d57767 929 TH1* hbp = new TH1F("hTrackerBusPatchOccupancy","Occupancy of bus patches",fBPnbins,fBPxmin,fBPxmax);
930
931 Master()->Add2List(hbp,AliMUONQAIndices::kTrackerBusPatchOccupancy, task, expert, !image, !saveCorr);
932
933 TH1* h = new TH1F("hTrackerBusPatchParityErrors","Number of parity errors per bus patch",fBPnbins,fBPxmin,fBPxmax);
934
935 Master()->Add2List(h,AliMUONQAIndices::kTrackerBusPatchParityErrors,task,expert,!image,!saveCorr);
936
937 h = new TH1F("hTrackerBusPatchTokenLostErrors","Number of token lost errors per bus patch",fBPnbins,fBPxmin,fBPxmax);
938 Master()->Add2List(h,AliMUONQAIndices::kTrackerBusPatchTokenLostErrors,task,expert,!image,!saveCorr);
939
940 h = new TH1F("hTrackerBusPatchPaddingErrors","Number of padding errors per bus patch",fBPnbins,fBPxmin,fBPxmax);
941
942 Master()->Add2List(h,AliMUONQAIndices::kTrackerBusPatchPaddingErrors,task,expert,!image,!saveCorr);
943
944
945 TH1* hnevents(0x0);
946
947 if ( task == AliQAv1::kRAWS )
ece56eb9 948 {
b3d57767 949 // for raw data, we differentiate events seen from events used to be able to detect
950 // severe decoder errors that lead to no event decoded (i.e. zero event used) even if
951 // events are there (i.e non-zero event seen).
3fe85c2c 952 hnevents = new TH1F("hTrackerNofPhysicsEventsSeen","Number of physics events seen",1,-0.5,0.5);
b3d57767 953 // this one will count the number of physics event the rawdatamaker is *seeing*
954 TAxis* a = hnevents->GetXaxis();
955 a->SetBinLabel(1,"NPhysicsEvents");
956 hnevents->SetStats(kFALSE);
957 Master()->Add2List(hnevents,AliMUONQAIndices::kTrackerNofPhysicsEventsSeen,task,expert,!image,!saveCorr);
ece56eb9 958 }
959
3fe85c2c 960 hnevents = new TH1F("hTrackerNofGoodPhysicsEventsUsed","Number of good physics events used",1,-0.5,0.5);
b3d57767 961 // this one will get its content from the TrackerData, i.e. it will count the number of *good* physics events *used*
962 // (i.e. not empty and with no fatal readout error)
963 TAxis* a = hnevents->GetXaxis();
964 a->SetBinLabel(1,"NGoodPhysicsEvents");
965 hnevents->SetStats(kFALSE);
ece56eb9 966
b3d57767 967 Master()->Add2List(hnevents,AliMUONQAIndices::kTrackerNofGoodPhysicsEventsUsed,task,expert,!image,!saveCorr);
ece56eb9 968
b3d57767 969 Master()->Add2List(static_cast<TH1*>(fBusPatchConfig->Clone()),AliMUONQAIndices::kTrackerBusPatchConfig, task,expert, !image, !saveCorr);
ece56eb9 970
b3d57767 971 Int_t nbins = AliDAQ::NumberOfDdls("MUONTRK");
972 const Int_t offset = AliDAQ::DdlIDOffset("MUONTRK");
973
974 Double_t xmin = offset - 0.5;
975 Double_t xmax = offset + nbins - 0.5;
976
977 TString what(AliQAv1::GetTaskName(task));
978
979 h = new TH1F(Form("hTrackerDDL%sOccupancy",what.Data()),Form(";DDLId;DDL Occupancy in %% (from %s)",what.Data()),nbins,xmin,xmax);
980
981 Master()->Add2List(h,AliMUONQAIndices::kTrackerDDLOccupancy,task,expert,!image,!saveCorr);
64c2397e 982
b3d57767 983 if ( task == AliQAv1::kRAWS )
984 {
985 // see above the comment about why we have event seen vs used for raw data.
986 h = new TH1F("hTrackerDDLNofEventsSeen","Number of events seen by DDL;DDLId",nbins,xmin,xmax);
987 Master()->Add2List(h,AliMUONQAIndices::kTrackerDDLNofEventsSeen,task,expert,!image,!saveCorr);
988 }
989
990 h = new TH1F("hTrackerDDLNofEventsUsed","Number of events used by DDL;DDLId",nbins,xmin,xmax);
991 Master()->Add2List(h,AliMUONQAIndices::kTrackerDDLNofEventsUsed,task,expert,!image,!saveCorr);
992
993}
64c2397e 994
b3d57767 995//____________________________________________________________________________
996void AliMUONTrackerQADataMakerRec::InitRaws()
997{
998 /// create monitor objects for RAWS
999
1000 TrackerDataMaker(AliRecoParam::AConvert(Master()->GetEventSpecie()),kTRUE);
1001
1002 /// Book histograms that are common to Raws and Digits
1003 BookHistograms(AliQAv1::kRAWS);
1004
1005 /// Now the Raws specific parts
1006 TH1* h = new TH1F("hTrackerReadoutStatus","Readout status (x events)",7,-0.5,6.5);
64c2397e 1007 h->SetStats(kFALSE);
1008
64c2397e 1009 TAxis* a = h->GetXaxis();
1010
f2e6387f 1011 a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofGlitchErrors),"Glitch errors");
1012 a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofTokenLostErrors),"Token lost errors");
1013 a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofParityErrors),"Parity errors");
1014 a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofPaddingErrors),"Padding errors");
64c2397e 1015
b3d57767 1016 a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofEmptyEvents),"Empty events");
ece56eb9 1017
b3d57767 1018 a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofMissingBusPatchesFromConfig),"Not readout bus patches");
1019 a->SetBinLabel(h->FindBin(1.0*AliMUONQAIndices::kTrackerRawNofMissingBusPatchesFromDataStream),"Missing bus patches");
ece56eb9 1020
b3d57767 1021 TH1* h1 = static_cast<TH1*>(h->Clone("hTrackerReadoutStatusPerEvent"));
1022 h1->SetTitle("Readout status per event");
1023 h1->GetYaxis()->SetTitle("Percentage");
ece56eb9 1024
b3d57767 1025 // The QA shifter will only see the summary plot below
ece56eb9 1026
b3d57767 1027 Add2RawsList(h,AliMUONQAIndices::kTrackerReadoutStatus,kTRUE,kFALSE,kFALSE);
1028 Add2RawsList(h1,AliMUONQAIndices::kTrackerReadoutStatusPerEvent,kFALSE,kTRUE,kFALSE);
ece56eb9 1029
b3d57767 1030 // Lastly the event size histograms
ece56eb9 1031
b3d57767 1032 Int_t nbins = AliDAQ::NumberOfDdls("MUONTRK");
b71c3d2d 1033 const Int_t offset = AliDAQ::DdlIDOffset("MUONTRK");
1034
b3d57767 1035 Double_t xmin = offset - 0.5;
1036 Double_t xmax = offset + nbins - 0.5;
b71c3d2d 1037
b3d57767 1038 h = new TH1F("hTrackerDDLEventSize","DDL event size (bytes);DDL Id;Data size (bytes)",nbins,xmin,xmax);
1039 h->SetStats(kFALSE);
1040 Add2RawsList(h,AliMUONQAIndices::kTrackerDDLEventSize,kTRUE,kFALSE,kFALSE);
1041
1042 h = new TH1F("hTrackerDDLMeanEventSize","DDL mean event size (KB) per event;DDL Id;Mean Event size (KB)",nbins,xmin,xmax);
1043 h->SetStats(kFALSE);
1044 Add2RawsList(h,AliMUONQAIndices::kTrackerDDLEventSizePerEvent,kFALSE,kTRUE,kFALSE);
1045
bd6fae1e 1046 Add2RawsList(new TH1F("hTrackerIsThere","tracker is there",1,0,1),AliMUONQAIndices::kTrackerIsThere,kTRUE,kFALSE,kFALSE);
92664bc8 1047 //
1048 ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
ece56eb9 1049}
1050
1051//__________________________________________________________________
1052void AliMUONTrackerQADataMakerRec::InitDigits()
1053{
b3d57767 1054 /// create monitor objects for DIGITS
ece56eb9 1055
b3d57767 1056 AliCodeTimerAuto("",0);
1057
9074a9a9 1058 if ( GetRecoParam()->TryRecover() )
1059 {
1060 fDigitMaker->SetTryRecover(kTRUE);
1061 }
1062 else
1063 {
1064 fDigitMaker->SetTryRecover(kFALSE);
1065 }
1066
b3d57767 1067 TrackerCalData(AliRecoParam::AConvert(Master()->GetEventSpecie()),kTRUE);
ece56eb9 1068
b3d57767 1069 /// Book histograms that are common to Raws and Digits
1070 BookHistograms(AliQAv1::kDIGITSR);
92664bc8 1071 //
1072 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
ece56eb9 1073}
1074
1075//____________________________________________________________________________
1076void AliMUONTrackerQADataMakerRec::InitRecPoints()
1077{
1078 /// create Reconstructed Points histograms in RecPoints subdir for the
1079 /// MUON tracker subsystem.
1080 const Bool_t expert = kTRUE ;
1081 const Bool_t image = kTRUE ;
1082
1083 AliCodeTimerAuto("",0);
b3d57767 1084
1085 TrackerRecData(AliRecoParam::AConvert(Master()->GetEventSpecie()),kTRUE);
1086
1087 BookHistograms(AliQAv1::kRECPOINTS);
ece56eb9 1088
1089 TH1I *h1I;
1090 TH1F *h1F;
1091 TH2F *h2F;
1092
1093 // histograms per chamber
1094 Int_t nCh = AliMpConstants::NofTrackingChambers();
1095 for ( Int_t i = 0; i < nCh; ++i )
1096 {
1097 h1I = new TH1I(Form("hTrackerClusterMultiplicityForChamber%d",i+1), Form("cluster size distribution in chamber %d;size (n_{pads};Counts)",i+1), 100,0,100);
6482f70b 1098 Add2RecPointsList(h1I,AliMUONQAIndices::kTrackerClusterMultiplicityPerChamber+i, expert, !image);
ece56eb9 1099
1100 h1I = new TH1I(Form("hTrackerClusterChargeForChamber%d",i+1), Form("cluster charge distribution in chamber %d;charge (fC);Counts",i+1), 100,0,1000);
6482f70b 1101 Add2RecPointsList(h1I,AliMUONQAIndices::kTrackerClusterChargePerChamber+i, expert, !image);
ece56eb9 1102
1103 Float_t rMax = AliMUONConstants::Rmax(i/2);
1104 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);
6482f70b 1105 Add2RecPointsList(h2F, AliMUONQAIndices::kTrackerClusterHitMapPerChamber+i, expert, !image);
ece56eb9 1106 }
1107
1108 // summary histograms per chamber
1109 h1I = new TH1I("hTrackerNumberOfClustersPerChamber", "Number of clusters per chamber;chamber ID;n_{clusters}", nCh,-0.5,nCh-0.5);
6482f70b 1110 Add2RecPointsList(h1I,AliMUONQAIndices::kTrackerNumberOfClustersPerChamber, !expert, image);
ece56eb9 1111
1112 h1F = new TH1F("hTrackerClusterMultiplicityPerChMean", "cluster mean size per chamber;chamber ID;<size> (n_{pads})", nCh,-0.5,nCh-0.5);
1113 h1F->SetOption("P");
1114 h1F->SetMarkerStyle(kFullDotMedium);
1115 h1F->SetMarkerColor(kRed);
6482f70b 1116 Add2RecPointsList(h1F, AliMUONQAIndices::kTrackerClusterMultiplicityPerChMean, !expert, image);
ece56eb9 1117
1118 h1F = new TH1F("hTrackerClusterMultiplicityPerChSigma", "cluster size dispersion per chamber;chamber ID;#sigma_{size} (n_{pads})", nCh,-0.5,nCh-0.5);
1119 h1F->SetOption("P");
1120 h1F->SetMarkerStyle(kFullDotMedium);
1121 h1F->SetMarkerColor(kRed);
6482f70b 1122 Add2RecPointsList(h1F, AliMUONQAIndices::kTrackerClusterMultiplicityPerChSigma, !expert, image);
ece56eb9 1123
1124 h1F = new TH1F("hTrackerClusterChargePerChMean", "cluster mean charge per chamber;chamber ID;<charge> (fC)", nCh,-0.5,nCh-0.5);
1125 h1F->SetOption("P");
1126 h1F->SetMarkerStyle(kFullDotMedium);
1127 h1F->SetMarkerColor(kRed);
6482f70b 1128 Add2RecPointsList(h1F, AliMUONQAIndices::kTrackerClusterChargePerChMean, !expert, image);
ece56eb9 1129
1130 h1F = new TH1F("hTrackerClusterChargePerChSigma", "cluster charge dispersion per chamber;chamber ID;#sigma_{charge} (fC)", nCh,-0.5,nCh-0.5);
1131 h1F->SetOption("P");
1132 h1F->SetMarkerStyle(kFullDotMedium);
1133 h1F->SetMarkerColor(kRed);
6482f70b 1134 Add2RecPointsList(h1F, AliMUONQAIndices::kTrackerClusterChargePerChSigma, !expert, image);
ece56eb9 1135
1136 // histograms per DE
1137 Int_t ndes(0);
1138 AliMpDEIterator it;
1139 it.First();
1140 while ( !it.IsDone())
1141 {
1142 Int_t detElemId = it.CurrentDEId();
1143
1144 if ( AliMpDEManager::GetStationType(detElemId) != AliMp::kStationTrigger )
1145 {
1146 ndes = TMath::Max(ndes,detElemId);
1147
1148 h1I = new TH1I(Form("hTrackerClusterMultiplicityForDE%04d",detElemId), Form("cluster size distribution in detection element %d;size (n_{pads})",detElemId), 100,0,100);
6482f70b 1149 Add2RecPointsList(h1I,AliMUONQAIndices::kTrackerClusterMultiplicityPerDE+detElemId, expert, !image);
ece56eb9 1150
1151 h1I = new TH1I(Form("hTrackerClusterChargeForDE%04d",detElemId), Form("cluster charge distribution in detection element %d;charge (fC)",detElemId), 100,0,1000);
6482f70b 1152 Add2RecPointsList(h1I,AliMUONQAIndices::kTrackerClusterChargePerDE+detElemId, expert, !image);
ece56eb9 1153 }
1154
1155 it.Next();
1156 }
1157
1158 // summary histograms per DE
1159 h1I = new TH1I("hTrackerNumberOfClustersPerDE", "Number of clusters per detection element;DetElem ID;n_{clusters}", ndes+1,-0.5,ndes+0.5);
6482f70b 1160 Add2RecPointsList(h1I, AliMUONQAIndices::kTrackerNumberOfClustersPerDE, !expert, image);
ece56eb9 1161
1162 h1F = new TH1F("hTrackerClusterMultiplicityPerDEMean", "cluster mean size per DE;DetElem ID;<size> (n_{pads})", ndes+1,-0.5,ndes+0.5);
1163 h1F->SetOption("P");
1164 h1F->SetMarkerStyle(kFullDotMedium);
1165 h1F->SetMarkerColor(kRed);
6482f70b 1166 Add2RecPointsList(h1F, AliMUONQAIndices::kTrackerClusterMultiplicityPerDEMean, !expert, image);
ece56eb9 1167
1168 h1F = new TH1F("hTrackerClusterChargePerDEMean", "cluster mean charge per DE;DetElem ID;<charge> (fC)", ndes+1,-0.5,ndes+0.5);
1169 h1F->SetOption("P");
1170 h1F->SetMarkerStyle(kFullDotMedium);
1171 h1F->SetMarkerColor(kRed);
6482f70b 1172 Add2RecPointsList(h1F, AliMUONQAIndices::kTrackerClusterChargePerDEMean, !expert, image);
ece56eb9 1173
b3d57767 1174 MappingCheckRecPoints(AliRecoParam::AConvert(Master()->GetEventSpecie()),kTRUE);
92664bc8 1175 //
1176 ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
ece56eb9 1177}
1178
1179//____________________________________________________________________________
1180void AliMUONTrackerQADataMakerRec::InitESDs()
1181{
1182 ///create ESDs histograms in ESDs subdir
1183
1184 const Bool_t expert = kTRUE ;
1185 const Bool_t image = kTRUE ;
1186
1187 Int_t nCh = AliMUONConstants::NTrackingCh();
1188 Int_t nDE = 1100;
1189
1190 // track info
1191 TH1F* hESDnTracks = new TH1F("hESDnTracks", "number of tracks;n_{tracks}", 20, 0., 20.);
6482f70b 1192 Add2ESDsList(hESDnTracks, AliMUONQAIndices::kESDnTracks, !expert, image);
ece56eb9 1193
1194 TH1F* hESDMatchTrig = new TH1F("hESDMatchTrig", "number of tracks matched with trigger;n_{tracks}", 20, 0., 20.);
6482f70b 1195 Add2ESDsList(hESDMatchTrig, AliMUONQAIndices::kESDMatchTrig, !expert, image);
ece56eb9 1196
1197 TH1F* hESDMomentum = new TH1F("hESDMomentum", "momentum distribution;p (GeV/c)", 300, 0., 300);
6482f70b 1198 Add2ESDsList(hESDMomentum, AliMUONQAIndices::kESDMomentum, !expert, image);
ece56eb9 1199
1200 TH1F* hESDPt = new TH1F("hESDPt", "transverse momentum distribution;p_{t} (GeV/c)", 200, 0., 50);
6482f70b 1201 Add2ESDsList(hESDPt, AliMUONQAIndices::kESDPt, !expert, image);
ece56eb9 1202
1203 TH1F* hESDRapidity = new TH1F("hESDRapidity", "rapidity distribution;rapidity", 200, -4.5, -2.);
6482f70b 1204 Add2ESDsList(hESDRapidity, AliMUONQAIndices::kESDRapidity, !expert, image);
ece56eb9 1205
1206 TH1F* hESDChi2 = new TH1F("hESDChi2", "normalized #chi^{2} distribution;#chi^{2} / ndf", 500, 0., 50.);
6482f70b 1207 Add2ESDsList(hESDChi2, AliMUONQAIndices::kESDChi2, !expert, image);
ece56eb9 1208
1209 TH1F* hESDProbChi2 = new TH1F("hESDProbChi2", "distribution of probability of #chi^{2};prob(#chi^{2})", 100, 0., 1.);
6482f70b 1210 Add2ESDsList(hESDProbChi2, AliMUONQAIndices::kESDProbChi2, !expert, image);
ece56eb9 1211
1212 TH1F* hESDThetaX = new TH1F("hESDThetaX", "#theta_{X} distribution;#theta_{X} (degree)", 360, -180., 180);
6482f70b 1213 Add2ESDsList(hESDThetaX, AliMUONQAIndices::kESDThetaX, !expert, image);
ece56eb9 1214
1215 TH1F* hESDThetaY = new TH1F("hESDThetaY", "#theta_{Y} distribution;#theta_{Y} (degree)", 360, -180., 180);
6482f70b 1216 Add2ESDsList(hESDThetaY, AliMUONQAIndices::kESDThetaY, !expert, image);
ece56eb9 1217
1218 // cluster info
1219 for (Int_t i = 0; i < nCh; i++) {
1220 Float_t rMax = AliMUONConstants::Rmax(i/2);
1221 TH2F* hESDClusterHitMap = new TH2F(Form("hESDClusterHitMap%d",i+1), Form("cluster position distribution in chamber %d;X (cm);Y (cm)",i+1),
1222 100, -rMax, rMax, 100, -rMax, rMax);
6482f70b 1223 Add2ESDsList(hESDClusterHitMap, AliMUONQAIndices::kESDClusterHitMap+i, expert, !image);
ece56eb9 1224 }
1225
1226 TH1F* hESDnClustersPerTrack = new TH1F("hESDnClustersPerTrack", "number of associated clusters per track;n_{clusters}", 20, 0., 20.);
6482f70b 1227 Add2ESDsList(hESDnClustersPerTrack, AliMUONQAIndices::kESDnClustersPerTrack, !expert, image);
ece56eb9 1228
1229 TH1F* hESDnClustersPerCh = new TH1F("hESDnClustersPerCh", "averaged number of clusters per chamber per track;chamber ID;<n_{clusters}>", nCh, -0.5, nCh-0.5);
1230 hESDnClustersPerCh->SetFillColor(kRed);
6482f70b 1231 Add2ESDsList(hESDnClustersPerCh, AliMUONQAIndices::kESDnClustersPerCh, !expert, image);
ece56eb9 1232
1233 TH1F* hESDnClustersPerDE = new TH1F("hESDnClustersPerDE", "averaged number of clusters per DE per track;DetElem ID;<n_{clusters}>", nDE+1, -0.5, nDE+0.5);
1234 hESDnClustersPerDE->SetFillColor(kRed);
6482f70b 1235 Add2ESDsList(hESDnClustersPerDE, AliMUONQAIndices::kESDnClustersPerDE, !expert, image);
ece56eb9 1236
1237 for (Int_t i = 0; i < nCh; i++) {
1238 TH1F* hESDClusterChargeInCh = new TH1F(Form("hESDClusterChargeInCh%d",i+1), Form("cluster charge distribution in chamber %d;charge (fC)",i+1), 100, 0., 1000.);
6482f70b 1239 Add2ESDsList(hESDClusterChargeInCh, AliMUONQAIndices::kESDClusterChargeInCh+i, expert, !image);
ece56eb9 1240 }
1241
1242 TH1F* hESDClusterChargePerChMean = new TH1F("hESDClusterChargePerChMean", "cluster mean charge per chamber;chamber ID;<charge> (fC)", nCh, -0.5, nCh-0.5);
1243 hESDClusterChargePerChMean->SetOption("P");
1244 hESDClusterChargePerChMean->SetMarkerStyle(kFullDotMedium);
1245 hESDClusterChargePerChMean->SetMarkerColor(kRed);
6482f70b 1246 Add2ESDsList(hESDClusterChargePerChMean, AliMUONQAIndices::kESDClusterChargePerChMean, !expert, image);
ece56eb9 1247
1248 TH1F* hESDClusterChargePerChSigma = new TH1F("hESDClusterChargePerChSigma", "cluster charge dispersion per chamber;chamber ID;#sigma_{charge} (fC)", nCh, -0.5, nCh-0.5);
1249 hESDClusterChargePerChSigma->SetOption("P");
1250 hESDClusterChargePerChSigma->SetMarkerStyle(kFullDotMedium);
1251 hESDClusterChargePerChSigma->SetMarkerColor(kRed);
6482f70b 1252 Add2ESDsList(hESDClusterChargePerChSigma, AliMUONQAIndices::kESDClusterChargePerChSigma, !expert, image);
ece56eb9 1253
1254 TH1F* hESDClusterChargePerDE = new TH1F("hESDClusterChargePerDE", "cluster mean charge per DE;DetElem ID;<charge> (fC)", nDE+1, -0.5, nDE+0.5);
1255 hESDClusterChargePerDE->SetOption("P");
1256 hESDClusterChargePerDE->SetMarkerStyle(kFullDotMedium);
1257 hESDClusterChargePerDE->SetMarkerColor(kRed);
6482f70b 1258 Add2ESDsList(hESDClusterChargePerDE, AliMUONQAIndices::kESDClusterChargePerDE, !expert, image);
ece56eb9 1259
1260 for (Int_t i = 0; i < nCh; i++) {
1261 TH1F* hESDClusterSizeInCh = new TH1F(Form("hESDClusterSizeInCh%d",i+1), Form("cluster size distribution in chamber %d;size (n_{pads})",i+1), 200, 0., 200.);
6482f70b 1262 Add2ESDsList(hESDClusterSizeInCh, AliMUONQAIndices::kESDClusterSizeInCh+i, expert, !image);
ece56eb9 1263 }
1264
1265 TH1F* hESDClusterSizePerChMean = new TH1F("hESDClusterSizePerChMean", "cluster mean size per chamber;chamber ID;<size> (n_{pads})", nCh, -0.5, nCh-0.5);
1266 hESDClusterSizePerChMean->SetOption("P");
1267 hESDClusterSizePerChMean->SetMarkerStyle(kFullDotMedium);
1268 hESDClusterSizePerChMean->SetMarkerColor(kRed);
6482f70b 1269 Add2ESDsList(hESDClusterSizePerChMean, AliMUONQAIndices::kESDClusterSizePerChMean, !expert, image);
ece56eb9 1270
1271 TH1F* hESDClusterSizePerChSigma = new TH1F("hESDClusterSizePerChSigma", "cluster size dispersion per chamber;chamber ID;#sigma_{size} (n_{pads})", nCh, -0.5, nCh-0.5);
1272 hESDClusterSizePerChSigma->SetOption("P");
1273 hESDClusterSizePerChSigma->SetMarkerStyle(kFullDotMedium);
1274 hESDClusterSizePerChSigma->SetMarkerColor(kRed);
6482f70b 1275 Add2ESDsList(hESDClusterSizePerChSigma, AliMUONQAIndices::kESDClusterSizePerChSigma, !expert, image);
ece56eb9 1276
1277 TH1F* hESDClusterSizePerDE = new TH1F("hESDClusterSizePerDE", "cluster mean size per DE;DetElem ID;<size> (n_{pads})", nDE+1, -0.5, nDE+0.5);
1278 hESDClusterSizePerDE->SetOption("P");
1279 hESDClusterSizePerDE->SetMarkerStyle(kFullDotMedium);
1280 hESDClusterSizePerDE->SetMarkerColor(kRed);
6482f70b 1281 Add2ESDsList(hESDClusterSizePerDE, AliMUONQAIndices::kESDClusterSizePerDE, !expert, image);
ece56eb9 1282
1283 // cluster - track info
1284 for (Int_t i = 0; i < nCh; i++) {
1285 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.);
6482f70b 1286 Add2ESDsList(hESDResidualXInCh, AliMUONQAIndices::kESDResidualXInCh+i, expert, !image);
ece56eb9 1287
1288 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.);
6482f70b 1289 Add2ESDsList(hESDResidualYInCh, AliMUONQAIndices::kESDResidualYInCh+i, expert, !image);
ece56eb9 1290
1291 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);
6482f70b 1292 Add2ESDsList(hESDLocalChi2XInCh, AliMUONQAIndices::kESDLocalChi2XInCh+i, expert, !image);
ece56eb9 1293
1294 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);
6482f70b 1295 Add2ESDsList(hESDLocalChi2YInCh, AliMUONQAIndices::kESDLocalChi2YInCh+i, expert, !image);
ece56eb9 1296
1297 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);
6482f70b 1298 Add2ESDsList(hESDLocalChi2InCh, AliMUONQAIndices::kESDLocalChi2InCh+i, expert, !image);
ece56eb9 1299 }
1300
1301 TH1F* hESDResidualXPerChMean = new TH1F("hESDResidualXPerChMean", "cluster-track residual-X per Ch: mean;chamber ID;<#Delta_{X}> (cm)", nCh, -0.5, nCh-0.5);
1302 hESDResidualXPerChMean->SetOption("P");
1303 hESDResidualXPerChMean->SetMarkerStyle(kFullDotMedium);
1304 hESDResidualXPerChMean->SetMarkerColor(kRed);
6482f70b 1305 Add2ESDsList(hESDResidualXPerChMean, AliMUONQAIndices::kESDResidualXPerChMean, !expert, image);
ece56eb9 1306
1307 TH1F* hESDResidualYPerChMean = new TH1F("hESDResidualYPerChMean", "cluster-track residual-Y per Ch: mean;chamber ID;<#Delta_{Y}> (cm)", nCh, -0.5, nCh-0.5);
1308 hESDResidualYPerChMean->SetOption("P");
1309 hESDResidualYPerChMean->SetMarkerStyle(kFullDotMedium);
1310 hESDResidualYPerChMean->SetMarkerColor(kRed);
6482f70b 1311 Add2ESDsList(hESDResidualYPerChMean, AliMUONQAIndices::kESDResidualYPerChMean, !expert, image);
ece56eb9 1312
1313 TH1F* hESDResidualXPerChSigma = new TH1F("hESDResidualXPerChSigma", "cluster-track residual-X per Ch: sigma;chamber ID;#sigma_{X} (cm)", nCh, -0.5, nCh-0.5);
1314 hESDResidualXPerChSigma->SetOption("P");
1315 hESDResidualXPerChSigma->SetMarkerStyle(kFullDotMedium);
1316 hESDResidualXPerChSigma->SetMarkerColor(kRed);
6482f70b 1317 Add2ESDsList(hESDResidualXPerChSigma, AliMUONQAIndices::kESDResidualXPerChSigma, !expert, image);
ece56eb9 1318
1319 TH1F* hESDResidualYPerChSigma = new TH1F("hESDResidualYPerChSigma", "cluster-track residual-Y per Ch: sigma;chamber ID;#sigma_{Y} (cm)", nCh, -0.5, nCh-0.5);
1320 hESDResidualYPerChSigma->SetOption("P");
1321 hESDResidualYPerChSigma->SetMarkerStyle(kFullDotMedium);
1322 hESDResidualYPerChSigma->SetMarkerColor(kRed);
6482f70b 1323 Add2ESDsList(hESDResidualYPerChSigma, AliMUONQAIndices::kESDResidualYPerChSigma, !expert, image);
ece56eb9 1324
1325 TH1F* hESDLocalChi2XPerChMean = new TH1F("hESDLocalChi2XPerCh", "local chi2-X per Ch: mean;chamber ID;<local #chi^{2}_{X}>", nCh, -0.5, nCh-0.5);
1326 hESDLocalChi2XPerChMean->SetOption("P");
1327 hESDLocalChi2XPerChMean->SetMarkerStyle(kFullDotMedium);
1328 hESDLocalChi2XPerChMean->SetMarkerColor(kRed);
6482f70b 1329 Add2ESDsList(hESDLocalChi2XPerChMean, AliMUONQAIndices::kESDLocalChi2XPerChMean, !expert, image);
ece56eb9 1330
1331 TH1F* hESDLocalChi2YPerChMean = new TH1F("hESDLocalChi2YPerCh", "local chi2-Y per Ch: mean;chamber ID;<local #chi^{2}_{Y}>", nCh, -0.5, nCh-0.5);
1332 hESDLocalChi2YPerChMean->SetOption("P");
1333 hESDLocalChi2YPerChMean->SetMarkerStyle(kFullDotMedium);
1334 hESDLocalChi2YPerChMean->SetMarkerColor(kRed);
6482f70b 1335 Add2ESDsList(hESDLocalChi2YPerChMean, AliMUONQAIndices::kESDLocalChi2YPerChMean, !expert, image);
ece56eb9 1336
1337 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);
1338 hESDLocalChi2PerChMean->SetOption("P");
1339 hESDLocalChi2PerChMean->SetMarkerStyle(kFullDotMedium);
1340 hESDLocalChi2PerChMean->SetMarkerColor(kRed);
6482f70b 1341 Add2ESDsList(hESDLocalChi2PerChMean, AliMUONQAIndices::kESDLocalChi2PerChMean, !expert, image);
ece56eb9 1342
1343 TH1F* hESDResidualXPerDEMean = new TH1F("hESDResidualXPerDEMean", "cluster-track residual-X per DE: mean;DetElem ID;<#Delta_{X}> (cm)", nDE+1, -0.5, nDE+0.5);
1344 hESDResidualXPerDEMean->SetOption("P");
1345 hESDResidualXPerDEMean->SetMarkerStyle(kFullDotMedium);
1346 hESDResidualXPerDEMean->SetMarkerColor(kRed);
6482f70b 1347 Add2ESDsList(hESDResidualXPerDEMean, AliMUONQAIndices::kESDResidualXPerDEMean, !expert, image);
ece56eb9 1348
1349 TH1F* hESDResidualYPerDEMean = new TH1F("hESDResidualYPerDEMean", "cluster-track residual-Y per DE: mean;DetElem ID;<#Delta_{Y}> (cm)", nDE+1, -0.5, nDE+0.5);
1350 hESDResidualYPerDEMean->SetOption("P");
1351 hESDResidualYPerDEMean->SetMarkerStyle(kFullDotMedium);
1352 hESDResidualYPerDEMean->SetMarkerColor(kRed);
6482f70b 1353 Add2ESDsList(hESDResidualYPerDEMean, AliMUONQAIndices::kESDResidualYPerDEMean, !expert, image);
ece56eb9 1354
1355 TH1F* hESDResidualXPerDESigma = new TH1F("hESDResidualXPerDESigma", "cluster-track residual-X per DE: sigma;DetElem ID;#sigma_{X} (cm)", nDE+1, -0.5, nDE+0.5);
1356 hESDResidualXPerDESigma->SetOption("P");
1357 hESDResidualXPerDESigma->SetMarkerStyle(kFullDotMedium);
1358 hESDResidualXPerDESigma->SetMarkerColor(kRed);
6482f70b 1359 Add2ESDsList(hESDResidualXPerDESigma, AliMUONQAIndices::kESDResidualXPerDESigma, !expert, image);
ece56eb9 1360
1361 TH1F* hESDResidualYPerDESigma = new TH1F("hESDResidualYPerDESigma", "cluster-track residual-Y per DE: sigma;DetElem ID;#sigma_{Y} (cm)", nDE+1, -0.5, nDE+0.5);
1362 hESDResidualYPerDESigma->SetOption("P");
1363 hESDResidualYPerDESigma->SetMarkerStyle(kFullDotMedium);
1364 hESDResidualYPerDESigma->SetMarkerColor(kRed);
6482f70b 1365 Add2ESDsList(hESDResidualYPerDESigma, AliMUONQAIndices::kESDResidualYPerDESigma, !expert, image);
ece56eb9 1366
1367 TH1F* hESDLocalChi2XPerDEMean = new TH1F("hESDLocalChi2XPerDE", "local chi2-X per DE: mean;DetElem ID;<local #chi^{2}_{X}>", nDE+1, -0.5, nDE+0.5);
1368 hESDLocalChi2XPerDEMean->SetOption("P");
1369 hESDLocalChi2XPerDEMean->SetMarkerStyle(kFullDotMedium);
1370 hESDLocalChi2XPerDEMean->SetMarkerColor(kRed);
6482f70b 1371 Add2ESDsList(hESDLocalChi2XPerDEMean, AliMUONQAIndices::kESDLocalChi2XPerDEMean, !expert, image);
ece56eb9 1372
1373 TH1F* hESDLocalChi2YPerDEMean = new TH1F("hESDLocalChi2YPerDE", "local chi2-Y per DE: mean;DetElem ID;<local #chi^{2}_{Y}>", nDE+1, -0.5, nDE+0.5);
1374 hESDLocalChi2YPerDEMean->SetOption("P");
1375 hESDLocalChi2YPerDEMean->SetMarkerStyle(kFullDotMedium);
1376 hESDLocalChi2YPerDEMean->SetMarkerColor(kRed);
6482f70b 1377 Add2ESDsList(hESDLocalChi2YPerDEMean, AliMUONQAIndices::kESDLocalChi2YPerDEMean, !expert, image);
ece56eb9 1378
1379 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);
1380 hESDLocalChi2PerDEMean->SetOption("P");
1381 hESDLocalChi2PerDEMean->SetMarkerStyle(kFullDotMedium);
1382 hESDLocalChi2PerDEMean->SetMarkerColor(kRed);
6482f70b 1383 Add2ESDsList(hESDLocalChi2PerDEMean, AliMUONQAIndices::kESDLocalChi2PerDEMean, !expert, image);
ece56eb9 1384
1385 // intermediate histograms
1386 TH1F* hESDnTotClustersPerCh = new TH1F("hESDnTotClustersPerCh", "total number of associated clusters per chamber;chamber ID;#Sigma(n_{clusters})", nCh, -0.5, nCh-0.5);
6482f70b 1387 Add2ESDsList(hESDnTotClustersPerCh, AliMUONQAIndices::kESDnTotClustersPerCh, expert, !image);
ece56eb9 1388 TH1F* hESDnTotClustersPerDE = new TH1F("hESDnTotClustersPerDE", "total number of associated clusters per DE;DetElem ID;#Sigma(n_{clusters})", nDE+1, -0.5, nDE+0.5);
6482f70b 1389 Add2ESDsList(hESDnTotClustersPerDE, AliMUONQAIndices::kESDnTotClustersPerDE, expert, !image);
ece56eb9 1390 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);
6482f70b 1391 Add2ESDsList(hESDnTotFullClustersPerDE, AliMUONQAIndices::kESDnTotFullClustersPerDE, expert, !image);
ece56eb9 1392 TH1F* hESDSumClusterChargePerDE = new TH1F("hESDSumClusterChargePerDE", "sum of cluster charge per DE;DetElem ID;#Sigma(charge) (fC)", nDE+1, -0.5, nDE+0.5);
6482f70b 1393 Add2ESDsList(hESDSumClusterChargePerDE, AliMUONQAIndices::kESDSumClusterChargePerDE, expert, !image);
ece56eb9 1394 TH1F* hESDSumClusterSizePerDE = new TH1F("hESDSumClusterSizePerDE", "sum of cluster size per DE;DetElem ID;#Sigma(size) (n_{pads})", nDE+1, -0.5, nDE+0.5);
6482f70b 1395 Add2ESDsList(hESDSumClusterSizePerDE, AliMUONQAIndices::kESDSumClusterSizePerDE, expert, !image);
ece56eb9 1396 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);
6482f70b 1397 Add2ESDsList(hESDSumResidualXPerDE, AliMUONQAIndices::kESDSumResidualXPerDE, expert, !image);
ece56eb9 1398 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);
6482f70b 1399 Add2ESDsList(hESDSumResidualYPerDE, AliMUONQAIndices::kESDSumResidualYPerDE, expert, !image);
ece56eb9 1400 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);
6482f70b 1401 Add2ESDsList(hESDSumResidualX2PerDE, AliMUONQAIndices::kESDSumResidualX2PerDE, expert, !image);
ece56eb9 1402 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);
6482f70b 1403 Add2ESDsList(hESDSumResidualY2PerDE, AliMUONQAIndices::kESDSumResidualY2PerDE, expert, !image);
ece56eb9 1404 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);
6482f70b 1405 Add2ESDsList(hESDSumLocalChi2XPerDE, AliMUONQAIndices::kESDSumLocalChi2XPerDE, expert, !image);
ece56eb9 1406 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);
6482f70b 1407 Add2ESDsList(hESDSumLocalChi2YPerDE, AliMUONQAIndices::kESDSumLocalChi2YPerDE, expert, !image);
ece56eb9 1408 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);
6482f70b 1409 Add2ESDsList(hESDSumLocalChi2PerDE, AliMUONQAIndices::kESDSumLocalChi2PerDE, expert, !image);
92664bc8 1410 //
1411 ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
ece56eb9 1412}
1413
1414//____________________________________________________________________________
1415void AliMUONTrackerQADataMakerRec::MakeRaws(AliRawReader* rawReader)
1416{
1417 /// make QA for rawdata tracker
1418
b3d57767 1419 AliCodeTimerAuto(Form("%s",AliRecoParam::GetEventSpecieName(AliRecoParam::AConvert(Master()->GetEventSpecie()))),0);
ece56eb9 1420
1421 /// forces init
6482f70b 1422 GetRawsData(AliMUONQAIndices::kTrackerBusPatchOccupancy);
ece56eb9 1423
b3d57767 1424 AliMUONTrackerDataMaker* dm = static_cast<AliMUONTrackerDataMaker*>(TrackerDataMaker(AliRecoParam::AConvert(Master()->GetEventSpecie())));
1425
92664bc8 1426 dm->SetRawReader(rawReader);
ece56eb9 1427
b3d57767 1428 Int_t eventType = rawReader->GetType();
64c2397e 1429
b3d57767 1430 if (eventType == AliRawEventHeaderBase::kPhysicsEvent )
1431 {
1432 dm->ProcessEvent();
1433
9074a9a9 1434 FillEventSize(rawReader);
1435
b3d57767 1436 if ( dm->LastEventWasEmpty() )
1437 {
92664bc8 1438 FillRawsData(AliMUONQAIndices::kTrackerReadoutStatus,1.0*AliMUONQAIndices::kTrackerRawNofEmptyEvents);
1d1e08f6 1439 }
b3d57767 1440 }
92664bc8 1441 //
ece56eb9 1442}
1443
1444//__________________________________________________________________
1445void AliMUONTrackerQADataMakerRec::MakeDigits(TTree* digitsTree)
1446{
1447 /// makes data from Digits
b3d57767 1448 AliCodeTimerAuto(Form("%s",AliRecoParam::GetEventSpecieName(AliRecoParam::AConvert(Master()->GetEventSpecie()))),0);
ece56eb9 1449
b3d57767 1450 /// forces init
1451
1452 GetDigitsData(AliMUONQAIndices::kTrackerBusPatchOccupancy);
ece56eb9 1453
1454 if (!fDigitStore)
1455 fDigitStore = AliMUONVDigitStore::Create(*digitsTree);
1456 fDigitStore->Connect(*digitsTree, false);
1457 digitsTree->GetEvent(0);
1458
1459 TIter next(fDigitStore->CreateIterator());
1460
1461 AliMUONVDigit* dig = 0x0;
1462
b3d57767 1463 AliMUON2DMap oneEventData(true);
1464
ece56eb9 1465 while ( ( dig = static_cast<AliMUONVDigit*>(next()) ) )
b3d57767 1466 {
1467 if ( dig->IsTracker() )
ece56eb9 1468 {
b3d57767 1469 if ( dig->Charge() > 0.0 )
1470 {
1471
1472 Int_t detElemId = dig->DetElemId();
1473 Int_t manuId = dig->ManuId();
1474
1475 AliMUONVCalibParam* param = static_cast<AliMUONVCalibParam*>(oneEventData.FindObject(detElemId,manuId));
1476 if (!param)
1477 {
1478 param = new AliMUONCalibParamND(1,AliMpConstants::ManuNofChannels(),detElemId,manuId,
1479 AliMUONVCalibParam::InvalidFloatValue());
1480 oneEventData.Add(param);
1481 }
1482 param->SetValueAsDouble(dig->ManuChannel(),0,dig->Charge());
1483 }
ece56eb9 1484 }
b3d57767 1485 }
b3d57767 1486 TrackerCalData(AliRecoParam::AConvert(Master()->GetEventSpecie()))->Add(oneEventData);
92664bc8 1487 //
ece56eb9 1488}
1489
ece56eb9 1490//____________________________________________________________________________
1491void AliMUONTrackerQADataMakerRec::MakeRecPoints(TTree* clustersTree)
1492{
1493 /// Fill histograms related to tracker clusters
1494
1495 // First things first : do we have clusters in the TreeR ?
1496 // In "normal" production mode, it should be perfectly normal
1497 // *not* to have them.
1498 // But if for some reason we de-activated the combined tracking,
1499 // then we have clusters in TreeR, so let's take that opportunity
1500 // to QA them...
1501
b3d57767 1502 AliCodeTimerAuto(Form("%s",AliRecoParam::GetEventSpecieName(AliRecoParam::AConvert(Master()->GetEventSpecie()))),0);
1503 // Forces init by requesting an histogram
1504 GetRecPointsData(AliMUONQAIndices::kTrackerBusPatchOccupancy);
ece56eb9 1505
1506 if (!fClusterStore)
1507 {
1508 AliCodeTimerAuto("ClusterStore creation",1);
1509 fClusterStore = AliMUONVClusterStore::Create(*clustersTree);
1510 if (!fClusterStore)
1511 {
1512 return;
1513 }
1514 }
1515
1516 fClusterStore->Connect(*clustersTree,kFALSE);
1517 clustersTree->GetEvent(0);
1518
1519 TIter next(fClusterStore->CreateIterator());
1520 AliMUONVCluster* cluster;
1521
b3d57767 1522 AliMUONQAMappingCheck* mcr = MappingCheckRecPoints(AliRecoParam::AConvert(Master()->GetEventSpecie()));
1523
1524 if ( mcr ) mcr->NewEvent();
1525
1526 AliMUON2DMap oneEventData(true);
ece56eb9 1527
1528 while ( ( cluster = static_cast<AliMUONVCluster*>(next()) ) )
1529 {
1530 Int_t detElemId = cluster->GetDetElemId();
1531 Int_t chamberId = AliMpDEManager::GetChamberId(detElemId);
1532
92664bc8 1533 FillRecPointsData(AliMUONQAIndices::kTrackerNumberOfClustersPerDE,detElemId);
1534 FillRecPointsData(AliMUONQAIndices::kTrackerClusterChargePerDE+detElemId,cluster->GetCharge());
1535 FillRecPointsData(AliMUONQAIndices::kTrackerClusterMultiplicityPerDE+detElemId,cluster->GetNDigits());
1536
1537 FillRecPointsData(AliMUONQAIndices::kTrackerNumberOfClustersPerChamber,chamberId);
1538 FillRecPointsData(AliMUONQAIndices::kTrackerClusterChargePerChamber+chamberId,cluster->GetCharge());
1539 FillRecPointsData(AliMUONQAIndices::kTrackerClusterMultiplicityPerChamber+chamberId,cluster->GetNDigits());
1540 FillRecPointsData(AliMUONQAIndices::kTrackerClusterHitMapPerChamber+chamberId,cluster->GetX(),cluster->GetY());
ece56eb9 1541
b3d57767 1542 if ( mcr ) mcr->Store(*cluster);
ece56eb9 1543
b3d57767 1544 for ( int i = 0; i < cluster->GetNDigits(); ++i )
1545 {
1546 UInt_t digitId = cluster->GetDigitId(i);
1547
1548 Int_t manuId = AliMUONVDigit::ManuId(digitId);
1549 Int_t manuChannel = AliMUONVDigit::ManuChannel(digitId);
1550
1551 AliMUONVCalibParam* param = static_cast<AliMUONVCalibParam*>(oneEventData.FindObject(detElemId,manuId));
1552 if (!param)
1553 {
1554 param = new AliMUONCalibParamND(1,AliMpConstants::ManuNofChannels(),detElemId,manuId,AliMUONVCalibParam::InvalidFloatValue());
1555 oneEventData.Add(param);
1556 }
1557 param->SetValueAsDouble(manuChannel,0,1.0);
1558 }
ece56eb9 1559 }
1560
b3d57767 1561 TrackerRecData(AliRecoParam::AConvert(Master()->GetEventSpecie()))->Add(oneEventData);
1562
92664bc8 1563 fClusterStore->Clear();
1564 //
ece56eb9 1565}
1566
1567//____________________________________________________________________________
1568void AliMUONTrackerQADataMakerRec::MakeESDs(AliESDEvent* esd)
1569{
1570 /// make QA data from ESDs
1571
b3d57767 1572 AliCodeTimerAuto(Form("%s",AliRecoParam::GetEventSpecieName(AliRecoParam::AConvert(Master()->GetEventSpecie()))),0);
1573
ece56eb9 1574 // load ESD event in the interface
1575 AliMUONESDInterface esdInterface;
a99c3449 1576 if (GetRecoParam()) AliMUONESDInterface::ResetTracker(GetRecoParam(), kFALSE);
ece56eb9 1577 else AliError("Unable to get recoParam: use default ones for residual calculation");
1578 esdInterface.LoadEvent(*esd);
1579
92664bc8 1580 FillESDsData(AliMUONQAIndices::kESDnTracks,esdInterface.GetNTracks());
ece56eb9 1581
1582 Int_t nTrackMatchTrig = 0;
1583
1584 // loop over tracks
1585 Int_t nTracks = (Int_t) esd->GetNumberOfMuonTracks();
1586 for (Int_t iTrack = 0; iTrack < nTracks; ++iTrack) {
1587
1588 // get the ESD track and skip "ghosts"
1589 AliESDMuonTrack* esdTrack = esd->GetMuonTrack(iTrack);
1590 if (!esdTrack->ContainTrackerData()) continue;
1591
1592 // get corresponding MUON track
1593 AliMUONTrack* track = esdInterface.FindTrack(esdTrack->GetUniqueID());
1594
1595 if (esdTrack->ContainTriggerData()) nTrackMatchTrig++;
1596
92664bc8 1597 FillESDsData(AliMUONQAIndices::kESDMomentum,esdTrack->P());
1598 FillESDsData(AliMUONQAIndices::kESDPt,esdTrack->Pt());
1599 FillESDsData(AliMUONQAIndices::kESDRapidity,esdTrack->Y());
1600 FillESDsData(AliMUONQAIndices::kESDChi2,track->GetNormalizedChi2());
1601 FillESDsData(AliMUONQAIndices::kESDProbChi2,TMath::Prob(track->GetGlobalChi2(),track->GetNDF()));
1602 FillESDsData(AliMUONQAIndices::kESDThetaX,esdTrack->GetThetaXUncorrected() / TMath::Pi() * 180.);
1603 FillESDsData(AliMUONQAIndices::kESDThetaY,esdTrack->GetThetaYUncorrected() / TMath::Pi() * 180.);
1604 FillESDsData(AliMUONQAIndices::kESDnClustersPerTrack,track->GetNClusters());
ece56eb9 1605
1606 // loop over clusters
1607 AliMUONTrackParam* trackParam = static_cast<AliMUONTrackParam*>(track->GetTrackParamAtCluster()->First());
1608 while (trackParam) {
1609
1610 AliMUONVCluster* cluster = trackParam->GetClusterPtr();
1611 Int_t chId = cluster->GetChamberId();
1612 Int_t deID = cluster->GetDetElemId();
1613 Double_t residualX = cluster->GetX() - trackParam->GetNonBendingCoor();
1614 Double_t residualY = cluster->GetY() - trackParam->GetBendingCoor();
1615 Double_t sigmaResidualX2 = cluster->GetErrX2() - trackParam->GetCovariances()(0,0);
1616 Double_t sigmaResidualY2 = cluster->GetErrY2() - trackParam->GetCovariances()(2,2);
1617 Double_t localChi2X = (sigmaResidualX2 > 0.) ? residualX*residualX/sigmaResidualX2 : 0.;
1618 Double_t localChi2Y = (sigmaResidualY2 > 0.) ? residualY*residualY/sigmaResidualY2 : 0.;
1619 Double_t localChi2 = 0.5 * trackParam->GetLocalChi2();
1620
92664bc8 1621 FillESDsData(AliMUONQAIndices::kESDClusterHitMap+chId,cluster->GetX(), cluster->GetY());
ece56eb9 1622
92664bc8 1623 FillESDsData(AliMUONQAIndices::kESDnTotClustersPerCh,chId);
1624 FillESDsData(AliMUONQAIndices::kESDnTotClustersPerDE,deID);
ece56eb9 1625
92664bc8 1626 FillESDsData(AliMUONQAIndices::kESDClusterChargeInCh+chId,cluster->GetCharge());
1627 FillESDsData(AliMUONQAIndices::kESDSumClusterChargePerDE,deID, cluster->GetCharge());
ece56eb9 1628
1629 if (cluster->GetNDigits() > 0) { // discard clusters with pad not stored in ESD
92664bc8 1630 FillESDsData(AliMUONQAIndices::kESDnTotFullClustersPerDE,deID);
1631 FillESDsData(AliMUONQAIndices::kESDClusterSizeInCh+chId,cluster->GetNDigits());
1632 FillESDsData(AliMUONQAIndices::kESDSumClusterSizePerDE,deID, cluster->GetNDigits());
ece56eb9 1633 }
1634
92664bc8 1635 FillESDsData(AliMUONQAIndices::kESDResidualXInCh+chId,residualX);
1636 FillESDsData(AliMUONQAIndices::kESDResidualYInCh+chId,residualY);
1637 FillESDsData(AliMUONQAIndices::kESDSumResidualXPerDE,deID, residualX);
1638 FillESDsData(AliMUONQAIndices::kESDSumResidualYPerDE,deID, residualY);
1639 FillESDsData(AliMUONQAIndices::kESDSumResidualX2PerDE,deID, residualX*residualX);
1640 FillESDsData(AliMUONQAIndices::kESDSumResidualY2PerDE,deID, residualY*residualY);
ece56eb9 1641
92664bc8 1642 FillESDsData(AliMUONQAIndices::kESDLocalChi2XInCh+chId,localChi2X);
1643 FillESDsData(AliMUONQAIndices::kESDLocalChi2YInCh+chId,localChi2Y);
1644 FillESDsData(AliMUONQAIndices::kESDLocalChi2InCh+chId,localChi2);
1645 FillESDsData(AliMUONQAIndices::kESDSumLocalChi2XPerDE,deID, localChi2X);
1646 FillESDsData(AliMUONQAIndices::kESDSumLocalChi2YPerDE,deID, localChi2Y);
1647 FillESDsData(AliMUONQAIndices::kESDSumLocalChi2PerDE,deID, localChi2);
ece56eb9 1648
1649 trackParam = static_cast<AliMUONTrackParam*>(track->GetTrackParamAtCluster()->After(trackParam));
1650
1651 }
1652
1653 }
1654
92664bc8 1655 FillESDsData(AliMUONQAIndices::kESDMatchTrig,nTrackMatchTrig);
1656 //
ece56eb9 1657}
1658
1659//____________________________________________________________________________
1660AliMUONVTrackerData* AliMUONTrackerQADataMakerRec::GetTrackerData() const
1661{
b3d57767 1662 /// Return tracker data
ece56eb9 1663
b3d57767 1664 return TrackerDataMaker(AliRecoParam::AConvert(Master()->GetEventSpecie()))->Data();
ece56eb9 1665}
152fe71e 1666
1667//____________________________________________________________________________
1668void
1669AliMUONTrackerQADataMakerRec::ResetDetectorRaws(TObjArray* list)
1670{
1671 /// Reset those histograms that must be reset (and only those), plus
1672 /// the trackerdata itself.
1673
1674 TIter next(list);
1675 TObject* o;
1676 while ( ( o = next() ) )
1677 {
1678 TH1* h = dynamic_cast<TH1*>(o);
1679 if (h)
1680 {
1681 TString hn(h->GetName());
1682
9074a9a9 1683 if ( !hn.Contains("TrackerBusPatchConfig") )
152fe71e 1684 {
bd6fae1e 1685 AliDebug(1,Form("Resetting %s",hn.Data()));
9074a9a9 1686
1687 h->Reset();
152fe71e 1688 }
1689 else
1690 {
bd6fae1e 1691 AliDebug(1,Form("Will not reset histogram %s",hn.Data()));
152fe71e 1692 }
92664bc8 1693 continue;
152fe71e 1694 }
92664bc8 1695 // RS account for the case when this histos were cloned per trigger class
1696 TObjArray* harr = dynamic_cast<TObjArray*>(o);
1697 if (harr) {
1698 TString hn(harr->GetName());
1699 if ( !hn.Contains("TrackerBusPatchConfig") ) {
1700
1701 AliDebug(1,Form("Resetting clones of %s",hn.Data()));
1702
1703 TIter nextCl(harr);
1704 TH1* hc = 0;
1705 while ( (hc=dynamic_cast<TH1*>(nextCl())) ) hc->Reset();
152fe71e 1706 }
92664bc8 1707 else {
1708 AliDebug(1,Form("Will not reset clones of histogram %s",hn.Data()));
152fe71e 1709 }
92664bc8 1710 continue;
1711 }
1712 //
1713 AliMUONVTrackerData* d = dynamic_cast<AliMUONVTrackerData*>(o);
1714 if (d) {
1715 AliDebug(1,Form("Resetting %s",d->GetName()));
1716 d->Clear();
1717 }
1718 else {
1719 AliError(Form("Found an object of class %s. Do not know how to reset.",o->ClassName()));
152fe71e 1720 }
1721 }
92664bc8 1722
1d1e08f6 1723 fLogger->Clear();
c00bc129 1724}
b3d57767 1725
1726//____________________________________________________________________________
1727TObjArray* AliMUONTrackerQADataMakerRec::GetArray(TObjArray*& array, Bool_t create)
1728{
1729 /// Get (or create) the array
1730
1731 if ( ! array )
1732 {
1733 if ( create )
1734 {
1735 array = new TObjArray(AliRecoParam::kNSpecies);
1736 }
1737 }
1738
1739 return array;
1740}
1741
1742//____________________________________________________________________________
1743AliMUONVTrackerDataMaker*
1744AliMUONTrackerQADataMakerRec::TrackerDataMaker(Int_t specieIndex) const
1745{
1746 /// const version of the getter
1747 if ( fTrackerDataMakerArray )
1748 {
1749 return static_cast<AliMUONVTrackerDataMaker*>(fTrackerDataMakerArray->At(specieIndex));
1750 }
1751 return 0x0;
1752}
1753
1754//____________________________________________________________________________
1755AliMUONVTrackerDataMaker*
1756AliMUONTrackerQADataMakerRec::TrackerDataMaker(Int_t specieIndex, Bool_t create)
1757{
1758 /// Get (or create) TrackerDataMaker object for a given specie
1759
1760 TObjArray* array = GetArray(fTrackerDataMakerArray,create);
1761 TObject* o(0x0);
1762
1763 if ( array )
1764 {
1765 array->SetOwner(kTRUE);
1766 o = array->At(specieIndex);
1767 if (!o && create)
1768 {
1769
1770 AliMUONTrackerDataMaker* dm = new AliMUONTrackerDataMaker(0x0,
1771 AliCDBManager::Instance()->GetRun(),
1772 0x0,
1773 "",
1774 "",
1775 kFALSE,
1776 0.0,0.0);
1777
1778 if (!fLogger) fLogger = new AliMUONLogger(-1); // note that we share the logger between species... should not be a big deal though
1779 dm->EnableErrorLogger(fLogger);
1780 dm->Data()->DisableChannelLevel(); // to save up disk space, we only store starting at the manu level
1781 dm->Data()->SetName("RawCharges");
1782 dm->SetRunning(kTRUE);
1783
1784 o = dm;
1785 array->AddAt(o,specieIndex);
1786 }
1787 }
1788 return static_cast<AliMUONVTrackerDataMaker*>(o);
1789}
1790
1791//____________________________________________________________________________
1792AliMUONVTrackerData*
1793AliMUONTrackerQADataMakerRec::TrackerCalData(Int_t specieIndex, Bool_t create)
1794{
1795 TObjArray* array = GetArray(fTrackerCalDataArray,create);
1796 TObject* o(0x0);
1797
1798 if (array)
1799 {
b3d57767 1800 o = array->At(specieIndex);
1801 if (!o && create)
1802 {
1803 AliMUONTrackerData* data = new AliMUONTrackerData("CalCharges",Form("Calibrated charges (fC) %s",GetRecoParam()->GetCalibrationMode()),1);
1804 data->SetDimensionName(0,"charge");
1805 data->DisableChannelLevel(); // to save up disk space, we only store starting at the manu level
1806 o=data;
1807 array->AddAt(o,specieIndex);
1808 }
1809 }
1810 return static_cast<AliMUONVTrackerData*>(o);
1811}
1812
1813//____________________________________________________________________________
1814AliMUONVTrackerData*
1815AliMUONTrackerQADataMakerRec::TrackerRecData(Int_t specieIndex, Bool_t create)
1816{
1817 TObjArray* array = GetArray(fTrackerRecDataArray,create);
1818 TObject* o(0x0);
1819
1820 if (array)
1821 {
b3d57767 1822 o = array->At(specieIndex);
1823 if (!o && create)
1824 {
1825 AliMUONTrackerData* data = new AliMUONTrackerData("RecCharges",Form("Calibrated charges (fC) %s for digits belonging to a reconstructed cluster",GetRecoParam()->GetCalibrationMode()),1);
1826 data->SetDimensionName(0,"one");
1827 data->DisableChannelLevel(); // to save up disk space, we only store starting at the manu level
1828 o=data;
1829 array->AddAt(o,specieIndex);
1830 }
1831 }
1832 return static_cast<AliMUONVTrackerData*>(o);
1833}
1834
1835//____________________________________________________________________________
1836AliMUONQAMappingCheck*
1837AliMUONTrackerQADataMakerRec::MappingCheckRecPoints(Int_t specieIndex, Bool_t create)
1838{
1839 TObjArray* array = GetArray(fMappingCheckRecPointsArray,create);
1840 TObject* o(0x0);
1841
1842 if (array)
1843 {
b3d57767 1844 o = array->At(specieIndex);
3fe85c2c 1845 array->SetOwner(kTRUE);
b3d57767 1846 if (!o && create)
1847 {
1848 AliMUONQAMappingCheck* mcheck = new AliMUONQAMappingCheck(RunNumber());
1849 o=mcheck;
1850 array->AddAt(o,specieIndex);
1851 }
1852 }
1853 return static_cast<AliMUONQAMappingCheck*>(o);
1854}