forked from UCATLAS/xAODAnaHelpers
/
OnlineBeamSpotTool.h
72 lines (53 loc) · 1.49 KB
/
OnlineBeamSpotTool.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef xAODAnaHelpers_OnlineBeamSpotTool_H
#define xAODAnaHelpers_OnlineBeamSpotTool_H
#include "xAODEventInfo/EventInfo.h"
#include "xAODAnaHelpers/EventInfo.h"
#include <vector>
#include <map>
namespace xAH {
class OnlineBeamSpotTool
{
public:
enum BSData{
BSx,
BSy,
BSz
};
private:
struct LBData {
int m_LBStart;
int m_LBEnd;
float m_BSx;
float m_BSy;
float m_BSz;
LBData(int LBStart, int LBEnd, float BSx, float BSy, float BSz){
m_LBStart = LBStart;
m_LBEnd = LBEnd;
m_BSx = BSx;
m_BSy = BSy;
m_BSz = BSz;
}
};
typedef std::vector<LBData> RunInfo;
typedef std::map<int, RunInfo> RunToLBDataMap;
typedef std::map<int, RunInfo>::iterator RunToLBDataMapItr;
public:
OnlineBeamSpotTool();
~OnlineBeamSpotTool();
float getOnlineBSInfo(const xAOD::EventInfo* eventInfo, BSData datakey);
float getOnlineBSInfo(const xAH::EventInfo* eventInfo, BSData datakey);
float getOnlineBSInfo(int runNumber, int lumiBlock, bool isMC, BSData datakey);
private:
const LBData* getLBData(int runNumber, int lumiBlock, bool isMC);
const LBData* getLBData(int lumiBlock);
void setRunInfo(int runNumber);
void readFile(std::string rootFileName);
RunToLBDataMap m_runList;
int m_cachedRunNum;
int m_cachedLB;
RunInfo* m_cachedRunInfo;
LBData* m_cachedLBData;
LBData* m_mcLBData;
};
}//xAH
#endif // xAODAnaHelpers_OnlineBeamSpotTool_H