CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes
FTLCluster Class Reference

#include <FTLCluster.h>

Classes

class  FTLHit
 
class  FTLHitPos
 
class  Shift
 

Public Types

typedef DetId key_type
 

Public Member Functions

int colSpan () const
 
const DetIddetid () const
 
float energy () const
 
 FTLCluster ()
 
 FTLCluster (DetId id, unsigned int isize, float const *energys, float const *times, float const *time_errors, uint16_t const *xpos, uint16_t const *ypos, uint16_t const xmin, uint16_t const ymin)
 
float getClusterErrorTime () const
 
float getClusterErrorX () const
 
float getClusterErrorY () const
 
FTLHit hit (int i) const
 
const std::vector< float > & hitENERGY () const
 
const std::vector< uint8_t > & hitOffset () const
 
const std::vector< float > & hitTIME () const
 
const std::vector< float > & hitTIME_ERROR () const
 
const DetIdid () const
 
int maxHitCol () const
 
int maxHitRow () const
 
int minHitCol () const
 
int minHitRow () const
 
bool overflow () const
 
bool overflowCol () const
 
bool overflowRow () const
 
void packCol (uint16_t ymin, uint16_t yspan)
 
void packRow (uint16_t xmin, uint16_t xspan)
 
int rowSpan () const
 
FTLHit seed () const
 
void setClusterErrorTime (float errtime)
 
void setClusterErrorX (float errx)
 
void setClusterErrorY (float erry)
 
int size () const
 
int sizeX () const
 
int sizeY () const
 
float time () const
 
float timeError () const
 
float x () const
 
float y () const
 

Static Public Attributes

static constexpr unsigned int MAXPOS = 2047
 
static constexpr unsigned int MAXSPAN = 255
 

Private Member Functions

float weighted_mean (const std::vector< float > &weights, const std::function< float(unsigned int)> &value) const
 
float weighted_mean_error (const std::vector< float > &weights, const std::function< float(unsigned int)> &err) const
 
float weighted_sum (const std::vector< float > &weights, const std::function< float(unsigned int i)> &sumFunc, const std::function< float(float, float)> &outFunc) const
 

Static Private Member Functions

static int overflow_ (uint16_t span)
 

Private Attributes

float err_time = -99999.9f
 
float err_x = -99999.9f
 
float err_y = -99999.9f
 
uint8_t seed_
 
uint8_t theHitColSpan = 0
 
std::vector< float > theHitENERGY
 
std::vector< uint8_t > theHitOffset
 
uint8_t theHitRowSpan = 0
 
std::vector< float > theHitTIME
 
std::vector< float > theHitTIME_ERROR
 
DetId theid
 
uint16_t theMinHitCol = MAXPOS
 
uint16_t theMinHitRow = MAXPOS
 

Detailed Description

based on SiPixelCluster

Author
Paolo Meridiani

Definition at line 21 of file FTLCluster.h.

Member Typedef Documentation

◆ key_type

Definition at line 23 of file FTLCluster.h.

Constructor & Destructor Documentation

◆ FTLCluster() [1/2]

FTLCluster::FTLCluster ( )
inline

Construct from a range of digis that form a cluster and from a DetID. The range is assumed to be non-empty.

Definition at line 79 of file FTLCluster.h.

79 {}

◆ FTLCluster() [2/2]

FTLCluster::FTLCluster ( DetId  id,
unsigned int  isize,
float const *  energys,
float const *  times,
float const *  time_errors,
uint16_t const *  xpos,
uint16_t const *  ypos,
uint16_t const  xmin,
uint16_t const  ymin 
)
inline

Definition at line 81 of file FTLCluster.h.

