]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/comp/AliHLTTPCDataCompressionComponent.cxx
printing benchmark message only if input contains clusters
[u/mrichter/AliRoot.git] / HLT / TPCLib / comp / AliHLTTPCDataCompressionComponent.cxx
index 18d50f637ec52a335c6492598e542739f7a94caf..51c569d4cee664e7bfe893a663975a0e8edf72d1 100644 (file)
@@ -1,6 +1,6 @@
 // $Id$
 //**************************************************************************
-//* This file is property of and copyright by the ALICE HLT Project        * 
+//* This file is property of and copyright by the                          * 
 //* ALICE Experiment at CERN, All rights reserved.                         *
 //*                                                                        *
 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
@@ -94,8 +94,8 @@ void AliHLTTPCDataCompressionComponent::GetInputDataTypes( AliHLTComponentDataTy
 {
   /// inherited from AliHLTComponent: list of data types in the vector reference
   tgtList.clear();
-  tgtList.push_back(AliHLTTPCDefinitions::fgkHWClustersDataType);
-  tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
+  tgtList.push_back(AliHLTTPCDefinitions::HWClustersDataType());
+  tgtList.push_back(AliHLTTPCDefinitions::ClustersDataType());
   tgtList.push_back(kAliHLTDataTypeTrack|kAliHLTDataOriginTPC);
 }
 
@@ -489,7 +489,7 @@ int AliHLTTPCDataCompressionComponent::DoEvent( const AliHLTComponentEventData&
   else compressionFactor=0.;
   if (fHistoCompFactor) fHistoCompFactor->Fill(compressionFactor);
 
-  if (GetBenchmarkInstance()) {
+  if (GetBenchmarkInstance() && allClusters>0) {
     GetBenchmarkInstance()->Stop(0);
     if (fDeflaterMode!=3) {
       HLTBenchmark("%s - compression factor %.2f", GetBenchmarkInstance()->GetStatistics(), compressionFactor);
@@ -878,12 +878,25 @@ int AliHLTTPCDataCompressionComponent::InitDeflater(int mode)
       if (iResult<0) return iResult;
     }
     
+    if (!fHistogramFile.IsNull())
+      deflater->EnableStatistics();
+
     unsigned nofParameters=AliHLTTPCDefinitions::GetNumberOfClusterParameterDefinitions();
     unsigned p=0;
     for (; p<nofParameters; p++) {
       const AliHLTTPCDefinitions::AliClusterParameter& parameter=AliHLTTPCDefinitions::fgkClusterParameterDefinitions[p];
+      // use the pad/time length as reference for the calculation of ratio for residuals
+      unsigned refLength=0;
+      unsigned refLengthPad=0;
+      unsigned refLengthTime=0;
+      if (parameter.fId==AliHLTTPCDefinitions::kPad)               refLengthPad=parameter.fBitLength;
+      else if (parameter.fId==AliHLTTPCDefinitions::kTime)         refLengthTime=parameter.fBitLength;
+      else if (parameter.fId==AliHLTTPCDefinitions::kResidualPad)  refLength=refLengthPad;
+      else if (parameter.fId==AliHLTTPCDefinitions::kResidualTime) refLength=refLengthTime;
+
       if (deflater->AddParameterDefinition(parameter.fName,
-                                          parameter.fBitLength)!=(int)parameter.fId) {
+                                          parameter.fBitLength,
+                                          refLength)!=(int)parameter.fId) {
        // for performance reason the parameter id is simply used as index in the array of
        // definitions, the position must match the id
        HLTFatal("mismatch between parameter id and position in array for parameter %s, rearrange definitions!", parameter.fName);
@@ -897,6 +910,9 @@ int AliHLTTPCDataCompressionComponent::InitDeflater(int mode)
     std::auto_ptr<AliHLTDataDeflaterSimple> deflater(new AliHLTDataDeflaterSimple);
     if (!deflater.get()) return -ENOMEM;
 
+    if (!fHistogramFile.IsNull())
+      deflater->EnableStatistics();
+
     unsigned nofParameters=AliHLTTPCDefinitions::GetNumberOfClusterParameterDefinitions();
     unsigned p=0;
     for (; p<nofParameters; p++) {
@@ -1106,6 +1122,7 @@ int AliHLTTPCDataCompressionComponent::CalculateDriftTimeTransformation(AliHLTTP
     meanT+=time;
     meanZ+=xyz[2];
   }
+  if (count==0) count=1;
   meanT/=count;
   meanZ/=count;
   float sumTZ=.0;