Bug fixed in copy ctor + small mods (obsolete lines removed).
[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()");
0e9547f1 37
38
5fee0a18 39 Bool_t diagnostics = kFALSE;
0e9547f1 40 Char_t* fileName = argv[1];
5fee0a18 41 TString secondArgument(argv[2]);
0e9547f1 42
408bf2b4 43 for (int i = 2; i < argc; i++) {
44 TString arg(argv[i]);
45 if (arg.Contains("--diagnostics=true")) diagnostics = kTRUE;
46 else if (arg.Contains("--help")) {
47 std::cout << "Usage: " << argv[0] << " FILENAME [OPTIONS]\n\n"
48 << "Options:\n"
49 << " --diagnostics=BOOL Make diagnostics ROOT file\n"
50 << std::endl;
51 return 0;
52 }
53 else {
54 std::cerr << "Unknown option: " << arg << "\n"
55 << "Try '" << argv[0] << " --help" << std::endl;
56 return 1;
57 }
5fee0a18 58 }
408bf2b4 59 Bool_t old = kTRUE;
0e9547f1 60
61 AliFMDParameters::Instance()->Init(kFALSE,0);
0e9547f1 62
63 //This will only work for FDR 1 data. When newer data becomes available the ! must be removed!
40036ce9 64 AliFMDParameters::Instance()->UseCompleteHeader(old);
0e9547f1 65
1f12303f 66 AliLog::EnableDebug(kFALSE);
0e9547f1 67
5fee0a18 68 AliRawReader *reader = 0;
69 TString fileNam(fileName);
40036ce9 70 if (fileNam.EndsWith(".root"))
71 reader = new AliRawReaderRoot(fileName);
6d237bb1 72 else reader = new AliRawReaderDate(fileName);
5fee0a18 73 if (!reader) {
74 std::cerr << "Don't know how to make reader for " << fileNam
75 << std::endl;
76 return -2;
77 }
40036ce9 78
0e9547f1 79
0e9547f1 80 TStopwatch timer;
81 timer.Start();
82 AliFMDGainDA gainDA;
5fee0a18 83 gainDA.SetSaveDiagnostics(diagnostics);
0e9547f1 84 gainDA.Run(reader);
85
86 timer.Stop();
87 timer.Print();
5fee0a18 88
89 Int_t retvalConditions = daqDA_FES_storeFile("conditions.csv", AliFMDParameters::Instance()->GetConditionsShuttleID());
90 Int_t retvalGain = daqDA_FES_storeFile("gains.csv", AliFMDParameters::Instance()->GetGainShuttleID());
0e9547f1 91
5fee0a18 92 if(retvalConditions!=0 || retvalGain!=0)
93 std::cerr << "Pedestal DA failed" << std::endl;
94
95 if(retvalGain != 0) return retvalGain;
96 else return retvalConditions;
97
0e9547f1 98
99
100
101}