]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Calibration component - beta implementation of AliHLTCalibrationProcessor for TRD...
authormploskon <mploskon@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 16 Oct 2007 17:50:17 +0000 (17:50 +0000)
committermploskon <mploskon@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 16 Oct 2007 17:50:17 +0000 (17:50 +0000)
HLT/TRD/AliHLTTRDCalibrationComponent.cxx [new file with mode: 0644]
HLT/TRD/AliHLTTRDCalibrationComponent.h [new file with mode: 0644]
HLT/TRD/AliHLTTRDDefinitions.cxx
HLT/TRD/AliHLTTRDDefinitions.h
HLT/TRD/AliHLTTRDLinkDef.h
HLT/TRD/Makefile.am
HLT/libAliHLTTRD.pkg

diff --git a/HLT/TRD/AliHLTTRDCalibrationComponent.cxx b/HLT/TRD/AliHLTTRDCalibrationComponent.cxx
new file mode 100644 (file)
index 0000000..f20f6fd
--- /dev/null
@@ -0,0 +1,206 @@
+// $Id$
+
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Authors: Matthias Richter <Matthias.Richter@ift.uib.no>                *
+ *          Timm Steinbeck <timm@kip.uni-heidelberg.de>                   *
+ *          for The ALICE Off-line 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   AliHLTTRDCalibrationComponent.cxx
+    @author Timm Steinbeck, Matthias Richter
+    @date   
+    @brief  A TRDCalibration processing component for the HLT. */
+
+#if __GNUC__ >= 3
+using namespace std;
+#endif
+
+#include "TTree.h"
+#include "TFile.h"
+#include "TBranch.h"
+
+#include "AliHLTTRDCalibrationComponent.h"
+#include "AliHLTTRDDefinitions.h"
+
+#include "AliCDBManager.h"
+#include "AliTRDclusterizerHLT.h"
+#include "AliRawReaderMemory.h"
+
+#include <cstdlib>
+#include <cerrno>
+#include <string>
+
+// this is a global object used for automatic component registration, do not use this
+AliHLTTRDCalibrationComponent gAliHLTTRDCalibrationComponent;
+
+ClassImp(AliHLTTRDCalibrationComponent);
+   
+AliHLTTRDCalibrationComponent::AliHLTTRDCalibrationComponent()
+  : AliHLTCalibrationProcessor()
+  , fOutputPercentage(100) // By default we copy to the output exactly what we got as input  
+  , fStrorageDBpath("local://$ALICE_ROOT")
+  , fCDB(NULL)
+{
+  // Default constructor
+}
+
+AliHLTTRDCalibrationComponent::~AliHLTTRDCalibrationComponent()
+{
+  // Destructor
+  ;
+}
+
+const char* AliHLTTRDCalibrationComponent::GetComponentID()
+{
+  // Return the component ID const char *
+  return "TRDCalibration"; // The ID of this component
+}
+
+void AliHLTTRDCalibrationComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
+{
+  // Get the list of input data
+  list.clear(); // We do not have any requirements for our input data type(s).
+  list.push_back( AliHLTTRDDefinitions::fgkTRDSATracksDataType );
+}
+
+AliHLTComponent_DataType AliHLTTRDCalibrationComponent::GetOutputDataType()
+{
+  // Get the output data type
+  return AliHLTTRDDefinitions::fgkCalibrationDataType;
+}
+
+void AliHLTTRDCalibrationComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
+{
+  // Get the output data size
+  constBase = 0;
+  inputMultiplier = ((double)fOutputPercentage)/100.0;
+}
+
+AliHLTComponent* AliHLTTRDCalibrationComponent::Spawn()
+{
+  // Spawn function, return new instance of this class
+  return new AliHLTTRDCalibrationComponent;
+};
+
+Int_t AliHLTTRDCalibrationComponent::ScanArgument( int argc, const char** argv )
+{
+  // perform initialization. We check whether our relative output size is specified in the arguments.
+  fOutputPercentage = 100;
+  int i = 0;
+  char* cpErr;
+  while ( i < argc )
+    {
+      Logging( kHLTLogDebug, "HLT::TRDCalibration::ScanArgument", "Arguments", "argv[%d] == %s", i, argv[i] );
+      if ( !strcmp( argv[i], "output_percentage" ) )
+       {
+         if ( i+1>=argc )
+           {
+             Logging(kHLTLogError, "HLT::TRDCalibration::ScanArgument", "Missing Argument", "Missing output_percentage parameter");
+             return ENOTSUP;
+           }
+         Logging( kHLTLogDebug, "HLT::TRDCalibration::ScanArgument", "Arguments", "argv[%d+1] == %s", i, argv[i+1] );
+         fOutputPercentage = strtoul( argv[i+1], &cpErr, 0 );
+         if ( *cpErr )
+           {
+             Logging(kHLTLogError, "HLT::TRDCalibration::ScanArgument", "Wrong Argument", "Cannot convert output_percentage parameter '%s'", argv[i+1] );
+             return EINVAL;
+           }
+         Logging( kHLTLogInfo, "HLT::TRDCalibration::ScanArgument", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
+         i += 2;
+         continue;
+       }
+
+      if ( strcmp( argv[i], "-cdb" ) == 0)
+       {
+         if ( i+1 >= argc )
+           {
+             Logging(kHLTLogError, "HLT::TRDCalibration::ScanArgument", "Missing Argument", "Missing -cdb argument");
+             return ENOTSUP;         
+           }
+         fStrorageDBpath = argv[i+1];
+         Logging( kHLTLogInfo, "HLT::TRDCalibration::ScanArgument", "DB storage set", "DB storage is %s", fStrorageDBpath.c_str() );     
+         i += 2;
+         continue;
+       }      
+
+      Logging(kHLTLogError, "HLT::TRDCalibration::ScanArgument", "Unknown Option", "Unknown option '%s'", argv[i] );
+      return EINVAL;
+    }
+  return 0;
+}
+
+Int_t AliHLTTRDCalibrationComponent::InitCalibration()
+{
+  //init the calibration
+  fCDB = AliCDBManager::Instance();
+  if (!fCDB)
+    {
+      Logging(kHLTLogError, "HLT::TRDCalibration::InitCalibration", "Could not get CDB instance", "fCDB 0x%x", fCDB);
+    }
+  else
+    {
+      fCDB->SetRun(0); // THIS HAS TO BE RETRIEVED !!!
+      fCDB->SetDefaultStorage(fStrorageDBpath.c_str());
+      Logging(kHLTLogDebug, "HLT::TRDCalibration::InitCalibration", "CDB instance", "fCDB 0x%x", fCDB);
+    }
+
+}
+
+Int_t AliHLTTRDCalibrationComponent::DeinitCalibration()
+{
+  // Deinitialization of the component
+  if (fCDB)
+    {
+      Logging( kHLTLogDebug, "HLT::TRDCalibration::DeinitCalibration", "destroy", "fCDB");
+      fCDB->Destroy();
+      fCDB = 0;
+    }
+}
+
+Int_t AliHLTTRDCalibrationComponent::ProcessCalibration( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData)
+{
+  // Process an event
+//   Logging( kHLTLogInfo, "HLT::TRDCalibration::ProcessCalibration", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
+  Logging( kHLTLogDebug, "HLT::TRDCalibration::ProcessCalibration", "BLOCKS", "NofBlocks %lu", evtData.fBlockCnt );
+  // Process an event
+  unsigned long totalSize = 0;
+
+  //implement a usage of the following
+//   AliHLTUInt32_t triggerDataStructSize = trigData.fStructSize;
+//   AliHLTUInt32_t triggerDataSize = trigData.fDataSize;
+//   void *triggerData = trigData.fData;
+  Logging( kHLTLogDebug, "HLT::TRDCalibration::ProcessCalibration", "Trigger data received", 
+          "Struct size %d Data size %d Data location 0x%x", trigData.fStructSize, trigData.fDataSize, (UInt_t*)trigData.fData);
+
+  // Loop over all input blocks in the event
+  int ibForce = 0;
+  TObject *tobjin = (TObject *)GetFirstInputObject( AliHLTTRDDefinitions::fgkTRDSATracksDataType, "AliTRDtrack", ibForce);
+  Logging( kHLTLogInfo, "HLT::TRDCalibration::ProcessCalibration", "1stBLOCK", "Pointer = 0x%x", tobjin);
+  while (tobjin)
+    {
+      tobjin = (TObject *)GetNextInputObject( ibForce );
+      Logging( kHLTLogInfo, "HLT::TRDCalibration::ProcessCalibration", "nextBLOCK", "Pointer = 0x%x", tobjin);
+    }
+
+  return 0;
+}
+
+Int_t AliHLTTRDCalibrationComponent::ShipDataToFXS( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData)
+{
+  //Int_t PushToFXS(TObject* pObject, const char* pDetector, const char* pFileID, const char* pDDLNumber = "");
+  //ireturn = PushToFXS(object, "TRD ", "TRDCalib", "1024 ");
+  Logging( kHLTLogDebug, "HLT::TRDCalibration::ProcessCalibration", "Shipping data", 
+          "Nothing serious");
+  Int_t ireturn = 0;
+  return ireturn;
+}
diff --git a/HLT/TRD/AliHLTTRDCalibrationComponent.h b/HLT/TRD/AliHLTTRDCalibrationComponent.h
new file mode 100644 (file)
index 0000000..91a336f
--- /dev/null
@@ -0,0 +1,77 @@
+#ifndef ALIHLTTRDCALIBRATIONCOMPONENT_H
+#define ALIHLTTRDCALIBRATIONCOMPONENT_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/** @file   AliHLTTRDCalibrationComponent.h
+    @author Timm Steinbeck, Matthias Richter
+    @date   
+    @brief  Declaration of a TRDCalibration component. */
+
+
+#include "AliHLTCalibrationProcessor.h"
+class AliCDBManager;
+
+/**
+ * @class AliHLTTRDCalibrationComponent
+ * @brief A TRDCalibration HLT processing component. 
+ *
+ * An implementiation of a TRDCalibration component that just copies its input data
+ * as a test, demonstration, and example of the HLT component scheme.
+ * - @ref InitCalibration (optional)
+ * - @ref ScanArgument (optional)
+ * - @ref DeinitCalibration (optional)
+ * - @ref ProcessCalibration
+ * - @ref ShipDataToFXS
+ * - @ref GetComponentID
+ * - @ref GetInputDataTypes
+ * - @ref GetOutputDataType
+ * - @ref GetOutputDataSize
+ * - @ref Spawn
+ * @ingroup alihlt_tutorial
+ */
+class AliHLTTRDCalibrationComponent : public AliHLTCalibrationProcessor
+    {
+    public:
+       AliHLTTRDCalibrationComponent();
+       virtual ~AliHLTTRDCalibrationComponent();
+
+       // Public functions to implement AliHLTComponent's interface.
+       // These functions are required for the registration process
+
+       const char* GetComponentID();
+       void GetInputDataTypes( vector<AliHLTComponent_DataType>& list);
+       AliHLTComponent_DataType GetOutputDataType();
+       virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
+       AliHLTComponent* Spawn();
+       
+    protected:
+       
+       // Protected functions to implement AliHLTComponent's interface.
+       // These functions provide initialization as well as the actual processing
+       // capabilities of the component. 
+
+       virtual Int_t InitCalibration();
+       virtual Int_t ScanArgument(int argc, const char** argv);
+       virtual Int_t DeinitCalibration();
+/*     virtual Int_t ProcessCalibration(const AliHLTComponent_EventData& evtData, */
+/*                                      const AliHLTComponent_BlockData* blocks, */
+/*                                      AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr, */
+/*                                      AliHLTUInt32_t& size, */
+/*                                      vector<AliHLTComponent_BlockData>& outputBlocks); */
+       virtual Int_t ProcessCalibration( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
+       virtual Int_t ShipDataToFXS( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
+       
+    private:
+
+       // The size of the output data produced, as a percentage of the input data's size.
+       // Can be greater than 100 (%)
+       
+       unsigned fOutputPercentage; // Output volume in percentage of the input
+       string fStrorageDBpath; // Default path for OCDB
+       AliCDBManager *fCDB; //! Pointer to OCDB
+       
+       ClassDef(AliHLTTRDCalibrationComponent, 0)
+
+    };
+#endif
index 211e49750c23d15990ba7fdaf4bd4ac631778fbd..a92d5fbd7ae3eb361dbfca5891028a2d36fc161d 100644 (file)
@@ -39,6 +39,8 @@ const AliHLTComponentDataType AliHLTTRDDefinitions::fgkMCMtrackletDataType = { s
 
 const AliHLTComponentDataType AliHLTTRDDefinitions::fgkMCMcalibrationDataType = { sizeof(AliHLTComponentDataType), {'M','C','M','C','A','L','I','H'},{'T','R','D',' '}};;
 
+const AliHLTComponentDataType AliHLTTRDDefinitions::fgkCalibrationDataType = { sizeof(AliHLTComponentDataType), {'C','A','L','I','B','R','A','H'},{'T','R','D',' '}};;
+
 AliHLTTRDDefinitions::AliHLTTRDDefinitions()
 {
   // see header file for class documentation
index c97b18a78bc14aa488098132deebd073efe8ee28..51511972f98e856171cdf6e4e269f36d21f20435 100644 (file)
 
 class AliHLTTRDDefinitions
 {
-    public:
-      AliHLTTRDDefinitions();
-      virtual ~AliHLTTRDDefinitions();
-
-      static const AliHLTComponentDataType fgkDDLRawDataType;
-      static const AliHLTComponentDataType fgkClusterDataType;
-      static const AliHLTComponentDataType fgkTRDSATracksDataType; // Stand Alone tracks
-      static const AliHLTComponentDataType fgkTRDSAEsdDataType; // Stand Alone tracks
-      static const AliHLTComponentDataType fgkMCMtrackletDataType;
-      static const AliHLTComponentDataType fgkMCMcalibrationDataType;
-      
-      ClassDef(AliHLTTRDDefinitions, 0)
 
+public:
+  AliHLTTRDDefinitions();
+  virtual ~AliHLTTRDDefinitions();
+  
+  static const AliHLTComponentDataType fgkDDLRawDataType; // Raw Data
+  static const AliHLTComponentDataType fgkClusterDataType; // TRD Cluster Data
+  static const AliHLTComponentDataType fgkTRDSATracksDataType; // Stand Alone tracks
+  static const AliHLTComponentDataType fgkTRDSAEsdDataType; // Stand Alone tracks
+  static const AliHLTComponentDataType fgkMCMtrackletDataType; // MCM tracklet Data
+  static const AliHLTComponentDataType fgkMCMcalibrationDataType; // MCM Calibration data
+  static const AliHLTComponentDataType fgkCalibrationDataType; // Calibration with TRDtracks
+
+  ClassDef(AliHLTTRDDefinitions, 0)
+    
 };
 
 #endif
index fe1736fcea0aabfc888438048b320fddb24c6b2d..dc5b363b1475b144fcbec32365199b94967d84b9 100644 (file)
@@ -9,6 +9,6 @@
 #pragma link C++ class AliHLTTRDTrackerComponent;
 #pragma link C++ class AliHLTTRDDefinitions;
 #pragma link C++ class AliHLTTRDEsdWriterComponent;
-
+#pragma link C++ class AliHLTTRDCalibrationComponent;
 #endif
 
index ff14fdf08535aedc6296446dfff380cf527a01ad..92e48f414c93b8421e2990be53e390ed3ee59575 100644 (file)
@@ -21,7 +21,8 @@ libAliHLTTRD_la_SOURCES               = AliTRDclusterizerHLT.cxx \
                                  AliHLTTRDDefinitions.cxx \
                                  AliHLTTRDClusterizerComponent.cxx \
                                  AliHLTTRDTrackerComponent.cxx \
-                                 AliHLTTRDEsdWriterComponent.cxx
+                                 AliHLTTRDEsdWriterComponent.cxx \
+                                 AliHLTTRDCalibrationComponent.cxx
 
 # class header files, the link definition for the root dictionary
 # will be created from the names of the header files
@@ -29,7 +30,8 @@ CLASS_HDRS                    = AliTRDclusterizerHLT.h \
                                  AliHLTTRDDefinitions.h \
                                  AliHLTTRDClusterizerComponent.h \
                                  AliHLTTRDTrackerComponent.h \
-                                 AliHLTTRDEsdWriterComponent.h
+                                 AliHLTTRDEsdWriterComponent.h \
+                                 AliHLTTRDCalibrationComponent.h
 
 pkginclude_HEADERS             = $(CLASS_HDRS) 
 
index 49bdd95422e64c66ea5b787708f986bf27c6e2ce..0c3d6fed8ffd49e14019cc164eb43ee41c2bf78a 100644 (file)
@@ -9,8 +9,8 @@ MODULE_SRCS= \
         AliHLTTRDDefinitions.cxx \
         AliHLTTRDTrackerComponent.cxx \
         AliTRDclusterizerHLT.cxx \
-       AliHLTTRDEsdWriterComponent.cxx
-
+       AliHLTTRDEsdWriterComponent.cxx \
+       AliHLTTRDCalibrationComponent.cxx
 # class header files, the link definition for the root dictionary
 # will be created from the names of the header files
 CLASS_HDRS:= \
@@ -18,8 +18,8 @@ CLASS_HDRS:= \
         AliHLTTRDDefinitions.h \
         AliHLTTRDTrackerComponent.h \
         AliTRDclusterizerHLT.h \
-       AliHLTTRDEsdWriterComponent.h
-
+       AliHLTTRDEsdWriterComponent.h \
+       AliHLTTRDCalibrationComponent.h
 # 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