4 * @brief HLT Conformal mapping tracker embedded into AliRoot simulation.
6 * Example macro to run the HLT Conformal mapping tracker embedded into
7 * AliRoot simulation. The reconstruction is done from the TPC digits.
9 * Usage: aliroot -b -q sim-hlt-tpc.C | tee sim-hlt-tpc.log
11 * The chain to be run is defined within the macro. The input data is
12 * read from the TPC.Digits.
14 * The following options can be specified comma separated in a string:
16 * aliroot -b -q sim-hlt-tpc.C'("options")'
17 * CA use the cellular automaton tracker and track merger
18 * CM use the conformal mapping tracker and track merger
19 * SORTED use CF pre-sorting and corresponding sequential CF
20 * algorithm, by default the algorithm capable of reading
21 * unsorted data is used
22 * RAW write raw data for all detectors
23 * RAWHLT write raw data only for HLT
24 * MC propagate the MC information
27 * The macro asumes the data to be already simulated. If it should run
28 * within the initial simulation, comment the corresponding functions
29 * below (SetRunGeneration etc.)
31 * @author Matthias.Richter@ift.uib.no
34 sim_hlt_tpc(const char* options="CA")
36 // this is just a tool to switch the logging systems
38 //log.SwitchAliLog(0);
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 ///////////////////////////////////////////////////////////////////////////////////////////////////
42 ///////////////////////////////////////////////////////////////////////////////////////////////////
44 // scanning the options
46 bool bUseCA=true; // use the CA tracker and merger
47 bool bCFSort=false; // CF pre-sorting and sequential CF algorithm
48 bool bRawData=false;// raw data for all detectors
49 bool bRawHLTData=false; // raw data only for HLT
50 bool bPropagateMC=false;
51 TString tsOptions=options;
52 TObjArray* pTokens=tsOptions.Tokenize(",");
54 for (int n=0; n<pTokens->GetEntries(); n++) {
55 TString arg=((TObjString*)pTokens->At(n))->GetString();
56 if (arg.CompareTo("ca", TString::kIgnoreCase)==0) {
58 } else if (arg.CompareTo("cm", TString::kIgnoreCase)==0) {
60 } else if (arg.CompareTo("sorted", TString::kIgnoreCase)==0) {
62 } else if (arg.CompareTo("unsorted", TString::kIgnoreCase)==0) {
64 } else if (arg.CompareTo("raw", TString::kIgnoreCase)==0) {
66 } else if (arg.CompareTo("rawhlt", TString::kIgnoreCase)==0) {
68 } else if (arg.CompareTo("mc", TString::kIgnoreCase)==0) {
71 cout << "unknown argument: " << arg << endl;
78 cout << "using " << bUseCA?"CA":"CM" << " tracker" << endl;
80 ///////////////////////////////////////////////////////////////////////////////////////////////////
81 ///////////////////////////////////////////////////////////////////////////////////////////////////
82 ///////////////////////////////////////////////////////////////////////////////////////////////////
84 // init the HLT system in order to define the analysis chain below
86 AliHLTSystem* gHLT=AliHLTPluginBase::GetInstance();
88 ///////////////////////////////////////////////////////////////////////////////////////////////////
89 ///////////////////////////////////////////////////////////////////////////////////////////////////
90 ///////////////////////////////////////////////////////////////////////////////////////////////////
92 // define the analysis chain
95 // load TPCParam from OCDB
96 const char* cdbEntry="TPC/Calib/Parameters";
97 AliCDBManager* pMan=AliCDBManager::Instance();
98 AliTPCParam* pTPCParam=NULL;
100 if (!pMan->IsDefaultStorageSet()) {
101 pMan->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
104 AliCDBEntry *pEntry = pMan->Get(cdbEntry);
106 pEntry->GetObject() &&
107 (pTPCParam=dynamic_cast<AliTPCParam*>(pEntry->GetObject()))) {
109 HLTWarning("can not load AliTPCParam from CDB entry %s", cdbEntry);
119 TString sinkClusterInput;
120 for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
121 TString trackerInput;
122 for (int part=iMinPart; part<=iMaxPart; part++) {
123 TString arg, publisher, cf;
125 // digit publisher components
126 arg.Form("-slice %d -partition %d", slice, part);
127 publisher.Form("DP_%02d_%d", slice, part);
128 AliHLTConfiguration pubconf(publisher.Data(), "TPCDigitPublisher", NULL , arg.Data());
130 // cluster finder components
132 if (pTPCParam) arg+=pTPCParam->GetMaxTBin()+1;
133 else arg+=446; // old simulated data
134 if (bCFSort) arg+=" -sorted ";
135 if (bPropagateMC) arg+=" -do-mc ";
136 cf.Form("CF_%02d_%d", slice, part);
137 AliHLTConfiguration cfconf(cf.Data(), "TPCClusterFinderUnpacked", publisher.Data(), arg.Data());
138 if (trackerInput.Length()>0) trackerInput+=" ";
140 if (sinkClusterInput.Length()>0) sinkClusterInput+=" ";
141 sinkClusterInput+=cf;
145 // tracker finder components
146 tracker.Form("TR_%02d", slice);
148 AliHLTConfiguration trackerconf(tracker.Data(), "TPCCATracker", trackerInput.Data(), "");
150 AliHLTConfiguration trackerconf(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "-pp-run");
153 //add all trackers to writer input. Include if you would like all slice tracks written.
154 //if (writerInput.Length()>0) writerInput+=" ";
155 //writerInput+=tracker;
157 // add all clusterfinders to the writer input
158 if (writerInput.Length()>0) writerInput+=" ";
159 writerInput+=trackerInput;
161 if (mergerInput.Length()>0) mergerInput+=" ";
162 mergerInput+=tracker;
166 // GlobalMerger component
168 AliHLTConfiguration mergerconf("globalmerger","TPCCAGlobalMerger",mergerInput.Data(),"");
170 AliHLTConfiguration mergerconf("globalmerger","TPCGlobalMerger",mergerInput.Data(),"");
173 // collector for the MC information to be propagated from CFs to ESDConverter
174 AliHLTConfiguration mcinfo("mcinfo", "BlockFilter" , sinkClusterInput.Data(), "-datatype 'CLMCINFO' 'TPC '");
176 if (writerInput.Length()>0) writerInput+=" ";
177 writerInput+="globalmerger";
179 TString converterInput="globalmerger";
180 if (bPropagateMC) converterInput+=" mcinfo";
182 //////////////////////////////////////////////////////////////////////////////////////////
187 //////////////////////////////////////////////////////////////////////////////////////////
188 // sink1: id=sink-writeall write all blocks
189 AliHLTConfiguration sink1("sink-writeall", "FileWriter" , writerInput.Data(), "-specfmt -subdir=event_%d -blcknofmt=_0x%x -idfmt=_0x%08x");
192 //////////////////////////////////////////////////////////////////////////////////////////
193 // sink2: id=sink-esd-file write ESD using the TPCEsdWriter
194 AliHLTConfiguration sink2("sink-esd-file", "TPCEsdWriter" , converterInput.Data(), "-datafile AliHLTESDs.root");
197 //////////////////////////////////////////////////////////////////////////////////////////
198 // sink3: id=sink-esd add ESD to HLTOUT using the TPCEsdConverter
200 // the esd converter configuration
201 AliHLTConfiguration sink3("sink-esd", "TPCEsdConverter" , converterInput.Data(), "");
203 //////////////////////////////////////////////////////////////////////////////////////////
204 // sink4: id=sink-clusters add cluster data blocks to HLTOUT
205 AliHLTConfiguration sink4("sink-clusters", "BlockFilter" , sinkClusterInput.Data(), "-datatype 'CLUSTERS' 'TPC '");
207 ///////////////////////////////////////////////////////////////////////////////////////////////////
208 ///////////////////////////////////////////////////////////////////////////////////////////////////
209 ///////////////////////////////////////////////////////////////////////////////////////////////////
211 // Init and run the HLT simulation
212 // All but HLT simulation is switched off
216 // switch of simulation and data generation
217 // comment all that stuff to also simulate the events and data
218 sim.SetRunGeneration(kFALSE);
219 sim.SetMakeDigits("");
220 sim.SetMakeSDigits("");
221 sim.SetMakeDigitsFromHits("");
222 sim.SetMakeTrigger("");
225 // the normal simulation sets the specific storage for the GRP entry
226 if (gSystem->AccessPathName("GRP/GRP/Data")) {
227 cerr << "*********************************************************" << endl;
228 cerr << "error: no GRP entry found in the currect directory, simulation might be incomplete. Skip setting specific storage for GRP entry" << endl;
229 cerr << "*********************************************************" << endl << endl;
231 sim.SetSpecificStorage("GRP/GRP/Data",
232 Form("local://%s",gSystem->pwd()));
235 TString rawDataSelection="HLT";
236 if (bRawData) rawDataSelection="ALL";
237 if (bRawHLTData || bRawData) sim.SetWriteRawData(rawDataSelection, "raw.root", kTRUE);
239 // set the options for the HLT simulation
240 sim.SetRunHLT("libAliHLTUtil.so libAliHLTTPC.so loglevel=0x7c "
241 "chains=sink-esd,sink-clusters");