Skip to content

Commit f6fbaab

Browse files
mleschga94pez
authored andcommitted
TPC Reductor PID Separation Power (#2224)
* TPC Reductor PID Separation Power * Change to flaot --------- Co-authored-by: ga94pez <ga94pez@mytum.de>
1 parent 332904c commit f6fbaab

5 files changed

Lines changed: 198 additions & 1 deletion

File tree

Modules/TPC/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ target_sources(O2QcTPC PRIVATE src/PID.cxx
3636
src/TPCAggregator.cxx
3737
src/SACZeroScaleReductor.cxx
3838
src/TrackClusters.cxx
39-
src/VDriftCalibReductor.cxx)
39+
src/VDriftCalibReductor.cxx
40+
src/SeparationPowerReductor.cxx)
4041

4142
target_include_directories(
4243
O2QcTPC
@@ -93,6 +94,7 @@ add_root_dictionary(O2QcTPC
9394
include/TPC/SACZeroScaleReductor.h
9495
include/TPC/TrackClusters.h
9596
include/TPC/VDriftCalibReductor.h
97+
include/TPC/SeparationPowerReductor.h
9698
LINKDEF include/TPC/LinkDef.h)
9799

98100
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/TPC
@@ -174,4 +176,5 @@ install(FILES run/tpcQCPID_sampled.json
174176
run/tpcQCSACScaleTrend.json
175177
run/tpcQCTrackClusters.json
176178
run/tpcQCvDriftTrending.json
179+
run/tpcQCTrending_separationpower.json
177180
DESTINATION etc)

Modules/TPC/include/TPC/LinkDef.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#pragma link C++ class o2::quality_control_modules::tpc::SACZeroScaleReductor + ;
4242
#pragma link C++ class o2::quality_control_modules::tpc::TrackClusters + ;
4343
#pragma link C++ class o2::quality_control_modules::tpc::VDriftCalibReductor + ;
44+
#pragma link C++ class o2::quality_control_modules::tpc::SeparationPowerReductor + ;
4445

4546
#pragma link C++ function o2::quality_control_modules::tpc::addAndPublish + ;
4647
#pragma link C++ function o2::quality_control_modules::tpc::toVector + ;
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
//
13+
// \file SeparationPowerReductor.h
14+
// \author Marcel Lesch
15+
//
16+
#ifndef QC_MODULE_TPC_SEPARATIONPOWERREDUCTOR_H
17+
#define QC_MODULE_TPC_SEPARATIONPOWERREDUCTOR_H
18+
19+
#include "QualityControl/ReductorTObject.h"
20+
#include <TText.h>
21+
22+
namespace o2::quality_control_modules::tpc
23+
{
24+
25+
/// \brief Reductor for TPC PID separation power values
26+
///
27+
/// Reductor for TPC PID separation power values
28+
class SeparationPowerReductor : public quality_control::postprocessing::ReductorTObject
29+
{
30+
public:
31+
SeparationPowerReductor() = default;
32+
~SeparationPowerReductor() = default;
33+
34+
void* getBranchAddress() final;
35+
const char* getBranchLeafList() final;
36+
void update(TObject* obj) final;
37+
38+
private:
39+
struct {
40+
float meanPi;
41+
float meanEl;
42+
float separationPower;
43+
} mSeparationPower;
44+
45+
float getValue(TText* line);
46+
};
47+
48+
} // namespace o2::quality_control_modules::tpc
49+
#endif // QC_MODULE_TPC_SEPARATIONPOWERREDUCTOR_H
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"qc": {
3+
"config": {
4+
"database": {
5+
"implementation": "CCDB",
6+
"host": "ccdb-test.cern.ch:8080",
7+
"username": "not_applicable",
8+
"password": "not_applicable",
9+
"name": "not_applicable"
10+
},
11+
"Activity": {
12+
"number": "42",
13+
"type": "2"
14+
},
15+
"monitoring": {
16+
"url": "infologger:///debug?qc"
17+
},
18+
"consul": {
19+
"url": ""
20+
},
21+
"conditionDB": {
22+
"url": "ccdb-test.cern.ch:8080"
23+
}
24+
},
25+
"postprocessing": {
26+
"PID_SepPower_Trend": {
27+
"active": "true",
28+
"className": "o2::quality_control::postprocessing::TrendingTask",
29+
"moduleName": "QualityControl",
30+
"resumeTrend": "false",
31+
"detectorName": "TPC",
32+
"dataSources": [
33+
{
34+
"type": "repository",
35+
"path": "TPC/MO/PID",
36+
"name": "CSeparationPower",
37+
"reductorName": "o2::quality_control_modules::tpc::SeparationPowerReductor",
38+
"moduleName": "QcTPC"
39+
}
40+
],
41+
"plots": [
42+
{
43+
"name": "sepPower_MeanPi",
44+
"title": "Trend of Separation Power Mean Pion",
45+
"varexp": "CSeparationPower.meanPi:time",
46+
"selection": "",
47+
"option": "*L",
48+
"graphErrors": ""
49+
},
50+
{
51+
"name": "sepPower_El",
52+
"title": "Trend of Separation Power Mean Electron",
53+
"varexp": "CSeparationPower.meanEl:time",
54+
"selection": "",
55+
"option": "*L",
56+
"graphErrors": ""
57+
},
58+
{
59+
"name": "sepPower_SeparationPower",
60+
"title": "Trend of SeparationPower",
61+
"varexp": "CSeparationPower.separationPower:time",
62+
"selection": "",
63+
"option": "*L",
64+
"graphErrors": ""
65+
}
66+
],
67+
"initTrigger": [
68+
"userorcontrol"
69+
],
70+
"updateTrigger": [
71+
"foreachlatest:ccdb:qc/TPC/MO/PID/CSeparationPower"
72+
],
73+
"stopTrigger": [
74+
"userorcontrol"
75+
]
76+
}
77+
}
78+
}
79+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
//
13+
// \file SeparationPowerReductor.cxx
14+
// \author Marcel Lesch
15+
//
16+
#include "TPC/SeparationPowerReductor.h"
17+
#include "QualityControl/QcInfoLogger.h"
18+
#include <boost/algorithm/string.hpp>
19+
#include <string>
20+
#include <TCanvas.h>
21+
#include <TPaveText.h>
22+
23+
namespace o2::quality_control_modules::tpc
24+
{
25+
26+
void* SeparationPowerReductor::getBranchAddress()
27+
{
28+
return &mSeparationPower;
29+
}
30+
31+
const char* SeparationPowerReductor::getBranchLeafList()
32+
{
33+
return "meanPi/F:meanEl:separationPower";
34+
}
35+
36+
void SeparationPowerReductor::update(TObject* obj)
37+
{
38+
// The values for the separation power are saved in a TPaveText inside a TCanvas 'obj'.
39+
if (obj) {
40+
if (auto canvas = static_cast<TCanvas*>(obj)) {
41+
if (auto blocText = static_cast<TPaveText*>(canvas->GetPrimitive("TPave"))) {
42+
mSeparationPower.meanPi = getValue((TText*)blocText->GetLineWith("Mean Pi:"));
43+
mSeparationPower.meanEl = getValue((TText*)blocText->GetLineWith("Mean El:"));
44+
mSeparationPower.separationPower = getValue((TText*)blocText->GetLineWith("separationPower:"));
45+
}
46+
}
47+
} else {
48+
ILOG(Error, Support) << "No 'obj' found." << ENDM;
49+
}
50+
}
51+
52+
float SeparationPowerReductor::getValue(TText* line)
53+
{
54+
if (!line) {
55+
return 0.;
56+
}
57+
58+
std::string text = static_cast<std::string>(line->GetTitle());
59+
const std::size_t posEndType = text.find(":");
60+
std::string quantity = text.substr(posEndType + 2, -1); // take string (excluding : and empty space) till end of line
61+
62+
return stof(quantity);
63+
}
64+
65+
} // namespace o2::quality_control_modules::tpc

0 commit comments

Comments
 (0)