ATLAS Offline Software
Public Member Functions | Public Attributes | Private Attributes | List of all members
LumiBlobUtil Class Reference

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

#include <LumiBlobUtil.h>

Collaboration diagram for LumiBlobUtil:

Public Member Functions

 LumiBlobUtil ()
 
int xvalue (const cool::Record &rec)
 
int yvalue (const cool::Record &rec)
 
int xvalue (const coral::AttributeList &attrList1) const
 
int yvalue (const coral::AttributeList &attrList1) const
 
void clear ()
 
const std::vector< double > & bunchLumis () const
 
bool unpack (const cool::Float &ARI, const coral::Blob &blobBC, const std::vector< unsigned int > &PV)
 

Public Attributes

std::string error
 

Private Attributes

std::vector< double > m_bunchLumis
 

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 LumiBlobUtil.h.

Constructor & Destructor Documentation

◆ LumiBlobUtil()

LumiBlobUtil::LumiBlobUtil ( )

Definition at line 14 of file LumiBlobUtil.cxx.

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

Member Function Documentation

◆ bunchLumis()

const std::vector< double > & LumiBlobUtil::bunchLumis ( ) const

Definition at line 70 of file LumiBlobUtil.cxx.

70  {
71  return m_bunchLumis;
72 }

◆ clear()

void LumiBlobUtil::clear ( )

Definition at line 21 of file LumiBlobUtil.cxx.

21  {
22  m_bunchLumis.clear();
23 }

◆ unpack()

bool LumiBlobUtil::unpack ( const cool::Float &  ARI,
const coral::Blob &  blobBC,
const std::vector< unsigned int > &  PV 
)

Definition at line 89 of file LumiBlobUtil.cxx.

