]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/trigger/CreateTriggerMenuCDBEntry.C
Adding default HLT trigger menu object to AliRoot CDB and macro for generating it.
[u/mrichter/AliRoot.git] / HLT / trigger / CreateTriggerMenuCDBEntry.C
CommitLineData
3da1c6d7 1/**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
4 * *
5 * Primary Authors: *
6 * Artur Szostak <artursz@iafrica.com> *
7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16
17/**
18 * \ingroup macros
19 * \file CreateTriggerMenuCDBEntry.C
20 * \brief Macro for generating the trigger menu CDB entry for the HLT global trigger.
21 *
22 * This macro is used to generate a default CDB entry for the HLT global trigger.
23 * The trigger menu is used by the HLT global trigger as a configuration object.
24 * It is an experts macro so make sure you know what you are doing.
25 *
26 * You can run this macro with defaults using the following shell command:
27 * \code
28 * > aliroot -b -q $ALICE_ROOT/HLT/trigger/CreateTriggerMenuCDBEntry.C
29 * \endcode
30 *
31 * \author Artur Szostak <artursz@iafrica.com>
32 */
33
34#if !defined(__CINT__) || defined(__MAKECINT__)
35#include "AliCDBManager.h"
36#include "AliCDBStorage.h"
37#include "AliCDBEntry.h"
38#include "AliHLTTriggerMenu.h"
39#include "AliHLTGlobalTriggerConfig.h"
40#include "TObjString.h"
41#include "TString.h"
42#include "TSystem.h"
43#include "Riostream.h"
44using std::cerr;
45using std::endl;
46#endif
47
48/**
49 * Generates a default CDB entry for the trigger menu in the given CDB storage
50 * (local by default).
51 * \param cdbPath The path to the default CDB storage.
52 */
53void CreateTriggerMenuCDBEntry(
54 const char* cdbPath = "local://$ALICE_ROOT/OCDB",
55 Int_t version = 0,
56 Int_t firstRun = 0,
57 Int_t lastRun = AliCDBRunRange::Infinity()
58 )
59{
60 gSystem->Load("libAliHLTTrigger.so");
61
62 // Setup the CDB default storage and run number.
63 AliCDBManager* cdbManager = AliCDBManager::Instance();
64 if (cdbManager == NULL)
65 {
66 cerr << "ERROR: Global CDB manager object does not exist." << endl;
67 return;
68 }
69 AliCDBStorage* storage = cdbManager->GetStorage(cdbPath);
70 if (storage == NULL)
71 {
72 cerr << "ERROR: Could not get storage for: " << cdbPath << endl;
73 return;
74 }
75
76 // Create the trigger menu.
77 AliHLTGlobalTriggerConfig config("Default Global Trigger Config");
78 config.AddSymbol("triggerClasses", "AliHLTUInt64_t", "this->GetTriggerClasses()", "0x0", "AliHLTEventSummary");
79 config.AddSymbol("domainAll", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"*******:***\")");
80 config.AddItem("triggerClasses != 0x0", "domainAll", "CTP triggered");
81 TObject* menu = AliHLTGlobalTriggerConfig::Menu()->Clone();
82 menu->Print();
83
84 // Write the trigger menu object to the CDB.
85 AliCDBId id("HLT/ConfigHLT/HLTGlobalTrigger", firstRun, lastRun, version);
86 AliCDBMetaData* metaData = new AliCDBMetaData();
87 metaData->SetResponsible("HLT");
88 metaData->SetComment("Default trigger menu for HLT global trigger.");
89 storage->Put(menu, id, metaData);
90}