]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/ITSSSDPEDda.cxx
Eliminated hardwired names. The layed detector type ID is stored in TGeo and can
[u/mrichter/AliRoot.git] / ITS / ITSSSDPEDda.cxx
index 7f7d331d81066ec6a814618c12ce05c1cfc49dd2..b0cbaa40c0549ed46c122adaa04a8aebb12a71a1 100644 (file)
@@ -1,10 +1,10 @@
 /**************************************************************************
 - Contact: Oleksandr_Borysov oborysov@cern.ch
-- Link: /afs/cern.ch/user/o/oborysov/public/da/pedestal36186.000.raw, ssddaconfig.txt, ssdddlmap.txt, badchannels.root
+- Link: /afs/cern.ch/user/o/oborysov/public/ssdda/run75491.raw, ssddaconfig.txt, ssdddlmap_v09.txt, ssdbcmap_1258498704.root
 - Run Type: PEDESTAL
 - DA Type: LDC
 - Number of events needed: ~200
-- Input Files: raw_data_file_on_LDC, in the daqDetDB: ssddaconfig.txt, ssdddlmap.txt, badchannels.root
+- Input Files: raw_data_file_on_LDC, in the daqDetDB: ssddaconfig.txt, ssdddlmap_v09.txt, ssdbcmap_1258498704.root
 - Output Files: ./<EqId_Slot> ./ssddaldc_<LDCID>.root, FXS_name=ITSSSDda_<LDCID>.root 
                 local files are persistent over runs: data source
 - Trigger types used:
 using namespace std;
 
 
-struct ConfigStruct {
+class ConfigStruct {
+public:
   Int_t    fNModuleProcess;
   string   fSsdDdlMap;
   string   fBadChannels;
-  Bool_t   fCheckChipsOff;
-  ConfigStruct() : fNModuleProcess(108), fSsdDdlMap(""), fBadChannels(""), fCheckChipsOff(kFALSE) {}
+  Bool_t   fCheckChipsOff, fUseWelford;
+  ConfigStruct() : fNModuleProcess(108), fSsdDdlMap(""), fBadChannels(""), fCheckChipsOff(kFALSE), fUseWelford(kTRUE) {}
 };
 
 
@@ -43,6 +44,7 @@ Bool_t ReadDAConfigurationFile(const Char_t *configfname, AliITSHandleDaSSD *con
 
 int main( int argc, char** argv )
 {
+// Implements SSD DA executable.
   const Char_t       *configfname = "ssddaconfig.txt";
   const Char_t       *bcfname = "badchannels.root"; 
   const Char_t       *ddlmfname = "ssdddlmap.txt";
@@ -79,7 +81,7 @@ int main( int argc, char** argv )
     
   if (cfg.fBadChannels.size() > 0) bcfname = cfg.fBadChannels.c_str();
   lfname.Form("./%s", bcfname);
-  if (status = daqDA_DB_getFile(bcfname, lfname.Data())) {
+  if ((status = daqDA_DB_getFile(bcfname, lfname.Data()))) {
     fprintf(stderr, "Failed to import the file %s from the detector db: %d, %s! Exit DA!\n", bcfname, status, lfname.Data());
     delete ssddaldc;
     return -3;
@@ -99,7 +101,7 @@ int main( int argc, char** argv )
     if (!ssddaldc->ReadDDLModuleMap()) cerr << "Failed to load the DDL map from AliITSRawStreamSSD!\n"; 
   }    
   
-  if (!ssddaldc->ProcessRawData(cfg.fNModuleProcess))  {
+  if (!ssddaldc->ProcessRawData(cfg.fNModuleProcess, cfg.fUseWelford)) {
      cerr << "Error !ssddaldc->ProcessRawData()" << endl;
      delete ssddaldc;
      return -1;
@@ -141,6 +143,7 @@ int main( int argc, char** argv )
 //__________________________________________________________________________________________
 Int_t SaveEquipmentCalibrationData(const AliITSHandleDaSSD  *ssddaldc, const Char_t  *fprefix)
 {
+// Saves the files with Offset correction and ZS threshold.
   TString feefilename;
   Int_t count = 0, status;
   for (Int_t ddli = 0; ddli < 16; ddli++) {
@@ -163,10 +166,10 @@ Int_t SaveEquipmentCalibrationData(const AliITSHandleDaSSD  *ssddaldc, const Cha
 Bool_t ReadDAConfigurationFile(const Char_t *configfname, AliITSHandleDaSSD *const ssddaldc, ConfigStruct& cfg) 
 {
 // Dowload configuration parameters from configuration file or database
-  const int nkwords = 12;
-  char *keywords[nkwords] = {"ZsDefault", "OffsetDefault", "ZsFactor", "PedestalThresholdFactor", "CmThresholdFactor",
+  const int nkwords = 13;
+  char const *keywords[nkwords] = {"ZsDefault", "OffsetDefault", "ZsFactor", "PedestalThresholdFactor", "CmThresholdFactor",
                              "NModulesToProcess", "DDLMapFile", "BadChannelsFile", "ZSMinValue", "MergeBCFlag", 
-                             "CheckChipsOff", "OffLadder"};
+                             "CheckChipsOff", "UseWelford", "OffLadder"};
   Int_t tmpint, laddern;
   Float_t tmpflt;
   fstream dfile;
@@ -276,6 +279,13 @@ Bool_t ReadDAConfigurationFile(const Char_t *configfname, AliITSHandleDaSSD *con
                 cout << keystr << ": " << cfg.fCheckChipsOff << endl;
               } break;
          case 11: 
+                 strline >> tmpint;
+              if (strline.fail()) cerr << "Failed to read " << keystr << " value from DA configuration file!\n";
+              else {
+                   cfg.fUseWelford = static_cast<Bool_t>(tmpint);
+                cout << keystr << ": " << cfg.fUseWelford << endl;
+              } break;
+         case 12: 
                  char dside;
               while (!strline.eof()) {
                 strline >> tmpstr;