// $Id$
/**
* @file sampleAliHLTOUTHandlerEsdBranch.C
* @brief Example macro to illustrate function of AliHLTOUTHandlerEsdBranch.
* @note Macro requires simulated raw data, please run e.g. ppbench setup.
*
* HLTOUT handlers inherit from class AliHLTOUTHandler and are utilized to
* process data blocks in the HLTOUT. As a specific case HLTOUT can contain
* data blocks/streamed objects designated for storage in custom ESD branches.
* AliHLTOUTHandlerEsdBranch provides an easy way to implement merging of
* such blocks/objects into the hltEsd.
*
* Usage: Simulate a data sample (e.g. ppbench) and run this macro in the
* folder for raw data reconstruction.
* <pre>
* aliroot -b -q -l sampleAliHLTOUTHandlerEsdBranch.C \
* | tee sampleAliHLTOUTHandlerEsdBranch.log
* </pre>
*
* The macro contains 3 parts:
* - the hltEsd layout object is adjusted in order to allow for the
* new branch
* - an object is generated, streamed and saved to file
* - a small HLT chain is run
*
* The HLT chain is as simple as just publishing the binary object file with
* the appropriate data type. The published object becomes part of the HLTOUT
* and the handler of the AliHLTAgentSample is called as it will announce
* the ability to process data blocks of this specific type from HLTOUT.
*
* @author Matthias.Richter@ift.uib.no
* @ingroup alihlt_tutorial
*/
void sampleAliHLTOUTHandlerEsdBranch()
{
// require a simulated data sample, e.g. the ppbench setup
// we need raw data in order to run a custom HLT chain
TString datainput;
if (!gSystem->AccessPathName("raw.root")) datainput="raw.root";
else if (!gSystem->AccessPathName("raw0")) datainput="./";
TString grpstorage;
if (!gSystem->AccessPathName("GRP/GRP/Data")) grpstorage="local://$PWD";
else if (!gSystem->AccessPathName("../GRP/GRP/Data")) grpstorage="local://$PWD/..";
if (datainput.IsNull() || grpstorage.IsNull()) {
cout << "sampleAliHLTOUTHandlerEsdBranch.C: illustrate AliHLTOUTHandlerEsdBranch" << endl;
cout << " Usage: aliroot -b -q -l sampleAliHLTOUTHandlerEsdBranch.C" << endl;
cout << "" << endl;
cout << " Macro requieres a simulated data sample, please run e.g. ppbench setup" << endl;
cout << " and run in the folder with the raw data" << endl;
if (datainput.IsNull()) cout << "Error: no raw data input found" << endl;
if (grpstorage.IsNull()) cout << "Error: no GRP entry found in neither ./ nor ../" << endl;
return;
}
if (!gSystem->AccessPathName("galice.root")) {
cout << "AliReconstruction from raw data requires to delete the galice.root file" << endl;
cout << "of previous reconstruction cycles. IMPORTANT: do not delete the file in" << endl;
cout << "the simulation folder but run in a subfolder like e.g. recraw" << endl;
return;
}
// Basic settings
TString command;
TString objectFileName=gSystem->TempDirectory();
objectFileName+="/";objectFileName+="inputobject.dat";
// Create the input object
TClonesArray* inputObject=new TClonesArray("TNamed");
inputObject->SetName("MyPrivateBranch");
// Init OCDB
AliCDBManager * man = AliCDBManager::Instance();
man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
// set specific storage for GRP entry
man->SetSpecificStorage("GRP/GRP/Data", grpstorage);
// Adjust hltEsd layout
//
// in order to allow custom branches for the HLT ESD a layout object is
// stored in OCDB. This object will be generated automatically in the future
// according to the online setup. It can be adapted manually to enable specific
// branches. In this example we add the input object (still an empty TClonesArray)
// to the layout and store the object.
const char* esdLayoutEntry="HLT/ConfigHLT/esdLayout";
if (gSystem->AccessPathName(esdLayoutEntry)) {
command="mkdir -p "; command+=esdLayoutEntry;
gSystem->Exec(command);
}
command="cp $ALICE_ROOT/OCDB/"; command+=esdLayoutEntry; command+="/Run* "; command+=esdLayoutEntry;
gSystem->Exec(command);
man->SetSpecificStorage(esdLayoutEntry, "local://$PWD");
man->SetRun(0);
AliCDBEntry* esdLayoutObject=man->Get(esdLayoutEntry);
AliESDEvent* esdLayout=(AliESDEvent*)esdLayoutObject->GetObject();
if (!esdLayout->FindListObject(inputObject->GetName())) {
esdLayout->AddObject(inputObject);
}
man->Put(esdLayout, esdLayoutObject->GetId(), esdLayoutObject->GetMetaData());
man->UnloadFromCache(esdLayoutEntry);
// now add some data to the input object, stream it and save to file
new ((*inputObject)[inputObject->GetEntriesFast()]) TNamed("data1","some data");
new ((*inputObject)[inputObject->GetEntriesFast()]) TNamed("data2","some more data");
AliHLTMessage* pMsg=AliHLTMessage::Stream(inputObject);
if (!pMsg) {
cerr << "failed to stream input object" << endl;
return;
}
ofstream objectFile(objectFileName);
objectFile.write(pMsg->Buffer(), pMsg->Length());
objectFile.close();
delete pMsg;
if (gSystem->AccessPathName(objectFileName)) {
cerr << "failed to write input file " << objectFileName << endl;
return;
}
//////////////////////////////////////////////////////////////////////////////////////
//
// Reconstruction settings
AliReconstruction rec;
rec.SetRunReconstruction("HLT ITS TPC");
rec.SetInput(datainput);
rec.SetWriteESDfriend(kFALSE);
// QA options
rec.SetRunQA(":") ;
//rec.SetQARefDefaultStorage("local://$ALICE_ROOT/QAref") ;
//////////////////////////////////////////////////////////////////////////////////////
//
// setup the HLT system
AliHLTSystem* pHLT=AliHLTPluginBase::GetInstance();
// define the HLT chain to be run in AliReconstruction
// arguments:
// 1) id of the configuartion, later used to refer to this configuration
// 2) id of the component to run
// 3) parents, no parents in this case
// 4) optional component arguments
TString arguments;
arguments.Form("-datatype ROOTTOBJ SMPL -datafile %s", objectFileName.Data());
AliHLTConfiguration publisher("Object-Publisher", "FilePublisher", "", arguments.Data());
// set option for the HLT module in AliReconstruction
// arguments
// - ignore-hltout : ignore the HLTOUT payload from the HLT DDLs
// - libraries to be used as plugins
// - loglevel=0x7c : Info, Important, Warning, Error, Fatal
// - chains=Object-Publisher : chains to be run
rec.SetOption("HLT",
"ignore-hltout "
"libAliHLTSample.so "
"loglevel=0x7c "
"chains=Object-Publisher "
);
rec.SetRunPlaneEff(kFALSE);
// switch off cleanESD
rec.SetCleanESD(kFALSE);
AliLog::Flush();
rec.Run();
}
sampleAliHLTOUTHandlerEsdBranch.C:1 sampleAliHLTOUTHandlerEsdBranch.C:2 sampleAliHLTOUTHandlerEsdBranch.C:3 sampleAliHLTOUTHandlerEsdBranch.C:4 sampleAliHLTOUTHandlerEsdBranch.C:5 sampleAliHLTOUTHandlerEsdBranch.C:6 sampleAliHLTOUTHandlerEsdBranch.C:7 sampleAliHLTOUTHandlerEsdBranch.C:8 sampleAliHLTOUTHandlerEsdBranch.C:9 sampleAliHLTOUTHandlerEsdBranch.C:10 sampleAliHLTOUTHandlerEsdBranch.C:11 sampleAliHLTOUTHandlerEsdBranch.C:12 sampleAliHLTOUTHandlerEsdBranch.C:13 sampleAliHLTOUTHandlerEsdBranch.C:14 sampleAliHLTOUTHandlerEsdBranch.C:15 sampleAliHLTOUTHandlerEsdBranch.C:16 sampleAliHLTOUTHandlerEsdBranch.C:17 sampleAliHLTOUTHandlerEsdBranch.C:18 sampleAliHLTOUTHandlerEsdBranch.C:19 sampleAliHLTOUTHandlerEsdBranch.C:20 sampleAliHLTOUTHandlerEsdBranch.C:21 sampleAliHLTOUTHandlerEsdBranch.C:22 sampleAliHLTOUTHandlerEsdBranch.C:23 sampleAliHLTOUTHandlerEsdBranch.C:24 sampleAliHLTOUTHandlerEsdBranch.C:25 sampleAliHLTOUTHandlerEsdBranch.C:26 sampleAliHLTOUTHandlerEsdBranch.C:27 sampleAliHLTOUTHandlerEsdBranch.C:28 sampleAliHLTOUTHandlerEsdBranch.C:29 sampleAliHLTOUTHandlerEsdBranch.C:30 sampleAliHLTOUTHandlerEsdBranch.C:31 sampleAliHLTOUTHandlerEsdBranch.C:32 sampleAliHLTOUTHandlerEsdBranch.C:33 sampleAliHLTOUTHandlerEsdBranch.C:34 sampleAliHLTOUTHandlerEsdBranch.C:35 sampleAliHLTOUTHandlerEsdBranch.C:36 sampleAliHLTOUTHandlerEsdBranch.C:37 sampleAliHLTOUTHandlerEsdBranch.C:38 sampleAliHLTOUTHandlerEsdBranch.C:39 sampleAliHLTOUTHandlerEsdBranch.C:40 sampleAliHLTOUTHandlerEsdBranch.C:41 sampleAliHLTOUTHandlerEsdBranch.C:42 sampleAliHLTOUTHandlerEsdBranch.C:43 sampleAliHLTOUTHandlerEsdBranch.C:44 sampleAliHLTOUTHandlerEsdBranch.C:45 sampleAliHLTOUTHandlerEsdBranch.C:46 sampleAliHLTOUTHandlerEsdBranch.C:47 sampleAliHLTOUTHandlerEsdBranch.C:48 sampleAliHLTOUTHandlerEsdBranch.C:49 sampleAliHLTOUTHandlerEsdBranch.C:50 sampleAliHLTOUTHandlerEsdBranch.C:51 sampleAliHLTOUTHandlerEsdBranch.C:52 sampleAliHLTOUTHandlerEsdBranch.C:53 sampleAliHLTOUTHandlerEsdBranch.C:54 sampleAliHLTOUTHandlerEsdBranch.C:55 sampleAliHLTOUTHandlerEsdBranch.C:56 sampleAliHLTOUTHandlerEsdBranch.C:57 sampleAliHLTOUTHandlerEsdBranch.C:58 sampleAliHLTOUTHandlerEsdBranch.C:59 sampleAliHLTOUTHandlerEsdBranch.C:60 sampleAliHLTOUTHandlerEsdBranch.C:61 sampleAliHLTOUTHandlerEsdBranch.C:62 sampleAliHLTOUTHandlerEsdBranch.C:63 sampleAliHLTOUTHandlerEsdBranch.C:64 sampleAliHLTOUTHandlerEsdBranch.C:65 sampleAliHLTOUTHandlerEsdBranch.C:66 sampleAliHLTOUTHandlerEsdBranch.C:67 sampleAliHLTOUTHandlerEsdBranch.C:68 sampleAliHLTOUTHandlerEsdBranch.C:69 sampleAliHLTOUTHandlerEsdBranch.C:70 sampleAliHLTOUTHandlerEsdBranch.C:71 sampleAliHLTOUTHandlerEsdBranch.C:72 sampleAliHLTOUTHandlerEsdBranch.C:73 sampleAliHLTOUTHandlerEsdBranch.C:74 sampleAliHLTOUTHandlerEsdBranch.C:75 sampleAliHLTOUTHandlerEsdBranch.C:76 sampleAliHLTOUTHandlerEsdBranch.C:77 sampleAliHLTOUTHandlerEsdBranch.C:78 sampleAliHLTOUTHandlerEsdBranch.C:79 sampleAliHLTOUTHandlerEsdBranch.C:80 sampleAliHLTOUTHandlerEsdBranch.C:81 sampleAliHLTOUTHandlerEsdBranch.C:82 sampleAliHLTOUTHandlerEsdBranch.C:83 sampleAliHLTOUTHandlerEsdBranch.C:84 sampleAliHLTOUTHandlerEsdBranch.C:85 sampleAliHLTOUTHandlerEsdBranch.C:86 sampleAliHLTOUTHandlerEsdBranch.C:87 sampleAliHLTOUTHandlerEsdBranch.C:88 sampleAliHLTOUTHandlerEsdBranch.C:89 sampleAliHLTOUTHandlerEsdBranch.C:90 sampleAliHLTOUTHandlerEsdBranch.C:91 sampleAliHLTOUTHandlerEsdBranch.C:92 sampleAliHLTOUTHandlerEsdBranch.C:93 sampleAliHLTOUTHandlerEsdBranch.C:94 sampleAliHLTOUTHandlerEsdBranch.C:95 sampleAliHLTOUTHandlerEsdBranch.C:96 sampleAliHLTOUTHandlerEsdBranch.C:97 sampleAliHLTOUTHandlerEsdBranch.C:98 sampleAliHLTOUTHandlerEsdBranch.C:99 sampleAliHLTOUTHandlerEsdBranch.C:100 sampleAliHLTOUTHandlerEsdBranch.C:101 sampleAliHLTOUTHandlerEsdBranch.C:102 sampleAliHLTOUTHandlerEsdBranch.C:103 sampleAliHLTOUTHandlerEsdBranch.C:104 sampleAliHLTOUTHandlerEsdBranch.C:105 sampleAliHLTOUTHandlerEsdBranch.C:106 sampleAliHLTOUTHandlerEsdBranch.C:107 sampleAliHLTOUTHandlerEsdBranch.C:108 sampleAliHLTOUTHandlerEsdBranch.C:109 sampleAliHLTOUTHandlerEsdBranch.C:110 sampleAliHLTOUTHandlerEsdBranch.C:111 sampleAliHLTOUTHandlerEsdBranch.C:112 sampleAliHLTOUTHandlerEsdBranch.C:113 sampleAliHLTOUTHandlerEsdBranch.C:114 sampleAliHLTOUTHandlerEsdBranch.C:115 sampleAliHLTOUTHandlerEsdBranch.C:116 sampleAliHLTOUTHandlerEsdBranch.C:117 sampleAliHLTOUTHandlerEsdBranch.C:118 sampleAliHLTOUTHandlerEsdBranch.C:119 sampleAliHLTOUTHandlerEsdBranch.C:120 sampleAliHLTOUTHandlerEsdBranch.C:121 sampleAliHLTOUTHandlerEsdBranch.C:122 sampleAliHLTOUTHandlerEsdBranch.C:123 sampleAliHLTOUTHandlerEsdBranch.C:124 sampleAliHLTOUTHandlerEsdBranch.C:125 sampleAliHLTOUTHandlerEsdBranch.C:126 sampleAliHLTOUTHandlerEsdBranch.C:127 sampleAliHLTOUTHandlerEsdBranch.C:128 sampleAliHLTOUTHandlerEsdBranch.C:129 sampleAliHLTOUTHandlerEsdBranch.C:130 sampleAliHLTOUTHandlerEsdBranch.C:131 sampleAliHLTOUTHandlerEsdBranch.C:132 sampleAliHLTOUTHandlerEsdBranch.C:133 sampleAliHLTOUTHandlerEsdBranch.C:134 sampleAliHLTOUTHandlerEsdBranch.C:135 sampleAliHLTOUTHandlerEsdBranch.C:136 sampleAliHLTOUTHandlerEsdBranch.C:137 sampleAliHLTOUTHandlerEsdBranch.C:138 sampleAliHLTOUTHandlerEsdBranch.C:139 sampleAliHLTOUTHandlerEsdBranch.C:140 sampleAliHLTOUTHandlerEsdBranch.C:141 sampleAliHLTOUTHandlerEsdBranch.C:142 sampleAliHLTOUTHandlerEsdBranch.C:143 sampleAliHLTOUTHandlerEsdBranch.C:144 sampleAliHLTOUTHandlerEsdBranch.C:145 sampleAliHLTOUTHandlerEsdBranch.C:146 sampleAliHLTOUTHandlerEsdBranch.C:147 sampleAliHLTOUTHandlerEsdBranch.C:148 sampleAliHLTOUTHandlerEsdBranch.C:149 sampleAliHLTOUTHandlerEsdBranch.C:150 sampleAliHLTOUTHandlerEsdBranch.C:151 sampleAliHLTOUTHandlerEsdBranch.C:152 sampleAliHLTOUTHandlerEsdBranch.C:153 sampleAliHLTOUTHandlerEsdBranch.C:154 sampleAliHLTOUTHandlerEsdBranch.C:155 sampleAliHLTOUTHandlerEsdBranch.C:156 sampleAliHLTOUTHandlerEsdBranch.C:157 sampleAliHLTOUTHandlerEsdBranch.C:158 sampleAliHLTOUTHandlerEsdBranch.C:159 sampleAliHLTOUTHandlerEsdBranch.C:160 sampleAliHLTOUTHandlerEsdBranch.C:161 sampleAliHLTOUTHandlerEsdBranch.C:162 sampleAliHLTOUTHandlerEsdBranch.C:163 sampleAliHLTOUTHandlerEsdBranch.C:164 sampleAliHLTOUTHandlerEsdBranch.C:165 sampleAliHLTOUTHandlerEsdBranch.C:166 sampleAliHLTOUTHandlerEsdBranch.C:167 sampleAliHLTOUTHandlerEsdBranch.C:168 sampleAliHLTOUTHandlerEsdBranch.C:169 sampleAliHLTOUTHandlerEsdBranch.C:170 sampleAliHLTOUTHandlerEsdBranch.C:171 sampleAliHLTOUTHandlerEsdBranch.C:172