Belle II Software development
UnknownPars Struct Reference

structure including all variables of interest with uncertainties from boot-strap More...

Public Member Functions

void add (SpotParam sPar, double SizeX, double SizeY, double SizeXY, double SizeZ)
 add next boot-strap replica of the BS parameters
 
void printStat ()
 Print interesting statistics from boot-strap.
 
void getOutput (std::vector< VectorXd > &vtxPos, std::vector< MatrixXd > &vtxErr, MatrixXd &sizeMat)
 get output in Belle2-like format
 
void setBranchVal (TTree *T, std::vector< double > *vec, TString n)
 save bootstrap variable to TTree
 
void setBranchSpline (TTree *T, Spline *spl, TString n)
 save bootstrap spline to TTree
 
void save2tree (TString fName)
 save everything to TTree
 

Public Attributes

UnknowSpline x
 BS position (x coordinate)
 
UnknowSpline y
 BS position (y coordinate)
 
UnknowSpline kX
 BS angle in xz plane.
 
UnknowSpline kY
 BS angle in yz plane.
 
UnknowSpline z
 BS position (z coordinate)
 
UnknowVar sizeX
 BS size in x direction.
 
UnknowVar sizeY
 BS size in y direction.
 
UnknowVar sizeXY
 off-diagonal component of BS size cov matrix in frame where z' is aligned with z
 
UnknowVar sizeMin
 smallest eigenvalue of the BS size cov matrix (similar to sizeY)
 
UnknowVar sizeMax
 middle eigenvalue of the BS size cov matrix (similar to sizeX)
 
UnknowVar xyAngle
 angle of the BS in xy plane when z' is aligned with z
 
UnknowVar sizeZ
 BS size in z direction.
 
UnknowVar crossAngle
 derived value of the crossing angle of the HER & LER beams
 
UnknowVar matXX
 XX element of BS size cov matrix.
 
UnknowVar matYY
 YY element of BS size cov matrix.
 
UnknowVar matZZ
 ZZ element of BS size cov matrix.
 
UnknowVar matXY
 XY element of BS size cov matrix.
 
UnknowVar matXZ
 XZ element of BS size cov matrix.
 
UnknowVar matYZ
 YZ element of BS size cov matrix.
 

Detailed Description

structure including all variables of interest with uncertainties from boot-strap

Definition at line 333 of file BeamSpotStandAlone.cc.

Member Function Documentation

◆ add()

void add ( SpotParam  sPar,
double  SizeX,
double  SizeY,
double  SizeXY,
double  SizeZ 
)
inline

add next boot-strap replica of the BS parameters

Definition at line 359 of file BeamSpotStandAlone.cc.

