]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - HLT/global/macros/makeGlobalHistoConfigObject.C
configurable histogram titles added (Hege)
[u/mrichter/AliRoot.git] / HLT / global / macros / makeGlobalHistoConfigObject.C
... / ...
CommitLineData
1// $Id$
2/**
3 * @file makeGlobalHistoConfigObject.C
4 * @brief Creation of Global Histo component configuration objects in OCDB
5 *
6 * <pre>
7 * Usage:
8 * aliroot -b -q makeGlobalHistoConfigObject.C'("path", "key", "uri", runmin, runmax)'
9 * </pre>
10 *
11 * Create an OCDB entry with a TObjString containing param.
12 * Many HLT components understand configuration strings containing
13 * arguments and parameters just like the command line arguments.
14 * This macro facilitates the creation of an appropriate object
15 * from a parameter string.
16 * As another approach the TObjString parameters are stored in a TMap
17 * associated to a key. A TMap object is generated if 'key' is specified.
18 *
19 * Parameters: <br>
20 * - path path of the entry within the OCDB (e.g. HLT/ConfigHLT/GlobalHisto)
21 * - uri (opt) the OCDB URI, default $ALICE_ROOT/OCDB
22 * - runmin (opt) default 0
23 * - runmax (opt) default 999999999
24 * The parameters of the component configuration should be defined inside function makeString().
25 *
26 * Note: The configuration procedure of an HLT component is not
27 * restricted to that scheme. The implementation is up to the
28 * developer and more complex objects are possible.
29 *
30 * @author Kalliopi.Kanaki@ift.uib.no
31 * @ingroup alihlt_tutorial
32 */
33void makeGlobalHistoConfigObject(const char* path,
34 const char* key,
35 //const char* param,
36 const char* cdbUri,
37 int runmin=0,
38 int runmax=999999999,
39 int runNo=0)
40{
41 AliCDBManager* man = AliCDBManager::Instance();
42 if (!man) {
43 cerr << "Cannot get AliCDBManager." << end;
44 exit;
45 }
46 TString storage;
47 if (!man->IsDefaultStorageSet()) {
48 if (cdbUri) {
49 storage=cdbUri;
50 if (storage.Contains("://")==0) {
51 storage="local://"; storage+=cdbUri;
52 }
53 } else {
54 storage="local://$ALICE_ROOT/OCDB";
55 }
56 man->SetDefaultStorage(storage);
57 } else {
58 storage = man->GetDefaultStorage()->GetURI();
59 }
60
61 TMap* pMap=NULL;
62
63 // load existing object and init TMap
64 AliCDBEntry* pExisting=NULL;
65 AliCDBStorage* pStorage=AliCDBManager::Instance()->GetDefaultStorage();
66 if (key && pStorage->GetLatestVersion(path, runNo)>=0) {
67 pExisting=pStorage->Get(path, runNo);
68 if (pExisting->GetObject()->IsA() == TMap::Class()) {
69 pMap=(TMap*)pExisting->GetObject()->Clone();
70 }
71 }
72
73 if (key && !pMap) pMap=new TMap;
74
75 // here is the actual content of the configuration object
76 TObject* obj=new TObjString(makeString()); //KK
77 //TObject* obj=new TObjString(param);
78 if (pMap) {
79 if (pMap->FindObject(key)) {
80 pMap->Remove(new TObjString(key));
81 }
82 pMap->Add(new TObjString(key), obj);
83 obj=pMap;
84 }
85
86 AliCDBPath cdbPath(path);
87 AliCDBId cdbId(cdbPath, runmin, runmax);
88 AliCDBMetaData* cdbMetaData=NULL;
89 if (pExisting) cdbMetaData=pExisting->GetMetaData();
90 else cdbMetaData=new AliCDBMetaData;
91 man->Put(obj, cdbId, cdbMetaData);
92}
93
94// void makeGlobalHistoConfigObject(const char* path
95// ,//const char* param="",
96// ,const char* cdbUri=NULL
97// ,int runmin=0
98// ,int runmax=999999999)
99// {
100// //makeGlobalHistoConfigObject(path, NULL, param, cdbUri, runmin, runmax);
101// makeGlobalHistoConfigObject(path, NULL, makeString(), cdbUri, runmin, runmax); //KK
102// }
103//
104// void makeComponentConfigurationObject(const char* path,
105// int runNo,
106// const char* key,
107// const char* param)
108// {
109// makeComponentConfigurationObject(path, key, param, NULL, 0, 999999999, runNo);
110// }
111
112void makeGlobalHistoConfigObject()
113{
114 cout << "===============================================================" << endl;
115 cout << "usage: aliroot -b -q -l makeGlobalHistoConfigObject.C'(\"path\", NULL, \"uri\", rangemin, rangemax)'" << endl << endl;
116 cout << " path path of the entry within the OCDB, e.g. HLT/ConfigHLT/GlobalHisto" << endl;
117 cout << " uri (opt) the OCDB URI, default $ALICE_ROOT/OCDB " << endl;
118 cout << " rangemin (opt) default 0" << endl;
119 cout << " rangemax (opt) default 999999999" << endl;
120 cout << " The parameters of the component configuration should be defined inside function makeString()." << endl;
121 cout << "===============================================================" << endl;
122}
123
124TString makeString(){
125
126 TString s = "";
127
128 s+="-max-track-count 8000 ";
129 //s+="-max-track-count 8000 -fill-V0 -max-V0-count 200 ";
130
131 s+="-histogram TrackPt(100,0,20) -size 1000 -expression Track_pt -cut Track_TPCclus>0 ";
132 s+="-histogram TrackPhi(180,0,360) -size 1000 -expression Track_phi -cut Track_TPCclus>0 ";
133 s+="-histogram TrackMultiplicity(250,0,5000) -size 1000 -expression trackcount ";
134 s+="-histogram TrackEta(100,-2,2) -size 1000 -expression Track_eta -cut Track_TPCclus>0 ";
135 s+="-histogram TrackTPCclus(200,0,200) -size 1000 -expression Track_TPCclus -cut Track_TPCclus>0 ";
136 s+="-histogram TrackITSclus(7,0,7) -size 1000 -expression Track_ITSclus ";
137 s+="-histogram TrackTheta(90,0,180) -size 1000 -expression Track_theta -cut Track_TPCclus>0 ";
138 s+="-histogram TrackDCAr(100,-50,50) -size 1000 -expression Track_DCAr -cut Track_TPCclus>0 ";
139 s+="-histogram TrackCharge -size 1000 -expression Track_charge -cut Track_TPCclus>0 ";
140
141 s+="-histogram VertexXY -size 1000 -expression vertexY:vertexX -cut nContributors>3 -opt colz ";
142 s+="-histogram VertexX(50,-5,5) -size 1000 -expression vertexX -cut nContributors>3 ";
143 s+="-histogram VertexY(50,-5,5) -size 1000 -expression vertexY -cut nContributors>3 ";
144 s+="-histogram VertexZ(200,-50,50) -size 1000 -expression vertexZ -cut nContributors>3 ";
145 s+="-histogram VertexTrendX -size 1000 -expression vertexX:event -cut nContributors>3 ";
146 s+="-histogram VertexTrendY -size 1000 -expression vertexY:event -cut nContributors>3 ";
147
148
149 return s;
150}