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