360 {
361 x.add(sPar.x);
362 y.add(sPar.y);
363 kX.add(sPar.kX);
364 kY.add(sPar.kY);
365 z.add(sPar.z);
366
367
368 sizeX.add(SizeX);
369 sizeY.add(SizeY);
370 sizeXY.add(SizeXY);
371 sizeZ.add(SizeZ);
372
373
374 // Calculate the eigen-values
375 double SizeMin, SizeMax;
376 std::tie(SizeMin, SizeMax) = getSizeMinMax(SizeX, SizeY, SizeXY);
377
378 sizeMin.add(SizeMin);
379 sizeMax.add(SizeMax);
380
381 // and angle in mrad
382 double angle = 1e3 * getAngle(SizeX, SizeY, SizeXY);
383
384
385 xyAngle.add(angle);
386
387 //Get whole cov matrix
388 MatrixXd matSize = getRotatedSizeMatrix({sqrS(SizeX), sqrS(SizeY), sqrS(SizeXY)}, sqrS(SizeZ), sPar.kX.val(sPar.kX.center()),
389 sPar.kY.val(sPar.kY.center()));
390
391 // Store elements in [um]
392 matXX.add(sqrtS(matSize(0, 0)));
393 matYY.add(sqrtS(matSize(1, 1)));
394 matZZ.add(sqrtS(matSize(2, 2)));
395 matXY.add(sqrtS(matSize(0, 1)));
396
397 matXZ.add(sqrtS(matSize(0, 2)));
398 matYZ.add(sqrtS(matSize(1, 2)));
399
400
401 // crossing-angle in mrad
402 double crossAngleVal = 1e3 * 2 * sqrtS(matSize(0, 0)) / sqrtS(matSize(2, 2));
403 crossAngle.add(crossAngleVal);
404 }
void add(Spline spl)
add boot-strap replica
void add(double x)
add value to the replicas
UnknowSpline kY
BS angle in yz plane.
UnknowVar crossAngle
derived value of the crossing angle of the HER & LER beams
UnknowVar matZZ
ZZ element of BS size cov matrix.
UnknowVar sizeMin
smallest eigenvalue of the BS size cov matrix (similar to sizeY)
UnknowVar matYY
YY element of BS size cov matrix.
UnknowVar sizeZ
BS size in z direction.
UnknowSpline z
BS position (z coordinate)
UnknowVar sizeY
BS size in y direction.
UnknowVar matXZ
XZ element of BS size cov matrix.
UnknowVar matXY
XY element of BS size cov matrix.
UnknowSpline y
BS position (y coordinate)
UnknowVar sizeX
BS size in x direction.
UnknowVar matXX
XX element of BS size cov matrix.
UnknowVar sizeMax
middle eigenvalue of the BS size cov matrix (similar to sizeX)
UnknowVar sizeXY
off-diagonal component of BS size cov matrix in frame where z' is aligned with z
UnknowSpline x
BS position (x coordinate)
UnknowVar xyAngle
angle of the BS in xy plane when z' is aligned with z
UnknowVar matYZ
YZ element of BS size cov matrix.
UnknowSpline kX
BS angle in xz plane.

◆ getOutput()

void getOutput ( std::vector< VectorXd > &  vtxPos,
std::vector< MatrixXd > &  vtxErr,
MatrixXd &  sizeMat 
)
inline

get output in Belle2-like format

Definition at line 436 of file BeamSpotStandAlone.cc.

437 {
438 //Store the vertex position
439 int nVals = x.spls[0].vals.size();
440
441 vtxPos.clear();
442 vtxErr.clear();
443
444 const double toCm = 1e-4;
445
446 for (int i = 0; i < nVals; ++i) {
447 //vertex position
448 Vector3d vtx(x.spls[0].vals[i]*toCm, y.spls[0].vals[i]*toCm, z.spls[0].vals[i]*toCm);
449
450 //vertex error matrix (symmetric)
451 Matrix3d mS = Matrix3d::Zero();
452 mS(0, 0) = sqrS(x.spls[0].errs[i] * toCm);
453 mS(1, 1) = sqrS(y.spls[0].errs[i] * toCm);
454 mS(2, 2) = sqrS(z.spls[0].errs[i] * toCm);
455
456 vtxPos.push_back(vtx);
457 vtxErr.push_back(mS);
458 }
459
460 //BeamSpot size matrix (from boot-strap iteration 0)
461
462 sizeMat.resize(3, 3);
463 sizeMat(0, 0) = sqrS(matXX.vars[0] * toCm);
464 sizeMat(1, 1) = sqrS(matYY.vars[0] * toCm);
465 sizeMat(2, 2) = sqrS(matZZ.vars[0] * toCm);
466
467 sizeMat(0, 1) = sqrS(matXY.vars[0] * toCm);
468 sizeMat(0, 2) = sqrS(matXZ.vars[0] * toCm);
469 sizeMat(1, 2) = sqrS(matYZ.vars[0] * toCm);
470
471 sizeMat(1, 0) = sizeMat(0, 1);
472 sizeMat(2, 0) = sizeMat(0, 2);
473 sizeMat(2, 1) = sizeMat(1, 2);
474 }
std::vector< Spline > spls
vector with replicas
std::vector< double > vars
vector of variable values for all replicas

◆ printStat()

void printStat ( )
inline

