]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/QA/AliHLTQADataMakerRec.cxx
Created more pads on QA plot
[u/mrichter/AliRoot.git] / HLT / QA / AliHLTQADataMakerRec.cxx
CommitLineData
72eec123 1// $Id$
2
3//**************************************************************************
4//* This file is property of and copyright by the ALICE HLT Project *
5//* ALICE Experiment at CERN, All rights reserved. *
6//* *
7//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8//* for The ALICE HLT Project. *
9//* *
10//* Permission to use, copy, modify and distribute this software and its *
11//* documentation strictly for non-commercial purposes is hereby granted *
12//* without fee, provided that the above copyright notice appears in all *
13//* copies and that both the copyright notice and this permission notice *
14//* appear in the supporting documentation. The authors make no claims *
15//* about the suitability of this software for any purpose. It is *
16//* provided "as is" without express or implied warranty. *
17//**************************************************************************
18
19/** @file AliHLTQADataMakerRec.cxx
20 @author Matthias Richter
21 @date 2010-03-10
22 @brief Steering class for the HLT offline QA
23*/
24#include "AliHLTQADataMakerRec.h"
25#include "AliHLTMisc.h"
26#include "AliHLTModuleAgent.h"
27#include "AliRecoParam.h"
28#include <iostream>
29#include "TString.h"
30#include "TObjString.h"
31#include "TObjArray.h"
2348e22d 32#include "TDirectory.h"
72eec123 33
34using namespace std;
35
36/** ROOT macro for the implementation of ROOT specific class methods */
37ClassImp(AliHLTQADataMakerRec)
38
39AliHLTQADataMakerRec::AliHLTQADataMakerRec()
40 : AliHLTQADataMakerBase()
41 , fPlugins()
42 , fFlags(0)
43{
44 // see header file for class documentation
45 // or
46 // refer to README to build package
47 // or
48 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
49
50 LoadAgents();
51}
52
53AliHLTQADataMakerRec::~AliHLTQADataMakerRec()
54{
55 // see header file for class documentation
56}
57
58int AliHLTQADataMakerRec::LoadAgents()
59{
60 // iterate over available agents and query class names of plugins
61 TString plugins;
62 for (AliHLTModuleAgent* pAgent=AliHLTModuleAgent::GetFirstAgent();
63 pAgent!=NULL;
64 pAgent=AliHLTModuleAgent::GetNextAgent()) {
65 const char* modulePlugins=pAgent->GetQAPlugins();
66 if (!modulePlugins || !modulePlugins[0]) continue;
67 if (!plugins.IsNull() && !plugins.EndsWith(" ")) plugins+=" ";
68 plugins+=modulePlugins;
69 }
70 if (!plugins.IsNull()) return LoadPlugins(plugins);
71 return 0;
72}
73
74int AliHLTQADataMakerRec::LoadPlugins(const char* plugins)
75{
76 // load plugins from list of blank separated class names
77 int iResult=0;
78 TString strPlugins=plugins;
79 TObjArray* tokens=strPlugins.Tokenize(" ");
80 if (tokens) {
81 TIter next(tokens);
82 TObject* obj=NULL;
83 while ((obj=next())) {
84 if (obj->IsA()!=TObjString::Class()) continue;
85 AliHLTQADataMakerBase* plugin=AliHLTMisc::LoadInstance((AliHLTQADataMakerBase*)0,
86 dynamic_cast<TObjString*>(obj)->GetString().Data());
87 if (!plugin) continue;
88 AliInfo(Form("using HLT QA plugin %s", plugin->IsA()->GetName()));
89 fPlugins.Add(plugin);
90 }
91 delete tokens;
92 }
93 return iResult;
94}
95
96void AliHLTQADataMakerRec::StartOfDetectorCycle()
97{
98 // see header file for class documentation
99
100 // this function is called multiple times by the framework, actually for every QA task
101 // however, here we don't have any argument for the task
102 // this class is initialized right before StartOfDetectorCycle is called, and depending
103 // on the availibility of thr histogram arrays one can tell where we are ;-)
104 unsigned init=0;
105 if (fDigitsQAList!=NULL && (fFlags&kDigitsListInit)==0) {
106 init|=kDigitsListInit; // indicate that plugins should be initialized for that task
107 fFlags|=kDigitsListInit; // indicate that it was initialized
108 }
109 if (fESDsQAList!=NULL && (fFlags&kESDsListInit)==0) {
110 init|=kESDsListInit; // indicate that plugins should be initialized for that task
111 fFlags|=kESDsListInit; // indicate that it was initialized
112 }
113 if (fRawsQAList!=NULL && (fFlags&kRawsListInit)==0) {
114 init|=kRawsListInit; // indicate that plugins should be initialized for that task
115 fFlags|=kRawsListInit; // indicate that it was initialized
116 }
117 if (fRecPointsQAList!=NULL && (fFlags&kRecPointsListInit)==0) {
118 init|=kRecPointsListInit; // indicate that plugins should be initialized for that task
119 fFlags|=kRecPointsListInit; // indicate that it was initialized
120 }
121
122 TIter next(&fPlugins);
123 TObject* obj=NULL;
124 while ((obj=next())) {
125 AliHLTQADataMakerBase* plugin=dynamic_cast<AliHLTQADataMakerBase*>(obj);
126 if (!plugin) continue;
127 // transfer the properties set in AliQAManager::GetQADataMaker to the plugin
128 plugin->SetName(GetName());
129 plugin->SetUniqueID(GetUniqueID());
130 if (init&kDigitsListInit) plugin->Init(AliQAv1::GetTaskIndex("Digits"), 0);
131 if (init&kESDsListInit) plugin->Init(AliQAv1::GetTaskIndex("ESDs"), 0);
132 if (init&kRawsListInit) plugin->Init(AliQAv1::GetTaskIndex("Raws"), 0);
133 if (init&kRecPointsListInit) plugin->Init(AliQAv1::GetTaskIndex("RecPoints"), 0);
134 plugin->StartOfDetectorCycle();
135 }
136}
137
138void AliHLTQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray** list)
139{
140 // see header file for class documentation
141 TIter next(&fPlugins);
142 TObject* obj=NULL;
2348e22d 143 TDirectory* dirBackup=gDirectory;
144 gDirectory=NULL;
72eec123 145 while ((obj=next())) {
146 AliHLTQADataMakerBase* plugin=dynamic_cast<AliHLTQADataMakerBase*>(obj);
147 if (!plugin) continue;
148 plugin->SetEventSpecie(GetEventSpecie());
149
150 TObjArray** pluginList=NULL;
151 if (task==AliQAv1::kESDS) {
152 pluginList=plugin->GetESDsQAList();
153 } else if (task==AliQAv1::kRECPOINTS) {
154 pluginList=plugin->GetRecPointsQAList();
155 } else if (task==AliQAv1::kDIGITS) {
156 pluginList=plugin->GetDigitsQAList();
157 } else if (task==AliQAv1::kRAWS) {
158 pluginList=plugin->GetRawsQAList();
159 }
160
161 if (pluginList) {
162 plugin->EndOfDetectorCycle(task, pluginList);
163 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
164 if (!pluginList[specie]) continue;
165 TIter nextentry(pluginList[specie]);
166 TObject* entry=NULL;
167 while ((entry=nextentry())) {
168 AliInfo(Form("cloning histogram %s for specie %d", entry->GetName(), specie));
169 list[specie]->Add(entry->Clone());
170 }
171 }
172 }
173 }
2348e22d 174 gDirectory=dirBackup;
72eec123 175}
176
177void AliHLTQADataMakerRec::MakeRaws(AliRawReader * rawReader)
178{
179 // see header file for class documentation
180 if (!rawReader) return;
181
182 TIter next(&fPlugins);
183 TObject* obj=NULL;
184 while ((obj=next())) {
185 AliHLTQADataMakerBase* plugin=dynamic_cast<AliHLTQADataMakerBase*>(obj);
186 if (!plugin) continue;
187 plugin->SetEventSpecie(GetEventSpecie());
188 plugin->MakeRaws(rawReader);
189 }
190}
191
192void AliHLTQADataMakerRec::MakeESDs(AliESDEvent * esd, AliESDEvent* hltesd)
193{
194 // HLT QA on ESDs
195 TIter next(&fPlugins);
196 TObject* obj=NULL;
197 while ((obj=next())) {
198 AliHLTQADataMakerBase* plugin=dynamic_cast<AliHLTQADataMakerBase*>(obj);
199 if (!plugin) continue;
200 plugin->SetEventSpecie(GetEventSpecie());
201 plugin->MakeESDs(esd, hltesd);
202 }
203}