]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/ITSSSDPEDda.cxx
Coding conventions
[u/mrichter/AliRoot.git] / ITS / ITSSSDPEDda.cxx
CommitLineData
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
fc566f79 8- Output Files: ./ssddaldc_<LDCID>_<RunID>.root, FXS_name=ITSSSDda_<LDCID>_<RunID>.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
22using namespace std;
23
f67db810 24
25int main( int argc, char** argv )
26{
27 AliITSHandleDaSSD *ssddaldc;
c4d90345 28 TString feefname, cmddbsave;
f67db810 29 Int_t status;
fc566f79 30 Char_t *dafname = 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 }
fc566f79 63 dafname = ".";
a69c8ba0 64 if (ssddaldc->SaveCalibrationSSDLDC(dafname)) {
65 cout << "SSDDA data are saved in " << dafname << endl;
c4d90345 66 status = daqDA_FES_storeFile(dafname, "DASSD_DB_results");
a69c8ba0 67 if (status) fprintf(stderr, "Failed to export file : %d\n", status);
68 } else cerr << "Error saving DA data to the file! Probably $DA_TEST_DIR defined incorrectly!" << endl;
fc566f79 69 feefname.Form("%s/ssddaldc_%i_%i.root", ".", ssddaldc->GetLdcId(), ssddaldc->GetRunId());
a69c8ba0 70 cout << "Saving feessdda data in " << feefname << endl;
71 TFile *fileRun = new TFile (feefname.Data(),"RECREATE");
72 if (fileRun->IsZombie()) {
73 cerr << "Error open file " << feefname << endl;
74 delete ssddaldc;
75 delete fileRun;
76 return 2;
77 }
78 ssddaldc->Write();
79 fileRun->Close();
80 delete fileRun;
81
82 if (getenv("DATE_DB_DIR")) {
83 cmddbsave.Form("$DATE_DB_DIR/daqDetDB_store ssddaldc_%i.root %s", ssddaldc->GetLdcId(), feefname.Data());
84 status = system(cmddbsave.Data());
85 if (status) fprintf(stderr, "Failed to export file to the detector db: %d, %s \n",status, cmddbsave.Data());
86 cmddbsave.Form("$DATE_DB_DIR/daqDetDB_store ssddaldc_%i_%i.root %s",
87 ssddaldc->GetLdcId(), ssddaldc->GetRunId(), feefname.Data());
88 status = system(cmddbsave.Data());
89 if (status) fprintf(stderr, "Failed to export file to the detector db: %d, %s \n",status, cmddbsave.Data());
90 } else cerr << "Error main(): $DATE_DB_DIR is not defined!" << endl;
c4d90345 91
f67db810 92 delete ssddaldc;
93 daqDA_progressReport(100);
94 return 0;
a69c8ba0 95}