CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

RPCLinkSynchroStat::SynchroCounts Class Reference

#include <RPCLinkSynchroStat.h>

List of all members.

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.

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

Definition at line 49 of file RPCLinkSynchroStat.h.

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

Member Function Documentation

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

Definition at line 60 of file RPCLinkSynchroStat.h.

References theCounts.

{ return theCounts; }
unsigned int RPCLinkSynchroStat::SynchroCounts::firstHit ( ) const

Definition at line 42 of file RPCLinkSynchroStat.cc.

References i.

{
  for (unsigned int i=0; i <8 ; ++i) if(theCounts[i]) return i;
  return 8;
}
void RPCLinkSynchroStat::SynchroCounts::increment ( unsigned int  bxDiff)

Definition at line 53 of file RPCLinkSynchroStat.cc.

{
  if (bxDiff < 8) theCounts[bxDiff]++;
}
double RPCLinkSynchroStat::SynchroCounts::mean ( ) const

Definition at line 70 of file RPCLinkSynchroStat.cc.

{ 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 i, and query::result.

Referenced by sum().

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

Definition at line 67 of file RPCLinkSynchroStat.cc.

References i, and query::result.

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

Definition at line 58 of file RPCLinkSynchroStat.cc.

References i, and theCounts.

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

Definition at line 93 of file RPCLinkSynchroStat.cc.

References UserOptions_cff::idx, and theCounts.

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

Definition at line 84 of file RPCLinkSynchroStat.cc.

References i, timingPdfMaker::mean, and plotscripts::rms().

Referenced by RPCLinkSynchroStat::dumpDelays().

{
  std::ostringstream str;
  str<<" mean: "<<std::setw(8)<<mean();
  str<<" rms: "<<std::setw(8)<<rms();
  str<<" counts:"; for (int i=0; i<8; ++i) str<<" "<<std::setw(4)<<theCounts[i];
  return str.str();
}
double RPCLinkSynchroStat::SynchroCounts::rms ( ) const

Definition at line 73 of file RPCLinkSynchroStat.cc.

References i, timingPdfMaker::mean, query::result, and mathSSE::sqrt().

{
  double result = 0.;
  int      sum = mom0();
  if (sum==0) return 0.;
  double mean = mom1()/sum;
  for (int i=0; i<8; ++i) result += theCounts[i]*(mean-i)*(mean-i);
  result /= sum;
  return sqrt(result);
}
void RPCLinkSynchroStat::SynchroCounts::set ( unsigned int  bxDiff)

Definition at line 48 of file RPCLinkSynchroStat.cc.

{
  if (bxDiff < 8) theCounts[bxDiff]=1;
}
unsigned int RPCLinkSynchroStat::SynchroCounts::sum ( ) const [inline]

Definition at line 57 of file RPCLinkSynchroStat.h.

References mom0().

{ return mom0(); }

Member Data Documentation

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

Definition at line 66 of file RPCLinkSynchroStat.h.

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