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
27 #include "AliHLTITSQAComponent.h"
28 #include "AliHLTITSClusterDataFormat.h"
29 #include "AliCDBEntry.h"
30 #include "AliCDBManager.h"
31 #include "AliITSRecPoint.h"
34 #include "TObjString.h"
35 #include "TObjArray.h"
41 /** ROOT macro for the implementation of ROOT specific class methods */
42 ClassImp(AliHLTITSQAComponent)
44 AliHLTITSQAComponent::AliHLTITSQAComponent()
46 fAliITSQADataMakerRec(NULL)
48 // see header file for class documentation
50 // refer to README to build package
52 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
56 AliHLTITSQAComponent::~AliHLTITSQAComponent()
58 // see header file for class documentation
61 // Public functions to implement AliHLTComponent's interface.
62 // These functions are required for the registration process
64 const char* AliHLTITSQAComponent::GetComponentID()
66 // see header file for class documentation
68 return "ITSClusterQA";
71 void AliHLTITSQAComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
73 // see header file for class documentation
75 list.push_back( kAliHLTDataTypeTObjArray );
78 AliHLTComponentDataType AliHLTITSQAComponent::GetOutputDataType()
80 // see header file for class documentation
81 return kAliHLTDataTypeHistogram;
85 void AliHLTITSQAComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
87 // see header file for class documentation
88 // XXX TODO: Find more realistic values.
93 AliHLTComponent* AliHLTITSQAComponent::Spawn()
95 // see header file for class documentation
96 return new AliHLTITSQAComponent;
99 int AliHLTITSQAComponent::DoInit( int argc, const char** argv )
101 // add AliITSQADataMakerRec constructor
102 fAliITSQADataMakerRec = new AliITSQADataMakerRec();
104 TString configuration="";
106 for (int i=0; i<argc && iResult>=0; i++) {
108 if (!configuration.IsNull()) configuration+=" ";
109 configuration+=argument;
112 if (!configuration.IsNull()) {
113 iResult=Configure(configuration.Data());
119 int AliHLTITSQAComponent::DoDeinit()
121 // see header file for class documentation
122 // add AliITSQADataMakerRec destruction
123 if(fAliITSQADataMakerRec) delete fAliITSQADataMakerRec;
127 int AliHLTITSQAComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
130 int TotalSpacePoint = 0;
132 const AliHLTComponentBlockData* iter = NULL;
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() ) {
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;
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};
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;
166 AliITSRecPoint recpoint(lab,hit,info);
167 fAliITSQADataMakerRec->FillRecPoint(recpoint);
170 for(Int_t i=0; i<6; i++) {
172 AliHLTUInt32_t specification = 0x0;
173 PushBack( (TObject*) fAliITSQADataMakerRec->GetITSGlobalHisto(i),kAliHLTDataTypeHistogram,specification);
176 HLTInfo("ITSClusterHisto found %d Total Spacepoints", TotalSpacePoint);
181 int AliHLTITSQAComponent::Configure(const char* arguments)
186 if (!arguments) return iResult;
188 TString allArgs=arguments;
191 TObjArray* pTokens=allArgs.Tokenize(" ");
194 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
195 argument=((TObjString*)pTokens->At(i))->GetString();
196 if (argument.IsNull()) continue;
198 if (argument.CompareTo("-plot-all")==0) {
199 HLTInfo("Ploting all historgams");
205 else if (argument.CompareTo("-plot-xy")==0) {
206 HLTInfo("Ploting Global XY");
211 else if (argument.CompareTo("-plot-xyz")==0) {
212 HLTInfo("Ploting Global XYZ");
216 else if (argument.CompareTo("-plot-charge")==0) {
217 HLTInfo("Ploting charge of clusters");
223 HLTError("unknown argument %s", argument.Data());
234 int AliHLTITSQAComponent::Reconfigure(const char* cdbEntry, const char* chainId)
236 // see header file for class documentation
239 const char* path="HLT/ConfigITS/HistoComponent";
240 const char* defaultNotify="";
243 defaultNotify=" (default)";
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);
249 TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
251 HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
252 iResult=Configure(pString->GetString().Data());
254 HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
257 HLTError("can not fetch object \"%s\" from CDB", path);