]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/TPCPEDESTALda.cxx
ATO-98 - function returns also status value
[u/mrichter/AliRoot.git] / TPC / TPCPEDESTALda.cxx
index a572b97d2a31810fcaad8d45c4e3fde632759ffc..8293a74aa42f1c91d044af63e71a55291b07f969 100644 (file)
@@ -27,6 +27,8 @@ TPCda_pedestal.cxx - calibration algorithm for TPC pedestal runs
 19/09/2008  J.Wiechula@gsi.de:            Added export of the calibration data to the AMORE data base.
                                           Added support for configuration files.
 31/01/2011  Christian.Lippmann@cern.ch :  Updates for changed setup at P2 with 2 LDCs per sector
+26/09/2014  Christian.Lippmann@cern.ch :  Updates for changed setup at P2 1 CRORC per LDC
+26/09/2014  Jens.Wiechula@cern.ch      :  comment out obsolete AliTPCRawStream
 
 contact: marian.ivanov@cern.ch
 
@@ -74,7 +76,7 @@ extern "C" {
 #include "AliRawReader.h"
 #include "AliRawReaderDate.h"
 #include "AliTPCmapper.h"
-#include "AliTPCRawStream.h"
+//#include "AliTPCRawStreamV3.h"
 #include "AliTPCROC.h"
 #include "AliTPCCalROC.h"
 #include "AliTPCCalPad.h"
@@ -110,6 +112,7 @@ int main(int argc, char **argv) {
     return -1;
   }
 
+  /*
   TString daterolename(gSystem->Getenv("DATE_ROLE_NAME"));
   if ( daterolename == "" ) {
     printf("Error: Variable DATE_ROLE_NAME not defined! Exiting ...\n");
@@ -122,8 +125,9 @@ int main(int argc, char **argv) {
     printf("Error: Variable DATE_ROLE_NAME neither ends with -0 nor -1 (E.g. ldc-TPC-C12-1)! Exiting ...\n");
     return -1;
   }
+  */
 
-  AliLog::SetClassDebugLevel("AliTPCRawStream",-5);
+  //AliLog::SetClassDebugLevel("AliTPCRawStreamV3",-5);
   AliLog::SetClassDebugLevel("AliRawReaderDate",-5);
   AliLog::SetClassDebugLevel("AliTPCAltroMapping",-5);
   AliLog::SetModuleDebugLevel("RAW",-5);
@@ -185,15 +189,24 @@ int main(int argc, char **argv) {
   }
   AliTPCConfigDA config(CONFIG_FILE);
   // check configuration
+  Bool_t  skipAmore=kFALSE;
+
   if ( (Int_t)config.GetValue("NoTimeAnalysis") == 1 ) {
     printf("WARNING: Time analysis was switched off in the configuration file!\n");
     timeAnalysis=kFALSE;
   }
+
   if ( (Int_t)config.GetValue("UseFastDecoder") == 1 ){
     printf("Info: The fast decoder will be used for the processing.\n");
     fastDecoding=kTRUE;
   }
-  
+
+  if ( config.GetConfigurationMap()->GetValue("SkipAmore") ) {
+    skipAmore=((TObjString*)config.GetConfigurationMap()->GetValue("SkipAmore"))->GetString().Atoi();
+    printf("TPCPEDESTALda: Skip Amore set in config\n");
+  }
+
+
   // create calibration object
   AliTPCCalibPedestal calibPedestal(config.GetConfigurationMap()); // pedestal and noise calibration
   calibPedestal.SetAltroMapping(mapping->GetAltroMapping()); // Use altro mapping we got from daqDetDb
@@ -271,45 +284,47 @@ int main(int argc, char **argv) {
   //
   //Send objects to the AMORE DB
   //
-  printf ("AMORE part\n");
-  const char *amoreDANameorig=gSystem->Getenv("AMORE_DA_NAME");
-  //cheet a little -- temporary solution (hopefully)
-  //
-  //currently amoreDA uses the environment variable AMORE_DA_NAME to create the mysql
-  //table in which the calib objects are stored. This table is dropped each time AmoreDA
-  //is initialised. This of course makes a problem if we would like to store different
-  //calibration entries in the AMORE DB. Therefore in each DA which writes to the AMORE DB
-  //the AMORE_DA_NAME env variable is overwritten.  
-
-  //find processed sector
-  Char_t sideName='A';
-  Int_t sector = -1;
-  for ( Int_t roc = 0; roc < 72; roc++ ) {
-    if ( !calibPedestal.GetCalRocPedestal(roc) ) continue;
-    if (mapping->GetSideFromRoc(roc)==1) sideName='C';
-    sector = mapping->GetSectorFromRoc(roc);
-  }
-//   gSystem->Setenv("AMORE_DA_NAME",Form("TPC-%c%02d-%s",sideName,sector,FILE_ID));
-  gSystem->Setenv("AMORE_DA_NAME",Form("%s-%s",gSystem->Getenv("DATE_ROLE_NAME"),FILE_ID));
-  
-  //
-  // end cheet
-  if (sector>-1){
-    TDatime time;
-    TObjString info(Form("Run: %u; Date: %s",runNb,time.AsSQLString()));
-    
-    amore::da::AmoreDA amoreDA(amore::da::AmoreDA::kSender);
-    Int_t statusDA=0;
-    statusDA+=amoreDA.Send("Pedestals",calibPedestal.GetCalPadPedestal());
-    statusDA+=amoreDA.Send("Noise",calibPedestal.GetCalPadRMS());
-    statusDA+=amoreDA.Send("Info",&info);
-    if ( statusDA )
-      printf("Warning: Failed to write one of the calib objects to the AMORE database\n");
-  }  else {
-    printf("Warning: No data found!\n");
+  if (!skipAmore){
+    printf ("AMORE part\n");
+    const char *amoreDANameorig=gSystem->Getenv("AMORE_DA_NAME");
+    //cheet a little -- temporary solution (hopefully)
+    //
+    //currently amoreDA uses the environment variable AMORE_DA_NAME to create the mysql
+    //table in which the calib objects are stored. This table is dropped each time AmoreDA
+    //is initialised. This of course makes a problem if we would like to store different
+    //calibration entries in the AMORE DB. Therefore in each DA which writes to the AMORE DB
+    //the AMORE_DA_NAME env variable is overwritten.
+
+    //find processed sector
+    Char_t sideName='A';
+    Int_t sector = -1;
+    for ( Int_t roc = 0; roc < 72; roc++ ) {
+      if ( !calibPedestal.GetCalRocPedestal(roc) ) continue;
+      if (mapping->GetSideFromRoc(roc)==1) sideName='C';
+      sector = mapping->GetSectorFromRoc(roc);
+    }
+  //   gSystem->Setenv("AMORE_DA_NAME",Form("TPC-%c%02d-%s",sideName,sector,FILE_ID));
+    gSystem->Setenv("AMORE_DA_NAME",Form("%s-%s",gSystem->Getenv("DATE_ROLE_NAME"),FILE_ID));
+
+    //
+    // end cheet
+    if (sector>-1){
+      TDatime time;
+      TObjString info(Form("Run: %u; Date: %s",runNb,time.AsSQLString()));
+
+      amore::da::AmoreDA amoreDA(amore::da::AmoreDA::kSender);
+      Int_t statusDA=0;
+      statusDA+=amoreDA.Send("Pedestals",calibPedestal.GetCalPadPedestal());
+      statusDA+=amoreDA.Send("Noise",calibPedestal.GetCalPadRMS());
+      statusDA+=amoreDA.Send("Info",&info);
+      if ( statusDA )
+        printf("Warning: Failed to write one of the calib objects to the AMORE database\n");
+    }  else {
+      printf("Warning: No data found!\n");
+    }
+    // reset env var
+    if (amoreDANameorig) gSystem->Setenv("AMORE_DA_NAME",amoreDANameorig);
   }
-  // reset env var
-  if (amoreDANameorig) gSystem->Setenv("AMORE_DA_NAME",amoreDANameorig);
   
   //
   // Now prepare ASCII files for local ALTRO configuration through DDL.
@@ -353,8 +368,9 @@ int main(int argc, char **argv) {
     Int_t sector = mapping->GetSectorFromRoc(roc);
     Int_t minrcu, maxrcu;
     if      ( isIROC ) { minrcu=0; maxrcu=1; }
-    else if ( inner  ) { minrcu=2; maxrcu=2; }
-    else               { minrcu=3; maxrcu=5; }
+    //else if ( inner  ) { minrcu=2; maxrcu=2; }
+    //else               { minrcu=3; maxrcu=5; }
+    else               { minrcu=2; maxrcu=5; }
     for ( int rcu = minrcu; rcu <= maxrcu; rcu++ ) {
       //Int_t patch = mapping->IsIROC(roc) ? rcu : rcu+2;
       for ( int branch = 0; branch < 2; branch++ ) {