Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class FT0ChannelTimeTimeSlotContainer final
{

//ranges to be discussed
static constexpr int HISTOGRAM_RANGE = 200;
static constexpr int HISTOGRAM_RANGE = 2000;
static constexpr unsigned int NUMBER_OF_HISTOGRAM_BINS = 2 * HISTOGRAM_RANGE;

using BoostHistogramType = boost::histogram::histogram<std::tuple<boost::histogram::axis::integer<>,
Expand All @@ -43,6 +43,7 @@ class FT0ChannelTimeTimeSlotContainer final
[[nodiscard]] int16_t getMeanGaussianFitValue(std::size_t channelID) const;
void merge(FT0ChannelTimeTimeSlotContainer* prev);
void print() const;
static int sGausFitBins;

private:
std::size_t mMinEntries;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

using namespace o2::ft0;

int FT0ChannelTimeTimeSlotContainer::sGausFitBins = 999; // NOT USED

FT0ChannelTimeTimeSlotContainer::FT0ChannelTimeTimeSlotContainer(std::size_t minEntries)
: mMinEntries(minEntries)
{
Expand Down Expand Up @@ -65,21 +67,38 @@ int16_t FT0ChannelTimeTimeSlotContainer::getMeanGaussianFitValue(std::size_t cha
return 0;
}
LOG(DEBUG) << " for channel " << int(channelID) << " entries " << mEntriesPerChannel[channelID];

std::vector<double> channelHistogramData(NUMBER_OF_HISTOGRAM_BINS);

std::vector<double> outputGaussianFitValues;
double binWidth = (HISTOGRAM_RANGE - (-HISTOGRAM_RANGE)) / NUMBER_OF_HISTOGRAM_BINS;
double minGausFitRange = 0;
double maxGausFitRange = 0;
double MaxValOfHistogram = 0.0;

for (int iBin = 0; iBin < NUMBER_OF_HISTOGRAM_BINS; ++iBin) {
channelHistogramData[iBin] = mHistogram.at(iBin, channelID);
}

int maxElementIndex = std::max_element(channelHistogramData.begin(), channelHistogramData.end()) - channelHistogramData.begin();
int maxElement = *std::max_element(channelHistogramData.begin(), channelHistogramData.end());

// calculating the min & max range values to fit gaussian
minGausFitRange = (-HISTOGRAM_RANGE + (maxElementIndex - sGausFitBins) * binWidth + binWidth / 2.0);
maxGausFitRange = (-HISTOGRAM_RANGE + (maxElementIndex + sGausFitBins) * binWidth + binWidth / 2.0);

double returnCode = math_utils::fitGaus<double>(NUMBER_OF_HISTOGRAM_BINS, channelHistogramData.data(),
-HISTOGRAM_RANGE, HISTOGRAM_RANGE, outputGaussianFitValues);
minGausFitRange, maxGausFitRange, outputGaussianFitValues);

MaxValOfHistogram = (-HISTOGRAM_RANGE + maxElementIndex * binWidth + binWidth / 2.0);
if (returnCode < 0) {
LOG(ERROR) << "Gaussian fit error!";
return 0;
return static_cast<int16_t>(std::round(MaxValOfHistogram));
}

return static_cast<int16_t>(std::round(outputGaussianFitValues[MEAN_VALUE_INDEX_IN_OUTPUT_VECTOR]));
}

