]>
Commit | Line | Data |
---|---|---|
1fe3ca76 | 1 | // $Id$ |
2 | //************************************************************************** | |
3 | //* This file is property of and copyright by the ALICE HLT Project * | |
4 | //* ALICE Experiment at CERN, All rights reserved. * | |
5 | //* * | |
6 | //* Primary Authors: Piergiorgio Cerello <cerello@to.infn.it> * | |
7 | //* for The ALICE HLT Project. * | |
8 | //* * | |
9 | //* Permission to use, copy, modify and distribute this software and its * | |
10 | //* documentation strictly for non-commercial purposes is hereby granted * | |
11 | //* without fee, provided that the above copyright notice appears in all * | |
12 | //* copies and that both the copyright notice and this permission notice * | |
13 | //* appear in the supporting documentation. The authors make no claims * | |
14 | //* about the suitability of this software for any purpose. It is * | |
15 | //* provided "as is" without express or implied warranty. * | |
16 | //************************************************************************** | |
17 | ||
18 | /// @file AliHLTITSQHistoComponent.cxx | |
19 | /// @author Piergiorgio Cerello cerello@to.infn.it | |
20 | /// @date 2009-07-03 | |
21 | /// @brief Interface component to the ITS QA | |
22 | ||
23 | #if __GNUC__>= 3 | |
24 | using namespace std; | |
25 | #endif | |
26 | ||
27 | #include "AliHLTITSQAComponent.h" | |
28 | #include "AliHLTITSClusterDataFormat.h" | |
29 | #include "AliCDBEntry.h" | |
30 | #include "AliCDBManager.h" | |
31 | #include "AliITSRecPoint.h" | |
32 | #include <TFile.h> | |
33 | #include <TString.h> | |
34 | #include "TObjString.h" | |
35 | #include "TObjArray.h" | |
36 | ||
37 | ||
38 | //#include <stdlib.h> | |
39 | //#include <cerrno> | |
40 | ||
41 | /** ROOT macro for the implementation of ROOT specific class methods */ | |
42 | ClassImp(AliHLTITSQAComponent) | |
43 | ||
44 | AliHLTITSQAComponent::AliHLTITSQAComponent() | |
45 | : | |
46 | fAliITSQADataMakerRec(NULL) | |
47 | { | |
48 | // see header file for class documentation | |
49 | // or | |
50 | // refer to README to build package | |
51 | // or | |
52 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
53 | ||
54 | } | |
55 | ||
56 | AliHLTITSQAComponent::~AliHLTITSQAComponent() | |
57 | { | |
58 | // see header file for class documentation | |
59 | } | |
60 | ||
61 | // Public functions to implement AliHLTComponent's interface. | |
62 | // These functions are required for the registration process | |
63 | ||
64 | const char* AliHLTITSQAComponent::GetComponentID() | |
65 | { | |
66 | // see header file for class documentation | |
67 | ||
68 | return "ITSClusterQA"; | |
69 | } | |
70 | ||
71 | void AliHLTITSQAComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list) | |
72 | { | |
73 | // see header file for class documentation | |
74 | list.clear(); | |
75 | list.push_back( kAliHLTDataTypeTObjArray ); | |
76 | } | |
77 | ||
78 | AliHLTComponentDataType AliHLTITSQAComponent::GetOutputDataType() | |
79 | { | |
80 | // see header file for class documentation | |
81 | return kAliHLTDataTypeHistogram; | |
82 | ||
83 | } | |
84 | ||
85 | void AliHLTITSQAComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) | |
86 | { | |
87 | // see header file for class documentation | |
88 | // XXX TODO: Find more realistic values. | |
89 | constBase = 80000; | |
90 | inputMultiplier = 10; | |
91 | } | |
92 | ||
93 | AliHLTComponent* AliHLTITSQAComponent::Spawn() | |
94 | { | |
95 | // see header file for class documentation | |
96 | return new AliHLTITSQAComponent; | |
97 | } | |
98 | ||
99 | int AliHLTITSQAComponent::DoInit( int argc, const char** argv ) | |
100 | { | |
101 | // add AliITSQADataMakerRec constructor | |
102 | fAliITSQADataMakerRec = new AliITSQADataMakerRec(); | |
103 | int iResult=0; | |
104 | TString configuration=""; | |
105 | TString argument=""; | |
106 | for (int i=0; i<argc && iResult>=0; i++) { | |
107 | argument=argv[i]; | |
108 | if (!configuration.IsNull()) configuration+=" "; | |
109 | configuration+=argument; | |
110 | } | |
111 | ||
112 | if (!configuration.IsNull()) { | |
113 | iResult=Configure(configuration.Data()); | |
114 | } | |
115 | ||
116 | return iResult; | |
117 | } | |
118 | ||
119 | int AliHLTITSQAComponent::DoDeinit() | |
120 | { | |
121 | // see header file for class documentation | |
122 | // add AliITSQADataMakerRec destruction | |
123 | if(fAliITSQADataMakerRec) delete fAliITSQADataMakerRec; | |
124 | return 0; | |
125 | } | |
126 | ||
127 | int AliHLTITSQAComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/) | |
128 | { | |
129 | ||
130 | int TotalSpacePoint = 0; | |
131 | ||
132 | const AliHLTComponentBlockData* iter = NULL; | |
133 | ||
134 | if(!IsDataEvent()) | |
135 | return 0; | |
136 | ||
137 | static Int_t rp = 1; | |
138 | // Check id histograms already created for this Event Specie | |
139 | if ( rp ) { fAliITSQADataMakerRec->InitRecPoints(); rp = 0; } | |
140 | for ( iter = GetFirstInputBlock(kAliHLTDataTypeClusters|kAliHLTDataOriginITSSSD); iter != NULL; iter = GetNextInputBlock() ) { | |
141 | ||
142 | const AliHLTITSClusterData* clusterData = (const AliHLTITSClusterData*) iter->fPtr; | |
143 | Int_t nSpacepoint = (Int_t) clusterData->fSpacePointCnt; | |
144 | TotalSpacePoint += nSpacepoint; | |
145 | AliHLTITSSpacePointData *clusters = (AliHLTITSSpacePointData*) clusterData->fSpacePoints; | |
146 | ||
147 | for(int i=0;i<nSpacepoint;i++){ | |
148 | Int_t lab[4]={0,0,0,0}; | |
149 | Float_t hit[6]={0,0,0,0,0,0}; | |
150 | Int_t info[3]={0,0,0}; | |
151 | ||
152 | lab[0]=clusters[i].fTracks[0]; | |
153 | lab[1]=clusters[i].fTracks[1]; | |
154 | lab[2]=clusters[i].fTracks[2]; | |
155 | lab[3]=clusters[i].fIndex; | |
156 | hit[0]=clusters[i].fY; | |
157 | hit[1]=clusters[i].fZ; | |
158 | hit[2]=clusters[i].fSigmaY2; | |
159 | hit[3]=clusters[i].fSigmaZ2; | |
160 | hit[4]=clusters[i].fQ; | |
161 | hit[5]=clusters[i].fSigmaYZ; | |
162 | info[0]=clusters[i].fNy; | |
163 | info[1]=clusters[i].fNz; | |
164 | info[2]=clusters[i].fLayer; | |
165 | ||
166 | AliITSRecPoint recpoint(lab,hit,info); | |
64f27b26 | 167 | fAliITSQADataMakerRec->FillRecPoint(recpoint); |
1fe3ca76 | 168 | } |
169 | } | |
170 | for(Int_t i=0; i<6; i++) { | |
171 | //if(fPlotCharge){ | |
64f27b26 | 172 | AliHLTUInt32_t specification = 0x0; |
173 | PushBack( (TObject*) fAliITSQADataMakerRec->GetITSGlobalHisto(i),kAliHLTDataTypeHistogram,specification); | |
1fe3ca76 | 174 | //} |
175 | } | |
176 | HLTInfo("ITSClusterHisto found %d Total Spacepoints", TotalSpacePoint); | |
177 | ||
178 | return 0; | |
179 | } | |
180 | ||
181 | int AliHLTITSQAComponent::Configure(const char* arguments) | |
182 | { | |
183 | ||
184 | int iResult=0; | |
185 | ||
186 | if (!arguments) return iResult; | |
187 | ||
188 | TString allArgs=arguments; | |
189 | TString argument; | |
190 | ||
191 | TObjArray* pTokens=allArgs.Tokenize(" "); | |
192 | ||
193 | if (pTokens) { | |
194 | for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) { | |
195 | argument=((TObjString*)pTokens->At(i))->GetString(); | |
196 | if (argument.IsNull()) continue; | |
197 | /* | |
198 | if (argument.CompareTo("-plot-all")==0) { | |
199 | HLTInfo("Ploting all historgams"); | |
200 | fPlotXY = kTRUE; | |
201 | fPlotXYZ = kTRUE; | |
202 | fPlotCharge = kTRUE; | |
203 | continue; | |
204 | } | |
205 | else if (argument.CompareTo("-plot-xy")==0) { | |
206 | HLTInfo("Ploting Global XY"); | |
207 | fPlotXY = kTRUE; | |
208 | continue; | |
209 | } | |
210 | ||
211 | else if (argument.CompareTo("-plot-xyz")==0) { | |
212 | HLTInfo("Ploting Global XYZ"); | |
213 | //fPlotXYZ = kTRUE; | |
214 | continue; | |
215 | } | |
216 | else if (argument.CompareTo("-plot-charge")==0) { | |
217 | HLTInfo("Ploting charge of clusters"); | |
218 | fPlotCharge = kTRUE; | |
219 | continue; | |
220 | } | |
221 | */ | |
222 | else { | |
223 | HLTError("unknown argument %s", argument.Data()); | |
224 | iResult=-EINVAL; | |
225 | break; | |
226 | } | |
227 | } | |
228 | delete pTokens; | |
229 | } | |
230 | ||
231 | return iResult; | |
232 | } | |
233 | ||
234 | int AliHLTITSQAComponent::Reconfigure(const char* cdbEntry, const char* chainId) | |
235 | { | |
236 | // see header file for class documentation | |
237 | int iResult=0; | |
238 | ||
239 | const char* path="HLT/ConfigITS/HistoComponent"; | |
240 | const char* defaultNotify=""; | |
241 | if (cdbEntry) { | |
242 | path=cdbEntry; | |
243 | defaultNotify=" (default)"; | |
244 | } | |
245 | if (path) { | |
246 | HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>"); | |
247 | AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path); | |
248 | if (pEntry) { | |
249 | TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject()); | |
250 | if (pString) { | |
251 | HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data()); | |
252 | iResult=Configure(pString->GetString().Data()); | |
253 | } else { | |
254 | HLTError("configuration object \"%s\" has wrong type, required TObjString", path); | |
255 | } | |
256 | } else { | |
257 | HLTError("can not fetch object \"%s\" from CDB", path); | |
258 | } | |
259 | } | |
260 | ||
261 | return iResult; | |
262 | } |