added low and high flux parameters to the array
[u/mrichter/AliRoot.git] / FMD / FMDPedestalda.cxx
CommitLineData
4a243071 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: PEDESTAL
8bd95799 8 DA Type: LDC
4a243071 9 Number of events needed: 1000
10 Input Files: raw data
11 Output Files: peds.csv
12 Trigger types used: PEDESTAL
13*/
24954a29 14#include <iostream>
4a243071 15#include <TSystem.h>
5dd86feb 16#include <TString.h>
4a243071 17#include <AliFMDParameters.h>
18#include <AliRawReader.h>
19#include <TStopwatch.h>
20#include <AliFMDPedestalDA.h>
21#include <AliRawReaderDate.h>
5dd86feb 22#include <AliRawReaderRoot.h>
23#include "daqDA.h"
4a243071 24#include "TROOT.h"
25#include "TPluginManager.h"
24954a29 26#include <AliLog.h>
4a243071 27
28
29int main(int argc, char **argv)
30{
4a243071 31 /* magic line from Rene - for future reference! */
32 gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
24954a29 33 "*",
4a243071 34 "TStreamerInfo",
35 "RIO",
36 "TStreamerInfo()");
24954a29 37
4a243071 38
5dd86feb 39 Bool_t diagnostics = kFALSE;
4a243071 40 Char_t* fileName = argv[1];
5dd86feb 41 TString secondArgument(argv[2]);
42
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 }
4a243071 49
bbafbf2e 50 if(!secondArgument.IsWhitespace() && !secondArgument.Contains("--help")
51 && !secondArgument.Contains("--diagnostics=true")) {
5dd86feb 52 std::cout<<"Second argument wrong. Use --help"<<std::endl;
53 return -1;
54 }
4a243071 55 Bool_t old = kTRUE;
56
1f12303f 57 AliLog::EnableDebug(kFALSE);
4a243071 58 AliFMDParameters::Instance()->Init(kFALSE,0);
4a243071 59 AliFMDParameters::Instance()->UseCompleteHeader(old);
60
5dd86feb 61 AliRawReader *reader = 0;
62 TString fileNam(fileName);
63 if (fileNam.EndsWith(".root")) reader = new AliRawReaderRoot(fileName);
6d237bb1 64 else reader = new AliRawReaderDate(fileName);
5dd86feb 65 if (!reader) {
66 std::cerr << "Don't know how to make reader for " << fileNam
67 << std::endl;
68 return -2;
69 }
4a243071 70 TStopwatch timer;
71 timer.Start();
72 AliFMDPedestalDA pedDA;
5dd86feb 73 pedDA.SetSaveDiagnostics(diagnostics);
4a243071 74 pedDA.Run(reader);
75
76 timer.Stop();
77 timer.Print();
5dd86feb 78
79 Int_t retvalConditions = daqDA_FES_storeFile("conditions.csv", AliFMDParameters::Instance()->GetConditionsShuttleID());
80 Int_t retvalPeds = daqDA_FES_storeFile("peds.csv", AliFMDParameters::Instance()->GetPedestalShuttleID());
4a243071 81
5dd86feb 82 if(retvalConditions!=0 || retvalPeds!=0)
83 std::cerr << "Pedestal DA failed" << std::endl;
4a243071 84
5dd86feb 85 if(retvalPeds != 0) return retvalPeds;
86 else return retvalConditions;
4a243071 87
88}