]>
Commit | Line | Data |
---|---|---|
c4d90345 | 1 | /************************************************************************** |
a69c8ba0 | 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: | |
c4d90345 | 11 | **************************************************************************/ |
12 | ||
13 | ||
14 | #include <iostream> | |
15 | #include "TString.h" | |
f67db810 | 16 | #include "TFile.h" |
17 | #include "daqDA.h" | |
f67db810 | 18 | #include "AliITSHandleDaSSD.h" |
7bad8b65 | 19 | #include "TROOT.h" |
20 | #include "TPluginManager.h" | |
f67db810 | 21 | |
22 | using namespace std; | |
23 | ||
f67db810 | 24 | |
25 | int main( int argc, char** argv ) | |
26 | { | |
27 | AliITSHandleDaSSD *ssddaldc; | |
c4d90345 | 28 | TString feefname, cmddbsave; |
f67db810 | 29 | Int_t status; |
c4d90345 | 30 | Char_t *dafname = NULL, *dadaqdir = NULL; |
f67db810 | 31 | |
7bad8b65 | 32 | |
33 | gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo", | |
34 | "*", | |
35 | "TStreamerInfo", | |
36 | "RIO", | |
37 | "TStreamerInfo()"); | |
38 | ||
39 | ||
40 | ||
f67db810 | 41 | /* check that we got some arguments = list of files */ |
42 | if (argc<2) { | |
a69c8ba0 | 43 | fprintf(stderr, "Wrong number of arguments\n"); |
f67db810 | 44 | return -1; |
45 | } | |
46 | ||
47 | char *datafilename = argv[1]; | |
48 | ||
c4d90345 | 49 | ssddaldc = new AliITSHandleDaSSD(datafilename); |
50 | if (ssddaldc->IsZombie()) return -1; | |
51 | if (!ssddaldc->ProcessRawData()) | |
f67db810 | 52 | { |
a69c8ba0 | 53 | cerr << "Error !ssddaldc->ProcessRawData()" << endl; |
f67db810 | 54 | delete ssddaldc; |
55 | return -1; | |
56 | } | |
f67db810 | 57 | daqDA_progressReport(90); |
c4d90345 | 58 | |
59 | if (!system(NULL)) { | |
a69c8ba0 | 60 | cerr << "Error: the call system(NULL) in main() returned NULL!" << endl; |
c4d90345 | 61 | return -1; |
62 | } | |
63 | dadaqdir = getenv ("DA_TEST_DIR"); | |
a69c8ba0 | 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; | |
c4d90345 | 73 | status = daqDA_FES_storeFile(dafname, "DASSD_DB_results"); |
a69c8ba0 | 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; | |
a69c8ba0 | 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; | |
c4d90345 | 98 | |
f67db810 | 99 | delete ssddaldc; |
100 | daqDA_progressReport(100); | |
101 | return 0; | |
a69c8ba0 | 102 | } |