]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTComponent.cxx
ALIROOT-5600 - skip non-participating detector modules
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTComponent.cxx
index 5587cbb3c6d3dd7cb0dc3b3bb3bb139a67c28067..3617a3e0d6fead46e00199fe4d08181cbb0d96c7 100644 (file)
 //          context
 
 
-#if __GNUC__>= 3
-using namespace std;
-#endif
-
 //#include "AliHLTStdIncludes.h"
 #include "AliHLTComponent.h"
 #include "AliHLTComponentHandler.h"
 #include "AliHLTMessage.h"
 #include "AliHLTCTPData.h"
 #include "AliHLTErrorGuard.h"
-#include "AliRawDataHeader.h"
+#include "AliHLTCDHWrapper.h"
 #include "TString.h"
 #include "TMath.h"
 #include "TObjArray.h"
@@ -89,7 +85,7 @@ AliHLTComponent::AliHLTComponent()
   fpStopwatches(new TObjArray(kSWTypeCount)),
   fMemFiles(),
   fpRunDesc(NULL),
-  fCDBSetRunNoFunc(false),
+  fCDBSetRunNoFunc(NULL),
   fChainId(),
   fChainIdCrc(0),
   fpBenchmark(NULL),
@@ -473,7 +469,7 @@ int AliHLTComponent::ConfigureFromArgumentString(int argc, const char** argv)
     // the argument is a single argument, just having whitespaces at the end.
     argument.Remove(0, argument.First(' '));
     if (argument.IsWhitespace()) {
-      ptrarray.push_back(argv[i]);
+      stringarray.push_back(argv[i]);
       continue;
     }
 
@@ -497,7 +493,6 @@ int AliHLTComponent::ConfigureFromArgumentString(int argc, const char** argv)
            // every second entry is enclosed by quotes and thus
            // one single argument
            stringarray.push_back(argument.Data());
-           ptrarray.push_back(stringarray.back().c_str());
          } else {
     TObjArray* pTokens=argument.Tokenize(" ");
     if (pTokens) {
@@ -506,7 +501,6 @@ int AliHLTComponent::ConfigureFromArgumentString(int argc, const char** argv)
          TString data=pTokens->At(n)->GetName();
          if (!data.IsNull() && !data.IsWhitespace()) {
            stringarray.push_back(data.Data());
-           ptrarray.push_back(stringarray.back().c_str());
          }
        }
       }
@@ -519,6 +513,13 @@ int AliHLTComponent::ConfigureFromArgumentString(int argc, const char** argv)
     }
   }
 
