Belle II Software development
TOPAlignmentAlgorithm::AlignData Struct Reference

data structure More...

Public Member Functions

void add (const AlignData &data)
 Merge another data structure to this one.
 
void finalize (double scaleFact)
 Calculate weighted averages and rescale errors.
 

Public Attributes

int iter = 0
 iteration counter
 
int ntrk = 0
 number of tracks used
 
std::vector< float > alignPars
 alignment parameters
 
std::vector< float > alignErrs
 uncertainties on alignment parameters
 
bool valid = false
 true if alignment parameters are valid
 

Detailed Description

data structure

Definition at line 52 of file TOPAlignmentAlgorithm.h.

Member Function Documentation

◆ add()

void add ( const AlignData data)

Merge another data structure to this one.

Implements weighted average (least square fit) of alignment parameters. Function finalize() must be called after all data structures are added.

Definition at line 342 of file TOPAlignmentAlgorithm.cc.

343 {
344 iter = std::max(iter, data.iter);
345 ntrk += data.ntrk;
346 if (not data.valid) return;
347
348 for (size_t i = alignPars.size(); i < data.alignPars.size(); i++) {
349 alignPars.push_back(0);
350 alignErrs.push_back(0);
351 }
352
353 for (size_t i = 0; i < data.alignPars.size(); i++) {
354 auto e = data.alignErrs[i];
355 if (e == 0) continue;
356 auto wt = 1 / (e * e);
357 alignPars[i] += data.alignPars[i] * wt ;
358 alignErrs[i] += wt ;
359 }
360 valid = true;
361 }
bool valid
true if alignment parameters are valid
std::vector< float > alignPars
alignment parameters
std::vector< float > alignErrs
uncertainties on alignment parameters

◆ finalize()

void finalize ( double  scaleFact)

Calculate weighted averages and rescale errors.

Parameters
scaleFactscale factor for errors

Definition at line 364 of file TOPAlignmentAlgorithm.cc.

365 {
366 for (size_t i = 0; i < alignPars.size(); i++) {
367 auto wt = alignErrs[i];
368 if (wt == 0) continue;
369 alignPars[i] /= wt;
370 alignErrs[i] = 1 / sqrt(wt) * scaleFact;
371 }
372 }
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28

Member Data Documentation

◆ alignErrs

std::vector<float> alignErrs

uncertainties on alignment parameters

Definition at line 56 of file TOPAlignmentAlgorithm.h.

◆ alignPars

std::vector<float> alignPars

alignment parameters

Definition at line 55 of file TOPAlignmentAlgorithm.h.

◆ iter

int iter = 0

iteration counter

Definition at line 53 of file TOPAlignmentAlgorithm.h.

◆ ntrk

int ntrk = 0

number of tracks used

Definition at line 54 of file TOPAlignmentAlgorithm.h.

◆ valid

bool valid = false

true if alignment parameters are valid

Definition at line 57 of file TOPAlignmentAlgorithm.h.


The documentation for this struct was generated from the following files: