Skip to content

Commit

Permalink
changed axes in rotated histograms
Browse files Browse the repository at this point in the history
  • Loading branch information
dorotheapfeiffer committed Jun 4, 2023
1 parent efe8e5c commit eeafd3d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
8 changes: 5 additions & 3 deletions src/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
17 changes: 6 additions & 11 deletions src/RootFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit eeafd3d

Please sign in to comment.