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