Belle II Software development
Manager.h
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#pragma once
10
11#include <string>
12#include <vector>
13#include <map>
14#include <Geant4/G4Transform3D.hh>
15#include <root/TMatrixD.h>
16#include <genfit/StateOnPlane.h>
17#include <root/TGeoMatrix.h>
18#include <set>
19
20#include <framework/logging/Logger.h>
21
22#include <mdst/dbobjects/BeamSpot.h>
23#include <alignment/dbobjects/VXDAlignment.h>
24#include <klm/dbobjects/bklm/BKLMAlignment.h>
25#include <klm/dbobjects/eklm/EKLMAlignment.h>
26#include <klm/dbobjects/eklm/EKLMSegmentAlignment.h>
27
28#include <cdc/dbobjects/CDCTimeZeros.h>
29#include <cdc/dbobjects/CDCTimeWalks.h>
30#include <cdc/dbobjects/CDCAlignment.h>
31#include <cdc/dbobjects/CDCXtRelations.h>
32
33#include <alignment/GlobalParam.h>
34#include <alignment/GlobalTimeLine.h>
35#include <alignment/Hierarchy.h>
36
37#include <map>
38#include <string>
39#include <vector>
40
41namespace Belle2 {
46 namespace alignment {
47
50
51 public:
52
53
54
56 std::function<bool(const EventMetaData&, const EventMetaData&)> cmpEventMetaData = [](const EventMetaData& lhs,
57 const EventMetaData& rhs) -> bool {
58 if (lhs.getExperiment() < rhs.getExperiment()) return true;
59 if (lhs.getExperiment() > rhs.getExperiment()) return false;
60
61 if (lhs.getRun() < rhs.getRun()) return true;
62 if (lhs.getRun() > rhs.getRun()) return false;
63
64 if (lhs.getEvent() < rhs.getEvent()) return true;
65 return false;
66 };
67
77
78
88
91 void sortUniqueVector(std::vector<EventMetaData>& vec);
92
95
97 void initialize(const std::vector<std::string>& components = {}, const std::vector<EventMetaData>& timeSlices = {});
98
100 void preCollect(const EventMetaData& emd);
101
103 public:
109 Constraints& getConstraints() { return m_constraints; }
110
112 void writeConstraints(std::string txtFilename);
113
114 private:
121
126
127
129 bool m_initialized {false};
130
132 std::unique_ptr<RigidBodyHierarchy> m_alignment {new RigidBodyHierarchy()};
134 std::unique_ptr<LorentShiftHierarchy> m_lorentzShift {new LorentShiftHierarchy()};
136 std::unique_ptr<GlobalParamVector> m_globalVector {new GlobalParamVector()};
138 std::map<long, Constraint> m_constraints {};
139
141 std::vector<EventMetaData> m_dbTimeSlicing {};
142
145 alignment::timeline::TimeTable m_iniTimeTable{};
146 };
147
148 }
150}
Store event, run, and experiment numbers.
int getRun() const
Run Getter.
unsigned int getEvent() const
Event Getter.
int getExperiment() const
Experiment Getter.
Class to hold hierarchy of whole Belle2.
Definition Manager.h:49
std::function< bool(const EventMetaData &, const EventMetaData &)> cmpEventMetaData
Comparison function for EventMetaData.
Definition Manager.h:56
GlobalCalibrationManager & operator=(const GlobalCalibrationManager &)
Singleton class, hidden assignment operator.
Constraints & getConstraints()
Get the constraints collected so far.
Definition Manager.h:109
bool m_initialized
Finished initialization?
Definition Manager.h:129
LorentShiftHierarchy & getLorentzShiftHierarchy() const
Get the Lorentz shift hierarchy.
Definition Manager.h:107
std::unique_ptr< RigidBodyHierarchy > m_alignment
The alignment hierarchy.
Definition Manager.h:132
GlobalCalibrationManager()
Singleton class, hidden constructor.
Definition Manager.h:116
void writeConstraints(std::string txtFilename)
Write-out complete hierarchy to a text file.
Definition Manager.cc:169
void initialize(const std::vector< std::string > &components={}, const std::vector< EventMetaData > &timeSlices={})
Initialize the manager with given configuration (from MillepedeCollector)
Definition Manager.cc:52
std::vector< EventMetaData > m_dbTimeSlicing
Vector of EventMetaData containing the time slicing of the calibration job.
Definition Manager.h:141
std::unique_ptr< LorentShiftHierarchy > m_lorentzShift
Hierarchy for Lorentz shift corrections.
Definition Manager.h:134
void sortUniqueVector(std::vector< EventMetaData > &vec)
Sort vector of EventMetaData and make it unique to process user defined time splittings of the consta...
Definition Manager.cc:190
std::unique_ptr< GlobalParamVector > m_globalVector
The global vector for unified access to DB constants.
Definition Manager.h:136
std::map< long, Constraint > m_constraints
Map of constraints {unique label, labels and coefficients}.
Definition Manager.h:138
int updateTimeDepGlobalLabels(const EventMetaData &event)
Update the current time ID in the GlobalLabel.
Definition Manager.cc:196
static void initGlobalVector(GlobalParamVector &vector)
Initialize a given GlobalParamVector with all DB objects and interfaces.
Definition Manager.cc:33
GlobalCalibrationManager(const GlobalCalibrationManager &)
Singleton class, hidden copy constructor.
RigidBodyHierarchy & getAlignmentHierarchy() const
Get the rigid body alignment hierarchy.
Definition Manager.h:105
void preCollect(const EventMetaData &emd)
Notice manager of a coming event (from MillepedeCollector)
Definition Manager.cc:98
alignment::timeline::TimeTable m_iniTimeTable
The initial time table generated from time intervals in GlobalLabel used to check if payload (labels)...
Definition Manager.h:145
static GlobalCalibrationManager & getInstance()
Get instance of the Manager auto& gcm = GlobalCalibrationManager::getInstance();.
Definition Manager.cc:27
The central user class to manipulate any global constant in any DB object Used to retrieve global par...
1D Hierarchy for Lorentz shift correction
Definition Hierarchy.h:108
6D Hierarchy of rigid bodies
Definition Hierarchy.h:144
STL class.
Abstract base class for different kinds of events.