forked from alisw/AliDPG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOCDBConfig.C
200 lines (161 loc) · 6.04 KB
/
OCDBConfig.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/*
* AliDPG - ALICE Experiment Data Preparation Group
* OCDB configuration script
*
*/
enum EOCDB_t {
kOCDBDefault,
kOCDBCustom,
kNOCDBs
};
const Char_t *OCDBName[kNOCDBs] = {
"Default",
"Custom"
};
void OCDBDefault(Int_t mode);
void DefaultSpecificStorage(AliCDBManager *man, Int_t mode);
Bool_t RecoParamWithTPCDistortions(AliCDBManager *man);
void NoDistortionSpecificStorage(AliCDBManager *man, Int_t mode);
/*****************************************************************/
void OCDBConfig(Int_t tag, Int_t type)
{
switch (tag) {
// kOCDBDefault
case kOCDBDefault:
OCDBDefault(type);
break;
// kOCDBCustom
case kOCDBCustom:
if ((gROOT->LoadMacro("OCDBCustom.C")) != 0) {
printf("ERROR: cannot find OCDBCustom.C\n");
abort();
return;
}
gROOT->ProcessLine(Form("OCDBCustom(%d);",type));
break;
}
}
/*****************************************************************/
void OCDBDefault(Int_t mode)
{
Int_t run = atoi(gSystem->Getenv("CONFIG_RUN"));
AliCDBManager* man = AliCDBManager::Instance();
man->SetDefaultStorage("raw://");
if(gSystem->Getenv("CONFIG_OCDBTIMESTAMP"))
{
TString t = gSystem->Getenv("CONFIG_OCDBTIMESTAMP");
TObjArray* list =t.Tokenize("_");
UInt_t tU[6];
for(Int_t i=0; i<list->GetEntries(); i++)
{
TString st = ((TObjString*)list->At(i))->GetString();
tU[i] =(UInt_t)atoi(st.Data());
}
man->SetMaxDate(TTimeStamp(tU[0], tU[1], tU[2], tU[3], tU[4], tU[5]));
printf("*** Setting custom OCDB time stamp %s ***\n", t.Data());
}
man->SetRun(run);
// set detector specific paths
DefaultSpecificStorage(man, mode);
}
/*****************************************************************/
void DefaultSpecificStorage(AliCDBManager *man, Int_t mode)
{
AliCDBEntry *cdbe = man->Get("GRP/GRP/Data");
if (!cdbe) return NULL;
AliGRPObject *grp = (AliGRPObject *)cdbe->GetObject();
TDatime date = grp->GetTimeStart();
Int_t year = date.GetYear();
const Char_t *Raw = Form("alien://Folder=/alice/data/%d/OCDB", year);
const Char_t *Ideal = "alien://Folder=/alice/simulation/2008/v4-15-Release/Ideal/";
const Char_t *Residual = "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/";
const Char_t *Full = "alien://Folder=/alice/simulation/2008/v4-15-Release/Full/";
// for AD hack
const Char_t *Raw2015 = "alien://Folder=/alice/data/2015/OCDB";
// DEFAULT SPECIFIC OBJECTS
const Char_t *SpecificStorageList[][3] = {
// path sim rec
//
// ITS
"ITS/Align/Data", Ideal, Residual, // ok
"ITS/Calib/SPDSparseDead", Full, Residual, // ok ?
// TPC
"TPC/Calib/ClusterParam", Ideal, Residual, // ok!
"TPC/Calib/RecoParam", Residual, Residual, // ok!
"TPC/Calib/TimeGain", Ideal, Residual, // ok!
"TPC/Calib/Correction", Ideal, Residual, // ok!
// MUON
"MUON/Align/Data", Full, NULL, // ok!
// ZDC
"ZDC/Align/Data", Ideal, Ideal, // ok
"ZDC/Calib/Pedestals", Ideal, Ideal // added (11.12.2017)
};
const Int_t nSpecificStorages = sizeof(SpecificStorageList) / (3 * sizeof(Char_t *));
// set specific storages
for (Int_t isto = 0; isto < nSpecificStorages; isto++) {
if (SpecificStorageList[isto][mode+1]) {
printf("Setting specific storage: %s -> %s\n", SpecificStorageList[isto][0], SpecificStorageList[isto][mode+1]);
man->SetSpecificStorage(SpecificStorageList[isto][0], SpecificStorageList[isto][mode+1]);
}
}
// EXTRA SPECIFIC OBJECTS IF NO DISTORTIONS
if (!RecoParamWithTPCDistortions(man)) {
printf("Not using TPC distortions, need extra specific storages\n");
NoDistortionSpecificStorage(man, mode);
}
// Run-1 settings
if (year < 2015) {
man->SetSpecificStorage("AD/Calib/QAParam", Raw2015);
const Char_t *muonHack[2] = {Ideal, Residual};
man->SetSpecificStorage("MUON/Align/Data", muonHack[mode]);
}
}
/*****************************************************************/
void NoDistortionSpecificStorage(AliCDBManager *man, Int_t mode) {
const Char_t *Ideal = "alien://Folder=/alice/simulation/2008/v4-15-Release/Ideal/";
const Char_t *Residual = "alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/";
const Char_t *SpecificStorageList[][3] = {
// path sim rec
//
"TPC/Align/Data", Ideal, Residual, // ok!
"TPC/Calib/TimeDrift", Ideal, Residual // ok!
};
const Int_t nSpecificStorages = sizeof(SpecificStorageList) / (3 * sizeof(Char_t *));
for (Int_t isto = 0; isto < nSpecificStorages; isto++) {
if (SpecificStorageList[isto][mode+1]) {
printf("Setting specific storage: %s -> %s\n", SpecificStorageList[isto][0], SpecificStorageList[isto][mode+1]);
man->SetSpecificStorage(SpecificStorageList[isto][0], SpecificStorageList[isto][mode+1]);
}
}
}
/*****************************************************************/
Bool_t
RecoParamWithTPCDistortions(AliCDBManager *man) {
// check methods exist
if (!AliRecoParam::Class()->GetMethodAny("SuggestRunEventSpecie"))
return kFALSE;
if (!AliTPCRecoParam::Class()->GetMethodAny("GetUseCorrectionMap"))
return kFALSE;
// get event specie from GRP
AliCDBEntry *grpe = man->Get("GRP/GRP/Data");
if (!grpe) return kFALSE;
AliGRPObject *grp = (AliGRPObject *)grpe->GetObject();
AliRecoParam::EventSpecie_t evs = AliRecoParam::SuggestRunEventSpecie(grp->GetRunType(),
grp->GetBeamType(),
grp->GetLHCState());
// get TPC RecoParam for event specie
AliCDBEntry *pare = man->Get("TPC/Calib/RecoParam");
if (!pare) return kFALSE;
TObjArray *parl = (TObjArray *)pare->GetObject();
AliTPCRecoParam *par = NULL;
for (Int_t i = parl->GetEntriesFast(); i--;) {
AliTPCRecoParam *p = (AliTPCRecoParam *)parl->UncheckedAt(i);
if (!p || !(p->GetEventSpecie() & evs)) continue;
par = p;
break;
}
// check if use correction map
if (!par->GetUseCorrectionMap())
return kFALSE;
return kTRUE;
}