89  {
90 
91  const uint8_t *k=static_cast<const uint8_t*>(blobBC.startingAddress());
92 
93  if (blobBC.size() == 0) {
94  std::cout << "No Blob" << std::endl;
95  return false;
96  }
97 
98  else {
99  unsigned int tmk = *k; //Used to make sure that the value from the blob is a number
100  unsigned int fact = 0; //Used in calculation of Stored value when x=1 or x=2
101  unsigned int x = 1; //Size of blob values
102  unsigned int y = 1; // Storage modes
103  unsigned int BCID = 0;//Newest BCID number - used for storing the data when y=0 or y=2
104  unsigned int BCIDold = 0; //Last BCID number - used for storing data when y=0 or y=2
105  float BV = 0; //The actual stored value
106  float AB1 = 0; // The avarage value for one LB/timestep
107  double element = 0; // This is allways 0, but makes sure it is a double
108 
109  x=tmk/10;
110  y=tmk-x*10;
111  fact=int(pow(100,x));
112  /*
113  std::cout << "From unpack " << std::endl;
114  std::cout << "value of x: " << x << std::endl;
115  std::cout << "value of y: " << y << std::endl;
116  std::cout << "BlobBC.size() " << blobBC.size() << std::endl;
117  std::cout << "Vector.size " << PV.size() << std::endl;
118  */
119  k++;
120 
122  if (x==1) {
123  if (y==0) {
124  for (unsigned int i =0; i<PV.size(); i++) {
125  // std::cout << i<< std::endl;
126  BCID = PV[i];
127 
128  // std::cout << "BCID " << BCID << std::endl;
129  const uint8_t* y10 = (const uint8_t*) k;
130  for (unsigned int j = BCIDold; j <= BCID; j++, y10++) {
131  if (j==BCID) {
132  tmk = *y10;
133  BV = ARI*tmk/fact;
134  m_bunchLumis.push_back(BV);
135  AB1 += BV;
136  // std::cout << "BV " << BV << std::endl;
137  }
138  else {
139  m_bunchLumis.push_back(element);
140  }
141  }
142  BCIDold=BCID+1;
143  }
144  for (unsigned int i=BCIDold; i<3564; i++) {
145  m_bunchLumis.push_back(element);
146  }
147  AB1 = AB1/PV.size();
148  // std::cout << AB1 << std::endl;
149  } //This ends y=0
150  if (y==1) {
151  const uint8_t* y11 = (const uint8_t*) k;
152  for (unsigned int i = 0; i < ((blobBC.size()-1)/x); i++, y11++) {
153  tmk = *y11;
154  BV = ARI*tmk/fact;
155  m_bunchLumis.push_back(BV);
156  AB1 += BV;
157  }
158  AB1 = AB1/m_bunchLumis.size();
159  // std::cout << AB1 << std::endl;
160  } //This ends y=1
161  if (y==2) {
162  const uint16_t* k1 = reinterpret_cast<const uint16_t*> (k);
163  unsigned int len = *k1;
164  k1++;
165  const uint8_t* y12 = k+2*(len+1);
166  for (unsigned int i = 0; i<len; i++, k1++) {
167  BCID = *k1;
168  for (unsigned int j=BCIDold; j<=(BCID); j++, y12++) {
169  if (j==BCID) {
170  tmk=*y12;
171  BV = ARI*tmk/fact;
172  m_bunchLumis.push_back(BV);
173  AB1 += BV;
174  }
175  else {
176  m_bunchLumis.push_back(element);
177  }
178  }
179  BCIDold=BCID+1;
180  }
181  for (unsigned int i=(BCIDold); i<3564; i++) {
182  m_bunchLumis.push_back(element);
183  }
184  BCIDold=0;
185  if (len > 0) AB1 = AB1/len;
186  } //This ends y=2
187  // std::cout << AB1 << std::endl;
188  } //This ends x=1
189  if (x==2) {
190  if (y==0) {
191  for (unsigned int i =0; i<PV.size(); i++) {
192  BCID = PV[i];
193  const uint16_t* y20 = reinterpret_cast<const uint16_t*> (k);
194  for (unsigned int j = BCIDold; j <= BCID; j++, y20++) {
195  if (j==BCID) {
196  tmk = *y20;
197  BV = ARI*tmk/fact;
198  m_bunchLumis.push_back(BV);
199  AB1 += BV;
200  }
201  else {
202  m_bunchLumis.push_back(element);
203  }
204  }
205  BCIDold=BCID+1;
206  }
207  for (unsigned int i=BCIDold; i<3564; i++) {
208  m_bunchLumis.push_back(element);
209  }
210  AB1 = AB1/PV.size();
211  // std::cout << AB1 << std::endl;
212  }// This ends y=0
213  if (y==1) {
214  const uint16_t* y21 = reinterpret_cast<const uint16_t*> (k);
215  for (unsigned int i = 0; i < ((blobBC.size()-1)/x); i++, y21++) {
216  tmk=*y21;
217  BV = ARI*tmk/fact;
218  m_bunchLumis.push_back(BV);
219  AB1 += BV;
220  }
221  AB1 = AB1/((blobBC.size()-1)/x);
222  // std::cout << AB1 << std::endl;
223  } //This ends y=1
224  if (y==2) {
225  const uint16_t* k2 = reinterpret_cast<const uint16_t*> (k);
226  unsigned int len = *k2;
227  k2++;
228  const uint16_t* y22 = reinterpret_cast<const uint16_t*> (k+2*(len+1));
229  for (unsigned int i = 0; i<len; i++, k2++) {
230  BCID = *k2;
231  for (unsigned int j=BCIDold; j<=(BCID); j++, y22++) {
232  if (j==BCID) {
233  tmk=*y22;
234  BV = ARI*tmk/fact;
235  m_bunchLumis.push_back(BV);
236  AB1 += BV;
237  }
238  else {
239  m_bunchLumis.push_back(element);
240  }
241  }
242  BCIDold=BCID+1;
243  }
244  for (unsigned int i=BCIDold; i<3564; i++) {
245  m_bunchLumis.push_back(element);
246  }
247  if (len > 0) AB1 = AB1/len;
248  } // This ends y=2
249  // std::cout << AB1 << std::endl;
250  } // This ends x=2
251  if (x==4) {
252  if (y==0) {
253  for (unsigned int i =0; i<PV.size(); i++) {
254  BCID = PV[i];
255  union {
256  unsigned int i;
257  float f;
258  } cnv;
259  const unsigned int * y40 = reinterpret_cast<const unsigned int*> (k);
260  for (unsigned int j = BCIDold; j <= BCID; j++, y40++) {
261  if (j==BCID) {
262  cnv.i = *y40;
263  tmk = cnv.f;
264  BV = ARI*tmk/fact;
265  m_bunchLumis.push_back(BV);
266  AB1 += BV;
267  }
268  else {
269  m_bunchLumis.push_back(element);
270  }
271  }
272  BCIDold=BCID+1;
273  }
274  for (unsigned int i=BCIDold; i<3564; i++) {
275  m_bunchLumis.push_back(element);
276  }
277  AB1 = AB1/PV.size();
278  // std::cout << AB1 << std::endl;
279  } //This ends y=0
280  if (y==1) {
281  union {
282  unsigned int i;
283  float f;
284  } cnv;
285  const unsigned int * y41 = reinterpret_cast<const unsigned int*> (k);
286  for (unsigned int i = 0; i < ((blobBC.size()-1)/x); i++, y41++) {
287  cnv.i = *y41;
288  BV = cnv.f;
289  m_bunchLumis.push_back(BV);
290  AB1 += BV;
291  }
292  AB1 = AB1/((blobBC.size()-1)/x);
293  // std::cout << AB1 << std::endl;
294  } //This ends y=1
295  if (y==2) {
296  const uint16_t* k4 = reinterpret_cast<const uint16_t*> (k);
297  unsigned int len = *k4;
298  k4++;
299  union {
300  unsigned int i;
301  float f;
302  } cnv;
303  const unsigned int* y42 = reinterpret_cast<const unsigned int*> (k+2*(1+len));
304  for (unsigned int i = 0; i<len; i++, k4++) {
305  BCID = *k4;
306 
307  for (unsigned int j=BCIDold; j<=(BCID); j++, y42++) {
308  if (j==BCID) {
309  cnv.i = *y42;
310  BV = cnv.f;
311  m_bunchLumis.push_back(BV);
312  AB1 += BV;
313  }
314  else {
315  m_bunchLumis.push_back(element);
316  }
317  }
318  BCIDold=BCID+1;
319  }
320  for (unsigned int i=(BCIDold); i<3564; i++) {
321  m_bunchLumis.push_back(element);
322  }
323  if (len > 0) AB1 = AB1/len;
324  }//This ends y=2
325  // std::cout << AB1 << std::endl;
326  } //This ends x=4
327 
328  } //This ends else
329  return true;
330 } // This ends setValue

