CMS 3D CMS Logo

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

#include <CPPFCluster.h>

Public Member Functions

void addTime (const float time)
 
void addY (const float y)
 
int bx () const
 
int clusterSize () const
 
 CPPFCluster ()
 
 CPPFCluster (int fs, int ls, int bx)
 
int firstStrip () const
 
bool hasTime () const
 
bool hasY () const
 
bool isAdjacent (const CPPFCluster &cl) const
 
int lastStrip () const
 
void merge (const CPPFCluster &cl)
 
bool operator< (const CPPFCluster &cl) const
 
bool operator== (const CPPFCluster &cl) const
 
float time () const
 
float timeRMS () const
 
float y () const
 
float yRMS () const
 
 ~CPPFCluster ()
 

Private Attributes

int16_t bunchx
 
uint16_t fstrip
 
uint16_t lstrip
 
uint16_t nTime
 
uint16_t nY
 
float sumTime
 
float sumTime2
 
float sumY
 
float sumY2
 

Detailed Description

Definition at line 4 of file CPPFCluster.h.

Constructor & Destructor Documentation

◆ CPPFCluster() [1/2]

CPPFCluster::CPPFCluster ( )

Definition at line 8 of file CPPFCluster.cc.

9  : fstrip(0), lstrip(0), bunchx(0), sumTime(0), sumTime2(0), nTime(0), sumY(0), sumY2(0), nY(0) {}

◆ CPPFCluster() [2/2]

CPPFCluster::CPPFCluster ( int  fs,
int  ls,
int  bx 
)

Definition at line 11 of file CPPFCluster.cc.

12  : fstrip(fs), lstrip(ls), bunchx(bx), sumTime(0), sumTime2(0), nTime(0), sumY(0), sumY2(0), nY(0) {}

◆ ~CPPFCluster()

CPPFCluster::~CPPFCluster ( )

Definition at line 14 of file CPPFCluster.cc.

14 {}

Member Function Documentation

◆ addTime()

void CPPFCluster::addTime ( const float  time)

Definition at line 35 of file CPPFCluster.cc.

35  {
36  ++nTime;
37  sumTime += time;
38  sumTime2 += time * time;
39 }

References nTime, sumTime, sumTime2, and time().

◆ addY()

void CPPFCluster::addY ( const float  y)

Definition at line 41 of file CPPFCluster.cc.

41  {
42  ++nY;
43  sumY += y;
44  sumY2 += y * y;
45 }

References nY, sumY, sumY2, and y().

◆ bx()

int CPPFCluster::bx ( ) const

Definition at line 19 of file CPPFCluster.cc.

19 { return bunchx; }

References bunchx.

Referenced by CPPFMaskReClusterizer::doAction(), isAdjacent(), operator<(), and operator==().

◆ clusterSize()

int CPPFCluster::clusterSize ( ) const

Definition at line 18 of file CPPFCluster.cc.

18 { return lstrip - fstrip + 1; }

References fstrip, and lstrip.

Referenced by operator==().

◆ firstStrip()

int CPPFCluster::firstStrip ( ) const

Definition at line 16 of file CPPFCluster.cc.

16 { return fstrip; }

References fstrip.

Referenced by CPPFMaskReClusterizer::doAction(), isAdjacent(), operator<(), and operator==().

◆ hasTime()

bool CPPFCluster::hasTime ( ) const

Definition at line 21 of file CPPFCluster.cc.

21 { return nTime > 0; }

References nTime.

Referenced by time(), and timeRMS().

◆ hasY()

bool CPPFCluster::hasY ( ) const

Definition at line 27 of file CPPFCluster.cc.

27 { return nY > 0; }

References nY.

Referenced by y(), and yRMS().

◆ isAdjacent()

bool CPPFCluster::isAdjacent ( const CPPFCluster cl) const

Definition at line 31 of file CPPFCluster.cc.

31  {
32  return ((cl.firstStrip() == this->firstStrip() - 1) && (cl.bx() == this->bx()));
33 }

References bx(), GetRecoTauVFromDQM_MC_cff::cl, and firstStrip().

Referenced by CPPFClusterizer::doAction(), and merge().

◆ lastStrip()

int CPPFCluster::lastStrip ( ) const

Definition at line 17 of file CPPFCluster.cc.

17 { return lstrip; }

References lstrip.

Referenced by CPPFMaskReClusterizer::doAction().

◆ merge()

void CPPFCluster::merge ( const CPPFCluster cl)

Definition at line 47 of file CPPFCluster.cc.

47  {
48  if (!this->isAdjacent(cl))
49  return;
50 
51  fstrip = cl.firstStrip();
52 
53  nTime += cl.nTime;
54  sumTime += cl.sumTime;
55  sumTime2 += cl.sumTime2;
56 
57  nY += cl.nY;
58  sumY += cl.sumY;
59  sumY2 += cl.sumY2;
60 }

References GetRecoTauVFromDQM_MC_cff::cl, fstrip, isAdjacent(), nTime, nY, sumTime, sumTime2, sumY, and sumY2.

Referenced by CPPFClusterizer::doAction().

◆ operator<()

bool CPPFCluster::operator< ( const CPPFCluster cl) const

