]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/ITSSSDPEDda.cxx
better organization of private and protected methods. Bug fix in AliITSPlaneEff:...
[u/mrichter/AliRoot.git] / ITS / ITSSSDPEDda.cxx
1 /**************************************************************************
2 - Contact: Oleksandr_Borysov aborysov@ts.infnf.it
3 - Link: /afs/infn.it/ts/user/efragiac/public/testCosm3125.001
4 - Run Type: 
5 - DA Type: LDC
6 - Number of events needed: >=500
7 - Input Files: ssdpeddaconfig, raw_data_file_on_LDC
8 - Output Files: $DA_TEST_DIR/ssddaldc_<LDCID>_<RunID>.root, FXS_name=ITSSSDda_<LDCID>_<RunID>.root 
9                 local files are persistent over runs: data source
10 - Trigger types used:
11  **************************************************************************/
12
13
14 #include <iostream>
15 #include "TString.h"
16 #include "TFile.h"
17 #include "daqDA.h"
18 #include "AliITSHandleDaSSD.h" 
19 #include "TROOT.h"
20 #include "TPluginManager.h"
21
22 using namespace std;
23
24
25 int main( int argc, char** argv )
26 {
27   AliITSHandleDaSSD  *ssddaldc;
28   TString             feefname, cmddbsave;
29   Int_t               status;
30   Char_t             *dafname = NULL, *dadaqdir = NULL;
31
32
33    gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
34                                         "*",
35                                         "TStreamerInfo",
36                                         "RIO",
37                                         "TStreamerInfo()");
38
39
40
41   /* check that we got some arguments = list of files */
42   if (argc<2) {
43     fprintf(stderr, "Wrong number of arguments\n");
44     return -1;
45   }
46
47   char *datafilename = argv[1];
48
49   ssddaldc = new AliITSHandleDaSSD(datafilename);
50   if (ssddaldc->IsZombie()) return -1;
51   if (!ssddaldc->ProcessRawData())
52   {
53      cerr << "Error !ssddaldc->ProcessRawData()" << endl;
54      delete ssddaldc;
55      return -1;
56   }  
57   daqDA_progressReport(90);
58
59   if (!system(NULL)) {
60     cerr << "Error: the call system(NULL) in main() returned NULL!" << endl;
61     return -1;
62   }
63   dadaqdir = getenv ("DA_TEST_DIR");
64   if (!dadaqdir) {
65     cerr << "Error: DA_TEST_DIR is not defined, DA data are not saved!" << endl;
66     delete ssddaldc;
67     daqDA_progressReport(100);
68     return 1;
69   }
70   dafname = dadaqdir;
71   if (ssddaldc->SaveCalibrationSSDLDC(dafname)) {
72     cout << "SSDDA data are saved in " << dafname << endl;
73     status = daqDA_FES_storeFile(dafname, "DASSD_DB_results");
74     if (status) fprintf(stderr, "Failed to export file : %d\n", status);
75   } else cerr << "Error saving DA data to the file! Probably $DA_TEST_DIR defined incorrectly!" << endl;
76   feefname.Form("%s/ssddaldc_%i_%i.root", dadaqdir, ssddaldc->GetLdcId(), ssddaldc->GetRunId());
77   cout << "Saving feessdda data in " << feefname << endl;
78   TFile *fileRun = new TFile (feefname.Data(),"RECREATE");
79   if (fileRun->IsZombie()) {
80     cerr << "Error open file " << feefname << endl;
81     delete ssddaldc;
82     delete fileRun;
83     return 2;
84   }  
85   ssddaldc->Write();
86   fileRun->Close();
87   delete fileRun;
88
89   if (getenv("DATE_DB_DIR")) {
90     cmddbsave.Form("$DATE_DB_DIR/daqDetDB_store ssddaldc_%i.root %s", ssddaldc->GetLdcId(), feefname.Data());
91     status = system(cmddbsave.Data());
92     if (status) fprintf(stderr, "Failed to export file to the detector db: %d, %s \n",status, cmddbsave.Data());
93     cmddbsave.Form("$DATE_DB_DIR/daqDetDB_store ssddaldc_%i_%i.root %s", 
94                                  ssddaldc->GetLdcId(), ssddaldc->GetRunId(), feefname.Data());
95     status = system(cmddbsave.Data());
96     if (status) fprintf(stderr, "Failed to export file to the detector db: %d, %s \n",status, cmddbsave.Data());
97   } else cerr << "Error main(): $DATE_DB_DIR is not defined!" << endl;
98
99   delete ssddaldc;
100   daqDA_progressReport(100);
101   return 0;
102 }