]>
Commit | Line | Data |
---|---|---|
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 | ||
c75023e6 | 19 | /// @file AliHLTQADataMakerRec.cxx |
20 | /// @author Matthias Richter | |
21 | /// @date 2010-03-10 | |
22 | /// @brief Steering class for the HLT offline QA | |
23 | /// | |
72eec123 | 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 | |
34 | using namespace std; | |
35 | ||
36 | /** ROOT macro for the implementation of ROOT specific class methods */ | |
37 | ClassImp(AliHLTQADataMakerRec) | |
38 | ||
39 | AliHLTQADataMakerRec::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 | ||
53 | AliHLTQADataMakerRec::~AliHLTQADataMakerRec() | |
54 | { | |
55 | // see header file for class documentation | |
56 | } | |
57 | ||
58 | int 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 | ||
74 | int 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())) { | |
c75023e6 | 84 | TObjString* objstring=dynamic_cast<TObjString*>(obj); |
85 | if (!objstring) continue; | |
72eec123 | 86 | AliHLTQADataMakerBase* plugin=AliHLTMisc::LoadInstance((AliHLTQADataMakerBase*)0, |
c75023e6 | 87 | objstring->GetString().Data()); |
72eec123 | 88 | if (!plugin) continue; |
89 | AliInfo(Form("using HLT QA plugin %s", plugin->IsA()->GetName())); | |
90 | fPlugins.Add(plugin); | |
91 | } | |
92 | delete tokens; | |
93 | } | |
94 | return iResult; | |
95 | } | |
96 | ||
97 | void AliHLTQADataMakerRec::StartOfDetectorCycle() | |
98 | { | |
99 | // see header file for class documentation | |
100 | ||
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 ;-) | |
105 | unsigned init=0; | |
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 | |
109 | } | |
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 | |
113 | } | |
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 | |
117 | } | |
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 | |
121 | } | |
122 | ||
123 | TIter next(&fPlugins); | |
124 | TObject* obj=NULL; | |
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(); | |
136 | } | |
137 | } | |
138 | ||
139 | void AliHLTQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray** list) | |
140 | { | |
141 | // see header file for class documentation | |
142 | TIter next(&fPlugins); | |
143 | TObject* obj=NULL; | |
2348e22d | 144 | TDirectory* dirBackup=gDirectory; |
145 | gDirectory=NULL; | |
72eec123 | 146 | while ((obj=next())) { |
147 | AliHLTQADataMakerBase* plugin=dynamic_cast<AliHLTQADataMakerBase*>(obj); | |
148 | if (!plugin) continue; | |
149 | plugin->SetEventSpecie(GetEventSpecie()); | |
150 | ||
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(); | |
160 | } | |
161 | ||
162 | if (pluginList) { | |
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]); | |
167 | TObject* entry=NULL; | |
168 | while ((entry=nextentry())) { | |
169 | AliInfo(Form("cloning histogram %s for specie %d", entry->GetName(), specie)); | |
170 | list[specie]->Add(entry->Clone()); | |
171 | } | |
172 | } | |
173 | } | |
174 | } | |
2348e22d | 175 | gDirectory=dirBackup; |
72eec123 | 176 | } |
177 | ||
178 | void AliHLTQADataMakerRec::MakeRaws(AliRawReader * rawReader) | |
179 | { | |
180 | // see header file for class documentation | |
181 | if (!rawReader) return; | |
182 | ||
183 | TIter next(&fPlugins); | |
184 | TObject* obj=NULL; | |
185 | while ((obj=next())) { | |
186 | AliHLTQADataMakerBase* plugin=dynamic_cast<AliHLTQADataMakerBase*>(obj); | |
187 | if (!plugin) continue; | |
188 | plugin->SetEventSpecie(GetEventSpecie()); | |
189 | plugin->MakeRaws(rawReader); | |
190 | } | |
191 | } | |
192 | ||
193 | void AliHLTQADataMakerRec::MakeESDs(AliESDEvent * esd, AliESDEvent* hltesd) | |
194 | { | |
195 | // HLT QA on ESDs | |
196 | TIter next(&fPlugins); | |
197 | TObject* obj=NULL; | |
198 | while ((obj=next())) { | |
199 | AliHLTQADataMakerBase* plugin=dynamic_cast<AliHLTQADataMakerBase*>(obj); | |
200 | if (!plugin) continue; | |
201 | plugin->SetEventSpecie(GetEventSpecie()); | |
202 | plugin->MakeESDs(esd, hltesd); | |
203 | } | |
204 | } |