]>
Commit | Line | Data |
---|---|---|
0e9547f1 | 1 | /* |
2 | ||
3 | FMD DA for online calibration of conditions | |
4 | ||
5 | Contact: canute@nbi.dk | |
6 | Link: fmd.nbi.dk/fmd/offline | |
7 | Run Type: GAIN | |
8bd95799 | 8 | DA Type: LDC |
0e9547f1 | 9 | Number of events needed: usually 102400 |
10 | Input Files: raw data | |
11 | Output Files: gains.csv | |
12 | Trigger types used: GAIN | |
13 | */ | |
14 | #include <TSystem.h> | |
5fee0a18 | 15 | #include <TString.h> |
0e9547f1 | 16 | #include <AliFMDParameters.h> |
17 | #include <AliRawReader.h> | |
18 | #include <TStopwatch.h> | |
19 | #include <AliFMDGainDA.h> | |
20 | #include <AliRawReaderDate.h> | |
5fee0a18 | 21 | #include <AliRawReaderRoot.h> |
22 | #include "daqDA.h" | |
0e9547f1 | 23 | #include "TROOT.h" |
24 | #include "TPluginManager.h" | |
25 | ||
26 | ||
27 | ||
28 | int main(int argc, char **argv) | |
29 | { | |
30 | ||
0e9547f1 | 31 | gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo", |
32 | "*", | |
33 | "TStreamerInfo", | |
34 | "RIO", | |
35 | "TStreamerInfo()"); | |
0e9547f1 | 36 | |
37 | ||
5fee0a18 | 38 | Bool_t diagnostics = kFALSE; |
0e9547f1 | 39 | Char_t* fileName = argv[1]; |
5fee0a18 | 40 | TString secondArgument(argv[2]); |
0e9547f1 | 41 | |
5fee0a18 | 42 | if(secondArgument.Contains("--diagnostics=true")) |
43 | diagnostics = kTRUE; | |
44 | if(secondArgument.Contains("--help")) { | |
45 | std::cout<<"Usage: filename --diagnostics=true/false . --help this help"<<std::endl; | |
46 | return 0; | |
47 | } | |
c92226fa | 48 | if(!secondArgument.IsWhitespace()&& !secondArgument.Contains("--help") |
49 | && !secondArgument.Contains("--diagnostics=true")) { | |
5fee0a18 | 50 | std::cout<<"Second argument wrong. Use --help"<<std::endl; |
51 | return -1; | |
52 | } | |
53 | ||
54 | Bool_t old = kTRUE; | |
0e9547f1 | 55 | |
56 | AliFMDParameters::Instance()->Init(kFALSE,0); | |
0e9547f1 | 57 | |
58 | //This will only work for FDR 1 data. When newer data becomes available the ! must be removed! | |
59 | AliFMDParameters::Instance()->UseCompleteHeader(!old); | |
60 | ||
61 | ||
5fee0a18 | 62 | AliRawReader *reader = 0; |
63 | TString fileNam(fileName); | |
64 | if (fileNam.EndsWith(".root")) reader = new AliRawReaderRoot(fileName); | |
65 | else if (fileNam.EndsWith(".raw")) reader = new AliRawReaderDate(fileName); | |
66 | if (!reader) { | |
67 | std::cerr << "Don't know how to make reader for " << fileNam | |
68 | << std::endl; | |
69 | return -2; | |
70 | } | |
0e9547f1 | 71 | |
72 | ||
0e9547f1 | 73 | TStopwatch timer; |
74 | timer.Start(); | |
75 | AliFMDGainDA gainDA; | |
5fee0a18 | 76 | gainDA.SetSaveDiagnostics(diagnostics); |
0e9547f1 | 77 | gainDA.Run(reader); |
78 | ||
79 | timer.Stop(); | |
80 | timer.Print(); | |
5fee0a18 | 81 | |
82 | Int_t retvalConditions = daqDA_FES_storeFile("conditions.csv", AliFMDParameters::Instance()->GetConditionsShuttleID()); | |
83 | Int_t retvalGain = daqDA_FES_storeFile("gains.csv", AliFMDParameters::Instance()->GetGainShuttleID()); | |
0e9547f1 | 84 | |
5fee0a18 | 85 | if(retvalConditions!=0 || retvalGain!=0) |
86 | std::cerr << "Pedestal DA failed" << std::endl; | |
87 | ||
88 | if(retvalGain != 0) return retvalGain; | |
89 | else return retvalConditions; | |
90 | ||
0e9547f1 | 91 | |
92 | ||
93 | ||
94 | } |