]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliRawReader.cxx
New IsRawReaderValid() method which returns false in case the raw-data file, chain...
[u/mrichter/AliRoot.git] / RAW / AliRawReader.cxx
index fc7cb3e927061f1d08d74cbab2f43db23964acc8..f00be9863e915b30b2f3a31d92a913998c4ae7a9 100644 (file)
@@ -67,7 +67,8 @@ AliRawReader::AliRawReader() :
   fErrorCode(0),
   fEventNumber(-1),
   fErrorLogs("AliRawDataErrorLog",100),
-  fHeaderSwapped(NULL)
+  fHeaderSwapped(NULL),
+  fIsValid(kTRUE)
 {
 // default constructor: initialize data members
 // Allocate the swapped header in case of Mac
@@ -124,7 +125,8 @@ AliRawReader::AliRawReader(const AliRawReader& rawReader) :
   fErrorCode(0),
   fEventNumber(-1),
   fErrorLogs("AliRawDataErrorLog",100),
-  fHeaderSwapped(NULL)
+  fHeaderSwapped(NULL),
+  fIsValid(rawReader.fIsValid)
 {
 // copy constructor
 // Allocate the swapped header in case of Mac
@@ -154,6 +156,8 @@ AliRawReader& AliRawReader::operator = (const AliRawReader& rawReader)
   fEventNumber = rawReader.fEventNumber;
   fErrorLogs = *((TClonesArray*)rawReader.fErrorLogs.Clone());
 
+  fIsValid = rawReader.fIsValid;
+
   return *this;
 }
 
@@ -226,6 +230,14 @@ AliRawReader* AliRawReader::Create(const char *uri)
     }
   }
 
+  if (!rawReader->IsRawReaderValid()) {
+    AliErrorClass(Form("Raw-reader is invalid - check the input URI (%s)",fileURI.Data()));
+    delete rawReader;
+    fields->Delete();
+    delete fields;
+    return NULL;
+  }
+
   // Now apply event selection criteria (if specified)
   if (fields->GetEntries() > 1) {
     Int_t eventType = -1;