10#include <ecl/modules/eclLocalRunCalibration/ECLLocalRunCalibUnit.h>
11#include <ecl/dbobjects/ECLCrystalLocalRunCalib.h>
12#include <ecl/dbobjects/ECLLocalRunCalibRef.h>
18 const float& min_value,
19 const float& max_value,
20 const int*
const ndevs):
21 m_isNegAmpl(false), m_unitData(ncellids,
67 vec->push_back((obj.*getter)());
72 const std::string& dbName,
76 int exp = iov.getExperimentLow();
77 ECLDBTool refPayload(isLocal, dbName.c_str(),
81 refPayload.
write(&refobj, iov);
87 int exp = iov.getExperimentLow();
88 int run_high = iov.getRunLow() - 1;
91 payload.read(&prevIoV, ev);
95 payload.changeIoV(ev, ciov);
101 const std::string& dbName,
102 const std::string& payloadName,
105 const bool& changePrev,
108 int exp = iov.getExperimentLow();
113 nevents = cellAcc.getNOfEvents();
118 std::vector<int> counts;
120 callAccGetter<int>(&counts,
122 std::vector<float> means;
124 callAccGetter<float>(&means,
126 std::vector<float> stddevs;
128 callAccGetter<float>(&stddevs,
130 data.setNumberOfEvents(nevents);
131 data.setNumbersOfAcceptedEvents(counts);
132 data.setCalibVector(means, stddevs);
133 data.setExpRun(exp, run);
134 ECLDBTool payload(isLocal, dbName.c_str(),
135 payloadName.c_str());
140 payload.write(&data, iov);
ECLCrystalLocalRunCalib is designed to store results of the ECL local run calibration to database.
ECLLocalRunCalibAcc is the class designed to accumulate mean values, standard deviation and number of...
int getCount() const
Get number of accepted events.
float getMean() const
Get mean value.
float getStdDev() const
Get standard deviation.
ECLLocalRunCalibRef is designed to store reference marks to database for ECL local run calibration.
void calc()
Calculate accumulated values.
std::vector< ECLLocalRunCalibAcc > m_unitData
Mean value and standard deviation accumulators for each cell id.
void callAccGetter(std::vector< T > *vec, T(ECLLocalRunCalibAcc::*getter)() const)
Getter of accumulated values.
ECLLocalRunCalibUnit(const int &ncellids, const float &min_value, const float &max_value, const int *const ndevs)
Constructor.
void markAsRefference(const bool &isLocal, const std::string &dbName, const int &run, const IntervalOfValidity &iov)
Mark current run as reference.
void enableNegAmpl()
This function will be called only in the case, if negative amplitudes are observed in the current run...
void changePreviousIoV(const ECLDBTool &payload, const IntervalOfValidity &iov)
Change previous validity interval.
bool m_isNegAmpl
m_isNegAmpl is true if there are negative amplitudes in the current run and false otherwise.
void writeToDB(bool isLocal, const std::string &dbName, const std::string &payloadName, const IntervalOfValidity &iov, const int &run, const bool &changePrev, const bool &addref)
Write calibration results into a database.
~ECLLocalRunCalibUnit()
Destructor.
bool isNegAmpl() const
Check presence of negative amplitudes in the current run.
void add(const int &cellid, const float &value)
Add value to accumulate mean value, standard deviation and number of accepted events.
A class that describes the interval of experiments/runs for which an object in the database is valid.
int getRunLow() const
Getter for lowest run number.
Abstract base class for different kinds of events.