- Disentangle masks effect from trigger chamber efficiency estimation.
[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
04236e67 21//-----------------------------------------------------------------------------
22/// \class AliMUONQADataMakerRec
23///
24/// MUON base class for quality assurance data (histo) maker
25///
ece56eb9 26/// It is now only a steering class for the two subclasses AliMUONTrackerQADataMakerRec
27/// and AliMUONTriggerQADataMakerRec
28///
29/// \author C. Finck, D. Stocco, L. Aphecetche, A. Blanc
30
1d1e08f6 31#include "AliDAQ.h"
ece56eb9 32#include "AliMUONTrackerQADataMakerRec.h"
33#include "AliMUONTriggerQADataMakerRec.h"
34#include "AliQAChecker.h"
35#include "AliRawReader.h"
36#include "AliRawEventHeaderBase.h"
04236e67 37
38/// \cond CLASSIMP
39ClassImp(AliMUONQADataMakerRec)
40/// \endcond
41
42//____________________________________________________________________________
ece56eb9 43AliMUONQADataMakerRec::AliMUONQADataMakerRec(Bool_t tracker, Bool_t trigger) :
4e25ac79 44AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kMUON), "MUON Quality Assurance Data Maker"),
ece56eb9 45fTracker(tracker ? new AliMUONTrackerQADataMakerRec(this) : 0x0),
46fTrigger(trigger ? new AliMUONTriggerQADataMakerRec(this) : 0x0)
04236e67 47{
ece56eb9 48 /// ctor
04236e67 49}
50
51//__________________________________________________________________
52AliMUONQADataMakerRec::~AliMUONQADataMakerRec()
53{
54 /// dtor
ece56eb9 55 delete fTracker;
56 delete fTrigger;
04236e67 57}
58
59//____________________________________________________________________________
b3d57767 60Int_t AliMUONQADataMakerRec::Add2List(TH1 * hist, const Int_t index, AliQAv1::TASKINDEX_t task, const Bool_t expert, const Bool_t image, const Bool_t saveForCorr)
61{
62 TObjArray** list = GetList(task);
63 if (list)
64 {
65 return Add2List(hist,index,list,expert,image,saveForCorr);
66 }
67 return -1;
68}
69
70//____________________________________________________________________________
4e25ac79 71void AliMUONQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray** list)
04236e67 72{
b9bd355c 73 /// Detector specific actions at end of cycle
92664bc8 74 //
75 ResetEventTrigClasses(); // RS
76 //
c455c5fb 77 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
78 {
b9bd355c 79 if (! IsValidEventSpecie(specie, list) ) continue;
80
b3d57767 81 SetEventSpecie(AliRecoParam::ConvertIndex(specie)); // needed by the GetXXXData methods
82
ece56eb9 83 if ( task == AliQAv1::kRAWS )
b9bd355c 84 {
b3d57767 85 if ( fTracker ) fTracker->EndOfDetectorCycleRaws(specie,list);
86 if ( fTrigger ) fTrigger->EndOfDetectorCycleRaws(specie,list);
87 }
88 else if ( task == AliQAv1::kRECPOINTS )
b9bd355c 89 {
90 // normalize recpoints histograms
b3d57767 91 if ( fTracker ) fTracker->EndOfDetectorCycleRecPoints(specie,list);
92 if ( fTrigger ) fTrigger->EndOfDetectorCycleRecPoints(specie,list);
b9bd355c 93 }
b3d57767 94 else if ( task == AliQAv1::kESDS )
b9bd355c 95 {
96 // normalize esds histograms
b3d57767 97 if ( fTracker ) fTracker->EndOfDetectorCycleESDs(specie,list);
98 if ( fTrigger ) fTrigger->EndOfDetectorCycleESDs(specie,list);
99 }
100 else if ( task == AliQAv1::kDIGITSR )
101 {
102 if ( fTracker ) fTracker->EndOfDetectorCycleDigits(specie,list);
103 if ( fTrigger ) fTrigger->EndOfDetectorCycleDigits(specie,list);
104 }
105 else
106 {
107 AliFatal(Form("Not implemented for task %s",AliQAv1::GetTaskName(task).Data()));
b9bd355c 108 }
b3d57767 109 } // loop on specie
b9bd355c 110
111 // do the QA checking
ece56eb9 112 AliQAChecker::Instance()->Run(AliQAv1::kMUON,task,list,const_cast<AliDetectorRecoParam*>(GetRecoParam()));
04236e67 113}
114
115//____________________________________________________________________________
b3d57767 116TObject* AliMUONQADataMakerRec::GetData(AliQAv1::TASKINDEX_t task, const Int_t index)
117{
118 TObjArray** list = GetList(task);
119 if (list) return GetData(list,index);
120 return 0x0;
121}
122
123//____________________________________________________________________________
124TObjArray** AliMUONQADataMakerRec::GetList(AliQAv1::TASKINDEX_t task)
125{
126 // enum TASKINDEX_t {
127 // kNULLTASKINDEX=-1, kRAWS, kHITS, kSDIGITS, kDIGITS, kDIGITSR, kRECPOINTS, kTRACKSEGMENTS, kRECPARTICLES, kESDS, kNTASKINDEX };
128 if ( task == AliQAv1::kRAWS )
129 {
130 return fRawsQAList;
131 }
132 else if ( task == AliQAv1::kDIGITS || task == AliQAv1::kDIGITSR )
133 {
134 return fDigitsQAList;
135 }
136 else if ( task == AliQAv1::kRECPOINTS )
137 {
138 return fRecPointsQAList;
139 }
140 else
141 {
142 AliFatal(Form("task %s not supported here yet",AliQAv1::GetTaskName(task).Data()));
143 }
144 return 0x0;
145}
146
147//____________________________________________________________________________
04236e67 148void AliMUONQADataMakerRec::InitRaws()
149{
ece56eb9 150 /// create Raws histograms in Raws subdir
df48c8a4 151
ece56eb9 152 if ( fTracker ) fTracker->InitRaws();
153 if ( fTrigger ) fTrigger->InitRaws();
92664bc8 154 //
155 ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
f587a77d 156}
04236e67 157
44ed7a66 158//__________________________________________________________________
159void AliMUONQADataMakerRec::InitDigits()
160{
161 /// Initialized Digits spectra
ece56eb9 162 if ( fTracker ) fTracker->InitDigits();
163 if ( fTrigger ) fTrigger->InitDigits();
92664bc8 164 //
165 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
44ed7a66 166}
167
f587a77d 168//____________________________________________________________________________
169void AliMUONQADataMakerRec::InitRecPoints()
170{
171 /// create Reconstructed Points histograms in RecPoints subdir
ece56eb9 172 if ( fTracker ) fTracker->InitRecPoints();
173 if ( fTrigger ) fTrigger->InitRecPoints();
92664bc8 174 //
175 ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
04236e67 176}
177
178
179//____________________________________________________________________________
180void AliMUONQADataMakerRec::InitESDs()
181{
c92a8c85 182 ///create ESDs histograms in ESDs subdir
ece56eb9 183 if ( fTracker ) fTracker->InitESDs();
184 if ( fTrigger ) fTrigger->InitESDs();
92664bc8 185 //
186 ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
04236e67 187}
188
189//____________________________________________________________________________
190void AliMUONQADataMakerRec::MakeRaws(AliRawReader* rawReader)
191{
ece56eb9 192 /// make QA for rawdata
1d1e08f6 193 /// Note that we do not call the sub-datamaker MakeRaws method
194 /// for events where the MCH or MTR is not part of the readout...
195
196 if ( !rawReader || !rawReader->GetDetectorPattern() ) return;
197
198 UInt_t clmask = rawReader->GetDetectorPattern()[0];
199
ece56eb9 200 if ( fTracker && rawReader->GetType() == AliRawEventHeaderBase::kPhysicsEvent )
f587a77d 201 {
1d1e08f6 202 UInt_t mchMask = AliDAQ::DetectorPattern(" MUONTRK ");
203 if ( clmask & mchMask )
204 {
205 rawReader->Reset();
206 fTracker->MakeRaws(rawReader);
207 }
f587a77d 208 }
04236e67 209
ece56eb9 210 if ( fTrigger && (rawReader->GetType() == AliRawEventHeaderBase::kPhysicsEvent ||
211 rawReader->GetType() == AliRawEventHeaderBase::kCalibrationEvent ) )
719914e0 212 {
1d1e08f6 213 UInt_t mtrMask = AliDAQ::DetectorPattern(" MUONTRG ");
214 if ( clmask & mtrMask )
215 {
216 rawReader->Reset();
217 fTrigger->MakeRaws(rawReader);
218 }
719914e0 219 }
92664bc8 220 //
221 IncEvCountCycleRaws();
222 IncEvCountTotalRaws();
223 //
f587a77d 224}
2346e1ad 225
ece56eb9 226//__________________________________________________________________
227void AliMUONQADataMakerRec::MakeDigits()
f587a77d 228{
ece56eb9 229 /// makes data from Digits
bb22d2a6 230
b3d57767 231 AliFatal("Not implemented");
04236e67 232}
233
44ed7a66 234//__________________________________________________________________
235void AliMUONQADataMakerRec::MakeDigits(TTree* digitsTree)
236{
237 /// makes data from Digits
eca4fa66 238
77bd5fcf 239 // Do nothing in case of calibration event
b3d57767 240 if ( GetEventSpecie() == AliRecoParam::kCalib ) return;
77bd5fcf 241
ece56eb9 242 if ( fTracker ) fTracker->MakeDigits(digitsTree);
243 if ( fTrigger ) fTrigger->MakeDigits(digitsTree);
92664bc8 244 //
245 IncEvCountCycleDigits();
246 IncEvCountTotalDigits();
247 //
44ed7a66 248}
249
04236e67 250//____________________________________________________________________________
251void AliMUONQADataMakerRec::MakeRecPoints(TTree* clustersTree)
252{
f587a77d 253 /// Fill histograms from treeR
77bd5fcf 254
255 // Do nothing in case of calibration event
b3d57767 256 if ( GetEventSpecie() == AliRecoParam::kCalib ) return;
f587a77d 257
ece56eb9 258 if ( fTracker ) fTracker->MakeRecPoints(clustersTree);
259 if ( fTrigger ) fTrigger->MakeRecPoints(clustersTree);
92664bc8 260 //
261 IncEvCountCycleRecPoints();
262 IncEvCountTotalRecPoints();
263 //
04236e67 264}
265
266//____________________________________________________________________________
267void AliMUONQADataMakerRec::MakeESDs(AliESDEvent* esd)
268{
c92a8c85 269 /// make QA data from ESDs
77bd5fcf 270
271 // Do nothing in case of calibration event
b3d57767 272 if ( GetEventSpecie() == AliRecoParam::kCalib ) return;
c92a8c85 273
ece56eb9 274 if ( fTracker ) fTracker->MakeESDs(esd);
275 if ( fTrigger ) fTrigger->MakeESDs(esd);
92664bc8 276 //
277 IncEvCountCycleESDs();
278 IncEvCountTotalESDs();
279 //
ece56eb9 280 }
04236e67 281
282//____________________________________________________________________________
152fe71e 283void AliMUONQADataMakerRec::ResetDetector(AliQAv1::TASKINDEX_t task)
284{
285 /// Reset internals
286
287 for (int spec = 0; spec < AliRecoParam::kNSpecies; ++spec)
288 {
289 if (!AliQAv1::Instance()->IsEventSpecieSet(AliRecoParam::ConvertIndex(spec)))
290 continue;
291
292 if ( task == AliQAv1::kRAWS )
293 {
294 if (fTracker) fTracker->ResetDetectorRaws(fRawsQAList[spec]);
295 if (fTrigger) fTrigger->ResetDetectorRaws(fRawsQAList[spec]);
296 }
297 else if ( task == AliQAv1::kRECPOINTS )
298 {
299 if (fTracker) fTracker->ResetDetectorRecPoints(fRecPointsQAList[spec]);
300 if (fTrigger) fTrigger->ResetDetectorRecPoints(fRecPointsQAList[spec]);
301 }
302 else if ( task == AliQAv1::kESDS )
303 {
304 if (fTracker) fTracker->ResetDetectorESDs(fESDsQAList[spec]);
305 if (fTrigger) fTrigger->ResetDetectorESDs(fESDsQAList[spec]);
306 }
307 else if ( task == AliQAv1::kDIGITS )
308 {
309 if (fTracker) fTracker->ResetDetectorDigits(fDigitsQAList[spec]);
310 if (fTrigger) fTrigger->ResetDetectorDigits(fDigitsQAList[spec]);
311 }
312 else
313 {
b3d57767 314 AliFatal(Form("Not implemented for task %s",AliQAv1::GetTaskName(task).Data()));
152fe71e 315 }
316 }
317}
318
319//____________________________________________________________________________
04236e67 320void AliMUONQADataMakerRec::StartOfDetectorCycle()
321{
92664bc8 322 /// Detector specific actions at start of cycle
323
df48c8a4 324}