2 //**************************************************************************
3 //* This file is property of and copyright by the ALICE HLT Project *
4 //* ALICE Experiment at CERN, All rights reserved. *
6 //* Primary Authors: Piergiorgio Cerello <cerello@to.infn.it> *
7 //* for The ALICE HLT Project. *
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 //**************************************************************************
18 /// @file AliHLTITSQHistoComponent.cxx
19 /// @author Piergiorgio Cerello cerello@to.infn.it
21 /// @brief Interface component to the ITS QA
23 #include "AliHLTITSQAComponent.h"
24 #include "AliHLTITSClusterDataFormat.h"
25 #include "AliCDBEntry.h"
26 #include "AliCDBManager.h"
27 #include "AliITSRecPoint.h"
30 #include "TObjString.h"
31 #include "TObjArray.h"
38 /** ROOT macro for the implementation of ROOT specific class methods */
39 ClassImp(AliHLTITSQAComponent)
41 AliHLTITSQAComponent::AliHLTITSQAComponent()
43 fAliITSQADataMakerRec(NULL)
45 // see header file for class documentation
47 // refer to README to build package
49 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
53 AliHLTITSQAComponent::~AliHLTITSQAComponent()
55 // see header file for class documentation
58 // Public functions to implement AliHLTComponent's interface.
59 // These functions are required for the registration process
61 const char* AliHLTITSQAComponent::GetComponentID()
63 // see header file for class documentation
65 return "ITSClusterQA";
68 void AliHLTITSQAComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
70 // see header file for class documentation
72 list.push_back( kAliHLTDataTypeTObjArray );
75 AliHLTComponentDataType AliHLTITSQAComponent::GetOutputDataType()
77 // see header file for class documentation
78 return kAliHLTDataTypeHistogram;
82 void AliHLTITSQAComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
84 // see header file for class documentation
85 // XXX TODO: Find more realistic values.
90 AliHLTComponent* AliHLTITSQAComponent::Spawn()
92 // see header file for class documentation
93 return new AliHLTITSQAComponent;
96 int AliHLTITSQAComponent::DoInit( int argc, const char** argv )
98 // add AliITSQADataMakerRec constructor
99 fAliITSQADataMakerRec = new AliITSQADataMakerRec();
101 TString configuration="";
103 for (int i=0; i<argc && iResult>=0; i++) {
105 if (!configuration.IsNull()) configuration+=" ";
106 configuration+=argument;
109 if (!configuration.IsNull()) {
110 iResult=Configure(configuration.Data());
116 int AliHLTITSQAComponent::DoDeinit()
118 // see header file for class documentation
119 // add AliITSQADataMakerRec destruction
120 if(fAliITSQADataMakerRec) delete fAliITSQADataMakerRec;
124 int AliHLTITSQAComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
127 int TotalSpacePoint = 0;
129 const AliHLTComponentBlockData* iter = NULL;
135 // Check id histograms already created for this Event Specie
136 if ( rp ) { fAliITSQADataMakerRec->InitRecPoints(); rp = 0; }
137 for ( iter = GetFirstInputBlock(kAliHLTDataTypeClusters|kAliHLTDataOriginITSSSD); iter != NULL; iter = GetNextInputBlock() ) {
139 const AliHLTITSClusterData* clusterData = (const AliHLTITSClusterData*) iter->fPtr;
140 Int_t nSpacepoint = (Int_t) clusterData->fSpacePointCnt;
141 TotalSpacePoint += nSpacepoint;
142 AliHLTITSSpacePointData *clusters = (AliHLTITSSpacePointData*) clusterData->fSpacePoints;
144 for(int i=0;i<nSpacepoint;i++){
145 Int_t lab[4]={0,0,0,0};
146 Float_t hit[6]={0,0,0,0,0,0};
147 Int_t info[3]={0,0,0};
149 lab[0]=clusters[i].fTracks[0];
150 lab[1]=clusters[i].fTracks[1];
151 lab[2]=clusters[i].fTracks[2];
152 lab[3]=clusters[i].fIndex;
153 hit[0]=clusters[i].fY;
154 hit[1]=clusters[i].fZ;
155 hit[2]=clusters[i].fSigmaY2;
156 hit[3]=clusters[i].fSigmaZ2;
157 hit[4]=clusters[i].fQ;
158 hit[5]=clusters[i].fSigmaYZ;
159 info[0]=clusters[i].fNy;
160 info[1]=clusters[i].fNz;
161 info[2]=clusters[i].fLayer;
163 AliITSRecPoint recpoint(lab,hit,info);
164 fAliITSQADataMakerRec->FillRecPoint(recpoint);
167 for(Int_t i=0; i<6; i++) {
169 AliHLTUInt32_t specification = 0x0;
170 PushBack( (TObject*) fAliITSQADataMakerRec->GetITSGlobalHisto(i),kAliHLTDataTypeHistogram,specification);
173 HLTInfo("ITSClusterHisto found %d Total Spacepoints", TotalSpacePoint);
178 int AliHLTITSQAComponent::Configure(const char* arguments)
183 if (!arguments) return iResult;
185 TString allArgs=arguments;
188 TObjArray* pTokens=allArgs.Tokenize(" ");
191 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
192 argument=((TObjString*)pTokens->At(i))->GetString();
193 if (argument.IsNull()) continue;
195 if (argument.CompareTo("-plot-all")==0) {
196 HLTInfo("Ploting all historgams");
202 else if (argument.CompareTo("-plot-xy")==0) {
203 HLTInfo("Ploting Global XY");
208 else if (argument.CompareTo("-plot-xyz")==0) {
209 HLTInfo("Ploting Global XYZ");
213 else if (argument.CompareTo("-plot-charge")==0) {
214 HLTInfo("Ploting charge of clusters");
220 HLTError("unknown argument %s", argument.Data());
231 int AliHLTITSQAComponent::Reconfigure(const char* cdbEntry, const char* chainId)
233 // see header file for class documentation
236 const char* path="HLT/ConfigITS/HistoComponent";
237 const char* defaultNotify="";
240 defaultNotify=" (default)";
243 HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
244 AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path);
246 TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
248 HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
249 iResult=Configure(pString->GetString().Data());
251 HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
254 HLTError("can not fetch object \"%s\" from CDB", path);