CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
BeamCurrentInfo Class Reference

#include <BeamCurrentInfo.h>

Public Member Functions

 BeamCurrentInfo ()
 default constructor More...
 
 BeamCurrentInfo (const std::vector< float > &beam1Intensities, const std::vector< float > &beam2Intensities)
 constructor with fill More...
 
void fill (const std::vector< float > &beam1Intensities, const std::vector< float > &beam2Intensities)
 
void fillBeamIntensities (const std::vector< float > &beam1Intensities, const std::vector< float > &beam2Intensities)
 
const std::vector< float > & getBeam1Intensities () const
 
const std::vector< uint16_t > & getBeam1IntensitiesPacked () const
 
float getBeam1IntensityBX (int bx) const
 
const std::vector< float > & getBeam2Intensities () const
 
const std::vector< uint16_t > & getBeam2IntensitiesPacked () const
 
float getBeam2IntensityBX (int bx) const
 
bool isProductEqual (BeamCurrentInfo const &next) const
 
 ~BeamCurrentInfo ()
 destructor More...
 

Static Public Member Functions

static void unpackData (const std::vector< uint16_t > &packed, std::vector< float > &unpacked)
 

Static Public Attributes

static const float scaleFactor = 1e10
 

Private Member Functions

void packData ()
 
void unpackData ()
 

Private Attributes

std::vector< uint16_t > beam1IntensitiesPacked_
 
std::vector< float > beam1IntensitiesUnpacked_
 
std::vector< uint16_t > beam2IntensitiesPacked_
 
std::vector< float > beam2IntensitiesUnpacked_
 

Detailed Description

BeamCurrentInfo has been created by splitting off the beam current information from LumiInfo. See LumiInfo for more details.

Author
Valerie Halyo David Dagenhart Zhen Xie Paul Lujan
Version
October 21, 2014

Definition at line 32 of file BeamCurrentInfo.h.

Constructor & Destructor Documentation

BeamCurrentInfo::BeamCurrentInfo ( )
inline

default constructor

Definition at line 37 of file BeamCurrentInfo.h.

References beam1IntensitiesPacked_, beam1IntensitiesUnpacked_, beam2IntensitiesPacked_, beam2IntensitiesUnpacked_, and LumiConstants::numBX.

37  {
42  }
std::vector< float > beam2IntensitiesUnpacked_
std::vector< float > beam1IntensitiesUnpacked_
static const unsigned int numBX
Definition: LumiConstants.h:9
std::vector< uint16_t > beam1IntensitiesPacked_
std::vector< uint16_t > beam2IntensitiesPacked_
BeamCurrentInfo::BeamCurrentInfo ( const std::vector< float > &  beam1Intensities,
const std::vector< float > &  beam2Intensities 
)
inline

constructor with fill

Definition at line 45 of file BeamCurrentInfo.h.

References beam1IntensitiesUnpacked_, beam2IntensitiesUnpacked_, and packData().

46  {
47  beam1IntensitiesUnpacked_.assign(beam1Intensities.begin(), beam1Intensities.end());
48  beam2IntensitiesUnpacked_.assign(beam2Intensities.begin(), beam2Intensities.end());
49  packData();
50  }
std::vector< float > beam2IntensitiesUnpacked_
std::vector< float > beam1IntensitiesUnpacked_
BeamCurrentInfo::~BeamCurrentInfo ( )
inline

destructor

Definition at line 53 of file BeamCurrentInfo.h.

References getBeam1Intensities(), getBeam1IntensityBX(), getBeam2Intensities(), and getBeam2IntensityBX().

53 {}

Member Function Documentation

void BeamCurrentInfo::fill ( const std::vector< float > &  beam1Intensities,
const std::vector< float > &  beam2Intensities 
)

Definition at line 38 of file BeamCurrentInfo.cc.

References fillBeamIntensities().

Referenced by getBeam2IntensitiesPacked().

39  {
40  fillBeamIntensities(beam1Intensities, beam2Intensities);
41 }
void fillBeamIntensities(const std::vector< float > &beam1Intensities, const std::vector< float > &beam2Intensities)
void BeamCurrentInfo::fillBeamIntensities ( const std::vector< float > &  beam1Intensities,
const std::vector< float > &  beam2Intensities 
)

Definition at line 31 of file BeamCurrentInfo.cc.

References beam1IntensitiesUnpacked_, beam2IntensitiesUnpacked_, and packData().

Referenced by fill(), and getBeam2IntensitiesPacked().

32  {
33  beam1IntensitiesUnpacked_.assign(beam1Intensities.begin(), beam1Intensities.end());
34  beam2IntensitiesUnpacked_.assign(beam2Intensities.begin(), beam2Intensities.end());
35  packData();
36 }
std::vector< float > beam2IntensitiesUnpacked_
std::vector< float > beam1IntensitiesUnpacked_
const std::vector< float > & BeamCurrentInfo::getBeam1Intensities ( ) const

Definition at line 14 of file BeamCurrentInfo.cc.

References beam1IntensitiesUnpacked_.

Referenced by operator<<(), and ~BeamCurrentInfo().

14  {
16 
17 }
std::vector< float > beam1IntensitiesUnpacked_
const std::vector<uint16_t>& BeamCurrentInfo::getBeam1IntensitiesPacked ( ) const
inline

Definition at line 62 of file BeamCurrentInfo.h.

References beam1IntensitiesPacked_.

Referenced by operator<<().

62 { return beam1IntensitiesPacked_; }
std::vector< uint16_t > beam1IntensitiesPacked_
float BeamCurrentInfo::getBeam1IntensityBX ( int  bx) const

Definition at line 10 of file BeamCurrentInfo.cc.

References beam1IntensitiesUnpacked_.

Referenced by ~BeamCurrentInfo().

10  {
11  return beam1IntensitiesUnpacked_.at(bx);
12 }
std::vector< float > beam1IntensitiesUnpacked_
const std::vector< float > & BeamCurrentInfo::getBeam2Intensities ( ) const

Definition at line 22 of file BeamCurrentInfo.cc.

References beam2IntensitiesUnpacked_.

Referenced by operator<<(), and ~BeamCurrentInfo().

22  {
24 }
std::vector< float > beam2IntensitiesUnpacked_
const std::vector<uint16_t>& BeamCurrentInfo::getBeam2IntensitiesPacked ( ) const
inline
float BeamCurrentInfo::getBeam2IntensityBX ( int  bx) const

Definition at line 19 of file BeamCurrentInfo.cc.

References beam2IntensitiesUnpacked_.

Referenced by ~BeamCurrentInfo().

19  {
20  return beam2IntensitiesUnpacked_.at(bx); }
std::vector< float > beam2IntensitiesUnpacked_
bool BeamCurrentInfo::isProductEqual ( BeamCurrentInfo const &  next) const

Definition at line 26 of file BeamCurrentInfo.cc.

References beam1IntensitiesPacked_, and beam2IntensitiesPacked_.

Referenced by getBeam2IntensitiesPacked().

26  {
27  return (beam1IntensitiesPacked_ == next.beam1IntensitiesPacked_ &&
28  beam2IntensitiesPacked_ == next.beam2IntensitiesPacked_);
29 }
std::vector< uint16_t > beam1IntensitiesPacked_
std::vector< uint16_t > beam2IntensitiesPacked_
void BeamCurrentInfo::packData ( )
private

Definition at line 44 of file BeamCurrentInfo.cc.

References beam1IntensitiesPacked_, beam1IntensitiesUnpacked_, beam2IntensitiesPacked_, beam2IntensitiesUnpacked_, MiniFloatConverter::float32to16(), mps_fire::i, scaleFactor, and unpackData().

Referenced by BeamCurrentInfo(), and fillBeamIntensities().

44  {
47 
48  for (unsigned int i=0; i<beam1IntensitiesUnpacked_.size(); i++) {
50  }
51  for (unsigned int i=0; i<beam2IntensitiesUnpacked_.size(); i++) {
53  }
54 
55  // Re-unpack the data so that it matches the packed data.
56  unpackData();
57 }
static const float scaleFactor
std::vector< float > beam2IntensitiesUnpacked_
std::vector< float > beam1IntensitiesUnpacked_
static uint16_t float32to16(float x)
Definition: libminifloat.h:17
std::vector< uint16_t > beam1IntensitiesPacked_
std::vector< uint16_t > beam2IntensitiesPacked_
void BeamCurrentInfo::unpackData ( const std::vector< uint16_t > &  packed,
std::vector< float > &  unpacked 
)
static

Definition at line 60 of file BeamCurrentInfo.cc.

References MiniFloatConverter::float16to32(), mps_fire::i, and scaleFactor.

60  {
61  unpacked.resize(packed.size());
62 
63  for (unsigned int i=0; i<packed.size(); i++) {
64  unpacked[i] = MiniFloatConverter::float16to32(packed[i])*scaleFactor;
65  }
66 }
static const float scaleFactor
static float float16to32(uint16_t h)
Definition: libminifloat.h:12
void BeamCurrentInfo::unpackData ( )
private

Definition at line 68 of file BeamCurrentInfo.cc.

References beam1IntensitiesPacked_, beam1IntensitiesUnpacked_, beam2IntensitiesPacked_, and beam2IntensitiesUnpacked_.

Referenced by getBeam2IntensitiesPacked(), and packData().

68  {
69 
72 }
std::vector< float > beam2IntensitiesUnpacked_
std::vector< float > beam1IntensitiesUnpacked_
std::vector< uint16_t > beam1IntensitiesPacked_
std::vector< uint16_t > beam2IntensitiesPacked_

Member Data Documentation

std::vector<uint16_t> BeamCurrentInfo::beam1IntensitiesPacked_
private
std::vector<float> BeamCurrentInfo::beam1IntensitiesUnpacked_
private
std::vector<uint16_t> BeamCurrentInfo::beam2IntensitiesPacked_
private
std::vector<float> BeamCurrentInfo::beam2IntensitiesUnpacked_
private
const float BeamCurrentInfo::scaleFactor = 1e10
static

Definition at line 34 of file BeamCurrentInfo.h.

Referenced by packData(), and unpackData().