Print interesting statistics from boot-strap.

Definition at line 407 of file BeamSpotStandAlone.cc.

408 {
409 x.getMeanSigma().print("x");
410 y.getMeanSigma().print("y");
411 kX.getMeanSigma().print("kX");
412 kY.getMeanSigma().print("kY");
413 z.getMeanSigma().print("z");
414
415 sizeX.printStat("sizeX");
416 sizeY.printStat("sizeY");
417 sizeXY.printStat("sizeXY");
418
419
420 sizeMin.printStat("sizeMin");
421 sizeMax.printStat("sizeMax");
422 xyAngle.printStat("xyAngle");
423 sizeZ.printStat("sizeZ");
424 crossAngle.printStat("crossAngle");
425
426
427 matXX.printStat("matXX");
428 matYY.printStat("matYY");
429 matZZ.printStat("matZZ");
430 matXY.printStat("matXY");
431 matXZ.printStat("matXZ");
432 matYZ.printStat("matYZ");
433 }
Spline getMeanSigma()
Get mean and 1-sigma errors of the spline values.
void printStat(TString n)
Print variable of name n with stat-info.
void print(TString tag="")
print the spline
Definition: tools.h:188

◆ save2tree()

void save2tree ( TString  fName)
inline

save everything to TTree

Definition at line 496 of file BeamSpotStandAlone.cc.

497 {
498
499 TTree* T = new TTree("runs", "beam conditions of runs");
500
501 int run = -99; //currently dummy
502 T->Branch("run", &run, "run/I");
503
504 Spline xAvg = x.getMeanSigma();
505 setBranchSpline(T, &xAvg, "x");
506 Spline yAvg = y.getMeanSigma();
507 setBranchSpline(T, &yAvg, "y");
508 Spline zAvg = z.getMeanSigma();
509 setBranchSpline(T, &zAvg, "z");
510
511 Spline kxAvg = kX.getMeanSigma();
512 setBranchSpline(T, &kxAvg, "kX");
513 Spline kyAvg = kY.getMeanSigma();
514 setBranchSpline(T, &kyAvg, "kY");
515
516 std::vector<double> sizeXVar = sizeX.getStats();
517 setBranchVal(T, &sizeXVar, "sizeX");
518 std::vector<double> sizeYVar = sizeY.getStats();
519 setBranchVal(T, &sizeYVar, "sizeY");
520 std::vector<double> sizeXYVar = sizeXY.getStats();
521 setBranchVal(T, &sizeXYVar, "sizeXY");
522 std::vector<double> sizeZVar = sizeZ.getStats();
523 setBranchVal(T, &sizeZVar, "sizeZ");
524
525 std::vector<double> sizeMinVar = sizeMin.getStats();
526 setBranchVal(T, &sizeMinVar, "sizeMin");
527 std::vector<double> sizeMaxVar = sizeMax.getStats();
528 setBranchVal(T, &sizeMaxVar, "sizeMax");
529 std::vector<double> xyAngleVar = xyAngle.getStats();
530 setBranchVal(T, &xyAngleVar, "xyAngle");
531
532 std::vector<double> crossAngleVar = crossAngle.getStats();
533 setBranchVal(T, &crossAngleVar, "crossAngle");
534
535
536 std::vector<double> matXXVar = matXX.getStats();
537 std::vector<double> matYYVar = matYY.getStats();
538 std::vector<double> matZZVar = matZZ.getStats();
539 std::vector<double> matXYVar = matXY.getStats();
540 std::vector<double> matXZVar = matXZ.getStats();
541 std::vector<double> matYZVar = matYZ.getStats();
542
543 setBranchVal(T, &matXXVar, "matXX");
544 setBranchVal(T, &matYYVar, "matYY");
545 setBranchVal(T, &matZZVar, "matZZ");
546
547 setBranchVal(T, &matXYVar, "matXY");
548 setBranchVal(T, &matXZVar, "matXZ");
549 setBranchVal(T, &matYZVar, "matYZ");
550
551
552 T->Fill();
553 T->SaveAs(fName);
554 }
std::vector< double > getStats()
Get basic stats.
void setBranchSpline(TTree *T, Spline *spl, TString n)
save bootstrap spline to TTree
void setBranchVal(TTree *T, std::vector< double > *vec, TString n)
save bootstrap variable to TTree

