 |
Belle II Software
release-05-02-19
|
18 #include <framework/dataobjects/EventMetaData.h>
19 #include <framework/datastore/StoreObjPtr.h>
20 #include <framework/datastore/StoreArray.h>
23 #include <ecl/modules/eclLocalRunCalibration/ECLLocalRunCalibratorModule.h>
24 #include <ecl/dataobjects/ECLTrig.h>
47 m_time(nullptr), m_ampl(nullptr)
63 "Number of standard deviations used to form initial limits.", 5);
66 "select local or central DB.",
true);
68 std::string defaultDBName =
"localdb/database.txt";
71 "to a local DB.", defaultDBName);
74 "If changePrev is set, the upper run in the interval of "
75 "validity for the previous written payload will be changed.",
79 "Low run for validity interval. "
80 "If the low run value is negative, "
82 "is used as a low run.", -1);
85 "High run for validity interval. "
86 "If the high run value is equal to -1, "
87 "the high run of validity interval is not limited.",
91 "Mark run as reference if it is"
92 "needed to do that at start",
96 "Fill time and amplitude histograms"
97 "for a certain cell id.",
false);
100 "Cell id number, used to "
101 "fill amplitude or time histogram.");
104 const std::string defaultHistoFileName =
105 "time_ampl_histo.root";
109 "File name used to save amplitude and time"
110 "histograms for a certain cell id.",
111 defaultHistoFileName);
114 "Fill full tree.",
false);
134 m_histo_time =
new TH1F(
"histo_time",
"", 10000, -1, -1);
135 m_histo_ampl =
new TH1F(
"histo_ampl",
"", 10000, -1, -1);
148 m_tree =
new TTree(
"localrun",
"");
167 B2FATAL(
"eclDigits not valid");
170 for (
const auto& digit : eclDigits) {
173 auto cellid = digit.getCellId();
174 auto index = cellid - 1;
176 if (index < 0 || index >=
signed(
c_ncellids)) {
177 B2FATAL(
"ECLLocalRunCalibratorModule::event(): cell id = "
178 << cellid <<
" out of range!");
181 auto time = digit.getTimeFit();
184 auto ampl = digit.getAmp();
240 int exp = evtPtr->getExperiment();
241 int run = evtPtr->getRun();
280 auto fl = TFile::Open(
"/ghi/fs01/belle2/bdata/group/detector/ECL/local-run-db/data-full/ecl_local_run_fulltree.root",
295 static_cast<uint32_t
>(
310 return time - 2 * (time / 8);
A class that describes the interval of experiments/runs for which an object in the database is valid.
int16_t getTimeShift(const ECLDigit &digit) const
Calculate time shift.
uint32_t decodeTrigTime(uint32_t time) const
Decode time.
void setDescription(const std::string &description)
Sets the description of the module.
TH1F * m_histo_ampl
m_histo_ampl is the name of the histogram, which contains amplitude distribution for a certain cell i...
void beginRun() override
Begin run.
int m_cellid
cell id number.
~ECLLocalRunCalibratorModule()
Destructor.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
float m_tree_time
Time varible used to fill tree.
bool m_fulltree
Write full tree of times and amplitudes per each cellid (before calculating mean values) to file "ecl...
static const std::string c_timePayloadName
Name of the time payload.
int m_lowRun
Low run of the validity interval.
float m_maxAmpl
Maximum allowed amplitude value.
bool m_addref
If m_addref is true, then the current calibration run will be marked as reference run immediately aft...
std::string m_dbName
Tag of central database or path to a local database.
RelationVector< TO > getRelationsTo(const std::string &name="", const std::string &namedRelation="") const
Get the relations that point from this object to another store array.
void writeCalibResultsToDB()
Write calibration results into a database.
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 is the class designed for the control of mean value and the standard deviation a...
std::string m_histoFileName
The path of the .root file with the histograms obtained in the histogram filling mode.
float m_maxTime
Maximum allowed time value.
void add(const int &cellid, const float &value)
Add value to accumulate mean value, standard deviation and number of accepted events.
Abstract base class for different kinds of events.
static const int c_ncellids
Number of cell ids.
Type-safe access to single objects in the data store.
float m_tree_ampl
Amplitude varible used to fill tree.
bool m_isFillHisto
If m_isFillHisto is false, than the mode of local run calibration is enabled.
bool m_isLocal
Enables local database usage.
bool m_changePrev
If m_changePrev is true, the validity intervals of the previous payloads stored into the database wil...
int m_tree_cellid
Cellid varible used to fill tree.
void endRun() override
End run.
ECLLocalRunCalibratorModule()
Constructor.
bool isValid() const
Check wether the array was registered.
Class to store ECL digitized hits (output of ECLDigi) relation to ECLHit filled in ecl/modules/eclDig...
int m_highRun
High run of the validity interval.
void calc()
Calculate accumulated values.
TTree * m_tree
Full tree of times and amplitudes per each cellid before calculating mean values.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
ECLLocalRunCalibUnit * m_ampl
m_ampl contains amplitude mean value and standard deviation accumulators for all cell ids.
int m_devs
Number of standard deviations used to update value limits.
float m_minAmpl
Minimum allowed amplitude value.
TH1F * m_histo_time
m_histo_time is the name of the histogram, which contains time distribution for a certain cell id.
float m_minTime
Minimum allowed time value.
Accessor to arrays stored in the data store.
void enableNegAmpl()
This function will be called only in the case, if negative amplitudes are observed in the current run...
Class to store ECLTrig, still need to be study relation to ECLHit filled in ecl/modules/eclDigitizer/...
void event() override
Event.
static const std::string c_amplPayloadName
Name of the amplitude payload.
ECLLocalRunCalibUnit * m_time
m_time contains time mean value and standard deviation accumulators for all cell ids.
void writeHistoToFile()
Write histograms to file in the case, if the histogram filling mode is enabled.
int m_tree_event
Event varible used to fill tree.