Skip to content

Commit 07d9473

Browse files
chiarazampollishahor02
authored andcommitted
Adding also detector list
1 parent dd273bd commit 07d9473

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Detectors/Calibration/testMacros/getRunParameters.cxx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "DataFormatsCTP/Scalers.h"
2121
#include "DataFormatsCTP/Configuration.h"
2222
#include "DataFormatsParameters/GRPMagField.h"
23+
#include "DataFormatsParameters/GRPECSObject.h"
2324
#include "CommonTypes/Units.h"
2425
#include <boost/program_options.hpp>
2526

@@ -64,6 +65,17 @@ void writeBFieldToFile(float b)
6465
fclose(fptr);
6566
}
6667

68+
void writeDetListToFile(std::string detList)
69+
{
70+
FILE* fptr = fopen("DetList.txt", "w");
71+
if (fptr == nullptr) {
72+
LOGP(fatal, "ERROR: Could not open file to write detector list!");
73+
return;
74+
}
75+
fprintf(fptr, "%s", detList.c_str());
76+
fclose(fptr);
77+
}
78+
6779
bool initOptionsAndParse(bpo::options_description& options, int argc, char* argv[], bpo::variables_map& vm)
6880
{
6981
options.add_options()(
@@ -123,6 +135,20 @@ int main(int argc, char* argv[])
123135
LOGP(info, "run {}: B field = {}", run, magFieldL3Curr);
124136
writeBFieldToFile((float)magFieldL3Curr);
125137

138+
// getting the detector list
139+
LOGP(info, "Getting detector participating in the run");
140+
std::map<std::string, std::string> metadataRun;
141+
metadataRun["runNumber"] = std::to_string(run);
142+
o2::parameters::GRPECSObject* ecsObj = ccdb_inst.getSpecific<o2::parameters::GRPECSObject>("GLO/Config/GRPECS", tsSOR, metadataRun);
143+
std::string dets = "";
144+
for (int i = o2::detectors::DetID::First; i < o2::detectors::DetID::nDetectors; ++i) {
145+
if (ecsObj->isDetReadOut(i)) {
146+
dets = dets + o2::detectors::DetID::getName(i) + " ";
147+
}
148+
}
149+
LOGP(info, "run {}: detectors in readout = {}", run, dets);
150+
writeDetListToFile(dets);
151+
126152
LOGP(info, "Checking IR and duration");
127153
if (run < 519041) {
128154
// LHC22c, d

0 commit comments

Comments
 (0)