+  // fill ptrarray; should be safe at this point
+  // since stringarray isn't modified any further
+  unsigned int idx;
+  for(idx=0; idx<stringarray.size(); ++idx) {
+    ptrarray.push_back(stringarray.at(idx).c_str());
+  }
+
   for (i=0; (unsigned)i<ptrarray.size() && iResult>=0;) {
     int result=ScanConfigurationArgument(ptrarray.size()-i, &ptrarray[i]);
     if (result==0) {
@@ -1042,6 +1043,7 @@ void AliHLTComponent::FillEventData(AliHLTComponentEventData& evtData)
   memset(&evtData, 0, sizeof(AliHLTComponentEventData));
   evtData.fStructSize=sizeof(AliHLTComponentEventData);
   evtData.fEventID=kAliHLTVoidEventID;
+  evtData.fEventCreation_s = kMaxUInt;
 }
 
 void AliHLTComponent::PrintComponentDataTypeInfo(const AliHLTComponentDataType& dt) 
@@ -1747,6 +1749,10 @@ namespace
   public:
     AliHLTComponentStatisticsId(AliHLTUInt32_t id) : fId(id) {}
     AliHLTComponentStatisticsId(const AliHLTComponentStatisticsId& src) : fId(src.fId) {}
+    AliHLTComponentStatisticsId& operator=(const AliHLTComponentStatisticsId& src) {
+      if (this==&src) return *this;
+      fId=src.fId; return *this;
+    }
     bool operator==(const AliHLTComponentStatistics& a) const {return a.fId==fId;}
   private:
     AliHLTComponentStatisticsId();
@@ -1769,6 +1775,10 @@ namespace
   public:
     AliHLTComponentBlockDataSpecification(AliHLTUInt32_t specification) : fSpecification(specification) {}
     AliHLTComponentBlockDataSpecification(const AliHLTComponentBlockDataSpecification& src) : fSpecification(src.fSpecification) {}
+    AliHLTComponentBlockDataSpecification& operator=(const AliHLTComponentBlockDataSpecification& src) {
+      if (this==&src) return *this;
+      fSpecification=src.fSpecification; return *this;
+    }
     bool operator==(const AliHLTComponentBlockData& bd) const {return bd.fSpecification==fSpecification;}
   private:
     AliHLTComponentBlockDataSpecification();
@@ -1889,10 +1899,10 @@ int AliHLTComponent::ProcessEvent( const AliHLTComponentEventData& evtData,
        {
          // We can actually get the event type from the CDH if it is valid.
          // Otherwise just use the specification of the input block.
-         const AliRawDataHeader* cdh;
+         AliHLTCDHWrapper cdh;
          if (ExtractTriggerData(trigData, NULL, NULL, &cdh, NULL) == 0)
          {
-           fEventType = ExtractEventTypeFromCDH(cdh);
+           fEventType = ExtractEventTypeFromCDH(&cdh);
          }
        }
 
@@ -2369,11 +2379,12 @@ AliHLTComponent::AliHLTStopwatchGuard::AliHLTStopwatchGuard(const AliHLTStopwatc
   //
 }
 
-AliHLTComponent::AliHLTStopwatchGuard& AliHLTComponent::AliHLTStopwatchGuard::operator=(const AliHLTStopwatchGuard&)
+AliHLTComponent::AliHLTStopwatchGuard& AliHLTComponent::AliHLTStopwatchGuard::operator=(const AliHLTStopwatchGuard& other)
 {
   //
   // assignment operator not for use
   //
+  if (this==&other) return *this;
   fpStopwatch=NULL;
   fpPrec=NULL;
   return *this;
@@ -2467,10 +2478,11 @@ AliHLTUInt32_t AliHLTComponent::GetRunType() const
   return fpRunDesc->fRunType;
 }
 
+
 AliHLTUInt32_t    AliHLTComponent::GetTimeStamp() const
 {
   // see header file for function documentation
-  if (fCurrentEventData.fEventCreation_s) {
+  if (fCurrentEventData.fEventCreation_s < kMaxUInt ) { 
     return  fCurrentEventData.fEventCreation_s;
   }
   // using the actual UTC if the time stamp was not set by the framework
@@ -2659,7 +2671,7 @@ int AliHLTComponent::ExtractTriggerData(
     const AliHLTComponentTriggerData& trigData,
     const AliHLTUInt8_t (**attributes)[gkAliHLTBlockDAttributeCount],
     AliHLTUInt64_t* status,
-    const AliRawDataHeader** cdh,
+    AliHLTCDHWrapper* const cdh,
     AliHLTReadoutList* readoutlist,
     bool printErrors
   )
@@ -2704,15 +2716,15 @@ int AliHLTComponent::ExtractTriggerData(
   AliHLTEventTriggerData* evtData = reinterpret_cast<AliHLTEventTriggerData*>(trigData.fData);
   assert(evtData != NULL);
   
-  // Check that the CDH has 8 words.
-  if (cdh != NULL and evtData->fCommonHeaderWordCnt != 8)
+  // Check that the CDH has the right number of words.
+  if (cdh != NULL and evtData->fCommonHeaderWordCnt != gkAliHLTCommonHeaderCount)
   {
     if (printErrors)
     {
       AliHLTLogging log;
       log.LoggingVarargs(kHLTLogError, Class_Name(), FUNCTIONNAME(), __FILE__, __LINE__,
           "Common Data Header (CDH) has wrong number of data words: %d but expected %d",
-          evtData->fCommonHeaderWordCnt, sizeof(AliRawDataHeader)/sizeof(AliHLTUInt32_t)
+          evtData->fCommonHeaderWordCnt, gkAliHLTCommonHeaderCount
         );
     }
     return -EBADMSG;
@@ -2745,8 +2757,7 @@ int AliHLTComponent::ExtractTriggerData(
   }
   if (cdh != NULL)
   {
-    const AliRawDataHeader* cdhptr = reinterpret_cast<const AliRawDataHeader*>(&evtData->fCommonHeader[0]);
-    *cdh = cdhptr;
+    *cdh = &(evtData->fCommonHeader[0]);
   }
   if (readoutlist != NULL)
   {
@@ -2755,10 +2766,9 @@ int AliHLTComponent::ExtractTriggerData(
   return 0;
 }
 
-AliHLTUInt32_t AliHLTComponent::ExtractEventTypeFromCDH(const AliRawDataHeader* cdh)
+AliHLTUInt32_t AliHLTComponent::ExtractEventTypeFromCDH(const AliHLTCDHWrapper* const cdh)
 {
   // see header file for function documentation
-  
   UChar_t l1msg = cdh->GetL1TriggerMessage();
   if ((l1msg & 0x1) == 0x0) return gkAliEventTypeData;
   // The L2SwC bit must be one if we got here, i.e. l1msg & 0x1 == 0x1.