ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Database
CoolLumiUtilities
src
BunchGroupUtil.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/BunchGroupUtil.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
14
BunchGroupUtil::BunchGroupUtil
() {
15
// Clear vectors
16
this->
clear
();
17
error
.clear();
18
}
19
20
void
21
BunchGroupUtil::clear
() {
22
m_bunchGroup
.clear();
23
}
24
25
26
// Access functions
27
unsigned
int
28
BunchGroupUtil::nBunchGroup
()
const
{
29
return
m_bunchGroup
.size();
30
}
31
32
const
std::vector<unsigned int> &
33
BunchGroupUtil::bunchGroup
()
const
{
34
return
m_bunchGroup
;
35
}
36
37
// Fill value from cool::Record (ie. python)
38
bool
39
BunchGroupUtil::setValue
(
const
cool::Record& rec) {
40
return
setValue
(rec.attributeList());
41
}
42
43
// Fill value from AttributeList
44
// Returns false on error
45
bool
46
BunchGroupUtil::setValue
(
const
coral::AttributeList& attrList) {
47
48
// First, clear old values
49
this->
clear
();
50
error
.clear();
51
52
// Check if there is any data
53
if
(attrList[
"BunchCode"
].isNull()) {
54
error
=
"BunchCode is NULL!"
;
55
return
false
;
56
}
57
58
const
coral::Blob &blobBC = attrList[
"BunchCode"
].data<coral::Blob>();
59
// std::cout << "size of blob: " << blobBC.size() << std::endl;
60
61
// Verify length
62
/* if ( static_cast<cool::UInt32>( blobBC.size() ) != 2 * (nb1 + nb2 + ncol)) {
63
std::stringstream ss;
64
ss << "BCIDmasks length " << blobBC.size() << " != 2 * " << (nb1+nb2+ncol) << "!";
65
error = ss.str();
66
return false;
67
}
68
*/
69
// for (int i =0; i < ( blobBC.size() ); i++) {
70
// std::cout << blobBC.startingAddress();
71
// }
72
73
74
75
// Pointer to blob to allow unpacking from binary
76
const
uint8_t *p=
static_cast<
const
uint8_t*
>
(blobBC.startingAddress());
77
unsigned
int
c1 = 0;
78
unsigned
int
c3 =0;
79
unsigned
int
c5 = 0;
80
unsigned
int
c9 = 0;
81
unsigned
int
c17 = 0;
82
unsigned
int
c33 = 0;
83
unsigned
int
c65 = 0;
84
unsigned
int
c131 = 0;
85
unsigned
int
other = 0;
86
// Decode beam1 list
87
unsigned
int
tmp = *p;
88
std::cout <<
"HER"
<< tmp << std::endl;
89
for
(
unsigned
int
i = 0; i < blobBC.size(); i++, p++) {
90
tmp = *p;
91
// unsigned int tmp = *p;
92
// std::cout << "The Data of BunchGroupContent is " << tmp << std::endl ;
93
std::cout <<
"BGC "
<< tmp << std::endl;
94
if
(tmp==131) {
95
c131++;
96
// std::cout << " 131 " << i << std::endl;
97
}
98
else
if
(tmp==65) {
99
c65++;
100
// std::cout <<" 65 " << i << std::endl;
101
}
102
else
if
(tmp==33) {
103
c33++;
104
// std::cout << "33 " << i << std::endl;
105
}
106
else
if
(tmp==17) {
107
c17++;
108
// std::cout << "17 " << i << std::endl;
109
}
110
else
if
(tmp==9) {
111
c9++;
112
// std::cout << "9 " << i << std::endl;
113
}
114
else
if
(tmp==5) {
115
c5++;
116
// std::cout << "5 " << i << std::endl;
117
}
118
else
if
(tmp==3) {
119
// std::cout << "3 " << i << std::endl;
120
c3++;
121
}
122
else
if
(tmp==1) {
123
c1++;
124
// std::cout << "1 " << i << std::endl;
125
}
126
else
{
127
other++;
128
}
129
m_bunchGroup
.push_back(*p);
130
}
131
std::cout <<
"COME ON 1368 "
<< c131+c3 << std::endl;
132
std::cout <<
"C131 i.e. group 8 "
<< c131 << std::endl;
133
std::cout <<
"C65 i.e. group 7 "
<< c65 << std::endl;
134
std::cout <<
"C33 i.e. group 6 "
<< c33 << std::endl;
135
std::cout <<
"C17 i.e. group 5 "
<< c17 << std::endl;
136
std::cout <<
"C9 i.e. group 4 "
<< c9 << std::endl;
137
std::cout <<
"C5 i.e. group 3 "
<< c5 << std::endl;
138
std::cout <<
"C3 i.e. group 2 "
<< c3 << std::endl;
139
std::cout <<
"C1 i.e. group 1 "
<< c1 << std::endl;
140
std::cout <<
"Other i.e. group 0 "
<< other << std::endl;
141
// Success!
142
return
true
;
143
}
144
145
BunchGroupUtil.h
BunchGroupUtil::nBunchGroup
unsigned int nBunchGroup() const
Definition
BunchGroupUtil.cxx:28
BunchGroupUtil::setValue
bool setValue(const coral::AttributeList &attrList)
Definition
BunchGroupUtil.cxx:46
BunchGroupUtil::bunchGroup
const std::vector< unsigned int > & bunchGroup() const
Definition
BunchGroupUtil.cxx:33
BunchGroupUtil::m_bunchGroup
std::vector< unsigned int > m_bunchGroup
Definition
BunchGroupUtil.h:62
BunchGroupUtil::BunchGroupUtil
BunchGroupUtil()
Definition
BunchGroupUtil.cxx:14
BunchGroupUtil::clear
void clear()
Definition
BunchGroupUtil.cxx:21
error
Definition
IImpactPoint3dEstimator.h:72
Generated on
for ATLAS Offline Software by
1.17.0