CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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

template<typename Value >
float weighted_mean (const std::vector< float > &weights, Value &&value) const
 
template<typename Err >
float weighted_mean_error (const std::vector< float > &weights, Err &&err) const
 
template<typename SumFunc , typename OutFunc >
float weighted_sum (const std::vector< float > &weights, SumFunc &&sumFunc, OutFunc &&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 20 of file FTLCluster.h.

Member Typedef Documentation

◆ key_type

Definition at line 22 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 78 of file FTLCluster.h.

78 {}

◆ 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 80 of file FTLCluster.h.

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

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 174 of file FTLCluster.h.

174 { return theHitColSpan; }

References theHitColSpan.

Referenced by maxHitCol(), and sizeY().

◆ detid()

const DetId& FTLCluster::detid ( ) const
inline

Definition at line 179 of file FTLCluster.h.

179 { return id(); }

References id().

◆ energy()

float FTLCluster::energy ( ) const
inline

Definition at line 149 of file FTLCluster.h.

149  {
150  return std::accumulate(theHitENERGY.begin(), theHitENERGY.end(), 0.f);
151  } // 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 201 of file FTLCluster.h.

201 { return err_time; }

References err_time.

◆ getClusterErrorX()

float FTLCluster::getClusterErrorX ( ) const
inline

Definition at line 199 of file FTLCluster.h.

199 { return err_x; }

References err_x.

◆ getClusterErrorY()

float FTLCluster::getClusterErrorY ( ) const
inline

Definition at line 200 of file FTLCluster.h.

200 { return err_y; }

References err_y.

◆ hit()

FTLHit FTLCluster::hit ( int  i) const
inline

Definition at line 164 of file FTLCluster.h.

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

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 159 of file FTLCluster.h.

159 { return theHitENERGY; }

References theHitENERGY.

◆ hitOffset()

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

Definition at line 158 of file FTLCluster.h.

158 { return theHitOffset; }

References theHitOffset.

◆ hitTIME()

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

Definition at line 160 of file FTLCluster.h.

160 { return theHitTIME; }

References theHitTIME.

◆ hitTIME_ERROR()

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

Definition at line 161 of file FTLCluster.h.

161 { return theHitTIME_ERROR; }

References theHitTIME_ERROR.

◆ id()

const DetId& FTLCluster::id ( ) const
inline

Definition at line 178 of file FTLCluster.h.

178 { return theid; }

References theid.

Referenced by detid().

◆ maxHitCol()

int FTLCluster::maxHitCol ( ) const
inline

Definition at line 156 of file FTLCluster.h.

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

References colSpan(), and minHitCol().

◆ maxHitRow()

int FTLCluster::maxHitRow ( ) const
inline

Definition at line 154 of file FTLCluster.h.

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

References minHitRow(), and rowSpan().

◆ minHitCol()

int FTLCluster::minHitCol ( ) const
inline

Definition at line 155 of file FTLCluster.h.

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

References theMinHitCol.

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

◆ minHitRow()

int FTLCluster::minHitRow ( ) const
inline

Definition at line 153 of file FTLCluster.h.

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

References theMinHitRow.

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

◆ overflow()

bool FTLCluster::overflow ( ) const
inline

Definition at line 185 of file FTLCluster.h.

185 { 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 181 of file FTLCluster.h.

181 { return overflow_(theHitColSpan); }

References overflow_(), and theHitColSpan.

Referenced by overflow().

◆ overflowRow()

bool FTLCluster::overflowRow ( ) const
inline

Definition at line 183 of file FTLCluster.h.

183 { return overflow_(theHitRowSpan); }

References overflow_(), and theHitRowSpan.

Referenced by overflow().

◆ packCol()

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

Definition at line 187 of file FTLCluster.h.

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

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 191 of file FTLCluster.h.

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

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

Referenced by FTLCluster().

◆ rowSpan()

int FTLCluster::rowSpan ( ) const
inline

Definition at line 176 of file FTLCluster.h.

176 { return theHitRowSpan; }

References theHitRowSpan.

Referenced by maxHitRow(), and sizeX().

◆ seed()

FTLHit FTLCluster::seed ( ) const
inline

Definition at line 172 of file FTLCluster.h.

172 { return hit(seed_); }

References hit(), and seed_.

◆ setClusterErrorTime()

void FTLCluster::setClusterErrorTime ( float  errtime)
inline

Definition at line 198 of file FTLCluster.h.

198 { err_time = errtime; }

References err_time.

◆ setClusterErrorX()

void FTLCluster::setClusterErrorX ( float  errx)
inline

Definition at line 196 of file FTLCluster.h.

196 { err_x = errx; }

References err_x.

◆ setClusterErrorY()

void FTLCluster::setClusterErrorY ( float  erry)
inline

Definition at line 197 of file FTLCluster.h.

197 { err_y = erry; }

References err_y.

◆ size()

int FTLCluster::size ( void  ) const
inline

◆ sizeX()

int FTLCluster::sizeX ( ) const
inline

Definition at line 144 of file FTLCluster.h.

144 { return rowSpan() + 1; }

References rowSpan().

◆ sizeY()

int FTLCluster::sizeY ( ) const
inline

Definition at line 147 of file FTLCluster.h.

147 { return colSpan() + 1; }

References colSpan().

◆ time()

float FTLCluster::time ( ) const
inline

Definition at line 130 of file FTLCluster.h.

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

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 135 of file FTLCluster.h.

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

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

Referenced by MTDTrackingRecHit::timeError().

◆ weighted_mean()

template<typename Value >
float FTLCluster::weighted_mean ( const std::vector< float > &  weights,
Value &&  value 
) const
inlineprivate

Definition at line 234 of file FTLCluster.h.

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

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

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

◆ weighted_mean_error()

template<typename Err >
float FTLCluster::weighted_mean_error ( const std::vector< float > &  weights,
Err &&  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()

template<typename SumFunc , typename OutFunc >
float FTLCluster::weighted_sum ( const std::vector< float > &  weights,
SumFunc &&  sumFunc,
OutFunc &&  outFunc 
) const
inlineprivate

Definition at line 223 of file FTLCluster.h.

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

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 125 of file FTLCluster.h.

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

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 218 of file FTLCluster.h.

Referenced by getClusterErrorTime(), and setClusterErrorTime().

◆ err_x

float FTLCluster::err_x = -99999.9f
private

Definition at line 216 of file FTLCluster.h.

Referenced by getClusterErrorX(), and setClusterErrorX().

◆ err_y

float FTLCluster::err_y = -99999.9f
private

Definition at line 217 of file FTLCluster.h.

Referenced by getClusterErrorY(), and setClusterErrorY().

◆ MAXPOS

constexpr unsigned int FTLCluster::MAXPOS = 2047
staticconstexpr

Definition at line 73 of file FTLCluster.h.

◆ MAXSPAN

constexpr unsigned int FTLCluster::MAXSPAN = 255
staticconstexpr

Definition at line 72 of file FTLCluster.h.

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

◆ seed_

uint8_t FTLCluster::seed_
private

Definition at line 220 of file FTLCluster.h.

Referenced by FTLCluster(), and seed().

◆ theHitColSpan

uint8_t FTLCluster::theHitColSpan = 0
private

Definition at line 214 of file FTLCluster.h.

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

◆ theHitENERGY

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

Definition at line 207 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 206 of file FTLCluster.h.

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

◆ theHitRowSpan

uint8_t FTLCluster::theHitRowSpan = 0
private

Definition at line 213 of file FTLCluster.h.

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

◆ theHitTIME

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

Definition at line 208 of file FTLCluster.h.

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

◆ theHitTIME_ERROR

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

Definition at line 209 of file FTLCluster.h.

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

◆ theid

DetId FTLCluster::theid
private

Definition at line 204 of file FTLCluster.h.

Referenced by id().

◆ theMinHitCol

uint16_t FTLCluster::theMinHitCol = MAXPOS
private

Definition at line 212 of file FTLCluster.h.

Referenced by minHitCol(), and packCol().

◆ theMinHitRow

uint16_t FTLCluster::theMinHitRow = MAXPOS
private

Definition at line 211 of file FTLCluster.h.

Referenced by minHitRow(), and packRow().

FTLCluster::weighted_mean_error
float weighted_mean_error(const std::vector< float > &weights, Err &&err) const
Definition: FTLCluster.h:246
FTLCluster::theHitENERGY
std::vector< float > theHitENERGY
Definition: FTLCluster.h:207
FTLCluster::id
const DetId & id() const
Definition: FTLCluster.h:178
FTLCluster::overflowCol
bool overflowCol() const
Definition: FTLCluster.h:181
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:216
FTLCluster::overflowRow
bool overflowRow() const
Definition: FTLCluster.h:183
FTLCluster::rowSpan
int rowSpan() const
Definition: FTLCluster.h:176
FTLCluster::theid
DetId theid
Definition: FTLCluster.h:204
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:191
FTLCluster::minHitRow
int minHitRow() const
Definition: FTLCluster.h:153
FTLCluster::minHitCol
int minHitCol() const
Definition: FTLCluster.h:155
FTLCluster::overflow_
static int overflow_(uint16_t span)
Definition: FTLCluster.h:257
FTLCluster::weighted_sum
float weighted_sum(const std::vector< float > &weights, SumFunc &&sumFunc, OutFunc &&outFunc) const
Definition: FTLCluster.h:223
HLT_FULL_cff.weights
weights
Definition: HLT_FULL_cff.py:99207
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
FTLCluster::theMinHitCol
uint16_t theMinHitCol
Definition: FTLCluster.h:212
FTLCluster::colSpan
int colSpan() const
Definition: FTLCluster.h:174
MTVHistoProducerAlgoForTrackerBlock_cfi.maxHit
maxHit
Definition: MTVHistoProducerAlgoForTrackerBlock_cfi.py:37
FTLCluster::theHitColSpan
uint8_t theHitColSpan
Definition: FTLCluster.h:214
FTLCluster::hit
FTLHit hit(int i) const
Definition: FTLCluster.h:164
FTLCluster::seed_
uint8_t seed_
Definition: FTLCluster.h:220
FTLCluster::theHitRowSpan
uint8_t theHitRowSpan
Definition: FTLCluster.h:213
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:217
FTLCluster::packCol
void packCol(uint16_t ymin, uint16_t yspan)
Definition: FTLCluster.h:187
FTLCluster::x
float x() const
Definition: FTLCluster.h:120
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:72
FTLCluster::y
float y() const
Definition: FTLCluster.h:125
FTLCluster::theHitTIME
std::vector< float > theHitTIME
Definition: FTLCluster.h:208
FTLCluster::err_time
float err_time
Definition: FTLCluster.h:218
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:209
FTLCluster::theHitOffset
std::vector< uint8_t > theHitOffset
Definition: FTLCluster.h:206
FTLCluster::weighted_mean
float weighted_mean(const std::vector< float > &weights, Value &&value) const
Definition: FTLCluster.h:234
FTLCluster::theMinHitRow
uint16_t theMinHitRow
Definition: FTLCluster.h:211