ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Database
CoolLumiUtilities
src
FillParamsUtil.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
CoolLumiUtilities/FillParamsUtil.h
"
6
//#include "CoolKernel/IObject.h"
7
#include "CoralBase/Blob.h"
8
#include "CoralBase/Attribute.h"
9
#include <sstream>
10
#include <iostream>
11
#include <cstdint>
12
13
FillParamsUtil::FillParamsUtil
() {
14
// Clear vectors
15
this->
clear
();
16
error
.clear();
17
}
18
19
void
20
FillParamsUtil::clear
() {
21
m_beam1Bunches
.clear();
22
m_beam2Bunches
.clear();
23
m_luminousBunches
.clear();
24
}
25
26
27
// Access functions
28
unsigned
int
29
FillParamsUtil::nBeam1Bunches
()
const
{
30
return
m_beam1Bunches
.size();
31
}
32
33
unsigned
int
34
FillParamsUtil::nBeam2Bunches
()
const
{
35
return
m_beam2Bunches
.size();
36
}
37
38
unsigned
int
39
FillParamsUtil::nLuminousBunches
()
const
{
40
return
m_luminousBunches
.size();
41
}
42
44
45
const
std::vector<unsigned int> &
46
FillParamsUtil::beam1Bunches
()
const
{
47
return
m_beam1Bunches
;
48
}
49
50
const
std::vector<unsigned int> &
51
FillParamsUtil::beam2Bunches
()
const
{
52
return
m_beam2Bunches
;
53
}
54
55
const
std::vector<unsigned int> &
56
FillParamsUtil::luminousBunches
()
const
{
57
return
m_luminousBunches
;
58
}
59
60
/*
61
const std::vector<unsigned int> &
62
FillParamsUtil::bcidmasks() const{
63
return m_bcidmasks;
64
}
65
*/
66
67
// Fill value from cool::Record (ie. python)
68
bool
69
FillParamsUtil::setValue
(
const
cool::Record& rec) {
70
return
setValue
(rec.attributeList());
71
}
72
73
// Fill value from AttributeList
74
// Returns false on error
75
bool
76
FillParamsUtil::setValue
(
const
coral::AttributeList& attrList) {
77
78
// First, clear old values
79
this->
clear
();
80
error
.clear();
81
82
// Check if there is any data
83
if
(attrList[
"BCIDmasks"
].isNull()) {
84
error
=
"BCIDmasks is NULL!"
;
85
return
false
;
86
}
87
88
// Extract raw data from COOL object
89
cool::UInt32 nb1 = attrList[
"Beam1Bunches"
].data<cool::UInt32>();
90
cool::UInt32 nb2 = attrList[
"Beam2Bunches"
].data<cool::UInt32>();
91
cool::UInt32 ncol = attrList[
"LuminousBunches"
].data<cool::UInt32>();
92
93
const
coral::Blob& blob = attrList[
"BCIDmasks"
].data<coral::Blob>();
94
95
// Verify length
96
if
(
static_cast<
cool::UInt32
>
( blob.size() ) != 2 * (nb1 + nb2 + ncol)) {
97
std::stringstream
ss
;
98
ss
<<
"BCIDmasks length "
<< blob.size() <<
" != 2 * "
<< (nb1+nb2+ncol) <<
"!"
;
99
error
=
ss
.str();
100
return
false
;
101
}
102
// std::cout << " Size of BCIDmask: " << blob.size() << std::endl;
103
104
// Pointer to blob to allow unpacking from binary
105
const
uint16_t* p=
static_cast<
const
uint16_t*
>
(blob.startingAddress());
106
107
// Decode beam1 list
108
for
(
unsigned
int
i = 0; i < nb1; i++, p++) {
109
m_beam1Bunches
.push_back(*p);
110
// std::cout << "nBeam1 is " << *p << std::endl;
111
}
112
113
// Decode beam2 list
114
for
(
unsigned
int
i = 0; i < nb2; i++, p++) {
115
// unsigned int tmp = *p;
116
// std::cout << "#2 is " << tmp << std::endl;
117
m_beam2Bunches
.push_back(*p);
118
}
119
120
121
// Decode luminous list
122
for
(
unsigned
int
i = 0; i < ncol; i++, p++) {
123
//unsigned int tmp = *p;
124
// std::cout << "Luminous bunch is " << tmp << std::endl;
125
m_luminousBunches
.push_back(*p);
126
}
127
128
129
for
(
unsigned
int
i = (nb1+nb2+ncol); i < blob.size(); i++, p++) {
130
//unsigned int tmp = *p;
131
// std::cout << "BCIDmask is " << tmp << std::endl;
132
}
133
// Success!
134
return
true
;
135
}
FillParamsUtil.h
ss
static Double_t ss
Definition
LArPhysWaveHECTool.cxx:37
FillParamsUtil::beam1Bunches
const std::vector< unsigned int > & beam1Bunches() const
Definition
FillParamsUtil.cxx:46
FillParamsUtil::nBeam2Bunches
unsigned int nBeam2Bunches() const
Definition
FillParamsUtil.cxx:34
FillParamsUtil::m_beam1Bunches
std::vector< unsigned int > m_beam1Bunches
Definition
FillParamsUtil.h:49
FillParamsUtil::luminousBunches
const std::vector< unsigned int > & luminousBunches() const
Definition
FillParamsUtil.cxx:56
FillParamsUtil::FillParamsUtil
FillParamsUtil()
Definition
FillParamsUtil.cxx:13
FillParamsUtil::nBeam1Bunches
unsigned int nBeam1Bunches() const
Definition
FillParamsUtil.cxx:29
FillParamsUtil::nLuminousBunches
unsigned int nLuminousBunches() const
Definition
FillParamsUtil.cxx:39
FillParamsUtil::m_beam2Bunches
std::vector< unsigned int > m_beam2Bunches
Definition
FillParamsUtil.h:50
FillParamsUtil::beam2Bunches
const std::vector< unsigned int > & beam2Bunches() const
Definition
FillParamsUtil.cxx:51
FillParamsUtil::m_luminousBunches
std::vector< unsigned int > m_luminousBunches
Definition
FillParamsUtil.h:51
FillParamsUtil::setValue
bool setValue(const coral::AttributeList &attrList)
Definition
FillParamsUtil.cxx:76
FillParamsUtil::clear
void clear()
Definition
FillParamsUtil.cxx:20
error
Definition
IImpactPoint3dEstimator.h:72
Generated on
for ATLAS Offline Software by
1.17.0