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 gSystem->Load("libHLTrec.so");
59 AliHLTSystem* gHLT=AliHLTReconstructorBase::GetInstance();
61 ///////////////////////////////////////////////////////////////////////////////////////////////////
63 // Setting up which output to give
65 Bool_t bUseClusterFinderDecoder=kTRUE;
66 TString option="libAliHLTUtil.so libAliHLTRCU.so libAliHLTTPC.so loglevel=0x7c chains=";
67 Bool_t esdout=kFALSE, dumpout=kFALSE, histout=kFALSE, chout=kFALSE, cdout=kFALSE;
70 TObjArray* pTokens=allArgs.Tokenize(" ");
72 for (int i=0; i<pTokens->GetEntries(); i++) {
73 argument=((TObjString*)pTokens->At(i))->GetString();
74 if (argument.IsNull()) continue;
76 if (argument.Contains("-statistics=")) {
77 argument.ReplaceAll("-statistics=", "");
78 if (argument.Contains("root")) {
79 if (option.Length()>0) option+=",";
82 if (argument.Contains("raw")) {
83 if (option.Length()>0) option+=",";
88 if (argument.CompareTo("decoder",TString::kIgnoreCase)==0) {
89 bUseClusterFinderDecoder = kTRUE;
92 if (argument.CompareTo("packed",TString::kIgnoreCase)==0) {
93 bUseClusterFinderDecoder = kFALSE;
96 if (argument.CompareTo("trackhistogram",TString::kIgnoreCase)==0) {
98 if (option.Length()>0) option+=",";
102 if (argument.CompareTo("trackdump",TString::kIgnoreCase)==0) {
104 if (option.Length()>0) option+=",";
108 if (argument.CompareTo("esd",TString::kIgnoreCase)==0) {
110 if (option.Length()>0) option+=",";
114 if (argument.CompareTo("clusterdump",TString::kIgnoreCase)==0) {
116 if (option.Length()>0) option+=",";
120 if (argument.CompareTo("clusterhisto",TString::kIgnoreCase)==0) {
122 if (option.Length()>0) option+=",";
126 if (argument.CompareTo("all",TString::kIgnoreCase)==0) {
132 if (option.Length()>0) option+=",";
133 option+="sink1,histFile,dump,cdump,chhisto";
141 if (!histout && !dumpout && !esdout && !chout && !cdout) {
142 cout << "you need to specify an output option, on or more out of: ESD, TrackHistogram, TrackDump, ClusterHisto, ClusterDump" << endl;
145 if ((option.Contains("statroot") || option.Contains("statraw")) && !esdout) {
146 cout << "!!!!!!!! Warning: HLT statistics are only collected for output type ESD !!!!!!!!" << endl;
149 ///////////////////////////////////////////////////////////////////////////////////////////////////
151 // define the analysis chain to be run
160 TString histogramHandlerInputClusterFinder;
162 for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
163 TString trackerInput;
164 for (int part=iMinPart; part<=iMaxPart; part++) {
165 TString arg, publisher, cf;
166 TString clusterHistoOutput;
167 // raw data publisher components
169 if (part>1) ddlno+=72+4*slice+(part-2);
170 else ddlno+=2*slice+part;
171 arg.Form("-minid %d -datatype 'DDL_RAW ' 'TPC ' -dataspec 0x%02x%02x%02x%02x -verbose", ddlno, slice, slice, part, part);
172 publisher.Form("DP_%02d_%d", slice, part);
173 AliHLTConfiguration pubconf(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
175 // cluster finder components
176 cf.Form("CF_%02d_%d", slice, part);
177 if (bUseClusterFinderDecoder) {
178 AliHLTConfiguration cfconf(cf.Data(), "TPCClusterFinderDecoder", publisher.Data(), "-timebins 1001");
180 AliHLTConfiguration cfconf(cf.Data(), "TPCClusterFinderPacked", publisher.Data(), "-timebins 1001 -sorted");
182 if (trackerInput.Length()>0) trackerInput+=" ";
184 if (writerInput.Length()>0) writerInput+=" ";
186 if (histoInput.Length()>0) histoInput+=" ";
188 if (cdumpInput.Length()>0) cdumpInput+=" ";
192 clusterHistoOutput.Form("CH_%02d_%d", slice, part);
193 AliHLTConfiguration cfconf(clusterHistoOutput.Data(), "TPCClusterHisto", cf.Data(), "");
194 if (histogramHandlerInputClusterFinder.Length()>0) histogramHandlerInputClusterFinder+=" ";
195 histogramHandlerInputClusterFinder+=clusterHistoOutput;
199 // tracker finder components
200 tracker.Form("TR_%02d", slice);
201 AliHLTConfiguration trackerconf(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "-pp-run -solenoidBz 0.5");
202 if (writerInput.Length()>0) writerInput+=" ";
203 writerInput+=tracker;
204 if (mergerInput.Length()>0) mergerInput+=" ";
205 mergerInput+=tracker;
206 //add all slice tracks to histo input
207 //if (histoInput.Length()>0) histoInput+=" ";
208 //histoInput+=tracker;
211 // GlobalMerger component
212 AliHLTConfiguration mergerconf("globalmerger","TPCGlobalMerger",mergerInput.Data(),"");
214 //add all global tracks to histo input
215 if (histoInput.Length()>0) histoInput+=" ";
216 histoInput+="globalmerger";
218 // specify whether to write all blocks separately or merge the tracks
219 // and convert to ESD
220 bool writeBlocks=false;
224 // the writer configuration
225 AliHLTConfiguration fwconf("sink1", "FileWriter" , writerInput.Data(), "-specfmt=_%d -subdir=out_%d -blcknofmt=_0x%x -idfmt=_0x%08x");
228 //AliHLTConfiguration sink("sink1", "TPCEsdWriter" , "globalmerger", "-datafile AliHLTESDs.root");
230 // the esd converter configuration
231 AliHLTConfiguration esdcconf("esd-converter", "TPCEsdConverter" , "globalmerger", "");
233 // the root file writer configuration
234 AliHLTConfiguration sink("sink1", "EsdCollector" , "esd-converter", "-directory hlt-tpc-esd");
236 // optional component statistics
237 AliHLTConfiguration statroot("statroot", "StatisticsCollector" , "esd-converter", "-file HLT.statistics.root -publish 0");
238 AliHLTConfiguration statraw("statraw", "FileWriter" , "esd-converter", "-datatype COMPSTAT PRIV -datafile HLT.statistics.raw -concatenate-blocks -concatenate-events");
241 //Chain with Track Histogram
243 AliHLTConfiguration histoconf("histo","TPCTrackHisto",histoInput.Data(),"");
244 AliHLTConfiguration fwconf("histFile", "ROOTFileWriter" , "histo", "-datafile TrackHisto -concatenate-events -overwrite");
246 //Chain with Track Dump
248 AliHLTConfiguration dumpconf("dump","TPCTrackDump","globalmerger","-directory TrackDump");
251 AliHLTConfiguration cfconf("HHCF", "TPCHistogramHandler", histogramHandlerInputClusterFinder.Data(), "-use-general");
252 AliHLTConfiguration rootFileWriterClusters("chhisto", "ROOTFileWriter", "HHCF" , "-datafile histogramHandlerClusterFinder -concatenate-events -overwrite");
255 AliHLTConfiguration cdumpconf("cdump","TPCClusterDump",cdumpInput.Data(),"-directory ClusterDump");
259 ///////////////////////////////////////////////////////////////////////////////////////////////////
261 // Init and run the reconstruction
262 // All but HLT reconstructio is switched off
264 AliReconstruction rec;
266 rec.SetRunVertexFinder(kFALSE);
267 rec.SetRunLocalReconstruction("HLT");
268 rec.SetRunTracking("");
269 rec.SetLoadAlignFromCDB(0);
272 // NOTE: FillESD is a step in the AliReconstruction sequence and has
273 // nothing to do with the fact that this macro writes ESD output
274 // HLT processes the HLTOUT during FillESD and extracts data which
275 // has already been prepared. This step is currently not necessary for
278 rec.SetOption("HLT", option);