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) {}
float sumY2
Definition: CPPFCluster.h:39
uint16_t nY
Definition: CPPFCluster.h:40
uint16_t fstrip
Definition: CPPFCluster.h:32
float sumTime2
Definition: CPPFCluster.h:36
uint16_t nTime
Definition: CPPFCluster.h:37
float sumTime
Definition: CPPFCluster.h:36
uint16_t lstrip
Definition: CPPFCluster.h:33
float sumY
Definition: CPPFCluster.h:39
int16_t bunchx
Definition: CPPFCluster.h:34

◆ 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) {}
float sumY2
Definition: CPPFCluster.h:39
uint16_t nY
Definition: CPPFCluster.h:40
uint16_t fstrip
Definition: CPPFCluster.h:32
float sumTime2
Definition: CPPFCluster.h:36
uint16_t nTime
Definition: CPPFCluster.h:37
float sumTime
Definition: CPPFCluster.h:36
int bx() const
Definition: CPPFCluster.cc:19
def ls(path, rec=False)
Definition: eostools.py:349
uint16_t lstrip
Definition: CPPFCluster.h:33
float sumY
Definition: CPPFCluster.h:39
int16_t bunchx
Definition: CPPFCluster.h:34

◆ ~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.

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

35  {
36  ++nTime;
37  sumTime += time;
38  sumTime2 += time * time;
39 }
float sumTime2
Definition: CPPFCluster.h:36
uint16_t nTime
Definition: CPPFCluster.h:37
float sumTime
Definition: CPPFCluster.h:36
float time() const
Definition: CPPFCluster.cc:22

◆ addY()

void CPPFCluster::addY ( const float  y)

Definition at line 41 of file CPPFCluster.cc.

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

41  {
42  ++nY;
43  sumY += y;
44  sumY2 += y * y;
45 }
float sumY2
Definition: CPPFCluster.h:39
uint16_t nY
Definition: CPPFCluster.h:40
float y() const
Definition: CPPFCluster.cc:28
float sumY
Definition: CPPFCluster.h:39

◆ bx()

int CPPFCluster::bx ( ) const

Definition at line 19 of file CPPFCluster.cc.

References bunchx.

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

19 { return bunchx; }
int16_t bunchx
Definition: CPPFCluster.h:34

◆ clusterSize()

int CPPFCluster::clusterSize ( ) const

Definition at line 18 of file CPPFCluster.cc.

References fstrip, and lstrip.

Referenced by operator==().

18 { return lstrip - fstrip + 1; }
uint16_t fstrip
Definition: CPPFCluster.h:32
uint16_t lstrip
Definition: CPPFCluster.h:33

◆ firstStrip()

int CPPFCluster::firstStrip ( ) const

Definition at line 16 of file CPPFCluster.cc.

References fstrip.

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

16 { return fstrip; }
uint16_t fstrip
Definition: CPPFCluster.h:32

◆ hasTime()

bool CPPFCluster::hasTime ( ) const

Definition at line 21 of file CPPFCluster.cc.

References nTime.

Referenced by time(), and timeRMS().

21 { return nTime > 0; }
uint16_t nTime
Definition: CPPFCluster.h:37

◆ hasY()

bool CPPFCluster::hasY ( ) const

Definition at line 27 of file CPPFCluster.cc.

References nY.

Referenced by y(), and yRMS().

27 { return nY > 0; }
uint16_t nY
Definition: CPPFCluster.h:40

◆ isAdjacent()

bool CPPFCluster::isAdjacent ( const CPPFCluster cl) const

Definition at line 31 of file CPPFCluster.cc.

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

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

31  {
32  return ((cl.firstStrip() == this->firstStrip() - 1) && (cl.bx() == this->bx()));
33 }
int firstStrip() const
Definition: CPPFCluster.cc:16
int bx() const
Definition: CPPFCluster.cc:19

◆ lastStrip()

int CPPFCluster::lastStrip ( ) const

