]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDPreprocessor.cxx
exit loop when in external control
[u/mrichter/AliRoot.git] / FMD / AliFMDPreprocessor.cxx
index 9d50b4bf215e36c59a258589ef248b1cc2697e35..98654f22e94702eb18279ddc9030ee4311705220 100644 (file)
@@ -115,7 +115,7 @@ Bool_t AliFMDPreprocessor::GetAndCheckFileSources(TList*&     list,
     case kDCS: sys = "DCS";     break;
     default:   sys = "unknown"; break;
     }
-    Log(Form("Failed to get file sources for %s/%s", sys.Data(), system));
+    Log(Form("Failed to get file sources for %s/%d", sys.Data(), system));
     return kFALSE;
   }
   return kTRUE;
@@ -281,7 +281,7 @@ AliFMDPreprocessor::GetInfoCalibration(TList* files,
   
 //____________________________________________________________________
 AliFMDCalibPedestal* 
-AliFMDPreprocessor::GetPedestalCalibration(TList* pedFiles)
+AliFMDPreprocessor::GetPedestalCalibration(const TList* pedFiles)
 {
   // Read DAQ DA produced CSV files of pedestals, and return a
   // calibration object. 
@@ -298,33 +298,35 @@ AliFMDPreprocessor::GetPedestalCalibration(TList* pedFiles)
   TObjString*          fileSource;
   
   while((fileSource = dynamic_cast<TObjString*>(iter.Next()))) {
-    const Char_t* filename = GetFile(kDAQ, pars->GetPedestalShuttleID(), fileSource->GetName());
+    const Char_t* filename = GetFile(kDAQ, pars->GetPedestalShuttleID(), 
+                                    fileSource->GetName());
     std::ifstream in(filename);
     if(!in) {
       Log(Form("File %s not found!", filename));
       continue;
     }
-
-    // Get header (how long is it ?)
-    TString header;
-    header.ReadLine(in);
-    header.ToLower();
-    if(!header.Contains(pars->GetPedestalShuttleID())) {
-      Log("File header is not from pedestal!");
-      continue;
-    }
-    Log("File contains data from pedestals");
-    
-    // Read columns line
-    int lineno = 2;
-    header.ReadLine(in);
-    
     // Loop until EOF
-    while(in.peek()!=EOF) {
+    int lineno = 0;
+    char cc;
+    while((cc = in.peek())!=EOF) {
       if(in.bad()) { 
        Log(Form("Bad read at line %d in %s", lineno, filename));
        break;
       }
+      if (cc == '#') { 
+       TString line;
+       line.ReadLine(in);
+       lineno++;
+       if (lineno == 1) {
+         line.ToLower();
+         if(!line.Contains(pars->GetPedestalShuttleID())) {
+           Log(Form("File header is not from pedestal!: %s", line.Data()));
+           break;
+         }
+         Log("File contains data from pedestals");
+       }
+       continue;
+      }
       UShort_t det, sec, strip;
       Char_t ring;
       Float_t ped, noise, mu, sigma, chi2ndf;
@@ -362,7 +364,7 @@ AliFMDPreprocessor::GetPedestalCalibration(TList* pedFiles)
 
 //____________________________________________________________________
 AliFMDCalibGain* 
-AliFMDPreprocessor::GetGainCalibration(TList* gainFiles)
+AliFMDPreprocessor::GetGainCalibration(const TList* gainFiles)
 {
   // Read DAQ DA produced CSV files of pedestals, and return a
   // calibration object. 
@@ -378,32 +380,34 @@ AliFMDPreprocessor::GetGainCalibration(TList* gainFiles)
   TIter             iter(gainFiles);
   TObjString*       fileSource;
   while((fileSource = dynamic_cast<TObjString *>(iter.Next()))) {
-    const Char_t* filename = GetFile(kDAQ, pars->GetGainShuttleID(), fileSource->GetName());
+    const Char_t* filename = GetFile(kDAQ, pars->GetGainShuttleID(), 
+                                    fileSource->GetName());
     std::ifstream in(filename);
     if(!in) {
       Log(Form("File %s not found!", filename));
       continue;
     }
-
-    //Get header (how long is it ?)
-    TString header;
-    header.ReadLine(in);
-    header.ToLower();
-    if(!header.Contains(pars->GetGainShuttleID())) {
-      Log("File header is not from gain!");
-      continue;
-    }
-    Log("File contains data from pulse gain");
-
-    // Read column headers
-    header.ReadLine(in);
-
-    int lineno  = 2;
-    // Read until EOF 
-    while(in.peek()!=EOF) {
-      if(in.bad()) { 
-       Log(Form("Bad read at line %d in %s", lineno, filename));
-       break;
+    // Loop until EOF                                                                                                                                   
+    int lineno = 0;
+    char cc;
+    while((cc = in.peek())!=EOF) {
+      if(in.bad()) {
+        Log(Form("Bad read at line %d in %s", lineno, filename));
+        break;
+      }
+      if (cc == '#') {
+        TString line;
+        line.ReadLine(in);
+        lineno++;
+        if (lineno == 1) {
+          line.ToLower();
+          if(!line.Contains(pars->GetGainShuttleID())) {
+            Log(Form("File header is not from gains!: %s", line.Data()));
+            break;
+          }
+          Log("File contains data from gains");
+        }
+       continue;
       }
       UShort_t det, sec, strip;
       Char_t ring;