Adding calibration object for the sharing efficiency
[u/mrichter/AliRoot.git] / FMD / FMDGainda.cxx
CommitLineData
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>
40036ce9 22#include <AliLog.h>
5fee0a18 23#include "daqDA.h"
0e9547f1 24#include "TROOT.h"
25#include "TPluginManager.h"
26
27
28
29int main(int argc, char **argv)
30{
31
0e9547f1 32 gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
33 "*",
34 "TStreamerInfo",
35 "RIO",
36 "TStreamerInfo()");
276b1261 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)");
0e9547f1 65
66
5fee0a18 67 Bool_t diagnostics = kFALSE;
0e9547f1 68 Char_t* fileName = argv[1];
5fee0a18 69 TString secondArgument(argv[2]);
0e9547f1 70
408bf2b4 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 }
5fee0a18 86 }
408bf2b4 87 Bool_t old = kTRUE;
0e9547f1 88
89 AliFMDParameters::Instance()->Init(kFALSE,0);
0e9547f1 90
91 //This will only work for FDR 1 data. When newer data becomes available the ! must be removed!
40036ce9 92 AliFMDParameters::Instance()->UseCompleteHeader(old);
0e9547f1 93
1f12303f 94 AliLog::EnableDebug(kFALSE);
0e9547f1 95
5fee0a18 96 AliRawReader *reader = 0;
97 TString fileNam(fileName);
40036ce9 98 if (fileNam.EndsWith(".root"))
99 reader = new AliRawReaderRoot(fileName);
6d237bb1 100 else reader = new AliRawReaderDate(fileName);
5fee0a18 101 if (!reader) {
102 std::cerr << "Don't know how to make reader for " << fileNam
103 << std::endl;
104 return -2;
105 }
40036ce9 106
0e9547f1 107
0e9547f1 108 TStopwatch timer;
109 timer.Start();
110 AliFMDGainDA gainDA;
5fee0a18 111 gainDA.SetSaveDiagnostics(diagnostics);
0e9547f1 112 gainDA.Run(reader);
113
114 timer.Stop();
115 timer.Print();
5fee0a18 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());
0e9547f1 119
5fee0a18 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
0e9547f1 126
127
128
129}