]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
added libAliHLTTrigger (Jochen)
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 24 Nov 2007 17:11:14 +0000 (17:11 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 24 Nov 2007 17:11:14 +0000 (17:11 +0000)
HLT/Makefile.am
HLT/configure.ac
HLT/libAliHLTTrigger.pkg [new file with mode: 0644]
HLT/trigger/AliHLTTriggerSelectiveReadoutComponent.cxx [new file with mode: 0644]
HLT/trigger/AliHLTTriggerSelectiveReadoutComponent.h [new file with mode: 0644]
HLT/trigger/Makefile.am [new file with mode: 0644]

index 0da7dfc448236f5c52fcb5e26b00e5e6c43ca702..32d34d5a4a4031c3eb0b1c08043973773adc1b6e 100644 (file)
@@ -7,7 +7,7 @@ SAMPLE_DIR=SampleLib
 endif
 
 if EN_HLT_TPC
-TPC_DIR=TPCLib 
+TPC_DIR=TPCLib
 endif
 
 if EN_HLT_PHOS
@@ -26,6 +26,10 @@ if EN_HLT_COMP
 COMP_DIR=comp
 endif
 
+#if EN_HLT_TRIGGER
+TRIGGER_DIR=trigger
+#endif
+
 SUBDIRS                = BASE \
                          sim \
                          rec \
@@ -35,6 +39,7 @@ SUBDIRS               = BASE \
                          $(TRD_DIR) \
                          $(MUON_DIR) \
                          $(COMP_DIR) \
+                          $(TRIGGER_DIR) \
                          doc
 
 EXTRA_DIST             = libHLTbase.pkg \
@@ -49,6 +54,7 @@ EXTRA_DIST            = libHLTbase.pkg \
                          libAliHLTTRD.pkg \
                          libAliHLTMUON.pkg \
                          libAliHLTComp.pkg \
+                         libAliHLTTrigger.pkg \
                          hlt.conf
 
 DIST_SUBDIRS           = $(SUBDIRS)
index 6688f68266c726dd0def6d55d7f9a26ccb2d84c5..d958a823f817513787d5479225574079aed91487 100644 (file)
@@ -788,6 +788,7 @@ AC_CONFIG_FILES([Makefile
                 PHOS/Makefile
                 TRD/Makefile
                 MUON/Makefile
+                trigger/Makefile
                 comp/Makefile
                 doc/Makefile
                 doc/doxygen.conf])
diff --git a/HLT/libAliHLTTrigger.pkg b/HLT/libAliHLTTrigger.pkg
new file mode 100644 (file)
index 0000000..b014758
--- /dev/null
@@ -0,0 +1,51 @@
+#-*- Mode: Makefile -*-
+# $Id$
+
+# This files defines the source and header files for the
+# libAliHLTTrigger library and additional flags for the compilation
+# and linking process. For further information refer to the 
+# README.
+
+include $(MODDIR)/hlt.conf
+
+# class header files, the link definition for the root dictionary
+# will be created from the names of the header files
+CLASS_HDRS:= \
+               AliHLTTriggerSelectiveReadoutComponent.h
+
+# library sources
+MODULE_SRCS:=  $(CLASS_HDRS:.h=.cxx)
+
+# library headers
+# in most cases you might have already added all the header files to
+# the CLASS_HDRS variable. So we just use the content of this. You
+# can simply add more header files which don't contain classes with
+# ROOT dictionary support
+MODULE_HDRS:=  $(CLASS_HDRS)
+
+# The LinkDef file required by the ROOT dictionary generation can be
+# generated automatically. For the all header files specified in
+# CLASS_HDRS an entry will be generated
+# pragma link C++ class <class-name>+;
+#
+# If the default behavior is not enough, you can provide a custom
+# *LinkDef.h to the MODULE_DHDR variable. Leave MODULE_DHDR empty to
+# enable automatic generation. 
+MODULE_DHDR:=          
+
+EINCLUDE := HLT/BASE HLT/trigger HLT/TPCLib
+
+###############################################################################
+#
+# do not change anything below this line
+#
+SRCS:=$(patsubst %,trigger/%,$(MODULE_SRCS))
+CINTHDRS:=$(patsubst %,trigger/%,$(CLASS_HDRS))
+HDRS:=$(patsubst %,trigger/%,$(MODULE_HDRS))
+DHDR:=$(patsubst %,trigger/%,$(MODULE_DHDR))
+CINTAUTOLINK:= $(shell test "x$(MODULE_DHDR)" = "x" &&! echo 1)
+
+EDEFINE      := ${HLTDEFS}
+PACKCXXFLAGS := ${HLTCXXFLAGS}
+PACKCFLAGS   := ${HLTCLFAGS}
+PACKDCXXFLAGS:= ${HLTDCXXFLAGS}
diff --git a/HLT/trigger/AliHLTTriggerSelectiveReadoutComponent.cxx b/HLT/trigger/AliHLTTriggerSelectiveReadoutComponent.cxx
new file mode 100644 (file)
index 0000000..a57aff6
--- /dev/null
@@ -0,0 +1,272 @@
+//-*- Mode: C++ -*-
+// $Id$
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
+ *                  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   AliHLTTriggerSelectiveReadoutComponent.cxx
+    @author Jochen Thaeder
+    @date   
+    @brief  Component for the Selective Readout Trigger
+*/
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt   
+
+#if __GNUC__ >= 3
+using namespace std;
+#endif
+
+#include "AliHLTTriggerSelectiveReadoutComponent.h"
+#include "AliHLTTPCDefinitions.h"
+
+#include <cstdlib>
+#include <cerrno>
+
+
+// ** This is a global object used for automatic component registration, do not use this
+AliHLTTriggerSelectiveReadoutComponent gAliHLTTriggerSelectivereadoutComponent;
+
+ClassImp(AliHLTTriggerSelectiveReadoutComponent)
+    
+AliHLTTriggerSelectiveReadoutComponent::AliHLTTriggerSelectiveReadoutComponent() :
+  fDetector(),
+  fEnableThresholdSize(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
+
+  memset( fThreshold, 0, (fkNThreshold * sizeof(AliHLTUInt32_t)) );
+}
+
+AliHLTTriggerSelectiveReadoutComponent::~AliHLTTriggerSelectiveReadoutComponent() {
+  // see header file for class documentation
+}
+
+// Public functions to implement AliHLTComponent's interface.
+// These functions are required for the registration process
+
+const char* AliHLTTriggerSelectiveReadoutComponent::GetComponentID() {
+  // see header file for class documentation
+  return "TriggerSelectiveReadout"; 
+}
+
+void AliHLTTriggerSelectiveReadoutComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list) {
+  // see header file for class documentation
+
+  list.clear(); 
+  list.push_back( kAliHLTDataTypeDDLRaw );
+}
+
+AliHLTComponentDataType AliHLTTriggerSelectiveReadoutComponent::GetOutputDataType() {
+  // see header file for class documentation
+
+  return kAliHLTMultipleDataType;
+}
+
+Int_t AliHLTTriggerSelectiveReadoutComponent::GetOutputDataTypes( AliHLTComponentDataTypeList& tgtList) {
+  // see header file for class documentation
+
+  tgtList.clear(); 
+  tgtList.push_back( kAliHLTDataTypeDDLRaw );
+  tgtList.push_back( kAliHLTDataTypeDDL );
+}
+
+void AliHLTTriggerSelectiveReadoutComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) {
+  // see header file for class documentation
+
+  constBase = sizeof( AliHLTEventDDL );
+
+  if ( ! fDetector.CompareTo("TPC") )
+    inputMultiplier = 216.0;
+  else
+    HLTError("Output DataSize for Detector '%s' has not been implemented", fDetector.Data() );
+}
+
+// Spawn function, return new instance of this class
+AliHLTComponent* AliHLTTriggerSelectiveReadoutComponent::Spawn() {
+  // see header file for class documentation
+
+  return new AliHLTTriggerSelectiveReadoutComponent;
+}
+
+Int_t AliHLTTriggerSelectiveReadoutComponent::DoInit( int argc, const char** argv ) {
+  // see header file for class documentation
+    
+  Int_t iResult = 0;
+  TString argument = "";
+  TString parameter = "";
+  Int_t bMissingParam=0;
+  
+  for ( Int_t ii=0; ii<argc && iResult>=0; ii++ ) {
+  
+    argument = argv[ii];
+
+    if ( argument.IsNull() ) continue;
+
+    // -detector
+    if ( argument.CompareTo("-detector") == 0) {
+
+      if ( ( bMissingParam=( ++ii >= argc ) ) ) break;
+      
+      fDetector = argv[ii];  
+      fDetector.Remove(TString::kLeading, ' ');
+
+      fDetector = parameter;
+      HLTInfo( "Detector has been set to '%s'.", fDetector.Data() );
+    }
+    
+    // -enableThreshold
+    else if ( ! argument.CompareTo("-enableThreshold") ) {
+
+      if ( ( bMissingParam=( ++ii >= argc ) ) ) break;
+      
+      parameter = argv[ii];  
+      parameter.Remove(TString::kLeading, ' ');
+
+      if ( ! parameter.CompareTo("size") ) {
+       fEnableThresholdSize = kTRUE;
+       HLTInfo( "Threshold on data 'size' has been enabled." );
+      }
+      else {
+       HLTError( "This threshold '%s' has not been implemented.", parameter.Data() );
+       iResult = -EPROTO;
+      }
+    } 
+
+    // -enableThreshold
+    else if ( ! argument.CompareTo("-treshold") ) {
+       HLTError("Not yet implemented '%s'", argument.Data() );
+    } 
+    
+    // - unknow parameter
+    else {
+      iResult = -EINVAL;
+      HLTError("Unknown argument '%s'", argument.Data() );
+    }
+
+  } // for ( Int_t ii=0; ii<argc && iResult>=0; ii++ ) {
+    
+  if ( bMissingParam ) {
+    HLTError( "Missing parameter for argument '%s'.", argument.Data() );
+    iResult = -EPROTO;
+  }
+
+  return iResult;
+}
+    
+
+Int_t AliHLTTriggerSelectiveReadoutComponent::DoDeinit() {
+  // see header file for class documentation
+
+  return 0;
+}
+
+Int_t AliHLTTriggerSelectiveReadoutComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& trigData ) {
+  // see header file for class documentation
+
+  // ** Create empty Readoutlist
+  AliHLTEventDDL readoutList;
+  memset( &readoutList, 0, sizeof(AliHLTEventDDL) );
+
+  const AliHLTComponentBlockData* iter = NULL;
+  Int_t ddlId = 0;
+  AliHLTUInt8_t patch = 0;
+
+  // ** Loop over all input blocks and specify which data format should be read - only select Raw Data
+  iter = GetFirstInputBlock( kAliHLTDataTypeDDLRaw );
+  
+  while ( iter != NULL ) {
+    
+    // ** Check if block has the origin as specified in fDetector
+    if ( fDetector.CompareTo( iter->fDataType.fOrigin ) == 0 ) {
+      iter = GetNextInputBlock();
+      continue;
+    }
+
+    // ** Check if block has only the CDH Header ( 32 Bytes = gkAliHLTCommonHeaderCount *sizeof(AliHLTUInt32_t) )
+    if ( iter->fSize <= ( gkAliHLTCommonHeaderCount * sizeof(AliHLTUInt32_t) ) ) {
+      iter = GetNextInputBlock();
+      continue;
+    }
+
+    //
+    // ** Check for detector specifications
+    //
+
+    // ** Check for TPC specifc specification
+    if ( fDetector.CompareTo("TPC") == 0 ) {
+      
+      // ** Get DDL ID
+      AliHLTUInt8_t slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
+      patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
+       
+      if (patch < 2) ddlId = 768 + (2 * slice) + patch;
+      else ddlId = 838 + (4*slice) + patch;
+       
+      HLTDebug ( "Input Data - TPC - Slice/Patch: %d/%d - EquipmentID : %d.", slice, patch, ddlId );
+    } // if ( fDetector.CompareTo("TPC") == 0 ) {
+    
+    // ** Check for other detector specifc specification
+    else {
+      HLTError("Detector '%s' has not been implemented yet.", fDetector.Data() );
+      iter = GetNextInputBlock();
+      continue;
+    }
+      
+    //
+    // ** Check if threshold should be considerd
+    //
+    
+    if ( fEnableThresholdSize ) {
+
+      // ** Check for TPC threshold
+      if ( ! fDetector.CompareTo("TPC") ) {
+       if ( patch < fkNThreshold ){ 
+
+         // ** if datablock to big, do not put it in HLT readout, enable for DAQ readout
+         if ( ( fThreshold[patch] !=0 ) && ( iter->fSize > fThreshold[patch] ) ) {
+           //----------------------SetEnableDDL( &readoutList, ddlId );
+           iter = GetNextInputBlock();
+           continue;
+         }
+         
+       }
+      } // if ( ! fDetector.CompareTo("TPC") ) {
+      
+      // ** Check for other detector threshold
+      else
+       HLTError("Check for size threshold as not been implemented yet for Detector '%s'.", fDetector.Data() );
+      
+    } // if ( fEnableThresholdSize ) {
+
+    // ** PushBack data block
+    PushBack( iter->fPtr , iter->fSize, iter->fDataType, iter->fSpecification);
+      
+    // ** Get next input block, with the same specification as defined in GetFirstInputBlock()
+    iter = GetNextInputBlock();
+    
+  } //  while ( iter != NULL ) {
+    
+  // ** PushBack readout list
+  PushBack( &readoutList, sizeof(AliHLTEventDDL), kAliHLTDataTypeDDL, (AliHLTUInt32_t) 0 );
+  
+  return 0;
+}
diff --git a/HLT/trigger/AliHLTTriggerSelectiveReadoutComponent.h b/HLT/trigger/AliHLTTriggerSelectiveReadoutComponent.h
new file mode 100644 (file)
index 0000000..b9ca366
--- /dev/null
@@ -0,0 +1,103 @@
+//-*- Mode: C++ -*-
+// $Id$
+#ifndef ALIHLTTRIGGERSELECTIVEREADOUTCOMPONENT_H
+#define ALIHLTTRIGGERSELECTIVEREADOUTCOMPONENT_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   AliHLTTriggerSelectiveReadoutComponent.h
+    @author Jochen Thaeder
+    @date   
+    @brief  Component for the Selective Readout Trigger
+*/
+
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt   
+
+#include "AliHLTProcessor.h"
+#include "TString.h"
+
+/**
+ * @class AliHLTTriggerSelectiveReadoutComponent
+ * @brief  Component for the Selective Readout Trigger
+ *
+ * This class is the trigger component for selective readout. It is not detector specific.
+ * However, a detector can be provided via the commandline arguments, in order to turn off the
+ * the whole detector for readout.
+ *
+ * If threshold has been enabled, incoming blocks with size > threshold, will not been
+ * forwarded and Bit for this readout partition in ReadoutList will be set for DAQ readout.
+ *
+ * The component has the following component arguments:
+ * -detector <TPC|PHOS|TRD|MUON>    : Select Detector for discarding raw data.
+ * -enableThreshold <size>          : Enables threshold on size ( default is kFALSE )
+ * -threshold < Int_t threshold[6]> : Size threshold in Byte for different patches for TPC -> This will be disappear later on, will be taken from xCDB entry.
+ *
+ * @ingroup alihlt_trigger
+ */
+class AliHLTTriggerSelectiveReadoutComponent : public AliHLTProcessor
+{
+ public:
+
+  /** constructor */
+  AliHLTTriggerSelectiveReadoutComponent();
+  /** destructor */
+  virtual ~AliHLTTriggerSelectiveReadoutComponent();
+
+  // Public functions to implement AliHLTComponent's interface.
+  // These functions are required for the registration process
+  
+  const char* GetComponentID();
+  void GetInputDataTypes( AliHLTComponentDataTypeList& list );
+
+  AliHLTComponentDataType GetOutputDataType();
+  Int_t GetOutputDataTypes( AliHLTComponentDataTypeList& tgtList );
+
+  virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
+  AliHLTComponent* Spawn();
+  
+ protected:
+
+  using AliHLTProcessor::DoEvent;
+
+  // Protected functions to implement AliHLTComponent's interface.
+  // These functions provide initialization as well as the actual processing
+  // capabilities of the component. 
+  
+  /** Initialize the trigger component. */
+  Int_t DoInit( int argc, const char** argv );
+
+  /** DeInitialize the trigger component. */
+  Int_t DoDeinit();
+  
+  /** Process the data in the trigger component */
+  Int_t DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
+
+ private:
+  /** size of the threshold array  */
+  static const int fkNThreshold = 6;
+
+  /** copy constructor prohibited */
+  AliHLTTriggerSelectiveReadoutComponent(const AliHLTTriggerSelectiveReadoutComponent&);
+
+  /** assignment operator prohibited */
+  AliHLTTriggerSelectiveReadoutComponent& operator=(const AliHLTTriggerSelectiveReadoutComponent&);
+
+  /** Detector name */
+  TString fDetector; //! transient
+  
+  /** Enable of the size Threshold */
+  Bool_t fEnableThresholdSize; //! transient
+  
+  /** Threshold in Bytes for each a readout partition */
+  AliHLTUInt32_t fThreshold[fkNThreshold]; //! transient
+
+  ClassDef(AliHLTTriggerSelectiveReadoutComponent, 0);
+  
+};
+#endif
diff --git a/HLT/trigger/Makefile.am b/HLT/trigger/Makefile.am
new file mode 100644 (file)
index 0000000..0176abc
--- /dev/null
@@ -0,0 +1,102 @@
+# $Id$
+# Makefile template for the libAliHLTTrigger library
+
+# This files defines the autotools-based build system of the
+# libAliHLTTrigger library. All lines starting with a '#' are comments.
+# Note: Source files definitions must be made in libAliHLTTrigger.pkg
+
+MODULE                                 = AliHLTTrigger
+
+EXTRA_DIST                     = 
+
+# include the pkg definition which actually contains the source
+# file definitions
+MODDIR                         = $(top_srcdir)
+PKGDEF                         = $(MODDIR)/libAliHLTTrigger.pkg
+include $(top_srcdir)/libAliHLTTrigger.pkg
+
+
+# library definition
+# The lib_LTLIBRARIES variable is a fixed variable of the autotools build
+# system. All libraries defined by the Makefile template have to be added
+# here. Since we aim for separated directories for different libraries
+# there will be only one library.
+lib_LTLIBRARIES                        =  libAliHLTTrigger.la
+
+# version info for the library
+# The libtool program is used to created the library, a version number can
+# be specified by using the -version-info flag. This flag accepts an argument
+# of the form current[:revision[:age]].
+# If either revision or age are omitted, they default to 0. Also note that
+# age must be less than or equal to the current interface number. Here are a
+# set of rules to help you update your library version information:
+#
+#   1. Start with version information of 0:0:0 for each libtool library.
+#   2. Update the version information only immediately before a public release
+#      of your software. More frequent updates are unnecessary, and only
+#      guarantee that the current interface number gets larger faster.
+#   3. If the library source code has changed at all since the last update,
+#      then increment revision (c:r:a becomes c:r+1:a).
+#   4. If any interfaces have been added, removed, or changed since the last
+#      update, increment current, and set revision to 0.
+#   5. If any interfaces have been added since the last public release, then
+#      increment age.
+#   6. If any interfaces have been removed since the last public release, then
+#      set age to 0. 
+LIBRARY_VERSION                        = '0:0:0'
+
+# library sources
+# The source files are specified in libAliHLTTrigger.pkg
+libAliHLTTrigger_la_SOURCES    =  $(MODULE_SRCS)
+
+# library headers
+# The header files are specified in libAliHLTTrigger.pkg
+noinst_HEADERS                 =  $(MODULE_HDRS)
+
+# compilation flags of the library
+# This is the place to add further include directories if you are
+# using external modules. The AliRoot/STEER and ROOT directories
+# are the default include directories.
+# Include paths within the HLT modules are automatically taken from the
+# EINCLUDE variable of the pkg definition
+# other AliRoot dependencies might need to added
+AM_CPPFLAGS                    = -DMODULE=$(MODULE) \
+                                 @HLTBASE_CPPFLAGS@ \
+                                 @ALIROOT_CPPFLAGS@ \
+                                 @ROOTCFLAGS@ \
+                                 $(foreach i, $(EINCLUDE),  \
+                                       $(shell echo $(i) | sed -e "/HLT\//!d" -e "s|HLT/|-I$(top_srcdir)/|")) \
+                                 $(foreach i, $(EINCLUDE),  \
+                                       $(shell echo $(i) | sed -e "/HLT\//d" -e "s|^|-I$(ALICE_ROOT)/|"))
+
+# linking flags of the library
+# This is the place to add further libraries if you are
+# using external modules. The AliRoot, ROOT and HLT base libraries
+# are added by default.
+# Also the version of the library 
+#libAliHLTTPC_la_LIBADD                = $(top_builddir)/BASE/TPCLib/libAliHLTTPC.la
+libAliHLTTrigger_la_LDFLAGS    = -L@ROOTLIBDIR@ \
+                                 @ROOTLIBS@ \
+                                 @HLTBASE_LDFLAGS@ \
+                                 @ALIROOT_LDFLAGS@ \
+                                 @ALIROOT_LIBS@ \
+                                 -version-info $(LIBRARY_VERSION)
+
+# automatic generation of data and time of library build
+COMPILE_INFO                   =  AliHLTTriggerCompileInfo.cxx
+
+# set the file name for the generated root dictionary
+DICTCPP                                =  AliHLTTrigger-DICT.cxx
+nodist_libAliHLTTrigger_la_SOURCES= $(COMPILE_INFO) \
+                                  $(DICTCPP)
+
+CLEANFILES                     = $(COMPILE_INFO)
+
+include $(top_srcdir)/make.dict
+
+$(COMPILE_INFO): $(libAliHLTTrigger_la_SOURCES) $(pkginclude_HEADERS) $(noinst_HEADERS) Makefile.am
+       @echo '//automatically generated compilation info' > $@
+       @echo '//!!! DO NOT EDIT THIS FILE !!!' >> $@
+       @echo '//add changes in Makefile.am' >> $@
+       @echo 'extern "C" void CompileInfo( char*& date, char*& time)' >> $@
+       @echo '{date=__DATE__; time=__TIME__; return;}' >> $@