Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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
4 changes: 3 additions & 1 deletion 4 Detectors/TPC/qc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ o2_add_library(TPCQC
src/Helpers.cxx
src/Clusters.cxx
src/Tracks.cxx
src/DCSPTemperature.cxx
PUBLIC_LINK_LIBRARIES O2::TPCBase
O2::DataFormatsTPC
O2::GPUO2Interface)
Expand All @@ -26,7 +27,8 @@ o2_target_root_dictionary(TPCQC
include/TPCQC/Helpers.h
include/TPCQC/Clusters.h
include/TPCQC/Tracks.h
include/TPCQC/CalPadWrapper.h)
include/TPCQC/CalPadWrapper.h
include/TPCQC/DCSPTemperature.h)

o2_add_test(PID
COMPONENT_NAME tpc
Expand Down
59 changes: 59 additions & 0 deletions 59 Detectors/TPC/qc/include/TPCQC/DCSPTemperature.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

///
/// @file DCSPTemperature.h
/// @author Thomas Klemenz, thomas.klemenz@tum.de
///

#ifndef AliceO2_TPC_QC_DCSPTEMPERATURE_H
#define AliceO2_TPC_QC_DCSPTEMPERATURE_H

#include <vector>

// o2 includes
#include "DataFormatsTPC/DCS.h"

class TCanvas;

namespace o2::tpc::qc
{

/// @brief This class helps visualizing the data from the temperature sensors inside the TPC
///
/// origin: TPC
/// @author Thomas Klemenz, thomas.klemenz@tum.de
class DCSPTemperature
{
public:
/// default constructor
DCSPTemperature() = default;

/// destructor
~DCSPTemperature();

/// initializes the TCanvases that will later be shown on the QCG
void initializeCanvases();

/// fill graphs with temperature data and populate the canvases
void processData(const std::vector<std::unique_ptr<o2::tpc::dcs::Temperature>>& data);

/// returns the canvases showing the temperature data
std::vector<TCanvas*>& getCanvases() { return mCanVec; };

private:
std::vector<TCanvas*> mCanVec{}; // holds the canvases which are to be published in the QCG
tklemenz marked this conversation as resolved.
Outdated
Show resolved Hide resolved

ClassDefNV(DCSPTemperature, 1)
};
} // namespace o2::tpc::qc

#endif
178 changes: 178 additions & 0 deletions 178 Detectors/TPC/qc/src/DCSPTemperature.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

// root includes
#include "TStyle.h"
#include "TCanvas.h"
#include "TGraph.h"
#include "TAxis.h"
#include "TMultiGraph.h"
#include "TLegend.h"

// o2 includes
#include "TPCQC/DCSPTemperature.h"
#include "DataFormatsTPC/DCS.h"

#include <fmt/format.h>

ClassImp(o2::tpc::qc::DCSPTemperature);

using namespace o2::tpc::qc;

DCSPTemperature::~DCSPTemperature()
{
while (mCanVec.size()) {
delete mCanVec.back();
mCanVec.pop_back();
}
}

void DCSPTemperature::initializeCanvases()
{
gStyle->SetPalette(kRainBow);
gStyle->SetTitleSize(0.05, "XY");
gStyle->SetTitleOffset(1.05, "XY");

auto cStats = new TCanvas("c_temperature_stats", "c_temperature_stats", 1000, 1000);
auto cSensorsMultiGraph = new TCanvas("c_temperature_sensors", "c_temperature_sensors", 1000, 1000);

mCanVec.emplace_back(cStats);
mCanVec.emplace_back(cSensorsMultiGraph);

gStyle->SetTimeOffset(0);
}

void DCSPTemperature::processData(const std::vector<std::unique_ptr<o2::tpc::dcs::Temperature>>& data)
{
int nPointA = 0;
int nPointC = 0;
int sensorCounter = 0;

auto grM = new TMultiGraph;
std::vector<TGraph*> grVec; // one graph per sensor
auto grStatsAMean = new TGraph;
auto grStatsAGradX = new TGraph;
auto grStatsAGradY = new TGraph;
auto grStatsCMean = new TGraph;
auto grStatsCGradX = new TGraph;
auto grStatsCGradY = new TGraph;

std::vector<int> pointCountersSensors;

for (int i = 0; i < 18; i++) {
pointCountersSensors.emplace_back(0);
grVec.emplace_back(new TGraph);
grVec.back()->SetNameTitle(fmt::format("tempSensor{}", i + 1).data(), fmt::format("Temperature Sensor {};;T (K)", i + 1).data());
grVec.back()->GetXaxis()->SetTimeDisplay(1);
grVec.back()->GetXaxis()->SetTimeFormat("#splitline{%d.%m.%y}{%H:%M:%S}");
grVec.back()->SetMarkerStyle(20);
}

for (const auto& t : data) {
tklemenz marked this conversation as resolved.
Outdated
Show resolved Hide resolved
sensorCounter = 0;
for (const auto sensor : t->raw) {
for (const auto& value : sensor.data) {
grVec.at(sensorCounter)->SetPoint(pointCountersSensors.at(sensorCounter), double(value.time) / 1000., value.value);
pointCountersSensors.at(sensorCounter)++;
}
sensorCounter++;
}
for (const auto& value : t->statsA.data) {
grStatsAMean->SetPoint(nPointA, double(value.time) / 1000., value.value.mean);
grStatsAGradX->SetPoint(nPointA, double(value.time) / 1000., value.value.gradX);
grStatsAGradY->SetPoint(nPointA, double(value.time) / 1000., value.value.gradY);
nPointA++;
}
for (const auto& value : t->statsC.data) {
grStatsCMean->SetPoint(nPointC, double(value.time) / 1000., value.value.mean);
grStatsCGradX->SetPoint(nPointC, double(value.time) / 1000., value.value.gradX);
grStatsCGradY->SetPoint(nPointC, double(value.time) / 1000., value.value.gradY);
nPointC++;
}
}

for (auto& gr : grVec) {
gr->Sort();
grM->Add(gr);
tklemenz marked this conversation as resolved.
Outdated
Show resolved Hide resolved
}

mCanVec.at(0)->Divide(2, 3);

grStatsAMean->SetTitle("Temperature mean (A-side);;T (K)");
grStatsAMean->SetMarkerStyle(20);
grStatsAMean->GetXaxis()->SetTimeDisplay(1);
grStatsAMean->GetXaxis()->SetTimeFormat("#splitline{%d.%m.%y}{%H:%M:%S}");
mCanVec.at(0)->cd(1);
grStatsAMean->Sort();
grStatsAMean->Draw("apl");
tklemenz marked this conversation as resolved.
Outdated
Show resolved Hide resolved

grStatsCMean->SetTitle("Temperature mean (C-side);;T (K)");
grStatsCMean->SetMarkerStyle(20);
grStatsCMean->GetXaxis()->SetTimeDisplay(1);
grStatsCMean->GetXaxis()->SetTimeFormat("#splitline{%d.%m.%y}{%H:%M:%S}");
mCanVec.at(0)->cd(2);
grStatsCMean->Sort();
grStatsCMean->Draw("apl");

grStatsAGradX->SetTitle("Temperature gradient X (A-side);;gradient (K/cm)");
grStatsAGradX->SetMarkerStyle(20);
grStatsAGradX->GetXaxis()->SetTimeDisplay(1);
grStatsAGradX->GetXaxis()->SetTimeFormat("#splitline{%d.%m.%y}{%H:%M:%S}");
mCanVec.at(0)->cd(3);
grStatsAGradX->Sort();
grStatsAGradX->Draw("apl");

grStatsCGradX->SetTitle("Temperature gradient X (C-side);;gradient (K/cm)");
grStatsCGradX->SetMarkerStyle(20);
grStatsCGradX->GetXaxis()->SetTimeDisplay(1);
grStatsCGradX->GetXaxis()->SetTimeFormat("#splitline{%d.%m.%y}{%H:%M:%S}");
mCanVec.at(0)->cd(4);
grStatsCGradX->Sort();
grStatsCGradX->Draw("apl");

grStatsAGradY->SetTitle("Temperature gradient Y (A-side);;gradient (K/cm)");
grStatsAGradY->SetMarkerStyle(20);
grStatsAGradY->GetXaxis()->SetTimeDisplay(1);
grStatsAGradY->GetXaxis()->SetTimeFormat("#splitline{%d.%m.%y}{%H:%M:%S}");
mCanVec.at(0)->cd(5);
grStatsAGradY->Sort();
grStatsAGradY->Draw("apl");

grStatsCGradY->SetTitle("Temperature gradient Y (C-side);;gradient (K/cm)");
grStatsCGradY->SetMarkerStyle(20);
grStatsCGradY->GetXaxis()->SetTimeDisplay(1);
grStatsCGradY->GetXaxis()->SetTimeFormat("#splitline{%d.%m.%y}{%H:%M:%S}");
mCanVec.at(0)->cd(6);
grStatsCGradY->Sort();
grStatsCGradY->Draw("apl");

TLegend* legend = new TLegend(0.85, 0.6, 0.9, 0.9);
for (int i = 0; i < grVec.size(); i++) {
legend->AddEntry(grVec.at(i), grVec.at(i)->GetName(), "p");
}

mCanVec.at(1)->cd();
grM->GetXaxis()->SetTimeDisplay(1);
grM->GetXaxis()->SetTimeFormat("#splitline{%d.%m.%y}{%H:%M:%S}");
grM->SetTitle("Raw temperature values;;T (K)");
grM->Draw("A pmc plc");
legend->Draw("same");
mCanVec.at(1)->Update();

/// associate the graphs with the canvases
grM->SetBit(TObject::kCanDelete);
grStatsAMean->SetBit(TObject::kCanDelete);
grStatsAGradX->SetBit(TObject::kCanDelete);
grStatsAGradY->SetBit(TObject::kCanDelete);
grStatsCMean->SetBit(TObject::kCanDelete);
grStatsCGradX->SetBit(TObject::kCanDelete);
grStatsCGradY->SetBit(TObject::kCanDelete);
}
1 change: 1 addition & 0 deletions 1 Detectors/TPC/qc/src/TPCQCLinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#pragma link C++ class o2::tpc::qc::Clusters+;
#pragma link C++ class o2::tpc::qc::Tracks+;
#pragma link C++ class o2::tpc::qc::CalPadWrapper+;
#pragma link C++ class o2::tpc::qc::DCSPTemperature+;
#pragma link C++ function o2::tpc::qc::helpers::makeLogBinning+;
#pragma link C++ function o2::tpc::qc::helpers::setStyleHistogram1D+;
#pragma link C++ function o2::tpc::qc::helpers::setStyleHistogram2D+;
Expand Down
23 changes: 23 additions & 0 deletions 23 Detectors/TPC/qc/test/test_DCSPTemperature.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#define BOOST_TEST_MODULE Test TPC QC
#define BOOST_TEST_MAIN
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
#include "DataFormatsTPC/Defs.h"
#include "TPCQC/DCSPTemperature.h"
#include <cmath>

BOOST_AUTO_TEST_CASE(ReadWriteROOTFile)
{
o2::tpc::qc::DCSPTemperature temp;
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.