]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFPreprocessor.cxx
correct check of upper limit in index array
[u/mrichter/AliRoot.git] / TOF / AliTOFPreprocessor.cxx
index 8506b65587162715d2555dfae2ab71cb146b9dc8..7611488adb6942178c242be191fd25f910b11186 100644 (file)
@@ -169,11 +169,9 @@ UInt_t AliTOFPreprocessor::ProcessDCSDataPoints(TMap *dcsAliasMap)
 
   // processing DCS
 
-  fData->SetFDRFlag(fFDRFlag);
-  
   if (!dcsAliasMap){
     Log("No DCS map found: TOF exiting from Shuttle");
-    if (fData){
+    if (fData) {
            delete fData;
            fData = 0;
     }
@@ -181,11 +179,18 @@ UInt_t AliTOFPreprocessor::ProcessDCSDataPoints(TMap *dcsAliasMap)
   }
   else {
 
-  // The processing of the DCS input data is forwarded to AliTOFDataDCS
+    if (!fData) {
+       Log("No DCSdata map initialized: TOF exiting from Shuttle");
+       return 0;// return error Code for DCS data map not initialized
+    }
+
+    fData->SetFDRFlag(fFDRFlag);
+  
+    // The processing of the DCS input data is forwarded to AliTOFDataDCS
     resultDCSMap=fData->ProcessData(*dcsAliasMap);
     if(!resultDCSMap){
       Log("Some problems occurred while processing DCS data, TOF exiting from Shuttle");
-      if (fData){
+      if (fData) {
              delete fData;
              fData = 0;
       }
@@ -236,8 +241,6 @@ UInt_t AliTOFPreprocessor::ProcessHVandLVdps(TMap *dcsAliasMap)
 
   // processing DCS HV and LV data points
 
-  fHVLVmaps->SetFDRFlag(fFDRFlag);
-  
   if (!dcsAliasMap){
     Log("No DCS map found: TOF exiting from Shuttle");
     if (fHVLVmaps){
@@ -248,8 +251,15 @@ UInt_t AliTOFPreprocessor::ProcessHVandLVdps(TMap *dcsAliasMap)
   }
   else {
 
+    if (!fHVLVmaps) {
+       Log("No HVLVdata map initialized: TOF exiting from Shuttle");
+       return 200;// return error Code for HVLV data map not initialized
+    }
+
+    fHVLVmaps->SetFDRFlag(fFDRFlag);
+  
     // The processing of the DCS input data is forwarded to AliTOFDataDCS
-    //if (0) { // AdC
     resultDCSMap = fHVLVmaps->ProcessData(*dcsAliasMap);
     if (!resultDCSMap) {
       Log("Some problems occurred while processing DCS data, TOF exiting from Shuttle");
@@ -335,7 +345,7 @@ UInt_t AliTOFPreprocessor::ProcessHVandLVdps(TMap *dcsAliasMap)
       */
 
     }
-    //} // AdC
+
   }
 
 
@@ -562,7 +572,11 @@ UInt_t AliTOFPreprocessor::ProcessOnlineDelays()
                  AliInfo("The following sources produced files with the id DELAYS");
                  listTot->Print();
                  for (Int_t jj=0;jj<listTot->GetEntries();jj++){
-                         TObjString * str = dynamic_cast<TObjString*> (listTot->At(jj));
+                   TObjString * str = dynamic_cast<TObjString*> (listTot->At(jj));
+                   if (!str) {
+                     AliError("dynamic_cast returned NULL");
+                                   return 4;
+                         }
                          AliInfo(Form("found source %s", str->String().Data()));
                          
                          // file with summed histos, to extract calib params
@@ -750,6 +764,21 @@ AliTOFPreprocessor::ProcessT0Fill()
   /* get params from OCDB */
   AliCDBEntry *cdbe = NULL;
 
+  /*
+   * check UseLHCClockPhase flag in RunParams.
+   * if set do nothing and return successfully
+   */
+  cdbe = GetFromOCDB("Calib", "RunParams");
+  if (!cdbe) {
+    Log("cannot get \"RunParams\" entry from OCDB");
+    return 21;
+  }
+  AliTOFRunParams *runparams = (AliTOFRunParams *)cdbe->GetObject();
+  if (runparams->GetUseLHCClockPhase()) {
+    Log("UseLHCClockPhase flag is set in RunParams: online T0-fill not computed");
+    return 0;
+  }
+
   /* 
    * at this stage status object is not on OCDB yet
    * since it will be stored later. nevertheless we
@@ -946,6 +975,7 @@ AliTOFPreprocessor::ProcessT0Fill()
   runParamsObject->SetT0(t0);
   runParamsObject->SetTOFResolution(tofReso);
   runParamsObject->SetT0Spread(t0Spread);
+  runParamsObject->SetUseLHCClockPhase(kFALSE);
 
   /* store reference data */
   if(fStoreRefData){