]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/ITSSPDSCANda.cxx
Hit histos redefined
[u/mrichter/AliRoot.git] / ITS / ITSSPDSCANda.cxx
index f911b2c47dd811541ed6bdc7094351e6ec63e32a..711e8790bfd9049f8e114ccbd4584902dd371420 100644 (file)
@@ -1,12 +1,12 @@
 /*
-- "Contact:" - henrik.tydesjo@cern.ch
-- "Link:" - 
-- "Run Type:" - DAQ_MIN_TH_SCAN,DAQ_MEAN_TH_SCAN,DAQ_UNIFORMITY_SCAN,DAQ_NOISY_PIX_SCAN,DAQ_PIX_DELAY_SCAN,DAQ_FO_UNIF_SCAN
-- "DA Type:" - LDC
-- "Number of events needed:"
-- "Input Files:" - daq db config files: spd_standal_params,spd_perm_noisy ,  previous noisy lists: ./calibResults/ScanNoisy/* ,  raw data
-- "Output Files:" - Ref Data: ./calibResults/ScanReference/* ,  DCS update: ./calibResults/ScanDCSconfigToFXS/* ,  OCDB update: ./calibResults/ScanNoisyToFXS/* ,  persistent files: ./calibResults/ScanNoisy/*
-- "Trigger types used:" 
+Contact: henrik.tydesjo@cern.ch
+Link: tydes.home.cern.ch/tydes/doc/CalibrationOverview/CalibrationAlgorithms/
+Run Type: DAQ_MIN_TH_SCAN,DAQ_MEAN_TH_SCAN,DAQ_UNIFORMITY_SCAN,DAQ_NOISY_PIX_SCAN,DAQ_PIX_DELAY_SCAN,DAQ_FO_UNIF_SCAN
+DA Type: LDC
+Number of events needed: Depending on scan type
+Input Files: spd_standal_params,spd_perm_noisy ,  ./calibResults/ScanNoisy/* ,  raw data
+Output Files: ./calibResults/ScanReference/* ,  ./calibResults/ScanDCSconfigToFXS/* ,  ./calibResults/ScanNoisyToFXS/* ,  ./calibResults/ScanNoisy/*
+Trigger types used: PHYSICS
 */
 
 ////////////////////////////////////////////////////////////////////////////////
 //                                                                            //
 ////////////////////////////////////////////////////////////////////////////////
 
+#ifndef SPD_DA_OFF
 extern "C" {
 #include "daqDA.h"
 }
+#endif
 #include "event.h"
 #include "monitor.h"
 #include "AliRawReaderDate.h"
@@ -42,6 +44,7 @@ extern "C" {
 #include <TPluginManager.h>
 #include <TObjArray.h>
 #include <TString.h>
+#include <TFitter.h>
 
 int main(int argc, char **argv) {
   if (argc<2) {
@@ -69,6 +72,9 @@ int main(int argc, char **argv) {
   TString paramsFileName = Form("%s/standal_params.txt",configFilesDir);
   TString permNoisyFileName = Form("%s/perm_noisy.txt",configFilesDir);
 
+  TFitter *fitter = new TFitter(3);
+  TVirtualFitter::SetFitter(fitter);
+
   // This line is needed in case of a stand-alone application w/o
   // $ROOTSYS/etc/system.rootrc file
   gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
@@ -143,6 +149,10 @@ int main(int argc, char **argv) {
   int startSeg = 1;
 
 #ifndef SPD_DA_OFF
+  if (getenv("DATE_RUN_NUMBER")==0) {
+    printf("DATE_RUN_NUMBER not properly set.\n");
+    return -1;
+  }
   int runNr = atoi(getenv("DATE_RUN_NUMBER"));
 #else
   int runNr = atoi(argv[1]);
@@ -252,7 +262,7 @@ int main(int argc, char **argv) {
            }
          }
          
-         if (str->ReadCalibHeader()) {
+         if (str->ReadCalibHeader()>0) {
            // first check the type:
            if (bScanInit[eqId] && type[eqId]!=str->GetHtype()) {
              printf("Calib header problem. Type changed (%d -> %d)!\n",type[eqId],str->GetHtype());
@@ -438,11 +448,17 @@ int main(int argc, char **argv) {
   }
 
   
-  // clean up scan objects (which also saves them)
+  // clean up scan objects (which also saves them) , check if something happened...
+    Bool_t somethingHappened = kFALSE;
   for (UInt_t eqId=0; eqId<20; eqId++) {
-    if (scanObj[eqId]!=NULL) delete scanObj[eqId];
+    if (scanObj[eqId]!=NULL) {
+      delete scanObj[eqId];
+      somethingHappened = kTRUE;
+    }
+  }
+  if (!somethingHappened) {
+    printf("WARNING: No data processed. Are the calibration headers missing?\n");
   }
-
 
 
 
@@ -632,7 +648,7 @@ int main(int argc, char **argv) {
     delete handlerPermNoisy;
   }
 
-
+  printf("Opening id list file\n");
   TString idsFXSFileName = Form("%s/FXSids_run_%d.txt",saveDirIdsToFXS,runNr);
   ofstream idsFXSfile;
   idsFXSfile.open(idsFXSFileName.Data());
@@ -641,6 +657,7 @@ int main(int argc, char **argv) {
 
   // send noisy data to FXS
   if (nrNoisyFilesProduced>0) {
+    printf("Preparing noisy files\n");
     // send a tared file of all new noisy maps
     TString command = Form("cd %s; tar -cf noisy_scan.tar *",saveDirNoisyToFXS);
     //    printf("\n\n%s\n\n",command.Data());
@@ -659,6 +676,7 @@ int main(int argc, char **argv) {
 
   // send dcs config files to FXS
   if (nrDCSconfigFilesProduced>0) {
+    printf("Preparing DCS config files\n");
     // 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());
@@ -678,6 +696,7 @@ int main(int argc, char **argv) {
   // send reference data to FXS
   for (UInt_t eqId=0; eqId<20; eqId++) {
     if (bScanInit[eqId]) {
+      printf("Preparing reference data for eq %d\n",eqId);
       TString fileName = Form("%s/SPDcal_run_%d_eq_%d.root",saveDirRef,runNr,eqId);
       TString id = Form("SPD_ref_scan_%d",eqId);
 #ifndef SPD_DA_OFF
@@ -692,9 +711,19 @@ int main(int argc, char **argv) {
   }
 
 
+  printf("Preparing id list file\n");
   idsFXSfile.close();
+  TString id = "SPD_id_list";
+#ifndef SPD_DA_OFF
+  status = daqDA_FES_storeFile(idsFXSFileName.Data(),id.Data());
+  if (status!=0) {
+    printf("Failed to export file %s , status %d\n",idsFXSFileName.Data(),status);
+    return -1;
+  }
+#endif
 
 
+  printf("DA finished.\n");
 
   return 0;
-}
+}
\ No newline at end of file