CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
RPCLinkSynchroStat::SynchroCounts Class Reference

#include <RPCLinkSynchroStat.h>

Public Member Functions

const std::vector< unsigned int > & counts () const
 
unsigned int firstHit () const
 
void increment (unsigned int bxDiff)
 
double mean () const
 
SynchroCountsoperator+= (const SynchroCounts &rhs)
 
bool operator== (const SynchroCounts &) const
 
std::string print () const
 
double rms () const
 
void set (unsigned int bxDiff)
 
unsigned int sum () const
 
 SynchroCounts ()
 
 SynchroCounts (const unsigned int *hits)
 

Private Member Functions

unsigned int mom0 () const
 
double mom1 () const
 

Private Attributes

std::vector< unsigned int > theCounts
 

Detailed Description

Definition at line 46 of file RPCLinkSynchroStat.h.

Constructor & Destructor Documentation

RPCLinkSynchroStat::SynchroCounts::SynchroCounts ( )
inline

Definition at line 48 of file RPCLinkSynchroStat.h.

48 : theCounts(std::vector<unsigned int>(8,0)) {}
std::vector< unsigned int > theCounts
RPCLinkSynchroStat::SynchroCounts::SynchroCounts ( const unsigned int *  hits)
inline

Definition at line 49 of file RPCLinkSynchroStat.h.

References SiStripPI::mean, and SiStripPI::rms.

49 : theCounts(std::vector<unsigned int>(hits,hits+8)) {}
std::vector< unsigned int > theCounts

Member Function Documentation

const std::vector<unsigned int>& RPCLinkSynchroStat::SynchroCounts::counts ( ) const
inline

Definition at line 60 of file RPCLinkSynchroStat.h.

References operator+=(), and RPCLinkSynchroStat::LinkBoard::operator==().

60 { return theCounts; }
std::vector< unsigned int > theCounts
unsigned int RPCLinkSynchroStat::SynchroCounts::firstHit ( ) const

Definition at line 42 of file RPCLinkSynchroStat.cc.

References mps_fire::i.

43 {
44  for (unsigned int i=0; i <8 ; ++i) if(theCounts[i]) return i;
45  return 8;
46 }
std::vector< unsigned int > theCounts
void RPCLinkSynchroStat::SynchroCounts::increment ( unsigned int  bxDiff)

Definition at line 53 of file RPCLinkSynchroStat.cc.

54 {
55  if (bxDiff < 8) theCounts[bxDiff]++;
56 }
std::vector< unsigned int > theCounts
double RPCLinkSynchroStat::SynchroCounts::mean ( ) const

Definition at line 70 of file RPCLinkSynchroStat.cc.

71 { unsigned int sum = mom0(); return sum==0 ? 0. : mom1()/sum; }
unsigned int RPCLinkSynchroStat::SynchroCounts::mom0 ( ) const
private

Definition at line 64 of file RPCLinkSynchroStat.cc.

References mps_fire::i, and mps_fire::result.

65 { unsigned int result = 0; for (unsigned int i=0; i<8; ++i) result += theCounts[i]; return result; }
std::vector< unsigned int > theCounts
double RPCLinkSynchroStat::SynchroCounts::mom1 ( ) const
private

Definition at line 67 of file RPCLinkSynchroStat.cc.

References mps_fire::i, and mps_fire::result.

68 { double result = 0.; for (unsigned int i=0; i<8; ++i) result += i*theCounts[i]; return result; }
std::vector< unsigned int > theCounts
RPCLinkSynchroStat::SynchroCounts & RPCLinkSynchroStat::SynchroCounts::operator+= ( const SynchroCounts rhs)

Definition at line 58 of file RPCLinkSynchroStat.cc.

References mps_fire::i, and theCounts.

59 {
60  for (unsigned int i=0; i<8; ++i) theCounts[i]+=rhs.theCounts[i];
61  return *this;
62 }
std::vector< unsigned int > theCounts
bool RPCLinkSynchroStat::SynchroCounts::operator== ( const SynchroCounts o) const

Definition at line 93 of file RPCLinkSynchroStat.cc.

References training_settings::idx, and theCounts.

94 {
95  for (unsigned int idx=0; idx <8; ++idx) if (theCounts[idx] != o.theCounts[idx]) return false;
96  return true;
97 }
std::vector< unsigned int > theCounts
std::string RPCLinkSynchroStat::SynchroCounts::print ( void  ) const

Definition at line 84 of file RPCLinkSynchroStat.cc.

References mps_fire::i, SiStripPI::mean, SiStripPI::rms, and harvestTrackValidationPlots::str.

Referenced by RPCLinkSynchroStat::dumpDelays().

85 {
86  std::ostringstream str;
87  str<<" mean: "<<std::setw(8)<<mean();
88  str<<" rms: "<<std::setw(8)<<rms();
89  str<<" counts:"; for (int i=0; i<8; ++i) str<<" "<<std::setw(4)<<theCounts[i];
90  return str.str();
91 }
std::vector< unsigned int > theCounts
double RPCLinkSynchroStat::SynchroCounts::rms ( ) const

Definition at line 73 of file RPCLinkSynchroStat.cc.

References mps_fire::i, SiStripPI::mean, mps_fire::result, and mathSSE::sqrt().

74 {
75  double result = 0.;
76  int sum = mom0();
77  if (sum==0) return 0.;
78  double mean = mom1()/sum;
79  for (int i=0; i<8; ++i) result += theCounts[i]*(mean-i)*(mean-i);
80  result /= sum;
81  return sqrt(result);
82 }
T sqrt(T t)
Definition: SSEVec.h:18
std::vector< unsigned int > theCounts
void RPCLinkSynchroStat::SynchroCounts::set ( unsigned int  bxDiff)

Definition at line 48 of file RPCLinkSynchroStat.cc.

49 {
50  if (bxDiff < 8) theCounts[bxDiff]=1;
51 }
std::vector< unsigned int > theCounts
unsigned int RPCLinkSynchroStat::SynchroCounts::sum ( ) const
inline

Definition at line 57 of file RPCLinkSynchroStat.h.

References edm::print(), and AlCaHLTBitMon_QueryRunRegistry::string.

57 { return mom0(); }

Member Data Documentation

std::vector<unsigned int> RPCLinkSynchroStat::SynchroCounts::theCounts
private

Definition at line 66 of file RPCLinkSynchroStat.h.

Referenced by operator+=(), and operator==().