]>
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 | |
6e7691a5 | 7 | - Input Files: raw_data_file_on_LDC, ssdddlmap.txt, badchannels.root |
371588bb | 8 | - Output Files: ./ssddaldc_<LDCID>.root, FXS_name=ITSSSDda_<LDCID>.root |
a69c8ba0 | 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; | |
6e7691a5 | 28 | TString feefname, fcdbsave, lfname; |
f67db810 | 29 | Int_t status; |
fc566f79 | 30 | Char_t *dafname = NULL; |
6e7691a5 | 31 | const Char_t *bcfname = "badchannels.root"; |
32 | const Char_t *ddlmfname = "ssdddlmap.txt"; | |
f67db810 | 33 | |
7bad8b65 | 34 | |
35 | gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo", | |
36 | "*", | |
37 | "TStreamerInfo", | |
38 | "RIO", | |
39 | "TStreamerInfo()"); | |
40 | ||
41 | ||
42 | ||
f67db810 | 43 | /* check that we got some arguments = list of files */ |
44 | if (argc<2) { | |
a69c8ba0 | 45 | fprintf(stderr, "Wrong number of arguments\n"); |
f67db810 | 46 | return -1; |
47 | } | |
48 | ||
49 | char *datafilename = argv[1]; | |
c4d90345 | 50 | ssddaldc = new AliITSHandleDaSSD(datafilename); |
51 | if (ssddaldc->IsZombie()) return -1; | |
6e7691a5 | 52 | |
53 | lfname.Form("./%s", bcfname); | |
54 | status = daqDA_DB_getFile(bcfname, lfname.Data()); | |
55 | if (!status) { | |
56 | if (!ssddaldc->ReadStaticBadChannelsMap(lfname.Data())) cerr << "Error reading static bad channels map " << lfname.Data() << " !\n"; | |
57 | } else fprintf(stderr, "Failed to import file %s from the detector db: %d, %s \n", bcfname, status, lfname.Data()); | |
58 | ||
59 | lfname.Form("./%s", ddlmfname); | |
60 | status = daqDA_DB_getFile(ddlmfname, lfname.Data()); | |
61 | if (!status) { | |
62 | if (!ssddaldc->ReadDDLModuleMap(lfname.Data())) cerr << "Error reading DDL map from file " << lfname.Data() << " !\n"; | |
63 | } else { | |
64 | fprintf(stderr, "Failed to import file %s from the detector db: %d, %s \n", bcfname, status, lfname.Data()); | |
65 | if (!ssddaldc->ReadDDLModuleMap()) cerr << "Failed to load the DDL map from AliITSRawStreamSSD!\n"; | |
66 | } | |
67 | ||
c4d90345 | 68 | if (!ssddaldc->ProcessRawData()) |
f67db810 | 69 | { |
a69c8ba0 | 70 | cerr << "Error !ssddaldc->ProcessRawData()" << endl; |
f67db810 | 71 | delete ssddaldc; |
72 | return -1; | |
371588bb | 73 | } |
f67db810 | 74 | daqDA_progressReport(90); |
c4d90345 | 75 | |
fc566f79 | 76 | dafname = "."; |
a69c8ba0 | 77 | if (ssddaldc->SaveCalibrationSSDLDC(dafname)) { |
78 | cout << "SSDDA data are saved in " << dafname << endl; | |
3af1c47d | 79 | status = daqDA_FES_storeFile(dafname, "CALIBRATION"); |
a69c8ba0 | 80 | if (status) fprintf(stderr, "Failed to export file : %d\n", status); |
81 | } else cerr << "Error saving DA data to the file! Probably $DA_TEST_DIR defined incorrectly!" << endl; | |
fac3826c | 82 | |
371588bb | 83 | feefname.Form("%s/ssddaldc_%i.root", ".", ssddaldc->GetLdcId()); |
a69c8ba0 | 84 | cout << "Saving feessdda data in " << feefname << endl; |
85 | TFile *fileRun = new TFile (feefname.Data(),"RECREATE"); | |
86 | if (fileRun->IsZombie()) { | |
87 | cerr << "Error open file " << feefname << endl; | |
88 | delete ssddaldc; | |
89 | delete fileRun; | |
90 | return 2; | |
91 | } | |
92 | ssddaldc->Write(); | |
93 | fileRun->Close(); | |
94 | delete fileRun; | |
95 | ||
fac3826c | 96 | fcdbsave.Form("ssddaldc_%i.root", ssddaldc->GetLdcId()); |
97 | status = daqDA_DB_storeFile(feefname.Data(), fcdbsave.Data()); | |
98 | if (status) fprintf(stderr, "Failed to export file %s to the detector db: %d, %s \n", feefname.Data(), status, fcdbsave.Data()); | |
c4d90345 | 99 | |
f67db810 | 100 | delete ssddaldc; |
101 | daqDA_progressReport(100); | |
102 | return 0; | |
a69c8ba0 | 103 | } |