@@ -93,13 +93,18 @@ void writeDCSMasks(const char* ccdbUrl, long timestamp, const char* outFilename
9393/// @brief Uploads the list of channels provided
9494/// @param ccdbUrl CCDB url
9595/// @param timestamp Timestamp
96- /// @param badChannels List of bad channels. Default is no bad channel
9796/// @param path Calibration object path
97+ /// @param channels List of bad channels. Default is no bad channel
9898void uploadBadChannels (const char * ccdbUrl , long timestamp , const std ::string path , std ::vector < o2 ::mid ::ColumnData > channels = {})
9999{
100100 o2 ::ccdb ::CcdbApi api ;
101101 api .init (ccdbUrl );
102102 std ::map < std ::string , std ::string > md ;
103+ if (timestamp == 1 && channels .empty ()) {
104+ // This is the default
105+ md ["default" ] = "true" ;
106+ md ["Created" ] = "1" ;
107+ }
103108 std ::cout << "Storing MID problematic channels (valid from " << timestamp << ") to " << path << "\n" ;
104109
105110 api .storeAsTFileAny (& channels , path , md , timestamp , o2 ::ccdb ::CcdbObjectInfo ::INFINITE_TIMESTAMP );
@@ -185,12 +190,12 @@ std::vector<o2::mid::ColumnData> makeFakeDeadChannels()
185190 // - expected refers to the expected fake dead channels obtained by Baptiste
186191 // by comparing the masked channels with the default masks.
187192 std ::vector < o2 ::mid ::ColumnData > fakeDeads ;
188- // fakeDeads.push_back({0, 3, 0x81, 0x0, 0x0, 0x0, 0x0 }); // 40; X1; expected: 0x0; data 10/2023
193+ fakeDeads .push_back ({0 , 3 , 0x81 , 0x0 , 0x0 , 0x0 , 0x1 }); // 40; X1; expected: 0x0; data 10/2023; data 06/2024; data 06/2024
189194 fakeDeads .push_back ({6 , 5 , 0x0 , 0x2a00 , 0x0 , 0x0 , 0x0 }); // 6c; X1; expected: 0x0; data 12/2023: 0x2e00
190195 fakeDeads .push_back ({7 , 5 , 0x0 , 0x6bff , 0x0 , 0x0 , 0x0 }); // 6e; X1; expected: 0x0; data 10/2023: 0x28ff
191196 fakeDeads .push_back ({9 , 5 , 0x0 , 0x0 , 0x0 , 0x0 , 0x2 }); // 60; Y2; expected: 0x0
192197 fakeDeads .push_back ({10 , 2 , 0x0 , 0x0 , 0x0 , 0x0 , 0xe0 }); // 31; Y2;
193- fakeDeads .push_back ({10 , 4 , 0x805f , 0x0 , 0x0 , 0x0 , 0x0 }); // 51; X2; expected: 0x905e; data 12/2023: 0x5f
198+ fakeDeads .push_back ({10 , 4 , 0x905f , 0x0 , 0x0 , 0x0 , 0x0 }); // 51; X2; expected: 0x905e; data 12/2023: 0x5f; data 06/2024
194199 fakeDeads .push_back ({14 , 5 , 0x0 , 0x0 , 0x0 , 0x0 , 0x80 }); // 69; Y2;
195200 fakeDeads .push_back ({16 , 2 , 0x0 , 0x0 , 0x0 , 0x0 , 0xe0 }); // 2c; Y2; expected: 0x80; data 10/2023: 0xa0
196201 fakeDeads .push_back ({16 , 3 , 0x0 , 0xf00 , 0x0 , 0x0 , 0x0 }); // 4e; X2; expected: 0x0; data 10/2023: 0x300
@@ -203,14 +208,14 @@ std::vector<o2::mid::ColumnData> makeFakeDeadChannels()
203208 fakeDeads .push_back ({44 , 5 , 0x2000 , 0x0 , 0x0 , 0x0 , 0x0 }); // ef; X1; expected: 0x0
204209 fakeDeads .push_back ({44 , 6 , 0x0 , 0x0 , 0x0 , 0x0 , 0xf }); // f8; Y1; expected: 0x0; data 10/2023: 0x7
205210 fakeDeads .push_back ({46 , 1 , 0x0 , 0x0 , 0x0 , 0x0 , 0xc0 }); // 91; Y2; expected: 0xc0; data 12/2023: 0x40
206- fakeDeads .push_back ({46 , 2 , 0x0 , 0x0 , 0x0 , 0x0 , 0xc0 }); // b1; Y2; expected: 0xe0; data 10/2023: 0xe0
211+ fakeDeads .push_back ({46 , 2 , 0x0 , 0x0 , 0x0 , 0x0 , 0xe0 }); // b1; Y2; expected: 0xe0; data 10/2023: 0xe0; data 06/2024
207212 fakeDeads .push_back ({46 , 3 , 0x0 , 0x0 , 0x0 , 0x0 , 0xc0 }); // c1; Y2;
208- fakeDeads .push_back ({46 , 4 , 0x0 , 0x0 , 0x0 , 0x0 , 0x58 }); // d1; Y2; expected: 0xe8; data 10/2023: 0x60
213+ fakeDeads .push_back ({46 , 4 , 0x0 , 0x0 , 0x0 , 0x0 , 0xf8 }); // d1; Y2; expected: 0xe8; data 10/2023: 0x60; data 06/2024
209214 fakeDeads .push_back ({46 , 5 , 0x0 , 0x0 , 0x0 , 0x0 , 0x60 }); // e1; Y2;
210- fakeDeads .push_back ({47 , 3 , 0x1 , 0x0 , 0x0 , 0x0 , 0x0 }); // c3; X2; expected: 0x9d; data 10/2023: 0x15
211- // fakeDeads.push_back({47, 5, 0x1, 0x0, 0x0, 0x0, 0x0}); // e3; X2; 0 (expected only)
212- fakeDeads .push_back ({52 , 2 , 0x0 , 0x0 , 0x0 , 0x0 , 0xf8 }); // ac; Y2; expected: 0xb0; data 10/2023: 0xf0
213- fakeDeads .push_back ({52 , 3 , 0x0 , 0x0 , 0x0 , 0x0 , 0x80 }); // cd; Y2; expected: 0x0
215+ fakeDeads .push_back ({47 , 3 , 0x5d , 0x0 , 0x0 , 0x0 , 0x0 }); // c3; X2; expected: 0x9d; data 10/2023: 0x15; data 06/2024
216+ fakeDeads .push_back ({47 , 5 , 0x1 , 0x0 , 0x0 , 0x0 , 0x0 }); // e3; data 06/2023; data 06/2024
217+ fakeDeads .push_back ({52 , 2 , 0x0 , 0x0 , 0x0 , 0x0 , 0xf8 }); // ac; Y2; expected: 0xb0; data 10/2023: 0xf0
218+ fakeDeads .push_back ({52 , 3 , 0x0 , 0x0 , 0x0 , 0x0 , 0x80 }); // cd; Y2; expected: 0x0
214219 // fakeDeads.push_back({64, 4, 0x0, 0x0, 0x0, 0x0, 0x40}); // d1; Y4; expected: 0x0; data 12/2023
215220 fakeDeads .push_back ({68 , 5 , 0x0 , 0x0 , 0x0 , 0x0 , 0xe2 }); // e9; Y4; expected: 0x0; data 10/2023: 0xe0
216221
@@ -228,30 +233,68 @@ void ccdbUtils(const char* what, long timestamp = 0, const char* inFilename = "m
228233 timestamp = std ::chrono ::duration_cast < std ::chrono ::milliseconds > (std ::chrono ::system_clock ::now ().time_since_epoch ()).count ();
229234 }
230235
231- std ::vector < std ::string > whats = {"querybad" , "uploadbad" , "queryfake" , "uploadfake" , "querymasks" , "writemasks" , "uploadbadfrommasks" };
232-
233236 const std ::string fakeDeadChannelCCDBPath = "MID/Calib/FakeDeadChannels" ;
237+ const std ::string rejectListCCDBPath = "MID/Calib/RejectList" ;
234238
235- if (what == whats [0 ]) {
239+ std ::vector < std ::string > whats ;
240+ whats .emplace_back ("querybad" );
241+ if (what == whats .back ()) {
236242 queryBadChannels (ccdbUrl , timestamp , verbose , BadChannelCCDBPath );
237- } else if (what == whats [1 ]) {
243+ return ;
244+ }
245+
246+ whats .emplace_back ("uploadbad" );
247+ if (what == whats .back ()) {
238248 uploadBadChannels (ccdbUrl , timestamp , BadChannelCCDBPath );
239- } else if (what == whats [2 ]) {
249+ return ;
250+ }
251+
252+ whats .emplace_back ("queryrejectlist" );
253+ if (what == whats .back ()) {
254+ queryBadChannels (ccdbUrl , timestamp , verbose , rejectListCCDBPath );
255+ return ;
256+ }
257+
258+ whats .emplace_back ("uploadrejectlist" );
259+ if (what == whats .back ()) {
260+ uploadBadChannels (ccdbUrl , timestamp , rejectListCCDBPath );
261+ return ;
262+ }
263+
264+ whats .emplace_back ("queryfake" );
265+ if (what == whats .back ()) {
240266 queryBadChannels (ccdbUrl , timestamp , verbose , fakeDeadChannelCCDBPath );
241- } else if (what == whats [3 ]) {
242- uploadBadChannels (ccdbUrl , timestamp , fakeDeadChannelCCDBPath );
243- } else if (what == whats [4 ]) {
267+ return ;
268+ }
269+
270+ whats .emplace_back ("uploadfake" );
271+ if (what == whats .back ()) {
272+ uploadBadChannels (ccdbUrl , timestamp , fakeDeadChannelCCDBPath , makeFakeDeadChannels ());
273+ return ;
274+ }
275+
276+ whats .emplace_back ("querymasks" );
277+ if (what == whats .back ()) {
244278 queryDCSMasks (ccdbUrl , timestamp , verbose );
245- } else if (what == whats [5 ]) {
279+ return ;
280+ }
281+
282+ whats .emplace_back ("writemasks" );
283+ if (what == whats .back ()) {
246284 writeDCSMasks (ccdbUrl , timestamp );
247- } else if (what == whats [6 ]) {
285+ return ;
286+ }
287+
288+ whats .emplace_back ("uploadbadfrommasks" );
289+ if (what == whats .back ()) {
248290 uploadBadChannelsFromDCSMask (inFilename , timestamp , ccdbUrl , verbose );
249- } else {
250- std ::cout << "Unimplemented option chosen " << what << std ::endl ;
251- std ::cout << "Available:\n" ;
252- for (auto& str : whats ) {
253- std ::cout << str << " ";
254- }
255- std ::cout << std ::endl ;
291+ return ;
256292 }
257- }
293+
294+ std ::cout << "Unimplemented option chosen " << what << std ::endl ;
295+ std ::cout << "Available:\n" ;
296+ for (auto & str : whats ) {
297+ std ::cout << str << " " ;
298+ }
299+ std ::cout << std ::endl ;
300+ }
0 commit comments