]>
Commit | Line | Data |
---|---|---|
03c875c8 | 1 | // $Id$ |
2 | /** | |
3 | * @file extract-ESD.C | |
4 | * @brief Tool to extract the HLT ESD from the raw data. | |
5 | * | |
6 | * Usage: | |
7 | * <pre> | |
8 | * aliroot -b -q 'extract-ESD.C("raw.root", cdb, nOfEvents)' | tee extract-ESD.log | |
9 | * aliroot -b -q 'extract-ESD.C("alien:///alice/data/2010/.../.root", "raw://", nOfEvents)' | tee extract-ESD.log | |
10 | * </pre> | |
11 | * | |
12 | * @author Kalliopi.Kanaki@ift.uib.no | |
13 | * @ingroup alihlt_tutorial | |
14 | */ | |
15 | void extract_ESD(const char* input, const char *cdbURI, int nofEvents=-1){ | |
16 | ||
17 | // setup of the RawReader | |
18 | if(!input){ | |
19 | cerr << "invalid path" << endl; | |
20 | cerr << "usage: aliroot -b -q extract-ESD.C'(\"raw.root\", \"cdb\", nOfEvents)'" << endl; | |
21 | return; | |
22 | } | |
23 | ||
24 | TString strfile = input; | |
25 | TString struri = cdbURI; | |
26 | ||
27 | if(strfile.Contains("://") && !strfile.Contains("local://")) TGrid::Connect("alien"); | |
28 | ||
29 | // Set the CDB storage location | |
30 | AliCDBManager *man = AliCDBManager::Instance(); | |
31 | man->SetDefaultStorage(cdbURI); | |
32 | man->SetRun(0); | |
33 | if (struri.BeginsWith("local://")) man->SetSpecificStorage("HLT/Calib/StreamerInfo", "local://$ALICE_ROOT/OCDB"); | |
34 | ||
35 | AliRawReader* pRawReader=AliRawReader::Create(input); | |
36 | if (!pRawReader){ | |
37 | cout << "cannot open RawReader for file " << input << endl; | |
38 | return; | |
39 | } | |
40 | ||
41 | if (!pRawReader->NextEvent()){ | |
42 | cerr << "no events available" << endl; | |
43 | return; | |
44 | } | |
45 | ||
46 | // setup of the HLT system | |
47 | AliHLTSystem *pHLT = AliHLTPluginBase::GetInstance(); | |
48 | if(!pHLT) cerr << "fatal error: can not get HLT instance" << endl; | |
49 | ||
50 | TString arg; | |
51 | arg.Form("-typeid ALIESDV0"); | |
52 | AliHLTConfiguration publisher("hltout-publisher", "AliHLTOUTPublisher" , NULL, arg.Data()); | |
53 | ||
f948d3b1 | 54 | arg.Form("-treename HLTesdTree"); |
03c875c8 | 55 | AliHLTConfiguration collector("sink1","EsdCollector","hltout-publisher", arg.Data()); |
56 | ||
57 | // the reconstructor setup | |
58 | AliHLTReconstructor hltRec; | |
59 | hltRec.SetOption("libAliHLTUtil.so loglevel=0x7c chains=sink1 ignore-hltout ignore-ctp"); | |
60 | if (hltRec.Init()<0) { | |
61 | cerr << "initialization of reconstructor failed" << endl; | |
62 | return; | |
63 | } | |
64 | ||
65 | // the reconstruction loop | |
66 | Int_t event=0; | |
67 | UChar_t* pData=NULL; | |
68 | pRawReader->RewindEvents(); | |
69 | while(pRawReader->NextEvent() && (nofEvents<0 || event<nofEvents)){ | |
70 | cout << "=======================================================" << endl; | |
71 | cout << "event " << event << endl; | |
72 | cout << "-------------------------------------------------------" << endl; | |
73 | pRawReader->Reset(); | |
74 | hltRec.Reconstruct(pRawReader, NULL); | |
75 | event++; | |
76 | } | |
77 | } | |
78 | ||
f948d3b1 | 79 | void extract_ESD(const char* input, int nofEvents=-1){ |
80 | extract_ESD(input, "raw://", nofEvents); | |
81 | } | |
82 | ||
03c875c8 | 83 | void extract_ESD(){ |
84 | cerr << "===============================================================" << endl; | |
85 | cerr << "usage: aliroot -b -q extract-ESD.C'(\"raw.root\", \"cdb\", nOfEvents)'"<< endl; | |
86 | cerr <<" aliroot -b -q extract-ESD.C'(\"alien:///alice/data/2010/LHC10../../.root\", \"raw://\", nOfEvents)'"<< endl; | |
87 | cerr << "===============================================================" << endl; | |
88 | } |