]>
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 | */ | |
0a8abcad | 14 | #include <Riostream.h> |
0e9547f1 | 15 | #include <TSystem.h> |
5fee0a18 | 16 | #include <TString.h> |
0e9547f1 | 17 | #include <AliFMDParameters.h> |
18 | #include <AliRawReader.h> | |
19 | #include <TStopwatch.h> | |
20 | #include <AliFMDGainDA.h> | |
21 | #include <AliRawReaderDate.h> | |
5fee0a18 | 22 | #include <AliRawReaderRoot.h> |
40036ce9 | 23 | #include <AliLog.h> |
5fee0a18 | 24 | #include "daqDA.h" |
0e9547f1 | 25 | #include "TROOT.h" |
26 | #include "TPluginManager.h" | |
2a082c96 | 27 | #ifdef ALI_AMORE |
28 | # include <AmoreDA.h> | |
29 | # include <TH2.h> | |
30 | #endif | |
0e9547f1 | 31 | |
32 | ||
33 | ||
34 | int main(int argc, char **argv) | |
35 | { | |
36 | ||
0e9547f1 | 37 | gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo", |
38 | "*", | |
39 | "TStreamerInfo", | |
40 | "RIO", | |
41 | "TStreamerInfo()"); | |
276b1261 | 42 | gROOT->GetPluginManager()->AddHandler("ROOT::Math::Minimizer", "Minuit", |
43 | "TMinuitMinimizer", | |
44 | "Minuit", | |
45 | "TMinuitMinimizer(const char *)"); | |
46 | gROOT->GetPluginManager()->AddHandler("ROOT::Math::Minimizer", | |
47 | "GSLMultiMin", | |
48 | "ROOT::Math::GSLMinimizer", | |
49 | "MathMore", | |
50 | "GSLMinimizer(const char *)"); | |
51 | gROOT->GetPluginManager()->AddHandler("ROOT::Math::Minimizer", | |
52 | "GSLMultiFit", | |
53 | "ROOT::Math::GSLNLSMinimizer", | |
54 | "MathMore", "GSLNLSMinimizer(int)"); | |
55 | gROOT->GetPluginManager()->AddHandler("ROOT::Math::Minimizer", | |
56 | "GSLSimAn", | |
57 | "ROOT::Math::GSLSimAnMinimizer", | |
58 | "MathMore", | |
59 | "GSLSimAnMinimizer(int)"); | |
60 | gROOT->GetPluginManager()->AddHandler("ROOT::Math::Minimizer", | |
61 | "Linear", | |
62 | "TLinearMinimizer", | |
63 | "Minuit", | |
64 | "TLinearMinimizer(const char *)"); | |
65 | gROOT->GetPluginManager()->AddHandler("ROOT::Math::Minimizer", | |
66 | "Fumili", | |
67 | "TFumiliMinimizer", | |
68 | "Fumili", | |
69 | "TFumiliMinimizer(int)"); | |
0e9547f1 | 70 | |
71 | ||
5fee0a18 | 72 | Bool_t diagnostics = kFALSE; |
0e9547f1 | 73 | Char_t* fileName = argv[1]; |
5fee0a18 | 74 | TString secondArgument(argv[2]); |
0e9547f1 | 75 | |
408bf2b4 | 76 | for (int i = 2; i < argc; i++) { |
77 | TString arg(argv[i]); | |
78 | if (arg.Contains("--diagnostics=true")) diagnostics = kTRUE; | |
79 | else if (arg.Contains("--help")) { | |
0a8abcad | 80 | cout << "Usage: " << argv[0] << " FILENAME [OPTIONS]\n\n" |
408bf2b4 | 81 | << "Options:\n" |
82 | << " --diagnostics=BOOL Make diagnostics ROOT file\n" | |
0a8abcad | 83 | << endl; |
408bf2b4 | 84 | return 0; |
85 | } | |
86 | else { | |
0a8abcad | 87 | cerr << "Unknown option: " << arg << "\n" |
88 | << "Try '" << argv[0] << " --help" << endl; | |
408bf2b4 | 89 | return 1; |
90 | } | |
5fee0a18 | 91 | } |
408bf2b4 | 92 | Bool_t old = kTRUE; |
0e9547f1 | 93 | |
94 | AliFMDParameters::Instance()->Init(kFALSE,0); | |
0e9547f1 | 95 | |
96 | //This will only work for FDR 1 data. When newer data becomes available the ! must be removed! | |
40036ce9 | 97 | AliFMDParameters::Instance()->UseCompleteHeader(old); |
0e9547f1 | 98 | |
1f12303f | 99 | AliLog::EnableDebug(kFALSE); |
0e9547f1 | 100 | |
5fee0a18 | 101 | AliRawReader *reader = 0; |
102 | TString fileNam(fileName); | |
40036ce9 | 103 | if (fileNam.EndsWith(".root")) |
104 | reader = new AliRawReaderRoot(fileName); | |
6d237bb1 | 105 | else reader = new AliRawReaderDate(fileName); |
5fee0a18 | 106 | if (!reader) { |
0a8abcad | 107 | cerr << "Don't know how to make reader for " << fileNam |
108 | << endl; | |
5fee0a18 | 109 | return -2; |
110 | } | |
40036ce9 | 111 | |
0e9547f1 | 112 | |
0e9547f1 | 113 | TStopwatch timer; |
114 | timer.Start(); | |
115 | AliFMDGainDA gainDA; | |
5fee0a18 | 116 | gainDA.SetSaveDiagnostics(diagnostics); |
2a082c96 | 117 | #ifdef ALI_AMORE |
118 | gainDA.SetMakeSummaries(kTRUE); | |
119 | #endif | |
0e9547f1 | 120 | gainDA.Run(reader); |
121 | ||
122 | timer.Stop(); | |
123 | timer.Print(); | |
5fee0a18 | 124 | |
2a082c96 | 125 | Int_t retvalConditions = |
126 | daqDA_FES_storeFile("conditions.csv", | |
127 | AliFMDParameters::Instance()->GetConditionsShuttleID()); | |
128 | Int_t retvalGain = | |
129 | daqDA_FES_storeFile("gains.csv", | |
130 | AliFMDParameters::Instance()->GetGainShuttleID()); | |
0e9547f1 | 131 | |
5fee0a18 | 132 | if(retvalConditions!=0 || retvalGain!=0) |
0a8abcad | 133 | cerr << "Pedestal DA failed" << endl; |
5fee0a18 | 134 | |
2a082c96 | 135 | #ifdef ALI_AMORE |
136 | try { | |
137 | amore::da::AmoreDA myAmore(amore::da::AmoreDA::kSender); | |
138 | ||
139 | UShort_t det = 0; | |
140 | for (det = 1; det <= 3; det++) | |
141 | if (gainDA.HasSeenDetector(det)) break; | |
142 | if (det >= 1 && det <= 3) { | |
143 | TObject* runNo = new TObject; | |
144 | runNo->SetUniqueID(reader->GetRunNumber()); | |
145 | myAmore.Send(Form("gainRunNoFMD%d", det), runNo); | |
146 | } | |
147 | ||
148 | TIter next(&gainDA.GetSummaries()); | |
149 | TObject* obj = 0; | |
150 | while ((obj = next())) | |
151 | myAmore.Send(obj->GetName(), obj); | |
152 | ||
153 | } | |
0a8abcad | 154 | catch (exception& e) { |
155 | cerr << "Failed to make AMORE instance: " << e.what() << endl; | |
2a082c96 | 156 | } |
157 | ||
158 | #endif | |
159 | ||
5fee0a18 | 160 | if(retvalGain != 0) return retvalGain; |
2a082c96 | 161 | return retvalConditions; |
162 | ||
0e9547f1 | 163 | } |
2a082c96 | 164 | // |
165 | // EOF | |
166 | // | |
167 |