Belle II Software  release-08-01-10
PIDCalibrationWeightCreatorModule.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 // Own header.
10 #include <analysis/modules/PIDCalibrationWeightCreator/PIDCalibrationWeightCreatorModule.h>
11 
12 // framework aux
13 #include <framework/core/ModuleParam.templateDetails.h>
14 #include <framework/database/DBImportObjPtr.h>
15 #include <framework/logging/Logger.h>
16 
17 using namespace Belle2;
18 
19 //-----------------------------------------------------------------
20 // Register module
21 //-----------------------------------------------------------------
22 
23 REG_MODULE(PIDCalibrationWeightCreator);
24 
25 //-----------------------------------------------------------------
26 // Implementation
27 //-----------------------------------------------------------------
28 
30 
31 {
32  setDescription("Creates the calibration weight matrix");
33  addParam("matrixName", m_matrixName, "Name of the WeightMatrix");
34  addParam("weightMatrix", m_weightMatrix, "6x6 WeightMatrix");
35  addParam("experimentLow", m_experimentLow, "Interval of validity, ex.low");
36  addParam("experimentHigh", m_experimentHigh, "Interval of validity, ex.high");
37  addParam("runLow", m_runLow, "Interval of validity, run low");
38  addParam("runHigh", m_runHigh, "Interval of validity, run high");
39 }
40 
41 
43 {
44  // Check the size of m_weightMatrix. It has to be 6x6.
45  bool isValid = true;
46  if (m_weightMatrix.size() == 6) {
47  for (const auto& vec : m_weightMatrix)
48  if (vec.size() != 6) {
49  isValid = false;
50  break;
51  }
52  } else {
53  isValid = false;
54  }
55 
56  if (!isValid)
57  B2ERROR("The given weight matrix size is invalid! It must be 6 (particle types) x 6 (detectors)!");
58 
60  importer.construct(m_weightMatrix);
62 }
Class for importing a single object to the database.
A class that describes the interval of experiments/runs for which an object in the database is valid.
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
virtual void initialize() override
Initialize the Module.
REG_MODULE(arichBtest)
Register the Module.
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
Abstract base class for different kinds of events.