]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/ITSSSDPEDda.cxx
new version of SSD DA and related classes (O. Borysov)
[u/mrichter/AliRoot.git] / ITS / ITSSSDPEDda.cxx
1 /**************************************************************************
2 - "Contact": - Oleksandr Borysov, aborysov@ts.infnf.it
3 - "Link:" - link to test files: /afs/infn.it/ts/user/aborysov/public/C23_run387.000.raw
4 - "Run Type:" - run type (exactly as defined in the ECS)
5 - "DA Type:" -  LDC
6 - "Number of events needed:"   at least 500
7
8 - "Input Files:" - config file:    ssdpeddaconfig 
9                    previous result files:  
10                    data source:   raw data file on LDC
11                     
12 - "Output Files:" -  local names $DA_TEST_DIR/ssddaldc_<LDCID>_<RunID>.root 
13                      FXS name: ITSSSDda_<LDCID>_<RunID>.root, 
14                      local files are persistent over runs: data source
15 - "Trigger types used:"
16  **************************************************************************/
17
18
19 #include <iostream>
20 #include "TString.h"
21 #include "TFile.h"
22 #include "daqDA.h"
23 #include "AliITSHandleDaSSD.h" 
24
25 using namespace std;
26
27
28 int main( int argc, char** argv )
29 {
30   AliITSHandleDaSSD  *ssddaldc;
31   TString             feefname, cmddbsave;
32   Int_t               status;
33   Char_t             *dafname = NULL, *dadaqdir = NULL;
34
35   /* check that we got some arguments = list of files */
36   if (argc<2) {
37     printf("Wrong number of arguments\n");
38     return -1;
39   }
40
41   char *datafilename = argv[1];
42
43   ssddaldc = new AliITSHandleDaSSD(datafilename);
44   if (ssddaldc->IsZombie()) return -1;
45   if (!ssddaldc->ProcessRawData())
46   {
47      cout << "Error !ssddaldc->ProcessRawData()" << endl;
48      delete ssddaldc;
49      return -1;
50   }  
51   daqDA_progressReport(90);
52
53   if (!system(NULL)) {
54     cout << "Error: the call system(NULL) in main() returned NULL!" << endl;
55     return -1;
56   }
57   dadaqdir = getenv ("DA_TEST_DIR");
58   if (dadaqdir) {
59     dafname = dadaqdir;
60     if (!(ssddaldc->SaveCalibrationSSDLDC(dafname))) 
61       cout << "Error saving DA data to the file! Probably $DA_TEST_DIR defined incorrectly!" << endl;
62     else cout << "SSDDA data are saved in " << dafname << endl;
63     feefname = Form("%s/ssddaldc_%i_%i.root", dadaqdir, ssddaldc->GetLdcId(), ssddaldc->GetRunId());
64     cout << "Saving feessdda data in " << feefname << endl;
65     TFile *fileRun = new TFile (feefname.Data(),"RECREATE");
66     ssddaldc->Write();
67     fileRun->Close();
68     delete fileRun;
69     status = daqDA_FES_storeFile(dafname, "DASSD_DB_results");
70     if (status) printf("Failed to export file : %d\n",status);
71
72     if (getenv("DATE_DB_DIR")) {
73       cmddbsave = Form("$DATE_DB_DIR/daqDetDB_store ssddaldc.root %s", feefname.Data());
74       status = system(cmddbsave.Data());
75       if (status) printf("Failed to export file to the detector db: %d\n",status);
76     } else cout << "Error main(): $DATE_DB_DIR is not defined!" << endl;
77   }
78   else cout << "Error: DA_TEST_DIR is not defined, DA data are not saved!" << endl;
79   delete ssddaldc;
80   daqDA_progressReport(100);
81   return 0;
82 }