adding availability check for a list of OCDB objects, code cleanup and updated docume...
[u/mrichter/AliRoot.git] / HLT / rec / streamerinfo-from-raw.C
CommitLineData
9ca40ad8 1// $Id$
2/**
3 * @file streamerinfo-from-raw.C
4 * @brief Extract the streamer info for a raw file and AliRoot version
5 *
6 * This macro generates the streamer info for all objects in the HLTOUT
7 * payload of the specified raw file. The AliRoot version of the when
8 * running this macro needs to be the same as the HLTOUT payload was
9 * generatted with.
10 *
11 * The macro has two optional parameters:
12 * - filename: default 'raw://'
13 * - OCDB URI: default 'raw.root'
14 *
15 * If either file or URI refers to the GRID, the macro connects to alien.
16 * Make sure that ROOT is compiled with ALIEN support and that the required
17 * alien API libraries can be loaded.
18 *
19 * You can run this macro with defaults using the following shell command:
20 * @code
21 * > aliroot -b -q $ALICE_ROOT/HLT/rec/streamerinfo-from-raw.C
22 * @endcode
23 * With a raw file from the GRID
24 * @code
25 * > aliroot -b -q streamerinfo-from-raw.C'("alien:///alice/data/2009/LHC09d/000102925/raw/09000102925035.10.root")'
26 * @endcode
27 *
28 * Streamer info is stored in a TObjArray wrapped into an AliCDBEntry
29 * object, and stored to HLT.StreamerInfo.root. This file can be used
30 * directly as OCDB object, it just needs to be renamed.
31 *
32 * @author Matthias.Richter@ift.uib.no
33 */
34void streamerinfo_from_raw(const char *filename="raw.root", const char* cdbUri="raw://")
35{
36 TString tmpStr1=filename;
37 TString tmpStr2=cdbUri;
38 if ((tmpStr1.Contains("://") && !tmpStr1.BeginsWith("local://")) ||
39 !tmpStr2.BeginsWith("local://")) {
40 // setup the GRID connection if raw file or OCDB are from GRID
41 TGrid::Connect("alien");
42 }
43
44 // Set the CDB storage location
45 AliCDBManager * man = AliCDBManager::Instance();
46 man->SetDefaultStorage(cdbUri);
47
48 // Reconstruction settings
49 AliReconstruction rec;
50 rec.SetRunPlaneEff(kFALSE);
51 rec.SetCleanESD(kFALSE);
52
53 rec.SetInput(filename);
54 rec.SetRunReconstruction("HLT");
55 rec.SetOption("HLT","skip-hltout chains=schemaevo");
56
57 AliHLTSystem* pHLT=AliHLTPluginBase::GetInstance();
58 AliHLTConfiguration publisher("hltout-publisher", "AliHLTOUTPublisher" , NULL, "");
59 AliHLTConfiguration collector("schemaevo", "ROOTSchemaEvolutionComponent" , "hltout-publisher", "-file=HLT.StreamerInfo.root");
60
61 // QA options
62 rec.SetRunQA(":") ;
63
64 AliLog::Flush();
65 rec.Run();
66}