diff --git a/Modules/ITS/include/ITS/ITSThresholdCalibrationTask.h b/Modules/ITS/include/ITS/ITSThresholdCalibrationTask.h index 06efa1b57e..16be4f19cc 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; @@ -106,6 +107,7 @@ class ITSThresholdCalibrationTask : public TaskInterface 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/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..25b0cbeda1 100644 --- a/Modules/ITS/src/ITSThresholdCalibrationTask.cxx +++ b/Modules/ITS/src/ITSThresholdCalibrationTask.cxx @@ -87,12 +87,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 inString(tunString.begin(), tunString.end()); - string inStringChipDone(chipDoneString.begin(), chipDoneString.end()); + 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); + + 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 +117,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 +227,6 @@ ITSThresholdCalibrationTask::CalibrationResStruct ITSThresholdCalibrationTask::C { CalibrationResStruct result; auto StaveINFO = splitString(input, ","); - for (string info : StaveINFO) { if (info.size() == 0) continue; @@ -226,12 +238,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") {