3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 //* for The ALICE HLT Project. *
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 //**************************************************************************
19 /// @file AliHLTQADataMakerRec.cxx
20 /// @author Matthias Richter
22 /// @brief Steering class for the HLT offline QA
24 #include "AliHLTQADataMakerRec.h"
25 #include "AliHLTMisc.h"
26 #include "AliHLTModuleAgent.h"
27 #include "AliRecoParam.h"
30 #include "TObjString.h"
31 #include "TObjArray.h"
32 #include "TDirectory.h"
36 /** ROOT macro for the implementation of ROOT specific class methods */
37 ClassImp(AliHLTQADataMakerRec)
39 AliHLTQADataMakerRec::AliHLTQADataMakerRec()
40 : AliHLTQADataMakerBase()
44 // see header file for class documentation
46 // refer to README to build package
48 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
53 AliHLTQADataMakerRec::~AliHLTQADataMakerRec()
55 // see header file for class documentation
58 int AliHLTQADataMakerRec::LoadAgents()
60 // iterate over available agents and query class names of plugins
62 for (AliHLTModuleAgent* pAgent=AliHLTModuleAgent::GetFirstAgent();
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;
70 if (!plugins.IsNull()) return LoadPlugins(plugins);
74 int AliHLTQADataMakerRec::LoadPlugins(const char* plugins)
76 // load plugins from list of blank separated class names
78 TString strPlugins=plugins;
79 TObjArray* tokens=strPlugins.Tokenize(" ");
83 while ((obj=next())) {
84 TObjString* objstring=dynamic_cast<TObjString*>(obj);
85 if (!objstring) continue;
86 AliHLTQADataMakerBase* plugin=AliHLTMisc::LoadInstance((AliHLTQADataMakerBase*)0,
87 objstring->GetString().Data());
88 if (!plugin) continue;
89 AliInfo(Form("using HLT QA plugin %s", plugin->IsA()->GetName()));
97 void AliHLTQADataMakerRec::StartOfDetectorCycle()
99 // see header file for class documentation
101 // this function is called multiple times by the framework, actually for every QA task
102 // however, here we don't have any argument for the task
103 // this class is initialized right before StartOfDetectorCycle is called, and depending
104 // on the availibility of thr histogram arrays one can tell where we are ;-)
106 if (fDigitsQAList!=NULL && (fFlags&kDigitsListInit)==0) {
107 init|=kDigitsListInit; // indicate that plugins should be initialized for that task
108 fFlags|=kDigitsListInit; // indicate that it was initialized
110 if (fESDsQAList!=NULL && (fFlags&kESDsListInit)==0) {
111 init|=kESDsListInit; // indicate that plugins should be initialized for that task
112 fFlags|=kESDsListInit; // indicate that it was initialized
114 if (fRawsQAList!=NULL && (fFlags&kRawsListInit)==0) {
115 init|=kRawsListInit; // indicate that plugins should be initialized for that task
116 fFlags|=kRawsListInit; // indicate that it was initialized
118 if (fRecPointsQAList!=NULL && (fFlags&kRecPointsListInit)==0) {
119 init|=kRecPointsListInit; // indicate that plugins should be initialized for that task
120 fFlags|=kRecPointsListInit; // indicate that it was initialized
123 TIter next(&fPlugins);
125 while ((obj=next())) {
126 AliHLTQADataMakerBase* plugin=dynamic_cast<AliHLTQADataMakerBase*>(obj);
127 if (!plugin) continue;
128 // transfer the properties set in AliQAManager::GetQADataMaker to the plugin
129 plugin->SetName(GetName());
130 plugin->SetUniqueID(GetUniqueID());
131 if (init&kDigitsListInit) plugin->Init(AliQAv1::GetTaskIndex("Digits"), 0);
132 if (init&kESDsListInit) plugin->Init(AliQAv1::GetTaskIndex("ESDs"), 0);
133 if (init&kRawsListInit) plugin->Init(AliQAv1::GetTaskIndex("Raws"), 0);
134 if (init&kRecPointsListInit) plugin->Init(AliQAv1::GetTaskIndex("RecPoints"), 0);
135 plugin->StartOfDetectorCycle();
139 void AliHLTQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray** list)
141 // see header file for class documentation
142 TIter next(&fPlugins);
144 TDirectory* dirBackup=gDirectory;
146 while ((obj=next())) {
147 AliHLTQADataMakerBase* plugin=dynamic_cast<AliHLTQADataMakerBase*>(obj);
148 if (!plugin) continue;
149 plugin->SetEventSpecie(GetEventSpecie());
151 TObjArray** pluginList=NULL;
152 if (task==AliQAv1::kESDS) {
153 pluginList=plugin->GetESDsQAList();
154 } else if (task==AliQAv1::kRECPOINTS) {
155 pluginList=plugin->GetRecPointsQAList();
156 } else if (task==AliQAv1::kDIGITS) {
157 pluginList=plugin->GetDigitsQAList();
158 } else if (task==AliQAv1::kRAWS) {
159 pluginList=plugin->GetRawsQAList();
163 plugin->EndOfDetectorCycle(task, pluginList);
164 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
165 if (!pluginList[specie]) continue;
166 TIter nextentry(pluginList[specie]);
168 while ((entry=nextentry())) {
169 AliInfo(Form("cloning histogram %s for specie %d", entry->GetName(), specie));
170 list[specie]->Add(entry->Clone());
175 gDirectory=dirBackup;
178 void AliHLTQADataMakerRec::MakeRaws(AliRawReader * rawReader)
180 // see header file for class documentation
181 if (!rawReader) return;
183 TIter next(&fPlugins);
185 while ((obj=next())) {
186 AliHLTQADataMakerBase* plugin=dynamic_cast<AliHLTQADataMakerBase*>(obj);
187 if (!plugin) continue;
188 plugin->SetEventSpecie(GetEventSpecie());
189 plugin->MakeRaws(rawReader);
193 void AliHLTQADataMakerRec::MakeESDs(AliESDEvent * esd, AliESDEvent* hltesd)
196 TIter next(&fPlugins);
198 while ((obj=next())) {
199 AliHLTQADataMakerBase* plugin=dynamic_cast<AliHLTQADataMakerBase*>(obj);
200 if (!plugin) continue;
201 plugin->SetEventSpecie(GetEventSpecie());
202 plugin->MakeESDs(esd, hltesd);