3 * Example macro to run the HLT Conformal mapping tracker embedded into
4 * AliRoot reconstruction. The reconstruction is done from the TPC raw
9 * aliroot -b -q rec-hlt-tpc.C | tee rec-hlt-tpc.log
10 * aliroot -b -q rec-hlt-tpc.C'("./","decoder All")' | tee rec-hlt-tpc.log
13 * The macro asumes raw data to be available in the rawx folders, either
14 * simulated or real data. A different input can be specified as parameter
16 * aliroot -b -q rec-hlt-tpc.C'("input.root")'
19 * The second parameter changes which clusterfinder you use:
20 * - decoder, uses TPCClusterFinderDecoder. This is default.
21 * - packed, uses TPCClusterFinderPacked
23 * Also in the second parameter you can set which output you would like to have:
24 * - ESD, gives you an ESD file. This is default.
25 * - TrackHistogram, will run the TrackHistogram component, and give
26 * root files with histograms.
27 * - TrackDump, dumps the track struct to a text file.
28 * - ClusterHisto, gives you histograms of the cluster.
29 * - ClusterDump, dumps the cluster struct to text flie.
30 * - All, gives you all 3 output.
32 * In the first section, an analysis chain is defined. The scale of the
33 * chain can be defined by choosing the range of sectors and partitions.
35 * The reconstruction is steered by the AliReconstruction object in the
39 * @author Matthias.Richter@ift.uib.no
41 void rec_hlt_tpc(const char* input="./", char* opt="decoder ESD")
44 if(!gSystem->AccessPathName("galice.root")){
45 cerr << "please delete the galice.root or run at different place." << endl;
50 cerr << "please specify input or run without arguments" << endl;
54 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 // init the HLT system in order to define the analysis chain below
58 AliHLTSystem* gHLT=AliHLTPluginBase::GetInstance();
60 ///////////////////////////////////////////////////////////////////////////////////////////////////
62 // Setting up which output to give
64 Bool_t bUseClusterFinderDecoder=kTRUE;
65 TString option="libAliHLTUtil.so libAliHLTRCU.so libAliHLTTPC.so loglevel=0x7c chains=";
66 Bool_t esdout=kFALSE, dumpout=kFALSE, histout=kFALSE, chout=kFALSE, cdout=kFALSE;
69 TObjArray* pTokens=allArgs.Tokenize(" ");
71 for (int i=0; i<pTokens->GetEntries(); i++) {
72 argument=((TObjString*)pTokens->At(i))->GetString();
73 if (argument.IsNull()) continue;
75 if (argument.Contains("-statistics=")) {
76 argument.ReplaceAll("-statistics=", "");
77 if (argument.Contains("root")) {
78 if (option.Length()>0) option+=",";
81 if (argument.Contains("raw")) {
82 if (option.Length()>0) option+=",";
87 if (argument.CompareTo("decoder",TString::kIgnoreCase)==0) {
88 bUseClusterFinderDecoder = kTRUE;
91 if (argument.CompareTo("packed",TString::kIgnoreCase)==0) {
92 bUseClusterFinderDecoder = kFALSE;
95 if (argument.CompareTo("trackhistogram",TString::kIgnoreCase)==0) {
97 if (option.Length()>0) option+=",";
101 if (argument.CompareTo("trackdump",TString::kIgnoreCase)==0) {
103 if (option.Length()>0) option+=",";
107 if (argument.CompareTo("esd",TString::kIgnoreCase)==0) {
109 if (option.Length()>0) option+=",";
113 if (argument.CompareTo("clusterdump",TString::kIgnoreCase)==0) {
115 if (option.Length()>0) option+=",";
119 if (argument.CompareTo("clusterhisto",TString::kIgnoreCase)==0) {
121 if (option.Length()>0) option+=",";
125 if (argument.CompareTo("all",TString::kIgnoreCase)==0) {
131 if (option.Length()>0) option+=",";
132 option+="sink1,histFile,dump,cdump,chhisto";
140 if (!histout && !dumpout && !esdout && !chout && !cdout) {
141 cout << "you need to specify an output option, on or more out of: ESD, TrackHistogram, TrackDump, ClusterHisto, ClusterDump" << endl;
144 if ((option.Contains("statroot") || option.Contains("statraw")) && !esdout) {
145 cout << "!!!!!!!! Warning: HLT statistics are only collected for output type ESD !!!!!!!!" << endl;
148 ///////////////////////////////////////////////////////////////////////////////////////////////////
150 // define the analysis chain to be run
159 TString histogramHandlerInputClusterFinder;
161 for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
162 TString trackerInput;
163 for (int part=iMinPart; part<=iMaxPart; part++) {
164 TString arg, publisher, cf;
165 TString clusterHistoOutput;
166 // raw data publisher components
168 if (part>1) ddlno+=72+4*slice+(part-2);
169 else ddlno+=2*slice+part;
170 arg.Form("-minid %d -datatype 'DDL_RAW ' 'TPC ' -dataspec 0x%02x%02x%02x%02x -verbose", ddlno, slice, slice, part, part);
171 publisher.Form("DP_%02d_%d", slice, part);
172 AliHLTConfiguration pubconf(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
174 // cluster finder components
175 cf.Form("CF_%02d_%d", slice, part);
176 if (bUseClusterFinderDecoder) {
177 AliHLTConfiguration cfconf(cf.Data(), "TPCClusterFinderDecoder", publisher.Data(), "-timebins 1001");
179 AliHLTConfiguration cfconf(cf.Data(), "TPCClusterFinderPacked", publisher.Data(), "-timebins 1001 -sorted");
181 if (trackerInput.Length()>0) trackerInput+=" ";
183 if (writerInput.Length()>0) writerInput+=" ";
185 if (histoInput.Length()>0) histoInput+=" ";
187 if (cdumpInput.Length()>0) cdumpInput+=" ";
191 clusterHistoOutput.Form("CH_%02d_%d", slice, part);
192 AliHLTConfiguration cfconf(clusterHistoOutput.Data(), "TPCClusterHisto", cf.Data(), "");
193 if (histogramHandlerInputClusterFinder.Length()>0) histogramHandlerInputClusterFinder+=" ";
194 histogramHandlerInputClusterFinder+=clusterHistoOutput;
198 // tracker finder components
199 tracker.Form("TR_%02d", slice);
200 AliHLTConfiguration trackerconf(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "-pp-run -solenoidBz 0.5");
201 if (writerInput.Length()>0) writerInput+=" ";
202 writerInput+=tracker;
203 if (mergerInput.Length()>0) mergerInput+=" ";
204 mergerInput+=tracker;
205 //add all slice tracks to histo input
206 //if (histoInput.Length()>0) histoInput+=" ";
207 //histoInput+=tracker;
210 // GlobalMerger component
211 AliHLTConfiguration mergerconf("globalmerger","TPCGlobalMerger",mergerInput.Data(),"");
213 //add all global tracks to histo input
214 if (histoInput.Length()>0) histoInput+=" ";
215 histoInput+="globalmerger";
217 // specify whether to write all blocks separately or merge the tracks
218 // and convert to ESD
219 bool writeBlocks=false;
223 // the writer configuration
224 AliHLTConfiguration fwconf("sink1", "FileWriter" , writerInput.Data(), "-specfmt=_%d -subdir=out_%d -blcknofmt=_0x%x -idfmt=_0x%08x");
227 //AliHLTConfiguration sink("sink1", "TPCEsdWriter" , "globalmerger", "-datafile AliHLTESDs.root");
229 // the esd converter configuration
230 AliHLTConfiguration esdcconf("esd-converter", "TPCEsdConverter" , "globalmerger", "");
232 // the root file writer configuration
233 AliHLTConfiguration sink("sink1", "EsdCollector" , "esd-converter", "-directory hlt-tpc-esd");
235 // optional component statistics
236 AliHLTConfiguration statroot("statroot", "StatisticsCollector" , "esd-converter", "-file HLT.statistics.root -publish 0");
237 AliHLTConfiguration statraw("statraw", "FileWriter" , "esd-converter", "-datatype COMPSTAT PRIV -datafile HLT.statistics.raw -concatenate-blocks -concatenate-events");
240 //Chain with Track Histogram
242 AliHLTConfiguration histoconf("histo","TPCTrackHisto",histoInput.Data(),"");
243 AliHLTConfiguration fwconf("histFile", "ROOTFileWriter" , "histo", "-datafile TrackHisto -concatenate-events -overwrite");
245 //Chain with Track Dump
247 AliHLTConfiguration dumpconf("dump","TPCTrackDump","globalmerger","-directory TrackDump");
250 AliHLTConfiguration cfconf("HHCF", "TPCHistogramHandler", histogramHandlerInputClusterFinder.Data(), "-use-general");
251 AliHLTConfiguration rootFileWriterClusters("chhisto", "ROOTFileWriter", "HHCF" , "-datafile histogramHandlerClusterFinder -concatenate-events -overwrite");
254 AliHLTConfiguration cdumpconf("cdump","TPCClusterDump",cdumpInput.Data(),"-directory ClusterDump");
258 ///////////////////////////////////////////////////////////////////////////////////////////////////
260 // Init and run the reconstruction
261 // All but HLT reconstructio is switched off
263 AliReconstruction rec;
265 rec.SetRunVertexFinder(kFALSE);
266 rec.SetRunLocalReconstruction("HLT");
267 rec.SetRunTracking("");
268 rec.SetLoadAlignFromCDB(0);
271 // NOTE: FillESD is a step in the AliReconstruction sequence and has
272 // nothing to do with the fact that this macro writes ESD output
273 // HLT processes the HLTOUT during FillESD and extracts data which
274 // has already been prepared. This step is currently not necessary for
277 rec.SetOption("HLT", option);