Deleted file VZEROTUNING1da.cxx
authorcheynis <cheynis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 22 Jul 2008 16:02:56 +0000 (16:02 +0000)
committercheynis <cheynis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 22 Jul 2008 16:02:56 +0000 (16:02 +0000)
VZERO/AliVZEROQAChecker.cxx
VZERO/AliVZEROQAChecker.h
VZERO/VZEROTUNING1da.cxx [deleted file]
VZERO/VZEROTUNING2da.cxx [deleted file]

index 14fa97f..dfd897a 100644 (file)
 #include "AliQA.h"
 #include "AliQAChecker.h"
 #include "AliVZEROQAChecker.h"
+//#include "AliCDBEntry.h"
+//#include "AliCDBManager.h"
 
 ClassImp(AliVZEROQAChecker)
 
 //__________________________________________________________________
+const Double_t AliVZEROQAChecker::Check(AliQA::ALITASK_t index, TObjArray * list) 
+{
+
+// Main check function: Depending on the TASK, different checks will be applied
+// Check for empty histograms 
+
+//   AliDebug(1,Form("AliVZEROChecker"));
+//   AliCDBEntry *QARefRec = AliCDBManager::Instance()->Get("VZERO/QARef/RAW");
+//   if( !QARefRec){
+//     AliInfo("QA reference data NOT retrieved for QA check...");
+//     return 1.;
+//   }
+
+// checking for empty histograms
+
+//   Double_t check = 0.0;
+//   if(CheckEntries(list) == 0)  {
+//      AliWarning(Form("Histograms are empty !"));
+//      check = 0.4;          
+//      return check;
+     
+  if ( index == AliQA::kRAW ) 
+  {
+       printf(" index = %d, Check = %f\n\n", index,CheckEntries(list));
+       return CheckEntries(list);
+  }
+  
+  AliWarning(Form("Checker for task %d not implemented for the moment",index));
+  return 0.0;    
+
+}
+//_________________________________________________________________
+Double_t AliVZEROQAChecker::CheckEntries(TObjArray * list) const
+{
+  
+  //  check on the QA histograms on the input list: 
+   
+
+  Double_t test = 0.0  ;
+  Int_t   count = 0 ; 
+  printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); 
+  printf(" Number of entries = %d \n", list->GetEntries() );
+   
+  if (list->GetEntries() == 0){  
+      test = 1.0; 
+      AliInfo(Form("There are no entries to be checked..."));
+  }
+  else {
+      TIter next(list) ; 
+      TH1 * hdata ;
+      count = 0 ; 
+      while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
+        if (hdata) { 
+         Double_t rv = 0.0;
+          Printf("Histogram %s     has entries: %f ",hdata->GetName(),hdata->GetEntries());
+         if(hdata->GetEntries()>0)rv=1.0; 
+         count++ ; 
+         test += rv ; 
+         printf(" count = %d, rv = %f \n", count,rv);
+        }
+        else{
+         AliError(Form("Data type cannot be processed"));
+        }      
+      }
+      if (count != 0) { 
+        if (test==0.0) {
+           AliInfo(Form("Histograms are booked for THIS specific Task, but they are all empty: setting flag to kWARNING"));
+//         test = 0.0;  //upper limit value to set kWARNING flag for a task
+        }
+        else test = 1.0;
+      }
+  }
+
+  return test ; 
+}  
+//______________________________________________________________________________
+void AliVZEROQAChecker::SetQA(AliQA::ALITASK_t index, const Double_t value) const
+{
+// sets the QA word according the return value of the Check
+
+  AliQA * qa = AliQA::Instance(index);
+  
+  qa->UnSet(AliQA::kFATAL);
+  qa->UnSet(AliQA::kWARNING);
+  qa->UnSet(AliQA::kERROR);
+  qa->UnSet(AliQA::kINFO);
+  
+  if ( value == 1.0 ) 
+  {
+    qa->Set(AliQA::kINFO);
+  }
+  else if ( value == 0.0 )
+  {
+    qa->Set(AliQA::kFATAL);
+  }
+  else if ( value > 0.5 ) 
+  {
+    qa->Set(AliQA::kWARNING);
+  }
+  else
+  {
+    qa->Set(AliQA::kERROR);
+  }
+}
index bce8a7e..cb321aa 100644 (file)
@@ -14,6 +14,7 @@
 class TFile ; 
 class TH1F ; 
 class TH1I ; 
