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
100 int getContinuousIndexByTimeID(const TimeTable& timeTable, int uid, int timeid);
101
119 std::vector<EventMetaData> setupTimedepGlobalLabels(PyObject* config);
120
140 std::vector<EventMetaData> setupTimedepGlobalLabels(
141 std::vector< std::tuple< std::vector< int >, std::vector< std::tuple< int, int, int > > > >& config);
142
148
149 private:
151 TimeTable timeTable{};
153 PayloadsTable payloadsTable{};
154
155 public:
156
163 GlobalParamTimeLine(const std::vector<EventMetaData>& events, GlobalLabel& label, const GlobalParamVector& vector);
164
169 void loadFromDB();
170
180 void updateGlobalParam(GlobalLabel label, double correction, bool resetParam = false);
181
185 std::vector<std::pair<IntervalOfValidity, TObject*>> releaseObjects();
186
187 };
188
189 } // namespace timeline
190 } // namespace alignment
192} // 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...
GlobalParamTimeLine(const std::vector< EventMetaData > &events, GlobalLabel &label, const GlobalParamVector &vector)
Constructor.
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.
STL class.
Abstract base class for different kinds of events.