◆ xvalue() [1/2]

int LumiBlobUtil::xvalue ( const cool::Record &  rec)

Definition at line 27 of file LumiBlobUtil.cxx.

27  {
28  return xvalue(rec.attributeList());
29 }

◆ xvalue() [2/2]

int LumiBlobUtil::xvalue ( const coral::AttributeList &  attrList1) const

Definition at line 37 of file LumiBlobUtil.cxx.

37  {
38  const coral::Blob &blobBC = attrList1["BunchRawInstLum"].data<coral::Blob>();
39  const uint8_t *k=static_cast<const uint8_t*>(blobBC.startingAddress());
40  int x = 1;
41  if (blobBC.size() == 0) {
42  std::cout << "No Blob" << std::endl;
43  return -1;
44  }
45  unsigned int tmk = *k;
46  x=tmk/10;
47  return x;
48 }

◆ yvalue() [1/2]

int LumiBlobUtil::yvalue ( const cool::Record &  rec)

Definition at line 32 of file LumiBlobUtil.cxx.

32  {
33  return yvalue(rec.attributeList());
34 }

◆ yvalue() [2/2]

int LumiBlobUtil::yvalue ( const coral::AttributeList &  attrList1) const

Definition at line 51 of file LumiBlobUtil.cxx.

51  {
52 
53  const coral::Blob &blobBC = attrList1["BunchRawInstLum"].data<coral::Blob>();
54 
55  const uint8_t *k=static_cast<const uint8_t*>(blobBC.startingAddress());
56  int y = 1;
57  int x = 1;
58  if (blobBC.size() == 0) {
59  std::cout << "No Blob" << std::endl;
60  return -1;
61  }
62  unsigned int tmk = *k;
63  x=tmk/10;
64  y=tmk-10*x;
65  return y;
66 }

Member Data Documentation

◆ error

std::string LumiBlobUtil::error

Definition at line 44 of file LumiBlobUtil.h.

◆ m_bunchLumis

std::vector<double> LumiBlobUtil::m_bunchLumis
private

Definition at line 47 of file LumiBlobUtil.h.


The documentation for this class was generated from the following files:
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:558
python.subdetectors.tile.Blob
Blob
Definition: tile.py:17
LumiBlobUtil::yvalue
int yvalue(const cool::Record &rec)
Definition: LumiBlobUtil.cxx:32
x
#define x
PixelByteStreamErrors::BCID
@ BCID
Definition: PixelByteStreamErrors.h:13
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
lumiFormat.i
int i
Definition: lumiFormat.py:85
LumiBlobUtil::xvalue
int xvalue(const cool::Record &rec)
Definition: LumiBlobUtil.cxx:27
hist_file_dump.f
f
Definition: hist_file_dump.py:140
LumiBlobUtil::clear
void clear()
Definition: LumiBlobUtil.cxx:21
y
#define y
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
LumiBlobUtil::m_bunchLumis
std::vector< double > m_bunchLumis
Definition: LumiBlobUtil.h:47
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
error
Definition: IImpactPoint3dEstimator.h:70
fitman.k
k
Definition: fitman.py:528