]>
Commit | Line | Data |
---|---|---|
76c437dc | 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: Matthias Richter <Matthias.Richter@ift.uib.no> * | |
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 AliHLTTPCDataCompressionMonitorComponent.cxx | |
19 | /// @author Matthias Richter | |
20 | /// @date 2011-09-12 | |
21 | /// @brief TPC component for monitoring of data compression | |
22 | /// | |
23 | ||
24 | #include "AliHLTTPCDataCompressionMonitorComponent.h" | |
eb51a006 | 25 | #include "AliHLTTPCDataCompressionComponent.h" |
f899e060 | 26 | #include "AliHLTTPCDataCompressionDecoder.h" |
76c437dc | 27 | #include "AliHLTTPCDefinitions.h" |
28 | #include "AliHLTTPCHWCFData.h" | |
6776da52 | 29 | #include "AliHLTTPCDefinitions.h" |
30 | #include "AliHLTTPCClusterDataFormat.h" | |
31 | #include "AliHLTTPCRawCluster.h" | |
32 | #include "AliHLTTPCTransform.h" | |
eb51a006 | 33 | #include "AliHLTTPCTrackGeometry.h" |
779a5a62 | 34 | #include "AliHLTTPCHWCFSpacePointContainer.h" |
a4fad4be | 35 | #include "AliHLTErrorGuard.h" |
76c437dc | 36 | #include "AliRawDataHeader.h" |
6776da52 | 37 | #include "AliTPCclusterMI.h" |
bc3adc1e | 38 | #include "AliTPCROC.h" |
76c437dc | 39 | #include "TH1I.h" |
779a5a62 | 40 | #include "TH1F.h" |
bc3adc1e | 41 | #include "TH1D.h" |
76c437dc | 42 | #include "TH2I.h" |
69d38ee6 | 43 | #include "TH2F.h" |
bc3adc1e | 44 | #include "TH2D.h" |
69d38ee6 | 45 | #include "TH3I.h" |
46 | #include "TH3F.h" | |
bc3adc1e | 47 | #include "TH3D.h" |
48 | #include "TProfile.h" | |
76c437dc | 49 | #include "TFile.h" |
779a5a62 | 50 | #include "TObjArray.h" |
a6267876 | 51 | #include "TList.h" |
76c437dc | 52 | #include <memory> |
53 | ||
54 | ClassImp(AliHLTTPCDataCompressionMonitorComponent) | |
55 | ||
56 | AliHLTTPCDataCompressionMonitorComponent::AliHLTTPCDataCompressionMonitorComponent() | |
57 | : AliHLTProcessor() | |
58 | , fpHWClusterDecoder(NULL) | |
59 | , fHistoHWCFDataSize(NULL) | |
60 | , fHistoHWCFReductionFactor(NULL) | |
61 | , fHistoNofClusters(NULL) | |
bc3adc1e | 62 | , fHistoNofClustersReductionFactor(NULL) |
a6267876 | 63 | , fHistogramFile() |
779a5a62 | 64 | , fMonitoringContainer(NULL) |
76c437dc | 65 | , fVerbosity(0) |
66 | , fFlags(0) | |
a6267876 | 67 | , fPublishingMode(kPublishSeparate) |
76c437dc | 68 | { |
69 | } | |
70 | ||
71 | AliHLTTPCDataCompressionMonitorComponent::~AliHLTTPCDataCompressionMonitorComponent() | |
72 | { | |
73 | /// destructor | |
74 | } | |
75 | ||
76 | ||
77 | const char* AliHLTTPCDataCompressionMonitorComponent::GetComponentID() | |
78 | { | |
79 | /// inherited from AliHLTComponent: id of the component | |
80 | return "TPCDataCompressorMonitor"; | |
81 | } | |
82 | ||
83 | ||
84 | void AliHLTTPCDataCompressionMonitorComponent::GetInputDataTypes( AliHLTComponentDataTypeList& tgtList) | |
85 | { | |
86 | /// inherited from AliHLTComponent: list of data types in the vector reference | |
87 | tgtList.clear(); | |
88 | tgtList.push_back(AliHLTTPCDefinitions::fgkHWClustersDataType); | |
89 | tgtList.push_back(kAliHLTDataTypeTrack|kAliHLTDataOriginTPC); | |
90 | tgtList.push_back(AliHLTTPCDefinitions::fgkRawClustersDataType); | |
91 | tgtList.push_back(AliHLTTPCDefinitions::RemainingClustersCompressedDataType()); | |
92 | tgtList.push_back(AliHLTTPCDefinitions::ClusterTracksCompressedDataType()); | |
93 | } | |
94 | ||
95 | AliHLTComponentDataType AliHLTTPCDataCompressionMonitorComponent::GetOutputDataType() | |
96 | { | |
97 | /// inherited from AliHLTComponent: output data type of the component. | |
98 | return kAliHLTMultipleDataType; | |
99 | } | |
100 | ||
101 | int AliHLTTPCDataCompressionMonitorComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList) | |
102 | { | |
103 | /// inherited from AliHLTComponent: multiple output data types of the component. | |
104 | tgtList.clear(); | |
105 | tgtList.push_back(kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC); | |
106 | return tgtList.size(); | |
107 | } | |
108 | ||
109 | void AliHLTTPCDataCompressionMonitorComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) | |
110 | { | |
111 | /// inherited from AliHLTComponent: output data size estimator | |
a6267876 | 112 | constBase=100000; |
76c437dc | 113 | inputMultiplier=1.0; |
114 | } | |
115 | ||
116 | AliHLTComponent* AliHLTTPCDataCompressionMonitorComponent::Spawn() | |
117 | { | |
118 | /// inherited from AliHLTComponent: spawn function. | |
119 | return new AliHLTTPCDataCompressionMonitorComponent; | |
120 | } | |
121 | ||
122 | int AliHLTTPCDataCompressionMonitorComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, | |
123 | const AliHLTComponentBlockData* /*inputBlocks*/, | |
124 | AliHLTComponentTriggerData& /*trigData*/, | |
125 | AliHLTUInt8_t* /*outputPtr*/, | |
126 | AliHLTUInt32_t& /*size*/, | |
127 | AliHLTComponentBlockDataList& /*outputBlocks*/ ) | |
128 | { | |
129 | /// inherited from AliHLTProcessor: data processing | |
130 | int iResult=0; | |
131 | ||
132 | if (!IsDataEvent()) return 0; | |
133 | ||
134 | const AliHLTComponentBlockData* pDesc=NULL; | |
135 | unsigned rawDataSize=0; | |
136 | unsigned hwclustersDataSize=0; | |
137 | unsigned nofClusters=0; | |
69d38ee6 | 138 | unsigned compDataSize=0; |
139 | ||
a4fad4be | 140 | // check size of TPC raw data |
76c437dc | 141 | for (pDesc=GetFirstInputBlock(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC); |
142 | pDesc!=NULL; pDesc=GetNextInputBlock()) { | |
143 | fFlags|=kHaveRawData; | |
144 | rawDataSize+=pDesc->fSize; | |
145 | } | |
146 | ||
a4fad4be | 147 | // check size of HWCF data and add to the MonitoringContainer |
76c437dc | 148 | for (pDesc=GetFirstInputBlock(AliHLTTPCDefinitions::fgkHWClustersDataType); |
149 | pDesc!=NULL; pDesc=GetNextInputBlock()) { | |
150 | fFlags|=kHaveHWClusters; | |
779a5a62 | 151 | // FIXME: the decoding can now be handled via the data container |
76c437dc | 152 | if (pDesc->fSize<=sizeof(AliRawDataHeader)) continue; |
153 | if (fpHWClusterDecoder) { | |
154 | hwclustersDataSize+=pDesc->fSize; | |
155 | AliHLTUInt8_t* pData=reinterpret_cast<AliHLTUInt8_t*>(pDesc->fPtr); | |
156 | pData+=sizeof(AliRawDataHeader); | |
157 | if (fpHWClusterDecoder->Init(pData, pDesc->fSize-sizeof(AliRawDataHeader))<0 || | |
158 | (fpHWClusterDecoder->CheckVersion()<0 && (int)pDesc->fSize>fpHWClusterDecoder->GetRCUTrailerSize())) { | |
159 | HLTError("data block of type %s corrupted: can not decode format", | |
160 | AliHLTComponent::DataType2Text(pDesc->fDataType).c_str()); | |
161 | } else { | |
162 | nofClusters+=fpHWClusterDecoder->GetNumberOfClusters(); | |
163 | } | |
164 | } | |
779a5a62 | 165 | if (fMonitoringContainer) { |
166 | fMonitoringContainer->AddRawData(pDesc); | |
167 | } | |
76c437dc | 168 | } |
169 | ||
779a5a62 | 170 | if (fMonitoringContainer) { |
171 | for (pDesc=GetFirstInputBlock(AliHLTTPCDefinitions::RemainingClusterIdsDataType()); | |
172 | pDesc!=NULL; pDesc=GetNextInputBlock()) { | |
173 | iResult=fMonitoringContainer->AddClusterIds(pDesc); | |
174 | } | |
6776da52 | 175 | |
779a5a62 | 176 | for (pDesc=GetFirstInputBlock(AliHLTTPCDefinitions::ClusterIdTracksDataType()); |
177 | pDesc!=NULL; pDesc=GetNextInputBlock()) { | |
178 | iResult=fMonitoringContainer->AddClusterIds(pDesc); | |
179 | } | |
180 | ||
f899e060 | 181 | // read data |
182 | AliHLTTPCDataCompressionDecoder decoder; | |
a4fad4be | 183 | bool bHaveRawClusters=false; |
184 | for (pDesc=GetFirstInputBlock(AliHLTTPCDefinitions::RawClustersDataType()); | |
185 | pDesc!=NULL; pDesc=GetNextInputBlock()) { | |
186 | // Note: until r51411 and v5-01-Rev-03 the compressed cluster format was sent with data | |
187 | // type {CLUSTRAW,TPC }, the version member indicated the actual type of data | |
188 | // transparently handled in the decoder | |
189 | bHaveRawClusters=true; | |
190 | iResult=decoder.ReadClustersPartition(fMonitoringContainer->BeginRemainingClusterBlock(0, pDesc->fSpecification), | |
191 | reinterpret_cast<AliHLTUInt8_t*>(pDesc->fPtr), | |
192 | pDesc->fSize, | |
193 | pDesc->fSpecification); | |
194 | if (iResult<0) { | |
195 | HLTError("reading of partition clusters failed with error %d", iResult); | |
196 | } | |
197 | } | |
198 | ||
199 | if (!bHaveRawClusters) { | |
779a5a62 | 200 | for (pDesc=GetFirstInputBlock(AliHLTTPCDefinitions::RemainingClustersCompressedDataType()); |
201 | pDesc!=NULL; pDesc=GetNextInputBlock()) { | |
a4fad4be | 202 | iResult=decoder.ReadClustersPartition(fMonitoringContainer->BeginRemainingClusterBlock(0, pDesc->fSpecification), |
203 | reinterpret_cast<AliHLTUInt8_t*>(pDesc->fPtr), | |
204 | pDesc->fSize, | |
205 | pDesc->fSpecification); | |
69d38ee6 | 206 | compDataSize+=pDesc->fSize; |
779a5a62 | 207 | } |
208 | ||
209 | for (pDesc=GetFirstInputBlock(AliHLTTPCDefinitions::ClusterTracksCompressedDataType()); | |
210 | pDesc!=NULL; pDesc=GetNextInputBlock()) { | |
f899e060 | 211 | iResult=decoder.ReadTrackModelClustersCompressed(fMonitoringContainer->BeginTrackModelClusterBlock(0), |
779a5a62 | 212 | reinterpret_cast<AliHLTUInt8_t*>(pDesc->fPtr), |
213 | pDesc->fSize, | |
214 | pDesc->fSpecification); | |
69d38ee6 | 215 | compDataSize+=pDesc->fSize; |
779a5a62 | 216 | } |
a4fad4be | 217 | } else { |
218 | if (GetFirstInputBlock(AliHLTTPCDefinitions::RemainingClustersCompressedDataType()) || | |
219 | GetFirstInputBlock(AliHLTTPCDefinitions::ClusterTracksCompressedDataType())) { | |
220 | ALIHLTERRORGUARD(5, "conflicting data blocks, monitoring histograms already filled from raw cluster data, ignoring blocks of compressed partition and track clusters"); | |
221 | } | |
222 | } | |
779a5a62 | 223 | |
224 | fMonitoringContainer->Clear(); | |
eb51a006 | 225 | } |
226 | ||
76c437dc | 227 | float ratio=0; |
69d38ee6 | 228 | if (compDataSize) {ratio=(float)hwclustersDataSize; ratio/=compDataSize;} |
bc3adc1e | 229 | if (fHistoHWCFDataSize) fHistoHWCFDataSize ->Fill(rawDataSize/1024, compDataSize/1024); |
230 | if (fHistoHWCFReductionFactor) fHistoHWCFReductionFactor->Fill(rawDataSize/1024, ratio); | |
231 | if (fHistoNofClusters) fHistoNofClusters ->Fill(rawDataSize/1024, nofClusters); | |
232 | if (fHistoNofClustersReductionFactor) fHistoNofClustersReductionFactor ->Fill(nofClusters, ratio); | |
69d38ee6 | 233 | HLTInfo("raw data %d, hwcf data %d, comp data %d, ratio %f, %d clusters\n", rawDataSize, hwclustersDataSize, compDataSize, ratio, nofClusters); |
76c437dc | 234 | |
a6267876 | 235 | if (iResult>=0 && fPublishingMode!=kPublishOff) { |
236 | iResult=Publish(fPublishingMode); | |
237 | } | |
238 | ||
239 | return iResult; | |
240 | } | |
241 | ||
242 | int AliHLTTPCDataCompressionMonitorComponent::Publish(int mode) | |
243 | { | |
244 | /// publish to output | |
bc3adc1e | 245 | // additional histograms derived from the main ones to publish |
246 | TObjArray *derivedHistos = new TObjArray(); | |
247 | derivedHistos->SetOwner(kTRUE); | |
a6267876 | 248 | |
249 | // FIXME: code needs to be optimized, maybe a bit to much new and delete for the | |
250 | // moment, the data type might need adjustment | |
251 | int iResult=0; | |
252 | TObjArray* pArray=mode==kPublishArray?(new TObjArray):NULL; | |
253 | TList* pList=mode==kPublishList?(new TList):NULL; | |
254 | if (mode==kPublishSeparate) { | |
255 | if (fHistoHWCFDataSize) PushBack(fHistoHWCFDataSize , kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC); | |
256 | if (fHistoHWCFReductionFactor) PushBack(fHistoHWCFReductionFactor, kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC); | |
257 | if (fHistoNofClusters) PushBack(fHistoNofClusters , kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC); | |
bc3adc1e | 258 | if (fHistoNofClustersReductionFactor) PushBack(fHistoNofClustersReductionFactor, kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC); |
a6267876 | 259 | } else if (pList) { |
260 | if (fHistoHWCFDataSize) pList->Add(fHistoHWCFDataSize->Clone()); | |
261 | if (fHistoHWCFReductionFactor) pList->Add(fHistoHWCFReductionFactor->Clone()); | |
262 | if (fHistoNofClusters) pList->Add(fHistoNofClusters->Clone()); | |
bc3adc1e | 263 | if (fHistoNofClustersReductionFactor) pList->Add(fHistoNofClustersReductionFactor->Clone()); |
a6267876 | 264 | } else if (pArray) { |
265 | if (fHistoHWCFDataSize) pArray->Add(fHistoHWCFDataSize->Clone()); | |
266 | if (fHistoHWCFReductionFactor) pArray->Add(fHistoHWCFReductionFactor->Clone()); | |
267 | if (fHistoNofClusters) pArray->Add(fHistoNofClusters->Clone()); | |
bc3adc1e | 268 | if (fHistoNofClustersReductionFactor) pArray->Add(fHistoNofClustersReductionFactor->Clone()); |
a6267876 | 269 | } |
270 | ||
bc3adc1e | 271 | |
a6267876 | 272 | if (fMonitoringContainer) { |
273 | static const char* searchIds[] = {"fHistograms", "fHistograms2D", "fHistograms3D", NULL}; | |
274 | const char** searchId=searchIds; | |
275 | while (*searchId && iResult>=0) { | |
276 | const TObject* o=fMonitoringContainer->FindObject(*searchId); | |
277 | if (o) { | |
278 | const TObjArray* histograms=dynamic_cast<const TObjArray*>(o); | |
279 | if (histograms) { | |
280 | for (int i=0; i<histograms->GetEntriesFast() && iResult>=0; i++) { | |
281 | if (!histograms->At(i)) continue; | |
bc3adc1e | 282 | /// |
283 | TString name=histograms->At(i)->GetName(); | |
284 | if( (name.CompareTo(fgkHistogramDefinitions2D[kHistogramQMaxSector].fName)==0) || | |
285 | (name.CompareTo(fgkHistogramDefinitions2D[kHistogramSigmaY2Sector].fName)==0) || | |
286 | (name.CompareTo(fgkHistogramDefinitions2D[kHistogramSigmaZ2Sector].fName)==0) ){ | |
287 | TH2F *h1=(TH2F*)histograms->At(i); | |
288 | TProfile *h2 = (TProfile*)(h1->ProfileX()); | |
289 | derivedHistos->Add(h2); | |
290 | } | |
291 | if( name.CompareTo(fgkHistogramDefinitions3D[kHistogramPadrowPadSector].fName)==0) { | |
292 | TH3F *h1=(TH3F*)histograms->At(i); | |
293 | for (int j=1; j<=72; j++) { | |
294 | h1->GetXaxis()->SetRange(j,j); | |
295 | TString histoname = Form("zy_%d",j); | |
296 | TH2F *h2 = (TH2F*)h1->Project3D(histoname.Data()); | |
297 | derivedHistos->Add(h2); | |
298 | } | |
299 | } | |
300 | /// | |
a6267876 | 301 | if (mode==kPublishSeparate) { |
302 | iResult=PushBack(histograms->At(i), kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC); | |
303 | } else if (pList) { | |
304 | pList->Add(histograms->At(i)->Clone()); | |
305 | } else if (pArray) { | |
306 | pArray->Add(histograms->At(i)->Clone()); | |
307 | } | |
308 | } | |
bc3adc1e | 309 | for (int i=0; i<derivedHistos->GetEntriesFast() && iResult>=0; i++) { |
310 | if (mode==kPublishSeparate) { | |
311 | iResult=PushBack(derivedHistos->At(i), kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC); | |
312 | } else if (pList) { | |
313 | pList->Add(derivedHistos->At(i)->Clone()); | |
314 | } else if (pArray) { | |
315 | pArray->Add(derivedHistos->At(i)->Clone()); | |
316 | } | |
317 | } | |
a6267876 | 318 | } |
319 | } else { | |
320 | HLTError("failed to find object \"%s\"", *searchId); | |
321 | } | |
322 | searchId++; | |
323 | } | |
324 | } | |
325 | ||
326 | if (pArray) { | |
327 | iResult=PushBack(pArray, kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC); | |
328 | pArray->SetOwner(kTRUE); | |
329 | delete pArray; | |
330 | pArray=NULL; | |
331 | } | |
332 | if (pList) { | |
333 | iResult=PushBack(pList, kAliHLTDataTypeTObject|kAliHLTDataOriginTPC); | |
334 | pList->SetOwner(kTRUE); | |
335 | delete pList; | |
336 | pList=NULL; | |
337 | } | |
76c437dc | 338 | return iResult; |
339 | } | |
340 | ||
341 | int AliHLTTPCDataCompressionMonitorComponent::DoInit( int argc, const char** argv ) | |
342 | { | |
343 | /// inherited from AliHLTComponent: component initialisation and argument scan. | |
344 | int iResult=0; | |
345 | ||
346 | // component configuration | |
347 | //Stage 1: default initialization. | |
348 | //Default values. | |
349 | fFlags=0; | |
350 | ||
351 | //Stage 2: OCDB. | |
352 | TString cdbPath("HLT/ConfigTPC/"); | |
353 | cdbPath += GetComponentID(); | |
354 | // | |
355 | // iResult = ConfigureFromCDBTObjString(cdbPath); | |
356 | // if (iResult < 0) | |
357 | // return iResult; | |
358 | ||
359 | //Stage 3: command line arguments. | |
360 | if (argc && (iResult = ConfigureFromArgumentString(argc, argv)) < 0) | |
361 | return iResult; | |
362 | ||
363 | std::auto_ptr<AliHLTTPCHWCFData> hwClusterDecoder(new AliHLTTPCHWCFData); | |
779a5a62 | 364 | std::auto_ptr<AliDataContainer> dataContainer(new AliDataContainer); |
76c437dc | 365 | |
366 | std::auto_ptr<TH2I> histoHWCFDataSize(new TH2I("HWCFDataSize", | |
367 | "HW ClusterFinder Size", | |
368 | 100, 0., 80000., 100, 0., 80000.)); | |
369 | if (histoHWCFDataSize.get()) { | |
370 | TAxis* xaxis=histoHWCFDataSize->GetXaxis(); | |
bc3adc1e | 371 | if (xaxis) xaxis->SetTitle("raw data size [kB]"); |
76c437dc | 372 | TAxis* yaxis=histoHWCFDataSize->GetYaxis(); |
69d38ee6 | 373 | if (yaxis) yaxis->SetTitle("compressed data size [kb]"); |
76c437dc | 374 | } |
375 | ||
376 | std::auto_ptr<TH2I> histoHWCFReductionFactor(new TH2I("HWCFReductionFactor", | |
377 | "Data reduction HW ClusterFinder", | |
378 | 100, 0., 80000., 100, 0., 10.)); | |
379 | if (histoHWCFReductionFactor.get()) { | |
380 | TAxis* xaxis=histoHWCFReductionFactor->GetXaxis(); | |
bc3adc1e | 381 | if (xaxis) xaxis->SetTitle("raw data size [kB]"); |
76c437dc | 382 | TAxis* yaxis=histoHWCFReductionFactor->GetYaxis(); |
383 | if (yaxis) yaxis->SetTitle("reduction factor"); | |
384 | } | |
385 | ||
386 | std::auto_ptr<TH2I> histoNofClusters(new TH2I("NofClusters", | |
387 | "Number of HLT TPC clusters", | |
3b5a8606 | 388 | 100, 0., 80000., 500, 0., 3000000.)); |
76c437dc | 389 | if (histoNofClusters.get()) { |
390 | TAxis* xaxis=histoNofClusters->GetXaxis(); | |
bc3adc1e | 391 | if (xaxis) xaxis->SetTitle("raw data size [kB]"); |
76c437dc | 392 | TAxis* yaxis=histoNofClusters->GetYaxis(); |
69d38ee6 | 393 | if (yaxis) yaxis->SetTitle("N. of clusters"); |
76c437dc | 394 | } |
395 | ||
362b09a1 | 396 | std::auto_ptr<TH2I> histoNofClustersReductionFactor(new TH2I("ReductionFactorVsNofClusters", |
397 | "Reduction Factor vs. Number of HLT TPC clusters", | |
3b5a8606 | 398 | 500, 0., 3000000., 100, 0., 10.)); |
bc3adc1e | 399 | if (histoNofClustersReductionFactor.get()) { |
400 | TAxis* xaxis=histoNofClustersReductionFactor->GetXaxis(); | |
401 | if (xaxis) xaxis->SetTitle("N. of clusters"); | |
402 | TAxis* yaxis=histoNofClustersReductionFactor->GetYaxis(); | |
403 | if (yaxis) yaxis->SetTitle("reduction factor"); | |
404 | } | |
405 | ||
a6267876 | 406 | fHistoHWCFDataSize=histoHWCFDataSize.release(); |
407 | fHistoHWCFReductionFactor=histoHWCFReductionFactor.release(); | |
408 | fHistoNofClusters=histoNofClusters.release(); | |
bc3adc1e | 409 | fHistoNofClustersReductionFactor=histoNofClustersReductionFactor.release(); |
76c437dc | 410 | |
411 | fpHWClusterDecoder=hwClusterDecoder.release(); | |
779a5a62 | 412 | fMonitoringContainer=dataContainer.release(); |
76c437dc | 413 | |
414 | return iResult; | |
415 | } | |
416 | ||
417 | int AliHLTTPCDataCompressionMonitorComponent::DoDeinit() | |
418 | { | |
419 | /// inherited from AliHLTComponent: component cleanup | |
420 | int iResult=0; | |
421 | ||
422 | if (fpHWClusterDecoder) delete fpHWClusterDecoder; | |
423 | fpHWClusterDecoder=NULL; | |
424 | ||
425 | if (!fHistogramFile.IsNull()) { | |
426 | TFile out(fHistogramFile, "RECREATE"); | |
427 | if (!out.IsZombie()) { | |
428 | out.cd(); | |
429 | if (fHistoHWCFDataSize) fHistoHWCFDataSize->Write(); | |
430 | if (fHistoHWCFReductionFactor) fHistoHWCFReductionFactor->Write(); | |
431 | if (fHistoNofClusters) fHistoNofClusters->Write(); | |
bc3adc1e | 432 | if (fHistoNofClustersReductionFactor) fHistoNofClustersReductionFactor->Write(); |
779a5a62 | 433 | if (fMonitoringContainer) { |
69d38ee6 | 434 | const TObject* o1=fMonitoringContainer->FindObject("fHistograms"); |
435 | const TObject* o2=fMonitoringContainer->FindObject("fHistograms2D"); | |
436 | const TObject* o3=fMonitoringContainer->FindObject("fHistograms3D"); | |
437 | if (o1) o1->Write(); | |
438 | if (o2) o2->Write(); | |
439 | if (o3) o3->Write(); | |
779a5a62 | 440 | } |
76c437dc | 441 | out.Close(); |
442 | } | |
443 | } | |
444 | if (fHistoHWCFDataSize) delete fHistoHWCFDataSize; | |
445 | fHistoHWCFDataSize=NULL; | |
446 | if (fHistoHWCFReductionFactor) delete fHistoHWCFReductionFactor; | |
447 | fHistoHWCFReductionFactor=NULL; | |
448 | if (fHistoNofClusters) delete fHistoNofClusters; | |
449 | fHistoNofClusters=NULL; | |
bc3adc1e | 450 | if (fHistoNofClustersReductionFactor) delete fHistoNofClustersReductionFactor; |
451 | fHistoNofClustersReductionFactor=NULL; | |
9b2c9b8b | 452 | if (fMonitoringContainer) { |
453 | fMonitoringContainer->Clear(); | |
454 | delete fMonitoringContainer; | |
455 | } | |
456 | fMonitoringContainer=NULL; | |
457 | ||
76c437dc | 458 | |
459 | return iResult; | |
460 | } | |
461 | ||
462 | int AliHLTTPCDataCompressionMonitorComponent::ScanConfigurationArgument(int argc, const char** argv) | |
463 | { | |
464 | /// inherited from AliHLTComponent: argument scan | |
465 | int iResult=0; | |
466 | if (argc<1) return 0; | |
467 | int bMissingParam=0; | |
468 | int i=0; | |
469 | TString argument=argv[i]; | |
470 | ||
471 | do { | |
472 | // -histogram-file | |
473 | if (argument.CompareTo("-histogram-file")==0) { | |
474 | if ((bMissingParam=(++i>=argc))) break; | |
475 | fHistogramFile=argv[i++]; | |
a6267876 | 476 | return i; |
477 | } | |
478 | // -publishing-mode | |
479 | if (argument.CompareTo("-publishing-mode")==0) { | |
480 | if ((bMissingParam=(++i>=argc))) break; | |
481 | TString option=argv[i++]; | |
482 | if (option.CompareTo("off")==0) fPublishingMode=kPublishOff ; | |
483 | else if (option.CompareTo("separate")==0) fPublishingMode=kPublishSeparate; | |
484 | else if (option.CompareTo("list")==0) fPublishingMode=kPublishList ; | |
485 | else if (option.CompareTo("array")==0) fPublishingMode=kPublishArray ; | |
486 | else { | |
487 | HLTError("invalid option \"%s\" for argument \"%s\", expecting 'off', 'separate', 'list', or 'array'", option.Data(), argument.Data()); | |
488 | return -EPROTO; | |
489 | } | |
490 | return i; | |
76c437dc | 491 | } |
492 | } while (0); // using do-while only to have break available | |
493 | ||
494 | if (bMissingParam) { | |
495 | HLTError("missing parameter for argument %s", argument.Data()); | |
496 | iResult=-EPROTO; | |
497 | } | |
498 | ||
499 | return iResult; | |
500 | } | |
6776da52 | 501 | |
779a5a62 | 502 | AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::AliDataContainer() |
69d38ee6 | 503 | : fHistograms(new TObjArray) |
504 | , fHistograms2D(new TObjArray) | |
505 | , fHistograms3D(new TObjArray) | |
779a5a62 | 506 | , fHistogramPointers() |
69d38ee6 | 507 | , fHistogram2DPointers() |
508 | , fHistogram3DPointers() | |
779a5a62 | 509 | , fRemainingClusterIds() |
510 | , fTrackModelClusterIds() | |
511 | , fCurrentClusterIds(NULL) | |
512 | , fRawData(NULL) | |
362b09a1 | 513 | , fCurrentCluster() |
69d38ee6 | 514 | , fSector(-1) |
779a5a62 | 515 | , fBegin() |
779a5a62 | 516 | { |
517 | /// constructor | |
362b09a1 | 518 | memset(&fCurrentCluster, 0, sizeof(AliHLTTPCRawCluster)); |
779a5a62 | 519 | if (fHistograms) { |
520 | fHistograms->SetOwner(kTRUE); | |
521 | fHistogramPointers.resize(kNumberOfHistograms, NULL); | |
522 | for (const AliHistogramDefinition* definition=fgkHistogramDefinitions; | |
523 | definition->fName!=NULL; definition++) { | |
bc3adc1e | 524 | fHistogramPointers[definition->fId]=new TH1D(definition->fName, |
779a5a62 | 525 | definition->fTitle, |
526 | definition->fBins, | |
527 | definition->fLowerBound, | |
528 | definition->fUpperBound | |
529 | ); | |
530 | fHistograms->AddAt(fHistogramPointers[definition->fId], definition->fId); | |
531 | } | |
532 | } | |
69d38ee6 | 533 | /// |
534 | if (fHistograms2D) { | |
535 | fHistograms2D->SetOwner(kTRUE); | |
536 | fHistogram2DPointers.resize(kNumberOfHistograms2D, NULL); | |
537 | for (const AliHistogramDefinition2D* definition=fgkHistogramDefinitions2D; | |
538 | definition->fName!=NULL; definition++) { | |
bc3adc1e | 539 | fHistogram2DPointers[definition->fId]=new TH2D(definition->fName, |
69d38ee6 | 540 | definition->fTitle, |
541 | definition->fBinsX, | |
542 | definition->fLowerBoundX, | |
543 | definition->fUpperBoundX, | |
544 | definition->fBinsY, | |
545 | definition->fLowerBoundY, | |
546 | definition->fUpperBoundY | |
547 | ); | |
548 | fHistograms2D->AddAt(fHistogram2DPointers[definition->fId], definition->fId); | |
549 | } | |
550 | } | |
551 | /// | |
552 | if (fHistograms3D) { | |
553 | fHistograms3D->SetOwner(kTRUE); | |
554 | fHistogram3DPointers.resize(kNumberOfHistograms3D, NULL); | |
555 | for (const AliHistogramDefinition3D* definition=fgkHistogramDefinitions3D; | |
556 | definition->fName!=NULL; definition++) { | |
bc3adc1e | 557 | fHistogram3DPointers[definition->fId]=new TH3D(definition->fName, |
69d38ee6 | 558 | definition->fTitle, |
559 | definition->fBinsX, | |
560 | definition->fLowerBoundX, | |
561 | definition->fUpperBoundX, | |
562 | definition->fBinsY, | |
563 | definition->fLowerBoundY, | |
564 | definition->fUpperBoundY, | |
565 | definition->fBinsZ, | |
566 | definition->fLowerBoundZ, | |
567 | definition->fUpperBoundZ | |
568 | ); | |
569 | fHistograms3D->AddAt(fHistogram3DPointers[definition->fId], definition->fId); | |
570 | } | |
571 | } | |
572 | ||
779a5a62 | 573 | } |
574 | ||
575 | const AliHLTTPCDataCompressionMonitorComponent::AliHistogramDefinition AliHLTTPCDataCompressionMonitorComponent::fgkHistogramDefinitions[] = { | |
bc3adc1e | 576 | {kHistogramPadrow, "padrow" , "padrow; padrow; counts" , 159, 0., 159.}, |
362b09a1 | 577 | {kHistogramHWCFPad, "hwcfpad" , "hwcfpad; pad; counts" , 280, 0., 140.}, |
578 | {kHistogramPad, "pad" , "pad; pad; counts" , 280, 0., 140.}, | |
bc3adc1e | 579 | {kHistogramTime, "timebin" , "timebin; time; counts" , 1024, 0., 1024.}, |
69d38ee6 | 580 | {kHistogramSigmaY2, "sigmaY2" , "sigmaY2; #sigma_{Y}^{2}; counts" , 100, 0., 1.}, |
581 | {kHistogramSigmaZ2, "sigmaZ2" , "sigmaZ2; #sigma_{Z}^{2}; counts" , 100, 0., 1.}, | |
bc3adc1e | 582 | {kHistogramCharge, "charge" , "charge; charge; counts" , 1024, 0., 65536.}, |
583 | {kHistogramQMax, "qmax" , "qmax; Q_{max}; counts" , 128, 0., 1024.}, | |
69d38ee6 | 584 | {kHistogramDeltaPadrow, "d_padrow" , "d_padrow; #Delta padrow; counts" , 1000, -1., 1.}, |
362b09a1 | 585 | {kHistogramDeltaPad, "d_pad" , "d_pad; #Delta pad; counts" , 1000, -1., 1.}, |
586 | {kHistogramDeltaTime, "d_time" , "d_time; #Delta time; counts" , 1000, -1., 1.}, | |
69d38ee6 | 587 | {kHistogramDeltaSigmaY2, "d_sigmaY2", "d_sigmaY2; #Delta #sigma_{Y}^{2}; counts", 1000, -1., 1.}, |
588 | {kHistogramDeltaSigmaZ2, "d_sigmaZ2", "d_sigmaZ2; #Delta #sigma_{Z}^{2}; counts", 1000, -1., 1.}, | |
589 | {kHistogramDeltaCharge, "d_charge" , "d_charge; #Delta charge" , 1000, -1., 1.}, | |
590 | {kHistogramDeltaQMax, "d_qmax" , "d_qmax; #Delta Q_{max}" , 1000, -1., 1.}, | |
362b09a1 | 591 | {kHistogramOutOfRange, "ResError" , "Residual Error; padrow; counts" , 159, 0., 159.}, |
69d38ee6 | 592 | {kNumberOfHistograms, NULL, NULL, 0,0.,0.} |
779a5a62 | 593 | }; |
594 | ||
69d38ee6 | 595 | const AliHLTTPCDataCompressionMonitorComponent::AliHistogramDefinition2D AliHLTTPCDataCompressionMonitorComponent::fgkHistogramDefinitions2D[] = { |
bc3adc1e | 596 | {kHistogramQMaxSector, "qmaxsector" , "qmaxsector; sector; Q_{max}" , 72,0.,72., 1024,0.,1024.}, |
597 | {kHistogramSigmaY2Sector, "sigmaY2sector", "sigmaY2sector; sector; #sigma_{Y}^{2}" , 72,0.,72., 100,0.,1.}, | |
598 | {kHistogramSigmaZ2Sector, "sigmaZ2sector", "sigmaZ2sector; sector; #sigma_{Z}^{2}" , 72,0.,72., 100,0.,1.}, | |
599 | {kHistogramXY, "XY", "XY; X[cm]; Y[cm]" , 100,-300.,300., 100,-300.,300.}, | |
69d38ee6 | 600 | {kNumberOfHistograms2D, NULL, NULL, 0,0.,0., 0,0.,0.} |
601 | }; | |
602 | ||
603 | const AliHLTTPCDataCompressionMonitorComponent::AliHistogramDefinition3D AliHLTTPCDataCompressionMonitorComponent::fgkHistogramDefinitions3D[] = { | |
bc3adc1e | 604 | {kHistogramPadrowPadSector,"padrowpadsector","padrowpadsector; sector; pad;padrow", 72,0.,72., 140,0.,140., 159,0.,159.}, |
69d38ee6 | 605 | {kNumberOfHistograms3D, NULL, NULL, 0,0.,0., 0,0.,0., 0,0.,0.} |
606 | }; | |
607 | ||
779a5a62 | 608 | AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::~AliDataContainer() |
609 | { | |
610 | /// dectructor | |
611 | if (fRawData) delete fRawData; | |
612 | if (fHistograms) delete fHistograms; | |
69d38ee6 | 613 | if (fHistograms2D) delete fHistograms2D; |
614 | if (fHistograms3D) delete fHistograms3D; | |
779a5a62 | 615 | } |
616 | ||
617 | AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::iterator& AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::BeginRemainingClusterBlock(int /*count*/, AliHLTUInt32_t specification) | |
618 | { | |
619 | /// iterator of remaining clusters block of specification | |
620 | AliHLTUInt8_t slice=AliHLTTPCDefinitions::GetMinSliceNr(specification); | |
621 | AliHLTUInt8_t partition=AliHLTTPCDefinitions::GetMinPatchNr(specification); | |
622 | unsigned index=slice*AliHLTTPCTransform::GetNumberOfPatches()+partition; | |
623 | if (index<fRemainingClusterIds.size()) | |
624 | fCurrentClusterIds=&fRemainingClusterIds[index]; | |
625 | else | |
626 | fCurrentClusterIds=NULL; | |
627 | fBegin=iterator(this); | |
779a5a62 | 628 | return fBegin; |
629 | } | |
630 | ||
631 | AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::iterator& AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::BeginTrackModelClusterBlock(int /*count*/) | |
632 | { | |
633 | /// iterator of track model clusters | |
634 | if (fTrackModelClusterIds.fIds && fTrackModelClusterIds.fSize>0) | |
635 | fCurrentClusterIds=&fTrackModelClusterIds; | |
636 | else | |
637 | fCurrentClusterIds=NULL; | |
638 | fBegin=iterator(this); | |
779a5a62 | 639 | return fBegin; |
640 | } | |
641 | ||
779a5a62 | 642 | int AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::AddRawData(const AliHLTComponentBlockData* pDesc) |
643 | { | |
362b09a1 | 644 | /// add raw data bloack |
645 | int iResult=0; | |
779a5a62 | 646 | if (pDesc->fDataType==AliHLTTPCDefinitions::HWClustersDataType()) { |
647 | if (!fRawData) fRawData=new AliHLTTPCHWCFSpacePointContainer(AliHLTTPCHWCFSpacePointContainer::kModeCreateMap); | |
648 | if (!fRawData) return -ENOMEM; | |
362b09a1 | 649 | if ((iResult=fRawData->AddInputBlock(pDesc))<0) return iResult; |
650 | AliHLTSpacePointContainer::AliHLTSpacePointPropertyGrid* pSpacePointGrid=AliHLTTPCHWCFSpacePointContainer::AllocateIndexGrid(); | |
651 | if (pSpacePointGrid) { | |
652 | fRawData->PopulateAccessGrid(pSpacePointGrid, pDesc->fSpecification); | |
653 | fRawData->SetSpacePointPropertyGrid(pDesc->fSpecification, pSpacePointGrid); | |
654 | } | |
655 | return 0; | |
779a5a62 | 656 | } |
657 | return -ENODATA; | |
658 | } | |
659 | ||
660 | int AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::AddClusterIds(const AliHLTComponentBlockData* pDesc) | |
661 | { | |
662 | /// add cluster id block for remaining or track model clusters | |
663 | if (!pDesc) return -EINVAL; | |
664 | if (pDesc->fDataType==AliHLTTPCDefinitions::ClusterIdTracksDataType()) { | |
665 | fTrackModelClusterIds.fIds=reinterpret_cast<AliHLTUInt32_t*>(pDesc->fPtr); | |
666 | fTrackModelClusterIds.fSize=pDesc->fSize/sizeof(AliHLTUInt32_t); | |
667 | return 0; | |
668 | } | |
669 | if (pDesc->fDataType==AliHLTTPCDefinitions::RemainingClusterIdsDataType()) { | |
670 | AliHLTUInt8_t slice=AliHLTTPCDefinitions::GetMinSliceNr(pDesc->fSpecification); | |
671 | AliHLTUInt8_t partition=AliHLTTPCDefinitions::GetMinPatchNr(pDesc->fSpecification); | |
672 | unsigned index=slice*AliHLTTPCTransform::GetNumberOfPatches()+partition; | |
673 | if (fRemainingClusterIds.size()<=index) { | |
674 | if ((int)fRemainingClusterIds.size()<AliHLTTPCTransform::GetNSlice()*AliHLTTPCTransform::GetNumberOfPatches()) { | |
675 | fRemainingClusterIds.resize(AliHLTTPCTransform::GetNSlice()*AliHLTTPCTransform::GetNumberOfPatches()); | |
676 | } else { | |
677 | fRemainingClusterIds.resize(index+1); | |
678 | } | |
679 | } | |
680 | fRemainingClusterIds[index].fIds=reinterpret_cast<AliHLTUInt32_t*>(pDesc->fPtr); | |
681 | fRemainingClusterIds[index].fSize=pDesc->fSize/sizeof(AliHLTUInt32_t); | |
682 | return 0; | |
683 | } | |
684 | return -ENODATA; | |
685 | } | |
686 | ||
687 | AliHLTUInt32_t AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::GetClusterId(int clusterNo) const | |
688 | { | |
689 | /// get the cluster id from the current cluster id block (optional) | |
690 | if (!fCurrentClusterIds || | |
6b6242a8 | 691 | clusterNo<0 || |
779a5a62 | 692 | (int)fCurrentClusterIds->fSize<=clusterNo) |
693 | return kAliHLTVoidDataSpec; | |
694 | return fCurrentClusterIds->fIds[clusterNo]; | |
695 | } | |
696 | ||
362b09a1 | 697 | AliHLTUInt32_t AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FindNearestCluster(int slice, int partition, const AliHLTTPCRawCluster& cluster) const |
698 | { | |
699 | /// get the cluster id of the nearest original cluster | |
700 | if (!fRawData) return kAliHLTVoidDataSpec; | |
701 | AliHLTUInt32_t key=AliHLTTPCDefinitions::EncodeDataSpecification(slice, slice, partition, partition); | |
702 | // FIXME: AliHLTIndexGrid::Index is not declared const | |
703 | AliHLTSpacePointContainer::AliHLTSpacePointPropertyGrid* pGrid=const_cast<AliHLTSpacePointContainer::AliHLTSpacePointPropertyGrid*>(fRawData->GetSpacePointPropertyGrid(key)); | |
704 | if (!pGrid) return kAliHLTVoidDataSpec; | |
705 | AliHLTUInt32_t clusterId=kAliHLTVoidDataSpec; | |
706 | // search a 4x4 matrix out of the 9x9 matrix around the cell addressed by | |
707 | // pad and time | |
708 | float padrow=(float)cluster.GetPadRow()-AliHLTTPCTransform::GetFirstRow(partition); | |
709 | float pad=cluster.GetPad(); | |
710 | float time=cluster.GetTime(); | |
711 | float minr2=-1.; | |
712 | const float padpitch=AliHLTTPCTransform::GetPadPitchWidth(partition); | |
713 | const float zwidth=AliHLTTPCTransform::GetZWidth(); | |
714 | float maxDeltaPad=AliHLTTPCDefinitions::GetMaxClusterDeltaPad(); | |
715 | float maxDeltaTime=AliHLTTPCDefinitions::GetMaxClusterDeltaTime(); | |
716 | int rowindex=pGrid->GetXIndex(padrow); | |
717 | int padstartindex=pGrid->GetYIndex(pad); | |
718 | int timestartindex=pGrid->GetZIndex(time); | |
719 | int cellindex=pGrid->Index(rowindex, padstartindex, timestartindex); | |
720 | float centerpad=pGrid->GetCenterY(cellindex); | |
721 | float centertime=pGrid->GetCenterZ(cellindex); | |
722 | if ((TMath::Abs(centerpad-pad)>maxDeltaPad && pad>0.) || | |
723 | (TMath::Abs(centertime-time)>maxDeltaTime && time>0.)) { | |
724 | ALIHLTERRORGUARD(20, "invalid pad center calculation, please check dimensions if dimensions of index grid match the maximum possible deviation"); | |
725 | } | |
726 | ||
727 | int paddirection=1; | |
728 | int timedirection=1; | |
729 | if (centerpad>pad) paddirection=-1; | |
730 | if (centertime>time) timedirection=-1; | |
731 | for (int padcount=0, padindex=padstartindex; padcount<2; padcount++, padindex+=paddirection) { | |
732 | if (padindex<0) continue; | |
733 | if (padindex>=pGrid->GetDimensionY()) break; | |
734 | for (int timecount=0, timeindex=timestartindex; timecount<2; timecount++, timeindex+=timedirection) { | |
735 | if (timeindex<0) continue; | |
736 | if (timeindex>=pGrid->GetDimensionZ()) break; | |
737 | cellindex=pGrid->Index(rowindex, padindex, timeindex); | |
738 | float cellpad=pGrid->GetCenterY(cellindex); | |
739 | float celltime=pGrid->GetCenterZ(cellindex); | |
740 | for (AliHLTSpacePointContainer::AliHLTSpacePointPropertyGrid::iterator& cl=pGrid->begin((float)padrow, cellpad, celltime); | |
741 | cl!=pGrid->end(); cl++) { | |
742 | if (cl.Data().fTrackId>=0) continue; | |
743 | if (fRawData->GetCharge(cl.Data().fId)!=cluster.GetCharge() || | |
744 | fRawData->GetQMax(cl.Data().fId)!=cluster.GetQMax()) continue; | |
745 | if (TMath::Abs(padrow-fRawData->GetX(cl.Data().fId))>=1.) { | |
746 | HLTError("slice %d, partition %d, cluster 0x%08x: mismatch on padrow: %f vs. cluster %f", slice, partition, cl.Data().fId, padrow, fRawData->GetX(cl.Data().fId)); | |
747 | continue; | |
748 | } | |
749 | float clusterpad=fRawData->GetY(cl.Data().fId); | |
750 | float clustertime=fRawData->GetZ(cl.Data().fId); | |
751 | clusterpad-=pad; | |
752 | clusterpad*=padpitch; | |
753 | clustertime-=time; | |
754 | clustertime*=zwidth; | |
755 | float r2=clusterpad*clusterpad+clustertime*clustertime; | |
756 | if (minr2<0. || r2<minr2) { | |
757 | clusterId=cl.Data().fId; | |
758 | cl.Data().fTrackId=1; | |
759 | minr2=r2; | |
760 | } | |
761 | } | |
762 | } | |
763 | } | |
764 | return clusterId; | |
765 | } | |
766 | ||
767 | void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillPadRow(int row, int slice, AliHLTUInt32_t /*clusterId*/) | |
779a5a62 | 768 | { |
769 | /// fill padrow histogram | |
770 | unsigned index=kHistogramPadrow; | |
362b09a1 | 771 | fCurrentCluster.SetPadRow(row); |
69d38ee6 | 772 | // the inner sectors consist of readout partitions 0 and 1, if the row |
773 | // is smaller than first row of readout partition 2, its an inner sector | |
774 | if (row<AliHLTTPCTransform::GetFirstRow(2)) { | |
775 | fSector = slice; | |
776 | } else { | |
777 | fSector = slice+AliHLTTPCTransform::GetNSlice(); | |
778 | } | |
779a5a62 | 779 | if (index<fHistogramPointers.size() && fHistogramPointers[index]!=NULL) |
780 | fHistogramPointers[index]->Fill(row); | |
779a5a62 | 781 | } |
782 | ||
362b09a1 | 783 | void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillPad(float pad, AliHLTUInt32_t /*clusterId*/) |
779a5a62 | 784 | { |
785 | /// fill pad histogram | |
362b09a1 | 786 | fCurrentCluster.SetPad(pad); |
787 | int currentRow=fCurrentCluster.GetPadRow(); | |
779a5a62 | 788 | unsigned index=kHistogramPad; |
789 | if (index<fHistogramPointers.size() && fHistogramPointers[index]!=NULL) | |
790 | fHistogramPointers[index]->Fill(pad); | |
69d38ee6 | 791 | |
792 | index=kHistogramPadrowPadSector; | |
793 | if (index<fHistogram3DPointers.size() && fHistogram3DPointers[index]!=NULL) | |
362b09a1 | 794 | fHistogram3DPointers[index]->Fill(fSector,pad,currentRow); |
bc3adc1e | 795 | |
796 | AliTPCROC *roc=AliTPCROC::Instance(); | |
797 | Float_t pos[2]={0}; | |
362b09a1 | 798 | roc->GetPositionGlobal(fSector, fSector>35?currentRow-63:currentRow, pad, pos); |
bc3adc1e | 799 | index=kHistogramXY; |
800 | if (index<fHistogram2DPointers.size() && fHistogram2DPointers[index]!=NULL) | |
801 | fHistogram2DPointers[index]->Fill(pos[0],pos[1]); | |
802 | ||
779a5a62 | 803 | } |
804 | ||
362b09a1 | 805 | void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillTime(float time, AliHLTUInt32_t /*clusterId*/) |
779a5a62 | 806 | { |
807 | /// fill pad histogram | |
362b09a1 | 808 | fCurrentCluster.SetTime(time); |
779a5a62 | 809 | unsigned index=kHistogramTime; |
810 | if (index<fHistogramPointers.size() && fHistogramPointers[index]!=NULL) | |
811 | fHistogramPointers[index]->Fill(time); | |
779a5a62 | 812 | } |
813 | ||
362b09a1 | 814 | void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillSigmaY2(float sigmaY2, AliHLTUInt32_t /*clusterId*/, int partition) |
779a5a62 | 815 | { |
816 | /// fill sigmaY2 histogram | |
362b09a1 | 817 | fCurrentCluster.SetSigmaY2(sigmaY2); |
779a5a62 | 818 | unsigned index=kHistogramSigmaY2; |
ac30bb87 | 819 | /// take account for different pad widths |
820 | float weight=AliHLTTPCTransform::GetPadPitchWidth(partition); | |
779a5a62 | 821 | if (index<fHistogramPointers.size() && fHistogramPointers[index]!=NULL) |
ac30bb87 | 822 | fHistogramPointers[index]->Fill(sigmaY2*weight*weight); |
69d38ee6 | 823 | |
824 | index=kHistogramSigmaY2Sector; | |
825 | if (index<fHistogram2DPointers.size() && fHistogram2DPointers[index]!=NULL) | |
826 | fHistogram2DPointers[index]->Fill(fSector,sigmaY2*weight*weight); | |
827 | ||
779a5a62 | 828 | } |
829 | ||
362b09a1 | 830 | void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillSigmaZ2(float sigmaZ2, AliHLTUInt32_t /*clusterId*/) |
779a5a62 | 831 | { |
832 | /// fill sigmaZ2 histogram | |
362b09a1 | 833 | fCurrentCluster.SetSigmaZ2(sigmaZ2); |
779a5a62 | 834 | unsigned index=kHistogramSigmaZ2; |
ac30bb87 | 835 | // FIXME: this is just a fixed value, to be correct the values from the global |
836 | // parameter block has to be used | |
837 | float weight=AliHLTTPCTransform::GetZWidth(); | |
779a5a62 | 838 | if (index<fHistogramPointers.size() && fHistogramPointers[index]!=NULL) |
ac30bb87 | 839 | fHistogramPointers[index]->Fill(sigmaZ2*weight*weight); |
69d38ee6 | 840 | |
841 | index=kHistogramSigmaZ2Sector; | |
842 | if (index<fHistogram2DPointers.size() && fHistogram2DPointers[index]!=NULL) | |
843 | fHistogram2DPointers[index]->Fill(fSector,sigmaZ2*weight*weight); | |
844 | ||
779a5a62 | 845 | } |
846 | ||
362b09a1 | 847 | void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillCharge(unsigned charge, AliHLTUInt32_t /*clusterId*/) |
779a5a62 | 848 | { |
849 | /// fill charge histogram | |
362b09a1 | 850 | fCurrentCluster.SetCharge(charge); |
779a5a62 | 851 | unsigned index=kHistogramCharge; |
852 | if (index<fHistogramPointers.size() && fHistogramPointers[index]!=NULL) | |
853 | fHistogramPointers[index]->Fill(charge); | |
779a5a62 | 854 | } |
855 | ||
362b09a1 | 856 | void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillQMax(unsigned qmax, AliHLTUInt32_t /*clusterId*/) |
779a5a62 | 857 | { |
858 | /// fill qmax histogram | |
362b09a1 | 859 | fCurrentCluster.SetQMax(qmax); |
779a5a62 | 860 | unsigned index=kHistogramQMax; |
861 | if (index<fHistogramPointers.size() && fHistogramPointers[index]!=NULL) | |
862 | fHistogramPointers[index]->Fill(qmax); | |
69d38ee6 | 863 | |
864 | index=kHistogramQMaxSector; | |
865 | if (index<fHistogram2DPointers.size() && fHistogram2DPointers[index]!=NULL) | |
866 | fHistogram2DPointers[index]->Fill(fSector,qmax); | |
362b09a1 | 867 | } |
868 | ||
869 | void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::Fill(int slice, int partition, AliHLTUInt32_t clusterId) | |
870 | { | |
871 | /// fill cluster histograms requiring the full cluster information | |
872 | ||
873 | // TODO: the complete filling of histograms can be moved to this function | |
874 | // and the cluster struct be filled in the iterator | |
875 | // The delta histograms are filled here either by using the specified | |
876 | // cluster, or the nearest cluster on the padrow with identical charge | |
877 | // and qmax is searched for comparison. | |
878 | if (clusterId==kAliHLTVoidDataSpec) { | |
879 | clusterId=FindNearestCluster(slice, partition, fCurrentCluster); | |
880 | } | |
881 | if (clusterId==kAliHLTVoidDataSpec) return; | |
882 | bool bResidualError=false; | |
883 | int currentRow=fCurrentCluster.GetPadRow(); | |
884 | ||
885 | unsigned index=kHistogramDeltaPadrow; | |
886 | if (index<fHistogramPointers.size() && fHistogramPointers[index]!=NULL && fRawData) { | |
887 | if (fRawData->Check(clusterId)) { | |
888 | fHistogramPointers[index]->Fill(fCurrentCluster.GetPadRow()-fRawData->GetX(clusterId)); | |
889 | } | |
890 | } | |
891 | ||
892 | index=kHistogramDeltaPad; | |
893 | if (index<fHistogramPointers.size() && fHistogramPointers[index]!=NULL && fRawData) { | |
894 | if (fRawData->Check(clusterId)) { | |
895 | float dPad=fCurrentCluster.GetPad()-fRawData->GetY(clusterId); | |
896 | fHistogramPointers[index]->Fill(dPad); | |
897 | static const float maxdPad=0.015; // better 100um for 4 and 6mm pad width | |
898 | if (TMath::Abs(dPad)>maxdPad) { | |
899 | //HLTError("cluster 0x%08x slice %d partition %d: pad difference %f - max %f", clusterId, slice, partition, dPad, maxdPad); | |
900 | bResidualError=true; | |
901 | } | |
902 | } | |
903 | } | |
904 | ||
905 | index=kHistogramDeltaTime; | |
906 | if (index<fHistogramPointers.size() && fHistogramPointers[index]!=NULL && fRawData) { | |
907 | if (fRawData->Check(clusterId)) { | |
908 | float dTime=fCurrentCluster.GetTime()-fRawData->GetZ(clusterId); | |
909 | fHistogramPointers[index]->Fill(dTime); | |
910 | static const float maxdTime=0.04; // corresponds to 100um | |
911 | if (TMath::Abs(dTime)>maxdTime) { | |
912 | //HLTError("cluster 0x%08x slice %d partition %d: time difference %f - max %f", clusterId, slice, partition, dTime, maxdTime); | |
913 | bResidualError=true; | |
914 | } | |
915 | } | |
916 | } | |
917 | ||
918 | index=kHistogramDeltaSigmaY2; | |
919 | if (index<fHistogramPointers.size() && fHistogramPointers[index]!=NULL && fRawData) { | |
920 | if (fRawData->Check(clusterId)) { | |
921 | fHistogramPointers[index]->Fill(fCurrentCluster.GetSigmaY2()-fRawData->GetYWidth(clusterId)); | |
922 | } | |
923 | } | |
924 | ||
925 | index=kHistogramDeltaSigmaZ2; | |
926 | if (index<fHistogramPointers.size() && fHistogramPointers[index]!=NULL && fRawData) { | |
927 | if (fRawData->Check(clusterId)) { | |
928 | fHistogramPointers[index]->Fill(fCurrentCluster.GetSigmaZ2()-fRawData->GetZWidth(clusterId)); | |
929 | } | |
930 | } | |
931 | ||
932 | index=kHistogramDeltaCharge; | |
933 | if (index<fHistogramPointers.size() && fHistogramPointers[index]!=NULL && fRawData) { | |
934 | if (fRawData->Check(clusterId)) { | |
935 | fHistogramPointers[index]->Fill(fCurrentCluster.GetCharge()-fRawData->GetCharge(clusterId)); | |
936 | } | |
937 | } | |
69d38ee6 | 938 | |
779a5a62 | 939 | index=kHistogramDeltaQMax; |
940 | if (index<fHistogramPointers.size() && fHistogramPointers[index]!=NULL && fRawData) { | |
941 | if (fRawData->Check(clusterId)) { | |
362b09a1 | 942 | fHistogramPointers[index]->Fill(fCurrentCluster.GetQMax()-fRawData->GetQMax(clusterId)); |
779a5a62 | 943 | } |
944 | } | |
362b09a1 | 945 | |
946 | if (bResidualError) { | |
947 | index=kHistogramOutOfRange; | |
948 | if (index<fHistogramPointers.size() && fHistogramPointers[index]!=NULL && fRawData) { | |
949 | fHistogramPointers[index]->Fill(currentRow>=0?currentRow:0); | |
950 | } | |
951 | } | |
952 | ||
953 | index=kHistogramHWCFPad; | |
954 | if (index<fHistogramPointers.size() && fHistogramPointers[index]!=NULL && fRawData) | |
955 | fHistogramPointers[index]->Fill(fRawData->GetY(clusterId)); | |
779a5a62 | 956 | } |
957 | ||
958 | void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::Clear(Option_t * option) | |
959 | { | |
960 | /// internal cleanup | |
961 | if (fRawData) fRawData->Clear(option); | |
962 | } | |
963 | ||
69d38ee6 | 964 | TObject* AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FindObject(const char *name) const |
779a5a62 | 965 | { |
966 | /// get histogram object | |
a6267876 | 967 | if (!name) return NULL; |
69d38ee6 | 968 | if ( strcmp(name,"fHistograms") == 0 ) |
969 | return fHistograms; | |
970 | if ( strcmp(name,"fHistograms2D") == 0 ) | |
971 | return fHistograms2D; | |
972 | if ( strcmp(name,"fHistograms3D") == 0 ) | |
973 | return fHistograms3D; | |
974 | ||
975 | return NULL; | |
779a5a62 | 976 | } |