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
27 #include "AliHLTTPCClusterHistoComponent.h"
28 #include "AliHLTTPCTransform.h"
29 #include "AliHLTTPCClusterDataFormat.h"
30 #include "AliHLTTPCTrackletDataFormat.h"
31 #include "AliHLTTPCMemHandler.h"
32 #include "AliHLTTPCDefinitions.h"
33 #include "AliCDBEntry.h"
34 #include "AliCDBManager.h"
37 #include "TObjString.h"
38 #include "TObjArray.h"
40 //#include "AliHLTTPC.h"
44 /** ROOT macro for the implementation of ROOT specific class methods */
45 ClassImp(AliHLTTPCClusterHistoComponent)
47 AliHLTTPCClusterHistoComponent::AliHLTTPCClusterHistoComponent()
49 fTotalClusterChargeOROCAll(NULL),
50 fTotalClusterChargeIROCAll(NULL),
51 fTotalClusterChargeROCSelection(NULL),
52 fTotalClusterChargePartitionSelection(NULL),
53 fQMaxPartitionAll(NULL),
55 fNumberOfClusters(NULL),
56 fPlotChargeOROCAll(kTRUE),
57 fPlotChargeIROCAll(kTRUE),
58 fPlotChargeROCSel(kFALSE),
59 fPlotChargePartSel(kFALSE),
60 fPlotQmaxPartAll(kTRUE),
61 fPlotQmaxROCAll(kTRUE),
64 // see header file for class documentation
66 // refer to README to build package
68 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
72 AliHLTTPCClusterHistoComponent::~AliHLTTPCClusterHistoComponent()
74 // see header file for class documentation
77 // Public functions to implement AliHLTComponent's interface.
78 // These functions are required for the registration process
80 const char* AliHLTTPCClusterHistoComponent::GetComponentID()
82 // see header file for class documentation
84 return "TPCClusterHisto";
87 void AliHLTTPCClusterHistoComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
89 // see header file for class documentation
91 list.push_back( AliHLTTPCDefinitions::fgkClustersDataType );
94 AliHLTComponentDataType AliHLTTPCClusterHistoComponent::GetOutputDataType()
96 // see header file for class documentation
97 return kAliHLTDataTypeHistogram;
101 void AliHLTTPCClusterHistoComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
103 // see header file for class documentation
104 // XXX TODO: Find more realistic values.
109 AliHLTComponent* AliHLTTPCClusterHistoComponent::Spawn()
111 // see header file for class documentation
112 return new AliHLTTPCClusterHistoComponent;
115 int AliHLTTPCClusterHistoComponent::DoInit( int argc, const char** argv )
117 // HLTFatal("Initializing with log fatal");
118 // cout<<"Initializing with cout"<<endl;
120 fPlotChargeOROCAll=kTRUE;
121 fPlotChargeIROCAll=kTRUE;
122 fPlotChargeROCSel=kFALSE;
123 fPlotChargePartSel=kFALSE;
124 fPlotQmaxPartAll=kTRUE;
125 fPlotQmaxROCAll=kTRUE;
126 fPlotNClusters=kTRUE;
128 if(fPlotChargeOROCAll){fTotalClusterChargeOROCAll = new TH1F("fTotalClusterChargeOROCAll","Total Charge of clusters in all OROC",4000,0,4000);}
129 if(fPlotChargeIROCAll){fTotalClusterChargeIROCAll = new TH1F("fTotalClusterChargeIROCAll","Total Charge of clusters in all IROC",4000,0,4000);}
130 if(fPlotChargeROCSel){fTotalClusterChargeROCSelection = new TH1F("fTotalClusterChargeROCSelection","Total Charge of clusters in selection ROC",4000,0,4000);}
131 if(fPlotChargePartSel){fTotalClusterChargePartitionSelection = new TH1F("fTotalClusterChargePartitionSelection","Total Charge of clusters in sel Part",4000,0,4000);}
132 if(fPlotQmaxPartAll){fQMaxPartitionAll = new TH1F("fQMaxPartitionAll","QMax for All Partitions",216,0,216);}
133 if(fPlotQmaxROCAll){fQMaxROCAll = new TH1F("fQMaxROCAll","QMax for All Partitions",72,0,72);}
134 if(fPlotNClusters){fNumberOfClusters = new TH1F("fNumberOfClusters","Total Number of Clusters",1,0,1);}
137 TString configuration="";
139 for (int i=0; i<argc && iResult>=0; i++) {
141 if (!configuration.IsNull()) configuration+=" ";
142 configuration+=argument;
145 if (!configuration.IsNull()) {
146 iResult=Configure(configuration.Data());
152 int AliHLTTPCClusterHistoComponent::DoDeinit()
154 // see header file for class documentation
155 if(fTotalClusterChargeOROCAll!=NULL) delete fTotalClusterChargeOROCAll;
156 if(fTotalClusterChargeIROCAll!=NULL) delete fTotalClusterChargeIROCAll;
157 if(fQMaxPartitionAll!=NULL) delete fQMaxPartitionAll;
158 if(fQMaxROCAll!=NULL) delete fQMaxROCAll;
162 int AliHLTTPCClusterHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
165 int TotalSpacePoint = 0;
167 const AliHLTComponentBlockData* iter = NULL;
169 if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) )
172 fQMaxPartitionAll->Reset();
173 fQMaxROCAll->Reset();
175 for ( iter = GetFirstInputBlock(AliHLTTPCDefinitions::fgkClustersDataType); iter != NULL; iter = GetNextInputBlock() ) {
177 Int_t thisrow=-1,thissector=-1,row=-1;
179 AliHLTUInt8_t slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
180 AliHLTUInt8_t patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
181 row = AliHLTTPCTransform::GetFirstRow(patch);
182 AliHLTTPCTransform::Slice2Sector(slice,row,thissector,thisrow);
184 HLTDebug ( "Input Data - TPC cluster - Slice/Patch: %d/%d.", slice, patch );
186 const AliHLTTPCClusterData* clusterData = (const AliHLTTPCClusterData*) iter->fPtr;
187 Int_t nSpacepoint = (Int_t) clusterData->fSpacePointCnt;
188 TotalSpacePoint += nSpacepoint;
189 //HLTInfo("KryptonHisto found %d Spacepoints in slice %d patch %d", nSpacepoint, slice, patch);
190 AliHLTTPCSpacePointData *clusters = (AliHLTTPCSpacePointData*) &clusterData->fSpacePoints;
192 UInt_t tmpQPart = 0;//,tmpQROC = -1;
194 for(int i=0;i<nSpacepoint;i++){
195 if(fPlotChargeOROCAll){
197 fTotalClusterChargeOROCAll->Fill(clusters[i].fCharge);
200 if(fPlotChargeIROCAll){
202 fTotalClusterChargeIROCAll->Fill(clusters[i].fCharge);
205 if(fPlotChargeROCSel){
208 if(fPlotChargePartSel){
211 if(fPlotQmaxPartAll){
212 if(clusters[i].fQMax>tmpQPart){
213 fQMaxPartitionAll->SetBinContent(patch+6*slice,clusters[i].fQMax);
214 tmpQPart=clusters[i].fQMax;
218 if(clusters[i].fQMax>fQMaxROCAll->GetBinContent(thissector)){
219 fQMaxROCAll->SetBinContent(thissector,clusters[i].fQMax);
220 // tmpQROC=clusters[i].fQMax;
225 fNumberOfClusters->Fill(nSpacepoint);
229 //delete til dodeinit
230 if(fPlotChargeOROCAll){
231 AliHLTUInt32_t fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(0,35,2,5);
232 PushBack( (TObject*) fTotalClusterChargeOROCAll,kAliHLTDataTypeHistogram,fSpecification);
234 if(fPlotChargeIROCAll){
235 AliHLTUInt32_t fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(0,35,0,1);
236 PushBack( (TObject*) fTotalClusterChargeIROCAll,kAliHLTDataTypeHistogram,fSpecification);
238 if(fPlotChargeROCSel){
242 if(fPlotChargePartSel){
246 if(fPlotQmaxPartAll){
247 AliHLTUInt32_t fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(0,35,0,5);
248 PushBack( (TObject*) fQMaxPartitionAll,kAliHLTDataTypeHistogram,fSpecification);
249 //delete fQMaxPartitionAll;
252 AliHLTUInt32_t fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(0,35,0,5);
253 PushBack( (TObject*) fQMaxROCAll,kAliHLTDataTypeHistogram,fSpecification);
254 //delete fQMaxROCAll;
261 HLTInfo("KryptonHisto found %d Total Spacepoints", TotalSpacePoint);
266 int AliHLTTPCClusterHistoComponent::Configure(const char* arguments)
270 if (!arguments) return iResult;
272 TString allArgs=arguments;
275 TObjArray* pTokens=allArgs.Tokenize(" ");
278 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
279 argument=((TObjString*)pTokens->At(i))->GetString();
280 if (argument.IsNull()) continue;
282 if (argument.CompareTo("-plot-all")==0) {
283 HLTInfo("Ploting charge of all clusters");
288 else if (argument.CompareTo("-plot-trackclusters")==0) {
289 HLTInfo("Ploting charge of clusters used on a track");
294 HLTError("unknown argument %s", argument.Data());
302 //if hvis det eksisterer
303 if(fPlotChargeOROCAll){fTotalClusterChargeOROCAll = new TH1F("fTotalClusterChargeOROCAll","Total Charge of clusters in all OROC",4000,0,4000);}
304 if(fPlotChargeIROCAll){fTotalClusterChargeIROCAll = new TH1F("fTotalClusterChargeIROCAll","Total Charge of clusters in all IROC",4000,0,4000);}
305 if(fPlotChargeROCSel){fTotalClusterChargeROCSelection = new TH1F("fTotalClusterChargeROCSelection","Total Charge of clusters in selection ROC",4000,0,4000);}
306 if(fPlotChargePartSel){fTotalClusterChargePartitionSelection = new TH1F("fTotalClusterChargePartitionSelection","Total Charge of clusters in sel Part",4000,0,4000);}
307 if(fPlotQmaxPartAll){fQMaxPartitionAll = new TH1F("fQMaxPartitionAll","QMax for All Partitions",216,0,216);}
308 if(fPlotQmaxROCAll){fQMaxROCAll = new TH1F("fQMaxROCAll","QMax for All Partitions",72,0,72);}
309 if(fPlotNClusters){fNumberOfClusters = new TH1F("fNumberOfClusters","Total Number of Clusters",100,0,100);}
314 int AliHLTTPCClusterHistoComponent::Reconfigure(const char* cdbEntry, const char* chainId)
316 // see header file for class documentation
318 const char* path="HLT/ConfigTPC/KryptonHistoComponent";
319 const char* defaultNotify="";
322 defaultNotify=" (default)";
325 HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
326 AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
328 TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
330 HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
331 iResult=Configure(pString->GetString().Data());
333 HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
336 HLTError("can not fetch object \"%s\" from CDB", path);