]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/global/macros/rec-hlt-global-merger.C
add SPD to plots
[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   AliHLTSystem* gHLT=AliHLTPluginBase::GetInstance();
47   gHLT->SetGlobalLoggingLevel(0x4); 
48   /*  enum AliHLTComponentLogSeverity {       
49       kHLTLogNone      = 0,
50       kHLTLogBenchmark = 0x1,
51       kHLTLogDebug     = 0x2,
52       kHLTLogInfo      = 0x4,
53       kHLTLogWarning   = 0x8,
54       kHLTLogError     = 0x10,
55       kHLTLogFatal     = 0x20,      
56       few important messages not to be filtered out.
57       redirected to kHLTLogInfo in AliRoot
58       kHLTLogImportant = 0x40,
59       special value to enable all messages 
60       kHLTLogAll       = 0x7f,
61       the default logging filter 
62       kHLTLogDefault   = 0x79
63       useful           = 0x45
64   */
65
66   // set TPC debug stream level
67   AliTPCReconstructor::SetStreamLevel(1);
68
69   //gHLT->LoadComponentLibraries("libAliHLTUtil.so libAliHLTRCU.so libAliHLTTRD.so libAliHLTTPC.so libAliHLTGlobal.so");
70
71   ///////////////////////////////////////////////////////////////////////////////////////////////////
72   //
73   // define the analysis chain to be run
74   //
75
76   //  Global merger
77   TString globalmergerInput;
78
79   // TPC
80   int iMinSlice=0;
81   int iMaxSlice=35;
82   //int iMaxSlice=17;
83   int iMinPart=0;
84   int iMaxPart=5;
85
86   TString writerInput;
87   TString mergerInput;
88   for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
89     TString trackerInput;
90     for (int part=iMinPart; part<=iMaxPart; part++) {
91       TString arg, publisher, cf;
92
93       // raw data publisher components
94       int ddlno=768;
95       if (part>1) ddlno+=72+4*slice+(part-2);
96       else ddlno+=2*slice+part;
97       arg.Form("-minid %d -datatype 'DDL_RAW ' 'TPC '  -dataspec 0x%02x%02x%02x%02x -verbose", ddlno, slice, slice, part, part);
98       publisher.Form("DP_%02d_%d", slice, part);
99       AliHLTConfiguration pubconf(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
100
101       // cluster finder components
102       cf.Form("CF_%02d_%d",slice,part);
103       if (bUseClusterFinderDecoder) {
104         AliHLTConfiguration cfconf(cf.Data(), "TPCClusterFinderDecoder", publisher.Data(), "-timebins 446");
105       } else {
106         AliHLTConfiguration cfconf(cf.Data(), "TPCClusterFinderPacked", publisher.Data(), "-timebins 446 -sorted");
107       }
108       if (trackerInput.Length()>0) trackerInput+=" ";
109       trackerInput+=cf;
110       if (writerInput.Length()>0) writerInput+=" ";
111       writerInput+=cf;
112     }
113     TString tracker;
114     // tracker finder components
115     tracker.Form("TR_%02d",slice);
116     AliHLTConfiguration trackerconf(tracker.Data(), "TPCCATracker", trackerInput.Data(), "-solenoidBz 5");
117     if (writerInput.Length()>0) writerInput+=" ";
118     writerInput+=tracker;
119     if (mergerInput.Length()>0) mergerInput+=" ";
120     mergerInput+=tracker;
121   }
122   // TPC GlobalMerger component
123   AliHLTConfiguration mergerconf("globalmerger","TPCGlobalMerger",mergerInput.Data(),"");
124
125   //
126   // TRD
127   //
128   int iMinSlice=0;
129   int iMaxSlice=17;
130   //int iMaxSlice=8;
131
132   TString writerInput1;
133   TString mergerInput1;
134   for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
135     //TString trackerInput1;
136     TString arg1, publisher1, cf1;
137
138     // raw data publisher components
139     int ddlno=1024;
140     ddlno += slice;
141
142     arg1.Form("-minid %d -datatype 'DDL_RAW ' 'TRD ' -verbose", ddlno);
143     publisher1.Form("DP1_%02d", slice);
144     AliHLTConfiguration pubconf(publisher1.Data(), "AliRawReaderPublisher", NULL , arg1.Data());
145
146     //arg1.Form("-datatype 'DDL_RAW ' 'TRD ' -datafile raw0/TRD_%d.ddl", ddlno);
147     //publisher1.Form("DP1_%02d",slice);
148     //AliHLTConfiguration pubconf(publisher1.Data(), "FilePublisher", NULL , arg.Data());
149     //cout << arg.Data() << endl; 
150
151     // cluster finder components
152     cf1.Form("CF1_%02d",slice);
153     AliHLTConfiguration cfconf(cf1.Data(), "TRDClusterizer", publisher1.Data(), "output_percentage 1000 -geometry geometry.root -lowflux -simulation");
154
155     // tracker finder components
156     TString tracker1;
157     tracker1.Form("TR1_%02d",slice);
158     AliHLTConfiguration trackerconf(tracker1.Data(), "TRDTrackerV1", cf1.Data(), "output_percentage 300 -NTimeBins 24 -magnetic_field_ON -lowflux -geometry geometry.root");
159
160     if (writerInput1.Length()>0) writerInput1+=" ";
161     writerInput1+=tracker1;
162
163     if (mergerInput1.Length()>0) mergerInput1+=" ";
164     mergerInput1 += tracker1;
165   }
166
167   if (globalmergerInput.Length()>0) globalmergerInput+=" ";
168   globalmergerInput += "globalmerger";
169
170   if (globalmergerInput.Length()>0) globalmergerInput+=" ";
171   globalmergerInput += mergerInput1;
172
173   //TString datatype = "sim";
174   //AliHLTConfiguration HWriterTR( "HWriterTR", "FileWriter", writerInput.Data(), "-directory . -datafile tr_" + datatype + ".out");
175   
176   //GlobalTrackMerger component
177   AliHLTConfiguration gtrackmergerconf("gtrackmerger","GlobalTrackMerger",globalmergerInput.Data(),"");
178
179   // the root file writer configuration
180   AliHLTConfiguration sink("sink1", "EsdCollector" , "gtrackmerger" , "-directory hlt-global-track");
181
182   ///////////////////////////////////////////////////////////////////////////////////////////////////
183   //
184   // Init and run the reconstruction
185   // All but HLT reconstructio is switched off
186   //
187   AliReconstruction rec;
188   rec.SetInput(input);
189   rec.SetRunVertexFinder(kFALSE);
190   rec.SetRunLocalReconstruction("HLT");
191   rec.SetRunTracking("");
192   rec.SetLoadAlignFromCDB(0);
193   rec.SetRunQA(":");
194   rec.SetFillESD("HLT");
195   rec.SetOption("HLT", "libAliHLTUtil.so libAliHLTRCU.so libAliHLTTRD.so libAliHLTTPC.so libAliHLTGlobal.so chains=sink1");
196   rec.Run();
197 }