2 // $Id: makeTriggerConfigurationObject.C $
4 * @file makeTriggerConfigurationObject.C
5 * @brief Creation of HLT component configuration objects in OCDB
8 * Usage: aliroot -b -q makeTriggerConfigurationObject.C'("triggerName", "cdbUri", runMin, runMax)'
11 * Create an CDB entry for a certain trigger.
13 * According to <Trigger-Identifier>, <Minor Version> and <Major Versions>,
14 * CDB objects are created and saved in the CDB. This objects can be any TObject
15 * and have to implemented according to the trigger needs.
18 * In the path in the CDB '-' is replaced by '_._'
21 * - triggerName Trigger Name following the standard
22 * H-<Trigger-Identifier>-VXXXX.YYY
23 - VXXXX being the major version number, specifying the settings
24 - YYY being the minor version number, specifying the alogrithm version
25 * - cdbUri (opt) the CDB URI, default $ALICE_ROOT
26 * - runMin (opt) default 0
27 * - runMax (opt) default 999999999
29 * Implemented Trigger : <br>
30 * - Barrel_pT_Single -> AliHLTESDTrackCuts object
32 * Usage Example : <br>
33 * aliroot -b -l -q makeTriggerConfigurationObject.C'("H-Barrel_pT_Single-V0001.001")'
35 * @author Jochen Thaeder <jochen@thaeder.de>
36 * @ingroup alihlt_trigger
39 // #################################################################################
40 void makeTriggerConfigurationObject(const Char_t* triggerName, const Char_t* cdbUri=NULL,
41 Int_t runMin=0, Int_t runMax=AliCDBRunRange::Infinity() ) {
43 gSystem->Load("libANALYSIS.so");
44 gSystem->Load("libANALYSISalice.so");
45 gSystem->Load("libHLTbase.so");
46 gSystem->Load("libAliHLTUtil.so");
48 // --------------------------------------
49 // -- Parse Trigger Name
50 // --------------------------------------
52 TString name(triggerName);
53 if ( !name.BeginsWith("H-") ) {
54 cerr << "Error : " << name.Data() << " is not a valid trigger name!" << endl;
58 TObjArray* entries = name.Tokenize("-");
59 if (entries->GetEntriesFast() != 3 ) {
60 cerr << "Error : " << name.Data() << " is not a valid trigger name!" << endl;
64 TString id = (static_cast<TObjString*>(entries->UncheckedAt(1)))->GetString();
66 TObjArray* version = (static_cast<TObjString*>(entries->UncheckedAt(2)))->GetString().Tokenize(".");
67 if (version->GetEntriesFast() != 2 ) {
68 cerr << "Error : " << name.Data() << " is not a valid trigger name!" << endl;
72 // -- Major version ID = Settings
73 TString major = (static_cast<TObjString*>(version->UncheckedAt(0)))->GetString();
75 // -- Minor version ID = Algorithm
76 TString minor = (static_cast<TObjString*>(version->UncheckedAt(1)))->GetString();
79 // -------------------------------------------------------------------------------------
81 printf ("Trigger Setup for : %s \n", triggerName);
83 // --------------------------------------
84 // -- Create Configuration Object
85 // --------------------------------------
87 TObject* configObj = NULL;
89 if ( !id.CompareTo("Barrel_pT_Single") ) { // ----------------------------------------
91 AliHLTESDTrackCuts* esdTrackCuts = NULL;
94 if ( !minor.CompareTo("001") ) {
95 printf (" - Trigger Setup for 2010 pp data.\n");
97 esdTrackCuts = AliHLTESDTrackCuts::GetStandardTrackCuts2010pp();
98 description += esdTrackCuts->GetTitle();
100 // -- pt cut 1 GeV - minClusters 80
101 if ( !major.CompareTo("V0001") ) {
102 esdTrackCuts->SetPtRange(1.);
103 esdTrackCuts->SetMinNClustersTPC(80);
104 description += " && p_t > 1 GeV/c && clustersTPC > 80";
106 // -- pt cut 2 GeV - minClusters 80
107 else if ( !major.CompareTo("V0002") ) {
108 esdTrackCuts->SetPtRange(2.);
109 esdTrackCuts->SetMinNClustersTPC(80);
110 description += " && p_t > 2 GeV/c && clustersTPC > 80";
112 // -- pt cut 3 GeV - minClusters 100
113 else if ( !major.CompareTo("V0003") ) {
114 esdTrackCuts->SetPtRange(3.);
115 esdTrackCuts->SetMinNClustersTPC(100);
116 description += " && p_t > 3 GeV/c && clustersTPC > 100";
119 cerr << "Error : Major version " << major.Data() << " is not implemented!" << endl;
124 cerr << "Error : Minor version " << minor.Data() << " is not implemented!" << endl;
128 if ( !esdTrackCuts ) {
129 cerr << "Error : No AliHLTESDTrackCuts object created" << endl;
133 esdTrackCuts->SetTitle(description);
134 configObj = static_cast<TObject*>(esdTrackCuts);
136 else { // ------------------------------------------------------------------------------
137 cerr << "Error : Trigger name " << id.Data() << " is not implemented!" << endl;
141 // -------------------------------------------------------------------------------------
142 printf(" - TrackCuts : %s\n", esdTrackCuts->GetTitle());
144 // --------------------------------------
146 // --------------------------------------
148 AliCDBManager* man = AliCDBManager::Instance();
150 cerr << "Error : Can not get AliCDBManager" << endl;
155 if ( !man->IsDefaultStorageSet() ) {
158 if ( storage.Contains("://") == 0 ) {
159 storage = "local://";
164 storage = "local://$ALICE_ROOT/OCDB";
166 man->SetDefaultStorage(storage);
169 storage = man->GetDefaultStorage()->GetURI();
172 TString path("HLT/ConfigHLT/");
173 path += name.ReplaceAll("-",1,"_._",3);
175 // --------------------------------------
177 // --------------------------------------
180 cerr << "Error : No configuration object created" << endl;
184 AliCDBPath cdbPath(path);
185 AliCDBId cdbId(cdbPath, runMin, runMax);
186 AliCDBMetaData cdbMetaData;
187 man->Put(configObj, cdbId, &cdbMetaData);
189 printf("Adding %s type OCDB object to %s [%d,%d] in %s \n",
190 configObj->ClassName(),
192 runMin, runMax, storage.Data());
194 // --------------------------------------
196 // --------------------------------------
209 // #################################################################################
210 void makeTriggerConfigurationObject() {
212 cout << "===============================================================" << endl;
213 cout << "usage: aliroot -b -q -l makeComponentConfigurationObject.C'(\"triggerName\", \"cdbUri\", rangeMin, rangeMax)'" << endl << endl;
214 cout << " triggerName Trigger Name following the standard" << endl;
215 cout << " H-<Trigger-Identifier>-VXXXX.YYY" << endl;
216 cout << " - VXXXX being the major version number, specifying the settings" << endl;
217 cout << " - YYY being the minor version number, specifying the alogrithm version" << endl;
218 cout << " cdbUri (opt) the OCDB URI, default $ALICE_ROOT/OCDB " << endl;
219 cout << " rangeMin (opt) default 0" << endl;
220 cout << " rangeMax (opt) default 999999999" << endl << endl;
221 cout << "example: aliroot -b -l -q makeTriggerConfigurationObject.C'(\"H-Barrel_pT_Single-V0001.001\")'" << endl;
222 cout << "===============================================================" << endl;