1 #ifndef DataFormats_FTLRecHit_FTLCluster_h 2 #define DataFormats_FTLRecHit_FTLCluster_h 29 constexpr FTLHit(uint16_t hit_x, uint16_t hit_y,
float hit_energy,
float hit_time,
float hit_time_error) :
79 FTLCluster(
DetId id,
unsigned int isize,
float const * energys,
float const*
times,
float const* time_errors,
80 uint16_t
const * xpos, uint16_t
const * ypos,
81 uint16_t
const xmin, uint16_t
const ymin) :
87 for (
unsigned int i=0;
i!=isize; ++
i) {
88 uint16_t xoffset = xpos[
i]-
xmin;
89 uint16_t yoffset = ypos[
i]-
ymin;
92 if (xoffset > maxRow) maxRow = xoffset;
93 if (yoffset > maxCol) maxCol = yoffset;
108 inline float x()
const {
113 inline float y()
const {
119 auto t=[
this](
unsigned int i) {
return this->
theHitTIME[
i]; };
220 for (
unsigned int i=0; i<weights.size(); ++
i)
225 return outFunc(tot,sumW);
231 auto outFunc=[](
float x,
float y) {
if (
y>0)
return (
float)x/
y;
else return -999.f; };
237 auto sumFunc=[&
weights,err](
unsigned int i) {
return weights[
i]*weights[
i]*err(i)*err(i); } ;
238 auto outFunc=[](
float x,
float y) {
if (
y>0)
return (
float)
sqrt(x)/
y;
else return -999.f; };
242 static int overflow_(uint16_t span) {
return span==uint16_t(MAXSPAN);}
267 return detid < other.
detid();}
constexpr FTLHitPos(int row, int col)
void setClusterErrorTime(float errtime)
const std::vector< float > & hitTIME_ERROR() const
constexpr Shift(int dx, int dy)
constexpr uint16_t time_error()
void setClusterErrorX(float errx)
std::vector< float > theHitTIME_ERROR
static constexpr unsigned int MAXPOS
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)
constexpr uint16_t time()
static constexpr unsigned int MAXSPAN
constexpr uint16_t energy()
void packCol(uint16_t ymin, uint16_t yspan)
void setClusterErrorY(float erry)
std::vector< uint8_t > theHitOffset
std::vector< float > theHitTIME
const std::vector< float > & hitENERGY() const
constexpr int row() const
constexpr FTLHit(uint16_t hit_x, uint16_t hit_y, float hit_energy, float hit_time, float hit_time_error)
void packRow(uint16_t xmin, uint16_t xspan)
const std::vector< uint8_t > & hitOffset() const
float getClusterErrorY() const
std::vector< float > theHitENERGY
bool operator<(const FTLCluster &one, const FTLCluster &other)
float weighted_mean_error(const std::vector< float > &weights, const std::function< float(unsigned int)> &err) const
float getClusterErrorX() const
static unsigned int const shift
constexpr FTLHitPos operator+(const Shift &shift) 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 int overflow_(uint16_t span)
const std::vector< float > & hitTIME() const
constexpr int col() const
float weighted_mean(const std::vector< float > &weights, const std::function< float(unsigned int)> &value) const
float getClusterErrorTime() const
const DetId & detid() const