ATLAS Offline Software
Loading...
Searching...
No Matches
BunchGroupUtil Class Reference

Utility class to to decode data from FILLPARAMS COOL folder. More...

#include <BunchGroupUtil.h>

Collaboration diagram for BunchGroupUtil:

Public Member Functions

 BunchGroupUtil ()
unsigned int nBunchGroup () const
const std::vector< unsigned int > & bunchGroup () const
void clear ()
bool setValue (const coral::AttributeList &attrList)
bool setValue (const cool::Record &rec)

Public Attributes

std::string error

Private Attributes

std::vector< unsigned int > m_bunchGroup

Detailed Description

Utility class to to decode data from FILLPARAMS COOL folder.

Can be used with FillParamsTool or python FillParamsData

Author
E.Torrence

Definition at line 21 of file BunchGroupUtil.h.

Constructor & Destructor Documentation

◆ BunchGroupUtil()

BunchGroupUtil::BunchGroupUtil ( )

Definition at line 14 of file BunchGroupUtil.cxx.

14 {
15 // Clear vectors
16 this->clear();
17 error.clear();
18}
std::string error

Member Function Documentation

◆ bunchGroup()

const std::vector< unsigned int > & BunchGroupUtil::bunchGroup ( ) const

Definition at line 33 of file BunchGroupUtil.cxx.

33 {
34 return m_bunchGroup;
35}
std::vector< unsigned int > m_bunchGroup

◆ clear()

void BunchGroupUtil::clear ( )

Definition at line 21 of file BunchGroupUtil.cxx.

21 {
22 m_bunchGroup.clear();
23}

◆ nBunchGroup()

unsigned int BunchGroupUtil::nBunchGroup ( ) const

Definition at line 28 of file BunchGroupUtil.cxx.

28 {
29 return m_bunchGroup.size();
30}

◆ setValue() [1/2]

bool BunchGroupUtil::setValue ( const cool::Record & rec)

Definition at line 39 of file BunchGroupUtil.cxx.

39 {
40 return setValue(rec.attributeList());
41}
bool setValue(const coral::AttributeList &attrList)

◆ setValue() [2/2]

bool BunchGroupUtil::setValue ( const coral::AttributeList & attrList)

Definition at line 46 of file BunchGroupUtil.cxx.

46 {
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}

Member Data Documentation

◆ error

std::string BunchGroupUtil::error

Definition at line 53 of file BunchGroupUtil.h.

◆ m_bunchGroup

std::vector<unsigned int> BunchGroupUtil::m_bunchGroup
private

Definition at line 62 of file BunchGroupUtil.h.


The documentation for this class was generated from the following files: