CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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 Attributes

static const float scaleFactor = 1e10
 

Private Member Functions

void packData (void)
 
void unpackData (void) const
 

Private Attributes

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

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_, LumiConstants::numBX, and unpackedReady_.

37  {
42  unpackedReady_ = true;
43  }
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 46 of file BeamCurrentInfo.h.

References beam1IntensitiesUnpacked_, beam2IntensitiesUnpacked_, packData(), and unpackedReady_.

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

destructor

Definition at line 55 of file BeamCurrentInfo.h.

55 {}

Member Function Documentation

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

Definition at line 43 of file BeamCurrentInfo.cc.

References fillBeamIntensities().

44  {
45  fillBeamIntensities(beam1Intensities, beam2Intensities);
46 }
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 35 of file BeamCurrentInfo.cc.

References beam1IntensitiesUnpacked_, beam2IntensitiesUnpacked_, packData(), and unpackedReady_.

Referenced by fill().

36  {
37  beam1IntensitiesUnpacked_.assign(beam1Intensities.begin(), beam1Intensities.end());
38  beam2IntensitiesUnpacked_.assign(beam2Intensities.begin(), beam2Intensities.end());
39  unpackedReady_ = true;
40  packData();
41 }
std::vector< float > beam2IntensitiesUnpacked_
std::vector< float > beam1IntensitiesUnpacked_
void packData(void)
const std::vector< float > & BeamCurrentInfo::getBeam1Intensities ( ) const

Definition at line 15 of file BeamCurrentInfo.cc.

References beam1IntensitiesUnpacked_, and unpackData().

Referenced by operator<<().

15  {
16  unpackData();
18 
19 }
std::vector< float > beam1IntensitiesUnpacked_
void unpackData(void) const
const std::vector<uint16_t>& BeamCurrentInfo::getBeam1IntensitiesPacked ( ) const
inline

Definition at line 64 of file BeamCurrentInfo.h.

References beam1IntensitiesPacked_.

Referenced by operator<<().

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

Definition at line 10 of file BeamCurrentInfo.cc.

References beam1IntensitiesUnpacked_, and unpackData().

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

Definition at line 25 of file BeamCurrentInfo.cc.

References beam2IntensitiesUnpacked_, and unpackData().

Referenced by operator<<().

25  {
26  unpackData();
28 }
std::vector< float > beam2IntensitiesUnpacked_
void unpackData(void) const
const std::vector<uint16_t>& BeamCurrentInfo::getBeam2IntensitiesPacked ( ) const
inline

Definition at line 65 of file BeamCurrentInfo.h.

References beam2IntensitiesPacked_.

65 { return beam2IntensitiesPacked_; }
std::vector< uint16_t > beam2IntensitiesPacked_
float BeamCurrentInfo::getBeam2IntensityBX ( int  bx) const

Definition at line 21 of file BeamCurrentInfo.cc.

References beam2IntensitiesUnpacked_, and unpackData().

21  {
22  unpackData();
23  return beam2IntensitiesUnpacked_.at(bx); }
std::vector< float > beam2IntensitiesUnpacked_
void unpackData(void) const
bool BeamCurrentInfo::isProductEqual ( BeamCurrentInfo const &  next) const

Definition at line 30 of file BeamCurrentInfo.cc.

References beam1IntensitiesPacked_, and beam2IntensitiesPacked_.

30  {
31  return (beam1IntensitiesPacked_ == next.beam1IntensitiesPacked_ &&
32  beam2IntensitiesPacked_ == next.beam2IntensitiesPacked_);
33 }
std::vector< uint16_t > beam1IntensitiesPacked_
std::vector< uint16_t > beam2IntensitiesPacked_
void BeamCurrentInfo::packData ( void  )
private

Definition at line 49 of file BeamCurrentInfo.cc.

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

Referenced by BeamCurrentInfo(), and fillBeamIntensities().

49  {
52 
53  for (unsigned int i=0; i<beam1IntensitiesUnpacked_.size(); i++) {
55  }
56  for (unsigned int i=0; i<beam2IntensitiesUnpacked_.size(); i++) {
58  }
59 
60  // Re-unpack the data so that it matches the packed data.
61  unpackedReady_ = false;
62  unpackData();
63 }
int i
Definition: DBlmapReader.cc:9
static const float scaleFactor
std::vector< float > beam2IntensitiesUnpacked_
std::vector< float > beam1IntensitiesUnpacked_
static uint16_t float32to16(float x)
Definition: libminifloat.h:15
void unpackData(void) const
std::vector< uint16_t > beam1IntensitiesPacked_
std::vector< uint16_t > beam2IntensitiesPacked_
void BeamCurrentInfo::unpackData ( void  ) const
private

Definition at line 66 of file BeamCurrentInfo.cc.

References beam1IntensitiesPacked_, beam1IntensitiesUnpacked_, beam2IntensitiesPacked_, beam2IntensitiesUnpacked_, MiniFloatConverter::float16to32(), i, scaleFactor, and unpackedReady_.

Referenced by getBeam1Intensities(), getBeam1IntensityBX(), getBeam2Intensities(), getBeam2IntensityBX(), and packData().

66  {
67  if (unpackedReady_) return;
68 
71 
72  for (unsigned int i=0; i<beam1IntensitiesPacked_.size(); i++) {
74  }
75  for (unsigned int i=0; i<beam2IntensitiesPacked_.size(); i++) {
77  }
78  unpackedReady_ = true;
79 }
int i
Definition: DBlmapReader.cc:9
static const float scaleFactor
std::vector< float > beam2IntensitiesUnpacked_
std::vector< float > beam1IntensitiesUnpacked_
static float float16to32(uint16_t h)
Definition: libminifloat.h:10
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_
mutableprivate
std::vector<uint16_t> BeamCurrentInfo::beam2IntensitiesPacked_
private
std::vector<float> BeamCurrentInfo::beam2IntensitiesUnpacked_
mutableprivate
const float BeamCurrentInfo::scaleFactor = 1e10
static

Definition at line 34 of file BeamCurrentInfo.h.

Referenced by packData(), and unpackData().

bool BeamCurrentInfo::unpackedReady_
mutableprivate

Definition at line 87 of file BeamCurrentInfo.h.

Referenced by BeamCurrentInfo(), fillBeamIntensities(), packData(), and unpackData().