]>
Commit | Line | Data |
---|---|---|
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 | |
8 | DA Type: LDC | |
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> | |
15 | #include <TString.h> | |
16 | #include <AliFMDParameters.h> | |
17 | #include <AliRawReader.h> | |
18 | #include <TStopwatch.h> | |
19 | #include <AliFMDGainDA.h> | |
20 | #include <AliRawReaderDate.h> | |
21 | #include <AliRawReaderRoot.h> | |
22 | #include <AliLog.h> | |
23 | #include "daqDA.h" | |
24 | #include "TROOT.h" | |
25 | #include "TPluginManager.h" | |
26 | ||
27 | ||
28 | ||
29 | int main(int argc, char **argv) | |
30 | { | |
31 | ||
32 | gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo", | |
33 | "*", | |
34 | "TStreamerInfo", | |
35 | "RIO", | |
36 | "TStreamerInfo()"); | |
37 | gROOT->GetPluginManager()->AddHandler("ROOT::Math::Minimizer", "Minuit", | |
38 | "TMinuitMinimizer", | |
39 | "Minuit", | |
40 | "TMinuitMinimizer(const char *)"); | |
41 | gROOT->GetPluginManager()->AddHandler("ROOT::Math::Minimizer", | |
42 | "GSLMultiMin", | |
43 | "ROOT::Math::GSLMinimizer", | |
44 | "MathMore", | |
45 | "GSLMinimizer(const char *)"); | |
46 | gROOT->GetPluginManager()->AddHandler("ROOT::Math::Minimizer", | |
47 | "GSLMultiFit", | |
48 | "ROOT::Math::GSLNLSMinimizer", | |
49 | "MathMore", "GSLNLSMinimizer(int)"); | |
50 | gROOT->GetPluginManager()->AddHandler("ROOT::Math::Minimizer", | |
51 | "GSLSimAn", | |
52 | "ROOT::Math::GSLSimAnMinimizer", | |
53 | "MathMore", | |
54 | "GSLSimAnMinimizer(int)"); | |
55 | gROOT->GetPluginManager()->AddHandler("ROOT::Math::Minimizer", | |
56 | "Linear", | |
57 | "TLinearMinimizer", | |
58 | "Minuit", | |
59 | "TLinearMinimizer(const char *)"); | |
60 | gROOT->GetPluginManager()->AddHandler("ROOT::Math::Minimizer", | |
61 | "Fumili", | |
62 | "TFumiliMinimizer", | |
63 | "Fumili", | |
64 | "TFumiliMinimizer(int)"); | |
65 | ||
66 | ||
67 | Bool_t diagnostics = kFALSE; | |
68 | Char_t* fileName = argv[1]; | |
69 | TString secondArgument(argv[2]); | |
70 | ||
71 | for (int i = 2; i < argc; i++) { | |
72 | TString arg(argv[i]); | |
73 | if (arg.Contains("--diagnostics=true")) diagnostics = kTRUE; | |
74 | else if (arg.Contains("--help")) { | |
75 | std::cout << "Usage: " << argv[0] << " FILENAME [OPTIONS]\n\n" | |
76 | << "Options:\n" | |
77 | << " --diagnostics=BOOL Make diagnostics ROOT file\n" | |
78 | << std::endl; | |
79 | return 0; | |
80 | } | |
81 | else { | |
82 | std::cerr << "Unknown option: " << arg << "\n" | |
83 | << "Try '" << argv[0] << " --help" << std::endl; | |
84 | return 1; | |
85 | } | |
86 | } | |
87 | Bool_t old = kTRUE; | |
88 | ||
89 | AliFMDParameters::Instance()->Init(kFALSE,0); | |
90 | ||
91 | //This will only work for FDR 1 data. When newer data becomes available the ! must be removed! | |
92 | AliFMDParameters::Instance()->UseCompleteHeader(old); | |
93 | ||
94 | AliLog::EnableDebug(kFALSE); | |
95 | ||
96 | AliRawReader *reader = 0; | |
97 | TString fileNam(fileName); | |
98 | if (fileNam.EndsWith(".root")) | |
99 | reader = new AliRawReaderRoot(fileName); | |
100 | else reader = new AliRawReaderDate(fileName); | |
101 | if (!reader) { | |
102 | std::cerr << "Don't know how to make reader for " << fileNam | |
103 | << std::endl; | |
104 | return -2; | |
105 | } | |
106 | ||
107 | ||
108 | TStopwatch timer; | |
109 | timer.Start(); | |
110 | AliFMDGainDA gainDA; | |
111 | gainDA.SetSaveDiagnostics(diagnostics); | |
112 | gainDA.Run(reader); | |
113 | ||
114 | timer.Stop(); | |
115 | timer.Print(); | |
116 | ||
117 | Int_t retvalConditions = daqDA_FES_storeFile("conditions.csv", AliFMDParameters::Instance()->GetConditionsShuttleID()); | |
118 | Int_t retvalGain = daqDA_FES_storeFile("gains.csv", AliFMDParameters::Instance()->GetGainShuttleID()); | |
119 | ||
120 | if(retvalConditions!=0 || retvalGain!=0) | |
121 | std::cerr << "Pedestal DA failed" << std::endl; | |
122 | ||
123 | if(retvalGain != 0) return retvalGain; | |
124 | else return retvalConditions; | |
125 | ||
126 | ||
127 | ||
128 | ||
129 | } |