Belle II Software development
GlobalTimeLine.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 <alignment/GlobalLabel.h>
12#include <alignment/GlobalParam.h>
13#include <framework/dataobjects/EventMetaData.h>
14
15#include <Python.h>
16
17#include <memory>
18
19namespace Belle2 {
24 namespace alignment {
25 namespace timeline {
26
28 typedef std::pair<int, int> ExpRun;
30 typedef std::vector<EventMetaData> EventHeader;
32 typedef std::vector<ExpRun> RunHeader;
36 typedef std::unordered_map<int, std::vector<int>> TableData;
38 typedef std::tuple<EventHeader, RunHeader, TableData> TimeTable;
39
43 typedef std::vector< std::pair<EventMetaData, std::shared_ptr<GlobalParamSetAccess>>> IntraIoVPayloads;
45 typedef std::vector<std::pair<IntervalOfValidity, IntraIoVPayloads>> PayloadIovBlockRow;
47 typedef std::unordered_map<int, PayloadIovBlockRow> PayloadsTable;
48
57 EventMetaData gotoNextChangeRunWise(TimeTable& timeTable, int uid, int& timeid);
58
67 EventMetaData gotoNextChangeInRun(TimeTable& timeTable, int uid, int& timeid);
68
72 PayloadsTable TimeIdsTable2PayloadsTable(TimeTable& timeTable, const GlobalParamVector& vector);
73
82 TimeTable makeInitialTimeTable(std::vector<EventMetaData> events, GlobalLabel& label);
83
87 void finalizeTimeTable(TimeTable& table);
88
93 std::pair<EventMetaData, std::shared_ptr<GlobalParamSetAccess>> getPayloadByContinuousIndex(PayloadsTable& payloadsTable, int uid,
94 long unsigned int index);;
95
99 int getContinuousIndexByTimeID(const TimeTable& timeTable, int uid, int timeid);
100
118 std::vector<EventMetaData> setupTimedepGlobalLabels(PyObject* config);
119
139 std::vector<EventMetaData> setupTimedepGlobalLabels(
140 std::vector< std::tuple< std::vector< int >, std::vector< std::tuple< int, int, int > > > >& config);
141
147
148 private:
150 TimeTable timeTable{};
152 PayloadsTable payloadsTable{};
153
154 public:
155
162 GlobalParamTimeLine(const std::vector<EventMetaData>& events, GlobalLabel& label, const GlobalParamVector& vector);
163
168 void loadFromDB();
169
179 void updateGlobalParam(GlobalLabel label, double correction, bool resetParam = false);
180
184 std::vector<std::pair<IntervalOfValidity, TObject*>> releaseObjects();
185
186 };
187
188 } // namespace timeline
189 } // namespace alignment
191} // namespace Belle2
Class to convert to/from global labels for Millepede II to/from detector & parameter identificators.
Definition: GlobalLabel.h:41
The central user class to manipulate any global constant in any DB object Used to retrieve global par...
Definition: GlobalParam.h:327
Convenient class to automatically create payloads from allowed time depedence of parameter,...
PayloadsTable payloadsTable
Table with payloads.
std::vector< std::pair< IntervalOfValidity, TObject * > > releaseObjects()
Release all the objects (you become the owner!) for DB storage.
void loadFromDB()
Load every single payload with the content in database at its corresponding event (when it should sta...
void updateGlobalParam(GlobalLabel label, double correction, bool resetParam=false)
Add a correction to any payload's parameter in the timeline.
TimeTable timeTable
The final TimeTable with payload indices.
Abstract base class for different kinds of events.