Definition at line 17 of file CPPFCluster.cc.

References lstrip.

Referenced by CPPFMaskReClusterizer::doAction().

17 { return lstrip; }
uint16_t lstrip
Definition: CPPFCluster.h:33

◆ merge()

void CPPFCluster::merge ( const CPPFCluster cl)

Definition at line 47 of file CPPFCluster.cc.

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

Referenced by CPPFClusterizer::doAction().

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 }
float sumY2
Definition: CPPFCluster.h:39
uint16_t nY
Definition: CPPFCluster.h:40
uint16_t fstrip
Definition: CPPFCluster.h:32
float sumTime2
Definition: CPPFCluster.h:36
uint16_t nTime
Definition: CPPFCluster.h:37
float sumTime
Definition: CPPFCluster.h:36
bool isAdjacent(const CPPFCluster &cl) const
Definition: CPPFCluster.cc:31
float sumY
Definition: CPPFCluster.h:39

◆ operator<()

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

Definition at line 62 of file CPPFCluster.cc.

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

62  {
63  if (cl.bx() == this->bx())
64  return cl.firstStrip() < this->firstStrip();
65 
66  return cl.bx() < this->bx();
67 }
int firstStrip() const
Definition: CPPFCluster.cc:16
int bx() const
Definition: CPPFCluster.cc:19

◆ operator==()

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

Definition at line 69 of file CPPFCluster.cc.

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

69  {
70  return ((this->clusterSize() == cl.clusterSize()) && (this->bx() == cl.bx()) &&
71  (this->firstStrip() == cl.firstStrip()));
72 }
int clusterSize() const
Definition: CPPFCluster.cc:18
int firstStrip() const
Definition: CPPFCluster.cc:16
int bx() const
Definition: CPPFCluster.cc:19

◆ time()

float CPPFCluster::time ( ) const

Definition at line 22 of file CPPFCluster.cc.

References hasTime(), nTime, and sumTime.

Referenced by addTime().

22 { return hasTime() ? sumTime / nTime : 0; }
uint16_t nTime
Definition: CPPFCluster.h:37
float sumTime
Definition: CPPFCluster.h:36
bool hasTime() const
Definition: CPPFCluster.cc:21

◆ timeRMS()

float CPPFCluster::timeRMS ( ) const

Definition at line 23 of file CPPFCluster.cc.

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

23  {
24  return hasTime() ? sqrt(max(0.F, sumTime2 * nTime - sumTime * sumTime)) / nTime : -1;
25 }
float sumTime2
Definition: CPPFCluster.h:36
uint16_t nTime
Definition: CPPFCluster.h:37
T sqrt(T t)
Definition: SSEVec.h:19
float sumTime
Definition: CPPFCluster.h:36
bool hasTime() const
Definition: CPPFCluster.cc:21
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163

◆ y()

float CPPFCluster::y ( ) const

Definition at line 28 of file CPPFCluster.cc.

References hasY(), nY, and sumY.

Referenced by svgfig.Ellipse::__repr__(), addY(), geometryXMLparser.Alignable::pos(), ntupleDataFormat._HitObject::r(), and ntupleDataFormat._HitObject::r3D().

28 { return hasY() ? sumY / nY : 0; }
uint16_t nY
Definition: CPPFCluster.h:40
float sumY
Definition: CPPFCluster.h:39
bool hasY() const
Definition: CPPFCluster.cc:27

◆ yRMS()

float CPPFCluster::yRMS ( ) const

Definition at line 29 of file CPPFCluster.cc.

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

29 { return hasY() ? sqrt(max(0.F, sumY2 * nY - sumY * sumY)) / nY : -1; }
float sumY2
Definition: CPPFCluster.h:39
uint16_t nY
Definition: CPPFCluster.h:40
T sqrt(T t)
Definition: SSEVec.h:19
float sumY
Definition: CPPFCluster.h:39
bool hasY() const
Definition: CPPFCluster.cc:27
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163

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