]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/exa/simhlt.C
vacuum fixed to fix bug bug #66618
[u/mrichter/AliRoot.git] / HLT / exa / simhlt.C
1 // $Id$
2 /**
3  * @file simhlt.C
4  * @brief Run HLT reconstruction embedded into AliSimulation
5  *
6  * <pre>
7  * Usage: aliroot -b -q -l \
8  *     aliroot -b -q -l simhlt.C'("hltoption", "rawdataoptions", nofEvents, runNo, "cdbUri")'
9  *
10  * Examples:
11  *     simhlt.C'("loglevel=0x7c chains=GLOBAL-esd-converter")'
12  *       load all default libraries and run the chain 'GLOBAL-esd-converter'
13  *     simhlt.C'("loglevel=0x7c !libAliHLTITS.so")'
14  *       load all default libraries but the libAliHLTITS.so and run the
15  *       default chain, skips the ITS tracking
16  *     simhlt.C'("loglevel=0x7c rawfile=")'
17  *       run explicitly on digit data
18  *
19  * Defaults
20  *     rawdataoptions=""         -> skip generation of raw data
21  *     nofEvents=-1              -> take event count from simulated sample
22  *     runNo=-1                  -> take run number from simulated sample
23  *     cdbUri="local://$ALICE_ROOT/OCDB"
24  *
25  * </pre>
26  *
27  * This macro can be used to run the 'HLT simulation' standalone with an
28  * already simulated data sample. 'HLT simulation' means HLT reconstruction
29  * on simulated data, and is carried out at the end of the AliSimulation
30  * sequence.
31  *
32  * The definition of the HLT reconstruction chain depends on the available
33  * module plugins (component libraries). Each library defines a number of
34  * component configurations identified by a unique string. Here are a couple
35  * of definitions, but the list is by far not complete:
36  * - libAliHLTTPC.so:     TPC-clusters, TPC-globalmerger
37  * - libAliHLTITS.so:     ITS-tracker, ITS-SPD-vertexer
38  * - libAliHLTGlobal.so:  GLOBAL-esd-converter, GLOBAL-vertexhisto
39  * - libAliHLTTrigger.so: GLOBAL-Trigger
40  *
41  * This list will certainly develop over time, it is planned to add some
42  * helper functionality to AliHLTSystem for querying of such information.
43  *
44  * The definition of the chain depends on the availability of simulated raw
45  * data. If raw data is available, the HLT chain runs on this, otherwise on
46  * the digit data. \b NOTE: propagation of MC information is only possible
47  * for the latter case. Raw data generation must be either switched of, i.e.
48  * rawdataoptions is empty, or explicitly explicitly ignored by the HLT
49  * option 'rawfile=' (note the empty argument to the option).
50  *
51  * The output of the simulation are the HLT.Digits.root file and (if enabled)
52  * the HLT raw data files. You must run AliReconstruction in order to extract
53  * the simulated HLT data. A typical test sequence can be like:
54  *
55  * <pre>
56  * cd $ALICE_ROOT/test/ppbench
57  * ./runtest.sh
58  * aliroot -b -q -l simhlt.C'("loglevel=0x7c chains=GLOBAL-esd-converter")' \
59  *         | tee simhlt.C
60  * aliroot -b -q -l rec.C | tee rec.log
61  * </pre>
62  *
63  * @author Matthias.Richter@ift.uib.no
64  * @ingroup alihlt_tutorial
65  */
66 void simhlt(const char *hltOptions,
67             const char *rawDataSelection="",
68             int nofEvents=-1,
69             int runNo=-1,
70             const char *cdbURI="local://$ALICE_ROOT/OCDB"
71             )
72 {
73   ///////////////////////////////////////////////////////////////////////////////////////////////////
74   ///////////////////////////////////////////////////////////////////////////////////////////////////
75   ///////////////////////////////////////////////////////////////////////////////////////////////////
76   //
77   // connect to the GRID if we use a file or OCDB from the GRID
78   TString struri=cdbURI;
79   if (struri.Contains("://") && !struri.Contains("local://")) {
80     TGrid::Connect("alien");
81   }
82
83   // Set the CDB storage location
84   AliCDBManager * man = AliCDBManager::Instance();
85   man->SetDefaultStorage(cdbURI);
86
87   ///////////////////////////////////////////////////////////////////////////////////////////////////
88   ///////////////////////////////////////////////////////////////////////////////////////////////////
89   ///////////////////////////////////////////////////////////////////////////////////////////////////
90   //
91   // Init and run the HLT simulation
92   // All but HLT simulation is switched off
93   //
94   AliSimulation sim;
95  
96   // switch of simulation and data generation
97   // comment all that stuff to also simulate the events and data
98   sim.SetRunGeneration(kFALSE);
99   sim.SetMakeDigits("");
100   sim.SetMakeSDigits("");
101   sim.SetMakeDigitsFromHits("");
102   //sim.SetMakeTrigger("");
103   sim.SetRunQA("HLT:ALL");
104
105   // the normal simulation sets the specific storage for the GRP entry
106   if (gSystem->AccessPathName("GRP/GRP/Data")) {
107     cerr << "*********************************************************" << endl;
108     cerr << "error: no GRP entry found in the currect directory, simulation might be incomplete. Skip setting specific storage for GRP entry" << endl;
109     cerr << "*********************************************************" << endl << endl;
110   } else {
111     sim.SetSpecificStorage("GRP/GRP/Data",
112                            Form("local://%s",gSystem->pwd()));
113   }
114
115   // set the options for writing raw data, possible values e.g. ALL; HLT
116   if (rawDataSelection && rawDataSelection[0]!=0) {
117     sim.SetWriteRawData(rawDataSelection, "raw.root", kTRUE);
118   }
119
120   // set the options for the HLT simulation
121   sim.SetRunHLT(hltOptions);
122
123   if (runNo>=0) sim.SetRunNumber(runNo);
124
125   if (nofEvents>0) sim.Run(nofEvents);
126   else sim.Run();
127 }
128
129 void simhlt()
130 {
131   cout << "recraw-local: Run HLT reconstruction embedded into AliSimulation" << endl;
132   cout << " Usage: aliroot -b -q -l \\" << endl;
133   cout << "     aliroot -q simhlt.C'(\"hltoption\", \"rawdataoptions\", nofEvents, runNo, \"cdbUri\")'" << endl;
134   cout << "" << endl;
135   cout << " Examples:" << endl;
136   cout << "     aliroot -q simhlt.C'(\"loglevel=0x7c chains=GLOBAL-esd-converter\")'" << endl;
137   cout << "     aliroot -q simhlt.C'(\"loglevel=0x7c !libAliHLTITS.so\")'                " << endl;
138   cout << "     aliroot -q simhlt.C'(\"loglevel=0x7c rawfile=\")'                   " << endl;
139   cout << "" << endl;
140   cout << " Defaults" << endl;
141   cout << "     rawdataoptions=\"\"         -> skip generation of raw data         " << endl;
142   cout << "     nofEvents=-1              -> take event count from simulated sample" << endl;
143   cout << "     runNo=-1                  -> take run number from simulated sample " << endl;
144   cout << "     cdbUri=\"local://$ALICE_ROOT/OCDB\"                                " << endl;
145   cout << "" << endl;
146   cout << " The definition of the chain depends on the availability of simulated raw " << endl;
147   cout << " data. If raw data is available, the HLT chain runs on this, otherwise on " << endl;
148   cout << " the digit data. \b NOTE: propagation of MC information is only possible  " << endl;
149   cout << " for the latter case. Raw data generation must be either switched of, i.e." << endl;
150   cout << " rawdataoptions is empty, or explicitly explicitly ignored by the HLT          " << endl;
151   cout << " option 'rawfile=' (note the empty argument to the option).               " << endl;
152 }