]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HMPID/HMPIDda.cxx
Add /home/mtadel/alice-dev/trunk/aliroot/PWG0 to include path. After restructuring...
[u/mrichter/AliRoot.git] / HMPID / HMPIDda.cxx
index ab8be123e7095264f67ed4e61ff5b1d26c455abb..f6feae76981b1cacb7dc4fb714a6a741867e6c63 100644 (file)
@@ -2,14 +2,15 @@
 
 HMPID DA for online calibration
 
-Contact: Levente.Molnar@ba.infn.it, Giacomo.Volpe@ba.infn.it
-Link: http://richpc1.ba.infn.it/~levente/Files4Public/ValidateHmpidDA/
-Run Type: PEDESTAL -- but we select on the PHYSICS_EVENTS in th HMPIDda.cxx
-DA Type: LDC
-Number of events needed: 1000 events
-Input Files: Raw pedestal file, EXTERNAL config file: HmpidSigmaCut.txt on both HMPID LDCs
-Output Files: 14 txt files including pedestal values
-Trigger types used: PEDESTAL RUN (selecting on PHYSICS_EVENT)
+Contact:                  Levente.Molnar@cern.ch, Giacomo.Volpe@ba.infn.it
+Link:                     https://twiki.cern.ch/twiki/bin/view/ALICE/DAInstructions
+Run Type:                 PEDESTAL -- but we select on the PHYSICS_EVENTS in the HMPIDda.cxx
+DA Type:                  LDC
+Reference Run:             78734
+Number of events needed:  ~ 1000 events
+Input Files:              Raw pedestal file, EXTERNAL config files: HmpDaqDaConfig.txt, HmpDeadChannelMap.txt on all HMPID LDCs
+Output Files:             2 x 14 txt files including pedestal and error values
+Trigger types used:       CALIBRATION RUN (but selecting on PHYSICS_EVENT)
 
 */
 
