ATLAS Offline Software
BunchDescription.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
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 
15  // Clear vectors
16  this->clear();
17  error.clear();
18 }
19 
20 void
22  m_bunchD.clear();
23 }
24 
25 
26 // Access functions
27 unsigned int
29  return m_bunchD.size();
30 }
31 
32 const std::vector<unsigned int> &
34  return m_bunchD;
35 }
36 
37 // Fill value from cool::Record (ie. python)
38 bool
39 BunchDescription::setValue(const cool::Record& rec) {
40  return setValue(rec.attributeList());
41 }
42 
43 // Fill value from AttributeList
44 // Returns false on error
45 bool
47 
48  // First, clear old values
49  this->clear();
50  error.clear();
51 
52  // Check if there is any data
53  if (attrList["ItemToBunchGroupMap"].isNull()) {
54  error = "BunchCode is NULL!";
55  return false;
56  }
57 
58  const coral::Blob &blobBC = attrList["ItemToBunchGroupMap"].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 
78  // Decode beam1 list
79  for (unsigned int i = 0; i < blobBC.size(); i++, p++) {
80  //unsigned int tmp = *p;
81  // std::cout << "The Data of BunchGroupContent is " << tmp << std::endl ;
82  // std::cout << "BGC " << tmp << std::endl;
83  m_bunchD.push_back(*p);
84  }
85 
86  /*
87  std::cout << "COME ON 1368 " << c131+c33 << std::endl;
88  std::cout << "C131 " << c131 << std::endl;
89  std::cout << "C65 " << c65 << std::endl;
90  std::cout << "C33 " << c33 << std::endl;
91  std::cout << "C17 " << c17 << std::endl;
92  std::cout << "C9 " << c9 << std::endl;
93  std::cout << "C5 " << c5 << std::endl;
94  std::cout << "C3 " << c3 << std::endl;
95  std::cout << "C1 " << c1 << std::endl;
96  std::cout << "Other " << other << std::endl;
97  // Success! */
98  return true;
99 }
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
BunchDescription::bunchD
const std::vector< unsigned int > & bunchD() const
Definition: BunchDescription.cxx:33
python.subdetectors.tile.Blob
Blob
Definition: tile.py:17
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
BunchDescription::clear
void clear()
Definition: BunchDescription.cxx:21
lumiFormat.i
int i
Definition: lumiFormat.py:92
BunchDescription::setValue
bool setValue(const coral::AttributeList &attrList)
Definition: BunchDescription.cxx:46
BunchDescription.h
BunchDescription::BunchDescription
BunchDescription()
Definition: BunchDescription.cxx:14
error
Definition: IImpactPoint3dEstimator.h:70
BunchDescription::nBunchD1
unsigned int nBunchD1() const
Definition: BunchDescription.cxx:28
BunchDescription::m_bunchD
std::vector< unsigned int > m_bunchD
Definition: BunchDescription.h:63