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"
35 /** ROOT macro for the implementation of ROOT specific class methods */
36 ClassImp(AliHLTQADataMakerRec)
38 AliHLTQADataMakerRec::AliHLTQADataMakerRec()
39 : AliHLTQADataMakerBase()
43 // see header file for class documentation
45 // refer to README to build package
47 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
52 AliHLTQADataMakerRec::~AliHLTQADataMakerRec()
54 // see header file for class documentation
57 int AliHLTQADataMakerRec::LoadAgents()
59 // iterate over available agents and query class names of plugins
61 for (AliHLTModuleAgent* pAgent=AliHLTModuleAgent::GetFirstAgent();
63 pAgent=AliHLTModuleAgent::GetNextAgent()) {
64 const char* modulePlugins=pAgent->GetQAPlugins();
65 if (!modulePlugins || !modulePlugins[0]) continue;
66 if (!plugins.IsNull() && !plugins.EndsWith(" ")) plugins+=" ";
67 plugins+=modulePlugins;
69 if (!plugins.IsNull()) return LoadPlugins(plugins);
73 int AliHLTQADataMakerRec::LoadPlugins(const char* plugins)
75 // load plugins from list of blank separated class names
77 TString strPlugins=plugins;
78 TObjArray* tokens=strPlugins.Tokenize(" ");
82 while ((obj=next())) {
83 if (obj->IsA()!=TObjString::Class()) continue;
84 AliHLTQADataMakerBase* plugin=AliHLTMisc::LoadInstance((AliHLTQADataMakerBase*)0,
85 dynamic_cast<TObjString*>(obj)->GetString().Data());
86 if (!plugin) continue;
87 AliInfo(Form("using HLT QA plugin %s", plugin->IsA()->GetName()));
95 void AliHLTQADataMakerRec::StartOfDetectorCycle()
97 // see header file for class documentation
99 // this function is called multiple times by the framework, actually for every QA task
100 // however, here we don't have any argument for the task
101 // this class is initialized right before StartOfDetectorCycle is called, and depending
102 // on the availibility of thr histogram arrays one can tell where we are ;-)
104 if (fDigitsQAList!=NULL && (fFlags&kDigitsListInit)==0) {
105 init|=kDigitsListInit; // indicate that plugins should be initialized for that task
106 fFlags|=kDigitsListInit; // indicate that it was initialized
108 if (fESDsQAList!=NULL && (fFlags&kESDsListInit)==0) {
109 init|=kESDsListInit; // indicate that plugins should be initialized for that task
110 fFlags|=kESDsListInit; // indicate that it was initialized
112 if (fRawsQAList!=NULL && (fFlags&kRawsListInit)==0) {
113 init|=kRawsListInit; // indicate that plugins should be initialized for that task
114 fFlags|=kRawsListInit; // indicate that it was initialized
116 if (fRecPointsQAList!=NULL && (fFlags&kRecPointsListInit)==0) {
117 init|=kRecPointsListInit; // indicate that plugins should be initialized for that task
118 fFlags|=kRecPointsListInit; // indicate that it was initialized
121 TIter next(&fPlugins);
123 while ((obj=next())) {
124 AliHLTQADataMakerBase* plugin=dynamic_cast<AliHLTQADataMakerBase*>(obj);
125 if (!plugin) continue;
126 // transfer the properties set in AliQAManager::GetQADataMaker to the plugin
127 plugin->SetName(GetName());
128 plugin->SetUniqueID(GetUniqueID());
129 if (init&kDigitsListInit) plugin->Init(AliQAv1::GetTaskIndex("Digits"), 0);
130 if (init&kESDsListInit) plugin->Init(AliQAv1::GetTaskIndex("ESDs"), 0);
131 if (init&kRawsListInit) plugin->Init(AliQAv1::GetTaskIndex("Raws"), 0);
132 if (init&kRecPointsListInit) plugin->Init(AliQAv1::GetTaskIndex("RecPoints"), 0);
133 plugin->StartOfDetectorCycle();
137 void AliHLTQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray** list)
139 // see header file for class documentation
140 TIter next(&fPlugins);
142 while ((obj=next())) {
143 AliHLTQADataMakerBase* plugin=dynamic_cast<AliHLTQADataMakerBase*>(obj);
144 if (!plugin) continue;
145 plugin->SetEventSpecie(GetEventSpecie());
147 TObjArray** pluginList=NULL;
148 if (task==AliQAv1::kESDS) {
149 pluginList=plugin->GetESDsQAList();
150 } else if (task==AliQAv1::kRECPOINTS) {
151 pluginList=plugin->GetRecPointsQAList();
152 } else if (task==AliQAv1::kDIGITS) {
153 pluginList=plugin->GetDigitsQAList();
154 } else if (task==AliQAv1::kRAWS) {
155 pluginList=plugin->GetRawsQAList();
159 plugin->EndOfDetectorCycle(task, pluginList);
160 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
161 if (!pluginList[specie]) continue;
162 TIter nextentry(pluginList[specie]);
164 while ((entry=nextentry())) {
165 AliInfo(Form("cloning histogram %s for specie %d", entry->GetName(), specie));
166 list[specie]->Add(entry->Clone());
174 void AliHLTQADataMakerRec::MakeRaws(AliRawReader * rawReader)
176 // see header file for class documentation
177 if (!rawReader) return;
179 TIter next(&fPlugins);
181 while ((obj=next())) {
182 AliHLTQADataMakerBase* plugin=dynamic_cast<AliHLTQADataMakerBase*>(obj);
183 if (!plugin) continue;
184 plugin->SetEventSpecie(GetEventSpecie());
185 plugin->MakeRaws(rawReader);
189 void AliHLTQADataMakerRec::MakeESDs(AliESDEvent * esd, AliESDEvent* hltesd)
192 TIter next(&fPlugins);
194 while ((obj=next())) {
195 AliHLTQADataMakerBase* plugin=dynamic_cast<AliHLTQADataMakerBase*>(obj);
196 if (!plugin) continue;
197 plugin->SetEventSpecie(GetEventSpecie());
198 plugin->MakeESDs(esd, hltesd);