From eeafd3d875e719cf424b4f5fb675b321f8c9c68a Mon Sep 17 00:00:00 2001 From: Dorothea Pfeiffer Date: Sun, 4 Jun 2023 14:22:10 +0200 Subject: [PATCH] changed axes in rotated histograms --- src/Configuration.cpp | 8 +++++--- src/RootFile.cpp | 17 ++++++----------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/Configuration.cpp b/src/Configuration.cpp index bba35f5..2602e79 100644 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -126,15 +126,17 @@ bool Configuration::PrintUsage(const std::string &errorMessage, char *argv) { std::cout << "-tl: Translate coordinates. Per detector a tuple with three " "values in mm, e.g for two detectors [[t0,t1,t2], [t0,t1,t2]].\n" << std::endl; - std::cout << "-ro: Rotate around plane 0, plane 1, plane 2. Per detector " + std::cout << "-ro: Rotate around axis 0, axis 1, axis 2. Per detector " "a tuple with three angles in degrees, e.g for two detectors " "[[r0,r1,r2], [r0,r1,r2]].\n" << std::endl; std::cout << "-tr: Transform detector coordinates. S=scale, T=translate, " - "R0=rotation plane 0, R1=rotation plane1, R2=rotation plane2.\n" + "R0=rotation axis 0, R1=rotation axis 1, R2=rotation axis 2.\n" << " example (two detectors): -tr [[S,T,R2], [S,T, R2]]. " "First scaling, then translation, then rotation around normal " - "axis to plane0 and plane 1.\n" + "axis to plane0 and plane 1 (axis 2 is normal for a detector " + "with plane 0 and 1,\nthe rotation is always around the origin " + "of the coordinate system).\n" << std::endl; std::cout << "-bc: bunch crossing clock. Optional argument (default 40 MHz).\n" diff --git a/src/RootFile.cpp b/src/RootFile.cpp index 2a140b2..bed9524 100644 --- a/src/RootFile.cpp +++ b/src/RootFile.cpp @@ -185,6 +185,7 @@ RootFile::RootFile(Configuration &config) : m_config(config) { std::string name = ""; int cnt1D = 0; int cnt2D = 0; + m_max0 = -999999999; m_max1 = -999999999; m_min0 = 9999999; @@ -195,11 +196,13 @@ RootFile::RootFile(Configuration &config) : m_config(config) { for (auto const &det : m_config.pDets) { auto dp0 = std::make_pair(det.first, 0); auto dp1 = std::make_pair(det.first, 1); + // 2D detectors if (!m_config.pIsPads[det.first] && m_config.GetDetectorPlane(dp0) == true && m_config.GetDetectorPlane(dp1) == true) { - int n0 = m_config.pChannels[std::make_pair(det.first, 0)]; - int n1 = m_config.pChannels[std::make_pair(det.first, 1)]; + int n0 = m_config.pChannels[dp0]; + int n1 = m_config.pChannels[dp1]; + if (m_config.pTransform.size() != m_config.pDets.size()) { m_min0 = 0; m_min1 = 0; @@ -251,15 +254,7 @@ RootFile::RootFile(Configuration &config) : m_config(config) { m_bins0 = (m_max0 - m_min0) * BINNING_FACTOR; m_bins1 = (m_max1 - m_min1) * BINNING_FACTOR; } - } - } - for (auto const &det : m_config.pDets) { - auto dp0 = std::make_pair(det.first, 0); - auto dp1 = std::make_pair(det.first, 1); - // 2D detectors - if (!m_config.pIsPads[det.first] && - m_config.GetDetectorPlane(dp0) == true && - m_config.GetDetectorPlane(dp1) == true) { + name = std::to_string(det.first) + "_delta_time_planes"; h1 = new TH1D(name.c_str(), name.c_str(), 1000, -500, 500); m_TH1D.push_back(h1);