]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/trigger/CreateTriggerMenuCDBEntry.C
flat friends update
[u/mrichter/AliRoot.git] / HLT / trigger / CreateTriggerMenuCDBEntry.C
1 //$Id$
2 /**************************************************************************
3  * This file is property of and copyright by the ALICE HLT Project        *
4  * All rights reserved.                                                   *
5  *                                                                        *
6  * Primary Authors:                                                       *
7  *   Artur Szostak <artursz@iafrica.com>                                  *
8  *                                                                        *
9  * Permission to use, copy, modify and distribute this software and its   *
10  * documentation strictly for non-commercial purposes is hereby granted   *
11  * without fee, provided that the above copyright notice appears in all   *
12  * copies and that both the copyright notice and this permission notice   *
13  * appear in the supporting documentation. The authors make no claims     *
14  * about the suitability of this software for any purpose. It is          *
15  * provided "as is" without express or implied warranty.                  *
16  **************************************************************************/
17
18 /**
19  * \ingroup macros
20  * \file CreateTriggerMenuCDBEntry.C
21  * \brief Macro for generating the trigger menu CDB entry for the HLT global trigger.
22  *
23  * This macro is used to generate a default CDB entry for the HLT global trigger.
24  * The trigger menu is used by the HLT global trigger as a configuration object.
25  * It is an experts macro so make sure you know what you are doing.
26  *
27  * You can run this macro with defaults using the following shell command:
28  * \code
29  *   > aliroot -b -q $ALICE_ROOT/HLT/trigger/CreateTriggerMenuCDBEntry.C
30  * \endcode
31  *
32  * \author Artur Szostak <artursz@iafrica.com>
33  */
34
35 #if !defined(__CINT__) || defined(__MAKECINT__)
36 #include "AliCDBManager.h"
37 #include "AliCDBStorage.h"
38 #include "AliCDBEntry.h"
39 #include "AliHLTTriggerMenu.h"
40 #include "AliHLTGlobalTriggerConfig.h"
41 #include "TObjString.h"
42 #include "TString.h"
43 #include "TSystem.h"
44 #include "Riostream.h"
45 using std::cerr;
46 using std::endl;
47 #endif
48
49 /**
50  * Generates a default CDB entry for the trigger menu in the given CDB storage
51  * (local by default).
52  * \param cdbPath  The path to the default CDB storage.
53  */
54 void CreateTriggerMenuCDBEntry(
55                 const char* cdbPath = "local://$ALICE_ROOT/OCDB",
56                 Int_t version = 0,
57                 Int_t firstRun = 0,
58                 Int_t lastRun = AliCDBRunRange::Infinity()
59         )
60 {
61         gSystem->Load("libAliHLTUtil.so");
62         gSystem->Load("libAliHLTTRD.so");
63         gSystem->Load("libAliHLTMUON.so");
64         gSystem->Load("libAliHLTTrigger.so");
65
66         // Setup the CDB default storage and run number.
67         AliCDBManager* cdbManager = AliCDBManager::Instance();
68         if (cdbManager == NULL)
69         {
70                 cerr << "ERROR: Global CDB manager object does not exist." << endl;
71                 return;
72         }
73         AliCDBStorage* storage = cdbManager->GetStorage(cdbPath);
74         if (storage == NULL)
75         {
76                 cerr << "ERROR: Could not get storage for: " << cdbPath << endl;
77                 return;
78         }
79
80         ///////////////////////////////////////////////////////////////////////////////////////////     
81         // Create the trigger menu.
82         AliHLTGlobalTriggerConfig config("Default Global Trigger Config");
83
84         config.AddSymbol("domainAll", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"*******:***\")");
85
86         ///////////////////////////////////////////////////////////////////////////////////////////     
87         // the domain definitions for the global HLT output and the HLT DDLs
88         config.AddSymbol("domainHLTOUT", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"*******:HLT \")");
89         config.AddSymbol("domainHLTDDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:HLT\\0\")");
90         config.AddSymbol("domainALLDDL", "AliHLTTriggerDomain", "", "AliHLTTriggerDomain(\"DAQRDOUT:***\\0\")");
91
92         ///////////////////////////////////////////////////////////////////////////////////////////     
93         // NOTE: always make sure that the global HLT output and the HLT DDLs are included
94         // in the readout, i.e. add domainHLTOUT|domainHLTDDL to the trigger domain
95         config.AddItem("BarrelMultiplicityTrigger", "BarrelMultiplicityTrigger|domainHLTOUT|domainALLDDL", "charged barrel track multiplicity triggered");
96         config.AddItem("MuonSpectroTrigger", "MuonSpectroTrigger|domainHLTOUT|domainALLDDL", "Muon spectrometer triggered");
97         
98         ///////////////////////////////////////////////////////////////////////////////////////////     
99         // default domain in case there is no global trigger
100         // readout the output of the reconstruction
101         // this refers to the domain domainHLTOUT|domainHLTDDL
102         config.SetDefaultTriggerDescription("No HLT global trigger");
103         config.DefaultTriggerDomain().Add("*******", "HLT ");
104         AliHLTReadoutList readoutlist;
105         readoutlist.Enable(AliHLTReadoutList::kHLT);
106         config.DefaultTriggerDomain().Add(readoutlist);
107
108         TObject* menu = AliHLTGlobalTriggerConfig::Menu()->Clone();
109         menu->Print();
110
111         ///////////////////////////////////////////////////////////////////////////////////////////     
112         // Write the trigger menu object to the CDB.
113         AliCDBId id("HLT/ConfigHLT/HLTGlobalTrigger", firstRun, lastRun, version);
114         AliCDBMetaData* metaData = new AliCDBMetaData();
115         metaData->SetResponsible("HLT");
116         metaData->SetComment("Default trigger menu for HLT global trigger.");
117         storage->Put(menu, id, metaData);
118 }