99// granted to it by virtue of its status as an Intergovernmental Organization
1010// or submit itself to any jurisdiction.
1111
12+ #include <fmt/format.h>
1213#include <vector>
1314#include <string>
1415#include "TFile.h"
2425
2526using DPID = o2 ::dcs ::DataPointIdentifier ;
2627
28+ /// macro to populate CCDB for TPC with the configuration for DCS
2729int makeTPCCCDBEntryForDCS (const std ::string url = "http://localhost:8080" )
2830{
2931
30- // std::string url(argv[0]);
31- // macro to populate CCDB for TOF with the configuration for DCS
3232 std ::unordered_map < DPID , std ::string > dpid2DataDesc ;
3333 std ::vector < std ::string > aliases ;
3434 auto dphints = o2 ::tpc ::dcs ::getTPCDCSDPHints ();
@@ -42,22 +42,31 @@ int makeTPCCCDBEntryForDCS(const std::string url = "http://localhost:8080")
4242
4343 std ::vector < std ::string > expaliases = o2 ::dcs ::expandAliases (aliases );
4444
45- // for (const auto& alias : expaliases) {
46- // printf("%s\n", alias.data());
47- //}
45+ if (url == "printOnly" ) {
46+ for (const auto & alias : expaliases ) {
47+ fmt ::print ("{}\n" , alias .data ());
48+ }
49+ return 0 ;
50+ }
4851
4952 DPID dpidtmp ;
50- for (size_t i = 0 ; i < expaliases .size (); ++ i ) {
51- DPID ::FILL (dpidtmp , expaliases [i ], o2 ::dcs ::DeliveryType ::DPVAL_DOUBLE );
53+ for (const auto & alias : expaliases ) {
54+ std ::string type = "DPVAL_DOUBLE" ;
55+ if (alias .find ("STATUS" ) == (alias .size () - std ::string ("STATUS" ).size ())) {
56+ DPID ::FILL (dpidtmp , alias , o2 ::dcs ::DeliveryType ::DPVAL_INT );
57+ type = "DPVAL_INT" ;
58+ } else {
59+ DPID ::FILL (dpidtmp , alias , o2 ::dcs ::DeliveryType ::DPVAL_DOUBLE );
60+ }
5261 dpid2DataDesc [dpidtmp ] = "TPCDATAPOINTS" ;
53- LOG (info ) << expaliases [ i ] ;
62+ LOGP (info , "{} ({})" , alias , type ) ;
5463 }
5564
5665 o2 ::ccdb ::CcdbApi api ;
5766 api .init (url ); // or http://localhost:8080 for a local installation
5867 std ::map < std ::string , std ::string > md ;
5968 long ts = std ::chrono ::duration_cast < std ::chrono ::milliseconds > (std ::chrono ::system_clock ::now ().time_since_epoch ()).count ();
60- api .storeAsTFileAny (& dpid2DataDesc , "TPC/Config/DCSDPconfig" , md , ts );
69+ api .storeAsTFileAny (& dpid2DataDesc , "TPC/Config/DCSDPconfig" , md , ts , 99999999999999 );
6170
6271 return 0 ;
6372}
0 commit comments