Definition at line 62 of file CPPFCluster.cc.

62  {
63  if (cl.bx() == this->bx())
64  return cl.firstStrip() < this->firstStrip();
65 
66  return cl.bx() < this->bx();
67 }

References bx(), GetRecoTauVFromDQM_MC_cff::cl, and firstStrip().

◆ operator==()

bool CPPFCluster::operator== ( const CPPFCluster cl) const

Definition at line 69 of file CPPFCluster.cc.

69  {
70  return ((this->clusterSize() == cl.clusterSize()) && (this->bx() == cl.bx()) &&
71  (this->firstStrip() == cl.firstStrip()));
72 }

References bx(), clusterSize(), and firstStrip().

◆ time()

float CPPFCluster::time ( ) const

Definition at line 22 of file CPPFCluster.cc.

22 { return hasTime() ? sumTime / nTime : 0; }

References hasTime(), nTime, and sumTime.

Referenced by addTime().

◆ timeRMS()

float CPPFCluster::timeRMS ( ) const

Definition at line 23 of file CPPFCluster.cc.

23  {
24  return hasTime() ? sqrt(max(0.F, sumTime2 * nTime - sumTime * sumTime)) / nTime : -1;
25 }

References F(), hasTime(), SiStripPI::max, nTime, mathSSE::sqrt(), sumTime, and sumTime2.

◆ y()

float CPPFCluster::y ( ) const

◆ yRMS()

float CPPFCluster::yRMS ( ) const

Definition at line 29 of file CPPFCluster.cc.

29 { return hasY() ? sqrt(max(0.F, sumY2 * nY - sumY * sumY)) / nY : -1; }

References F(), hasY(), SiStripPI::max, nY, mathSSE::sqrt(), sumY, and sumY2.

Member Data Documentation

◆ bunchx

int16_t CPPFCluster::bunchx
private

Definition at line 34 of file CPPFCluster.h.

Referenced by bx().

◆ fstrip

uint16_t CPPFCluster::fstrip
private

Definition at line 32 of file CPPFCluster.h.

Referenced by clusterSize(), firstStrip(), and merge().

◆ lstrip

uint16_t CPPFCluster::lstrip
private

Definition at line 33 of file CPPFCluster.h.

Referenced by clusterSize(), and lastStrip().

◆ nTime

uint16_t CPPFCluster::nTime
private

Definition at line 37 of file CPPFCluster.h.

Referenced by addTime(), hasTime(), merge(), time(), and timeRMS().

◆ nY

uint16_t CPPFCluster::nY
private

Definition at line 40 of file CPPFCluster.h.

Referenced by addY(), hasY(), merge(), y(), and yRMS().

◆ sumTime

float CPPFCluster::sumTime
private

Definition at line 36 of file CPPFCluster.h.

Referenced by addTime(), merge(), time(), and timeRMS().

◆ sumTime2

float CPPFCluster::sumTime2
private

Definition at line 36 of file CPPFCluster.h.

Referenced by addTime(), merge(), and timeRMS().

◆ sumY

float CPPFCluster::sumY
private

Definition at line 39 of file CPPFCluster.h.

Referenced by addY(), merge(), y(), and yRMS().

◆ sumY2

float CPPFCluster::sumY2
private

Definition at line 39 of file CPPFCluster.h.

Referenced by addY(), merge(), and yRMS().

eostools.ls
def ls(path, rec=False)
Definition: eostools.py:349
CPPFCluster::sumY2
float sumY2
Definition: CPPFCluster.h:39
CPPFCluster::y
float y() const
Definition: CPPFCluster.cc:28
CPPFCluster::fstrip
uint16_t fstrip
Definition: CPPFCluster.h:32
CPPFCluster::firstStrip
int firstStrip() const
Definition: CPPFCluster.cc:16
CPPFCluster::sumTime2
float sumTime2
Definition: CPPFCluster.h:36
CPPFCluster::nY
uint16_t nY
Definition: CPPFCluster.h:40
F
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
GetRecoTauVFromDQM_MC_cff.cl
cl
Definition: GetRecoTauVFromDQM_MC_cff.py:38
CPPFCluster::nTime
uint16_t nTime
Definition: CPPFCluster.h:37
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
CPPFCluster::sumTime
float sumTime
Definition: CPPFCluster.h:36
CPPFCluster::lstrip
uint16_t lstrip
Definition: CPPFCluster.h:33
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
CPPFCluster::bx
int bx() const
Definition: CPPFCluster.cc:19
CPPFCluster::sumY
float sumY
Definition: CPPFCluster.h:39
CPPFCluster::isAdjacent
bool isAdjacent(const CPPFCluster &cl) const
Definition: CPPFCluster.cc:31
CPPFCluster::time
float time() const
Definition: CPPFCluster.cc:22
CPPFCluster::hasTime
bool hasTime() const
Definition: CPPFCluster.cc:21
CPPFCluster::bunchx
int16_t bunchx
Definition: CPPFCluster.h:34
CPPFCluster::clusterSize
int clusterSize() const
Definition: CPPFCluster.cc:18
CPPFCluster::hasY
bool hasY() const
Definition: CPPFCluster.cc:27