From 7741e94d74e31533e831cfb31ca150ea3b914172 Mon Sep 17 00:00:00 2001 From: Carlo Puggioni Date: Wed, 25 Sep 2024 19:04:04 +0200 Subject: [PATCH] ZDC: Add summary and correlection plot --- Modules/ZDC/etc/zdcTaskRecData.json | 182 ++++++---- Modules/ZDC/etc/zdcTaskRecDataPbPb.json | 275 +++++++++++++++ .../ZDC/include/ZDC/PostProcessingConfigZDC.h | 3 + Modules/ZDC/include/ZDC/ZDCRecDataCheck.h | 27 ++ .../include/ZDC/ZDCRecDataPostProcessing.h | 18 +- Modules/ZDC/src/PostProcessingConfigZDC.cxx | 49 ++- Modules/ZDC/src/ZDCRecDataCheck.cxx | 326 ++++++++++++++++-- Modules/ZDC/src/ZDCRecDataPostProcessing.cxx | 146 +++++++- Modules/ZDC/src/ZDCRecDataTask.cxx | 16 +- 9 files changed, 950 insertions(+), 92 deletions(-) create mode 100755 Modules/ZDC/etc/zdcTaskRecDataPbPb.json diff --git a/Modules/ZDC/etc/zdcTaskRecData.json b/Modules/ZDC/etc/zdcTaskRecData.json index 566e996163..bc3897664a 100755 --- a/Modules/ZDC/etc/zdcTaskRecData.json +++ b/Modules/ZDC/etc/zdcTaskRecData.json @@ -9,7 +9,7 @@ "name": "not_applicable" }, "Activity": { - "number": "42", + "number": "50", "type": "NONE" }, "monitoring": { @@ -34,28 +34,28 @@ "name": "zdc-rec" }, "taskParameters": { - "ADC": "3025;-100;12000", - "ADCZEM": "3025;-100;10000", - "ADCH": "3025;-100;12000", - "TDCT": "2400;-25;25", - "TDCA": "2000;-0.5;3999.5", - "TDCAZEM": "2000;-0.5;2999.5", - "TDCAH": "2000;-0.5;3999.5", - "ADCSUMvsTC": "1210;-100;12000;1210;-100;12000", - "ADCZEMvsADCZEM": "1210;-100;12000;1210;-100;12000", - "ADCZEMvsTC": "1210;-100;12000;1210;-100;12000", - "ADCvsTDCT": "240;-25;25;1210;-100;12000", - "ADCZEMvsTDCT": "240;-25;25;1210;-100;12000", - "TDCDIFF": "240;-25;25;240;-25;25", - "TDCAvsTDCT": "240;-25;25;1000;-0.5;3999.5", - "TDCAZEMvsTDCT": "240;-25;25;1000;-0.5;3999.5", - "TDCAvsTDCA": "1000;-0.5;3999.5;1000;-0.5;3999.5", - "TDCAZEMvsTDCAZEM": "1000;-0.5;3999.5;1000;-0.5;3999.5", - "TDCAZEMvsTDCA": "1000;-0.5;3999.5;1000;-0.5;3999.5", + "ADC": "3600; -3;357", + "ADCZEM": "3025;-100;12000", + "ADCH": "2300;-3;20", + "TDCT": "2400;-13.5;11.45", + "TDCA": "3600; -3;357", + "TDCAZEM": "2050;-0.5;4099.5", + "TDCAH": "2300;-3;20", + "ADCSUMvsTC": "144;-3;357;144;-3;357", + "ADCZEMvsADCZEM": "121;-100;12000;121;-100;12000", + "ADCZEMvsTC": "144;-3;357;121;-100;12000", + "ADCvsTDCT": "120;-13.5;11.45;144;-3;357", + "ADCZEMvsTDCT": "120;-13.5;11.45;121;-100;12000", + "TDCDIFF": "240;-27;22.90;240;-27;22.90", + "TDCAvsTDCT": "120;-13.5;11.45;144;-3;357", + "TDCAZEMvsTDCT": "120;-13.5;11.45;125;-1;3999", + "TDCAvsTDCA": "144;-3;357;144;-3;357", + "TDCAZEMvsTDCAZEM": "125;-1;3999;125;-1;3999", + "TDCAZEMvsTDCA": "144;-3;357;125;-1;3999", "CENTR_ZNA": "200;-2;2;200;-2;2", "CENTR_ZNC": "200;-2;2;200;-2;2", "CENTR_ZPA": "2240;0;22.4", - "CENTR_ZPC": "2240;-22.4;0" + "CENTR_ZPC": "2240;-22.4;0" }, "location": "remote", "saveObjectsToFile": "QcZDCRecData.root", "": "For debugging, path to the file where to save. If empty it won't save." @@ -120,6 +120,48 @@ "ZPCS:h_TDC_ZPC_SUM_V" ] } + ], + "dataSourcesTDCA": [ + { + "type": "repository", + "path": "ZDC/MO/Rec", + "names": [ + "ZNAC:h_TDC_ZNA_TC_A", + "ZNAS:h_TDC_ZNA_SUM_A", + "ZPAC:h_TDC_ZPA_TC_A", + "ZPAS:h_TDC_ZPA_SUM_A", + "ZEM1:h_TDC_ZEM1_A", + "ZEM2:h_TDC_ZEM2_A", + "ZNCC:h_TDC_ZNC_TC_A", + "ZNCS:h_TDC_ZNC_SUM_A", + "ZPCC:h_TDC_ZPC_TC_A", + "ZPCS:h_TDC_ZPC_SUM_A" + ] + } + ], + "dataSourcesPeak1n": [ + { + "type": "repository", + "path": "ZDC/MO/Rec", + "names": [ + "ZNAC:h_TDC_ZNA_TC_A", + "ZNAS:h_TDC_ZNA_SUM_A", + "ZNCC:h_TDC_ZNC_TC_A", + "ZNCS:h_TDC_ZNC_SUM_A" + ] + } + ], + "dataSourcesPeak1p": [ + { + "type": "repository", + "path": "ZDC/MO/Rec", + "names": [ + "ZPAC:h_TDC_ZPA_TC_A", + "ZPAS:h_TDC_ZPA_SUM_A", + "ZPCC:h_TDC_ZPC_TC_A", + "ZPCS:h_TDC_ZPC_SUM_A" + ] + } ], "initTrigger": [ "userorcontrol" @@ -140,51 +182,75 @@ "detectorName" : "ZDC", "policy": "OnAll", "checkParameters" : { - "ADC_ZNAC" : "461.2;10;20", - "ADC_ZNA1" : "115.6;10;20", - "ADC_ZNA2" : "115.8;10;20", - "ADC_ZNA3" : "115.6;10;20", - "ADC_ZNA4" : "115.9;10;20", - "ADC_ZNAS" : "462.7;10;20", - "ADC_ZPAC" : "156.7;10;20", - "ADC_ZPA1" : "63.63;10;20", - "ADC_ZPA2" : "70.86;10;20", - "ADC_ZPA3" : "16.30;10;20", - "ADC_ZPA4" : "9.25;10;20", - "ADC_ZPAS" : "155.2;10;20", - "ADC_ZEM1" : "392.2;10;20", - "ADC_ZEM2" : "388.2;10;20", - "ADC_ZNCC" : "471.7;10;20", - "ADC_ZNC1" : "117.7;10;20", - "ADC_ZNC2" : "118.8;10;20", - "ADC_ZNC3" : "119.2;10;20", - "ADC_ZNC4" : "117.6;10;20", - "ADC_ZNCS" : "473.3;10;20", - "ADC_ZPCC" : "195.6;10;20", - "ADC_ZPC1" : "59.19;10;20", - "ADC_ZPC2" : "77.63;10;20", - "ADC_ZPC3" : "39.96;10;20", - "ADC_ZPC4" : "34.21;10;20", - "ADC_ZPCS" : "193.9;10;20", + "ADC_ZNAC" : "40.2;10;20", + "ADC_ZNA1" : "10.6;10;20", + "ADC_ZNA2" : "11.8;10;20", + "ADC_ZNA3" : "8.6;10;20", + "ADC_ZNA4" : "6.9;10;20", + "ADC_ZNAS" : "41.7;10;20", + "ADC_ZPAC" : "17.7;10;20", + "ADC_ZPA1" : "1.63;10;20", + "ADC_ZPA2" : "2.86;10;20", + "ADC_ZPA3" : "5.30;10;20", + "ADC_ZPA4" : "12.25;10;20", + "ADC_ZPAS" : "20.2;10;20", + "ADC_ZEM1" : "803.2;10;20", + "ADC_ZEM2" : "891.2;10;20", + "ADC_ZNCC" : "40.7;10;20", + "ADC_ZNC1" : "9.7;10;20", + "ADC_ZNC2" : "15.8;10;20", + "ADC_ZNC3" : "6.2;10;20", + "ADC_ZNC4" : "8.6;10;20", + "ADC_ZNCS" : "42.3;10;20", + "ADC_ZPCC" : "19.6;10;20", + "ADC_ZPC1" : "14.19;10;20", + "ADC_ZPC2" : "7.63;10;20", + "ADC_ZPC3" : "2.96;10;20", + "ADC_ZPC4" : "1.21;10;20", + "ADC_ZPCS" : "20.9;10;20", "ADC_POS_MSG_X": "0.15", "ADC_POS_MSG_Y": "0.92", - "TDC_ZNAC" : "0.70;0.10;0.20", - "TDC_ZNAS" : "0.79;0.10;0.20", - "TDC_ZPAC" : "1.30;0.10;0.20", - "TDC_ZPAS" : "1.36;0.10;0.20", - "TDC_ZEM1" : "0.31;0.10;0.20", - "TDC_ZEM2" : "0.32;0.10;0.20", - "TDC_ZNCC" : "0.50;0.10;0.20", - "TDC_ZNCS" : "0.58;0.10;0.20", - "TDC_ZPCC" : "1.17;0.10;0.20", - "TDC_ZPCS" : "1.24;0.10;0.20", + "TDC_ZNAC" : "0.14;0.10;0.20", + "TDC_ZNAS" : "0.05;0.10;0.20", + "TDC_ZPAC" : "-0.39;0.10;0.20", + "TDC_ZPAS" : "-0.11;0.10;0.20", + "TDC_ZEM1" : "0.07;0.10;0.20", + "TDC_ZEM2" : "0.02;0.10;0.20", + "TDC_ZNCC" : "0.19;0.10;0.20", + "TDC_ZNCS" : "0.08;0.10;0.20", + "TDC_ZPCC" : "-0.29;0.10;0.20", + "TDC_ZPCS" : "-0.20;0.10;0.20", "TDC_POS_MSG_X": "0.01", - "TDC_POS_MSG_Y": "0.92" + "TDC_POS_MSG_Y": "0.92", + "TDCA_ZNAC" : "326;10;20", + "TDCA_ZNAS" : "331;10;20", + "TDCA_ZPAC" : "130;10;20", + "TDCA_ZPAS" : "146;10;20", + "TDCA_ZEM1" : "1203;10;20", + "TDCA_ZEM2" : "1265;10;20", + "TDCA_ZNCC" : "329;10;20", + "TDCA_ZNCS" : "339;10;20", + "TDCA_ZPCC" : "146;10;20", + "TDCA_ZPCS" : "150;10;20", + "TDCA_POS_MSG_X": "0.01", + "TDCA_POS_MSG_Y": "0.92", + "PEAK1N_ZNAC" : "40;10;20", + "PEAK1N_ZNAS" : "40;10;20", + "PEAK1N_ZNCC" : "40;10;20", + "PEAK1N_ZNCS" : "40;10;20", + "PEAK1N_POS_MSG_X": "0.01", + "PEAK1N_POS_MSG_Y": "0.92", + "PEAK1P_ZPAC" : "52;10;20", + "PEAK1P_ZPAS" : "52;10;20", + "PEAK1P_ZPCC" : "52;10;20", + "PEAK1P_ZPCS" : "52;10;20", + "PEAK1P_POS_MSG_X": "0.01", + "PEAK1P_POS_MSG_Y": "0.92" }, "dataSource": [{ "type": "PostProcessing", "name": "RecPP", - "MOs": ["h_summary_ADC" , "h_summary_TDC"] + "MOs": ["h_summary_ADC" , "h_summary_TDC", "h_summary_TDCA", "h_summary_Peak1n", "h_summary_Peak1p"] }] } } diff --git a/Modules/ZDC/etc/zdcTaskRecDataPbPb.json b/Modules/ZDC/etc/zdcTaskRecDataPbPb.json new file mode 100755 index 0000000000..1cca5be14c --- /dev/null +++ b/Modules/ZDC/etc/zdcTaskRecDataPbPb.json @@ -0,0 +1,275 @@ +{ + "qc": { + "config": { + "database": { + "implementation": "CCDB", + "host": "ccdb-test.cern.ch:8080", + "username": "not_applicable", + "password": "not_applicable", + "name": "not_applicable" + }, + "Activity": { + "number": "59", + "type": "NONE" + }, + "monitoring": { + "url": "infologger:///debug?qc" + }, + "consul": { + "url": "" + }, + "conditionDB": { + "url": "ccdb-test.cern.ch:8080" + } + }, + "tasks": { + "Rec": { + "active": "true", + "className": "o2::quality_control_modules::zdc::ZDCRecDataTask", + "moduleName": "QcZDC", + "detectorName": "ZDC", + "cycleDurationSeconds": "10", + "dataSource": { + "type": "dataSamplingPolicy", + "name": "zdc-rec" + }, + "taskParameters": { + "ADC": "1440; -3;357", + "ADCZEM": "3025;-100;12000", + "ADCH": "115;-3;20", + "TDCT": "2400;-13.5;11.45", + "TDCA": "1440; -3;357", + "TDCAZEM": "2050;-0.5;4099.5", + "TDCAH": "230;-3;20", + "ADCSUMvsTC": "144;-3;357;144;-3;357", + "ADCZEMvsADCZEM": "121;-100;12000;121;-100;12000", + "ADCZEMvsTC": "121;-100;12000;144;-3;357", + "ADCvsTDCT": "120;-13.5;11.45;144;-3;357", + "ADCZEMvsTDCT": "120;-13.5;11.45;121;-100;12000", + "TDCDIFF": "240;-27;22.90;240;-27;22.90", + "TDCAvsTDCT": "120;-13.5;11.45;144;-3;357", + "TDCAZEMvsTDCT": ";125;-1;3999;120;-13.5;11.45", + "TDCAvsTDCA": "144;-3;357;144;-3;357", + "TDCAZEMvsTDCAZEM": "125;-1;3999;125;-1;3999", + "TDCAZEMvsTDCA": "125;-1;3999;144;-3;357;", + "CENTR_ZNA": "200;-2;2;200;-2;2", + "CENTR_ZNC": "200;-2;2;200;-2;2", + "CENTR_ZPA": "2240;0;22.4", + "CENTR_ZPC": "2240;-22.4;0" + }, + "location": "remote", + "saveObjectsToFile": "QcZDCRecData.root", "": "For debugging, path to the file where to save. If empty it won't save." + } + }, + "postprocessing": { + "RecPP": { + "active": "true", + "className": "o2::quality_control_modules::zdc::ZDCRecDataPostProcessing", + "moduleName": "QcZDC", + "detectorName": "ZDC", + "customization": [ + ], + "dataSourcesADC": [ + { + "type": "repository", + "path": "ZDC/MO/Rec", + "names": [ + "ZNAC:h_ADC_ZNA_TC", + "ZNA1:h_ADC_ZNA_T1", + "ZNA2:h_ADC_ZNA_T2", + "ZNA3:h_ADC_ZNA_T3", + "ZNA4:h_ADC_ZNA_T4", + "ZNAS:h_ADC_ZNA_SUM", + "ZPAC:h_ADC_ZPA_TC", + "ZPA1:h_ADC_ZPA_T1", + "ZPA2:h_ADC_ZPA_T2", + "ZPA3:h_ADC_ZPA_T3", + "ZPA4:h_ADC_ZPA_T4", + "ZPAS:h_ADC_ZPA_SUM", + "ZEM1:h_ADC_ZEM1", + "ZEM2:h_ADC_ZEM2", + "ZNCC:h_ADC_ZNC_TC", + "ZNC1:h_ADC_ZNC_T1", + "ZNC2:h_ADC_ZNC_T2", + "ZNC3:h_ADC_ZNC_T3", + "ZNC4:h_ADC_ZNC_T4", + "ZNCS:h_ADC_ZNC_SUM", + "ZPCC:h_ADC_ZPC_TC", + "ZPC1:h_ADC_ZPC_T1", + "ZPC2:h_ADC_ZPC_T2", + "ZPC3:h_ADC_ZPC_T3", + "ZPC4:h_ADC_ZPC_T4", + "ZPCS:h_ADC_ZPC_SUM" + ] + } + ], + "dataSourcesTDC": [ + { + "type": "repository", + "path": "ZDC/MO/Rec", + "names": [ + "ZNAC:h_TDC_ZNA_TC_V", + "ZNAS:h_TDC_ZNA_SUM_V", + "ZPAC:h_TDC_ZPA_TC_V", + "ZPAS:h_TDC_ZPA_SUM_V", + "ZEM1:h_TDC_ZEM1_V", + "ZEM2:h_TDC_ZEM2_V", + "ZNCC:h_TDC_ZNC_TC_V", + "ZNCS:h_TDC_ZNC_SUM_V", + "ZPCC:h_TDC_ZPC_TC_V", + "ZPCS:h_TDC_ZPC_SUM_V" + ] + } + ], + "dataSourcesTDCA": [ + { + "type": "repository", + "path": "ZDC/MO/Rec", + "names": [ + "ZNAC:h_TDC_ZNA_TC_A", + "ZNAS:h_TDC_ZNA_SUM_A", + "ZPAC:h_TDC_ZPA_TC_A", + "ZPAS:h_TDC_ZPA_SUM_A", + "ZEM1:h_TDC_ZEM1_A", + "ZEM2:h_TDC_ZEM2_A", + "ZNCC:h_TDC_ZNC_TC_A", + "ZNCS:h_TDC_ZNC_SUM_A", + "ZPCC:h_TDC_ZPC_TC_A", + "ZPCS:h_TDC_ZPC_SUM_A" + ] + } + ], + "dataSourcesPeak1n": [ + { + "type": "repository", + "path": "ZDC/MO/Rec", + "names": [ + "ZNAC:h_TDC_ZNA_TC_A", + "ZNAS:h_TDC_ZNA_SUM_A", + "ZNCC:h_TDC_ZNC_TC_A", + "ZNCS:h_TDC_ZNC_SUM_A" + ] + } + ], + "dataSourcesPeak1p": [ + { + "type": "repository", + "path": "ZDC/MO/Rec", + "names": [ + "ZPAC:h_TDC_ZPA_TC_A", + "ZPAS:h_TDC_ZPA_SUM_A", + "ZPCC:h_TDC_ZPC_TC_A", + "ZPCS:h_TDC_ZPC_SUM_A" + ] + } + ], + "initTrigger": [ + "userorcontrol" + ], + "updateTrigger": [ + "newobject:qcdb:ZDC/MO/Rec/h_ADC_ZNA_TC" + ], + "stopTrigger": [ + "userorcontrol" + ] + } + }, + "checks": { + "RecCheck": { + "active": "true", + "className": "o2::quality_control_modules::zdc::ZDCRecDataCheck", + "moduleName": "QcZDC", + "detectorName" : "ZDC", + "policy": "OnAll", + "checkParameters" : { + "ADC_ZNAC" : "21.2;10;20", + "ADC_ZNA1" : "5.6;10;20", + "ADC_ZNA2" : "6.8;10;20", + "ADC_ZNA3" : "4.6;10;20", + "ADC_ZNA4" : "3.9;10;20", + "ADC_ZNAS" : "21.7;10;20", + "ADC_ZPAC" : "8.7;10;20", + "ADC_ZPA1" : "1.63;10;20", + "ADC_ZPA2" : "2.86;10;20", + "ADC_ZPA3" : "6.30;10;20", + "ADC_ZPA4" : "9.25;10;20", + "ADC_ZPAS" : "10.2;10;20", + "ADC_ZEM1" : "870.2;100;200", + "ADC_ZEM2" : "870.2;100;200", + "ADC_ZNCC" : "21.7;10;20", + "ADC_ZNC1" : "4.7;10;20", + "ADC_ZNC2" : "8.8;10;20", + "ADC_ZNC3" : "3.2;10;20", + "ADC_ZNC4" : "4.6;10;20", + "ADC_ZNCS" : "22.3;10;20", + "ADC_ZPCC" : "9.6;10;20", + "ADC_ZPC1" : "7.19;10;20", + "ADC_ZPC2" : "3.63;10;20", + "ADC_ZPC3" : "1.96;10;20", + "ADC_ZPC4" : "1.21;10;20", + "ADC_ZPCS" : "10.9;10;20", + "ADC_POS_MSG_X": "0.15", + "ADC_POS_MSG_Y": "0.92", + "TDC_ZNAC" : "0.14;0.10;0.20", + "TDC_ZNAS" : "0.05;0.10;0.20", + "TDC_ZPAC" : "-0.39;0.10;0.20", + "TDC_ZPAS" : "-0.11;0.10;0.20", + "TDC_ZEM1" : "0.07;0.10;0.20", + "TDC_ZEM2" : "0.02;0.10;0.20", + "TDC_ZNCC" : "0.19;0.10;0.20", + "TDC_ZNCS" : "0.08;0.10;0.20", + "TDC_ZPCC" : "-0.29;0.10;0.20", + "TDC_ZPCS" : "-0.20;0.10;0.20", + "TDC_POS_MSG_X": "0.01", + "TDC_POS_MSG_Y": "0.92", + "TDCA_ZNAC" : "21;10;20", + "TDCA_ZNAS" : "21;10;20", + "TDCA_ZPAC" : "8;10;20", + "TDCA_ZPAS" : "9;10;20", + "TDCA_ZEM1" : "252;10;20", + "TDCA_ZEM2" : "258;10;20", + "TDCA_ZNCC" : "21;10;20", + "TDCA_ZNCS" : "22;10;20", + "TDCA_ZPCC" : "9;10;20", + "TDCA_ZPCS" : "9;10;20", + "TDCA_POS_MSG_X": "0.01", + "TDCA_POS_MSG_Y": "0.92", + "PEAK1N_ZNAC" : "2;2;4", + "PEAK1N_ZNAS" : "2;2;4", + "PEAK1N_ZNCC" : "2;2;4", + "PEAK1N_ZNCS" : "2;2;4", + "PEAK1N_POS_MSG_X": "0.01", + "PEAK1N_POS_MSG_Y": "0.92", + "PEAK1P_ZPAC" : "3;10;20", + "PEAK1P_ZPAS" : "3;10;20", + "PEAK1P_ZPCC" : "3;10;20", + "PEAK1P_ZPCS" : "3;10;20", + "PEAK1P_POS_MSG_X": "0.01", + "PEAK1P_POS_MSG_Y": "0.92" + }, + "dataSource": [{ + "type": "PostProcessing", + "name": "RecPP", + "MOs": ["h_summary_ADC" , "h_summary_TDC", "h_summary_TDCA", "h_summary_Peak1n", "h_summary_Peak1p"] + }] + } + } + }, + "dataSamplingPolicies": [ + { + "id": "zdc-rec", + "active": "true", + "machines": [], + "query": "zdc-bcrec:ZDC/BCREC/0;zdc-energyrec:ZDC/ENERGY/0;zdc-tdcrec:ZDC/TDCDATA/0;zdc-inforec:ZDC/INFO/0", + "samplingConditions": [ + { + "condition": "random", + "fraction": "0.3", + "seed": "0" + } + ], + "blocking": "false" + } + ] +} + diff --git a/Modules/ZDC/include/ZDC/PostProcessingConfigZDC.h b/Modules/ZDC/include/ZDC/PostProcessingConfigZDC.h index 599eec1225..0ebdaf702f 100644 --- a/Modules/ZDC/include/ZDC/PostProcessingConfigZDC.h +++ b/Modules/ZDC/include/ZDC/PostProcessingConfigZDC.h @@ -49,6 +49,9 @@ struct PostProcessingConfigZDC : PostProcessingConfig { std::map parameters; std::vector dataSourcesADC; std::vector dataSourcesTDC; + std::vector dataSourcesTDCA; + std::vector dataSourcesPeak1n; + std::vector dataSourcesPeak1p; }; } // namespace o2::quality_control_modules::zdc diff --git a/Modules/ZDC/include/ZDC/ZDCRecDataCheck.h b/Modules/ZDC/include/ZDC/ZDCRecDataCheck.h index 352d8d282f..7d9e964633 100644 --- a/Modules/ZDC/include/ZDC/ZDCRecDataCheck.h +++ b/Modules/ZDC/include/ZDC/ZDCRecDataCheck.h @@ -60,21 +60,48 @@ class ZDCRecDataCheck : public o2::quality_control::checker::CheckInterface private: std::vector mVectParamADC; std::vector mVectParamTDC; + std::vector mVectParamTDCA; + std::vector mVectParamPeak1n; + std::vector mVectParamPeak1p; + int mNumWADC = 0; int mNumEADC = 0; int mNumWTDC = 0; int mNumETDC = 0; + int mNumWTDCA = 0; + int mNumETDCA = 0; + int mNumWPeak1n = 0; + int mNumEPeak1n = 0; + int mNumWPeak1p = 0; + int mNumEPeak1p = 0; + float mPosMsgADCX; float mPosMsgADCY; float mPosMsgTDCX; float mPosMsgTDCY; + float mPosMsgTDCAX; + float mPosMsgTDCAY; + float mPosMsgPeak1nX; + float mPosMsgPeak1nY; + float mPosMsgPeak1pX; + float mPosMsgPeak1pY; + int mQADC = 0; int mQTDC = 0; + int mQTDCA = 0; + int mQPeak1n = 0; + int mQPeak1p = 0; std::string mStringWADC = ""; std::string mStringEADC = ""; std::string mStringWTDC = ""; std::string mStringETDC = ""; + std::string mStringWTDCA = ""; + std::string mStringETDCA = ""; + std::string mStringWPeak1n = ""; + std::string mStringEPeak1n = ""; + std::string mStringWPeak1p = ""; + std::string mStringEPeak1p = ""; }; } // namespace o2::quality_control_modules::zdc diff --git a/Modules/ZDC/include/ZDC/ZDCRecDataPostProcessing.h b/Modules/ZDC/include/ZDC/ZDCRecDataPostProcessing.h index ba744dfba9..54c2473213 100644 --- a/Modules/ZDC/include/ZDC/ZDCRecDataPostProcessing.h +++ b/Modules/ZDC/include/ZDC/ZDCRecDataPostProcessing.h @@ -12,7 +12,7 @@ /// /// \file ZDCRecDataPostProcessing.h /// \author Andrea Ferrero andrea.ferrero@cern.ch -/// \brief Post-processing of the ZDC ADC and TDC plots +/// \brief Post-processing of the ZDC ADC and TDC (Time and Amplitude) plots /// \since 30/08/2023 /// @@ -86,18 +86,32 @@ class ZDCRecDataPostProcessing : public PostProcessingInterface const char* displayHints = ""); void createSummaryADCHistos(Trigger t, repository::DatabaseInterface* qcdb); void createSummaryTDCHistos(Trigger t, repository::DatabaseInterface* qcdb); + void createSummaryTDCAHistos(Trigger t, repository::DatabaseInterface* qcdb); + void createSummaryPeak1nHistos(Trigger t, repository::DatabaseInterface* qcdb); + void createSummaryPeak1pHistos(Trigger t, repository::DatabaseInterface* qcdb); void updateSummaryADCHistos(Trigger t, repository::DatabaseInterface* qcdb); void updateSummaryTDCHistos(Trigger t, repository::DatabaseInterface* qcdb); + void updateSummaryTDCAHistos(Trigger t, repository::DatabaseInterface* qcdb); + void updateSummaryPeak1nHistos(Trigger t, repository::DatabaseInterface* qcdb); + void updateSummaryPeak1pHistos(Trigger t, repository::DatabaseInterface* qcdb); // CCDB object accessors std::map mMOsADC; std::map mMOsTDC; - + std::map mMOsTDCA; + std::map mMOsPeak1n; + std::map mMOsPeak1p; // Hit rate histograms =============================================== std::vector mBinLabelsADC; std::vector mBinLabelsTDC; + std::vector mBinLabelsTDCA; + std::vector mBinLabelsPeak1n; + std::vector mBinLabelsPeak1p; std::unique_ptr mSummaryADCHisto; std::unique_ptr mSummaryTDCHisto; + std::unique_ptr mSummaryTDCAHisto; + std::unique_ptr mSummaryPeak1nHisto; + std::unique_ptr mSummaryPeak1pHisto; }; template diff --git a/Modules/ZDC/src/PostProcessingConfigZDC.cxx b/Modules/ZDC/src/PostProcessingConfigZDC.cxx index 86a61bd4e6..ce6114e567 100644 --- a/Modules/ZDC/src/PostProcessingConfigZDC.cxx +++ b/Modules/ZDC/src/PostProcessingConfigZDC.cxx @@ -36,6 +36,7 @@ PostProcessingConfigZDC::PostProcessingConfigZDC(std::string name, const boost:: } // Data source configuration + // ADC for (const auto& dataSourceConfig : config.get_child("qc.postprocessing." + name + ".dataSourcesADC")) { if (const auto& sourceNames = dataSourceConfig.second.get_child_optional("names"); sourceNames.has_value()) { for (const auto& sourceName : sourceNames.value()) { @@ -50,6 +51,7 @@ PostProcessingConfigZDC::PostProcessingConfigZDC(std::string name, const boost:: throw std::runtime_error("No 'name' value or a 'names' vector in the path 'qc.postprocessing." + name + ".dataSourcesADC'"); } } + // TDC Time for (const auto& dataSourceConfig : config.get_child("qc.postprocessing." + name + ".dataSourcesTDC")) { if (const auto& sourceNames = dataSourceConfig.second.get_child_optional("names"); sourceNames.has_value()) { for (const auto& sourceName : sourceNames.value()) { @@ -61,7 +63,52 @@ PostProcessingConfigZDC::PostProcessingConfigZDC(std::string name, const boost:: dataSourcesTDC.push_back({ dataSourceConfig.second.get("path"), dataSourceConfig.second.get("name") }); } else { - throw std::runtime_error("No 'name' value or a 'names' vector in the path 'qc.postprocessing." + name + ".dataSourcesADC'"); + throw std::runtime_error("No 'name' value or a 'names' vector in the path 'qc.postprocessing." + name + ".dataSourcesTDC'"); + } + } + // TDC Amplitude + for (const auto& dataSourceConfig : config.get_child("qc.postprocessing." + name + ".dataSourcesTDCA")) { + if (const auto& sourceNames = dataSourceConfig.second.get_child_optional("names"); sourceNames.has_value()) { + for (const auto& sourceName : sourceNames.value()) { + dataSourcesTDCA.push_back({ dataSourceConfig.second.get("path"), + sourceName.second.data() }); + } + } else if (!dataSourceConfig.second.get("name").empty()) { + // "name" : [ "something" ] would return an empty string here + dataSourcesTDCA.push_back({ dataSourceConfig.second.get("path"), + dataSourceConfig.second.get("name") }); + } else { + throw std::runtime_error("No 'name' value or a 'names' vector in the path 'qc.postprocessing." + name + ".dataSourcesTDCA'"); + } + } + // Peak 1n TDC Amplitude + for (const auto& dataSourceConfig : config.get_child("qc.postprocessing." + name + ".dataSourcesPeak1n")) { + if (const auto& sourceNames = dataSourceConfig.second.get_child_optional("names"); sourceNames.has_value()) { + for (const auto& sourceName : sourceNames.value()) { + dataSourcesPeak1n.push_back({ dataSourceConfig.second.get("path"), + sourceName.second.data() }); + } + } else if (!dataSourceConfig.second.get("name").empty()) { + // "name" : [ "something" ] would return an empty string here + dataSourcesPeak1n.push_back({ dataSourceConfig.second.get("path"), + dataSourceConfig.second.get("name") }); + } else { + throw std::runtime_error("No 'name' value or a 'names' vector in the path 'qc.postprocessing." + name + ".dataSourcesPeak1n'"); + } + } + // Peak 1p TDC Amplitude + for (const auto& dataSourceConfig : config.get_child("qc.postprocessing." + name + ".dataSourcesPeak1p")) { + if (const auto& sourceNames = dataSourceConfig.second.get_child_optional("names"); sourceNames.has_value()) { + for (const auto& sourceName : sourceNames.value()) { + dataSourcesPeak1p.push_back({ dataSourceConfig.second.get("path"), + sourceName.second.data() }); + } + } else if (!dataSourceConfig.second.get("name").empty()) { + // "name" : [ "something" ] would return an empty string here + dataSourcesPeak1p.push_back({ dataSourceConfig.second.get("path"), + dataSourceConfig.second.get("name") }); + } else { + throw std::runtime_error("No 'name' value or a 'names' vector in the path 'qc.postprocessing." + name + ".dataSourcesPeak1p'"); } } } diff --git a/Modules/ZDC/src/ZDCRecDataCheck.cxx b/Modules/ZDC/src/ZDCRecDataCheck.cxx index d62e7083c3..ac21faa4a3 100644 --- a/Modules/ZDC/src/ZDCRecDataCheck.cxx +++ b/Modules/ZDC/src/ZDCRecDataCheck.cxx @@ -54,6 +54,7 @@ void ZDCRecDataCheck::startOfActivity(const Activity& activity) Quality ZDCRecDataCheck::check(std::map>* moMap) { Quality result = Quality::Null; + // ADC mNumEADC = 0; mNumWADC = 0; mStringWADC = ""; @@ -94,6 +95,8 @@ Quality ZDCRecDataCheck::check(std::map 0) { mQTDC = 3; } + } - if (mQADC == 1 && mQTDC == 1) { - result = Quality::Good; - } else if (mQADC == 3 || mQTDC == 3) { - result = Quality::Bad; - if (mQADC == 3) { - result.addFlag(FlagTypeFactory::Unknown(), - "Task quality is bad because in ADC Summary " + std::to_string(mNumWADC) + " channels:" + mStringEADC + "have a value in the bad range"); + // summary TDC Amplitude + mNumETDCA = 0; + mNumWTDCA = 0; + mStringWTDCA = ""; + mStringETDCA = ""; + if (mo->getName() == "h_summary_TDCA") { + auto* h = dynamic_cast(mo->getObject()); + if (h == nullptr) { + ILOG(Error, Support) << "could not cast '" << mo->getName() << "' to TH1*" << ENDM; + return Quality::Null; + } + // dumpVecParam((int)h->GetNbinsX(),(int)mVectParamTDC.size()); + if ((int)h->GetNbinsX() != (int)mVectParamTDCA.size()) { + return Quality::Null; + } + for (int i = 0; i < h->GetNbinsX(); i++) { + ib = i + 1; + if ((((float)h->GetBinContent(ib) < (float)mVectParamTDCA.at(i).minW && (float)h->GetBinContent(ib) >= (float)mVectParamTDCA.at(i).minE)) || ((float)h->GetBinContent(ib) > (float)mVectParamTDCA.at(i).maxW && (float)h->GetBinContent(ib) < (float)mVectParamTDCA.at(i).maxE)) { + mNumWTDCA += 1; + mStringWTDCA = mStringWTDCA + mVectParamTDCA.at(i).ch + " "; + // ILOG(Warning, Support) << "Rec Warning in " << mVectParamTDCA.at(i).ch << " intervall: " << mVectParamTDCA.at(i).minW << " - " << mVectParamTDCA.at(i).maxW << " Value: " << h->GetBinContent(ib) << ENDM; } - if (mQTDC == 3) { - result.addFlag(FlagTypeFactory::Unknown(), - "It is bad because in TDC Summary" + std::to_string(mNumWTDC) + " channels:" + mStringETDC + "have a value in the bad range"); + if (((float)h->GetBinContent(ib) < (float)mVectParamTDCA.at(i).minE) || ((float)h->GetBinContent(ib) > (float)mVectParamTDCA.at(i).maxE)) { + mNumETDCA += 1; + mStringETDCA = mStringETDCA + mVectParamTDCA.at(i).ch + " "; + // ILOG(Error, Support) << "Rec Error in " << mVectParamTDCA.at(i).ch << " intervall: " << mVectParamTDCA.at(i).minE << " - " << mVectParamTDCA.at(i).maxE << " Value: " << h->GetBinContent(ib) << ENDM; } - } else { - result = Quality::Medium; - if (mQADC == 2) { - result.addFlag(FlagTypeFactory::Unknown(), - "It is medium because in ADC Summary " + std::to_string(mNumWADC) + " channels:" + mStringWADC + "have a value in the medium range"); + } + if (mNumWTDCA == 0 && mNumETDCA == 0) { + mQTDCA = 1; + } + if (mNumWTDCA > 0) { + mQTDCA = 2; + } + if (mNumETDCA > 0) { + mQTDCA = 3; + } + } + + // summary TDC Amplitude Peak 1n + mNumEPeak1n = 0; + mNumWPeak1n = 0; + mStringWPeak1n = ""; + mStringEPeak1n = ""; + if (mo->getName() == "h_summary_Peak1n") { + auto* h = dynamic_cast(mo->getObject()); + if (h == nullptr) { + ILOG(Error, Support) << "could not cast '" << mo->getName() << "' to TH1*" << ENDM; + return Quality::Null; + } + // dumpVecParam((int)h->GetNbinsX(),(int)mVectParamTDC.size()); + if ((int)h->GetNbinsX() != (int)mVectParamPeak1n.size()) { + return Quality::Null; + } + for (int i = 0; i < h->GetNbinsX(); i++) { + ib = i + 1; + if ((((float)h->GetBinContent(ib) < (float)mVectParamPeak1n.at(i).minW && (float)h->GetBinContent(ib) >= (float)mVectParamPeak1n.at(i).minE)) || ((float)h->GetBinContent(ib) > (float)mVectParamPeak1n.at(i).maxW && (float)h->GetBinContent(ib) < (float)mVectParamPeak1n.at(i).maxE)) { + mNumWPeak1n += 1; + mStringWPeak1n = mStringWPeak1n + mVectParamPeak1n.at(i).ch + " "; + // ILOG(Warning, Support) << "Rec Warning in " << mVectParamPeak1n.at(i).ch << " intervall: " << mVectParamPeak1n.at(i).minW << " - " << mVectParamPeak1n.at(i).maxW << " Value: " << h->GetBinContent(ib) << ENDM; } - if (mQTDC == 2) { - result.addFlag(FlagTypeFactory::Unknown(), - "It is medium because in TDC Summary " + std::to_string(mNumWTDC) + " channels:" + mStringWTDC + "have a value in the medium range"); + if (((float)h->GetBinContent(ib) < (float)mVectParamPeak1n.at(i).minE) || ((float)h->GetBinContent(ib) > (float)mVectParamPeak1n.at(i).maxE)) { + mNumEPeak1n += 1; + mStringEPeak1n = mStringEPeak1n + mVectParamPeak1n.at(i).ch + " "; + // ILOG(Error, Support) << "Rec Error in " << mVectParamPeak1n.at(i).ch << " intervall: " << mVectParamPeak1n.at(i).minE << " - " << mVectParamPeak1n.at(i).maxE << " Value: " << h->GetBinContent(ib) << ENDM; } } + if (mNumWPeak1n == 0 && mNumEPeak1n == 0) { + mQPeak1n = 1; + } + if (mNumWPeak1n > 0) { + mQPeak1n = 2; + } + if (mNumEPeak1n > 0) { + mQPeak1n = 3; + } + } + + // summary TDC Amplitude peak 1p + mNumEPeak1p = 0; + mNumWPeak1p = 0; + mStringWPeak1p = ""; + mStringEPeak1p = ""; + if (mo->getName() == "h_summary_Peak1p") { + auto* h = dynamic_cast(mo->getObject()); + if (h == nullptr) { + ILOG(Error, Support) << "could not cast '" << mo->getName() << "' to TH1*" << ENDM; + return Quality::Null; + } + // dumpVecParam((int)h->GetNbinsX(),(int)mVectParamTDC.size()); + if ((int)h->GetNbinsX() != (int)mVectParamPeak1p.size()) { + return Quality::Null; + } + for (int i = 0; i < h->GetNbinsX(); i++) { + ib = i + 1; + if ((((float)h->GetBinContent(ib) < (float)mVectParamPeak1p.at(i).minW && (float)h->GetBinContent(ib) >= (float)mVectParamPeak1p.at(i).minE)) || ((float)h->GetBinContent(ib) > (float)mVectParamPeak1p.at(i).maxW && (float)h->GetBinContent(ib) < (float)mVectParamPeak1p.at(i).maxE)) { + mNumWPeak1p += 1; + mStringWPeak1p = mStringWPeak1p + mVectParamPeak1p.at(i).ch + " "; + // ILOG(Warning, Support) << "Rec Warning in " << mVectParamPeak1p.at(i).ch << " intervall: " << mVectParamPeak1p.at(i).minW << " - " << mVectParamPeak1p.at(i).maxW << " Value: " << h->GetBinContent(ib) << ENDM; + } + if (((float)h->GetBinContent(ib) < (float)mVectParamPeak1p.at(i).minE) || ((float)h->GetBinContent(ib) > (float)mVectParamPeak1p.at(i).maxE)) { + mNumEPeak1p += 1; + mStringEPeak1p = mStringEPeak1p + mVectParamPeak1p.at(i).ch + " "; + // ILOG(Error, Support) << "Rec Error in " << mVectParamPeak1p.at(i).ch << " intervall: " << mVectParamPeak1p.at(i).minE << " - " << mVectParamPeak1p.at(i).maxE << " Value: " << h->GetBinContent(ib) << ENDM; + } + } + if (mNumWPeak1p == 0 && mNumEPeak1p == 0) { + mQPeak1p = 1; + } + if (mNumWPeak1p > 0) { + mQPeak1p = 2; + } + if (mNumEPeak1p > 0) { + mQPeak1p = 3; + } + } + + // Global Check + if (mQADC == 1 && mQTDC == 1 && mQTDCA == 1 && mQPeak1n == 1 && mQPeak1p == 1) { + result = Quality::Good; + } else if (mQADC == 3 || mQTDC == 3 || mQTDCA == 3 && mQPeak1n == 3 && mQPeak1p == 3) { + result = Quality::Bad; + if (mQADC == 3) { + result.addFlag(FlagTypeFactory::Unknown(), + "Task quality is bad because in ADC Summary " + std::to_string(mNumWADC) + " channels:" + mStringEADC + "have a value in the bad range"); + } + + if (mQTDC == 3) { + result.addFlag(FlagTypeFactory::Unknown(), + "It is bad because in TDC Summary" + std::to_string(mNumWTDC) + " channels:" + mStringETDC + "have a value in the bad range"); + } + if (mQTDCA == 3) { + result.addFlag(FlagTypeFactory::Unknown(), + "It is bad because in TDC Amplitude Summary" + std::to_string(mNumWTDCA) + " channels:" + mStringETDCA + "have a value in the bad range"); + } + if (mQPeak1n == 3) { + result.addFlag(FlagTypeFactory::Unknown(), + "It is bad because in TDC Amplitude Peak1n Summary" + std::to_string(mNumWPeak1n) + " channels:" + mStringEPeak1n + "have a value in the bad range"); + } + if (mQPeak1p == 3) { + result.addFlag(FlagTypeFactory::Unknown(), + "It is bad because in TDC Amplitude Peak1p Summary" + std::to_string(mNumWPeak1p) + " channels:" + mStringEPeak1p + "have a value in the bad range"); + } + } else { + result = Quality::Medium; + if (mQADC == 2) { + result.addFlag(FlagTypeFactory::Unknown(), + "It is medium because in ADC Summary " + std::to_string(mNumWADC) + " channels:" + mStringWADC + "have a value in the medium range"); + } + if (mQTDC == 2) { + result.addFlag(FlagTypeFactory::Unknown(), + "It is medium because in TDC Summary " + std::to_string(mNumWTDC) + " channels:" + mStringWTDC + "have a value in the medium range"); + } + if (mQTDCA == 2) { + result.addFlag(FlagTypeFactory::Unknown(), + "It is medium because in TDC Amplitude Summary " + std::to_string(mNumWTDCA) + " channels:" + mStringWTDCA + "have a value in the medium range"); + } + if (mQPeak1n == 2) { + result.addFlag(FlagTypeFactory::Unknown(), + "It is medium because in TDC Amplitude Peak1n Summary " + std::to_string(mNumWPeak1n) + " channels:" + mStringWPeak1n + "have a value in the medium range"); + } + if (mQPeak1p == 2) { + result.addFlag(FlagTypeFactory::Unknown(), + "It is medium because in TDC Amplitude Peak1p Summary " + std::to_string(mNumWPeak1p) + " channels:" + mStringWPeak1p + "have a value in the medium range"); + } } } return result; @@ -174,6 +320,7 @@ void ZDCRecDataCheck::beautify(std::shared_ptr mo, Quality checkR setQualityInfo(mo, kOrange, errorSt); } } + if (mo->getName() == "h_summary_TDC") { if (mQTDC == 1) { setQualityInfo(mo, kGreen, getCurrentDataTime() + "TDC OK"); @@ -185,8 +332,43 @@ void ZDCRecDataCheck::beautify(std::shared_ptr mo, Quality checkR setQualityInfo(mo, kOrange, errorSt); } } -} + if (mo->getName() == "h_summary_TDCA") { + if (mQTDCA == 1) { + setQualityInfo(mo, kGreen, getCurrentDataTime() + "TDC Amplitude OK"); + } else if (mQTDCA == 3) { + std::string errorSt = getCurrentDataTime() + "Error TDC Amplitude value in the channels: " + mStringETDCA + "is not correct. Call the expert"; + setQualityInfo(mo, kRed, errorSt); + } else if (mQTDCA == 2) { + std::string errorSt = getCurrentDataTime() + "Warning TDC Amplitude value in the channels: " + mStringWTDCA + "is not correct. Send mail to the expert"; + setQualityInfo(mo, kOrange, errorSt); + } + } + + if (mo->getName() == "h_summary_Peak1n") { + if (mQPeak1n == 1) { + setQualityInfo(mo, kGreen, getCurrentDataTime() + "TDC Amplitude Peak1n OK"); + } else if (mQPeak1n == 3) { + std::string errorSt = getCurrentDataTime() + "Error TDC Amplitude Peak1n value in the channels: " + mStringEPeak1n + "is not correct. Call the expert"; + setQualityInfo(mo, kRed, errorSt); + } else if (mQPeak1n == 2) { + std::string errorSt = getCurrentDataTime() + "Warning TDC Amplitude Peak1n value in the channels: " + mStringWPeak1n + "is not correct. Send mail to the expert"; + setQualityInfo(mo, kOrange, errorSt); + } + } + + if (mo->getName() == "h_summary_Peak1p") { + if (mQPeak1p == 1) { + setQualityInfo(mo, kGreen, getCurrentDataTime() + "TDC Amplitude OK"); + } else if (mQPeak1p == 3) { + std::string errorSt = getCurrentDataTime() + "Error TDC Amplitude Peak1p value in the channels: " + mStringEPeak1p + "is not correct. Call the expert"; + setQualityInfo(mo, kRed, errorSt); + } else if (mQPeak1p == 2) { + std::string errorSt = getCurrentDataTime() + "Warning TDC Amplitude Peak1p value in the channels: " + mStringWPeak1p + "is not correct. Send mail to the expert"; + setQualityInfo(mo, kOrange, errorSt); + } + } +} void ZDCRecDataCheck::setQualityInfo(std::shared_ptr mo, int color, std::string text) { auto* h = dynamic_cast(mo->getObject()); @@ -209,6 +391,9 @@ void ZDCRecDataCheck::init(const Activity& activity) { mVectParamADC.clear(); mVectParamTDC.clear(); + mVectParamTDCA.clear(); + mVectParamPeak1n.clear(); + mVectParamPeak1p.clear(); setChName("ADC_ZNAC", "ADC"); setChName("ADC_ZNA1", "ADC"); @@ -252,12 +437,42 @@ void ZDCRecDataCheck::init(const Activity& activity) setChName("TDC_ZPCC", "TDC"); setChName("TDC_ZPCS", "TDC"); + setChName("TDCA_ZNAC", "TDCA"); + setChName("TDCA_ZNAS", "TDCA"); + setChName("TDCA_ZPAC", "TDCA"); + setChName("TDCA_ZPAS", "TDCA"); + setChName("TDCA_ZEM1", "TDCA"); + setChName("TDCA_ZEM2", "TDCA"); + setChName("TDCA_ZNCC", "TDCA"); + setChName("TDCA_ZNCS", "TDCA"); + setChName("TDCA_ZPCC", "TDCA"); + setChName("TDCA_ZPCS", "TDCA"); + + setChName("PEAK1N_ZNAC", "PEAK1N"); + setChName("PEAK1N_ZNAS", "PEAK1N"); + setChName("PEAK1N_ZNCC", "PEAK1N"); + setChName("PEAK1N_ZNCS", "PEAK1N"); + + setChName("PEAK1P_ZPAC", "PEAK1P"); + setChName("PEAK1P_ZPAS", "PEAK1P"); + setChName("PEAK1P_ZPCC", "PEAK1P"); + setChName("PEAK1P_ZPCS", "PEAK1P"); + for (int i = 0; i < (int)mVectParamADC.size(); i++) { setChCheck(i, "ADC", activity); } for (int i = 0; i < (int)mVectParamTDC.size(); i++) { setChCheck(i, "TDC", activity); } + for (int i = 0; i < (int)mVectParamTDCA.size(); i++) { + setChCheck(i, "TDCA", activity); + } + for (int i = 0; i < (int)mVectParamPeak1n.size(); i++) { + setChCheck(i, "PEAK1N", activity); + } + for (int i = 0; i < (int)mVectParamPeak1p.size(); i++) { + setChCheck(i, "PEAK1P", activity); + } if (auto param = mCustomParameters.atOptional("ADC_POS_MSG_X", activity)) { mPosMsgADCX = atof(param.value().c_str()); } @@ -270,6 +485,24 @@ void ZDCRecDataCheck::init(const Activity& activity) if (auto param = mCustomParameters.atOptional("TDC_POS_MSG_Y", activity)) { mPosMsgTDCY = atof(param.value().c_str()); } + if (auto param = mCustomParameters.atOptional("TDCA_POS_MSG_X", activity)) { + mPosMsgTDCAX = atof(param.value().c_str()); + } + if (auto param = mCustomParameters.atOptional("TDCA_POS_MSG_Y", activity)) { + mPosMsgTDCAY = atof(param.value().c_str()); + } + if (auto param = mCustomParameters.atOptional("PEAK1N_POS_MSG_X", activity)) { + mPosMsgPeak1nX = atof(param.value().c_str()); + } + if (auto param = mCustomParameters.atOptional("PEAK1N_POS_MSG_Y", activity)) { + mPosMsgPeak1nY = atof(param.value().c_str()); + } + if (auto param = mCustomParameters.atOptional("PEAK1P_POS_MSG_X", activity)) { + mPosMsgPeak1pX = atof(param.value().c_str()); + } + if (auto param = mCustomParameters.atOptional("PEAK1P_POS_MSG_Y", activity)) { + mPosMsgPeak1pY = atof(param.value().c_str()); + } } void ZDCRecDataCheck::setChName(std::string channel, std::string type) @@ -282,6 +515,15 @@ void ZDCRecDataCheck::setChName(std::string channel, std::string type) if (type == "TDC") { mVectParamTDC.push_back(chCheck); } + if (type == "TDCA") { + mVectParamTDCA.push_back(chCheck); + } + if (type == "PEAK1N") { + mVectParamPeak1n.push_back(chCheck); + } + if (type == "PEAK1P") { + mVectParamPeak1p.push_back(chCheck); + } } void ZDCRecDataCheck::setChCheck(int index, std::string type, const Activity& activity) @@ -307,8 +549,37 @@ void ZDCRecDataCheck::setChCheck(int index, std::string type, const Activity& ac mVectParamTDC.at(index).maxE = atof(tokenString.at(0).c_str()) + atof(tokenString.at(2).c_str()); } } -} + if (type == "TDCA" && index < (int)mVectParamTDCA.size()) { + if (auto param = mCustomParameters.atOptional(mVectParamTDCA.at(index).ch, activity)) { + tokenString = tokenLine(param.value(), ";"); + + mVectParamTDCA.at(index).minW = atof(tokenString.at(0).c_str()) - atof(tokenString.at(1).c_str()); + mVectParamTDCA.at(index).maxW = atof(tokenString.at(0).c_str()) + atof(tokenString.at(1).c_str()); + mVectParamTDCA.at(index).minE = atof(tokenString.at(0).c_str()) - atof(tokenString.at(2).c_str()); + mVectParamTDCA.at(index).maxE = atof(tokenString.at(0).c_str()) + atof(tokenString.at(2).c_str()); + } + } + if (type == "PEAK1N" && index < (int)mVectParamPeak1n.size()) { + if (auto param = mCustomParameters.atOptional(mVectParamPeak1n.at(index).ch, activity)) { + tokenString = tokenLine(param.value(), ";"); + mVectParamPeak1n.at(index).minW = atof(tokenString.at(0).c_str()) - atof(tokenString.at(1).c_str()); + mVectParamPeak1n.at(index).maxW = atof(tokenString.at(0).c_str()) + atof(tokenString.at(1).c_str()); + mVectParamPeak1n.at(index).minE = atof(tokenString.at(0).c_str()) - atof(tokenString.at(2).c_str()); + mVectParamPeak1n.at(index).maxE = atof(tokenString.at(0).c_str()) + atof(tokenString.at(2).c_str()); + } + } + if (type == "PEAK1P" && index < (int)mVectParamPeak1p.size()) { + if (auto param = mCustomParameters.atOptional(mVectParamPeak1p.at(index).ch, activity)) { + tokenString = tokenLine(param.value(), ";"); + + mVectParamPeak1p.at(index).minW = atof(tokenString.at(0).c_str()) - atof(tokenString.at(1).c_str()); + mVectParamPeak1p.at(index).maxW = atof(tokenString.at(0).c_str()) + atof(tokenString.at(1).c_str()); + mVectParamPeak1p.at(index).minE = atof(tokenString.at(0).c_str()) - atof(tokenString.at(2).c_str()); + mVectParamPeak1p.at(index).maxE = atof(tokenString.at(0).c_str()) + atof(tokenString.at(2).c_str()); + } + } +} std::vector ZDCRecDataCheck::tokenLine(std::string Line, std::string Delimiter) { std::string token; @@ -347,10 +618,23 @@ void ZDCRecDataCheck::dumpVecParam(int numBinHisto, int num_ch) for (int i = 0; i < (int)mVectParamTDC.size(); i++) { dumpFile << mVectParamTDC.at(i).ch << " \t" << std::to_string(mVectParamTDC.at(i).minW) << " \t" << std::to_string(mVectParamTDC.at(i).maxW) << " \t" << std::to_string(mVectParamTDC.at(i).minE) << " \t" << std::to_string(mVectParamTDC.at(i).maxE) << " \n"; } + dumpFile << "\n Vector Param TDCA \n"; + for (int i = 0; i < (int)mVectParamTDCA.size(); i++) { + dumpFile << mVectParamTDCA.at(i).ch << " \t" << std::to_string(mVectParamTDCA.at(i).minW) << " \t" << std::to_string(mVectParamTDCA.at(i).maxW) << " \t" << std::to_string(mVectParamTDCA.at(i).minE) << " \t" << std::to_string(mVectParamTDCA.at(i).maxE) << " \n"; + } + dumpFile << "\n Vector Param PEAK1N \n"; + for (int i = 0; i < (int)mVectParamPeak1n.size(); i++) { + dumpFile << mVectParamPeak1n.at(i).ch << " \t" << std::to_string(mVectParamPeak1n.at(i).minW) << " \t" << std::to_string(mVectParamPeak1n.at(i).maxW) << " \t" << std::to_string(mVectParamPeak1n.at(i).minE) << " \t" << std::to_string(mVectParamPeak1n.at(i).maxE) << " \n"; + } + + dumpFile << "\n Vector Param PEAK1P \n"; + for (int i = 0; i < (int)mVectParamPeak1n.size(); i++) { + dumpFile << mVectParamPeak1p.at(i).ch << " \t" << std::to_string(mVectParamPeak1p.at(i).minW) << " \t" << std::to_string(mVectParamPeak1p.at(i).maxW) << " \t" << std::to_string(mVectParamPeak1p.at(i).minE) << " \t" << std::to_string(mVectParamPeak1p.at(i).maxE) << " \n"; + } + dumpFile << "Num Bin Histo " << std::to_string(numBinHisto) << " \n"; dumpFile << "Num ch " << std::to_string(num_ch) << " \n"; dumpFile.close(); } } - } // namespace o2::quality_control_modules::zdc diff --git a/Modules/ZDC/src/ZDCRecDataPostProcessing.cxx b/Modules/ZDC/src/ZDCRecDataPostProcessing.cxx index c7b4031afb..d3ef0301b9 100644 --- a/Modules/ZDC/src/ZDCRecDataPostProcessing.cxx +++ b/Modules/ZDC/src/ZDCRecDataPostProcessing.cxx @@ -12,7 +12,7 @@ /// /// \file ZDCRecDataPostProcessing.cxx /// \author Andrea Ferrero andrea.ferrero@cern.ch -/// \brief Post-processing of the ZDC ADC and TDC plots +/// \brief Post-processing of the ZDC ADC and TDC (Time and amplitudes) plots /// \since 30/08/2023 /// @@ -141,7 +141,7 @@ void ZDCRecDataPostProcessing::configure(const boost::property_tree::ptree& conf mMOsADC.emplace(mBinLabelsADC.size(), MOHelper(source.path, moName)); } - // TDC summary plot + // TDC Time summary plot for (auto source : zdcConfig.dataSourcesTDC) { std::string histName, moName; splitDataSourceName(source.name, histName, moName); @@ -152,6 +152,42 @@ void ZDCRecDataPostProcessing::configure(const boost::property_tree::ptree& conf mBinLabelsTDC.emplace_back(histName); mMOsTDC.emplace(mBinLabelsTDC.size(), MOHelper(source.path, moName)); } + + // TDC Amplitude summary plot + for (auto source : zdcConfig.dataSourcesTDCA) { + std::string histName, moName; + splitDataSourceName(source.name, histName, moName); + if (moName.empty()) { + continue; + } + + mBinLabelsTDCA.emplace_back(histName); + mMOsTDCA.emplace(mBinLabelsTDCA.size(), MOHelper(source.path, moName)); + } + + // TDC Peak 1n summary plot + for (auto source : zdcConfig.dataSourcesPeak1n) { + std::string histName, moName; + splitDataSourceName(source.name, histName, moName); + if (moName.empty()) { + continue; + } + + mBinLabelsPeak1n.emplace_back(histName); + mMOsPeak1n.emplace(mBinLabelsPeak1n.size(), MOHelper(source.path, moName)); + } + + // TDC Peak 1p summary plot + for (auto source : zdcConfig.dataSourcesPeak1p) { + std::string histName, moName; + splitDataSourceName(source.name, histName, moName); + if (moName.empty()) { + continue; + } + + mBinLabelsPeak1p.emplace_back(histName); + mMOsPeak1p.emplace(mBinLabelsPeak1p.size(), MOHelper(source.path, moName)); + } } //_________________________________________________________________________________________ @@ -180,12 +216,51 @@ void ZDCRecDataPostProcessing::createSummaryTDCHistos(Trigger t, repository::Dat //_________________________________________________________________________________________ +void ZDCRecDataPostProcessing::createSummaryTDCAHistos(Trigger t, repository::DatabaseInterface* qcdb) +{ + mSummaryTDCAHisto.reset(); + mSummaryTDCAHisto = std::make_unique("h_summary_TDCA", "Summary TDC Amplitude", mBinLabelsTDCA.size(), 0, mBinLabelsTDCA.size()); + for (size_t bin = 0; bin < mBinLabelsTDCA.size(); bin++) { + mSummaryTDCAHisto->GetXaxis()->SetBinLabel(bin + 1, mBinLabelsTDCA[bin].c_str()); + } + publishHisto(mSummaryTDCAHisto.get(), false, "E", ""); +} + +//_________________________________________________________________________________________ + +void ZDCRecDataPostProcessing::createSummaryPeak1nHistos(Trigger t, repository::DatabaseInterface* qcdb) +{ + mSummaryPeak1nHisto.reset(); + mSummaryPeak1nHisto = std::make_unique("h_summary_Peak1n", "Summary TDC Amplitude Peak 1n", mBinLabelsPeak1n.size(), 0, mBinLabelsPeak1n.size()); + for (size_t bin = 0; bin < mBinLabelsPeak1n.size(); bin++) { + mSummaryPeak1nHisto->GetXaxis()->SetBinLabel(bin + 1, mBinLabelsPeak1n[bin].c_str()); + } + publishHisto(mSummaryPeak1nHisto.get(), false, "E", ""); +} + +//_________________________________________________________________________________________ + +void ZDCRecDataPostProcessing::createSummaryPeak1pHistos(Trigger t, repository::DatabaseInterface* qcdb) +{ + mSummaryPeak1pHisto.reset(); + mSummaryPeak1pHisto = std::make_unique("h_summary_Peak1p", "Summary TDC Amplitude Peak 1p", mBinLabelsPeak1p.size(), 0, mBinLabelsPeak1p.size()); + for (size_t bin = 0; bin < mBinLabelsPeak1p.size(); bin++) { + mSummaryPeak1pHisto->GetXaxis()->SetBinLabel(bin + 1, mBinLabelsPeak1p[bin].c_str()); + } + publishHisto(mSummaryPeak1pHisto.get(), false, "E", ""); +} + +//_________________________________________________________________________________________ + void ZDCRecDataPostProcessing::initialize(Trigger t, framework::ServiceRegistryRef services) { auto& qcdb = services.get(); createSummaryADCHistos(t, &qcdb); createSummaryTDCHistos(t, &qcdb); + createSummaryTDCAHistos(t, &qcdb); + createSummaryPeak1nHistos(t, &qcdb); + createSummaryPeak1pHistos(t, &qcdb); } //_________________________________________________________________________________________ @@ -224,12 +299,79 @@ void ZDCRecDataPostProcessing::updateSummaryTDCHistos(Trigger t, repository::Dat //_________________________________________________________________________________________ +void ZDCRecDataPostProcessing::updateSummaryTDCAHistos(Trigger t, repository::DatabaseInterface* qcdb) +{ + for (auto& [bin, mo] : mMOsTDCA) { + if (!mo.update(qcdb, t.timestamp, t.activity)) { + continue; + } + TH1F* h = mo.get(); + if (!h) { + continue; + } + mSummaryTDCAHisto->SetBinContent(bin, h->GetMean()); + mSummaryTDCAHisto->SetBinError(bin, h->GetMeanError()); + } +} + +//_________________________________________________________________________________________ + +void ZDCRecDataPostProcessing::updateSummaryPeak1nHistos(Trigger t, repository::DatabaseInterface* qcdb) +{ + for (auto& [bin, mo] : mMOsPeak1n) { + if (!mo.update(qcdb, t.timestamp, t.activity)) { + continue; + } + TH1F* h = mo.get(); + if (!h) { + continue; + } + h->GetXaxis()->SetRangeUser(1., 200.); + mSummaryPeak1nHisto->SetBinContent(bin, h->GetBinCenter(h->GetMaximumBin())); + } +} + +//_________________________________________________________________________________________ + +void ZDCRecDataPostProcessing::updateSummaryPeak1pHistos(Trigger t, repository::DatabaseInterface* qcdb) +{ + float minBin1p = 2; + float maxBin1p = 250; + for (auto& [bin, mo] : mMOsPeak1p) { + if (!mo.update(qcdb, t.timestamp, t.activity)) { + continue; + } + TH1F* h = mo.get(); + if (!h) { + continue; + } + if (auto param = mCustomParameters.find("minBin1p"); param != mCustomParameters.end()) { + ILOG(Debug, Devel) << "Custom parameter - minBin1p: " << param->second << ENDM; + minBin1p = atof(param->second.c_str()); + } else { + minBin1p = 2; + } + if (auto param = mCustomParameters.find("maxBin1p"); param != mCustomParameters.end()) { + ILOG(Debug, Devel) << "Custom parameter - maxBin1p: " << param->second << ENDM; + maxBin1p = atof(param->second.c_str()); + } else { + maxBin1p = 250; + } + h->GetXaxis()->SetRangeUser(2, 250); + mSummaryPeak1pHisto->SetBinContent(bin, h->GetBinCenter(h->GetMaximumBin())); + } +} +//_________________________________________________________________________________________ + void ZDCRecDataPostProcessing::update(Trigger t, framework::ServiceRegistryRef services) { auto& qcdb = services.get(); updateSummaryADCHistos(t, &qcdb); updateSummaryTDCHistos(t, &qcdb); + updateSummaryTDCAHistos(t, &qcdb); + updateSummaryPeak1nHistos(t, &qcdb); + updateSummaryPeak1pHistos(t, &qcdb); } //_________________________________________________________________________________________ diff --git a/Modules/ZDC/src/ZDCRecDataTask.cxx b/Modules/ZDC/src/ZDCRecDataTask.cxx index b17f7cbae0..baea99529d 100644 --- a/Modules/ZDC/src/ZDCRecDataTask.cxx +++ b/Modules/ZDC/src/ZDCRecDataTask.cxx @@ -405,10 +405,10 @@ void ZDCRecDataTask::initHisto() addNewHisto("ADCSUMvsTC", "h_ADC_ZNC_ZEM1", "ADC ZNC TC vs ADC ZEM1", "ADC", "ZEM1", "ADC", "ZNCC", 0); addNewHisto("ADCSUMvsTC", "h_ADC_ZNC_ZEM2", "ADC ZNC TC vs ADC ZEM2", "ADC", "ZEM2", "ADC", "ZNCC", 0); - addNewHisto("ADCSUMvsTC", "h_ADC_ZNA_ZEM1", "ADC ZPA TC vs ADC ZEM1", "ADC", "ZEM1", "ADC", "ZPAC", 0); - addNewHisto("ADCSUMvsTC", "h_ADC_ZNA_ZEM2", "ADC ZPA TC vs ADC ZEM2", "ADC", "ZEM2", "ADC", "ZPAC", 0); - addNewHisto("ADCSUMvsTC", "h_ADC_ZNC_ZEM1", "ADC ZPC TC vs ADC ZEM1", "ADC", "ZEM1", "ADC", "ZPCC", 0); - addNewHisto("ADCSUMvsTC", "h_ADC_ZNC_ZEM2", "ADC ZPC TC vs ADC ZEM2", "ADC", "ZEM2", "ADC", "ZPCC", 0); + addNewHisto("ADCSUMvsTC", "h_ADC_ZPA_ZEM1", "ADC ZPA TC vs ADC ZEM1", "ADC", "ZEM1", "ADC", "ZPAC", 0); + addNewHisto("ADCSUMvsTC", "h_ADC_ZPA_ZEM2", "ADC ZPA TC vs ADC ZEM2", "ADC", "ZEM2", "ADC", "ZPAC", 0); + addNewHisto("ADCSUMvsTC", "h_ADC_ZPC_ZEM1", "ADC ZPC TC vs ADC ZEM1", "ADC", "ZEM1", "ADC", "ZPCC", 0); + addNewHisto("ADCSUMvsTC", "h_ADC_ZPC_ZEM2", "ADC ZPC TC vs ADC ZEM2", "ADC", "ZEM2", "ADC", "ZPCC", 0); if (auto param = mCustomParameters.find("ADCvsTDCT"); param != mCustomParameters.end()) { ILOG(Debug, Devel) << "Custom parameter - ADCvsTDCT: " << param->second << ENDM; @@ -502,10 +502,10 @@ void ZDCRecDataTask::initHisto() addNewHisto("TDC_A_A", "h_TDC_ZNC_ZEM1", "ZNC TDC amplitude vs ZEM1 TDC amplitude", "TDCA", "ZEM1", "TDCA", "ZNCC", 0); addNewHisto("TDC_A_A", "h_TDC_ZNC_ZEM2", "ZNC TDC amplitude vs ZEM2 TDC amplitude", "TDCA", "ZEM2", "TDCA", "ZNCC", 0); - addNewHisto("TDC_A_A", "h_TDC_ZPA_ZEM1", "ZNA TDC amplitude vs ZEM1 TDC amplitude", "TDCA", "ZEM1", "TDCA", "ZPAC", 0); - addNewHisto("TDC_A_A", "h_TDC_ZPA_ZEM2", "ZNA TDC amplitude vs ZEM2 TDC amplitude", "TDCA", "ZEM2", "TDCA", "ZPAC", 0); - addNewHisto("TDC_A_A", "h_TDC_ZPC_ZEM1", "ZNC TDC amplitude vs ZEM1 TDC amplitude", "TDCA", "ZEM1", "TDCA", "ZPCC", 0); - addNewHisto("TDC_A_A", "h_TDC_ZPC_ZEM2", "ZNC TDC amplitude vs ZEM2 TDC amplitude", "TDCA", "ZEM2", "TDCA", "ZPCC", 0); + addNewHisto("TDC_A_A", "h_TDC_ZPA_ZEM1", "ZPA TDC amplitude vs ZEM1 TDC amplitude", "TDCA", "ZEM1", "TDCA", "ZPAC", 0); + addNewHisto("TDC_A_A", "h_TDC_ZPA_ZEM2", "ZPA TDC amplitude vs ZEM2 TDC amplitude", "TDCA", "ZEM2", "TDCA", "ZPAC", 0); + addNewHisto("TDC_A_A", "h_TDC_ZPC_ZEM1", "ZPC TDC amplitude vs ZEM1 TDC amplitude", "TDCA", "ZEM1", "TDCA", "ZPCC", 0); + addNewHisto("TDC_A_A", "h_TDC_ZPC_ZEM2", "ZPC TDC amplitude vs ZEM2 TDC amplitude", "TDCA", "ZEM2", "TDCA", "ZPCC", 0); // msg histo setBinHisto2D(26, -0.5, 26.0 - 0.5, 19, -0.5, 19.0 - 0.5);