@@ -39,13 +40,17 @@ extern "C" {
 #include "TObject.h"
 #include "TPluginManager.h"
 
+//AMORE
+#include <AmoreDA.h>
+
 
 int main(int argc, char **argv){ 
 
-  int status;
-  const Char_t         *hmpConfigFile = "HmpDaqDaConfig.txt"; 
+  int status=0;
+  const Char_t         *hmpConfigFile        = "HmpDaqDaConfig.txt"; 
+  const Char_t         *hmpDeadChannelMapFile = "HmpDeadChannelMap.txt"; 
   const Int_t               ddlOffset = 1536;
-        TString                 hmpIn;
+        TString                 hmpIn,hmpIn2;
         TString                 feeIn;
 
   
@@ -61,34 +66,31 @@ int main(int argc, char **argv){
   }
 
   /* copy locally a file from daq detector config db */
+  
   hmpIn=Form("./%s",hmpConfigFile);
-  status=daqDA_DB_getFile(hmpConfigFile,hmpIn.Data());
-  if (status) { printf("Failed to get HMPID config file status: %d\n",status); return -1; }
+  status=daqDA_DB_getFile(hmpConfigFile,hmpIn.Data()); 
+  if (status) { printf("Failed to get HMPID config file status: %d\n",status);return -1; }
+  hmpIn2=Form("./%s",hmpDeadChannelMapFile);
+  status=daqDA_DB_getFile(hmpDeadChannelMapFile,hmpIn2.Data()); 
+  if (status) { printf("Failed to get HMPID dead channel file status: %d\n",status);return -1; }
+  
 
   /* report progress */
   daqDA_progressReport(10);
-
-  
-  
   /* define wait event timeout - 1s max */
   monitorSetNowait();
   monitorSetNoWaitNetworkTimeout(1000);
 
   /* set local storage of ped files for Fe2C */
+
   
   /* init the pedestal calculation */
   AliHMPIDCalib *pCal=new AliHMPIDCalib();
-  /* Set the number of sigma cuts inside the file HmpidSigmaCut.txt on BOTH LDCs! */
+  /* Set the number of sigma cuts inside the file HmpidSigmaCut.txt on all LDCs! */
   /* If the file is NOT present then the default cut 3 will be used!*/
   pCal->SetSigCutFromFile(hmpIn);
-  
-  /* ONLY set this option to kTRUE if you want to create the ADC dsitributions for all 161280 pads!!!!*/  
-  /* kTRUE is not suggested for production mode b/c of the memory consumption! */
-  pCal->SetWriteHistoPads(kFALSE);               //use this option for default production useage!!!
-  //pCal->SetWriteHistoPads(kTRUE);              //only for expert debug
-  //pCal->SetWriteHistoPads(kTRUE,kTRUE,13);     //DO NOT USE THIS OPTION!
-  
+  pCal->SetDeadChannelMapFromFile(hmpIn2);  
   
   /* init event counter */
   Int_t firstEvt=0;
@@ -124,8 +126,6 @@ int main(int argc, char **argv){
         printf("End of monitoring file has been reached! \n");
         break;
         }
-      
-       
       if (status!=0) {
         printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
        return -1;
@@ -143,11 +143,6 @@ int main(int argc, char **argv){
       if (eventT==PHYSICS_EVENT || eventT==CALIBRATION_EVENT  ) {                 //updated: 18/02/2008 based on http://alice-ecs.web.cern.ch/alice-ecs/runtypes_3.16.html
         runNum=(unsigned long)event->eventRunNb;                                  //assuming that only one run is processed at a time
         ldcId=(unsigned long)event->eventLdcId;
-        if(iEvtNcal==firstEvt && pCal->GetWritePads()==kTRUE) 
-        {
-          if(pCal->GetLargePads()==kFALSE)  pCal->InitFile((Int_t)ldcId);         //The number for iEvtNcal should be the same as for the first value
-          else pCal->InitFile((Int_t)runNum);                                     //The number for iEvtNcal should be the same as for the first value
-        }
         
         iEvtNcal++;        
        AliRawReader *reader = new AliRawReaderDate((void*)event);
@@ -192,7 +187,7 @@ int main(int argc, char **argv){
 
   /* report progress */
   daqDA_progressReport(90);
-  
+  /* send pedestal and error files to DAQ FXS */
   for(Int_t nDDL=0; nDDL < AliHMPIDRawStream::kNDDL; nDDL++) {   
     feeIn=Form("thr%d.dat",ddlOffset+nDDL);         
     /* Calculate pedestal for the given ddl, if there is no ddl go t next */
@@ -206,13 +201,28 @@ int main(int argc, char **argv){
       status=daqDA_FES_storeFile(Form("HmpidErrorsDdl%02i.txt",nDDL),Form("HmpidErrorsDdl%02i.txt",nDDL));
       if (status) { printf("Failed to export file : %d\n",status); }
     }//errors
-    /* to create pedestal file as Paolo uncomment the line */
-    //if(!pCal->CalcPedestalPaolo(nDDL,Form("%sHmpidPedDdl%02i.txt",sDaOut.Data(),nDDL),iEvtNcal)) continue; 
   }//nDDL
 
-  if(pCal->GetWritePads()==kTRUE) pCal->CloseFile();
+  /* send files to AMORE DB */
+  daqDA_progressReport(95);
+  Int_t statusAmoreDA=0; 
+  amore::da::AmoreDA amoreDA(amore::da::AmoreDA::kSender);
+  for(Int_t iCh=0; iCh < AliHMPIDParam::kMaxCh; iCh++) {  
+  statusAmoreDA+=amoreDA.Send(Form("fPedMeanMap%d",iCh), pCal->GetPedMeanMap(iCh));  
+  statusAmoreDA+=amoreDA.Send(Form("fPedSigMap%d",iCh),  pCal->GetPedSigMap(iCh));  
+  }
+  for(Int_t iCh=0;iCh<=AliHMPIDParam::kMaxCh;iCh++)
+   {
+    for(Int_t iFee=0;iFee<6;iFee++)
+     {
+         statusAmoreDA+=amoreDA.Send(Form("f1DPedMean_Ch%d_FEE_%d",iCh,iFee),pCal->GetPedMean(6*iCh+iFee));
+         statusAmoreDA+=amoreDA.Send(Form("f1DPedSigma_Ch%d_FEE_%d",iCh,iFee),pCal->GetPedSigma(6*iCh+iFee));
+       }
+     }
+         
   delete pCal;  
-  if (status) return -1;
+  if(status) return -1;
+  if(statusAmoreDA) return -1;
   
   /* report progress */
   daqDA_progressReport(100);