]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
TPC KrCF and Cluster property plotting (Kenneth & Gaute)
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 20 May 2008 04:48:00 +0000 (04:48 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 20 May 2008 04:48:00 +0000 (04:48 +0000)
- added AliHLTTPCClusterHistoComponent: plotting of TPC cluster
  parameters
- added AliHLTTPCClusterDumpComponent: A debug component dumping the
  AliHLTTPCClusterData to asci file
- common cluster data output for TPC CF and KryptonClusterFinder
  moved all histogramming functionality to separate component.
- KrCF maintains list of hardware addresses of pads belonging to a krypton cluster.
- AliHLTTPCHistogramHandler: Updated to handle clusterdata, and produce
  spectrum and QMax plots

13 files changed:
HLT/TPCLib/AliHLTTPCAgent.cxx
HLT/TPCLib/AliHLTTPCClusterDumpComponent.cxx [new file with mode: 0644]
HLT/TPCLib/AliHLTTPCClusterDumpComponent.h [new file with mode: 0644]
HLT/TPCLib/AliHLTTPCClusterHistoComponent.cxx [new file with mode: 0644]
HLT/TPCLib/AliHLTTPCClusterHistoComponent.h [new file with mode: 0644]
HLT/TPCLib/AliHLTTPCClusters.cxx
HLT/TPCLib/AliHLTTPCClusters.h
HLT/TPCLib/AliHLTTPCHistogramHandlerComponent.cxx
HLT/TPCLib/AliHLTTPCHistogramHandlerComponent.h
HLT/TPCLib/AliHLTTPCKryptonClusterFinder.cxx
HLT/TPCLib/AliHLTTPCKryptonClusterFinder.h
HLT/TPCLib/AliHLTTPCKryptonClusterFinderComponent.cxx
HLT/TPCLib/AliHLTTPCKryptonClusterFinderComponent.h

index 7a91aa916eadba3b3ffc2efc04360d9df7c6959f..85b649a317a42979e62e658348309edb3b98cb8a 100644 (file)
@@ -1,20 +1,20 @@
 // @(#) $Id$
 
-/**************************************************************************
- * This file is property of and copyright by the ALICE HLT Project        * 
- * ALICE Experiment at CERN, All rights reserved.                         *
- *                                                                        *
- * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
- *                  for The ALICE HLT Project.                            *
- *                                                                        *
- * Permission to use, copy, modify and distribute this software and its   *
- * documentation strictly for non-commercial purposes is hereby granted   *
- * without fee, provided that the above copyright notice appears in all   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//*                                                                        *
+//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
+//*                  for The ALICE HLT Project.                            *
+//*                                                                        *
+//* Permission to use, copy, modify and distribute this software and its   *
+//* documentation strictly for non-commercial purposes is hereby granted   *
+//* without fee, provided that the above copyright notice appears in all   *
+//* copies and that both the copyright notice and this permission notice   *
+//* appear in the supporting documentation. The authors make no claims     *
+//* about the suitability of this software for any purpose. It is          *
+//* provided "as is" without express or implied warranty.                  *
+//**************************************************************************
 
 /** @file   AliHLTTPCAgent.cxx
     @author Matthias Richter
@@ -50,9 +50,11 @@ AliHLTTPCAgent gAliHLTTPCAgent;
 #include "AliHLTTPCDigitPublisherComponent.h"
 #include "AliHLTTPCZeroSuppressionComponent.h"
 #include "AliHLTTPCDigitDumpComponent.h"
+#include "AliHLTTPCClusterDumpComponent.h"
 #include "AliHLTTPCEsdWriterComponent.h"
 #include "AliHLTTPCOfflineClustererComponent.h"
 #include "AliHLTTPCOfflineTrackerComponent.h"
+#include "AliHLTTPCClusterHistoComponent.h"
 
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTTPCAgent)
@@ -177,10 +179,12 @@ int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
   pHandler->AddComponent(new AliHLTTPCDigitPublisherComponent);
   pHandler->AddComponent(new AliHLTTPCZeroSuppressionComponent);
   pHandler->AddComponent(new AliHLTTPCDigitDumpComponent);
+  pHandler->AddComponent(new AliHLTTPCClusterDumpComponent);
   pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliWriter);
   pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliConverter);
   pHandler->AddComponent(new AliHLTTPCOfflineClustererComponent);
   pHandler->AddComponent(new AliHLTTPCOfflineTrackerComponent);
+  pHandler->AddComponent(new AliHLTTPCClusterHistoComponent);
 
   return 0;
 }
diff --git a/HLT/TPCLib/AliHLTTPCClusterDumpComponent.cxx b/HLT/TPCLib/AliHLTTPCClusterDumpComponent.cxx
new file mode 100644 (file)
index 0000000..78463c0
--- /dev/null
@@ -0,0 +1,165 @@
+// $Id$
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//*                                                                        *
+//* Primary Authors: Kenneth Aamodt <Kenneth.Aamodt@cern.ch>               *
+//*                  for The ALICE HLT Project.                            *
+//*                                                                        *
+//* Permission to use, copy, modify and distribute this software and its   *
+//* documentation strictly for non-commercial purposes is hereby granted   *
+//* without fee, provided that the above copyright notice appears in all   *
+//* copies and that both the copyright notice and this permission notice   *
+//* appear in the supporting documentation. The authors make no claims     *
+//* about the suitability of this software for any purpose. It is          *
+//* provided "as is" without express or implied warranty.                  *
+//**************************************************************************
+
+/** @file   AliHLTTPCClusterDumpComponent.cxx
+    @author Kenneth Aamodt
+    @date   
+    @brief  Special file writer converting TPC clusters input to readable
+            ASCII format. 
+*/
+
+#include <cassert>
+#include "AliHLTTPCClusterDumpComponent.h"
+#include "AliHLTTPCDefinitions.h"
+#include "AliHLTTPCSpacePointData.h"
+#include "AliHLTTPCClusterDataFormat.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTTPCClusterDumpComponent)
+
+  AliHLTTPCClusterDumpComponent::AliHLTTPCClusterDumpComponent()
+    :
+    AliHLTFileWriter(),
+    fDirectory("")
+{
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTTPCClusterDumpComponent::~AliHLTTPCClusterDumpComponent()
+{
+  // see header file for class documentation
+}
+
+const char* AliHLTTPCClusterDumpComponent::GetComponentID()
+{
+  // see header file for class documentation
+  return "TPCClusterDump";
+}
+
+void AliHLTTPCClusterDumpComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
+{
+  // see header file for class documentation
+  list.clear();
+  list.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
+}
+
+AliHLTComponent* AliHLTTPCClusterDumpComponent::Spawn()
+{
+  // see header file for class documentation
+  return new AliHLTTPCClusterDumpComponent;
+}
+
+int AliHLTTPCClusterDumpComponent::InitWriter()
+{
+  // see header file for class documentation
+  return 0;
+}
+
+int AliHLTTPCClusterDumpComponent::ScanArgument(int argc, const char** argv)
+{
+  // see header file for class documentation
+
+  TString argument="";
+  bool bMissingParam=0;
+  int i=0;
+  do {
+    if (i>=argc || (argument=argv[i]).IsNull()) continue;
+    
+    // -directory
+    if (argument.CompareTo("-directory")==0) {
+      if ((bMissingParam=(++i>=argc))) break;
+      fDirectory=argv[i];
+      break;
+    }
+  }while(0);
+
+  HLTWarning("AliHLTTPCClusterDumpComponent does not have any arguments at this time");
+  return 0;
+}
+
+int AliHLTTPCClusterDumpComponent::CloseWriter()
+{
+  // see header file for class documentation
+  return 0;
+}
+
+int AliHLTTPCClusterDumpComponent::DumpEvent( const AliHLTComponentEventData& evtData,
+                                             const AliHLTComponentBlockData* /*blocks*/, 
+                                             AliHLTComponentTriggerData& /*trigData*/ )
+{
+  // see header file for class documentation
+
+  HLTDebug("Entering DumpEvent");
+
+  int iResult=0;
+  int blockno=0;
+  const AliHLTComponentBlockData* pDesc=NULL;
+
+  Int_t spacePointCounter=0;
+
+  //building the filename
+  fCurrentFileName="";
+  ios::openmode filemode=(ios::openmode)0;
+  if (!fDirectory.IsNull()) {
+    fCurrentFileName+=fDirectory;
+  }
+  fCurrentFileName+="TPCClusterDump_Event";
+  fCurrentFileName+=Form("_%d", GetEventCount());
+  ofstream dump(fCurrentFileName.Data(), filemode);
+
+  for (pDesc=GetFirstInputBlock(AliHLTTPCDefinitions::fgkClustersDataType); pDesc!=NULL; pDesc=GetNextInputBlock(), blockno++) {
+    HLTDebug("event %Lu block %d: %s 0x%08x size %d", evtData.fEventID, blockno, DataType2Text(pDesc->fDataType).c_str(), pDesc->fSpecification, pDesc->fSize);
+
+    if(pDesc->fDataType!=AliHLTTPCDefinitions::fgkClustersDataType){continue;}
+     if (dump.good()) {
+       iResult=1;
+       const AliHLTTPCClusterData* clusterData = (const AliHLTTPCClusterData*) pDesc->fPtr;
+       Int_t nSpacepoints = (Int_t) clusterData->fSpacePointCnt;
+       AliHLTTPCSpacePointData *clusters = (AliHLTTPCSpacePointData*) &clusterData->fSpacePoints;
+       
+       for(int i=0;i<nSpacepoints;i++){
+        dump << "" << endl;
+        dump << "ClusterNumber: " << spacePointCounter << endl;
+        dump << "Slice:         " << clusters[i].fUsed    << endl;//quick fix to get the partiion and slice numbers to the clusterdump
+        dump << "Partition:     " << clusters[i].fTrackN  << endl;//quick fix to get the partiion and slice numbers to the clusterdump
+        dump << "X:             " << clusters[i].fX       << endl;
+        dump << "Y:             " << clusters[i].fY       << endl;
+        dump << "Z:             " << clusters[i].fZ       << endl;
+        dump << "ID:            " << clusters[i].fID      << endl;
+        dump << "Pad row:       " << clusters[i].fPadRow << endl;
+        dump << "fSigmaY2:      " << clusters[i].fSigmaY2 << endl;
+        dump << "fSigmaZ2:      " << clusters[i].fSigmaZ2 << endl;
+        dump << "Charge:        " << clusters[i].fCharge << endl;
+        dump << "Q Max:         " << clusters[i].fMaxQ << endl;
+        spacePointCounter++;
+       }
+       
+     }
+     else {
+       HLTError("can not open file %s for writing", fCurrentFileName.Data());
+       iResult=-EBADF;
+     }
+
+    dump.close();
+  }
+  return iResult;
+}
diff --git a/HLT/TPCLib/AliHLTTPCClusterDumpComponent.h b/HLT/TPCLib/AliHLTTPCClusterDumpComponent.h
new file mode 100644 (file)
index 0000000..f58507b
--- /dev/null
@@ -0,0 +1,74 @@
+//-*- Mode: C++ -*-
+// $Id$
+
+#ifndef ALIHLTTPCCLUSTERDUMPCOMPONENT_H
+#define ALIHLTTPCCLUSTERDUMPCOMPONENT_H
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//* See cxx source for full Copyright notice                               *
+
+/** @file   AliHLTTPCClusterDumpComponent.h
+    @author Kenneth Aamodt, Matthias Richter
+    @date   
+    @brief  Special file writer converting TPC clusters input to readable ASCII format.
+*/
+
+#include "AliHLTFileWriter.h"
+
+/**
+ * @class AliHLTTPCClusterDumpComponent
+ * A converter for TPC clusters to ASCII output.
+ * Data blocks of type :AliHLTTPCDefinition::fgkClustersDataType and origin 'TPC ' is
+ * written in readable ASCII format to a file.
+ * 
+ * Component ID: \b TPCClusterDump <br>
+ * Library: \b libAliHLTTPC
+ *
+ * See AliHLTFileWriter for arguments, further specific options
+ * Mandatory arguments: <br>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ *
+ * Optional arguments: <br>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ * \li -directory    <i> directory   </i> <br>
+ *      the files will be put in.
+ *      default './' 
+ *
+ * @ingroup alihlt_tpc_components
+ */
+class AliHLTTPCClusterDumpComponent : public AliHLTFileWriter {
+ public:
+  /** default constructor */
+  AliHLTTPCClusterDumpComponent();
+  /** destructor */
+  virtual ~AliHLTTPCClusterDumpComponent();
+
+  // interface functions: property getters
+  virtual const char* GetComponentID();
+  virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list);
+  virtual AliHLTComponent* Spawn();
+
+ protected:
+  // interface functions: processing
+  int InitWriter();
+  int CloseWriter();
+  int DumpEvent( const AliHLTComponentEventData& evtData,
+                const AliHLTComponentBlockData* blocks, 
+                AliHLTComponentTriggerData& trigData );
+  using AliHLTDataSink::DumpEvent;
+
+  int ScanArgument(int argc, const char** argv);
+
+ private:
+  /** copy constructor prohibited */
+  AliHLTTPCClusterDumpComponent(const AliHLTTPCClusterDumpComponent&);
+  /** assignment operator prohibited */
+  AliHLTTPCClusterDumpComponent& operator=(const AliHLTTPCClusterDumpComponent&);
+
+  /** target directory */
+  TString    fDirectory;                                           // see above
+
+  ClassDef(AliHLTTPCClusterDumpComponent, 0);
+};
+
+#endif
diff --git a/HLT/TPCLib/AliHLTTPCClusterHistoComponent.cxx b/HLT/TPCLib/AliHLTTPCClusterHistoComponent.cxx
new file mode 100644 (file)
index 0000000..10f4ba9
--- /dev/null
@@ -0,0 +1,341 @@
+// $Id$
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//*                                                                        *
+//* Primary Authors: Gaute Ovrebekk <ovrebekk@ift.uib.no>                  *
+//*                  for The ALICE HLT Project.                            *
+//*                                                                        *
+//* Permission to use, copy, modify and distribute this software and its   *
+//* documentation strictly for non-commercial purposes is hereby granted   *
+//* without fee, provided that the above copyright notice appears in all   *
+//* copies and that both the copyright notice and this permission notice   *
+//* appear in the supporting documentation. The authors make no claims     *
+//* about the suitability of this software for any purpose. It is          *
+//* provided "as is" without express or implied warranty.                  *
+//**************************************************************************
+
+/** @file   AliHLTTPCClusterHistoComponent.cxx
+    @author Gaute Ovrebekk
+    @brief  Component for ploting charge in clusters
+*/
+
+#if __GNUC__>= 3
+using namespace std;
+#endif
+
+#include "AliHLTTPCClusterHistoComponent.h"
+#include "AliHLTTPCTransform.h"
+#include "AliHLTTPCClusterDataFormat.h"
+#include "AliHLTTPCTrackletDataFormat.h"
+#include "AliHLTTPCMemHandler.h"
+#include "AliHLTTPCDefinitions.h"
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
+#include <TFile.h>
+#include <TString.h>
+#include "TObjString.h"
+#include "TObjArray.h"
+
+//#include "AliHLTTPC.h"
+//#include <stdlib.h>
+//#include <cerrno>
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTTPCClusterHistoComponent)
+
+AliHLTTPCClusterHistoComponent::AliHLTTPCClusterHistoComponent()
+:
+fTotalClusterChargeOROCAll(NULL),                     
+  fTotalClusterChargeIROCAll(NULL),                   
+  fTotalClusterChargeROCSelection(NULL),               
+  fTotalClusterChargePartitionSelection(NULL),         
+  fQMaxPartitionAll(NULL),                             
+  fQMaxROCAll(NULL),                              
+  fNumberOfClusters(NULL),                        
+  fPlotChargeOROCAll(kTRUE),   
+  fPlotChargeIROCAll(kTRUE),
+  fPlotChargeROCSel(kFALSE), 
+  fPlotChargePartSel(kFALSE),
+  fPlotQmaxPartAll(kTRUE),  
+  fPlotQmaxROCAll(kTRUE),   
+  fPlotNClusters(kFALSE)    
+{
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+}
+
+AliHLTTPCClusterHistoComponent::~AliHLTTPCClusterHistoComponent()
+{
+  // see header file for class documentation
+}
+
+// Public functions to implement AliHLTComponent's interface.
+// These functions are required for the registration process
+
+const char* AliHLTTPCClusterHistoComponent::GetComponentID()
+{
+  // see header file for class documentation
+  
+  return "TPCClusterHisto";
+}
+
+void AliHLTTPCClusterHistoComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
+{
+  // see header file for class documentation
+  list.clear();
+  list.push_back( AliHLTTPCDefinitions::fgkClustersDataType );
+}
+
+AliHLTComponentDataType AliHLTTPCClusterHistoComponent::GetOutputDataType()
+{
+  // see header file for class documentation
+  return kAliHLTDataTypeHistogram;
+
+}
+
+void AliHLTTPCClusterHistoComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
+{
+  // see header file for class documentation
+  // XXX TODO: Find more realistic values.
+  constBase = 80000;
+  inputMultiplier = 1;
+}
+
+AliHLTComponent* AliHLTTPCClusterHistoComponent::Spawn()
+{
+  // see header file for class documentation
+  return new AliHLTTPCClusterHistoComponent;
+}
+
+int AliHLTTPCClusterHistoComponent::DoInit( int argc, const char** argv )
+{
+  //  HLTFatal("Initializing with log fatal");
+  //  cout<<"Initializing with cout"<<endl;
+  
+  fPlotChargeOROCAll=kTRUE;   
+  fPlotChargeIROCAll=kTRUE;
+  fPlotChargeROCSel=kFALSE; 
+  fPlotChargePartSel=kFALSE;
+  fPlotQmaxPartAll=kTRUE;  
+  fPlotQmaxROCAll=kTRUE;   
+  fPlotNClusters=kTRUE;
+   
+  if(fPlotChargeOROCAll){fTotalClusterChargeOROCAll = new TH1F("fTotalClusterChargeOROCAll","Total Charge of clusters in all OROC",4000,0,4000);}
+  if(fPlotChargeIROCAll){fTotalClusterChargeIROCAll = new TH1F("fTotalClusterChargeIROCAll","Total Charge of clusters in all IROC",4000,0,4000);}
+  if(fPlotChargeROCSel){fTotalClusterChargeROCSelection = new TH1F("fTotalClusterChargeROCSelection","Total Charge of clusters in selection ROC",4000,0,4000);}
+  if(fPlotChargePartSel){fTotalClusterChargePartitionSelection = new TH1F("fTotalClusterChargePartitionSelection","Total Charge of clusters in sel Part",4000,0,4000);}
+  if(fPlotQmaxPartAll){fQMaxPartitionAll = new TH1F("fQMaxPartitionAll","QMax for All Partitions",216,0,216);}
+  if(fPlotQmaxROCAll){fQMaxROCAll = new TH1F("fQMaxROCAll","QMax for All Partitions",72,0,72);}
+  if(fPlotNClusters){fNumberOfClusters = new TH1F("fNumberOfClusters","Total Number of Clusters",1,0,1);}
+
+  int iResult=0;
+  TString configuration="";
+  TString argument="";
+  for (int i=0; i<argc && iResult>=0; i++) {
+    argument=argv[i];
+    if (!configuration.IsNull()) configuration+=" ";
+    configuration+=argument;
+  }
+  
+  if (!configuration.IsNull()) {
+    iResult=Configure(configuration.Data());
+  }  
+
+  return iResult; 
+}
+  
+int AliHLTTPCClusterHistoComponent::DoDeinit()
+{
+  // see header file for class documentation
+  if(fTotalClusterChargeOROCAll!=NULL) delete fTotalClusterChargeOROCAll;
+  if(fTotalClusterChargeIROCAll!=NULL) delete fTotalClusterChargeIROCAll;     
+  if(fQMaxPartitionAll!=NULL) delete fQMaxPartitionAll;
+  if(fQMaxROCAll!=NULL) delete fQMaxROCAll;
+  return 0;
+}
+
+int AliHLTTPCClusterHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& trigData)
+{
+  
+  int TotalSpacePoint = 0;
+  
+  const AliHLTComponentBlockData* iter = NULL;
+  
+  if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) )
+    return 0;
+  
+  fQMaxPartitionAll->Reset();
+  fQMaxROCAll->Reset();
+
+  for ( iter = GetFirstInputBlock(AliHLTTPCDefinitions::fgkClustersDataType); iter != NULL; iter = GetNextInputBlock() ) {
+    
+    Int_t thisrow=-1,thissector=-1,row=-1;
+    
+    AliHLTUInt8_t slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
+    AliHLTUInt8_t patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
+    row = AliHLTTPCTransform::GetFirstRow(patch); 
+    AliHLTTPCTransform::Slice2Sector(slice,row,thissector,thisrow);
+    
+    HLTDebug ( "Input Data - TPC cluster - Slice/Patch: %d/%d.", slice, patch );
+    
+    const AliHLTTPCClusterData* clusterData = (const AliHLTTPCClusterData*) iter->fPtr;
+    Int_t nSpacepoint = (Int_t) clusterData->fSpacePointCnt;
+    TotalSpacePoint += nSpacepoint;
+    //HLTInfo("KryptonHisto found %d Spacepoints in slice %d patch %d", nSpacepoint, slice, patch);
+    AliHLTTPCSpacePointData *clusters = (AliHLTTPCSpacePointData*) &clusterData->fSpacePoints;
+    
+    UInt_t tmpQPart = 0;//,tmpQROC = -1;
+    
+    for(int i=0;i<nSpacepoint;i++){
+      if(fPlotChargeOROCAll){
+       if(thissector>=36){
+         fTotalClusterChargeOROCAll->Fill(clusters[i].fCharge);
+       }
+      }
+      if(fPlotChargeIROCAll){
+       if(thissector<=35){
+         fTotalClusterChargeIROCAll->Fill(clusters[i].fCharge);
+       }
+      }
+      if(fPlotChargeROCSel){
+       
+      }
+      if(fPlotChargePartSel){
+       
+      }
+      if(fPlotQmaxPartAll){
+       if(clusters[i].fMaxQ>tmpQPart){
+         fQMaxPartitionAll->SetBinContent(patch+6*slice,clusters[i].fMaxQ);
+         tmpQPart=clusters[i].fMaxQ;
+       }
+      }
+      if(fPlotQmaxROCAll){
+       if(clusters[i].fMaxQ>fQMaxROCAll->GetBinContent(thissector)){
+         fQMaxROCAll->SetBinContent(thissector,clusters[i].fMaxQ);
+         //      tmpQROC=clusters[i].fMaxQ;
+       }
+      }
+    }
+    if(fPlotNClusters){
+      fNumberOfClusters->Fill(nSpacepoint);
+    }
+  }
+  
+  //delete til dodeinit
+  if(fPlotChargeOROCAll){
+    AliHLTUInt32_t fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(0,35,2,5);
+    PushBack( (TObject*) fTotalClusterChargeOROCAll,kAliHLTDataTypeHistogram,fSpecification);
+  }
+  if(fPlotChargeIROCAll){
+    AliHLTUInt32_t fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(0,35,0,1);
+    PushBack( (TObject*) fTotalClusterChargeIROCAll,kAliHLTDataTypeHistogram,fSpecification);
+  }
+  if(fPlotChargeROCSel){
+    
+    
+  }
+  if(fPlotChargePartSel){
+    
+    
+  }
+  if(fPlotQmaxPartAll){
+    AliHLTUInt32_t fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(0,35,0,5);
+    PushBack( (TObject*) fQMaxPartitionAll,kAliHLTDataTypeHistogram,fSpecification);
+    //delete fQMaxPartitionAll;
+  }
+  if(fPlotQmaxROCAll){
+    AliHLTUInt32_t fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(0,35,0,5);
+    PushBack( (TObject*) fQMaxROCAll,kAliHLTDataTypeHistogram,fSpecification);
+    //delete fQMaxROCAll;
+  }
+  if(fPlotNClusters){
+    
+    
+  }
+  
+  HLTInfo("KryptonHisto found %d Total Spacepoints", TotalSpacePoint);
+  
+  return 0;
+}
+
+int AliHLTTPCClusterHistoComponent::Configure(const char* arguments)
+{
+  
+  int iResult=0;
+  if (!arguments) return iResult;
+  
+  TString allArgs=arguments;
+  TString argument;
+  
+  TObjArray* pTokens=allArgs.Tokenize(" ");
+  
+  if (pTokens) {
+    for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
+      argument=((TObjString*)pTokens->At(i))->GetString();
+      if (argument.IsNull()) continue;
+      
+      if (argument.CompareTo("-plot-all")==0) {
+       HLTInfo("Ploting charge of all clusters");
+       //fPlotAll = kTRUE;
+       continue;
+      }
+      
+      else if (argument.CompareTo("-plot-trackclusters")==0) {
+       HLTInfo("Ploting charge of clusters used on a track");
+       //fPlotAll = kFALSE;
+       continue;
+      }
+      else {
+       HLTError("unknown argument %s", argument.Data());
+       iResult=-EINVAL;
+       break;
+      }
+    }
+    delete pTokens;
+  }
+  
+  //if hvis det eksisterer
+  if(fPlotChargeOROCAll){fTotalClusterChargeOROCAll = new TH1F("fTotalClusterChargeOROCAll","Total Charge of clusters in all OROC",4000,0,4000);}
+  if(fPlotChargeIROCAll){fTotalClusterChargeIROCAll = new TH1F("fTotalClusterChargeIROCAll","Total Charge of clusters in all IROC",4000,0,4000);}
+  if(fPlotChargeROCSel){fTotalClusterChargeROCSelection = new TH1F("fTotalClusterChargeROCSelection","Total Charge of clusters in selection ROC",4000,0,4000);}
+  if(fPlotChargePartSel){fTotalClusterChargePartitionSelection = new TH1F("fTotalClusterChargePartitionSelection","Total Charge of clusters in sel Part",4000,0,4000);}
+  if(fPlotQmaxPartAll){fQMaxPartitionAll = new TH1F("fQMaxPartitionAll","QMax for All Partitions",216,0,216);}
+  if(fPlotQmaxROCAll){fQMaxROCAll = new TH1F("fQMaxROCAll","QMax for All Partitions",72,0,72);}
+  if(fPlotNClusters){fNumberOfClusters = new TH1F("fNumberOfClusters","Total Number of Clusters",100,0,100);}
+
+  return iResult;
+}
+
+int AliHLTTPCClusterHistoComponent::Reconfigure(const char* cdbEntry, const char* chainId)
+{
+  // see header file for class documentation
+  int iResult=0;
+  const char* path="HLT/ConfigTPC/KryptonHistoComponent";
+  const char* defaultNotify="";
+  if (cdbEntry) {
+    path=cdbEntry;
+    defaultNotify=" (default)";
+  }
+  if (path) {
+    HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
+    AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
+    if (pEntry) {
+      TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
+      if (pString) {
+       HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
+       iResult=Configure(pString->GetString().Data());
+      } else {
+       HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
+      }
+    } else {
+      HLTError("can not fetch object \"%s\" from CDB", path);
+    }
+  }
+
+  return iResult;
+}
diff --git a/HLT/TPCLib/AliHLTTPCClusterHistoComponent.h b/HLT/TPCLib/AliHLTTPCClusterHistoComponent.h
new file mode 100644 (file)
index 0000000..7809452
--- /dev/null
@@ -0,0 +1,105 @@
+// $Id$
+#ifndef ALIHLTTPCCLUSTERHISTOCOMPONENT_H
+#define ALIHLTTPCCLUSTERHISTOCOMPONENT_H
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//* See cxx source for full Copyright notice                               *
+
+/** @file   AliHLTTPCQHistoComponent.h
+    @author Gaute Ovrebekk
+    @brief  Component for ploting charge in clusters
+*/
+
+#include "AliHLTProcessor.h"
+#include "TH1F.h"
+#include "AliHLTTPCSpacePointData.h"
+#include "AliHLTTPCTrackSegmentData.h"
+
+class AliHLTTPCConfMapper;
+
+/**
+ * @class AliHLTTPCQHistoComponent
+ * Component for ploting charge in clusters
+ * 
+ * Component ID: \b TPCQHisto <br>
+ * Library: \b libAliHLTTPC.
+ *
+ * Mandatory arguments: <br>
+ * 
+ * 
+ * Optional arguments: <br>
+ * 
+ *
+ * @ingroup alihlt_tpc_components
+ */
+class AliHLTTPCClusterHistoComponent : public AliHLTProcessor
+{
+public:
+  /** default constructor */
+  AliHLTTPCClusterHistoComponent();
+  /** destructor */
+  virtual ~AliHLTTPCClusterHistoComponent();
+
+  // Public functions to implement AliHLTComponent's interface.
+  // These functions are required for the registration process
+
+  /** interface function, see @ref AliHLTComponent for description */
+  const char* GetComponentID();
+  /** interface function, see @ref AliHLTComponent for description */
+  void GetInputDataTypes(AliHLTComponentDataTypeList& list);
+  /** interface function, see @ref AliHLTComponent for description */
+  AliHLTComponentDataType GetOutputDataType();
+  /** interface function, see @ref AliHLTComponent for description */
+  virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
+  /** interface function, see @ref AliHLTComponent for description */
+  AliHLTComponent* Spawn();
+
+protected:
+
+  // Protected functions to implement AliHLTComponent's interface.
+  // These functions provide initialization as well as the actual processing
+  // capabilities of the component. 
+
+  /** interface function, see @ref AliHLTComponent for description */
+  int DoInit( int argc, const char** argv );
+  /** interface function, see @ref AliHLTComponent for description */
+  int DoDeinit();
+  /** interface function, see @ref AliHLTComponent for description */
+  int DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& trigData );
+
+  int Reconfigure(const char* cdbEntry, const char* chainId);
+
+  using AliHLTProcessor::DoEvent;
+  
+private:
+  /** copy constructor prohibited */
+  AliHLTTPCClusterHistoComponent(const AliHLTTPCClusterHistoComponent&);
+  /** assignment operator prohibited */
+  AliHLTTPCClusterHistoComponent& operator=(const AliHLTTPCClusterHistoComponent&);
+  /**
+   * Configure the component.
+   * Parse a string for the configuration arguments and set the component
+   * properties.
+   */ 
+  int Configure(const char* arguments);
+  
+  TH1F * fTotalClusterChargeOROCAll;                               //! transient
+  TH1F * fTotalClusterChargeIROCAll;                               //! transient
+  TH1F * fTotalClusterChargeROCSelection;                          //! transient
+  TH1F * fTotalClusterChargePartitionSelection;                    //! transient
+  TH1F * fQMaxPartitionAll;                                        //! transient
+  TH1F * fQMaxROCAll;                                              //! transient
+  TH1F * fNumberOfClusters;                                        //! transient
+  
+  Bool_t fPlotChargeOROCAll;                                       //! transient
+  Bool_t fPlotChargeIROCAll;                                       //! transient
+  Bool_t fPlotChargeROCSel;                                        //! transient
+  Bool_t fPlotChargePartSel;                                       //! transient
+  Bool_t fPlotQmaxPartAll;                                         //! transient
+  Bool_t fPlotQmaxROCAll;                                          //! transient
+  Bool_t fPlotNClusters;                                           //! transient
+  ClassDef(AliHLTTPCClusterHistoComponent, 0);
+
+};
+#endif
index 9462b3ba93220eb2aeff6b0485da6478344118dd..56aa0c050623f6f93014f484d9db7a7843b3bfaa 100644 (file)
@@ -37,7 +37,8 @@ AliHLTTPCClusters::AliHLTTPCClusters()
   fLastMergedPad(0),
   fRowNumber(0),
   fFirstPad(0),
