Belle II Software  release-05-02-19
SectorMapBootstrapModule.h
1 /********************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Eugenio Paoloni, Thomas Lueck *
7  * *
8  * This software is provided "as is" without any warranty. *
9  *******************************************************************************/
10 
11 #pragma once
12 
13 //framework:
14 #include <framework/core/Module.h>
15 #include <framework/database/PayloadFile.h>
16 
17 #include <vector>
18 #include <string>
19 #include <tuple>
20 
21 namespace Belle2 {
27  struct SectorMapConfig;
28 
33  class SectorMapBootstrapModule : public Module {
34 
35  public:
36 
39 
42  {
43  if (m_ptrDBObjPtr != nullptr) delete m_ptrDBObjPtr;
44  };
45 
46  void initialize() override ;
47  void beginRun() override ;
48  void event() override ;
49  void endRun() override ;
50 
51  private:
52 
54  void bootstrapSectorMap(void);
57  void bootstrapSectorMap(const SectorMapConfig& config);
59  void persistSectorMap(void);
61  void retrieveSectorMap(void);
62 
64  const std::string c_setupKeyNameTTreeName = "Setups";
66  const std::string c_setupKeyNameBranchName = "name";
67 
69  std::string m_sectorMapsInputFile = "SectorMaps.root";
71  std::string m_sectorMapsOutputFile = "SectorMaps.root";
72 
74  std::string m_setupToRead = std::string("");
75 
78 
79 
83  std::vector< std::tuple<int, std::string> > m_twoHitFilterAdjustFunctions = {};
84 
88  std::vector< std::tuple<int, std::string> > m_threeHitFilterAdjustFunctions = {};
89 
91  bool m_readSecMapFromDB = false;
92 
94  bool m_readSectorMap = true;
96  bool m_writeSectorMap = false;
97  };
99 } // Belle2 namespace
Belle2::SectorMapBootstrapModule::SectorMapBootstrapModule
SectorMapBootstrapModule()
Constructor.
Definition: SectorMapBootstrapModule.cc:39
Belle2::DBObjPtr< PayloadFile >
Specialization of DBObjPtr in case of PayloadFiles.
Definition: PayloadFile.h:64
Belle2::SectorMapBootstrapModule::~SectorMapBootstrapModule
~SectorMapBootstrapModule()
Destructor.
Definition: SectorMapBootstrapModule.h:49
Belle2::SectorMapBootstrapModule::m_threeHitFilterAdjustFunctions
std::vector< std::tuple< int, std::string > > m_threeHitFilterAdjustFunctions
vector of tuple<int, string> specifying how 3-hit filters are altered.
Definition: SectorMapBootstrapModule.h:96
Belle2::SectorMapBootstrapModule::m_sectorMapsInputFile
std::string m_sectorMapsInputFile
the name of the input root file the sectormaps are read from
Definition: SectorMapBootstrapModule.h:77
Belle2::SectorMapBootstrapModule::m_writeSectorMap
bool m_writeSectorMap
if true the sectormap will be written to an output file
Definition: SectorMapBootstrapModule.h:104
Belle2::SectorMapBootstrapModule::initialize
void initialize() override
Initialize the Module.
Definition: SectorMapBootstrapModule.cc:101
Belle2::SectorMapBootstrapModule::event
void event() override
This method is the core of the module.
Definition: SectorMapBootstrapModule.cc:138
Belle2::SectorMapBootstrapModule::m_sectorMapsOutputFile
std::string m_sectorMapsOutputFile
the name of the ouput root file the sectormaps are written to
Definition: SectorMapBootstrapModule.h:79
Belle2::SectorMapBootstrapModule::m_readSecMapFromDB
bool m_readSecMapFromDB
if true the sector map will be read from the DB. NOTE: this will override m_readSectorMap (read from ...
Definition: SectorMapBootstrapModule.h:99
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::SectorMapBootstrapModule::m_setupToRead
std::string m_setupToRead
if specified (non "") ONLY the setup with this name will be read. Else all setups in the root file wi...
Definition: SectorMapBootstrapModule.h:82
Belle2::SectorMapBootstrapModule::persistSectorMap
void persistSectorMap(void)
writes a sectormap to a root file
Definition: SectorMapBootstrapModule.cc:283
Belle2::SectorMapBootstrapModule::c_setupKeyNameBranchName
const std::string c_setupKeyNameBranchName
the name of the branch the setupt are stored in the tree
Definition: SectorMapBootstrapModule.h:74
Belle2::SectorMapBootstrapModule::retrieveSectorMap
void retrieveSectorMap(void)
retrieves SectorMap from file or from the DB
Definition: SectorMapBootstrapModule.cc:324
Belle2::SectorMapConfig
simple struct containing all the configuration data needed for the SecMapTrainer.
Definition: SectorMapConfig.h:36
Belle2::SectorMapBootstrapModule::bootstrapSectorMap
void bootstrapSectorMap(void)
puts several empty sectormaps into the framework
Definition: SectorMapBootstrapModule.cc:143
Belle2::SectorMapBootstrapModule::m_twoHitFilterAdjustFunctions
std::vector< std::tuple< int, std::string > > m_twoHitFilterAdjustFunctions
vector of tuple<int, string> specifying how 2-hit filters are altered.
Definition: SectorMapBootstrapModule.h:91
Belle2::SectorMapBootstrapModule::beginRun
void beginRun() override
Called when entering a new run.
Definition: SectorMapBootstrapModule.cc:132
Belle2::SectorMapBootstrapModule::m_ptrDBObjPtr
DBObjPtr< PayloadFile > * m_ptrDBObjPtr
pointer to the DBObjPtr for the payloadfile from which the sectormap is read
Definition: SectorMapBootstrapModule.h:85
Belle2::SectorMapBootstrapModule::c_setupKeyNameTTreeName
const std::string c_setupKeyNameTTreeName
the name of the tree the setups are stored in in the root file
Definition: SectorMapBootstrapModule.h:72
Belle2::SectorMapBootstrapModule::endRun
void endRun() override
This method is called if the current run ends.
Definition: SectorMapBootstrapModule.cc:208
Belle2::SectorMapBootstrapModule::m_readSectorMap
bool m_readSectorMap
if true a sectormap will be read from a file. NOTE: this will be overridden by m_readSecMapFromDB!
Definition: SectorMapBootstrapModule.h:102