+class TObjArray ; 
 
 // --- Standard library ---
 
@@ -25,10 +26,13 @@ class AliVZEROLoader ;
 class AliVZEROQAChecker: public AliQACheckerBase {
 
 public:
-  AliVZEROQAChecker() : AliQACheckerBase("VZERO","VZERO Quality Assurance Data Maker") {;}          // ctor
+  AliVZEROQAChecker() : AliQACheckerBase("VZERO","VZERO Quality Assurance Data Checker") {;}          // ctor
   AliVZEROQAChecker(const AliVZEROQAChecker& qac) : AliQACheckerBase(qac.GetName(), qac.GetTitle()) {;} // cpy ctor   
   virtual ~AliVZEROQAChecker() {;} // dtor
-
+  virtual const Double_t Check(AliQA::ALITASK_t index, TObjArray * list) ;
+  Double_t CheckEntries(TObjArray * list) const ;
+  virtual void SetQA(AliQA::ALITASK_t index, const Double_t value) const ;
+  
 private:
   
   ClassDef(AliVZEROQAChecker,1)  // description 
diff --git a/VZERO/VZEROTUNING1da.cxx b/VZERO/VZEROTUNING1da.cxx
deleted file mode 100644 (file)
index 79b5917..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
-/*********************************************************************************
-- Contact:    Brigitte Cheynis     b.cheynis@ipnl.in2p3.fr
-- Link:       http
-- Raw data test file : 
-- Reference run number :             
-- Run Type:   CHANNEL_DELAY_TUNING
-- DA Type:    LDC
-- Number of events needed: 500
-- Input Files:  argument list
-- Output Files: local file  V0_ChannelDelayTuning.dat
-                FXS file    V0_ChannelDelayTuning.dat
-- Trigger types used: PHYSICS_EVENT
-**********************************************************************************/
-
-
-/**********************************************************************************
-*                                                                                 *
-* VZERO Detector Algorithm used for tuning FEE parameters                         *
-*                                                                                 *
-* This program reads data on the LDC                                              *
-* It cumulates fBB and fBG flags, populates local "./V0_ChannelDelayTuning.dat"   *            
-* file, exports it to the FES, and stores it to DAQ DB                            *
-* We have 128 channels instead of 64 as expected for V0 due to the two sets of    *
-* charge integrators which are used by the FEE ...                                *
-* The program reports about its processing progress.                              *
-*                                                                                 *
-***********************************************************************************/
-
-// DATE
-#include "event.h"
-#include "monitor.h"
-#include "daqDA.h"
-
-//AliRoot
-#include <AliVZERORawStream.h>
-#include <AliRawReaderDate.h>
-#include <AliRawReader.h>
-#include <AliDAQ.h>
-
-// standard
-#include <stdio.h>
-#include <stdlib.h>
-
-//ROOT
-#include "TROOT.h"
-#include "TPluginManager.h"
-#include <TFile.h>
-#include <TH1F.h>
-#include <TMath.h>
-
-
-/* Main routine --- Arguments: list of DATE raw data files */
-      
-int main(int argc, char **argv) {
-
-/* magic line from Cvetan */
-  gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
-                    "*",
-                    "TStreamerInfo",
-                    "RIO",
-                    "TStreamerInfo()");
-  int status;
-  status = daqDA_DB_getFile("V00da_results","./V0_Ped_Width_Gain.dat");
-  if (status) {
-      printf("Failed to get Pedestal file (V0_Ped_Width_Gain.dat) from DAQ DB, status=%d\n", status);
-      return -1;   
-  }
-  
-  Float_t MeanPed[128], SigPed[128], fdump;
-  
-  /* open the pedestal file and retrieve pedestal mean and sigma */
-  FILE *fpPed = fopen("V0_Ped_Width_Gain.dat","r");
-  for(int i=0;i<128;i++){
-      fscanf(fpPed,"%f %f %f %f \n",&MeanPed[i],&SigPed[i],&fdump,&fdump);
-//      printf("%.3f %.3f \n",MeanPed[i],SigPed[i]);
-  }
-  fclose(fpPed);
-
-//______________________________________________________________________________
-// Get running parameters from V00_ChannelDelayTuning_DA.config file
-
-  Int_t    kNbEventSkipped;   // = 100;   number of events skipped - to be tuned
-  Float_t  kSigmaCut;         // = 3.0;   number of sigmas for threshold cut - to be tuned
-  
-  status = daqDA_DB_getFile("V00_ChannelDelayTuning_DA.config","./V00_ChannelDelayTuning_DA.config");
-  if (status) {
-      printf("Failed to get config file (V00_ChannelDelayTuning_DA.config) from DAQ DB, status=%d\n", status);
-      return -1;   
-  }
-  /* open the config file and retrieve running parameters */
-  FILE *fpConfig = fopen("V00_ChannelDelayTuning_DA.config","r");
-  fscanf(fpConfig,"%f %d",&kSigmaCut,&kNbEventSkipped);
-  fclose(fpConfig);
-  
-  printf("Number of events skipped = %d ; Number of sigmas for threshold cut = %f\n",kNbEventSkipped,kSigmaCut);
-//______________________________________________________________________________
-
-  Int_t BBFlag[64];
-  Int_t BGFlag[64];
-  Int_t ChargeEoI = 0;
-  Bool_t Integrator = 0;
-  Int_t NHit[64];
-  for(Int_t i=0; i<64; i++) {
-      BBFlag[i] = 0;
-      BGFlag[i] = 0;
-      NHit[i] = 0;
-  } 
-      
-  /* log start of process */
-  printf("VZERO DA program started - Channel Delay Tuning \n");  
-
-  /* check that we got some arguments  */
-  if (argc<2)   {
-      printf("Wrong number of arguments\n");
-      return -1;}
-
-  /* open result file to be exported to FES */
-  FILE *fp=NULL;
-  fp=fopen("./V0_ChannelDelayTuning.dat","a");
-  if (fp==NULL) {
-      printf("Failed to open result file\n");
-      return -1;}
-
-  /* open log file to inform user */
-  FILE *flog=NULL;
-  flog=fopen("./V00log.txt","w");
-  if (flog==NULL) {
-      printf("Failed to open log file\n");
-      return -1;  }
-    
-  /* report progress */
-  daqDA_progressReport(10);
-
-  /* init counters on events */
-  int nevents_physics=0;
-  int nevents_total=0;
-  int iteration;
-  sscanf(argv[1],"%d",&iteration);
-  
-  /* read the n data files */
-  for (int n=2; n<argc; n++) {
-  
-  /* read the data  */
-    status=monitorSetDataSource( argv[n] );
-    if (status!=0) {
-        printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
-        return -1; }
-
-  /* report progress */
-    daqDA_progressReport(10+50*n/argc);
-
-  /* read the data file */
-    for(;;) {
-        struct eventHeaderStruct *event;
-        eventTypeType eventT;
-
-        /* get next event */
-        status=monitorGetEventDynamic((void **)&event);
-        if (status==MON_ERR_EOF) break; /* end of monitoring file has been reached */
-        if (status!=0) {
-            printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
-            return -1; }
-
-        /* retry if got no event */
-        if (event==NULL) break;
-        
-        /* decode event */
-        eventT=event->eventType;
-       
-        switch (event->eventType){
-      
-        case START_OF_RUN:
-            printf("START Of Run detected\n");
-             break;
-      
-        case END_OF_RUN:
-            printf("END Of Run detected\n");
-             break;
-      
-        case PHYSICS_EVENT:
-             nevents_physics++;
-
-            AliRawReader *rawReader = new AliRawReaderDate((void*)event);
-  
-            AliVZERORawStream* rawStream  = new AliVZERORawStream(rawReader); 
-            rawStream->Next(); 
-            if(nevents_physics > kNbEventSkipped){
-               for(Int_t i=0; i<64; i++) {
-                   ChargeEoI = rawStream->GetADC(i);
-                   Integrator = rawStream->GetIntegratorFlag(i,10);
-                   Float_t Threshold = MeanPed[i + 64 * Integrator] + kSigmaCut * SigPed[i + 64 * Integrator];
-
-                   if((float)ChargeEoI>Threshold) {
-                       NHit[i]+=1;
-                       if(rawStream->GetBBFlag(i,10)) BBFlag[i]+=1;       
-                       if(rawStream->GetBGFlag(i,10)) BGFlag[i]+=1; 
-                   }            
-               }    
-            }
-             delete rawStream;
-             rawStream = 0x0;      
-             delete rawReader;
-             rawReader = 0x0;                                                                   
-        } // end of switch on event type 
-       
-        nevents_total++;
-        /* free resources */
-        free(event);
-
-    }    // end of loop over events
-  }      // end of loop over data files 
-   
-//________________________________________________________________________
-//  Computes mean values, dumps them into the output text file
-  Float_t fBB, fBG;    
-  for(Int_t i=0; i<64; i++) {      
-      if(NHit[i] > 0) {
-         fBB = (float)BBFlag[i]/(float)NHit[i];
-         fBG = (float)BGFlag[i]/(float)NHit[i];
-       }else{
-        fBB = fBG = 0.;
-       }
-       fprintf(fp," %d %d %f %f\n",iteration,i,fBB,fBG);
-       fprintf(flog," it %d ch %d BB %f BG %f BBFlag %d BGFlag %d Hit %d\n",iteration,i,fBB,fBG,BBFlag[i],BGFlag[i],NHit[i]);
-  } 
-  
-//________________________________________________________________________
-   
-  /* write report */
-  fprintf(flog,"Run #%s, received %d physics events out of %d\n",getenv("DATE_RUN_NUMBER"),nevents_physics,nevents_total);
-  printf("Run #%s, received %d physics events out of %d\n",getenv("DATE_RUN_NUMBER"),nevents_physics,nevents_total);
-  
-  /* close result and log files */
-  fclose(fp);
-  fclose(flog); 
-  
-  /* report progress */
-  daqDA_progressReport(90);
-
-  /* export result file to FES */
-  status=daqDA_FES_storeFile("./V0_ChannelDelayTuning.dat","V00da_ChannelDelayTuning");
-  if (status)    {
-      printf("Failed to export file : %d\n",status);
-      return -1; }
-      
-  /* store result file on Online DB */
-//   status=daqDA_DB_storeFile("./V0_ChannelDelayTuning.dat","V00da_ChannelDelayTuning");
-//   if (status)    {
-//       printf("Failed to store file into Online DB: %d\n",status);
-//       return -1; }
-      
-  /* report progress */
-  daqDA_progressReport(100);
-  
-  return status;
-}
diff --git a/VZERO/VZEROTUNING2da.cxx b/VZERO/VZEROTUNING2da.cxx
deleted file mode 100644 (file)
index 8a5bace..0000000
+++ /dev/null
@@ -1,244 +0,0 @@
-/*********************************************************************************
-- Contact:    Brigitte Cheynis     b.cheynis@ipnl.in2p3.fr
-- Link:       http
-- Raw data test file : 
-- Reference run number :             
-- Run Type:   INTEGRATION_GATE_TUNING (not defined yet)
-- DA Type:    LDC
-- Number of events needed: 500
-- Input Files:  argument list
-- Output Files: local file  V0_IntegrationGateTuning.dat
-                FXS file    V0_IntegrationGateTuning.dat
-- Trigger types used: PHYSICS_EVENT
-**********************************************************************************/
-
-
-/**********************************************************************************
-*                                                                                 *
-* VZERO Detector Algorithm used for tuning Integration Gates                      *
-*                                                                                 *
-* This program reads data on the LDC                                              *
-* It cumulates mean ADC responses ,  populates local                              *
-*                                   "./V0_IntegrationGateTuning.dat"  file        * 
-* and exports it to the FES.                                                      *
-* We have 128 channels instead of 64 as expected for V0 due to the two sets of    *
-* charge integrators which are used by the FEE ...                                *
-* The program reports about its processing progress.                              *
-*                                                                                 *
-***********************************************************************************/
-
-// DATE
-#include "event.h"
-#include "monitor.h"
-#include "daqDA.h"
-
-//AliRoot
-#include <AliVZERORawStream.h>
-#include <AliRawReaderDate.h>
-#include <AliRawReader.h>
-#include <AliDAQ.h>
-
-// standard
-#include <stdio.h>
-#include <stdlib.h>
-
-//ROOT
-#include "TROOT.h"
-#include "TPluginManager.h"
-#include <TFile.h>
-#include <TH1F.h>
-#include <TMath.h>
-
-
-/* Main routine --- Arguments: list of DATE raw data files */
-      
-int main(int argc, char **argv) {
-
-/* magic line from Cvetan */
-  gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
-                    "*",
-                    "TStreamerInfo",
-                    "RIO",
-                    "TStreamerInfo()");
-
-  int status;
-  status = daqDA_DB_getFile("V00da_results","./V0_Ped_Width_Gain.dat");
-  if (status) {
-      printf("Failed to get Pedestal file (V0_Ped_Width_Gain.dat) from DAQ DB, status=%d\n", status);
-      return -1;   
-  }
-  
-  Float_t MeanPed[128], SigPed[128], fdump;
-  
-  /* open the pedestal file and retrieve pedestal mean and sigma */
-  FILE *fpPed = fopen("V0_Ped_Width_Gain.dat","r");
-  for(int i=0;i<128;i++){
-      fscanf(fpPed,"%f %f %f %f \n",&MeanPed[i],&SigPed[i],&fdump,&fdump);
-//      printf("%.3f %.3f \n",MeanPed[i],SigPed[i]);
-  }
-  fclose(fpPed);
-
-//______________________________________________________________________________
-// Get running parameters from V00_ChannelDelayTuning_DA.config file
-
-  Int_t    kNbEventSkipped;   // = 100;   number of events skipped - to be tuned
-  Float_t  kSigmaCut;         // = 3.0;   number of sigmas for threshold cut - to be tuned
-  
-  status = daqDA_DB_getFile("V00_ChannelDelayTuning_DA.config","./V00_ChannelDelayTuning_DA.config");
-  if (status) {
-      printf("Failed to get config file (V00_ChannelDelayTuning_DA.config) from DAQ DB, status=%d\n", status);
-      return -1;   
-  }
-  /* open the config file and retrieve running parameters */
-  FILE *fpConfig = fopen("V00_ChannelDelayTuning_DA.config","r");
-  fscanf(fpConfig,"%f %d",&kSigmaCut,&kNbEventSkipped);
-  fclose(fpConfig);
-  
-  printf("Number of events skipped = %d ; Number of sigmas for threshold cut = %f\n",kNbEventSkipped,kSigmaCut);
-//______________________________________________________________________________
-
-  Float_t ChargeEoI  = 0.0;
-  Bool_t  Integrator = 0;
-  Int_t   NHit[128];
-  Float_t ADC_Mean[128];
-  for(Int_t i=0; i<128; i++) {
-      ADC_Mean[i] = 0.0;
-      NHit[i]     = 0;
-  } 
-       
-  /* log start of process */
-  printf("VZERO Integration_Gate_Tuning DA program started - Tuning Integration Gates\n");  
-
-  /* check that we got some arguments = list of files */
-  if (argc<2)   {
-      printf("Wrong number of arguments\n");
-      return -1;}
-               
-  /* open result file to be exported to FES */
-  FILE *fp=NULL;
-  fp=fopen("./V0_IntegrationGateTuning.dat","a");
-  if (fp==NULL) {
-      printf("Failed to open result file\n");
-      return -1;}
-
-  /* open log file to inform user */
-  FILE *flog=NULL;
-  flog=fopen("./V00log.txt","a");
-  if (flog==NULL) {
-      printf("Failed to open log file\n");
-      return -1;  }
-    
-  /* report progress */
-  daqDA_progressReport(10);
-
-  /* init counters on events */
-  int nevents_physics=0;
-  int nevents_total=0;
-  int iteration;
-  sscanf(argv[1],"%d",&iteration);
-  
-  /* read the n data files */
-  for (int n=2; n<argc; n++) {
-  
-  /* read the data  */
-    status=monitorSetDataSource( argv[n] );
-  if (status!=0) {
-      printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
-      return -1; }
-
-  /* report progress */
-  daqDA_progressReport(10+50*n/argc);
-   
-  /* read the data file */
-    for(;;) {
-        struct eventHeaderStruct *event;
-        eventTypeType eventT;
-
-        /* get next event */
-        status=monitorGetEventDynamic((void **)&event);
-        if (status==MON_ERR_EOF) break; /* end of monitoring file has been reached */
-        if (status!=0) {
-            printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
-            return -1; }
-
-        /* retry if got no event */
-        if (event==NULL) break;
-        
-        /* decode event */
-        eventT=event->eventType;
-       
-        switch (event->eventType){
-      
-        case START_OF_RUN:
-             break;
-      
-        case END_OF_RUN:
-            printf("End Of Run detected\n");
-             break;
-      
-        case PHYSICS_EVENT:
-             nevents_physics++;
-                        
-            AliRawReader *rawReader = new AliRawReaderDate((void*)event);
-  
-            AliVZERORawStream* rawStream  = new AliVZERORawStream(rawReader); 
-            rawStream->Next(); 
-            for(Int_t i=0; i<64; i++) {
-                Integrator = rawStream->GetIntegratorFlag(i,10);
-                ChargeEoI  = (float)rawStream->GetADC(i) - MeanPed[i + 64*Integrator];
-                Float_t Threshold = kSigmaCut * SigPed[i + 64*Integrator];
-
-                if(ChargeEoI  > Threshold) {                              
-                   ADC_Mean[i+64*Integrator] = ADC_Mean[i+64*Integrator]+ChargeEoI; 
-                   NHit[i+64*Integrator]+=1;
-                }
-             }    
-             delete rawStream;
-             rawStream = 0x0;      
-             delete rawReader;
-             rawReader = 0x0;                                                                   
-        } // end of switch on event type 
-       
-        nevents_total++;
-        /* free resources */
-        free(event);
-
-    }    // end of loop over events
-  }      // end of loop over data files 
-
-//________________________________________________________________________
-//  Computes mean values, dumps them into the output text file
-       
-  for(Int_t i=0; i<128; i++) {
-      if(NHit[i]>0) 
-         ADC_Mean[i]=ADC_Mean[i]/(float)NHit[i];
-      else      
-         ADC_Mean[i]=0.0;       
-      fprintf(fp," %d %d %f\n",iteration,i,ADC_Mean[i]);
-      fprintf(flog,"it %d ch %d NHit %d ADCMean %f\n",iteration,i,NHit[i],ADC_Mean[i]);
-  } 
-  
-//________________________________________________________________________
-   
-  /* write report */
-  fprintf(flog,"Run #%s, received %d physics events out of %d\n",getenv("DATE_RUN_NUMBER"),nevents_physics,nevents_total);
-  printf("Run #%s, received %d physics events out of %d\n",getenv("DATE_RUN_NUMBER"),nevents_physics,nevents_total);
-  
-  /* close result and log files */
-  fclose(fp);
-  fclose(flog); 
-  
-  /* report progress */
-  daqDA_progressReport(90);
-
-  /* export result file to FES */
-  status=daqDA_FES_storeFile("./V0_IntegrationGateTuning.dat","V00da_IntegrationGateTuning.dat");
-  if (status)    {
-      printf("Failed to export file : %d\n",status);
-      return -1; }
-
-  /* report progress */
-  daqDA_progressReport(100);
-  
-  return status;
-}