Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Modules/ITS/include/ITS/ITSThresholdCalibrationTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <TH2D.h>
#include <ITSBase/GeometryTGeo.h>
#include <TTree.h>
#include "ITSMFTReconstruction/ChipMappingITS.h"

class TH1D;
class TH2D;
Expand Down Expand Up @@ -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
Expand Down
22 changes: 3 additions & 19 deletions Modules/ITS/itsThresholdCalibration.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" : {}
Expand All @@ -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" : []
}
47 changes: 31 additions & 16 deletions Modules/ITS/src/ITSThresholdCalibrationTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,25 @@ void ITSThresholdCalibrationTask::startOfCycle()
void ITSThresholdCalibrationTask::monitorData(o2::framework::ProcessingContext& ctx)
{

const auto tunString = ctx.inputs().get<gsl::span<char>>("tunestring");
const auto chipDoneString = ctx.inputs().get<gsl::span<char>>("chipdonestring");
const auto scanType = ctx.inputs().get<char>("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<header::DataHeader*>(input);

if ((strcmp(header->dataOrigin.str, "ITS") == 0) && (strcmp(header->dataDescription.str, "TSTR") == 0)) {
const auto tmpstring = ctx.inputs().get<gsl::span<char>>(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<gsl::span<char>>(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<char>(input);
}
}
}

Int_t iScan;
Double_t calibrationValue;
Expand All @@ -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') {
Expand Down Expand Up @@ -214,7 +227,6 @@ ITSThresholdCalibrationTask::CalibrationResStruct ITSThresholdCalibrationTask::C
{
CalibrationResStruct result;
auto StaveINFO = splitString(input, ",");

for (string info : StaveINFO) {
if (info.size() == 0)
continue;
Expand All @@ -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") {
Expand Down