]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- handling of global AliHLTSystem singleton moved to BASE
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 26 Mar 2008 22:06:10 +0000 (22:06 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 26 Mar 2008 22:06:10 +0000 (22:06 +0000)
- AliHLTSimulation uses AliHLTSystem singleton
- HLTOUT raw files written according to AliSimulation::SetWriteRawData

HLT/BASE/AliHLTReconstructorBase.cxx [moved from HLT/rec/AliHLTReconstructorBase.cxx with 100% similarity]
HLT/BASE/AliHLTReconstructorBase.h [moved from HLT/rec/AliHLTReconstructorBase.h with 100% similarity]
HLT/libHLTbase.pkg
HLT/libHLTrec.pkg
HLT/sim/AliHLTOUTComponent.cxx
HLT/sim/AliHLTOUTComponent.h
HLT/sim/AliHLTSimulation.cxx
HLT/sim/AliHLTSimulation.h

index adb8c3b91f368b831786312d854cdcd1c5a1ffbe..90ee6584f244ef9b579865bc80ed5f8c24206654 100644 (file)
@@ -6,6 +6,7 @@ include $(MODDIR)/hlt.conf
 CLASS_HDRS:=   AliHLTComponent.h \
                AliHLTComponentHandler.h \
                AliHLTSystem.h \
 CLASS_HDRS:=   AliHLTComponent.h \
                AliHLTComponentHandler.h \
                AliHLTSystem.h \
+               AliHLTReconstructorBase.h \
                AliHLTProcessor.h \
                AliHLTCalibrationProcessor.h \
                AliHLTConfiguration.h \
                AliHLTProcessor.h \
                AliHLTCalibrationProcessor.h \
                AliHLTConfiguration.h \
index e156d123e50c6cf47d5ae7a42b2303184f77d86f..7bef44a5ee5ac4616ea7d5a86607f4f137ff0cd7 100644 (file)
@@ -6,7 +6,6 @@ include $(MODDIR)/hlt.conf
 LIBHLTREC_VERSION := 0
 
 CLASS_HDRS:=   AliHLTReconstructor.h \
 LIBHLTREC_VERSION := 0
 
 CLASS_HDRS:=   AliHLTReconstructor.h \
-               AliHLTReconstructorBase.h \
                AliRawReaderHLT.h \
                AliHLTOUTRawReader.h
 
                AliRawReaderHLT.h \
                AliHLTOUTRawReader.h
 
index 6c39a30504949a66294c280ac849d4d84a747691..dabafe584726bdff53bf5190835395fc4a138a72 100644 (file)
@@ -52,8 +52,6 @@ AliHLTOUTComponent::AliHLTOUTComponent()
   fWriters(),
   fNofDDLs(10),
   fIdFirstDDL(7680), // 0x1e<<8
   fWriters(),
   fNofDDLs(10),
   fIdFirstDDL(7680), // 0x1e<<8
-  fWriteDigits(kTRUE),
-  fWriteRaw(kTRUE),
   fBuffer(),
   fpLibManager(NULL)
 {
   fBuffer(),
   fpLibManager(NULL)
 {
@@ -73,6 +71,8 @@ AliHLTOUTComponent::AliHLTOUTComponent()
   */
 }
 
   */
 }
 
+int AliHLTOUTComponent::fgOptions=kWriteRawFiles|kWriteDigits;
+
 AliHLTOUTComponent::~AliHLTOUTComponent()
 {
   // see header file for class documentation
 AliHLTOUTComponent::~AliHLTOUTComponent()
 {
   // see header file for class documentation
@@ -180,7 +180,7 @@ int AliHLTOUTComponent::DumpEvent( const AliHLTComponentEventData& evtData,
 {
   // see header file for class documentation
   int iResult=0;
 {
   // see header file for class documentation
   int iResult=0;
-  HLTInfo("write %d output blocks", evtData.fBlockCnt);
+  HLTInfo("write %d output block(s)", evtData.fBlockCnt);
   if (iResult>=0) {
     homer_uint64 homerHeader[kCount_64b_Words];
     HOMERBlockDescriptor homerDescriptor(homerHeader);
   if (iResult>=0) {
     homer_uint64 homerHeader[kCount_64b_Words];
     HOMERBlockDescriptor homerDescriptor(homerHeader);
@@ -241,8 +241,8 @@ int AliHLTOUTComponent::FillESD(int eventNo, AliRunLoader* runLoader, AliESDEven
     int bufferSize=0;
     
     if ((bufferSize=FillOutputBuffer(eventNo, fWriters[*ddlno], pBuffer))>0) {
     int bufferSize=0;
     
     if ((bufferSize=FillOutputBuffer(eventNo, fWriters[*ddlno], pBuffer))>0) {
-      if (fWriteDigits) WriteDigits(eventNo, runLoader, *ddlno, pBuffer, bufferSize);
-      if (fWriteRaw) WriteRawFile(eventNo, runLoader, *ddlno, pBuffer, bufferSize);
+      if (fgOptions&kWriteDigits) WriteDigits(eventNo, runLoader, *ddlno, pBuffer, bufferSize);
+      if (fgOptions&kWriteRawFiles) WriteRawFile(eventNo, runLoader, *ddlno, pBuffer, bufferSize);
     }
     fWriters[*ddlno]->Clear();
     ddlno++;
     }
     fWriters[*ddlno]->Clear();
     ddlno++;
@@ -368,3 +368,15 @@ int AliHLTOUTComponent::WriteRawFile(int eventNo, AliRunLoader* /*runLoader*/, i
   }
   return iResult;
 }
   }
   return iResult;
 }
+
+void AliHLTOUTComponent::SetGlobalOption(unsigned int options)
+{
+  // see header file for class documentation
+  fgOptions|=options;
+}
+
+void AliHLTOUTComponent::ClearGlobalOption(unsigned int options)
+{
+  // see header file for class documentation
+  fgOptions&=~options;
+}
index 7fd8ff82d55d6d453e402674f31a97b3b8b29919..408f9452687e11fb7f17f3a92e15f77610faea16 100644 (file)
@@ -78,6 +78,25 @@ class AliHLTOUTComponent : public AliHLTOfflineDataSink  {
   void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
   AliHLTComponent* Spawn();
 
   void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
   AliHLTComponent* Spawn();
 
+  /**
+   * Enable global options valid for all instances of the component
+   * @param options   bit field
+   */
+  static void SetGlobalOption(unsigned int options);
+
+  /**
+   * Disable global options valid for all instances of the component
+   * @param options   bit field
+   */
+  static void ClearGlobalOption(unsigned int options);
+
+  enum {
+    /** write the raw files of the HLT links */
+    kWriteRawFiles = 0x1,
+    /** write the digit file */
+    kWriteDigits = 0x2
+  };
+
  protected:
   /**
    * Init method.
  protected:
   /**
    * Init method.
@@ -163,18 +182,15 @@ class AliHLTOUTComponent : public AliHLTOfflineDataSink  {
   /** equipment ID of first HLT DDL */
   int fIdFirstDDL; //!transient
 
   /** equipment ID of first HLT DDL */
   int fIdFirstDDL; //!transient
 
-  /** write digits or not */
-  Bool_t fWriteDigits; //!transient
-
-  /** write raw file or not */
-  Bool_t fWriteRaw; //!transient
-
   /** output buffer, allocated once in order to avoid frequent alloc/dealloc */
   vector<AliHLTUInt8_t> fBuffer; //!transient
 
   /** instance of the HOMER library manager */
   AliHLTHOMERLibManager* fpLibManager; // !transient
 
   /** output buffer, allocated once in order to avoid frequent alloc/dealloc */
   vector<AliHLTUInt8_t> fBuffer; //!transient
 
   /** instance of the HOMER library manager */
   AliHLTHOMERLibManager* fpLibManager; // !transient
 
-  ClassDef(AliHLTOUTComponent, 0)
+  /** global options for all instances */
+  static int fgOptions; //! transient
+
+  ClassDef(AliHLTOUTComponent, 1)
 };
 #endif
 };
 #endif
index fc8d702d4c7d35967eb1f3ebc9616685553e81a4..bd1f58b09f0bb06555148c18fe7a8f09726ee24c 100644 (file)
@@ -33,6 +33,7 @@
 #include "AliRawReaderDate.h"
 #include "AliRawReaderRoot.h"
 #include "AliESDEvent.h"
 #include "AliRawReaderDate.h"
 #include "AliRawReaderRoot.h"
 #include "AliESDEvent.h"
+#include "AliHLTOUTComponent.h"
 
 #if ALIHLTSIMULATION_LIBRARY_VERSION != LIBHLTSIM_VERSION
 #error library version in header file and lib*.pkg do not match
 
 #if ALIHLTSIMULATION_LIBRARY_VERSION != LIBHLTSIM_VERSION
 #error library version in header file and lib*.pkg do not match
@@ -44,7 +45,6 @@ ClassImp(AliHLTSimulation);
 AliHLTSimulation::AliHLTSimulation()
   :
   fOptions(),
 AliHLTSimulation::AliHLTSimulation()
   :
   fOptions(),
-  fpSystem(NULL),
   fpRawReader(NULL)
 {
   // see header file for class documentation
   fpRawReader(NULL)
 {
   // see header file for class documentation
@@ -57,10 +57,6 @@ AliHLTSimulation::AliHLTSimulation()
 AliHLTSimulation::~AliHLTSimulation()
 {
   // see header file for function documentation
 AliHLTSimulation::~AliHLTSimulation()
 {
   // see header file for function documentation
-  if (fpSystem) {
-    delete fpSystem;
-  }
-  fpSystem=NULL;
   if (fpRawReader) {
     delete fpRawReader;
   }
   if (fpRawReader) {
     delete fpRawReader;
   }
@@ -87,12 +83,12 @@ int AliHLTSimulation::Init(AliRunLoader* pRunLoader, const char* options)
   fOptions=options;
   TString sysOp;
 
   fOptions=options;
   TString sysOp;
 
-  if (!fpSystem) fpSystem=new AliHLTSystem;
-  if (!fpSystem) {
-    AliError("can not create AliHLTSystem object");
+  AliHLTSystem* pSystem=GetInstance();
+  if (!pSystem) {
+    AliError("can not get AliHLTSystem instance");
     return -ENOMEM;
   }
     return -ENOMEM;
   }
-  if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
+  if (pSystem->CheckStatus(AliHLTSystem::kError)) {
     AliError("HLT system in error state");
     return -EFAULT;
   }
     AliError("HLT system in error state");
     return -EFAULT;
   }
@@ -133,6 +129,10 @@ int AliHLTSimulation::Init(AliRunLoader* pRunLoader, const char* options)
              fpRawReader=NULL;
            }
        }
              fpRawReader=NULL;
            }
        }
+      } else if (token.Contains("writerawfiles=")) {
+       if (!token.ReplaceAll("writerawfiles=", "").Contains("HLT")) {
+         AliHLTOUTComponent::ClearGlobalOption(AliHLTOUTComponent::kWriteRawFiles);
+       }
       } else {
        if (sysOp.Length()>0) sysOp+=" ";
        sysOp+=token;
       } else {
        if (sysOp.Length()>0) sysOp+=" ";
        sysOp+=token;
@@ -142,13 +142,13 @@ int AliHLTSimulation::Init(AliRunLoader* pRunLoader, const char* options)
   }
 
   // scan options
   }
 
   // scan options
-  if (fpSystem->ScanOptions(sysOp.Data())<0) {
+  if (pSystem->ScanOptions(sysOp.Data())<0) {
     AliError("error setting options for HLT system");
     return -EINVAL;    
   }
 
     AliError("error setting options for HLT system");
     return -EINVAL;    
   }
 
-  if (!fpSystem->CheckStatus(AliHLTSystem::kReady)) {
-    if ((fpSystem->Configure(pRunLoader))<0) {
+  if (!pSystem->CheckStatus(AliHLTSystem::kReady)) {
+    if ((pSystem->Configure(pRunLoader))<0) {
       AliError("error during HLT system configuration");
       return -EFAULT;
     }
       AliError("error during HLT system configuration");
       return -EFAULT;
     }
@@ -169,24 +169,29 @@ int AliHLTSimulation::Run(AliRunLoader* pRunLoader)
   int nEvents = pRunLoader->GetNumberOfEvents();
   int iResult=0;
 
   int nEvents = pRunLoader->GetNumberOfEvents();
   int iResult=0;
 
-  if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
+  AliHLTSystem* pSystem=GetInstance();
+  if (!pSystem) {
+    AliError("can not get AliHLTSystem instance");
+    return -ENOMEM;
+  }
+  if (pSystem->CheckStatus(AliHLTSystem::kError)) {
     AliError("HLT system in error state");
     return -EFAULT;
   }
 
   // Note: the rawreader is already placed at the first event
     AliError("HLT system in error state");
     return -EFAULT;
   }
 
   // Note: the rawreader is already placed at the first event
-  if ((iResult=fpSystem->Reconstruct(1, pRunLoader, fpRawReader))>=0) {
-    fpSystem->FillESD(0, pRunLoader, NULL);
+  if ((iResult=pSystem->Reconstruct(1, pRunLoader, fpRawReader))>=0) {
+    pSystem->FillESD(0, pRunLoader, NULL);
     for (int i=1; i<nEvents; i++) {
       if (fpRawReader && !fpRawReader->NextEvent()) {
        AliError("missmatch in event count, rawreader corrupted");
        break;
       }
     for (int i=1; i<nEvents; i++) {
       if (fpRawReader && !fpRawReader->NextEvent()) {
        AliError("missmatch in event count, rawreader corrupted");
        break;
       }
-      fpSystem->Reconstruct(1, pRunLoader, fpRawReader);
-      fpSystem->FillESD(i, pRunLoader, NULL);
+      pSystem->Reconstruct(1, pRunLoader, fpRawReader);
+      pSystem->FillESD(i, pRunLoader, NULL);
     }
     // send specific 'event' to execute the stop sequence
     }
     // send specific 'event' to execute the stop sequence
-    fpSystem->Reconstruct(0, NULL, NULL);
+    pSystem->Reconstruct(0, NULL, NULL);
   }
   return iResult;
 }
   }
   return iResult;
 }
index eead445c82596a5940b77b21e618622cf132d05d..4e84126a36a04fc27979ca4c325b7d93737e6973 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "TObject.h"
 #include "TString.h"
 
 #include "TObject.h"
 #include "TString.h"
+#include "AliHLTReconstructorBase.h"
 class AliRunLoader;
 class AliHLTSystem;
 class AliRawReader;
 class AliRunLoader;
 class AliHLTSystem;
 class AliRawReader;
@@ -33,7 +34,7 @@ class AliRawReader;
  * @class AliHLTSimulation
  * Base class of HLT data processing simulations.
  */
  * @class AliHLTSimulation
  * Base class of HLT data processing simulations.
  */
-class AliHLTSimulation : public TObject {
+class AliHLTSimulation : public TObject, public AliHLTReconstructorBase {
  public:
   /** create an instance of the class */
   static AliHLTSimulation* CreateInstance();
  public:
   /** create an instance of the class */
   static AliHLTSimulation* CreateInstance();
@@ -60,13 +61,10 @@ class AliHLTSimulation : public TObject {
   /* current options */
   TString fOptions;                                                   //!transient
 
   /* current options */
   TString fOptions;                                                   //!transient
 
-  /* HLT steering object */
-  AliHLTSystem* fpSystem;                                             //!transient
-
   /* RAW reader instance for chains which need RAW data as input */
   AliRawReader* fpRawReader;                                            //!transient
 
   /* RAW reader instance for chains which need RAW data as input */
   AliRawReader* fpRawReader;                                            //!transient
 
-  ClassDef(AliHLTSimulation, 1)
+  ClassDef(AliHLTSimulation, 2)
 };
 
 #define ALIHLTSIMULATION_LIBRARY             "libHLTsim.so"
 };
 
 #define ALIHLTSIMULATION_LIBRARY             "libHLTsim.so"