- Adding the Monitoring Trigger
authorjthaeder <jthaeder@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 7 Sep 2008 16:27:51 +0000 (16:27 +0000)
committerjthaeder <jthaeder@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 7 Sep 2008 16:27:51 +0000 (16:27 +0000)
- some changes for the Statistics Components

HLT/ITS/AliHLTITSCompressRawDataSDDComponent.h
HLT/TPCLib/AliHLTTPCEventStatisticsProducerComponent.cxx
HLT/TPCLib/AliHLTTPCEventStatisticsProducerComponent.h
HLT/libAliHLTTrigger.pkg
HLT/trigger/AliHLTTriggerMonitoringComponent.cxx [new file with mode: 0644]
HLT/trigger/AliHLTTriggerMonitoringComponent.h [new file with mode: 0644]

index 41016f4..147d9d6 100644 (file)
@@ -1,3 +1,4 @@
+//-*- Mode: C++ -*-
 // @(#) $Id: AliHLTITSCompressRawDataSDDComponent.h 27006 2008-07-01 09:21:45Z richterm $
 
 #ifndef ALIHLTITSCOMPRESSRAWDATASDDCOMPONENT_H
index 8fb9b48..53623d5 100644 (file)
@@ -239,13 +239,25 @@ Int_t AliHLTTPCEventStatisticsProducerComponent::DoEvent( const AliHLTComponentE
 
   // ** Loop over all input blocks and specify which data format should be read
   for ( iter = GetFirstInputBlock(AliHLTTPCDefinitions::fgkTracksDataType); iter != NULL; iter = GetNextInputBlock() ) {
-    
+
     HLTDebug ( "Input Data - TPC track segments." );
 
     AddTracks( iter->fPtr );
   } //   for ( iter = GetFirstInputBlock(AliHLTTPCDefinitions::fgkTracksDataType); iter != NULL; iter = GetNextInputBlock() ) {
   
 
+  TObject* iterObject = NULL;
+
+  // ** GetESDs
+  iterObject = (TObject* )GetFirstInputObject(kAliHLTDataTypeESDTree|kAliHLTDataOriginTPC);
+
+  if ( iterObject ) {
+
+    HLTDebug ( "Input Data - TPC ESD." );
+
+    AddESD( (TTree*) iterObject );
+  } 
+  
   //
   // ** Produce event statistics
   //
@@ -340,6 +352,21 @@ void AliHLTTPCEventStatisticsProducerComponent::AddTracks( void* ptr, Int_t slic
 }
 
 // -- **********************************************************************************************
+void AliHLTTPCEventStatisticsProducerComponent::AddESD( TTree* esdTree ) {
+  // see header file for class documentation
+
+  AliESDEvent* esd = new AliESDEvent();
+  esd->ReadFromTree(esdTree);
+  esdTree->GetEntry(0);
+
+  HLTWarning("Number of tracks found : %d", esd->GetNumberOfTracks() );
+  
+  if ( esd )
+    delete esd;
+
+}
+
+// -- **********************************************************************************************
 void AliHLTTPCEventStatisticsProducerComponent::ProcessEvent() { 
   // see header file for class documentation
 
index c6fb6f5..8b45fbf 100644 (file)
@@ -23,6 +23,8 @@
 
 #include "AliHLTTPCEventStatistics.h"
 #include "AliHLTTPCTrackArray.h"
+#include "AliESDEvent.h"
+#include "TTree.h"
 
 /**
  * @class  AliHLTTPCEventStatisticsProducerComponent
@@ -89,6 +91,11 @@ public:
    */
   void AddTracks( void* ptr, Int_t slice=-1 );     
 
+  /** Add ESD
+   * @param esdEvent Pointer to AliESDEvent
+   */
+  void AddESD( TTree* esdTree );     
+
   /** Process even -> get process statistics */
   void ProcessEvent();                          
 
index 0bb90d3..a5153e3 100644 (file)
@@ -9,13 +9,13 @@
 # class header files, the link definition for the root dictionary
 # will be created from the names of the header files
 CLASS_HDRS:= \
-                AliHLTTrigger.h                          \
+                AliHLTTrigger.h                             \
                 AliHLTEventSummary.h                        \
                 AliHLTEventSummaryProducerComponent.h       \
                 AliHLTRunSummary.h                          \
                 AliHLTRunSummaryProducerComponent.h         \
-               AliHLTTriggerSelectiveReadoutComponent.h
-
+               AliHLTTriggerSelectiveReadoutComponent.h    \
+                AliHLTTriggerMonitoringComponent.h
 
 
 # library sources
diff --git a/HLT/trigger/AliHLTTriggerMonitoringComponent.cxx b/HLT/trigger/AliHLTTriggerMonitoringComponent.cxx
new file mode 100644 (file)
index 0000000..d563850
--- /dev/null
@@ -0,0 +1,257 @@
+//-*- Mode: C++ -*-
+// $Id: AliHLTTriggerMonitoringComponent.cxx 24328 2008-03-06 13:26:00Z richterm $
+/**************************************************************************
+ * 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   AliHLTTriggerMonitoringComponent.cxx
+    @author Jochen Thaeder
+    @date   
+    @brief  Produces a event summary as @see AliHLTEventSummary
+*/
+
+// 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 "AliHLTTriggerMonitoringComponent.h"
+#include "AliHLTTPCEventStatistics.h"
+#include "AliHLTEventStatistics.h"
+#include <cerrno>
+
+// ** This is a global object used for automatic component registration, do not use this
+AliHLTTriggerMonitoringComponent gAliHLTTriggerMonitoringComponent;
+
+ClassImp(AliHLTTriggerMonitoringComponent)
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                            Constructor / Destructor
+ * ---------------------------------------------------------------------------------
+ */
+   
+// ------------------------------------------------------------------------------------------
+AliHLTTriggerMonitoringComponent::AliHLTTriggerMonitoringComponent() : 
+  fTotalTrackCut(-1),
+  fLongTrackCut(-1),
+  fEventSummary(NULL) {
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+// ------------------------------------------------------------------------------------------
+AliHLTTriggerMonitoringComponent::~AliHLTTriggerMonitoringComponent() {
+  // see header file for class documentation
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ * Public functions to implement AliHLTComponent's interface.
+ * These functions are required for the registration process
+ * ---------------------------------------------------------------------------------
+ */
+
+// ------------------------------------------------------------------------------------------
+const char* AliHLTTriggerMonitoringComponent::GetComponentID() {
+  // see header file for class documentation
+  return "TriggerMonitoring"; 
+}
+
+// ------------------------------------------------------------------------------------------
+void AliHLTTriggerMonitoringComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list) {
+  // see header file for class documentation
+
+  list.clear(); 
+  list.push_back( kAliHLTDataTypeEventSummary );
+}
+
+// ------------------------------------------------------------------------------------------
+AliHLTComponentDataType AliHLTTriggerMonitoringComponent::GetOutputDataType() {
+  // see header file for class documentation
+
+  return kAliHLTDataTypeEventSummary;
+}
+
+// ------------------------------------------------------------------------------------------
+void AliHLTTriggerMonitoringComponent::GetOutputDataSize( unsigned long& constBase, 
+                                                         double& inputMultiplier ) {
+  // see header file for class documentation
+
+  constBase = sizeof( AliHLTEventSummary );
+  inputMultiplier = 0.0;
+}
+
+// ------------------------------------------------------------------------------------------
+AliHLTComponent* AliHLTTriggerMonitoringComponent::Spawn() {
+  // Spawn function, return new instance of this class
+  // see header file for class documentation
+
+  return new AliHLTTriggerMonitoringComponent;
+}
+
+
+// ------------------------------------------------------------------------------------------
+Int_t AliHLTTriggerMonitoringComponent::DoInit( int argc, const char** argv ) {
+  // see header file for class documentation
+
+  Int_t iResult = 0;
+  // ** Argument handling
+
+  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;
+
+    // -triggerTotalTracks
+    if ( ! argument.CompareTo("-triggerTotalTracks") ) {
+
+      if ( ( bMissingParam=( ++ii >= argc ) ) ) break;
+      parameter = argv[ii];  
+      parameter.Remove( TString::kLeading, ' ' );
+      
+      if  (parameter.IsDigit() ) {
+       fTotalTrackCut = (Int_t) parameter.Atoi();
+       HLTInfo( "Trigger on total number of tracks is activated, and threshold is set to  %d.", fTotalTrackCut );
+      } 
+      else {
+       HLTError( "Cannot convert triggerTotalTracks specifier '%s'.", parameter.Data() );
+       iResult = -EINVAL;
+       break;
+      }
+      
+    } // if ( ! argument.CompareTo("-triggerTotalTracks") ) {
+
+    // -triggerLongTracks
+    else if ( ! argument.CompareTo("-triggerLongTracks") ) {
+
+      if ( ( bMissingParam=( ++ii >= argc ) ) ) break;
+      parameter = argv[ii];  
+      parameter.Remove( TString::kLeading, ' ' );
+      
+      if  (parameter.IsDigit() ) {
+       fLongTrackCut = (Int_t) parameter.Atoi();
+       HLTInfo( "Trigger on number of long tracks is activated, and threshold is set to  %d.", fTotalTrackCut );
+      } 
+      else {
+       HLTError( "Cannot convert triggerLongTracks specifier '%s'.", parameter.Data() );
+       iResult = -EINVAL;
+       break;
+      }
+    } // if ( ! argument.CompareTo("-triggerLongTracks") ) {
+    // - 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 AliHLTTriggerMonitoringComponent::DoDeinit() {
+  // see header file for class documentation
+
+  if ( fEventSummary )
+    delete fEventSummary;
+  fEventSummary = NULL;
+
+  return 0;
+}
+
+// ------------------------------------------------------------------------------------------
+Int_t AliHLTTriggerMonitoringComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ) {
+  // see header file for class documentation
+
+  if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ))
+    return 0;
+  const TObject* iter = NULL;
+  iter = GetFirstInputObject(kAliHLTDataTypeEventSummary|kAliHLTDataOriginAny);
+
+  fEventSummary = (AliHLTEventSummary*) iter;
+    
+  // Trigger on eventSummary
+  Trigger();
+  
+  if (fEventSummary->IsAccepted())
+    HLTWarning( "Triggered" );
+  else
+    HLTWarning( "Discarded" );
+  
+  HLTWarning( "../../trigger/AliHLTTriggerMonitoringComponent.cxx:139:RunNumber %d ", GetRunNo() );
+  
+  // ** PushBack Event Summary
+  PushBack ( (TObject*) fEventSummary, sizeof(AliHLTEventSummary), kAliHLTDataTypeEventSummary, (AliHLTUInt32_t) 0 );
+
+  return 0;
+}
+
+// -- **********************************************************************************************
+// -- *******************************   Processing Functions  **************************************
+// -- **********************************************************************************************
+
+// -- **********************************************************************************************
+void AliHLTTriggerMonitoringComponent::Trigger() {
+  // see header file for class documentation
+  
+  TObjArray* detArray = fEventSummary->GetDetectorArray();
+
+  for ( Int_t iter = 0; iter <= detArray->GetLast(); iter++ ) {
+      
+    AliHLTEventStatistics* evStat = (AliHLTEventStatistics*) (*detArray)[iter];
+    TString detName = evStat->GetDetectorName();
+    
+    if ( detName.CompareTo("TPC") )
+      continue;
+    
+    HLTWarning("TPC statistics found...");
+    
+    AliHLTTPCEventStatistics* tpcStat = (AliHLTTPCEventStatistics*) (*detArray)[iter];
+    
+    if ( fLongTrackCut != -1 && tpcStat->GetNTracksAboveClusterThreshold() < fLongTrackCut ) {
+      fEventSummary->RejectEvent();
+      return;
+    }
+    
+    if ( fTotalTrackCut != -1 && tpcStat->GetNTotalTracks() < fTotalTrackCut ) {
+      fEventSummary->RejectEvent();
+      return;
+    }
+
+  } // for ( Int_t iter = 0; iter <= detArray->GetLast(); iter++ ) {
+
+}
diff --git a/HLT/trigger/AliHLTTriggerMonitoringComponent.h b/HLT/trigger/AliHLTTriggerMonitoringComponent.h
new file mode 100644 (file)
index 0000000..c20e766
--- /dev/null
@@ -0,0 +1,129 @@
+//-*- Mode: C++ -*-
+// $Id: AliHLTTriggerMonitoringComponent.h 24328 2008-03-06 13:26:00Z richterm $
+#ifndef ALIHLTTRIGGERMONITORINGCOMPONENT_H
+#define ALIHLTTRIGGERMONITORINGCOMPONENT_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   AliHLTTriggerMonitoringComponent.h
+    @author Jochen Thaeder
+    @date   
+    @brief  Produces a monitoring Trigger for AliEve
+*/
+
+// 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 "AliHLTEventSummary.h"
+
+/**
+ * @class  AliHLTTriggerMonitoringComponent
+ * @brief  Produces a monitoring Trigger for AliEve
+ *
+ * This class produces a trigger accoring to events with more than x tracks, 
+ * with associated clusters more the y and sends it out for every event.
+ * x and y can be set as option
+ *
+ * @ingroup alihlt_trigger
+ */
+
+class AliHLTTriggerMonitoringComponent : public AliHLTProcessor {
+  
+public:
+  
+  /*
+   * ---------------------------------------------------------------------------------
+   *                            Constructor / Destructor
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** constructor */
+  AliHLTTriggerMonitoringComponent();
+
+  /** destructor */
+  virtual ~AliHLTTriggerMonitoringComponent();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   * 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:
+
+  using AliHLTProcessor::DoEvent;
+
+  /*
+   * ---------------------------------------------------------------------------------
+   * Protected functions to implement AliHLTComponent's interface.
+   * These functions provide initialization as well as the actual processing
+   * capabilities of the component. 
+   * ---------------------------------------------------------------------------------
+   */
+  
+  /** Initialization */
+  Int_t DoInit( int argc, const char** argv );
+
+  /** DeInitialization */
+  Int_t DoDeinit();
+  
+  /** EventLoop */
+  Int_t DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
+
+  ///////////////////////////////////////////////////////////////////////////////////
+
+private:
+  /** copy constructor prohibited */
+  AliHLTTriggerMonitoringComponent (const AliHLTTriggerMonitoringComponent&);
+
+  /** assignment operator prohibited */
+  AliHLTTriggerMonitoringComponent& operator= (const AliHLTTriggerMonitoringComponent&);
+
+  // ------------------------------------------------------------------------------------------
+
+  /** Process trigger */
+  void Trigger();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Members - private
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Cut on total number of tracks */
+  Int_t fTotalTrackCut;
+
+  /** Cut on number of long tracks */
+  Int_t fLongTrackCut;
+  
+  /** Event summary class*/
+  AliHLTEventSummary* fEventSummary;       //! transient
+  
+  ClassDef(AliHLTTriggerMonitoringComponent, 0);
+
+};
+#endif
+