From 35caa32b91e634d64b3f9a20a7df7b95d5d9ee8f Mon Sep 17 00:00:00 2001 From: Isakov Artem Date: Fri, 23 Sep 2022 17:20:28 +0200 Subject: [PATCH 1/3] Solved data drops, updated to new data string format --- Modules/ITS/itsThresholdCalibration.json | 22 ++------- .../ITS/src/ITSThresholdCalibrationTask.cxx | 47 +++++++++++++------ 2 files changed, 35 insertions(+), 34 deletions(-) diff --git a/Modules/ITS/itsThresholdCalibration.json b/Modules/ITS/itsThresholdCalibration.json index 11eb0957e9..acafa134d3 100644 --- a/Modules/ITS/itsThresholdCalibration.json +++ b/Modules/ITS/itsThresholdCalibration.json @@ -32,8 +32,8 @@ "maxNumberCycles" : "-1", "dataSource_comment" : "The other type of dataSource is \"direct\", see basic-no-sampling.json.", "dataSource" : { - "type" : "dataSamplingPolicy", - "name" : "thresholdcalibration" + "type" : "direct", + "query" : "tunestring:ITS/TSTR;runtype:ITS/RUNT;fittype:ITS/FITT;scantype:ITS/SCANT;chipdonestring:ITS/QCSTR;confdbv:ITS/CONFDBV;PixTypString:ITS/PIXTYP" }, "location" : "remote", "taskParameters" : {} @@ -44,21 +44,5 @@ }, - "dataSamplingPolicies" : [ - { - "id" : "thresholdcalibration", - "active" : "true", - "machines" : [], - "query" : "tunestring:ITS/TSTR;chipdonestring:ITS/QCSTR;scantype:ITS/SCANT", - "samplingConditions" : [ - { - "condition" : "random", - "fraction" : "1", - "seed" : "1441" - } - ], - - "blocking" : "false" - } - ] + "dataSamplingPolicies" : [] } diff --git a/Modules/ITS/src/ITSThresholdCalibrationTask.cxx b/Modules/ITS/src/ITSThresholdCalibrationTask.cxx index 66af423576..21e1071e49 100644 --- a/Modules/ITS/src/ITSThresholdCalibrationTask.cxx +++ b/Modules/ITS/src/ITSThresholdCalibrationTask.cxx @@ -25,6 +25,7 @@ #include "TLatex.h" #include #include "Framework/InputRecordWalker.h" +#include "ITSMFTReconstruction/ChipMappingITS.h" using namespace o2::itsmft; using namespace o2::its; @@ -87,12 +88,25 @@ void ITSThresholdCalibrationTask::startOfCycle() void ITSThresholdCalibrationTask::monitorData(o2::framework::ProcessingContext& ctx) { - const auto tunString = ctx.inputs().get>("tunestring"); - const auto chipDoneString = ctx.inputs().get>("chipdonestring"); - const auto scanType = ctx.inputs().get("scantype"); + string inStringChipDone, inString; + char scanType; + for (auto&& input : o2::framework::InputRecordWalker(ctx.inputs())) { + if (input.header != nullptr && input.payload != nullptr) { + const auto* header = o2::framework::DataRefUtils::getHeader(input); - string inString(tunString.begin(), tunString.end()); - string inStringChipDone(chipDoneString.begin(), chipDoneString.end()); + if ((strcmp(header->dataOrigin.str, "ITS") == 0) && (strcmp(header->dataDescription.str, "TSTR") == 0)) { + const auto tmpstring = ctx.inputs().get>(input); + std::copy(tmpstring.begin(), tmpstring.end(), std::back_inserter(inString)); + } + if ((strcmp(header->dataOrigin.str, "ITS") == 0) && (strcmp(header->dataDescription.str, "QCSTR") == 0)) { + const auto tmpstring = ctx.inputs().get>(input); + std::copy(tmpstring.begin(), tmpstring.end(), std::back_inserter(inStringChipDone)); + } + if ((strcmp(header->dataOrigin.str, "ITS") == 0) && (strcmp(header->dataDescription.str, "SCANT") == 0)) { + scanType = ctx.inputs().get(input); + } + } + } Int_t iScan; Double_t calibrationValue; @@ -104,17 +118,17 @@ void ITSThresholdCalibrationTask::monitorData(o2::framework::ProcessingContext& iScan = 2; else if (scanType == 'A' || scanType == 'D') iScan = 3; - auto splitRes = splitString(inString, "Stave:"); - auto splitResChipDone = splitString(inStringChipDone, "Stave:"); + auto splitRes = splitString(inString, "O2"); + auto splitResChipDone = splitString(inStringChipDone, "O2"); for (auto StaveStr : splitRes) { + if (StaveStr.size() > 0) { CalibrationResStruct result = CalibrationParser(StaveStr); int currentStave = StaveBoundary[result.Layer] + result.Stave + 1; int iBarrel = getBarrel(result.Layer); int currentChip = getCurrentChip(iBarrel, result.ChipID, result.HIC, result.Hs); - if (iScan < 3) { if (scanType == 'V') { @@ -214,7 +228,7 @@ ITSThresholdCalibrationTask::CalibrationResStruct ITSThresholdCalibrationTask::C { CalibrationResStruct result; auto StaveINFO = splitString(input, ","); - + o2::itsmft::ChipMappingITS mp; for (string info : StaveINFO) { if (info.size() == 0) continue; @@ -226,12 +240,15 @@ ITSThresholdCalibrationTask::CalibrationResStruct ITSThresholdCalibrationTask::C std::string name = splitString(info, ":")[0]; string data = splitString(info, ":")[1]; - if (name == "Hs_pos") { - result.Hs = std::stod(data); - } else if (name == "Hic_Pos") { - result.HIC = std::stod(data); - } else if (name == "ChipID") { - result.ChipID = std::stod(data); + if (name == "ChipID") { + int o2chipid = std::stod(data); + int Hs, HIC, ChipID, Layer, Stave; + mp.expandChipInfoHW(o2chipid, Layer, Stave, Hs, HIC, ChipID); + result.Hs = Hs; + result.HIC = HIC; + result.Layer = Layer; + result.Stave = Stave; + result.ChipID = ChipID; } else if (name == "VCASN") { result.VCASN = std::stof(data); } else if (name == "Rms") { From c5ea892c261fc1e36c95d14c0fd2ef48e73a85b7 Mon Sep 17 00:00:00 2001 From: Isakov Artem Date: Tue, 27 Sep 2022 12:51:11 +0200 Subject: [PATCH 2/3] Ivan's comments fixed --- Modules/ITS/include/ITS/ITSThresholdCalibrationTask.h | 4 +++- Modules/ITS/src/ITSThresholdCalibrationTask.cxx | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/ITS/include/ITS/ITSThresholdCalibrationTask.h b/Modules/ITS/include/ITS/ITSThresholdCalibrationTask.h index 06efa1b57e..26fcaa22b2 100644 --- a/Modules/ITS/include/ITS/ITSThresholdCalibrationTask.h +++ b/Modules/ITS/include/ITS/ITSThresholdCalibrationTask.h @@ -22,6 +22,7 @@ #include #include #include +#include "ITSMFTReconstruction/ChipMappingITS.h" class TH1D; class TH2D; @@ -105,7 +106,8 @@ class ITSThresholdCalibrationTask : public TaskInterface TH1F* hSuccessRate; TH1F *hCalibrationLayer[7][3], *hCalibrationRMSLayer[7][3]; TH1F *hCalibrationThrNoiseLayer[7], *hCalibrationThrNoiseRMSLayer[7]; - + + o2::itsmft::ChipMappingITS mp; Int_t SuccessStatus[7], TotalStatus[7]; }; } // namespace o2::quality_control_modules::its diff --git a/Modules/ITS/src/ITSThresholdCalibrationTask.cxx b/Modules/ITS/src/ITSThresholdCalibrationTask.cxx index 21e1071e49..25b0cbeda1 100644 --- a/Modules/ITS/src/ITSThresholdCalibrationTask.cxx +++ b/Modules/ITS/src/ITSThresholdCalibrationTask.cxx @@ -25,7 +25,6 @@ #include "TLatex.h" #include #include "Framework/InputRecordWalker.h" -#include "ITSMFTReconstruction/ChipMappingITS.h" using namespace o2::itsmft; using namespace o2::its; @@ -228,7 +227,6 @@ ITSThresholdCalibrationTask::CalibrationResStruct ITSThresholdCalibrationTask::C { CalibrationResStruct result; auto StaveINFO = splitString(input, ","); - o2::itsmft::ChipMappingITS mp; for (string info : StaveINFO) { if (info.size() == 0) continue; From 5ed0f3cb985d1528b3d86d68f2f95d0c27be4438 Mon Sep 17 00:00:00 2001 From: Isakov Artem Date: Tue, 27 Sep 2022 12:55:24 +0200 Subject: [PATCH 3/3] Clang --- Modules/ITS/include/ITS/ITSThresholdCalibrationTask.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/ITS/include/ITS/ITSThresholdCalibrationTask.h b/Modules/ITS/include/ITS/ITSThresholdCalibrationTask.h index 26fcaa22b2..16be4f19cc 100644 --- a/Modules/ITS/include/ITS/ITSThresholdCalibrationTask.h +++ b/Modules/ITS/include/ITS/ITSThresholdCalibrationTask.h @@ -106,7 +106,7 @@ class ITSThresholdCalibrationTask : public TaskInterface TH1F* hSuccessRate; TH1F *hCalibrationLayer[7][3], *hCalibrationRMSLayer[7][3]; TH1F *hCalibrationThrNoiseLayer[7], *hCalibrationThrNoiseRMSLayer[7]; - + o2::itsmft::ChipMappingITS mp; Int_t SuccessStatus[7], TotalStatus[7]; };