]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/macros/sim-hlt-tpc.C
added Rsn cut on required PID and methods to set and retrieve this information
[u/mrichter/AliRoot.git] / HLT / TPCLib / macros / sim-hlt-tpc.C
CommitLineData
d67ed322 1// $Id$
2/*
488581c1 3 * @file sim-hlt-tpc.C
4 * @brief HLT Conformal mapping tracker embedded into AliRoot simulation.
5 *
d67ed322 6 * Example macro to run the HLT Conformal mapping tracker embedded into
7 * AliRoot simulation. The reconstruction is done from the TPC digits.
8 *
833b3167 9 * Usage: aliroot -b -q sim-hlt-tpc.C | tee sim-hlt-tpc.log
d67ed322 10 *
d0545a3c 11 * The chain to be run is defined within the macro.
12 *
13 * The following options can be specified comma separated in a string:
14 * aliroot -b -q sim-hlt-tpc.C'("options")'
15 * CA use the cellular automaton tracker and track merger
16 * CM use the conformal mapping tracker and track merger
d67ed322 17 *
c5123824 18 * The macro asumes the data to be already simulated. If it should run
8f471af0 19 * within the initial simulation, comment the corresponding functions
20 * below (SetRunGeneration etc.)
21 *
488581c1 22 * @author Matthias.Richter@ift.uib.no
23 * @ingroup alihlt_tpc
d67ed322 24 */
d0545a3c 25sim_hlt_tpc(const char* options="CA")
d67ed322 26{
27 // this is just a tool to switch the logging systems
28 AliHLTLogging log;
29 //log.SwitchAliLog(0);
30
d0545a3c 31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 ///////////////////////////////////////////////////////////////////////////////////////////////////
33 ///////////////////////////////////////////////////////////////////////////////////////////////////
34 //
35 // scanning the options
36 //
37 bool bUseCA=false; // use the CA tracker and merger
38 TString tsOptions=options;
39 TObjArray* pTokens=tsOptions.Tokenize(",");
40 if (pTokens) {
41 for (int n=0; n<pTokens->GetEntries(); n++) {
42 TString arg=((TObjString*)pTokens->At(n))->GetString();
43 if (arg.CompareTo("ca", TString::kIgnoreCase)==0) {
44 bUseCA=true;
45 } else if (arg.CompareTo("cm", TString::kIgnoreCase)==0) {
46 bUseCA=false;
47 } else {
48 cout << "unknown argument: " << arg << endl;
49 return 0;
50 }
51 }
52 delete pTokens;
53 }
54 // summary
55 cout << "using " << bUseCA?"CA":"CM" << " tracker" << endl;
56
7bf6c76d 57 ///////////////////////////////////////////////////////////////////////////////////////////////////
58 ///////////////////////////////////////////////////////////////////////////////////////////////////
59 ///////////////////////////////////////////////////////////////////////////////////////////////////
60 //
61 // init the HLT system in order to define the analysis chain below
62 //
63 AliHLTSystem* gHLT=AliHLTPluginBase::GetInstance();
64
65 ///////////////////////////////////////////////////////////////////////////////////////////////////
66 ///////////////////////////////////////////////////////////////////////////////////////////////////
67 ///////////////////////////////////////////////////////////////////////////////////////////////////
68 //
69 // define the analysis chain
70 //
71
72 // load TPCParam from OCDB
73 const char* cdbEntry="TPC/Calib/Parameters";
74 AliCDBManager* pMan=AliCDBManager::Instance();
75 AliTPCParam* pTPCParam=NULL;
76 if (pMan) {
77 if (!pMan->IsDefaultStorageSet()) {
78 pMan->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
79 pMan->SetRun(0);
80 }
81 AliCDBEntry *pEntry = pMan->Get(cdbEntry);
82 if (pEntry &&
83 pEntry->GetObject() &&
84 (pTPCParam=dynamic_cast<AliTPCParam*>(pEntry->GetObject()))) {
85 } else {
86 HLTWarning("can not load AliTPCParam from CDB entry %s", cdbEntry);
87 }
88 }
89
90 int iMinSlice=0;
91 int iMaxSlice=35;
92 int iMinPart=0;
93 int iMaxPart=5;
94 TString mergerInput;
95 TString writerInput;
96 TString sinkClusterInput;
97 for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
98 TString trackerInput;
99 for (int part=iMinPart; part<=iMaxPart; part++) {
100 TString arg, publisher, cf;
101
102 // digit publisher components
103 arg.Form("-slice %d -partition %d", slice, part);
104 publisher.Form("DP_%02d_%d", slice, part);
105 AliHLTConfiguration pubconf(publisher.Data(), "TPCDigitPublisher", NULL , arg.Data());
106
107 // cluster finder components
108 arg="-timebins ";
109 if (pTPCParam) arg+=pTPCParam->GetMaxTBin()+1;
110 else arg+=446; // old simulated data
111 arg+=" -sorted ";
112 cf.Form("CF_%02d_%d", slice, part);
113 AliHLTConfiguration cfconf(cf.Data(), "TPCClusterFinderUnpacked", publisher.Data(), arg.Data());
114 if (trackerInput.Length()>0) trackerInput+=" ";
115 trackerInput+=cf;
116 if (sinkClusterInput.Length()>0) sinkClusterInput+=" ";
117 sinkClusterInput+=cf;
118 }
d0545a3c 119
7bf6c76d 120 TString tracker;
121 // tracker finder components
122 tracker.Form("TR_%02d", slice);
d0545a3c 123 if (bUseCA) {
124 AliHLTConfiguration trackerconf(tracker.Data(), "TPCCATracker", trackerInput.Data(), "");
125 } else {
126 AliHLTConfiguration trackerconf(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "-pp-run");
127 }
7bf6c76d 128
129 //add all trackers to writer input. Include if you would like all slice tracks written.
130 //if (writerInput.Length()>0) writerInput+=" ";
131 //writerInput+=tracker;
132
133 // add all clusterfinders to the writer input
134 if (writerInput.Length()>0) writerInput+=" ";
135 writerInput+=trackerInput;
136
137 if (mergerInput.Length()>0) mergerInput+=" ";
138 mergerInput+=tracker;
139
140 }
141
142 // GlobalMerger component
d0545a3c 143 if (bUseCA) {
144 AliHLTConfiguration mergerconf("globalmerger","TPCCAGlobalMerger",mergerInput.Data(),"");
145 } else {
146 AliHLTConfiguration mergerconf("globalmerger","TPCGlobalMerger",mergerInput.Data(),"");
147 }
d67ed322 148
7bf6c76d 149 if (writerInput.Length()>0) writerInput+=" ";
150 writerInput+="globalmerger";
151
152 //////////////////////////////////////////////////////////////////////////////////////////
153 //
154 // output section
155 //
156
157 //////////////////////////////////////////////////////////////////////////////////////////
158 // sink1: id=sink-writeall write all blocks
159 AliHLTConfiguration sink1("sink-writeall", "FileWriter" , writerInput.Data(), "-specfmt -subdir=event_%d -blcknofmt=_0x%x -idfmt=_0x%08x");
160
161
162 //////////////////////////////////////////////////////////////////////////////////////////
163 // sink2: id=sink-esd-file write ESD using the TPCEsdWriter
164 AliHLTConfiguration sink2("sink-esd-file", "TPCEsdWriter" , "globalmerger", "-datafile AliHLTESDs.root");
165
166
167 //////////////////////////////////////////////////////////////////////////////////////////
168 // sink3: id=sink-esd add ESD to HLTOUT using the TPCEsdConverter
169
170 // the esd converter configuration
171 //AliHLTConfiguration sink3("sink-esd", "TPCEsdConverter" , "globalmerger", "");
172 AliHLTConfiguration sink3("sink-esd", "TPCEsdConverter" , mergerInput.Data(), "");
173
174
175 //////////////////////////////////////////////////////////////////////////////////////////
176 // sink4: id=sink-clusters add cluster data blocks to HLTOUT
177 AliHLTConfiguration sink4("sink-clusters", "BlockFilter" , sinkClusterInput.Data(), "-datatype 'CLUSTERS' 'TPC '");
178
179 ///////////////////////////////////////////////////////////////////////////////////////////////////
180 ///////////////////////////////////////////////////////////////////////////////////////////////////
181 ///////////////////////////////////////////////////////////////////////////////////////////////////
182 //
183 // Init and run the HLT simulation
184 // All but HLT simulation is switched off
185 //
186 AliSimulation sim;
187
d67ed322 188 // switch of simulation and data generation
189 // comment all that stuff to also simulate the events and data
190 sim.SetRunGeneration(kFALSE);
191 sim.SetMakeDigits("");
192 sim.SetMakeSDigits("");
193 sim.SetMakeDigitsFromHits("");
194 sim.SetMakeTrigger("");
7bf6c76d 195 sim.SetRunQA(":");
196 //sim.SetWriteRawData("HLT TPC", "raw.root", kTRUE);
d67ed322 197
198 // set the options for the HLT simulation
833b3167 199 sim.SetRunHLT("libAliHLTUtil.so libAliHLTTPC.so loglevel=0x7c "
7bf6c76d 200 "chains=sink-esd,sink-clusters");
d67ed322 201 sim.Run();
202}