In AliMUONChamberCalibrationTask:
[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
5fee0a18 43 if(secondArgument.Contains("--diagnostics=true"))
44 diagnostics = kTRUE;
45 if(secondArgument.Contains("--help")) {
46 std::cout<<"Usage: filename --diagnostics=true/false . --help this help"<<std::endl;
47 return 0;
48 }
c92226fa 49 if(!secondArgument.IsWhitespace()&& !secondArgument.Contains("--help")
50 && !secondArgument.Contains("--diagnostics=true")) {
5fee0a18 51 std::cout<<"Second argument wrong. Use --help"<<std::endl;
52 return -1;
53 }
54
55 Bool_t old = kTRUE;
0e9547f1 56
57 AliFMDParameters::Instance()->Init(kFALSE,0);
0e9547f1 58
59 //This will only work for FDR 1 data. When newer data becomes available the ! must be removed!
40036ce9 60 AliFMDParameters::Instance()->UseCompleteHeader(old);
0e9547f1 61
1f12303f 62 AliLog::EnableDebug(kFALSE);
0e9547f1 63
5fee0a18 64 AliRawReader *reader = 0;
65 TString fileNam(fileName);
40036ce9 66 if (fileNam.EndsWith(".root"))
67 reader = new AliRawReaderRoot(fileName);
6d237bb1 68 else reader = new AliRawReaderDate(fileName);
5fee0a18 69 if (!reader) {
70 std::cerr << "Don't know how to make reader for " << fileNam
71 << std::endl;
72 return -2;
73 }
40036ce9 74
0e9547f1 75
0e9547f1 76 TStopwatch timer;
77 timer.Start();
78 AliFMDGainDA gainDA;
5fee0a18 79 gainDA.SetSaveDiagnostics(diagnostics);
0e9547f1 80 gainDA.Run(reader);
81
82 timer.Stop();
83 timer.Print();
5fee0a18 84
85 Int_t retvalConditions = daqDA_FES_storeFile("conditions.csv", AliFMDParameters::Instance()->GetConditionsShuttleID());
86 Int_t retvalGain = daqDA_FES_storeFile("gains.csv", AliFMDParameters::Instance()->GetGainShuttleID());
0e9547f1 87
5fee0a18 88 if(retvalConditions!=0 || retvalGain!=0)
89 std::cerr << "Pedestal DA failed" << std::endl;
90
91 if(retvalGain != 0) return retvalGain;
92 else return retvalConditions;
93
0e9547f1 94
95
96
97}