]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDInput.cxx
less log
[u/mrichter/AliRoot.git] / FMD / AliFMDInput.cxx
index a8056824c602dc61db4f8b120685fd8a9d6ea816..20b759b61c9095a826e1895f31e9a3d7e5622597 100644 (file)
@@ -37,6 +37,7 @@
 #include "AliRawReaderFile.h"   // ALIRAWREADERFILE_H
 #include "AliRawReaderRoot.h"   // ALIRAWREADERROOT_H
 #include "AliRawReaderDate.h"   // ALIRAWREADERDATE_H
+#include "AliRawEventHeaderBase.h" 
 #include "AliFMD.h"             // ALIFMD_H
 #include "AliFMDHit.h"         // ALIFMDHIT_H
 #include "AliFMDDigit.h"       // ALIFMDDigit_H
@@ -161,7 +162,8 @@ Int_t
 AliFMDInput::NEvents() const 
 {
   // Get number of events
-  if (TESTBIT(fTreeMask, kRaw)) return fReader->GetNumberOfEvents();
+  if (TESTBIT(fTreeMask, kRaw) || 
+      TESTBIT(fTreeMask, kRawCalib)) return fReader->GetNumberOfEvents();
   if (fChainE) return fChainE->GetEntriesFast();
   if (fTreeE) return fTreeE->GetEntries();
   return -1;
@@ -187,6 +189,7 @@ AliFMDInput::Init()
        "\tRecPoints:     %d\n"
        "\tESD:           %d\n"
        "\tRaw:           %d\n"
+       "\tRawCalib:      %d\n"
        "\tGeometry:      %d\n"
        "\tTracks:        %d\n"
        "\tTracksRefs:    %d",
@@ -199,6 +202,7 @@ AliFMDInput::Init()
        TESTBIT(fTreeMask, kRecPoints),
        TESTBIT(fTreeMask, kESD),
        TESTBIT(fTreeMask, kRaw),
+       TESTBIT(fTreeMask, kRawCalib),
        TESTBIT(fTreeMask, kGeometry),
        TESTBIT(fTreeMask, kTracks),
        TESTBIT(fTreeMask, kTrackRefs));
@@ -267,7 +271,8 @@ AliFMDInput::Init()
     
   }
     
-  if (TESTBIT(fTreeMask, kRaw)) {
+  if (TESTBIT(fTreeMask, kRaw) || 
+      TESTBIT(fTreeMask, kRawCalib)) {
     AliInfo("Getting FMD raw data digits");
     fArrayA = new TClonesArray("AliFMDDigit");
 #if 0
@@ -436,9 +441,22 @@ AliFMDInput::Begin(Int_t event)
   }
 
   // Possibly load FMD Digit information 
-  if (TESTBIT(fTreeMask, kRaw)) {
+  if (TESTBIT(fTreeMask, kRaw) || TESTBIT(fTreeMask, kRawCalib)) {
     // AliInfo("Getting FMD raw data digits");
-    if (!fReader->NextEvent()) return kFALSE;
+    std::cout << "Waiting for event ..." << std::endl;
+    do { 
+      if (!fReader->NextEvent()) { 
+       if (fRawFile.Contains("mem://")) { 
+         gSystem->Sleep(3);
+         continue;
+       }
+       return kFALSE;
+      }
+      UInt_t eventType = fReader->GetType();
+      if(eventType == AliRawEventHeaderBase::kPhysicsEvent ||
+        eventType == AliRawEventHeaderBase::kCalibrationEvent) 
+       break;
+    } while (true);
     // AliFMDRawReader r(fReader, 0);
     fArrayA->Clear();
     fFMDReader->ReadAdcs(fArrayA);
@@ -473,6 +491,8 @@ AliFMDInput::Event()
     if (!ProcessDigits()) return kFALSE;
   if (TESTBIT(fTreeMask, kRaw)) 
     if (!ProcessRawDigits()) return kFALSE;
+  if (TESTBIT(fTreeMask, kRawCalib)) 
+    if (!ProcessRawCalibDigits()) return kFALSE;
   if (TESTBIT(fTreeMask, kRecPoints)) 
     if (!ProcessRecPoints()) return kFALSE;
   if (TESTBIT(fTreeMask, kESD))
@@ -685,6 +705,29 @@ AliFMDInput::ProcessRawDigits()
   return kTRUE;
 }
 
+//____________________________________________________________________
+Bool_t 
+AliFMDInput::ProcessRawCalibDigits()
+{
+  // Read the digit tree, and pass each digit to the member function
+  // ProcessDigit.
+  if (!fArrayA) {
+    AliError("No raw digit array defined");
+    return kFALSE;
+  }
+
+  Int_t nDigit = fArrayA->GetEntries();
+  if (nDigit <= 0) return kTRUE;
+  for (Int_t j = 0; j < nDigit; j++) {
+    AliFMDDigit* digit = static_cast<AliFMDDigit*>(fArrayA->At(j));
+    if (!digit) continue;
+    if (AliLog::GetDebugLevel("FMD","") >= 40 && j < 30) 
+      digit->Print();
+    if (!ProcessRawCalibDigit(digit)) return kFALSE;
+  }    
+  return kTRUE;
+}
+
 //____________________________________________________________________
 Bool_t 
 AliFMDInput::ProcessRecPoints()