-  fLastPad(0)
+  fLastPad(0),
+  fQMax(0)
 {
   // see header file for class documentation
   // or
@@ -61,7 +62,8 @@ AliHLTTPCClusters::AliHLTTPCClusters(const AliHLTTPCClusters& src)
   fLastMergedPad(src.fLastMergedPad),
   fRowNumber(src.fRowNumber),
   fFirstPad(src.fFirstPad),
-  fLastPad(src.fLastPad)
+  fLastPad(src.fLastPad),
+  fQMax(src.fQMax)
 {
   // see header file for class documentation
   //HLTInfo("Copy constructor called");
@@ -82,5 +84,6 @@ AliHLTTPCClusters& AliHLTTPCClusters::operator=(const AliHLTTPCClusters& src)
   fRowNumber= src.fRowNumber;
   fLastMergedPad = src.fLastMergedPad;
   fFirstPad = src.fFirstPad;
+  fQMax = src.fQMax;
   return (*this);
 }
index 54f25b02eda6977180679a9bcf9426c1adb28c64..b90d7498ddbcef37d6802235722a851765643ecf 100644 (file)
@@ -29,6 +29,7 @@ class AliHLTTPCClusters : public AliHLTLogging {
   UInt_t fRowNumber;     //row number
   Int_t fFirstPad;       //first pad
   UInt_t fLastPad;       //last pad (aha!!!)
+  UInt_t fQMax;          //Max signal in cluster (not the total charge)
   ClassDef(AliHLTTPCClusters,0) //Fast cluster finder
     };
 #endif //ALIHLTTPCCLUSTERS_H
index 760d32db479d2ab5ae26a74b289a7edc130c6fe3..c39e36b896441148cd2f0d1452ead361ca95a9f4 100644 (file)
@@ -29,6 +29,7 @@ using namespace std;
 #include "AliHLTTPCDefinitions.h"
 #include "AliCDBEntry.h"
 #include "AliCDBManager.h"
+#include "AliHLTTPCTransform.h"
 
 #include <cstdlib>
 #include <cerrno>
@@ -51,10 +52,15 @@ AliHLTTPCHistogramHandlerComponent::AliHLTTPCHistogramHandlerComponent()
     :    
     fNoiseHistograms(0),
     fKryptonHistograms(0),
-    fSpecificationTPCA(0),
-    fSpecificationTPCC(0),
     fSlice(-99),
+    
     fHistTH1Tmp(NULL),
+    fTotalClusterChargeIROCAll(NULL),
+    fTotalClusterChargeOROCAll(NULL),
+    fQMaxPartitionAll(NULL),
+    fPlotQmaxROCAll(NULL),
+    fNumberOfClusters(NULL),
+    
     fHistTH2Tmp(NULL),
     fHistTPCSideA(NULL),  
     fHistTPCSideC(NULL)    
@@ -181,7 +187,13 @@ int AliHLTTPCHistogramHandlerComponent::DoEvent(const AliHLTComponentEventData&
   HLTInfo("--- Entering DoEvent() in TPCHistogramHandler ---");
   
   if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )) return 0;
