ALIROOT-5433 Transition to CDHv3 in HLT
[u/mrichter/AliRoot.git] / HLT / rec / AliHLTMiscImplementation.cxx
index fa36a0b..dc90047 100644 (file)
@@ -217,14 +217,20 @@ int AliHLTMiscImplementation::InitMagneticField() const
   return -ENOENT;
 }
 
-AliHLTUInt64_t AliHLTMiscImplementation::GetTriggerMask(AliRawReader* rawReader) const
+AliHLTTriggerMask_t AliHLTMiscImplementation::GetTriggerMask(AliRawReader* rawReader) const
 {
   // see header file for function documentation
   if (!rawReader) return 0;
-  AliHLTUInt64_t trgMask=0;
+  AliHLTTriggerMask_t trgMask=0;
   if (rawReader) {
     const UInt_t* pattern=rawReader->GetTriggerPattern();
-    trgMask=pattern[1]&0xfffffff; // 28 upper bits of the 50 bit mask
+    if(rawReader->GetVersion()==3){
+      trgMask=pattern[3];
+      trgMask<<=32;
+      trgMask|=pattern[2];
+      trgMask<<=32;
+    }
+    trgMask|=pattern[1];
     trgMask<<=32;
     trgMask|=pattern[0]; // 32 lower bits of the mask
   }
@@ -246,7 +252,33 @@ AliHLTUInt32_t AliHLTMiscImplementation::GetEventType(AliRawReader* rawReader) c
   if (!rawReader) return 0;
   const AliRawEventHeaderBase* eventHeader = rawReader->GetEventHeader();
   if (!eventHeader) return 0;
-  return eventHeader->Get("Type");
+  UInt_t daqType = eventHeader->Get("Type");
+  switch(daqType){
+  case AliRawEventHeaderBase::kStartOfRun:
+  case AliRawEventHeaderBase::kStartOfData:
+    return gkAliEventTypeStartOfRun;
+
+  case AliRawEventHeaderBase::kEndOfRun:
+  case AliRawEventHeaderBase::kEndOfData:
+    return gkAliEventTypeEndOfRun;
+
+  case AliRawEventHeaderBase::kPhysicsEvent:
+    return gkAliEventTypeData;
+
+  case AliRawEventHeaderBase::kCalibrationEvent:
+    return gkAliEventTypeCalibration;
+
+  case AliRawEventHeaderBase::kFormatError:
+    return gkAliEventTypeCorruptID;
+
+  case AliRawEventHeaderBase::kSystemSoftwareTriggerEvent:
+  case AliRawEventHeaderBase::kDetectorSoftwareTriggerEvent:
+    return gkAliEventTypeSoftware;
+
+    // TODO: Sync Event Type not implemented!
+    //case AliRawEventHeaderBase::kSyncEvent:
+  }
+  return gkAliEventTypeUnknown;
 }
 
 const char* AliHLTMiscImplementation::GetBeamTypeFromGRP() const
@@ -337,7 +369,7 @@ int AliHLTMiscImplementation::InitStreamerInfos(TObjArray* pSchemas) const
            AliDebug(0,Form("skipping schema definition %d version %d to class %s as this is the native version", i, version, pSchema->GetName()));
            continue;
          }
-         TObjArray* pInfos=pClass->GetStreamerInfos();
+         TObjArray* pInfos=const_cast<TObjArray*>(pClass->GetStreamerInfos());
          if (pInfos /*&& version<pInfos->GetEntriesFast()*/) {
            if (pInfos->At(version)==NULL) {
              TStreamerInfo* pClone=(TStreamerInfo*)pSchema->Clone();