]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/alirawdump_main.cxx
Adding the functionality to check the consistency of the CDHs
[u/mrichter/AliRoot.git] / RAW / alirawdump_main.cxx
index f276b8daf01ab41798345bab6560bb84400c4388..d5c7e236e7c4ebe0d64d9e3985300d6a4e92a745 100644 (file)
@@ -58,6 +58,24 @@ static bool DumpCDH(AliRawDataHeader *cdh)
   return true;
 }
 
+//______________________________________________________________________________
+static bool CheckCDH(AliRawDataHeader *cdhRef,AliRawDataHeader *cdh)
+{
+  // Check the consistency of the CDHs
+  // ...
+  if ((cdhRef->GetEventID1() != cdh->GetEventID1()) ||
+      (cdhRef->GetVersion() != cdh->GetVersion()) ||
+      (cdhRef->GetEventID2() != cdh->GetEventID2()) ||
+      (cdhRef->GetMiniEventID() != cdh->GetMiniEventID()) ||
+      (cdhRef->GetTriggerClasses() != cdh->GetTriggerClasses())) {
+    cout << "CDH mismatch detected:" << endl;
+    DumpCDH(cdhRef);
+    DumpCDH(cdh);
+    return false;
+  }
+  return true;
+}
+
 //______________________________________________________________________________
 static bool DumpEvent(const char *progname, AliRawEvent *rawEvent)
 {
@@ -73,6 +91,8 @@ static bool DumpEvent(const char *progname, AliRawEvent *rawEvent)
   cout << "  *********** Event header ***********" << endl;
   rawEventHeader->Print();
 
+  AliRawDataHeader *cdhRef = NULL;
+
   for(Int_t iSubEvent=0; iSubEvent < rawEvent->GetNSubEvents(); iSubEvent++) {
     AliRawEvent *rawSubEvent = rawEvent->GetSubEvent(iSubEvent);
     AliRawEventHeaderBase *rawSubEventHeader = rawSubEvent->GetHeader();
@@ -88,6 +108,13 @@ static bool DumpEvent(const char *progname, AliRawEvent *rawEvent)
       AliRawData *rawData = rawEquip->GetRawData();
       AliRawDataHeader *cdh = (AliRawDataHeader*)rawData->GetBuffer();
       if (!DumpCDH(cdh)) return false;
+      // check the CDH consistency
+      if (cdhRef == NULL) {
+       cdhRef = cdh;
+      }
+      else {
+       if (!CheckCDH(cdhRef,cdh)) return false;
+      }
     }
   }