4 * @brief Tool to extract the HLT ESD from the raw data.
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
12 * This macro only needs the HLT/Calib/StreamerInfo object to extract the HLT ESD from raw data.
13 * However, it is extremely slow, it even gets slower during running. It should be used as an
14 * emergency solution. HLT/exa/recraw-local.C is the proper and fast way to extract HLT data.
16 * @author Kalliopi.Kanaki@ift.uib.no
17 * @ingroup alihlt_tutorial
19 void extract_ESD(const char* input, const char *cdbURI, int nofEvents=-1){
21 // setup of the RawReader
23 cerr << "invalid path" << endl;
24 cerr << "usage: aliroot -b -q extract-ESD.C'(\"raw.root\", \"cdb\", nOfEvents)'" << endl;
28 TString strfile = input;
29 TString struri = cdbURI;
31 if(strfile.Contains("://") && !strfile.Contains("local://")) TGrid::Connect("alien");
33 // Set the CDB storage location
34 AliCDBManager *man = AliCDBManager::Instance();
35 man->SetDefaultStorage(cdbURI);
37 AliRawReader *pRawReader = AliRawReader::Create(input);
39 cout << "cannot open RawReader for file " << input << endl;
43 if (!pRawReader->NextEvent()){
44 cerr << "no events available" << endl;
48 if(!struri.BeginsWith("raw://")) man->SetRun(pRawReader->GetRunNumber());
50 // setup of the HLT system
51 AliHLTSystem *pHLT = AliHLTPluginBase::GetInstance();
52 if(!pHLT) cerr << "fatal error: cannot get HLT instance" << endl;
55 arg.Form("-typeid ALIESDV0");
56 AliHLTConfiguration publisher("hltout-publisher", "AliHLTOUTPublisher" , NULL, arg.Data());
58 arg.Form("-treename HLTesdTree");
59 AliHLTConfiguration collector("sink1","EsdCollector","hltout-publisher", arg.Data());
61 // the reconstructor setup
62 AliHLTReconstructor hltRec;
63 hltRec.SetOption("libAliHLTUtil.so loglevel=0x7c chains=sink1 ignore-hltout ignore-ctp");
64 if (hltRec.Init()<0) {
65 cerr << "initialization of reconstructor failed" << endl;
69 // the reconstruction loop
72 pRawReader->RewindEvents();
73 while(pRawReader->NextEvent() && (nofEvents<0 || event<nofEvents)){
74 cout << "=======================================================" << endl;
75 cout << "event " << event << endl;
76 cout << "-------------------------------------------------------" << endl;
78 hltRec.Reconstruct(pRawReader, NULL);
83 void extract_ESD(const char* input, int nofEvents=-1){
84 extract_ESD(input, "raw://", nofEvents);
88 cerr << "===============================================================" << endl;
89 cerr << "usage: aliroot -b -q extract-ESD.C'(\"raw.root\", \"cdb\", nOfEvents)'"<< endl;
90 cerr <<" aliroot -b -q extract-ESD.C'(\"alien:///alice/data/2010/LHC10../../.root\", \"raw://\", nOfEvents)'"<< endl;
91 cerr << "===============================================================" << endl;