adding macro for TRD HLT (Theodor)
[u/mrichter/AliRoot.git] / HLT / TRD / macros / rec-hlt-trd.cxx
CommitLineData
bb90bd84 1// usage: aliroot rec-hlt-trd.cxx("/data/real_runXXX/raw_input.root")
2// or: aliroot rec-hlt-trd.cxx("/data/sim_run/raw.root")
3// or: aliroot rec-hlt-trd.cxx("/data/sim_run/") *
4// or copy into folder and aliroot rec-hlt-trd.cxx
5//
6// (*) here sim_run has as subfolders rawX (be sure to have the last "/" !!)
7
8#if !defined (__CINT__) || defined (__MAKECINT__)
9
10#include <iostream>
11#include <stdlib.h>
12#include <fstream>
13
14#include "TString.h"
15#include "TMath.h"
16
17#include "AliHLTSystem.h"
18#include "AliHLTPluginBase.h"
19#include "AliLog.h"
20#include "AliReconstruction.h"
21#include "AliHLTDataTypes.h"
22#include "AliHLTConfiguration.h"
23
24#include <valgrind/callgrind.h>
25#include <sys/time.h>
26#include "TSystem.h"
27
28#endif
29
30const Bool_t fullTRD=kTRUE;
31
32void rec_hlt_trd(const char* input ="./raw.root");
33int main(int argc, char** argv)
34{
35 if(argc>1) rec_hlt_trd(argv[1]);
36 else rec_hlt_trd();
37}
38
39void rec_hlt_trd(const char* input)
40{
41
42 ///////////////////////////////////////////////////////////////////////////////////////////////////
43 //
44 // define the analysis chain to be run
45 //
46
47 // Is the TRD full?
48 Bool_t fullTRD=kFALSE;
49
50 // If not use these SMs:
51 Int_t TRDmodules[18] = {0,1,7,8,9,10,17,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
52
53 // What chains should be run?
54 TString chains="TRD-OffEsdFile";
55
56 ///////////////////////////////////////////////////////////////////////////////////////////////////
57 //
58 // init the HLT system in order to define the analysis chain below
59 //
60 AliHLTSystem* gHLT=AliHLTPluginBase::GetInstance();
61
62 if(!gSystem->AccessPathName("galice.root")){
63 cerr << "please delete the galice.root or run at different place." << endl;
64 return;
65 }
66
67 TString GRPDir=input;
68 GRPDir.Resize(GRPDir.Last('/')+1);
69 if(GRPDir.Length()==0)GRPDir=gSystem->pwd();
70 printf("GRP dir: %s\n",GRPDir.Data());
71
72 Int_t usedModules=0;
73 if(fullTRD){
74 usedModules = 18;
75 for(int i=0; i<18; i++)
76 TRDmodules[i]=i;
77 }else{
78 for(int i=0; i<18; i++)
79 if(TRDmodules[i]>0)usedModules++;
80 }
81
82 TString option="libAliHLTUtil.so libAliHLTTRD.so libAliHLTGlobal.so libAliHLTTrigger.so loglevel=0x7f chains=";
83 option+=chains;
84 TString nextInput, nextOffInput;
85
86 for (int module = 0; module < usedModules; module++)
87 {
88 TString arg, publisher, cf, tr, trOff;
89 // raw data publisher components
90 publisher.Form("TRD-RP_%02d", module);
91 arg.Form("-minid %d -datatype 'DDL_RAW ' 'TRD ' -dataspec %i -verbose", module+1024, (int)TMath::Power(2,module));
92 AliHLTConfiguration pubConf(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
93
94 // Clusterizer
95 cf.Form("TRD-CF_%02d", module);
96 AliHLTConfiguration cfConf(cf.Data(), "TRDClusterizer", publisher.Data(), "output_percentage 700 -lowflux -simulation -yPosMethod LUT");
97
98 // Tracker
99 tr.Form("TRD-TR_%02d", module);
100 arg.Form("output_percentage 100 -lowflux -PIDmethod NN");
101 AliHLTConfiguration trConf(tr.Data(), "TRDTrackerV1", cf.Data(), arg.Data());
102
103 if (nextInput.Length()>0) nextInput+=" ";
104 nextInput+=tr;
105
106 trOff.Form("TRD-TROFF_%02d", module);
107 AliHLTConfiguration trOffConf(trOff.Data(), "TRDOfflineTrackerV1", cf.Data(), arg.Data());
108
109 if (nextOffInput.Length()>0) nextOffInput+=" ";
110 nextOffInput+=trOff;
111
112 }
113
114 // calibration
115 AliHLTConfiguration calibConf("TRD-Calib", "TRDCalibration", nextInput.Data(), "");
116 AliHLTConfiguration writerCalibConf( "TRD-CalibFile", "ROOTFileWriter", "TRD-Calib", "-directory hlt-trd-calib/ -datafile calib.root");
117
118 // esd converter
119 AliHLTConfiguration esdConf("TRD-Esd", "GlobalEsdConverter", nextInput.Data(), "-notree");
120
121 // root file writer
122 AliHLTConfiguration writerConf("TRD-EsdFile", "EsdCollector", "TRD-Esd", "-directory hlt-trd-esd/");
123
124 // root file writer (with esd friends and some day perhaps MC)
125 AliHLTConfiguration writerOffConf("TRD-OffEsdFile", "TRDEsdWriter", nextOffInput.Data(), "-datafile AliHLTTRDESDs.root -concatenate-events -concatenate-blocks");
126
127 ///////////////////////////////////////////////////////////////////////////////////////////////////
128 //
129 // Init and run the reconstruction
130 // All but HLT reconstructio is switched off
131 //
132 AliReconstruction rec;
133 rec.SetInput(input);
134 rec.SetRunVertexFinder(kFALSE);
135 rec.SetRunLocalReconstruction("HLT");
136 rec.SetRunTracking(":");
137 rec.SetLoadAlignFromCDB(0);
138 rec.SetFillESD("");
139 rec.SetRunQA(":");
140 rec.SetRunGlobalQA(kFALSE);
141 rec.SetFillTriggerESD(kFALSE);
142 rec.SetDefaultStorage("local://$ALICE_ROOT/OCDB");
143 rec.SetSpecificStorage("GRP/GRP/Data", Form("local://%s",GRPDir.Data()));
144 //rec.SetSpecificStorage("GRP/GRP/Data", Form("local://%s",gSystem->pwd()));
145
146 rec.SetOption("HLT", option);
147 rec.Run();
148}