]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/ITSSPDFOda.cxx
Fix compiler warning (Julian)
[u/mrichter/AliRoot.git] / ITS / ITSSPDFOda.cxx
index d2bfd3d7bb45d2748268679ec2ee69e3e56f654e..e8353474287f297d06dfe6307945fa10fb1cbac8 100644 (file)
@@ -1,3 +1,14 @@
+/*
+Contact: annalisa.mastroserio@cern.ch
+Link: tydes.home.cern.ch/tydes/doc/CalibrationOverview/CalibrationAlgorithms/
+Run Type: DAQ_FO_UNIF_SCAN
+DA Type: LDC
+Number of events needed: Depending on scan type
+Input Files: spd_focalib_params, raw data
+Output Files: ./calibResults/ScanDCSconfigToFXS/* 
+Trigger types used: PHYSICS
+*/
+
 ////////////////////////////////////////////////////////////////////////////////
 // This program can be compiled in two modes.                                 //
 //                                                                            //
@@ -48,10 +59,17 @@ int main(int argc, char **argv) {
   timer.Start();
   
   // directory structure, hard coded
-  char *saveDirNoisyToFXS    = "./calibResults/ScanNoisyToFXS";     //     may delete content
   char *saveDirDCSconfigToFXS= "./calibResults/ScanDCSconfigToFXS"; //     may delete content
   char *configFilesDir       = "./configFiles";                     //     may delete content
   char *saveDirIdsToFXS      = "./calibResults/IdsToFXS"; 
+
+  // make sure the directory structure is correct:
+  system("mkdir ./calibResults >& /dev/null");
+  system("mkdir ./calibResults/ScanDCSconfigToFXS >& /dev/null");
+  system("mkdir ./calibResults/IdsToFXS >& /dev/null");
+  system("mkdir ./configFiles >& /dev/null");
+
+
   // parameters config files
   TString thresholdsFileName = Form("%s/focalib_params.txt",configFilesDir); 
   
@@ -67,11 +85,9 @@ int main(int argc, char **argv) {
                                        "TStreamerInfo()");
   
   // turn off annoying warning messages
-  new AliLog;
-  AliLog::Instance()->SetGlobalDebugLevel(-20);
-  
-  
-  
+  // NB: Should not be handled here 
+  AliLog* logger = AliLog::GetRootLogger();
+  logger->SetGlobalDebugLevel(-20);
   
 // ********* STEP 0: Get configuration files from db (if there are any) , then read parameters*********  
   
@@ -105,7 +121,6 @@ int main(int argc, char **argv) {
   
   Int_t evType =-1;
   AliITSOnlineSPDfoInfo *info[20]; Int_t ntriggers[20]; Int_t vDB[20]; Bool_t iseq[20];
-  Bool_t infodacs[6] = {kFALSE, kFALSE, kFALSE, kFALSE, kFALSE,kFALSE}; // num of DAC params
   AliITSOnlineSPDfo *fomanager[20];
   TString s = "focalib";
   
@@ -143,7 +158,7 @@ int main(int argc, char **argv) {
     
     Int_t eventType;
     UInt_t eventNr=0;
-    Int_t entry=0;    
+      
     // main loop (infinite) 
     for(;;) {
       
@@ -215,13 +230,14 @@ int main(int argc, char **argv) {
             if(!fomanager[eqId]->GetNdacs()) fomanager[eqId]->SetNdacs(str->GetFOHnumDacs());
            
             TArrayS dacvalues(str->GetFOHnumDacs());
-            for(Int_t n = 0; n<str->GetFOHnumDacs(); n++) dacvalues.AddAt(str->GetFOHdacValue(n),n);
+            for(Int_t n = 0; n<(Int_t)str->GetFOHnumDacs(); n++) dacvalues.AddAt(str->GetFOHdacValue(n),n);
             
             TArrayS dacs = fomanager[eqId]->CreateDACArray(dacvalues, info[eqId]->GetDACIndexArray());
            
             for(Int_t ihs =0; ihs < 6; ihs++) { // needed in the header to access the HS and ChipId info (in data it is different)
              for(Int_t ich =0; ich < 10; ich++){
                if(!str->GetFOHchipPresent(ihs, ich)) continue;
+                  info[eqId]->SetActiveChipsAndHS(ihs,ich);
                  Short_t measure[4] = {str->GetFOHMatrixID(),str->GetFOHpixelRow(), str->GetFOHpixelCol(), str->GetFOHchipCount(ihs,ich)}; 
                   fomanager[eqId]->AddMeasurement(dacs,measure,ihs,ich);                                            
              } // chip loop      
@@ -285,6 +301,7 @@ int main(int argc, char **argv) {
           if(dacs.GetSize() == 0) continue;
           for(Int_t idac =0; idac < dacs.GetSize() - 1; idac++) { // -1 (the last one is the quality flag)
             if(dacs.At(idac) >=0 ) {
+            
               dcsfile << ((analyzer->GetFOHandler())->GetFOscanInfo())->GetDACindex(idac) << ",";
               dcsfile << iff << ",";
               dcsfile << hs << ",";
@@ -303,7 +320,7 @@ int main(int argc, char **argv) {
     // send a tared file of all the dcsConfig text files
     TString command = Form("cd %s; tar -cf dcsConfig.tar *",saveDirDCSconfigToFXS);
     //printf("\n\n%s\n\n",command.Data());
-    //system(command.Data());
+    system(command.Data());
     TString fileName = Form("%s/dcsConfig.tar",saveDirDCSconfigToFXS);
     TString iddcs = "SPD_dcsConfig";
     
@@ -326,7 +343,7 @@ int main(int argc, char **argv) {
       if(!iseq[eqId]) continue;   
       //printf("Preparing reference data for eq %d\n",eqId);
       
-      TString idf = Form("SPD_fo_scan_%d",eqId);
+      TString idf = Form("SPD_ref_fo_%d",eqId);
 #ifndef SPD_DA_OFF
       status = daqDA_FES_storeFile(files[eqId].Data(),idf.Data());
       if (status!=0) {
@@ -337,6 +354,21 @@ int main(int argc, char **argv) {
       idsFXSfile << Form("%s\n",idf.Data());   
     }
     
+
+
+  printf("Preparing id list file\n");
+  idsFXSfile.close();
+  TString idlist = "SPD_id_list";
+#ifndef SPD_DA_OFF
+  status = daqDA_FES_storeFile(idsFXSFileName.Data(),idlist.Data());
+  if (status!=0) {
+    printf("Failed to export file %s , status %d\n",idsFXSFileName.Data(),status);
+    return -1;
+  }
+#endif
+
+
+
     timer.Stop();
     timer.Print();   
     printf("DA finished.\n");