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: Gaute Ovrebekk <ovrebekk@ift.uib.no> *
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 AliHLTTPCClusterHistoComponent.cxx
19 /// @author Gaute Ovrebekk
20 /// @brief Component for ploting charge in clusters
23 #include "AliHLTTPCClusterHistoComponent.h"
24 #include "AliHLTTPCTransform.h"
25 #include "AliHLTTPCClusterDataFormat.h"
26 #include "AliHLTTPCTrackletDataFormat.h"
27 #include "AliHLTTPCDefinitions.h"
28 #include "AliCDBEntry.h"
29 #include "AliCDBManager.h"
32 #include "TObjString.h"
33 #include "TObjArray.h"
35 /** ROOT macro for the implementation of ROOT specific class methods */
36 ClassImp(AliHLTTPCClusterHistoComponent)
38 AliHLTTPCClusterHistoComponent::AliHLTTPCClusterHistoComponent()
40 fTotalClusterChargeOROCAll(NULL),
41 fTotalClusterChargeIROCAll(NULL),
42 fTotalClusterChargeROCSelection(NULL),
43 fTotalClusterChargePartitionSelection(NULL),
44 fQMaxPartitionAll(NULL),
46 fNumberOfClusters(NULL),
47 fPlotChargeOROCAll(kTRUE),
48 fPlotChargeIROCAll(kTRUE),
49 fPlotChargeROCSel(kFALSE),
50 fPlotChargePartSel(kFALSE),
51 fPlotQmaxPartAll(kTRUE),
52 fPlotQmaxROCAll(kTRUE),
55 // see header file for class documentation
57 // refer to README to build package
59 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
63 AliHLTTPCClusterHistoComponent::~AliHLTTPCClusterHistoComponent()
65 // see header file for class documentation
68 // Public functions to implement AliHLTComponent's interface.
69 // These functions are required for the registration process
71 const char* AliHLTTPCClusterHistoComponent::GetComponentID()
73 // see header file for class documentation
75 return "TPCClusterHisto";
78 void AliHLTTPCClusterHistoComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
80 // see header file for class documentation
82 list.push_back( AliHLTTPCDefinitions::fgkClustersDataType );
85 AliHLTComponentDataType AliHLTTPCClusterHistoComponent::GetOutputDataType()
87 // see header file for class documentation
88 return kAliHLTDataTypeHistogram;
92 void AliHLTTPCClusterHistoComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
94 // see header file for class documentation
95 // XXX TODO: Find more realistic values.
100 AliHLTComponent* AliHLTTPCClusterHistoComponent::Spawn()
102 // see header file for class documentation
103 return new AliHLTTPCClusterHistoComponent;
106 int AliHLTTPCClusterHistoComponent::DoInit( int argc, const char** argv )
108 // HLTFatal("Initializing with log fatal");
109 // cout<<"Initializing with cout"<<endl;
111 fPlotChargeOROCAll=kTRUE;
112 fPlotChargeIROCAll=kTRUE;
113 fPlotChargeROCSel=kFALSE;
114 fPlotChargePartSel=kFALSE;
115 fPlotQmaxPartAll=kTRUE;
116 fPlotQmaxROCAll=kTRUE;
117 fPlotNClusters=kTRUE;
119 if(fPlotChargeOROCAll){fTotalClusterChargeOROCAll = new TH1F("fTotalClusterChargeOROCAll","Total Charge of clusters in all OROC",4000,0,4000);}
120 if(fPlotChargeIROCAll){fTotalClusterChargeIROCAll = new TH1F("fTotalClusterChargeIROCAll","Total Charge of clusters in all IROC",4000,0,4000);}
121 if(fPlotChargeROCSel){fTotalClusterChargeROCSelection = new TH1F("fTotalClusterChargeROCSelection","Total Charge of clusters in selection ROC",4000,0,4000);}
122 if(fPlotChargePartSel){fTotalClusterChargePartitionSelection = new TH1F("fTotalClusterChargePartitionSelection","Total Charge of clusters in sel Part",4000,0,4000);}
123 if(fPlotQmaxPartAll){fQMaxPartitionAll = new TH1F("fQMaxPartitionAll","QMax for All Partitions",216,0,216);}
124 if(fPlotQmaxROCAll){fQMaxROCAll = new TH1F("fQMaxROCAll","QMax for All Partitions",72,0,72);}
125 if(fPlotNClusters){fNumberOfClusters = new TH1F("fNumberOfClusters","Total Number of Clusters",1,0,1);}
128 TString configuration="";
130 for (int i=0; i<argc && iResult>=0; i++) {
132 if (!configuration.IsNull()) configuration+=" ";
133 configuration+=argument;
136 if (!configuration.IsNull()) {
137 iResult=Configure(configuration.Data());
143 int AliHLTTPCClusterHistoComponent::DoDeinit()
145 // see header file for class documentation
146 if(fTotalClusterChargeOROCAll!=NULL) delete fTotalClusterChargeOROCAll;
147 if(fTotalClusterChargeIROCAll!=NULL) delete fTotalClusterChargeIROCAll;
148 if(fQMaxPartitionAll!=NULL) delete fQMaxPartitionAll;
149 if(fQMaxROCAll!=NULL) delete fQMaxROCAll;
153 int AliHLTTPCClusterHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
156 int TotalSpacePoint = 0;
158 const AliHLTComponentBlockData* iter = NULL;
160 if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) )
163 fQMaxPartitionAll->Reset();
164 fQMaxROCAll->Reset();
166 for ( iter = GetFirstInputBlock(AliHLTTPCDefinitions::fgkClustersDataType); iter != NULL; iter = GetNextInputBlock() ) {
168 Int_t thisrow=-1,thissector=-1,row=-1;
170 AliHLTUInt8_t slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
171 AliHLTUInt8_t patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
172 row = AliHLTTPCTransform::GetFirstRow(patch);
173 AliHLTTPCTransform::Slice2Sector(slice,row,thissector,thisrow);
175 HLTDebug ( "Input Data - TPC cluster - Slice/Patch: %d/%d.", slice, patch );
177 const AliHLTTPCClusterData* clusterData = (const AliHLTTPCClusterData*) iter->fPtr;
178 Int_t nSpacepoint = (Int_t) clusterData->fSpacePointCnt;
179 TotalSpacePoint += nSpacepoint;
180 //HLTInfo("KryptonHisto found %d Spacepoints in slice %d patch %d", nSpacepoint, slice, patch);
181 AliHLTTPCSpacePointData *clusters = (AliHLTTPCSpacePointData*) &clusterData->fSpacePoints;
183 UInt_t tmpQPart = 0;//,tmpQROC = -1;
185 for(int i=0;i<nSpacepoint;i++){
186 if(fPlotChargeOROCAll){
188 fTotalClusterChargeOROCAll->Fill(clusters[i].fCharge);
191 if(fPlotChargeIROCAll){
193 fTotalClusterChargeIROCAll->Fill(clusters[i].fCharge);
196 if(fPlotChargeROCSel){
199 if(fPlotChargePartSel){
202 if(fPlotQmaxPartAll){
203 if(clusters[i].fQMax>tmpQPart){
204 fQMaxPartitionAll->SetBinContent(patch+6*slice,clusters[i].fQMax);
205 tmpQPart=clusters[i].fQMax;
209 if(clusters[i].fQMax>fQMaxROCAll->GetBinContent(thissector)){
210 fQMaxROCAll->SetBinContent(thissector,clusters[i].fQMax);
211 // tmpQROC=clusters[i].fQMax;
216 fNumberOfClusters->Fill(nSpacepoint);
220 //delete til dodeinit
221 if(fPlotChargeOROCAll){
222 AliHLTUInt32_t fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(0,35,2,5);
223 PushBack( (TObject*) fTotalClusterChargeOROCAll,kAliHLTDataTypeHistogram,fSpecification);
225 if(fPlotChargeIROCAll){
226 AliHLTUInt32_t fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(0,35,0,1);
227 PushBack( (TObject*) fTotalClusterChargeIROCAll,kAliHLTDataTypeHistogram,fSpecification);
229 if(fPlotChargeROCSel){
233 if(fPlotChargePartSel){
237 if(fPlotQmaxPartAll){
238 AliHLTUInt32_t fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(0,35,0,5);
239 PushBack( (TObject*) fQMaxPartitionAll,kAliHLTDataTypeHistogram,fSpecification);
240 //delete fQMaxPartitionAll;
243 AliHLTUInt32_t fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(0,35,0,5);
244 PushBack( (TObject*) fQMaxROCAll,kAliHLTDataTypeHistogram,fSpecification);
245 //delete fQMaxROCAll;
252 HLTInfo("KryptonHisto found %d Total Spacepoints", TotalSpacePoint);
257 int AliHLTTPCClusterHistoComponent::Configure(const char* arguments)
261 if (!arguments) return iResult;
263 TString allArgs=arguments;
266 TObjArray* pTokens=allArgs.Tokenize(" ");
269 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
270 argument=((TObjString*)pTokens->At(i))->GetString();
271 if (argument.IsNull()) continue;
273 if (argument.CompareTo("-plot-all")==0) {
274 HLTInfo("Ploting charge of all clusters");
279 else if (argument.CompareTo("-plot-trackclusters")==0) {
280 HLTInfo("Ploting charge of clusters used on a track");
285 HLTError("unknown argument %s", argument.Data());
293 //if hvis det eksisterer
294 if(fPlotChargeOROCAll){fTotalClusterChargeOROCAll = new TH1F("fTotalClusterChargeOROCAll","Total Charge of clusters in all OROC",4000,0,4000);}
295 if(fPlotChargeIROCAll){fTotalClusterChargeIROCAll = new TH1F("fTotalClusterChargeIROCAll","Total Charge of clusters in all IROC",4000,0,4000);}
296 if(fPlotChargeROCSel){fTotalClusterChargeROCSelection = new TH1F("fTotalClusterChargeROCSelection","Total Charge of clusters in selection ROC",4000,0,4000);}
297 if(fPlotChargePartSel){fTotalClusterChargePartitionSelection = new TH1F("fTotalClusterChargePartitionSelection","Total Charge of clusters in sel Part",4000,0,4000);}
298 if(fPlotQmaxPartAll){fQMaxPartitionAll = new TH1F("fQMaxPartitionAll","QMax for All Partitions",216,0,216);}
299 if(fPlotQmaxROCAll){fQMaxROCAll = new TH1F("fQMaxROCAll","QMax for All Partitions",72,0,72);}
300 if(fPlotNClusters){fNumberOfClusters = new TH1F("fNumberOfClusters","Total Number of Clusters",100,0,100);}
305 int AliHLTTPCClusterHistoComponent::Reconfigure(const char* cdbEntry, const char* chainId)
307 // see header file for class documentation
309 const char* path="HLT/ConfigTPC/KryptonHistoComponent";
310 const char* defaultNotify="";
313 defaultNotify=" (default)";
316 HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
317 AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
319 TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
321 HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
322 iResult=Configure(pString->GetString().Data());
324 HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
327 HLTError("can not fetch object \"%s\" from CDB", path);