-  
+  fTotalClusterChargeIROCAll = new TH1F("fTotalClusterChargeIROCAll","Total Charge of clusters in all IROC",4000,0,4000);  
+  fTotalClusterChargeOROCAll = new TH1F("fTotalClusterChargeOROCAll","Total Charge of clusters in all OROC",4000,0,4000);
+  fQMaxPartitionAll          = new TH1F("fQMaxPartitionAll",         "QMax for All Partitions",             216,0,216);
+  fPlotQmaxROCAll            = new TH1F("fQMaxROCAll",               "QMax for All ROC",                    72,0,72);
+  fNumberOfClusters          = new TH1F("fNumberOfClusters",         "Total Number of Clusters",            100,0,100);
+    
   fHistTH2Tmp = new TH2F("fHistTH2Tmp","fHistTH2Tmp",250,-250,250,250,-250,250);    
   fHistTPCSideA = new TH2F("fHistTPCSideA","TPC side A (max signal)",250,-250,250,250,-250,250);
   fHistTPCSideA->SetXTitle("global X (cm)"); fHistTPCSideA->SetYTitle("global Y (cm)");
@@ -192,63 +204,104 @@ int AliHLTTPCHistogramHandlerComponent::DoEvent(const AliHLTComponentEventData&
         
   for(iter = GetFirstInputObject(kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC); iter != NULL; iter = GetNextInputObject()){
    
-     HLTInfo("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", 
-              evtData.fEventID, evtData.fEventID,
-              DataType2Text(GetDataType(iter)).c_str(), 
-              DataType2Text(kAliHLTDataTypeHistogram | kAliHLTDataOriginTPC).c_str());
+//      HLTInfo("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", 
+//               evtData.fEventID, evtData.fEventID,
+//               DataType2Text(GetDataType(iter)).c_str(), 
+//               DataType2Text(kAliHLTDataTypeHistogram | kAliHLTDataOriginTPC).c_str());
    
-     if (GetDataType(iter) == (kAliHLTDataTypeHistogram | kAliHLTDataOriginTPC) && GetEventCount()<2){
-         HLTWarning("data type %s is depricated, use %s (kAliHLTDataTypeHistogram)!", 
-        DataType2Text(kAliHLTDataTypeHistogram).c_str(),
-         DataType2Text(kAliHLTDataTypeHistogram | kAliHLTDataOriginTPC).c_str());
-     }      
+//      if (GetDataType(iter) == (kAliHLTDataTypeHistogram | kAliHLTDataOriginTPC) && GetEventCount()<2){
+//          HLTWarning("data type %s is depricated, use %s (kAliHLTDataTypeHistogram)!", 
+//      DataType2Text(kAliHLTDataTypeHistogram).c_str(),
+//          DataType2Text(kAliHLTDataTypeHistogram | kAliHLTDataOriginTPC).c_str());
+//      }      
      
      if (GetDataType(iter) != (kAliHLTDataTypeHistogram | kAliHLTDataOriginTPC)) continue;
          
-     // Summing the output histograms of the TPCNoiseMapComponent (from partition to TPC sides)
+     // Summing the output histograms of the AliHLTTPCNoiseMapComponent (from partition to TPC sides)
      if(fNoiseHistograms){  
        
-       fHistTH2Tmp = (TH2F*)iter;
-       UInt_t minSlice     = AliHLTTPCDefinitions::GetMinSliceNr(GetSpecification(iter)); 
-       UInt_t maxSlice     = AliHLTTPCDefinitions::GetMaxSliceNr(GetSpecification(iter)); 
-       UInt_t minPartition = AliHLTTPCDefinitions::GetMinPatchNr(GetSpecification(iter)); 
-       UInt_t maxPartition = AliHLTTPCDefinitions::GetMaxPatchNr(GetSpecification(iter)); 
-       
-       if((minSlice!=maxSlice) || (minPartition!=maxPartition)){
-           HLTWarning("TPCHistogramHandler::The Noise Map component is not running on partition level!");
-       }
-
-       if(minSlice<18) fHistTPCSideA->Add(fHistTPCSideA,fHistTH2Tmp,1,1);
-       else           fHistTPCSideC->Add(fHistTPCSideC,fHistTH2Tmp,1,1);
-       // minSlice=maxSlice, when the Noise Map component runs on partition level (as it should)
+        fHistTH2Tmp = (TH2F*)iter;
+        UInt_t minSlice     = AliHLTTPCDefinitions::GetMinSliceNr(GetSpecification(iter)); 
+        UInt_t maxSlice     = AliHLTTPCDefinitions::GetMaxSliceNr(GetSpecification(iter)); 
+        UInt_t minPartition = AliHLTTPCDefinitions::GetMinPatchNr(GetSpecification(iter)); 
+        UInt_t maxPartition = AliHLTTPCDefinitions::GetMaxPatchNr(GetSpecification(iter)); 
        
-       fSpecificationTPCA = AliHLTTPCDefinitions::EncodeDataSpecification( 17,  0, 5, 0 ); 
-       fSpecificationTPCC = AliHLTTPCDefinitions::EncodeDataSpecification( 35, 18, 5, 0 ); 
+        if((minSlice!=maxSlice) || (minPartition!=maxPartition)){
+            HLTWarning("TPCHistogramHandler::The Noise Map component is not running on partition level!");
+        }
 
+        // minSlice=maxSlice, when the Noise Map component runs on partition level (as it should)
+        if(minSlice<18) fHistTPCSideA->Add(fHistTPCSideA,fHistTH2Tmp,1,1);
+        else           fHistTPCSideC->Add(fHistTPCSideC,fHistTH2Tmp,1,1);
      } // endif fNoiseHistograms==kTRUE   
      
      
-//  Summing the output of TPCKryptonClusterFinderComponent
-//      if(fKryptonHistograms){
-//         
-//      } //endif fKryptonHistograms==kTRUE                     
+     // Summing the output of AliHLTTPCClusterHistoComponent
+     if(fKryptonHistograms){
+       Int_t thisrow=-1,thissector=-1,row=-1;
+       
+       AliHLTUInt8_t slice = AliHLTTPCDefinitions::GetMinSliceNr(GetSpecification(iter));
+       AliHLTUInt8_t patch = AliHLTTPCDefinitions::GetMinPatchNr(GetSpecification(iter));
+       row = AliHLTTPCTransform::GetFirstRow(patch); 
+       AliHLTTPCTransform::Slice2Sector(slice,row,thissector,thisrow);
+       
+       fHistTH1Tmp = (TH1F*)iter;      
+       //cout << fHistTH1Tmp->GetName() << "\t" << fHistTH1Tmp->GetEntries() << endl;
+       
+       TString name = fHistTH1Tmp->GetName();
+               
+       if(name=="fTotalClusterChargeIROCAll"){
+          fTotalClusterChargeIROCAll->Add(fTotalClusterChargeIROCAll,fHistTH1Tmp,1,1);
+       } 
+       else if(name=="fTotalClusterChargeOROCAll"){
+          fTotalClusterChargeOROCAll->Add(fTotalClusterChargeOROCAll,fHistTH1Tmp,1,1);
+       } 
+       else if(name=="fQMaxPartitionAll"){
+         AliHLTUInt8_t partitionNr=patch+slice*6;
+         //      if(fHistTH1Tmp->GetBinContent(partitionNr)>fQMaxPartitionAll->GetBinContent(partitionNr)){
+          fQMaxPartitionAll->SetBinContent(partitionNr,fHistTH1Tmp->GetBinContent(partitionNr));
+          //     }
+          fQMaxPartitionAll->Add(fQMaxPartitionAll,fHistTH1Tmp,1,1);
+       } 
+       else if(name=="fPlotQmaxROCAll"){
+         //      if(fHistTH1Tmp->GetBinContent(thissector)>fPlotQmaxROCAll->GetBinContent(thissector)){
+         //   fPlotQmaxROCAll->SetBinContent(thissector,fHistTH1Tmp->GetBinContent(thissector));
+           //    }
+         fPlotQmaxROCAll->Add(fPlotQmaxROCAll,fHistTH1Tmp,1,1);
+       }
+       else if(name=="fNumberOfClusters"){ 
+         //   fNumberOfClusters->Add(fNumberOfClusters,fHistTH1Tmp,1,1);
+       } else continue;     
+     } //endif fKryptonHistograms==kTRUE                        
   } // end for loop over histogram blocks
   
   MakeHistosPublic();
-
   return 0;
 } // end DoEvent()
 
 void AliHLTTPCHistogramHandlerComponent::MakeHistosPublic() {
 // see header file for class documentation
-  
  
   if(fNoiseHistograms){ 
-    PushBack( (TObject*) fHistTPCSideA, kAliHLTDataTypeHistogram, fSpecificationTPCA);
-    PushBack( (TObject*) fHistTPCSideC, kAliHLTDataTypeHistogram, fSpecificationTPCC);
+    PushBack((TObject*)fHistTPCSideA,kAliHLTDataTypeHistogram,AliHLTTPCDefinitions::EncodeDataSpecification( 0,17,0,5));
+    PushBack((TObject*)fHistTPCSideC,kAliHLTDataTypeHistogram,AliHLTTPCDefinitions::EncodeDataSpecification(18,35,0,5));
     delete fHistTH2Tmp;
     delete fHistTPCSideA;
     delete fHistTPCSideC;
+  }  
+  
+  if(fKryptonHistograms){
+     PushBack((TObject*)fTotalClusterChargeIROCAll,kAliHLTDataTypeHistogram,AliHLTTPCDefinitions::EncodeDataSpecification(0,17,0,1));
+     PushBack((TObject*)fTotalClusterChargeOROCAll,kAliHLTDataTypeHistogram,AliHLTTPCDefinitions::EncodeDataSpecification(0,17,2,5));
+     PushBack((TObject*)fQMaxPartitionAll,        kAliHLTDataTypeHistogram,AliHLTTPCDefinitions::EncodeDataSpecification(0,35,0,5));
+     PushBack((TObject*)fPlotQmaxROCAll,          kAliHLTDataTypeHistogram,AliHLTTPCDefinitions::EncodeDataSpecification(0,35,0,5));
+     PushBack((TObject*)fNumberOfClusters,        kAliHLTDataTypeHistogram,AliHLTTPCDefinitions::EncodeDataSpecification(0,35,0,5));
+          
+     delete fTotalClusterChargeIROCAll;
+     delete fTotalClusterChargeOROCAll;
+     delete fQMaxPartitionAll;
+     delete fPlotQmaxROCAll;
+     delete fNumberOfClusters;
   }
  
 //  TObjArray histos;
index 9984d444020d6d81f360e84af5cc000e9c206ea2..8e6ba19ea03ed5833542ce2192bf5e518737be53 100644 (file)
@@ -94,19 +94,22 @@ class AliHLTTPCHistogramHandlerComponent : public AliHLTProcessor {
       
       Bool_t fNoiseHistograms;   //!transient
       Bool_t fKryptonHistograms; //!transient
-      AliHLTUInt32_t fSpecificationTPCA; //!transient
-      AliHLTUInt32_t fSpecificationTPCC; //!transient
       
       Int_t fSlice;  //!transient
       
-      TH1 *fHistTH1Tmp;    //!transient           
+      TH1 *fHistTH1Tmp;                //!transient  
+      TH1 *fTotalClusterChargeIROCAll; //!transient
+      TH1 *fTotalClusterChargeOROCAll; //!transient
+      TH1 *fQMaxPartitionAll;          //!transient
+      TH1 *fPlotQmaxROCAll;            //!transient
+      TH1 *fNumberOfClusters;          //!transient
+            
       TH2 *fHistTH2Tmp;    //!transient
       TH2 *fHistTPCSideA;  //!transient        
       TH2 *fHistTPCSideC;  //!transient  
 
             
-      ClassDef(AliHLTTPCHistogramHandlerComponent, 0)
+      ClassDef(AliHLTTPCHistogramHandlerComponent, 1)
     };
 
 #endif
index 26d6c87c000570382ee77ccd02016cf337c961f8..c126e1922e9b893946d482b4c2db5dbcb76a9a8e 100644 (file)
@@ -27,6 +27,8 @@
 #include "AliHLTTPCPad.h"
 #include "AliHLTTPCClusters.h"
 #include "TFile.h"
+#include "AliHLTTPCSpacePointData.h"
+
 
 #if __GNUC__ >= 3
 using namespace std;
@@ -36,52 +38,19 @@ ClassImp(AliHLTTPCKryptonClusterFinder)
 
 AliHLTTPCKryptonClusterFinder::AliHLTTPCKryptonClusterFinder()
   : AliHLTTPCClusterFinder(),
+    fHWAddressVector(),
     fTimebinsInBunch(),
     fIndexOfBunchStart(),
-    fHKryptonSpectrumFullPatch(NULL),
-    fHKryptonSpectrumSelection(NULL),
-    fHNumberOfKryptonClusters(NULL),
-    fHNumberOfKryptonClustersSelection(NULL),
-    fHMaxQofKryptonClusterLast1000(NULL),
-    fHMaxQofKryptonClusterSelection(NULL),
-    fStartBinKryptonSpectrum(0),
-    fEndBinKryptonSpectrum(3000),
-    fStartBinMaxQ(0),
-    fEndBinMaxQ(1000),
-    fStartBinNumberOfKryptonClusters(0),
-    fEndBinNumberOfKryptonClusters(1000),
+    fMaxQOfCluster(0),
     fSelectionMinRowNumber(0),
     fSelectionMaxRowNumber(0),
-    fMaxQOfCluster(0),
-    fMaxQOfClusterBin(0),
-    fNumberOfKryptonClusters(0),
-    fNumberOfKryptonClustersBin(0),
-    fHistogramsInitialized(kFALSE)
+    fNKryptonClusters(0),
+    fMaxOutputSize(0)
 {
   //constructor  
 }
 
 AliHLTTPCKryptonClusterFinder::~AliHLTTPCKryptonClusterFinder(){
-  if(fHKryptonSpectrumFullPatch){
-    delete fHKryptonSpectrumFullPatch;
-    fHKryptonSpectrumFullPatch=NULL;
-  }
-  if(fHKryptonSpectrumSelection){
-    delete fHKryptonSpectrumSelection;
-    fHKryptonSpectrumSelection=NULL;
-  }
-  if(fHNumberOfKryptonClusters){
-    delete fHNumberOfKryptonClusters;
-    fHNumberOfKryptonClusters=NULL;
-  }
-  if(fHMaxQofKryptonClusterLast1000){
-    delete fHMaxQofKryptonClusterLast1000;
-    fHMaxQofKryptonClusterLast1000=NULL;
-  }
-  if(fHMaxQofKryptonClusterSelection){
-    delete fHMaxQofKryptonClusterSelection;
-    fHMaxQofKryptonClusterSelection=NULL;
-  }
 }
 
 void AliHLTTPCKryptonClusterFinder::ReBunch(const UInt_t *bunchData , Int_t bunchSize){
@@ -118,7 +87,10 @@ void AliHLTTPCKryptonClusterFinder::ReadDataUnsorted(void* ptr,unsigned long siz
   if(!fVectorInitialized){
     InitializePadArray();
    }
-
+  
+  fHWAddressVector.clear();
+  fNKryptonClusters=0;
+  
   fDigitReader->InitBlock(fPtr,fSize,fFirstRow,fLastRow,fCurrentPatch,fCurrentSlice);
   
   while(fDigitReader->NextChannel()){
@@ -138,14 +110,14 @@ void AliHLTTPCKryptonClusterFinder::ReadDataUnsorted(void* ptr,unsigned long siz
          UInt_t time = fDigitReader->GetTime()+fIndexOfBunchStart[r];
          AliHLTTPCClusters candidate;
          candidate.fTotalCharge=0;
-         candidate.fChargeFalling=0;//PS This variable will store teh maximum charge of the candidate, used later. Keep this in mind 
+         candidate.fQMax=0;
          if(fTimebinsInBunch[r]>2){
            for(Int_t i=0;i<fTimebinsInBunch[r];i++){
              candidate.fTotalCharge+=bunchData[i + fIndexOfBunchStart[r]];     
              candidate.fTime += time*bunchData[i + fIndexOfBunchStart[r]];
              candidate.fTime2 += time*time*bunchData[i + fIndexOfBunchStart[r]];
-             if(bunchData[i + fIndexOfBunchStart[r]]>candidate.fChargeFalling){
-               candidate.fChargeFalling = bunchData[i + fIndexOfBunchStart[r]];
+             if(bunchData[i + fIndexOfBunchStart[r]]>candidate.fQMax){
+               candidate.fQMax = bunchData[i + fIndexOfBunchStart[r]];
              }
              time++;
            }
@@ -177,10 +149,10 @@ Bool_t AliHLTTPCKryptonClusterFinder::ComparePads(AliHLTTPCPad *nextPad,AliHLTTP
       cluster->fTime2 += candidate->fTime2;
       cluster->fPad+=candidate->fPad;
       cluster->fPad2=candidate->fPad2;
-      cluster->fLastMergedPad=candidate->fPad;
+      cluster->fLastMergedPad=candidate->fPad/candidate->fTotalCharge;
       
-      if(candidate->fChargeFalling>cluster->fChargeFalling){
-       cluster->fChargeFalling = candidate->fChargeFalling;
+      if(candidate->fQMax>cluster->fQMax){
+       cluster->fQMax = candidate->fQMax;
       }
 
       //setting the matched pad to used
@@ -218,12 +190,14 @@ void AliHLTTPCKryptonClusterFinder::FindRowClusters()
          continue;
        }
        tmpCandidate=&tmpPad->fClusterCandidates[candidate];
+       tmpCandidate->fFirstPad=pad;
        UInt_t tmpTotalCharge=tmpCandidate->fTotalCharge;
        
        ComparePads(fRowPadVector[row][pad+1],tmpCandidate,pad+1);
        if(tmpCandidate->fTotalCharge>tmpTotalCharge){
          //we have a cluster
-         tmpCandidate->fPad=tmpCandidate->fPad/tmpCandidate->fTotalCharge;
+         tmpCandidate->fRowNumber= tmpCandidate->fRowNumber*tmpCandidate->fTotalCharge;
+         //      tmpCandidate->fPad = tmpCandidate->fPad*tmpCandidate->fTotalCharge;
          fClusters.push_back(*tmpCandidate);
        }
       }
@@ -235,17 +209,20 @@ void AliHLTTPCKryptonClusterFinder::FindRowClusters()
 
 void AliHLTTPCKryptonClusterFinder::FindKryptonClusters()
 {
+  fMaxQOfCluster=0;
   if(fClusters.size()<2){
     return;
   }
-  fMaxQOfCluster=0;
   for(UInt_t i=0; i<fClusters.size();i++){
     AliHLTTPCClusters * tmpCluster=&fClusters[i];
     if(tmpCluster->fFlags==99){//quickfix to check if a cluster is used already
       continue;
     }
-    if((Int_t)tmpCluster->fChargeFalling>fMaxQOfCluster){
-      fMaxQOfCluster = tmpCluster->fChargeFalling;
+
+    UInt_t prevRow=tmpCluster->fRowNumber/tmpCluster->fTotalCharge;
+
+    if((Int_t)tmpCluster->fQMax>fMaxQOfCluster){
+      fMaxQOfCluster = tmpCluster->fQMax;
     }
     
     //adds "normal" clusters belonging to the krypton cluster
@@ -255,28 +232,38 @@ void AliHLTTPCKryptonClusterFinder::FindKryptonClusters()
       if(nextCluster->fFlags==99){//quickfix to check if a cluster is used already
        continue;
       }
-
-      if(tmpCluster->fRowNumber==nextCluster->fRowNumber-1){//Checks if the row numbers are ok (next to eachother)
-       if(abs((Int_t)(tmpCluster->fPad) - (Int_t)(nextCluster->fPad))<3){ // checks if the pad numbers are ok
+      if(prevRow == (UInt_t)(nextCluster->fRowNumber/nextCluster->fTotalCharge)-1){//Checks if the row numbers are ok (next to eachother)
+       if(abs((Int_t)(tmpCluster->fPad/tmpCluster->fTotalCharge) - (Int_t)(nextCluster->fPad/nextCluster->fTotalCharge))<3){ // checks if the pad numbers are ok
          if(abs((Int_t)tmpCluster->fMean-(Int_t)nextCluster->fMean)<2){
            tmpCluster->fMean=nextCluster->fMean;
            tmpCluster->fTotalCharge+=nextCluster->fTotalCharge;
-           tmpCluster->fPad=nextCluster->fPad;
-           
-           if((Int_t)nextCluster->fChargeFalling>fMaxQOfCluster){
-             fMaxQOfCluster = nextCluster->fChargeFalling;
+           tmpCluster->fRowNumber+=nextCluster->fRowNumber;
+           tmpCluster->fPad+=nextCluster->fPad;
+           tmpCluster->fTime+=nextCluster->fTime;
+           if((Int_t)nextCluster->fQMax>fMaxQOfCluster){
+             fMaxQOfCluster = nextCluster->fQMax;
            }
            
+           
            if(tmpCluster->fFlags!=99){//means that this is the first time normal clusters match
              CheckForCandidateOnPreviousRow(tmpCluster);
+             for(UInt_t ap = tmpCluster->fFirstPad ; ap<=tmpCluster->fLastMergedPad ; ap++){
+             fHWAddressVector.push_back((AliHLTUInt16_t)fDigitReader->GetAltroBlockHWaddr(nextCluster->fRowNumber/nextCluster->fTotalCharge-AliHLTTPCTransform::GetFirstRow(fCurrentPatch),ap));
+             //                fHWAddressVector.push_back((AliHLTUInt16_t)fDigitReader->GetAltroBlockHWaddr(tmpCluster->fRowNumber,ap));
+             }
+             
            }
-           tmpCluster->fRowNumber=nextCluster->fRowNumber;
+           for(UInt_t ap = nextCluster->fFirstPad ; ap<=nextCluster->fLastMergedPad ; ap++){
+             fHWAddressVector.push_back((AliHLTUInt16_t)fDigitReader->GetAltroBlockHWaddr(nextCluster->fRowNumber/nextCluster->fTotalCharge-AliHLTTPCTransform::GetFirstRow(fCurrentPatch),ap));
+             HLTDebug("Pushing back hw address %d from row: %d and Pad: %d",fDigitReader->GetAltroBlockHWaddr(nextCluster->fRowNumber/nextCluster->fTotalCharge-AliHLTTPCTransform::GetFirstRow(fCurrentPatch),ap),nextCluster->fRowNumber/nextCluster->fTotalCharge,ap);
+           }
+
+           prevRow=nextCluster->fRowNumber/nextCluster->fTotalCharge;
            nextCluster->fFlags=99;
            tmpCluster->fFlags=99;
            if(j!=fClusters.size()-1){
              continue;
-           }
-           
+           }       
          }
        }
       }
@@ -292,33 +279,38 @@ void AliHLTTPCKryptonClusterFinder::FindKryptonClusters()
          }
          }//end add clustercandidate if present
          }*/
-       fHMaxQofKryptonClusterLast1000->Fill(fMaxQOfClusterBin,fMaxQOfCluster);
-       fMaxQOfClusterBin++;
-       if(fMaxQOfClusterBin>fEndBinMaxQ){
-         fMaxQOfClusterBin=0;
+
+
+       //convert the (AliHLTClusters) cluster to spacepointdata and add it to the output array.
+       if (fNKryptonClusters*sizeof(AliHLTTPCSpacePointData)>=fMaxOutputSize*sizeof(AliHLTUInt32_t)) {
+         HLTWarning("Buffer too small too add more spacepoints: %d of %d byte(s) already used",fNKryptonClusters*sizeof(AliHLTTPCSpacePointData) , fMaxOutputSize*sizeof(AliHLTUInt32_t));
+         return;
        }
-       fHKryptonSpectrumFullPatch->Fill(tmpCluster->fTotalCharge);
-       fHNumberOfKryptonClusters->Fill(fNumberOfKryptonClustersBin);
-       if(fNumberOfKryptonClustersBin>fEndBinNumberOfKryptonClusters){
-         fNumberOfKryptonClustersBin=0;
+       if(tmpCluster->fTotalCharge>10){
+         Float_t xyz[3]={0,0,0};
+         Int_t thisrow=-1;
+         Int_t thissector=-1;
+         AliHLTTPCTransform::Slice2Sector(fCurrentSlice, (Int_t)(tmpCluster->fRowNumber/tmpCluster->fTotalCharge), thissector, thisrow);
+         AliHLTTPCTransform::Raw2Local(xyz, thissector, thisrow,(Float_t)(tmpCluster->fPad/tmpCluster->fTotalCharge),(Float_t)(tmpCluster->fTime/tmpCluster->fTotalCharge));
+         fSpacePointData[fNKryptonClusters].fX = xyz[0];
+         fSpacePointData[fNKryptonClusters].fY = xyz[1];
+         fSpacePointData[fNKryptonClusters].fZ = xyz[2];
+         fSpacePointData[fNKryptonClusters].fCharge = tmpCluster->fTotalCharge;
+         fSpacePointData[fNKryptonClusters].fMaxQ = tmpCluster->fQMax;
+         fSpacePointData[fNKryptonClusters].fPadRow = tmpCluster->fRowNumber/tmpCluster->fTotalCharge;
+         HLTDebug("Krypton cluster found");
+         HLTDebug("xyz=[%f,%f,%f]",fSpacePointData[fNKryptonClusters].fX,fSpacePointData[fNKryptonClusters].fY,fSpacePointData[fNKryptonClusters].fZ);
+         HLTDebug("TotalCharge = %d    and   QMax = %d",fSpacePointData[fNKryptonClusters].fCharge,fSpacePointData[fNKryptonClusters].fMaxQ);
+         fNKryptonClusters++;
+         break;
        }
-       /*
-       fHKryptonSpectrumSelection
-       fHNumberOfKryptonClustersSelection
-       fHMaxQofKryptonClusterSelection
-       */
-       HLTInfo("Krypton cluster found, charge: %d   in patch number: %d",tmpCluster->fTotalCharge,fCurrentPatch);
-       break;
       }
-
-
     }
   }//end add "normal" clusters belonging to the krypton cluster
-  fNumberOfKryptonClustersBin++;
 
   //resets the candidates for every pad and the fClusters(row clusters)
-  for(UInt_t row=5;row<fNumberOfRows-5;row++){
-    for(UInt_t pad=5;pad<fNumberOfPadsInRow[row]-1-5;pad++){
+  for(UInt_t row=0;row<fNumberOfRows;row++){
+    for(UInt_t pad=0;pad<fNumberOfPadsInRow[row];pad++){
       fRowPadVector[row][pad]->fClusterCandidates.clear();
     }
   }
@@ -328,11 +320,26 @@ void AliHLTTPCKryptonClusterFinder::FindKryptonClusters()
 void AliHLTTPCKryptonClusterFinder::CheckForCandidateOnPreviousRow(AliHLTTPCClusters *tmpCluster){
   if(tmpCluster->fRowNumber>1){
     for(Int_t p=-1;p<2;p++){
-      if(tmpCluster->fPad+p>0 && tmpCluster->fPad+p<fNumberOfPadsInRow[tmpCluster->fRowNumber-1]){
-       AliHLTTPCPad *prevPad=fRowPadVector[tmpCluster->fRowNumber-1-AliHLTTPCTransform::GetFirstRow(fCurrentPatch)][tmpCluster->fPad+p];
+      if(tmpCluster->fPad+p>0 && tmpCluster->fPad+p<fNumberOfPadsInRow[tmpCluster->fRowNumber/tmpCluster->fTotalCharge-1]){
+       if(tmpCluster->fTotalCharge==0){
+         HLTFatal("Charge of tmpCluster in AliHLTTPCKryptonClusterFinder::CheckForCandidateOnPreviousRow is 0");
+         return;
+       }
+       if(tmpCluster->fRowNumber/tmpCluster->fTotalCharge-1-AliHLTTPCTransform::GetFirstRow(fCurrentPatch)<0){
+         HLTFatal("AliHLTTPCKryptonClusterFinder::CheckForCandidateOnPreviousRow:    Rownumber is below 0");
+         return;
+       }
+       if(tmpCluster->fRowNumber/tmpCluster->fTotalCharge-1-AliHLTTPCTransform::GetFirstRow(fCurrentPatch)>fNumberOfRows){
+         HLTFatal("AliHLTTPCKryptonClusterFinder::CheckForCandidateOnPreviousRow:    Rownumber is too high");
+         return;
+       }
+       AliHLTTPCPad *prevPad=fRowPadVector[tmpCluster->fRowNumber/tmpCluster->fTotalCharge-1-AliHLTTPCTransform::GetFirstRow(fCurrentPatch)][tmpCluster->fPad/tmpCluster->fTotalCharge+p];
        for(UInt_t i=0;i<prevPad->fClusterCandidates.size();i++){
          if(abs((Int_t)prevPad->fClusterCandidates[i].fMean - (Int_t)tmpCluster->fMean)<2 && prevPad->fUsedClusterCandidates[i]==0){
            tmpCluster->fTotalCharge += prevPad->fClusterCandidates[i].fTotalCharge;
+           fHWAddressVector.push_back((AliHLTUInt16_t)fDigitReader->GetAltroBlockHWaddr(tmpCluster->fRowNumber/tmpCluster->fTotalCharge-1-AliHLTTPCTransform::GetFirstRow(fCurrentPatch),tmpCluster->fPad/tmpCluster->fTotalCharge+p));
+             //            fHWAddressVector.push_back((AliHLTUInt16_t)fDigitReader->GetAltroBlockHWaddr(prevPad->GetRowNumber(),prevPad->GetPadNumber()));
+           HLTDebug("Pushing back hw address %d",fDigitReader->GetAltroBlockHWaddr(tmpCluster->fRowNumber/tmpCluster->fTotalCharge-1-AliHLTTPCTransform::GetFirstRow(fCurrentPatch),tmpCluster->fPad/tmpCluster->fTotalCharge+p));
          }
        }
       }
@@ -340,95 +347,8 @@ void AliHLTTPCKryptonClusterFinder::CheckForCandidateOnPreviousRow(AliHLTTPCClus
   }
 }
 
-void AliHLTTPCKryptonClusterFinder::InitializeHistograms(){
-
-
-  if(fHistogramsInitialized){
-    return;
-  }
-
-  TString sliceStr("-Slice_");
-  sliceStr+=fCurrentSlice;
-  TString patchStr("-Patch_");
-  patchStr+=fCurrentPatch;
-
-  TString namefKryptonSpectrumFullPatch("KryptonSpectrumFullPatch"+sliceStr+patchStr);
-  TString namefKryptonSpectrumSelection = "KryptonSpectrumSelection"+sliceStr+patchStr;
-  TString namefNumberOfKryptonClusters = "NumberOfKryptonClusters"+sliceStr+patchStr;
-  TString namefNumberOfKryptonClustersSelection = "NumberOfKryptonClustersSelection"+sliceStr+patchStr;
-  TString namefMaxQLast1000 = "MaxQ"+sliceStr+patchStr;
-  TString namefMaxQSelection = "MaxQSelection"+sliceStr+patchStr;
-
-  fHKryptonSpectrumFullPatch = new TH1F(namefKryptonSpectrumFullPatch,namefKryptonSpectrumFullPatch,fEndBinKryptonSpectrum-fStartBinKryptonSpectrum,fStartBinKryptonSpectrum,fEndBinKryptonSpectrum);
- fHKryptonSpectrumSelection = new TH1F(namefKryptonSpectrumSelection,namefKryptonSpectrumSelection,fEndBinKryptonSpectrum-fStartBinKryptonSpectrum,fStartBinKryptonSpectrum,fEndBinKryptonSpectrum);
-
-  fHNumberOfKryptonClusters = new TH1F(namefNumberOfKryptonClusters,namefNumberOfKryptonClusters,fEndBinNumberOfKryptonClusters-fStartBinNumberOfKryptonClusters,fStartBinNumberOfKryptonClusters,fEndBinNumberOfKryptonClusters);
-
-  fHNumberOfKryptonClustersSelection = new TH1F(namefNumberOfKryptonClustersSelection,namefNumberOfKryptonClustersSelection,fEndBinNumberOfKryptonClusters-fStartBinNumberOfKryptonClusters,fStartBinNumberOfKryptonClusters,fEndBinNumberOfKryptonClusters);
-
-  fHMaxQofKryptonClusterLast1000 = new TH1F(namefMaxQLast1000,namefMaxQLast1000,fEndBinMaxQ-fStartBinMaxQ,fStartBinMaxQ,fEndBinMaxQ);
-
-  fHMaxQofKryptonClusterSelection = new TH1F(namefMaxQSelection,namefMaxQSelection,fEndBinMaxQ-fStartBinMaxQ,fStartBinMaxQ,fEndBinMaxQ);
-
-  fHistogramsInitialized=kTRUE;
-}
-
-void AliHLTTPCKryptonClusterFinder::ResetHistograms(TString histoName){
-
-  if (histoName.CompareTo("KryptonSpectrumFullPatch")==0){
-    fHKryptonSpectrumFullPatch->Reset();
-  }
-  if (histoName.CompareTo("KryptonSpectrumSelection")==0){
-    fHKryptonSpectrumSelection->Reset();
-  }
-  if (histoName.CompareTo("NumberOfKryptonClusters")==0){
-    fHNumberOfKryptonClusters->Reset();
-  }
-  if (histoName.CompareTo("NumberOfKryptonClustersSelection")==0){
-    fHNumberOfKryptonClustersSelection->Reset();
-  }
-  if (histoName.CompareTo("MaxQ")==0){
-    fHMaxQofKryptonClusterLast1000->Reset();
-  }
-  if (histoName.CompareTo("MaxQSelection")==0){
-    fHMaxQofKryptonClusterSelection->Reset();
-  }
-  if (histoName.CompareTo("All")==0){
-    fHKryptonSpectrumFullPatch->Reset();
-    fHKryptonSpectrumSelection->Reset();
-    fHNumberOfKryptonClusters->Reset();
-    fHNumberOfKryptonClustersSelection->Reset();
-    fHMaxQofKryptonClusterLast1000->Reset();
-    fHMaxQofKryptonClusterSelection->Reset();
-  }
-}
-
 void AliHLTTPCKryptonClusterFinder::SetSelection(Int_t minRow, Int_t maxRow){
   fSelectionMinRowNumber=minRow;
   fSelectionMaxRowNumber=maxRow;
 }
 
-void AliHLTTPCKryptonClusterFinder::GetHistogramObjectArray(TObjArray & histos){
-  //  TObjArray histos;
-  histos.Clear();
-  histos.Add(fHKryptonSpectrumFullPatch);
-  histos.Add(fHKryptonSpectrumSelection);
-  histos.Add(fHNumberOfKryptonClusters);
-  histos.Add(fHNumberOfKryptonClustersSelection);
-  histos.Add(fHMaxQofKryptonClusterLast1000);
-  histos.Add(fHMaxQofKryptonClusterSelection);
-  //  return histos;
-}
-
-void AliHLTTPCKryptonClusterFinder::WriteHistograms(TString filename){
-
-  TFile file(filename,"recreate");
-  fHKryptonSpectrumFullPatch->Write();
-  fHKryptonSpectrumSelection->Write();
-  fHNumberOfKryptonClusters->Write();
-  fHNumberOfKryptonClustersSelection->Write();
-  fHMaxQofKryptonClusterLast1000->Write();
-  fHMaxQofKryptonClusterSelection->Write();
-  file.Close();
-}
index 4dc0d5480fb01a0e60a62a14894afe6d8e154b02..e6470f74e223d7a1c1d397eb91872779f9fb90e0 100644 (file)
@@ -53,20 +53,16 @@ class AliHLTTPCKryptonClusterFinder : public AliHLTTPCClusterFinder {
   /** checks if there is a candidate on the previous row */
   void CheckForCandidateOnPreviousRow(AliHLTTPCClusters* tmpCluster);
 
-  /** initialize the histograms */
-  void InitializeHistograms();
-
-  /** resets the histograms */
-  void ResetHistograms(TString histoName);
-
-  /*set the selection from minrow to maxrow, used to look at a certain interval of rows */
+  /** set the selection from minrow to maxrow, used to look at a certain interval of rows */
   void SetSelection(Int_t minRow, Int_t maxRow);
 
-  /** puts the histograms in the objarray*/
-  void GetHistogramObjectArray(TObjArray& histos);
+  /** returns the number of krypton clusters found */
+  AliHLTUInt32_t GetNKryptonClusters(){ return fNKryptonClusters;}
 
-  /** write histograms to a file, filename must also include the path. Used only for debugging by developers */
-  void WriteHistograms(TString filename);
+  /** sets the maximum size of the output buffer */
+  void SetMaxOutputSize(AliHLTUInt32_t size){fMaxOutputSize=size;}
+  
+  vector<AliHLTUInt16_t> fHWAddressVector;                         //! transient
 
  private: 
   /** copy constructor prohibited */
@@ -77,33 +73,16 @@ class AliHLTTPCKryptonClusterFinder : public AliHLTTPCClusterFinder {
   vector<Int_t> fTimebinsInBunch;                                  //! transient
 
   vector<Int_t> fIndexOfBunchStart;                                //! transient
-
-  //histograms
-  TH1F * fHKryptonSpectrumFullPatch;                                //! transient
-  TH1F * fHKryptonSpectrumSelection;                                //! transient
-  TH1F * fHNumberOfKryptonClusters;                                 //! transient
-  TH1F * fHNumberOfKryptonClustersSelection;                        //! transient
-  TH1F * fHMaxQofKryptonClusterLast1000;                            //! transient
-  TH1F * fHMaxQofKryptonClusterSelection;                           //! transient
   
-  Int_t fStartBinKryptonSpectrum;                                  //! transient
-  Int_t fEndBinKryptonSpectrum;                                    //! transient
-  Int_t fStartBinMaxQ;                                             //! transient
-  Int_t fEndBinMaxQ;                                               //! transient
-  Int_t fStartBinNumberOfKryptonClusters;                          //! transient
-  Int_t fEndBinNumberOfKryptonClusters;                            //! transient
-
+  Int_t fMaxQOfCluster;                                            //! transient
+  
   Int_t fSelectionMinRowNumber;                                    //! transient
   Int_t fSelectionMaxRowNumber;                                    //! transient
 
-  Int_t fMaxQOfCluster;                                            //! transient
-  Int_t fMaxQOfClusterBin;                                         //! transient
-  
-  Int_t fNumberOfKryptonClusters;                                  //! transient
-  Int_t fNumberOfKryptonClustersBin;                               //! transient
+  AliHLTUInt32_t fNKryptonClusters;                                //! transient
 
-  Bool_t fHistogramsInitialized;                                   //! transient                 
+  AliHLTUInt32_t fMaxOutputSize;                                   //! transient
   
-  ClassDef(AliHLTTPCKryptonClusterFinder,1) //Fast cluster finder
+  ClassDef(AliHLTTPCKryptonClusterFinder,2) //TPC Krypton cluster finder
 };
 #endif
index db3dd3490d6fa0c510cc7b8b7415ab1dc7e6273e..21bc9f7dbfe99bdcf5cde2590ead91490df3b765 100644 (file)
@@ -92,7 +92,8 @@ void AliHLTTPCKryptonClusterFinderComponent::GetInputDataTypes( vector<AliHLTCom
 AliHLTComponentDataType AliHLTTPCKryptonClusterFinderComponent::GetOutputDataType()
 {
   // see header file for class documentation
-  return kAliHLTDataTypeHistogram;
+ return kAliHLTMultipleDataType;
+ //  return kAliHLTDataTypeHistogram;
 }
 
 int AliHLTTPCKryptonClusterFinderComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
@@ -100,7 +101,8 @@ int AliHLTTPCKryptonClusterFinderComponent::GetOutputDataTypes(AliHLTComponentDa
 {
   // see header file for class documentation
   tgtList.clear();
-  tgtList.push_back(kAliHLTDataTypeHistogram);
+  tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
+  tgtList.push_back(kAliHLTDataTypeHwAddr16);
   return tgtList.size();
 }
 
@@ -121,6 +123,9 @@ AliHLTComponent* AliHLTTPCKryptonClusterFinderComponent::Spawn()
 int AliHLTTPCKryptonClusterFinderComponent::DoInit( int argc, const char** argv )
 {
   // see header file for class documentation
+
+  //  HLTFatal("Initializing the kryptonclusterfindercomponent");
+
   if ( fKryptonClusterFinder )
     return EINPROGRESS;
 
@@ -158,7 +163,12 @@ int AliHLTTPCKryptonClusterFinderComponent::DoDeinit()
   return 0;
 }
 
-int AliHLTTPCKryptonClusterFinderComponent::DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData){
+int AliHLTTPCKryptonClusterFinderComponent::DoEvent( const AliHLTComponentEventData& evtData, 
+                                             const AliHLTComponentBlockData* blocks, 
+                                             AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, 
+                                             AliHLTUInt32_t& size, 
+                                             vector<AliHLTComponentBlockData>& outputBlocks )
+{
   // see header file for class documentation
 
   if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )) return 0;
@@ -170,6 +180,10 @@ int AliHLTTPCKryptonClusterFinderComponent::DoEvent(const AliHLTComponentEventDa
 
   unsigned long maxPoints = 0;
 
+  AliHLTTPCClusterData* outPtr;
+
+  outPtr = (AliHLTTPCClusterData*)outputPtr;
+
   for (iter = GetFirstInputBlock(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC); iter != NULL; iter = GetNextInputBlock()){
 
     HLTInfo("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", 
@@ -198,16 +212,67 @@ int AliHLTTPCKryptonClusterFinderComponent::DoEvent(const AliHLTComponentEventDa
 
     fKryptonClusterFinder->InitSlice( slice, patch, row[0], row[1], maxPoints );
 
-    fKryptonClusterFinder->InitializeHistograms();
-       
+    fKryptonClusterFinder->SetOutputArray((AliHLTTPCSpacePointData*)outPtr->fSpacePoints);
+    
+    fKryptonClusterFinder->SetMaxOutputSize(size-sizeof(AliHLTUInt32_t));
+
     fKryptonClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize);
       
     fKryptonClusterFinder->FindRowClusters();
 
     fKryptonClusterFinder->FindKryptonClusters();
+    
+    //    if(fKryptonClusterFinder->GetNKryptonClusters()>0){
+
+    //    HLTFatal("Number of kryptonClusters: %d",(Int_t)fKryptonClusterFinder->GetNKryptonClusters());
+
+      if (sizeof(AliHLTUInt32_t)+fKryptonClusterFinder->GetNKryptonClusters()*sizeof(AliHLTTPCSpacePointData)>=size) {
+       HLTFatal("Buffer too small too add more spacepoints: %d of %d byte(s) already used",sizeof(AliHLTUInt32_t)+fKryptonClusterFinder->GetNKryptonClusters()*sizeof(AliHLTTPCSpacePointData) ,size);
+       return -ENOSPC;
+      }
+      
+      outPtr->fSpacePointCnt=fKryptonClusterFinder->GetNKryptonClusters();
+      
+      AliHLTComponentBlockData bd;
+      FillBlockData( bd );
+      bd.fOffset = 0;
+      bd.fSize = sizeof(AliHLTUInt32_t)+fKryptonClusterFinder->GetNKryptonClusters()*sizeof(AliHLTTPCSpacePointData);
+      bd.fSpecification = iter->fSpecification;
+      bd.fDataType = AliHLTTPCDefinitions::fgkClustersDataType;
+      outputBlocks.push_back( bd );
+
+      //adding the list of hardware addresses to the outpot buffer
+
+      AliHLTUInt32_t dataOffsetBeforeHW=sizeof(AliHLTUInt32_t)+fKryptonClusterFinder->GetNKryptonClusters()*sizeof(AliHLTTPCSpacePointData);
+      AliHLTUInt32_t sizeOfHWArray=fKryptonClusterFinder->fHWAddressVector.size()*sizeof(AliHLTUInt16_t);
+      //      cout<<"size of array: "<<sizeOfHWArray<<"     number of entries"<<fKryptonClusterFinder->fHWAddressVector.size()<<endl;
+
+      if (dataOffsetBeforeHW+sizeOfHWArray>=size){
+       HLTFatal("Buffer too small too add the HW address list: %d of %d byte(s) already used",dataOffsetBeforeHW+sizeOfHWArray ,size);
+       return -ENOSPC;
+      }
 
+      AliHLTUInt16_t *outputHWPtr=(AliHLTUInt16_t*)(outputPtr+dataOffsetBeforeHW);
+      for(UInt_t hw=0;hw<fKryptonClusterFinder->fHWAddressVector.size();hw++){
+       *outputHWPtr = fKryptonClusterFinder->fHWAddressVector[hw];
+       outputHWPtr++;
+      }
+      
+      AliHLTComponentBlockData bdHW;
+      FillBlockData( bdHW );
+      bdHW.fOffset =  dataOffsetBeforeHW;
+      bdHW.fSize = sizeOfHWArray;
+      bdHW.fSpecification = iter->fSpecification;
+      bdHW.fDataType = kAliHLTDataTypeHwAddr16;
+      outputBlocks.push_back( bdHW );
+
+      size=dataOffsetBeforeHW+sizeOfHWArray;
+      
+      /*    }
+           else{
+           size=0;
+      }*/
   }
-  MakeHistosPublic();
   return 0;
 }
 
@@ -283,19 +348,3 @@ int AliHLTTPCKryptonClusterFinderComponent::Reconfigure(const char* cdbEntry, co
   }
   return 0;
 }
-
-void AliHLTTPCKryptonClusterFinderComponent::MakeHistosPublic() {
-// see header file for class documentation
-  
-  TObjArray histos;
-  fKryptonClusterFinder->GetHistogramObjectArray(histos);
-  TIter iterator(&histos);
-
-  while(TObject* pObj=iterator.Next()){
-      
-       PushBack(pObj,kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC, fSpecification);
-
-       //fKryptonClusterFinder->GetHistogramObjectArray(histos);
-       //PushBack( (TObject*) &histos, kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC, fSpecification); 
-  }
-}
index 882547da6dc51d24da7488e22a44e253a4ff065d..65772f0ed3665b3ac2b197ddaff4212838927279 100644 (file)
@@ -50,8 +50,6 @@ class AliHLTTPCKryptonClusterFinderComponent : public AliHLTProcessor
   /** interface function, see @ref AliHLTComponent for description */
   AliHLTComponent* Spawn();
 
-  /** Gets the TObjArray from AliHLTTPCKryptonClusterFinder and pushes it to the output */
-  void MakeHistosPublic();
     protected:
        
        // Protected functions to implement AliHLTComponent's interface.
@@ -60,10 +58,9 @@ class AliHLTTPCKryptonClusterFinderComponent : public AliHLTProcessor
 
        int DoInit( int argc, const char** argv );
        int DoDeinit();
-       //      int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, 
-       //                   AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, 
-       //                   AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks );
-       int DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
+       int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, 
+                    AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, 
+                    AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks );
 
        int Reconfigure(const char* cdbEntry, const char* chainId);