]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - VZERO/VZEROPbPbda.cxx
Bring PIPEupgrade naming conventions in acc. with ITSU expectations
[u/mrichter/AliRoot.git] / VZERO / VZEROPbPbda.cxx
index 4f3086459c2dd4fb43f492ced566b61f2af88b65..191d679c25c77d55b25d163318b8ee80d567405f 100644 (file)
@@ -60,6 +60,7 @@ int main(int argc, char **argv) {
   
 //___________________________________________________
 // Get parameters from V00DAEqualFactors.config file
+  Int_t    neventsMin = 2000;
 
   Int_t    kStartClock = 9;  // First clock in the search for max adc
   Int_t    kEndClock = 11;   // Last clock in the search for max adc
@@ -78,16 +79,16 @@ int main(int argc, char **argv) {
   } else {
     /* open the config file and retrieve cuts */
     FILE *fpConfig = fopen("V00DAEqualFactors.config","r");
-    int res = fscanf(fpConfig,"%d %d %d %d %hhu %d %f",
-                    &kStartClock,&kEndClock,&kNPreClocks,&kNPostClocks,&kNFlagsCut,&kNBins,&kRange);
-    if(res!=7) {
-      printf("Failed to get values from Config file (V00DAEqualFactors.config): wrong file format - 6 integers and 1 float are expected - \n");
+    int res = fscanf(fpConfig,"%d %d %d %d %d %hhu %d %f",
+                    &neventsMin,&kStartClock,&kEndClock,&kNPreClocks,&kNPostClocks,&kNFlagsCut,&kNBins,&kRange);
+    if(res!=8) {
+      printf("Failed to get values from Config file (V00DAEqualFactors.config): wrong file format - 7 integers and 1 float are expected - \n");
     }
     fclose(fpConfig);
   }
   
-  printf("First LHC Clock = %d; Last LHC Clock = %d; N Pre Clock = %d ; N Post Clock = %d; Minimum number of TDC flags = %hhu; Number of histogram bins = %d; Histogram range = %.3f\n",
-        kStartClock, kEndClock, kNPreClocks, kNPostClocks, kNFlagsCut, kNBins, kRange);
+  printf("Minimum number of events to process = %d; First LHC Clock = %d; Last LHC Clock = %d; N Pre Clock = %d; N Post Clock = %d; Minimum number of TDC flags = %hhu; Number of histogram bins = %d; Histogram range = %.3f\n",
+        neventsMin,kStartClock, kEndClock, kNPreClocks, kNPostClocks, kNFlagsCut, kNBins, kRange);
 
   TH1D *fMedian[64];
   for(Int_t j = 0; j < 64; ++j) fMedian[j] = new TH1D(Form("fMedian_%d",j),"Slopes weighted median, channel par channel",kNBins,0,kRange);
@@ -118,6 +119,7 @@ int main(int argc, char **argv) {
   monitorSetNoWaitNetworkTimeout(1000);
   
   /* init counters on events */
+  int neventsPhysicsAll=0;
   int neventsPhysics=0;
   int neventsTotal=0;
 
@@ -163,6 +165,7 @@ int main(int argc, char **argv) {
   
           AliVZERORawStream* rawStream  = new AliVZERORawStream(rawReader); 
           if (rawStream->Next()) {     
+            neventsPhysicsAll++;
             UShort_t triggers = rawStream->GetTriggerInputs();
             UChar_t nFlags = 0;
             for(Int_t i = 0; i < 64; ++i) {
@@ -234,13 +237,13 @@ int main(int argc, char **argv) {
 
   }  // loop over events
   
-  printf("%d physics events processed\n",neventsPhysics);
+  printf("%d physics events processed (out of %d physics and %d total events)\n",neventsPhysics,neventsPhysicsAll,neventsTotal);
     
 //___________________________________________________________________________
 //  Computes regression parameters
 // charge_i = p0 + charge_tot * p1
 
-  if(neventsPhysics>2000){
+  if(neventsPhysics>neventsMin){
     /* open result file to be exported to FES */
     FILE *fp=NULL;
     fp=fopen("./V0_EqualizationFactors.dat","w");
@@ -253,27 +256,38 @@ int main(int argc, char **argv) {
     for(int i = 0; i < 64; ++i) fMedian[i]->GetQuantiles(1,&beta[i],&q);
 
     for(Int_t i=0; i<64; i++) {
-      fprintf(fp," %d %.3f\n",GetOfflineChannel(i), beta[i]*64.);                                     
-      printf(" %d %.3f\n",GetOfflineChannel(i), beta[i]*64.);                                 
+      fprintf(fp," %d %.5f\n",GetOfflineChannel(i), beta[i]*64.);                                     
+      printf(" %d %.5f\n",GetOfflineChannel(i), beta[i]*64.);                                 
     }
 
     /* close local result file and FXS result file*/
     fclose(fp);
-  }
-
-//________________________________________________________________________
    
-  /* export result file to FES */
-  status=daqDA_FES_storeFile("./V0_EqualizationFactors.dat","V00DAEqualFactors");
-  if (status)    {
-    printf("Failed to export file : %d\n",status);
-    return -1; }
-
-  /* store result file into Online DB */
-  status=daqDA_DB_storeFile("./V0_EqualizationFactors.dat","V00DAEqualFactors");
-  if (status)    {
-    printf("Failed to store file into Online DB: %d\n",status);
-    return -1; }
+    /* export result file to FES */
+    status=daqDA_FES_storeFile("./V0_EqualizationFactors.dat","V00DAEqualFactors");
+    if (status)    {
+      printf("Failed to export file : %d\n",status);
+      return -1; }
+
+    /* store result file into Online DB */
+    status=daqDA_DB_storeFile("./V0_EqualizationFactors.dat","V00DAEqualFactors");
+    if (status)    {
+      printf("Failed to store file into Online DB: %d\n",status);
+      return -1; }
+  }
+  else {
+    // Take the last run's file from the DB
+    status=daqDA_DB_getFile("V00DAEqualFactors","./V0_EqualizationFactors.dat");
+    if (status)    {
+      printf("Failed to get file from Online DB: %d\n",status);
+      return -1; }
+
+    /* export result file to FES */
+    status=daqDA_FES_storeFile("./V0_EqualizationFactors.dat","V00DAEqualFactors");
+    if (status)    {
+      printf("Failed to export file : %d\n",status);
+      return -1; }
+  }
 
   return status;
 }