void FT0ChannelTimeTimeSlotContainer::print() const
{
//QC will do that part
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@
// or submit itself to any jurisdiction.

#include "FT0ChannelTimeCalibrationSpec.h"
#include "FT0Calibration/FT0ChannelTimeTimeSlotContainer.h"

using namespace o2::framework;

void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
{
//probably some option will be added
std::vector<o2::framework::ConfigParamSpec> options;
options.push_back(ConfigParamSpec{"time-calib-fitting-nbins", VariantType::Int, 2, {""}});
std::swap(workflowOptions, options);
}

#include "Framework/runDataProcessing.h"
Expand All @@ -22,6 +28,7 @@ using namespace o2::framework;
WorkflowSpec defineDataProcessing(ConfigContext const& config)
{
WorkflowSpec workflow;
o2::ft0::FT0ChannelTimeTimeSlotContainer::sGausFitBins = config.options().get<int>("time-calib-fitting-nbins");
workflow.emplace_back(o2::ft0::getFT0ChannelTimeCalibrationSpec());
//add calib spec here...
return workflow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@
// or submit itself to any jurisdiction.

#include "FT0ChannelTimeCalibrationSpec.h"
#include "FT0Calibration/FT0ChannelTimeTimeSlotContainer.h"

using namespace o2::framework;

void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
{
//probably some option will be added
std::vector<o2::framework::ConfigParamSpec> options;
options.push_back(ConfigParamSpec{"time-calib-fitting-nbins", VariantType::Int, 2, {""}});
std::swap(workflowOptions, options);
}

#include "Framework/runDataProcessing.h"
Expand All @@ -22,6 +28,7 @@ using namespace o2::framework;
WorkflowSpec defineDataProcessing(ConfigContext const& config)
{
WorkflowSpec workflow;
o2::ft0::FT0ChannelTimeTimeSlotContainer::sGausFitBins = config.options().get<int>("time-calib-fitting-nbins");
workflow.emplace_back(o2::ft0::getFT0ChannelTimeCalibrationSpec());
return workflow;
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,6 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

WorkflowSpec workflow;
workflow.emplace_back(dataProcessorSpec);

return workflow;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class FV0ChannelTimeTimeSlotContainer final
{

//ranges to be discussed
static constexpr int HISTOGRAM_RANGE = 200;
static constexpr int HISTOGRAM_RANGE = 2000;
static constexpr unsigned int NUMBER_OF_HISTOGRAM_BINS = 2 * HISTOGRAM_RANGE;

using BoostHistogramType = boost::histogram::histogram<std::tuple<boost::histogram::axis::integer<>,
Expand All @@ -44,6 +44,7 @@ class FV0ChannelTimeTimeSlotContainer final
[[nodiscard]] int16_t getMeanGaussianFitValue(std::size_t channelID) const;
void merge(FV0ChannelTimeTimeSlotContainer* prev);
void print() const;
static int sGausFitBins;

private:
std::size_t mMinEntries;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

using namespace o2::fv0;

int FV0ChannelTimeTimeSlotContainer::sGausFitBins = 999; // NOT USED

FV0ChannelTimeTimeSlotContainer::FV0ChannelTimeTimeSlotContainer(std::size_t minEntries)
: mMinEntries(minEntries)
{
Expand Down Expand Up @@ -65,22 +67,41 @@ int16_t FV0ChannelTimeTimeSlotContainer::getMeanGaussianFitValue(std::size_t cha
if (0 == mEntriesPerChannel[channelID]) {
return 0;
}
LOG(DEBUG) << " for channel " << int(channelID) << " entries " << mEntriesPerChannel[channelID];

std::vector<double> channelHistogramData(NUMBER_OF_HISTOGRAM_BINS, 0);

std::vector<double> channelHistogramData(NUMBER_OF_HISTOGRAM_BINS);
std::vector<double> outputGaussianFitValues;
double binWidth = (HISTOGRAM_RANGE - (-HISTOGRAM_RANGE)) / NUMBER_OF_HISTOGRAM_BINS;
double minGausFitRange = 0;
double maxGausFitRange = 0;
double MaxValOfHistogram = 0.0;

for (int iBin = 0; iBin < NUMBER_OF_HISTOGRAM_BINS; ++iBin) {
channelHistogramData[iBin] = mHistogram.at(iBin, channelID);
}

int maxElementIndex = std::max_element(channelHistogramData.begin(), channelHistogramData.end()) - channelHistogramData.begin();
int maxElement = *std::max_element(channelHistogramData.begin(), channelHistogramData.end());

// calculating the min & max range values to fit gaussian
minGausFitRange = (-HISTOGRAM_RANGE + (maxElementIndex - sGausFitBins) * binWidth + binWidth / 2.0);
maxGausFitRange = (-HISTOGRAM_RANGE + (maxElementIndex + sGausFitBins) * binWidth + binWidth / 2.0);

double returnCode = math_utils::fitGaus<double>(NUMBER_OF_HISTOGRAM_BINS, channelHistogramData.data(),
-HISTOGRAM_RANGE, HISTOGRAM_RANGE, outputGaussianFitValues);
minGausFitRange, maxGausFitRange, outputGaussianFitValues);

MaxValOfHistogram = (-HISTOGRAM_RANGE + maxElementIndex * binWidth + binWidth / 2.0);

if (returnCode < 0) {
LOG(ERROR) << "Gaussian fit error!";
return 0;
return static_cast<int16_t>(std::round(MaxValOfHistogram));
//return 0;
}

return static_cast<int16_t>(std::round(outputGaussianFitValues[MEAN_VALUE_INDEX_IN_OUTPUT_VECTOR]));
}

void FV0ChannelTimeTimeSlotContainer::print() const
{
//QC will do that part
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@
// or submit itself to any jurisdiction.

#include "FV0ChannelTimeCalibrationSpec.h"
#include "FV0Calibration/FV0ChannelTimeTimeSlotContainer.h"

using namespace o2::framework;

void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
{

//probably some option will be added
std::vector<o2::framework::ConfigParamSpec> options;
options.push_back(ConfigParamSpec{"time-calib-fitting-nbins", VariantType::Int, 2, {""}});
std::swap(workflowOptions, options);
}

#include "Framework/runDataProcessing.h"
Expand All @@ -22,6 +29,7 @@ using namespace o2::framework;
WorkflowSpec defineDataProcessing(ConfigContext const& config)
{
WorkflowSpec workflow;
o2::fv0::FV0ChannelTimeTimeSlotContainer::sGausFitBins = config.options().get<int>("time-calib-fitting-nbins");
workflow.emplace_back(o2::fv0::getFV0ChannelTimeCalibrationSpec());
return workflow;
}