]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/global/macros/rec-hlt-global-merger.C
The present commit corresponds to an important change in the way the
[u/mrichter/AliRoot.git] / HLT / global / macros / rec-hlt-global-merger.C
1 // $Id$
2 /*
3  * Example macro to run the HLT global track merger embedded
4  * into AliRoot reconstruction. The reconstruction is done from the raw data.
5  *
6  * Usage:
7  * <pre>
8  *   aliroot -b -q rec-hlt-global-merger.C | tee rec-hlt-global-merger.log
9  * </pre>
10  *
11  * The chain to be run is defined by the macro given to the parameter
12  * 'config='
13  *
14  * The macro asumes raw data to be available in the rawx folders, either
15  * simulated or real data. A different input can be specified as parameter
16  * <pre>
17  *   aliroot -b -q rec-hlt-global-merger.C'("input.root")'
18  * </pre>
19  *
20  * By the second parameter the digit reader can be chosen, default is
21  * AliHLTTPCDigitReaderPacked (=false). Set to true to use
22  * AliHLTTPCDigitReaderDecoder
23  *
24  * In the first section, an analysis chain is defined. The scale of the
25  * chain can be defined by choosing the range of sectors and partitions.
26  *
27  * The reconstruction is steered by the AliReconstruction object in the
28  * usual way.
29  *
30  * @ingroup alihlt_global
31  * @author 
32  */
33 void rec_hlt_global_merger(const char* input="./", bool bUseClusterFinderDecoder=true)
34 {
35   if (!input) {
36     cerr << "please specify input or run without arguments" << endl;
37     return;
38   }
39
40   gSystem->Exec("rm galice.root");
41
42   ///////////////////////////////////////////////////////////////////////////////////////////////////
43   //
44   // init the HLT system in order to define the analysis chain below
45   //
46   gSystem->Load("libHLTrec.so");
47   AliHLTSystem* gHLT=AliHLTReconstructorBase::GetInstance();
48   gHLT->SetGlobalLoggingLevel(0x4); 
49   /*  enum AliHLTComponentLogSeverity {       
50       kHLTLogNone      = 0,
51       kHLTLogBenchmark = 0x1,
52       kHLTLogDebug     = 0x2,
53       kHLTLogInfo      = 0x4,
54       kHLTLogWarning   = 0x8,
55       kHLTLogError     = 0x10,
56       kHLTLogFatal     = 0x20,      
57       few important messages not to be filtered out.
58       redirected to kHLTLogInfo in AliRoot
59       kHLTLogImportant = 0x40,
60       special value to enable all messages 
61       kHLTLogAll       = 0x7f,
62       the default logging filter 
63       kHLTLogDefault   = 0x79
64       useful           = 0x45
65   */
66
67   // set TPC debug stream level
68   AliTPCReconstructor::SetStreamLevel(1);
69
70   //gHLT->LoadComponentLibraries("libAliHLTUtil.so libAliHLTRCU.so libAliHLTTRD.so libAliHLTTPC.so libAliHLTGlobal.so");
71
72   ///////////////////////////////////////////////////////////////////////////////////////////////////
73   //
74   // define the analysis chain to be run
75   //
76
77   //  Global merger
78   TString globalmergerInput;
79
80   // TPC
81   int iMinSlice=0;
82   int iMaxSlice=35;
83   //int iMaxSlice=17;
84   int iMinPart=0;
85   int iMaxPart=5;
86
87   TString writerInput;
88   TString mergerInput;
89   for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
90     TString trackerInput;
91     for (int part=iMinPart; part<=iMaxPart; part++) {
92       TString arg, publisher, cf;
93
94       // raw data publisher components
95       int ddlno=768;
96       if (part>1) ddlno+=72+4*slice+(part-2);
97       else ddlno+=2*slice+part;
98       arg.Form("-minid %d -datatype 'DDL_RAW ' 'TPC '  -dataspec 0x%02x%02x%02x%02x -verbose", ddlno, slice, slice, part, part);
99       publisher.Form("DP_%02d_%d", slice, part);
100       AliHLTConfiguration pubconf(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
101
102       // cluster finder components
103       cf.Form("CF_%02d_%d",slice,part);
104       if (bUseClusterFinderDecoder) {
105         AliHLTConfiguration cfconf(cf.Data(), "TPCClusterFinderDecoder", publisher.Data(), "-timebins 446");
106       } else {
107         AliHLTConfiguration cfconf(cf.Data(), "TPCClusterFinderPacked", publisher.Data(), "-timebins 446 -sorted");
108       }
109       if (trackerInput.Length()>0) trackerInput+=" ";
110       trackerInput+=cf;
111       if (writerInput.Length()>0) writerInput+=" ";
112       writerInput+=cf;
113     }
114     TString tracker;
115     // tracker finder components
116     tracker.Form("TR_%02d",slice);
117     AliHLTConfiguration trackerconf(tracker.Data(), "TPCCATracker", trackerInput.Data(), "-solenoidBz 5");
118     if (writerInput.Length()>0) writerInput+=" ";
119     writerInput+=tracker;
120     if (mergerInput.Length()>0) mergerInput+=" ";
121     mergerInput+=tracker;
122   }
123   // TPC GlobalMerger component
124   AliHLTConfiguration mergerconf("globalmerger","TPCGlobalMerger",mergerInput.Data(),"");
125
126   //
127   // TRD
128   //
129   int iMinSlice=0;
130   int iMaxSlice=17;
131   //int iMaxSlice=8;
132
133   TString writerInput1;
134   TString mergerInput1;
135   for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
136     //TString trackerInput1;
137     TString arg1, publisher1, cf1;
138
139     // raw data publisher components
140     int ddlno=1024;
141     ddlno += slice;
142
143     arg1.Form("-minid %d -datatype 'DDL_RAW ' 'TRD ' -verbose", ddlno);
144     publisher1.Form("DP1_%02d", slice);
145     AliHLTConfiguration pubconf(publisher1.Data(), "AliRawReaderPublisher", NULL , arg1.Data());
146
147     //arg1.Form("-datatype 'DDL_RAW ' 'TRD ' -datafile raw0/TRD_%d.ddl", ddlno);
148     //publisher1.Form("DP1_%02d",slice);
149     //AliHLTConfiguration pubconf(publisher1.Data(), "FilePublisher", NULL , arg.Data());
150     //cout << arg.Data() << endl; 
151
152     // cluster finder components
153     cf1.Form("CF1_%02d",slice);
154     AliHLTConfiguration cfconf(cf1.Data(), "TRDClusterizer", publisher1.Data(), "output_percentage 1000 -geometry geometry.root -lowflux -simulation");
155
156     // tracker finder components
157     TString tracker1;
158     tracker1.Form("TR1_%02d",slice);
159     AliHLTConfiguration trackerconf(tracker1.Data(), "TRDTrackerV1", cf1.Data(), "output_percentage 300 -NTimeBins 24 -magnetic_field_ON -lowflux -geometry geometry.root");
160
161     if (writerInput1.Length()>0) writerInput1+=" ";
162     writerInput1+=tracker1;
163
164     if (mergerInput1.Length()>0) mergerInput1+=" ";
165     mergerInput1 += tracker1;
166   }
167
168   if (globalmergerInput.Length()>0) globalmergerInput+=" ";
169   globalmergerInput += "globalmerger";
170
171   if (globalmergerInput.Length()>0) globalmergerInput+=" ";
172   globalmergerInput += mergerInput1;
173
174   //TString datatype = "sim";
175   //AliHLTConfiguration HWriterTR( "HWriterTR", "FileWriter", writerInput.Data(), "-directory . -datafile tr_" + datatype + ".out");
176   
177   //GlobalTrackMerger component
178   AliHLTConfiguration gtrackmergerconf("gtrackmerger","GlobalTrackMerger",globalmergerInput.Data(),"");
179
180   // the root file writer configuration
181   AliHLTConfiguration sink("sink1", "EsdCollector" , "gtrackmerger" , "-directory hlt-global-track");
182
183   ///////////////////////////////////////////////////////////////////////////////////////////////////
184   //
185   // Init and run the reconstruction
186   // All but HLT reconstructio is switched off
187   //
188   AliReconstruction rec;
189   rec.SetInput(input);
190   rec.SetRunVertexFinder(kFALSE);
191   rec.SetRunLocalReconstruction("HLT");
192   rec.SetRunTracking("");
193   rec.SetLoadAlignFromCDB(0);
194   rec.SetRunQA(":");
195   rec.SetFillESD("HLT");
196   rec.SetOption("HLT", "libAliHLTUtil.so libAliHLTRCU.so libAliHLTTRD.so libAliHLTTPC.so libAliHLTGlobal.so chains=sink1");
197   rec.Run();
198 }