Files
Jungfraujoch/common/AzimuthalIntegrationProfile.h
2025-09-21 19:27:51 +02:00

48 lines
1.7 KiB
C++

// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#ifndef JUNGFRAUJOCH_AZIMUTHALINTEGRATIONPROFILE_H
#define JUNGFRAUJOCH_AZIMUTHALINTEGRATIONPROFILE_H
#include <vector>
#include <mutex>
#include "MultiLinePlot.h"
#include "AzimuthalIntegration.h"
#include "../acquisition_device/AcquisitionDevice.h"
class AzimuthalIntegrationProfile {
mutable std::mutex m;
std::vector<float> sum;
std::vector<float> sum2;
std::vector<uint64_t> count;
std::vector<float> bin_to_q;
std::vector<float> bin_to_d;
std::vector<float> bin_to_2theta;
std::vector<float> bin_to_phi;
std::vector<float> bin_to_q_1d;
int32_t q_bins;
int32_t azim_bins;
std::string title;
const std::vector<float>& GetXAxis(PlotAzintUnit unit) const;
public:
explicit AzimuthalIntegrationProfile(const AzimuthalIntegration &mapping);
void Clear(const AzimuthalIntegration &mapping);
void SetTitle(const std::string& input);
void Add(const DeviceOutput &result);
void Add(const std::vector<float> &sum, const std::vector<uint32_t> &count);
void Add(int64_t bin, int64_t value);
std::vector<float> GetResult() const;
std::vector<float> GetResult1D() const;
float GetMeanValueOfBins(uint16_t min_bin, uint16_t max_bin) const;
float GetBkgEstimate(const AzimuthalIntegrationSettings& settings) const;
MultiLinePlot GetPlot(bool force_1d = false, PlotAzintUnit plot_unit = PlotAzintUnit::Q_recipA) const;
AzimuthalIntegrationProfile& operator+=(const AzimuthalIntegrationProfile& profile); // Not thread safe
};
#endif //JUNGFRAUJOCH_AZIMUTHALINTEGRATIONPROFILE_H