90  : theid(id),
91  theHitOffset(2 * isize),
92  theHitENERGY(energys, energys + isize),
93  theHitTIME(times, times + isize),
94  theHitTIME_ERROR(time_errors, time_errors + isize) {
95  uint16_t maxCol = 0;
96  uint16_t maxRow = 0;
97  int maxHit = -1;
98  float maxEnergy = -99999;
99  for (unsigned int i = 0; i != isize; ++i) {
100  uint16_t xoffset = xpos[i] - xmin;
101  uint16_t yoffset = ypos[i] - ymin;
102  theHitOffset[i * 2] = std::min(uint16_t(MAXSPAN), xoffset);
103  theHitOffset[i * 2 + 1] = std::min(uint16_t(MAXSPAN), yoffset);
104  if (xoffset > maxRow)
105  maxRow = xoffset;
106  if (yoffset > maxCol)
107  maxCol = yoffset;
108  if (theHitENERGY[i] > maxEnergy) {
109  maxHit = i;
111  }
112  }
113  packRow(xmin, maxRow);
114  packCol(ymin, maxCol);
115 
116  if (maxHit >= 0)
117  seed_ = std::min(uint8_t(MAXSPAN), uint8_t(maxHit));
118  }

References mps_fire::i, particleFlowClusterECALTimeSelected_cfi::maxEnergy, MTVHistoProducerAlgoForTrackerBlock_cfi::maxHit, MAXSPAN, min(), packCol(), packRow(), seed_, theHitENERGY, theHitOffset, TrackerOfflineValidation_Dqm_cff::xmin, EcalSCDynamicDPhiParametersESProducer_cfi::xoffset, L1TOccupancyClient_cfi::ymin, and EcalSCDynamicDPhiParametersESProducer_cfi::yoffset.

Member Function Documentation

◆ colSpan()

int FTLCluster::colSpan ( ) const
inline

Definition at line 175 of file FTLCluster.h.

175 { return theHitColSpan; }

References theHitColSpan.

Referenced by maxHitCol(), and sizeY().

◆ detid()

const DetId& FTLCluster::detid ( ) const
inline

Definition at line 180 of file FTLCluster.h.

180 { return id(); }

References id().

◆ energy()

float FTLCluster::energy ( ) const
inline

Definition at line 150 of file FTLCluster.h.

150  {
151  return std::accumulate(theHitENERGY.begin(), theHitENERGY.end(), 0.f);
152  } // Return total cluster energy.

References theHitENERGY.

Referenced by MTDThresholdClusterizer::clusterize(), MTDTrackingRecHit::energy(), and Jet.Jet::rawEnergy().

◆ getClusterErrorTime()

float FTLCluster::getClusterErrorTime ( ) const
inline

Definition at line 202 of file FTLCluster.h.

202 { return err_time; }

References err_time.

◆ getClusterErrorX()

float FTLCluster::getClusterErrorX ( ) const
inline

Definition at line 200 of file FTLCluster.h.

200 { return err_x; }

References err_x.

◆ getClusterErrorY()

float FTLCluster::getClusterErrorY ( ) const
inline

Definition at line 201 of file FTLCluster.h.

201 { return err_y; }

References err_y.

◆ hit()

FTLHit FTLCluster::hit ( int  i) const
inline

Definition at line 165 of file FTLCluster.h.

