]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONPedestalSubprocessor.cxx
Removing validation stage, which will probably be handled in the online DA (Laurent)
[u/mrichter/AliRoot.git] / MUON / AliMUONPedestalSubprocessor.cxx
index b2eaf59e1faf1799b44803f4ce597b61fec94551..43135bcc5b2c5c376245835b79a768ac5ecab08e 100644 (file)
@@ -25,7 +25,6 @@
 #include "AliCDBMetaData.h"
 #include "AliLog.h"
 #include "AliMUON2DMap.h"
-#include "AliMUON2DStoreValidator.h"
 #include "AliMUONCalibParam2F.h"
 #include "AliMUONConstants.h"
 #include "AliMUONObjectPair.h"
@@ -80,21 +79,34 @@ AliMUONPedestalSubprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endT
   delete fPedestals;
   fPedestals = new AliMUON2DMap(kTRUE);
   
-  AliInfo(Form("Reading pedestal files for Run %d startTime %ld endTime %ld",
-               run,startTime,endTime));
+  Master()->Log(Form("Reading pedestal files for Run %d startTime %ld endTime %ld",
+                     run,startTime,endTime));
   
   TList* sources = Master()->GetFileSources(kSystem,kId);
   TIter next(sources);
   TObjString* o(0x0);
+  Int_t n(0);
+  
   while ( ( o = static_cast<TObjString*>(next()) ) )
   {
     TString fileName(Master()->GetFile(kSystem,kId,o->GetName()));
-    Bool_t ok = ReadFile(fileName.Data());
+    Int_t ok = ReadFile(fileName.Data());
     if (!ok)
     {
-      AliError(Form("Could not read file %s",fileName.Data()));
+      Master()->Log(Form("Could not read file %s",fileName.Data()));
+    }
+    else
+    {
+      n += ok;
     }
   }
+  
+  if (!n)
+  {
+    Master()->Log("Failed to read any pedestals");
+    delete fPedestals;
+    fPedestals = 0;
+  }
   delete sources;
 }
 
@@ -105,33 +117,22 @@ AliMUONPedestalSubprocessor::Process(TMap* /*dcsAliasMap*/)
   // Store the pedestals into the CDB
   
   if (!fPedestals) return 0;
-  
-  AliInfo("Validating pedestals");
-  AliMUON2DStoreValidator validator;
-  TObjArray* missing =
-    validator.Validate(*fPedestals,AliMUONCalibParam2F::InvalidFloatValue());  
-  
-  if (missing)  
-  {
-    validator.Report(*missing);
-//    AliError("Will not write into CDB as some pieces are missing...");
-//    return 0;
-  }
-  
-  AliInfo("Storing pedestals");
+    
+  Master()->Log("Storing pedestals");
   
   AliCDBMetaData metaData;
        metaData.SetBeamPeriod(0);
        metaData.SetResponsible("MUON TRK");
        metaData.SetComment("Computed by AliMUONPedestalSubprocessor $Id$");
   
-       UInt_t result = Master()->Store("Calib", "Pedestals", fPedestals, &metaData, 0, 0);
+  Bool_t validToInfinity = kTRUE;
+       UInt_t result = Master()->Store("Calib", "Pedestals", fPedestals, &metaData, 0, validToInfinity);
   
   return result;  
 }
 
 //_____________________________________________________________________________
-Bool_t
+Int_t
 AliMUONPedestalSubprocessor::ReadFile(const char* filename)
 {
   // Read the pedestals from an ASCII file.
@@ -143,16 +144,21 @@ AliMUONPedestalSubprocessor::ReadFile(const char* filename)
   // Return kFALSE if reading was not successfull.
   //
   
-  AliInfo(Form("Reading %s",filename));
+  TString sFilename(gSystem->ExpandPathName(filename));
   
-  std::ifstream in(gSystem->ExpandPathName(filename));
-  if (!in.good()) return kFALSE;
+  Master()->Log(Form("Reading %s",sFilename.Data()));
   
+  std::ifstream in(sFilename.Data());
+  if (!in.good()) 
+  {
+    return 0;
+  }
   char line[80];
   Int_t busPatchID, manuID, manuChannel;
   Float_t pedMean, pedSigma;
   static const Int_t kNchannels(64);
   static Bool_t replace(kFALSE);
+  Int_t n(0);
   
   while ( in.getline(line,80) )
   {
@@ -173,9 +179,10 @@ AliMUONPedestalSubprocessor::ReadFile(const char* filename)
     }
     ped->SetValueAsFloat(manuChannel,0,pedMean);
     ped->SetValueAsFloat(manuChannel,1,pedSigma);
+    ++n;
   }
   in.close();
-  return kTRUE;
+  return n;
 }