◆ setBranchSpline()

void setBranchSpline ( TTree *  T,
Spline spl,
TString  n 
)
inline

save bootstrap spline to TTree

Definition at line 486 of file BeamSpotStandAlone.cc.

487 {
488 T->Branch(n + "_nodes", &spl->nodes);
489 T->Branch(n + "_vals", &spl->vals);
490 T->Branch(n + "_errs", &spl->errs);
491 }

◆ setBranchVal()

void setBranchVal ( TTree *  T,
std::vector< double > *  vec,
TString  n 
)
inline

save bootstrap variable to TTree

Definition at line 478 of file BeamSpotStandAlone.cc.

479 {
480 T->Branch(n, &vec->at(0), n + "/D");
481 T->Branch(n + "_low", &vec->at(1), n + "_low/D");
482 T->Branch(n + "_high", &vec->at(2), n + "_high/D");
483 }

Member Data Documentation

◆ crossAngle

UnknowVar crossAngle

derived value of the crossing angle of the HER & LER beams

Definition at line 349 of file BeamSpotStandAlone.cc.

◆ kX

BS angle in xz plane.

Definition at line 336 of file BeamSpotStandAlone.cc.

◆ kY

BS angle in yz plane.

Definition at line 337 of file BeamSpotStandAlone.cc.

◆ matXX

UnknowVar matXX

XX element of BS size cov matrix.

Definition at line 351 of file BeamSpotStandAlone.cc.

◆ matXY

UnknowVar matXY

XY element of BS size cov matrix.

Definition at line 354 of file BeamSpotStandAlone.cc.

◆ matXZ

UnknowVar matXZ

XZ element of BS size cov matrix.

Definition at line 355 of file BeamSpotStandAlone.cc.

◆ matYY

UnknowVar matYY

YY element of BS size cov matrix.

Definition at line 352 of file BeamSpotStandAlone.cc.

◆ matYZ

UnknowVar matYZ

YZ element of BS size cov matrix.

Definition at line 356 of file BeamSpotStandAlone.cc.

◆ matZZ

UnknowVar matZZ

ZZ element of BS size cov matrix.

Definition at line 353 of file BeamSpotStandAlone.cc.

◆ sizeMax

UnknowVar sizeMax

middle eigenvalue of the BS size cov matrix (similar to sizeX)

Definition at line 344 of file BeamSpotStandAlone.cc.

◆ sizeMin

UnknowVar sizeMin

smallest eigenvalue of the BS size cov matrix (similar to sizeY)

Definition at line 343 of file BeamSpotStandAlone.cc.

◆ sizeX

UnknowVar sizeX

BS size in x direction.

Definition at line 340 of file BeamSpotStandAlone.cc.

◆ sizeXY

UnknowVar sizeXY

off-diagonal component of BS size cov matrix in frame where z' is aligned with z

Definition at line 342 of file BeamSpotStandAlone.cc.

◆ sizeY

UnknowVar sizeY

BS size in y direction.

Definition at line 341 of file BeamSpotStandAlone.cc.

◆ sizeZ

UnknowVar sizeZ

BS size in z direction.

Definition at line 348 of file BeamSpotStandAlone.cc.

◆ x

BS position (x coordinate)

Definition at line 334 of file BeamSpotStandAlone.cc.

◆ xyAngle

UnknowVar xyAngle

angle of the BS in xy plane when z' is aligned with z

Definition at line 345 of file BeamSpotStandAlone.cc.

◆ y

BS position (y coordinate)

Definition at line 335 of file BeamSpotStandAlone.cc.

◆ z

BS position (z coordinate)

Definition at line 338 of file BeamSpotStandAlone.cc.


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