165  {
166  return FTLHit(minHitRow() + theHitOffset[i * 2],
167  minHitCol() + theHitOffset[i * 2 + 1],
168  theHitENERGY[i],
169  theHitTIME[i],
171  }

References mps_fire::i, minHitCol(), minHitRow(), theHitENERGY, theHitOffset, theHitTIME, and theHitTIME_ERROR.

Referenced by seed().

◆ hitENERGY()

const std::vector<float>& FTLCluster::hitENERGY ( ) const
inline

Definition at line 160 of file FTLCluster.h.

160 { return theHitENERGY; }

References theHitENERGY.

◆ hitOffset()

const std::vector<uint8_t>& FTLCluster::hitOffset ( ) const
inline

Definition at line 159 of file FTLCluster.h.

159 { return theHitOffset; }

References theHitOffset.

◆ hitTIME()

const std::vector<float>& FTLCluster::hitTIME ( ) const
inline

Definition at line 161 of file FTLCluster.h.

161 { return theHitTIME; }

References theHitTIME.

◆ hitTIME_ERROR()

const std::vector<float>& FTLCluster::hitTIME_ERROR ( ) const
inline

Definition at line 162 of file FTLCluster.h.

162 { return theHitTIME_ERROR; }

References theHitTIME_ERROR.

◆ id()

const DetId& FTLCluster::id ( ) const
inline

Definition at line 179 of file FTLCluster.h.

179 { return theid; }

References theid.

Referenced by detid().

◆ maxHitCol()

int FTLCluster::maxHitCol ( ) const
inline

Definition at line 157 of file FTLCluster.h.

157 { return minHitCol() + colSpan(); } // The max y index.

References colSpan(), and minHitCol().

◆ maxHitRow()

int FTLCluster::maxHitRow ( ) const
inline

Definition at line 155 of file FTLCluster.h.

155 { return minHitRow() + rowSpan(); } // The max x index.

References minHitRow(), and rowSpan().

◆ minHitCol()

int FTLCluster::minHitCol ( ) const
inline

Definition at line 156 of file FTLCluster.h.

156 { return theMinHitCol; } // The min y index.

References theMinHitCol.

Referenced by hit(), maxHitCol(), and y().

◆ minHitRow()

int FTLCluster::minHitRow ( ) const
inline

Definition at line 154 of file FTLCluster.h.

154 { return theMinHitRow; } // The min x index.

References theMinHitRow.

Referenced by hit(), maxHitRow(), and x().

◆ overflow()

bool FTLCluster::overflow ( ) const
inline

Definition at line 186 of file FTLCluster.h.

186 { return overflowCol() || overflowRow(); }

References overflowCol(), and overflowRow().

◆ overflow_()

static int FTLCluster::overflow_ ( uint16_t  span)
inlinestaticprivate

Definition at line 257 of file FTLCluster.h.

257 { return span == uint16_t(MAXSPAN); }

References MAXSPAN.

Referenced by overflowCol(), and overflowRow().

◆ overflowCol()

bool FTLCluster::overflowCol ( ) const
inline

Definition at line 182 of file FTLCluster.h.

182 { return overflow_(theHitColSpan); }

References overflow_(), and theHitColSpan.

Referenced by overflow().

◆ overflowRow()

bool FTLCluster::overflowRow ( ) const
inline

Definition at line 184 of file FTLCluster.h.

184 { return overflow_(theHitRowSpan); }

References overflow_(), and theHitRowSpan.

Referenced by overflow().

◆ packCol()

void FTLCluster::packCol ( uint16_t  ymin,
uint16_t  yspan 
)
inline

Definition at line 188 of file FTLCluster.h.

188  {
189  theMinHitCol = ymin;
190  theHitColSpan = std::min(yspan, uint16_t(MAXSPAN));
191  }

References MAXSPAN, min(), theHitColSpan, theMinHitCol, and L1TOccupancyClient_cfi::ymin.

Referenced by FTLCluster().

◆ packRow()

void FTLCluster::packRow ( uint16_t  xmin,
uint16_t  xspan 
)
inline

Definition at line 192 of file FTLCluster.h.

192  {
193  theMinHitRow = xmin;
194  theHitRowSpan = std::min(xspan, uint16_t(MAXSPAN));
195  }

References MAXSPAN, min(), theHitRowSpan, theMinHitRow, and TrackerOfflineValidation_Dqm_cff::xmin.

Referenced by FTLCluster().

◆ rowSpan()

int FTLCluster::rowSpan ( ) const
inline

Definition at line 177 of file FTLCluster.h.

177 { return theHitRowSpan; }

References theHitRowSpan.

Referenced by maxHitRow(), and sizeX().

◆ seed()

FTLHit FTLCluster::seed ( ) const
inline

Definition at line 173 of file FTLCluster.h.

173 { return hit(seed_); }

References hit(), and seed_.

◆ setClusterErrorTime()

void FTLCluster::setClusterErrorTime ( float  errtime)
inline

Definition at line 199 of file FTLCluster.h.

199 { err_time = errtime; }

References err_time.

◆ setClusterErrorX()

void FTLCluster::setClusterErrorX ( float  errx)
inline

Definition at line 197 of file FTLCluster.h.

197 { err_x = errx; }

References err_x.

◆ setClusterErrorY()

void FTLCluster::setClusterErrorY ( float  erry)
inline

Definition at line 198 of file FTLCluster.h.

198 { err_y = erry; }

References err_y.

◆ size()

int FTLCluster::size ( void  ) const
inline

◆ sizeX()

int FTLCluster::sizeX ( ) const
inline

Definition at line 145 of file FTLCluster.h.

145 { return rowSpan() + 1; }

References rowSpan().

◆ sizeY()

int FTLCluster::sizeY ( ) const
inline

Definition at line 148 of file FTLCluster.h.

148 { return colSpan() + 1; }

References colSpan().

◆ time()

float FTLCluster::time ( ) const
inline

Definition at line 131 of file FTLCluster.h.

131  {
132  auto t = [this](unsigned int i) { return this->theHitTIME[i]; };
133  return weighted_mean(this->theHitENERGY, t);
134  }

References mps_fire::i, submitPVValidationJobs::t, theHitENERGY, theHitTIME, and weighted_mean().

Referenced by MTDThresholdClusterizer::clusterize(), and MTDTrackingRecHit::time().

◆ timeError()

float FTLCluster::timeError ( ) const
inline

Definition at line 136 of file FTLCluster.h.

136  {
137  auto t_err = [this](unsigned int i) { return this->theHitTIME_ERROR[i]; };
138  return weighted_mean_error(this->theHitENERGY, t_err);
139  }

References mps_fire::i, theHitENERGY, theHitTIME_ERROR, and weighted_mean_error().

Referenced by MTDTrackingRecHit::timeError().

◆ weighted_mean()

float FTLCluster::weighted_mean ( const std::vector< float > &  weights,
const std::function< float(unsigned int)> &  value 
) const
inlineprivate

Definition at line 235 of file FTLCluster.h.

235  {
236  auto sumFunc = [&weights, value](unsigned int i) { return weights[i] * value(i); };
237  auto outFunc = [](float x, float y) {
238  if (y > 0)
239  return (float)x / y;
240  else
241  return -999.f;
242  };
243  return weighted_sum(weights, sumFunc, outFunc);
244  }

References mps_fire::i, relativeConstraints::value, weighted_sum(), HLT_FULL_cff::weights, x(), and y().

Referenced by time(), x(), and y().

◆ weighted_mean_error()

float FTLCluster::weighted_mean_error ( const std::vector< float > &  weights,
const std::function< float(unsigned int)> &  err 
) const
inlineprivate

Definition at line 246 of file FTLCluster.h.

246  {
247  auto sumFunc = [&weights, err](unsigned int i) { return weights[i] * weights[i] * err(i) * err(i); };
248  auto outFunc = [](float x, float y) {
249  if (y > 0)
250  return (float)sqrt(x) / y;
251  else
252  return -999.f;
253  };
254  return weighted_sum(weights, sumFunc, outFunc);
255  }

References submitPVResolutionJobs::err, mps_fire::i, mathSSE::sqrt(), weighted_sum(), HLT_FULL_cff::weights, x(), and y().

Referenced by timeError().

◆ weighted_sum()

float FTLCluster::weighted_sum ( const std::vector< float > &  weights,
const std::function< float(unsigned int i)> &  sumFunc,
const std::function< float(float, float)> &  outFunc 
) const
inlineprivate

Definition at line 223 of file FTLCluster.h.

225  {
226  float tot = 0;
227  float sumW = 0;
228  for (unsigned int i = 0; i < weights.size(); ++i) {
229  tot += sumFunc(i);
230  sumW += weights[i];
231  }
232  return outFunc(tot, sumW);
233  }

References mps_fire::i, and HLT_FULL_cff::weights.

Referenced by weighted_mean(), and weighted_mean_error().

◆ x()

float FTLCluster::x ( ) const
inline

◆ y()

float FTLCluster::y ( ) const
inline

Definition at line 126 of file FTLCluster.h.

126  {
127  auto y_pos = [this](unsigned int i) { return this->theHitOffset[i * 2 + 1] + minHitCol() + 0.5f; };
128  return weighted_mean(this->theHitENERGY, y_pos);
129  }

References mps_fire::i, minHitCol(), theHitENERGY, theHitOffset, and weighted_mean().

Referenced by svgfig.Ellipse::__repr__(), MTDThresholdClusterizer::clusterize(), geometryXMLparser.Alignable::pos(), ntupleDataFormat._HitObject::r(), ntupleDataFormat._HitObject::r3D(), weighted_mean(), and weighted_mean_error().

Member Data Documentation

◆ err_time

float FTLCluster::err_time = -99999.9f
private

Definition at line 219 of file FTLCluster.h.

Referenced by getClusterErrorTime(), and setClusterErrorTime().

◆ err_x

float FTLCluster::err_x = -99999.9f
private

Definition at line 217 of file FTLCluster.h.

Referenced by getClusterErrorX(), and setClusterErrorX().

◆ err_y

float FTLCluster::err_y = -99999.9f
private

Definition at line 218 of file FTLCluster.h.

Referenced by getClusterErrorY(), and setClusterErrorY().

◆ MAXPOS

constexpr unsigned int FTLCluster::MAXPOS = 2047
staticconstexpr

Definition at line 74 of file FTLCluster.h.

◆ MAXSPAN

constexpr unsigned int FTLCluster::MAXSPAN = 255
staticconstexpr

Definition at line 73 of file FTLCluster.h.

Referenced by FTLCluster(), overflow_(), packCol(), and packRow().

◆ seed_

uint8_t FTLCluster::seed_
private

Definition at line 221 of file FTLCluster.h.

Referenced by FTLCluster(), and seed().

◆ theHitColSpan

uint8_t FTLCluster::theHitColSpan = 0
private

Definition at line 215 of file FTLCluster.h.

Referenced by colSpan(), overflowCol(), and packCol().

◆ theHitENERGY

std::vector<float> FTLCluster::theHitENERGY
private

Definition at line 208 of file FTLCluster.h.

Referenced by energy(), FTLCluster(), hit(), hitENERGY(), size(), time(), timeError(), x(), and y().

◆ theHitOffset

std::vector<uint8_t> FTLCluster::theHitOffset
private

Definition at line 207 of file FTLCluster.h.

Referenced by FTLCluster(), hit(), hitOffset(), x(), and y().

◆ theHitRowSpan

uint8_t FTLCluster::theHitRowSpan = 0
private

Definition at line 214 of file FTLCluster.h.

Referenced by overflowRow(), packRow(), and rowSpan().

◆ theHitTIME

std::vector<float> FTLCluster::theHitTIME
private

Definition at line 209 of file FTLCluster.h.

Referenced by hit(), hitTIME(), and time().

◆ theHitTIME_ERROR

std::vector<float> FTLCluster::theHitTIME_ERROR
private

Definition at line 210 of file FTLCluster.h.

Referenced by hit(), hitTIME_ERROR(), and timeError().

◆ theid

DetId FTLCluster::theid
private

Definition at line 205 of file FTLCluster.h.

Referenced by id().

◆ theMinHitCol

uint16_t FTLCluster::theMinHitCol = MAXPOS
private

Definition at line 213 of file FTLCluster.h.

Referenced by minHitCol(), and packCol().

◆ theMinHitRow

uint16_t FTLCluster::theMinHitRow = MAXPOS
private

Definition at line 212 of file FTLCluster.h.

Referenced by minHitRow(), and packRow().

FTLCluster::theHitENERGY
std::vector< float > theHitENERGY
Definition: FTLCluster.h:208
FTLCluster::weighted_mean
float weighted_mean(const std::vector< float > &weights, const std::function< float(unsigned int)> &value) const
Definition: FTLCluster.h:235
FTLCluster::id
const DetId & id() const
Definition: FTLCluster.h:179
FTLCluster::overflowCol
bool overflowCol() const
Definition: FTLCluster.h:182
EcalSCDynamicDPhiParametersESProducer_cfi.yoffset
yoffset
Definition: EcalSCDynamicDPhiParametersESProducer_cfi.py:10
mps_fire.i
i
Definition: mps_fire.py:428
FTLCluster::err_x
float err_x
Definition: FTLCluster.h:217
FTLCluster::overflowRow
bool overflowRow() const
Definition: FTLCluster.h:184
FTLCluster::rowSpan
int rowSpan() const
Definition: FTLCluster.h:177
FTLCluster::theid
DetId theid
Definition: FTLCluster.h:205
min
T min(T a, T b)
Definition: MathUtil.h:58
EcalSCDynamicDPhiParametersESProducer_cfi.xoffset
xoffset
Definition: EcalSCDynamicDPhiParametersESProducer_cfi.py:12
FTLCluster::packRow
void packRow(uint16_t xmin, uint16_t xspan)
Definition: FTLCluster.h:192
FTLCluster::minHitRow
int minHitRow() const
Definition: FTLCluster.h:154
FTLCluster::minHitCol
int minHitCol() const
Definition: FTLCluster.h:156
FTLCluster::overflow_
static int overflow_(uint16_t span)
Definition: FTLCluster.h:257
HLT_FULL_cff.weights
weights
Definition: HLT_FULL_cff.py:99170
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
FTLCluster::theMinHitCol
uint16_t theMinHitCol
Definition: FTLCluster.h:213
FTLCluster::weighted_sum
float weighted_sum(const std::vector< float > &weights, const std::function< float(unsigned int i)> &sumFunc, const std::function< float(float, float)> &outFunc) const
Definition: FTLCluster.h:223
FTLCluster::colSpan
int colSpan() const
Definition: FTLCluster.h:175
MTVHistoProducerAlgoForTrackerBlock_cfi.maxHit
maxHit
Definition: MTVHistoProducerAlgoForTrackerBlock_cfi.py:37
FTLCluster::theHitColSpan
uint8_t theHitColSpan
Definition: FTLCluster.h:215
FTLCluster::hit
FTLHit hit(int i) const
Definition: FTLCluster.h:165
FTLCluster::seed_
uint8_t seed_
Definition: FTLCluster.h:221
FTLCluster::theHitRowSpan
uint8_t theHitRowSpan
Definition: FTLCluster.h:214
particleFlowClusterECALTimeSelected_cfi.maxEnergy
maxEnergy
Definition: particleFlowClusterECALTimeSelected_cfi.py:10
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
FTLCluster::err_y
float err_y
Definition: FTLCluster.h:218
FTLCluster::packCol
void packCol(uint16_t ymin, uint16_t yspan)
Definition: FTLCluster.h:188
FTLCluster::x
float x() const
Definition: FTLCluster.h:121
L1TOccupancyClient_cfi.ymin
ymin
Definition: L1TOccupancyClient_cfi.py:43
relativeConstraints.value
value
Definition: relativeConstraints.py:53
FTLCluster::MAXSPAN
static constexpr unsigned int MAXSPAN
Definition: FTLCluster.h:73
FTLCluster::weighted_mean_error
float weighted_mean_error(const std::vector< float > &weights, const std::function< float(unsigned int)> &err) const
Definition: FTLCluster.h:246
FTLCluster::y
float y() const
Definition: FTLCluster.h:126
FTLCluster::theHitTIME
std::vector< float > theHitTIME
Definition: FTLCluster.h:209
FTLCluster::err_time
float err_time
Definition: FTLCluster.h:219
TrackerOfflineValidation_Dqm_cff.xmin
xmin
Definition: TrackerOfflineValidation_Dqm_cff.py:10
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
FTLCluster::theHitTIME_ERROR
std::vector< float > theHitTIME_ERROR
Definition: FTLCluster.h:210
FTLCluster::theHitOffset
std::vector< uint8_t > theHitOffset
Definition: FTLCluster.h:207
FTLCluster::theMinHitRow
uint16_t theMinHitRow
Definition: FTLCluster.h:212