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() [1/2]

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:8
std::vector< uint16_t > beam1IntensitiesPacked_
std::vector< uint16_t > beam2IntensitiesPacked_

◆ BeamCurrentInfo() [2/2]

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().

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

◆ ~BeamCurrentInfo()

BeamCurrentInfo::~BeamCurrentInfo ( )
inline

destructor

Definition at line 52 of file BeamCurrentInfo.h.

52 {}

Member Function Documentation

◆ fill()

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

Definition at line 30 of file BeamCurrentInfo.cc.

References fillBeamIntensities().

30  {
31  fillBeamIntensities(beam1Intensities, beam2Intensities);
32 }
void fillBeamIntensities(const std::vector< float > &beam1Intensities, const std::vector< float > &beam2Intensities)

◆ fillBeamIntensities()

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

Definition at line 23 of file BeamCurrentInfo.cc.

References beam1IntensitiesUnpacked_, beam2IntensitiesUnpacked_, and packData().

Referenced by fill().

24  {
25  beam1IntensitiesUnpacked_.assign(beam1Intensities.begin(), beam1Intensities.end());
26  beam2IntensitiesUnpacked_.assign(beam2Intensities.begin(), beam2Intensities.end());
27  packData();
28 }
std::vector< float > beam2IntensitiesUnpacked_
std::vector< float > beam1IntensitiesUnpacked_

◆ getBeam1Intensities()

const std::vector< float > & BeamCurrentInfo::getBeam1Intensities ( ) const

Definition at line 12 of file BeamCurrentInfo.cc.

References beam1IntensitiesUnpacked_.

Referenced by operator<<().

12 { return beam1IntensitiesUnpacked_; }
std::vector< float > beam1IntensitiesUnpacked_

◆ getBeam1IntensitiesPacked()

const std::vector<uint16_t>& BeamCurrentInfo::getBeam1IntensitiesPacked ( ) const
inline

Definition at line 61 of file BeamCurrentInfo.h.

References beam1IntensitiesPacked_.

Referenced by operator<<().

61 { return beam1IntensitiesPacked_; }
std::vector< uint16_t > beam1IntensitiesPacked_

◆ getBeam1IntensityBX()

float BeamCurrentInfo::getBeam1IntensityBX ( int  bx) const

◆ getBeam2Intensities()

const std::vector< float > & BeamCurrentInfo::getBeam2Intensities ( ) const

Definition at line 16 of file BeamCurrentInfo.cc.

References beam2IntensitiesUnpacked_.

Referenced by operator<<().

16 { return beam2IntensitiesUnpacked_; }
std::vector< float > beam2IntensitiesUnpacked_

◆ getBeam2IntensitiesPacked()

const std::vector<uint16_t>& BeamCurrentInfo::getBeam2IntensitiesPacked ( ) const
inline

Definition at line 62 of file BeamCurrentInfo.h.

References beam2IntensitiesPacked_.

62 { return beam2IntensitiesPacked_; }
std::vector< uint16_t > beam2IntensitiesPacked_

◆ getBeam2IntensityBX()

float BeamCurrentInfo::getBeam2IntensityBX ( int  bx) const

◆ isProductEqual()

bool BeamCurrentInfo::isProductEqual ( BeamCurrentInfo const &  next) const

Definition at line 18 of file BeamCurrentInfo.cc.

References beam1IntensitiesPacked_, beam2IntensitiesPacked_, and GetRecoTauVFromDQM_MC_cff::next.

18  {
19  return (beam1IntensitiesPacked_ == next.beam1IntensitiesPacked_ &&
20  beam2IntensitiesPacked_ == next.beam2IntensitiesPacked_);
21 }
std::vector< uint16_t > beam1IntensitiesPacked_
std::vector< uint16_t > beam2IntensitiesPacked_

◆ packData()

void BeamCurrentInfo::packData ( )
private

Definition at line 35 of file BeamCurrentInfo.cc.

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

Referenced by BeamCurrentInfo(), and fillBeamIntensities().

35  {
38 
39  for (unsigned int i = 0; i < beam1IntensitiesUnpacked_.size(); i++) {
41  }
42  for (unsigned int i = 0; i < beam2IntensitiesUnpacked_.size(); i++) {
44  }
45 
46  // Re-unpack the data so that it matches the packed data.
47  unpackData();
48 }
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_

◆ unpackData() [1/2]

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

Definition at line 51 of file BeamCurrentInfo.cc.

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

51  {
52  unpacked.resize(packed.size());
53 
54  for (unsigned int i = 0; i < packed.size(); i++) {
55  unpacked[i] = MiniFloatConverter::float16to32(packed[i]) * scaleFactor;
56  }
57 }
static const float scaleFactor
static float float16to32(uint16_t h)
Definition: libminifloat.h:13

◆ unpackData() [2/2]

void BeamCurrentInfo::unpackData ( )
private

Definition at line 59 of file BeamCurrentInfo.cc.

References beam1IntensitiesPacked_, beam1IntensitiesUnpacked_, beam2IntensitiesPacked_, and beam2IntensitiesUnpacked_.

Referenced by packData().

59  {
62 }
std::vector< float > beam2IntensitiesUnpacked_
std::vector< float > beam1IntensitiesUnpacked_
std::vector< uint16_t > beam1IntensitiesPacked_
std::vector< uint16_t > beam2IntensitiesPacked_

Member Data Documentation

◆ beam1IntensitiesPacked_

std::vector<uint16_t> BeamCurrentInfo::beam1IntensitiesPacked_
private

◆ beam1IntensitiesUnpacked_

std::vector<float> BeamCurrentInfo::beam1IntensitiesUnpacked_
private

◆ beam2IntensitiesPacked_

std::vector<uint16_t> BeamCurrentInfo::beam2IntensitiesPacked_
private

◆ beam2IntensitiesUnpacked_

std::vector<float> BeamCurrentInfo::beam2IntensitiesUnpacked_
private

◆ scaleFactor

const float BeamCurrentInfo::scaleFactor = 1e10
static

Definition at line 34 of file BeamCurrentInfo.h.

Referenced by packData(), and unpackData().