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