20 #include <display/EVEVisualization.h>
22 #include <display/VisualRepMap.h>
23 #include <display/EveGeometry.h>
24 #include <display/EveVisBField.h>
25 #include <display/ObjectInfo.h>
27 #include <vxd/geometry/GeoCache.h>
28 #include <klm/bklm/geometry/GeometryPar.h>
29 #include <cdc/geometry/CDCGeometryPar.h>
30 #include <cdc/dataobjects/CDCRecoHit.h>
31 #include <cdc/translators/RealisticTDCCountTranslator.h>
32 #include <arich/dbobjects/ARICHGeometryConfig.h>
33 #include <simulation/dataobjects/MCParticleTrajectory.h>
34 #include <svd/reconstruction/SVDRecoHit.h>
35 #include <top/geometry/TOPGeometryPar.h>
37 #include <genfit/AbsMeasurement.h>
38 #include <genfit/PlanarMeasurement.h>
39 #include <genfit/SpacepointMeasurement.h>
40 #include <genfit/WireMeasurement.h>
41 #include <genfit/WireMeasurementNew.h>
42 #include <genfit/WirePointMeasurement.h>
43 #include <genfit/DetPlane.h>
44 #include <genfit/Exception.h>
45 #include <genfit/KalmanFitterInfo.h>
46 #include <genfit/GblFitterInfo.h>
48 #include <framework/dataobjects/DisplayData.h>
49 #include <framework/logging/Logger.h>
50 #include <framework/utilities/ColorPalette.h>
51 #include <framework/geometry/VectorUtil.h>
53 #include <Math/VectorUtil.h>
54 #include <TEveArrow.h>
57 #include <TEveManager.h>
58 #include <TEveGeoShape.h>
60 #include <TEvePointSet.h>
61 #include <TEveSelection.h>
62 #include <TEveStraightLineSet.h>
63 #include <TEveTriangleSet.h>
65 #include <TEveTrack.h>
66 #include <TEveTrackPropagator.h>
68 #include <TGeoMatrix.h>
69 #include <TGeoManager.h>
70 #include <TGeoSphere.h>
72 #include <TGLLogicalShape.h>
73 #include <TParticle.h>
77 #include <TMatrixDSymEigen.h>
79 #include <boost/math/special_functions/fpclassify.hpp>
80 #include <boost/scoped_ptr.hpp>
81 #include <boost/algorithm/string/find.hpp>
82 #include <boost/algorithm/string/trim.hpp>
83 #include <boost/algorithm/string/classification.hpp>
93 template <
class T>
void destroyEveElement(T*& el)
96 if (el->GetDenyDestroy() > 1)
97 B2WARNING(
"destroyEveElement(): Element " << el->GetName() <<
" has unexpected refcount " << el->GetDenyDestroy());
109 void fixGeoShapeRefCount(TEveGeoShape* eveshape)
111 TGeoShape* s = eveshape->GetShape();
113 if (gGeoManager->GetListOfShapes()->Last() == s)
114 gGeoManager->GetListOfShapes()->RemoveAt(gGeoManager->GetListOfShapes()->GetLast());
116 gGeoManager->GetListOfShapes()->Remove(s);
128 m_assignToPrimaries(false),
134 TGLLogicalShape::SetIgnoreSizeForCameraInterest(kTRUE);
160 m_calo3d =
new TEveCalo3D(NULL,
"ECLClusters");
162 m_calo3d->SetForwardEndCapPos(196.5);
163 m_calo3d->SetBackwardEndCapPos(-102.0);
165 m_calo3d->SetRnrFrame(
false,
false);
169 gEve->GetSelection()->IncDenyDestroy();
170 gEve->GetHighlight()->IncDenyDestroy();
200 bool drawHits =
false;
203 for (
size_t i = 0; i <
m_options.length(); i++) {
204 if (
m_options.at(i) ==
'H') drawHits =
true;
214 TEveStraightLineSet* lines =
new TEveStraightLineSet(
"RecoHits for " + label);
217 lines->SetMarkerStyle(6);
218 lines->SetMainTransparency(60);
235 TEveRecTrack rectrack;
236 rectrack.fP.Set(track_mom);
237 rectrack.fV.Set(track_pos);
240 track_lines->SetName(label);
243 track_lines->SetLineWidth(1);
249 track_lines->AddElement(lines);
259 bool drawHits =
false;
262 for (
size_t i = 0; i <
m_options.length(); i++) {
263 if (
m_options.at(i) ==
'H') drawHits =
true;
270 TEveLine* track =
new TEveLine();
271 std::vector<TVector3> posPoints;
272 track->SetName(label);
274 track->SetLineWidth(3);
276 track->SetSmooth(
true);
280 if (!recoHit->useInFit())
290 if (not fittedResult) {
291 B2WARNING(
"Skipping unfitted track point");
295 state.getPosMomCov(pos, mom, cov);
297 B2WARNING(
"Skipping state with strange pos, mom or cov");
301 posPoints.push_back(TVector3(pos.X(), pos.Y(), pos.Z()));
304 sort(posPoints.begin(), posPoints.end(),
305 [](
const TVector3 & a,
const TVector3 & b) ->
bool {
306 return a.X() * a.X() + a.Y() * a.Y() > b.X() * b.X() + b.Y() * b.Y();
308 for (
auto vec : posPoints) {
309 track->SetNextPoint(vec.X(), vec.Y(), vec.Z());
312 TEveStraightLineSet* lines =
new TEveStraightLineSet(
"RecoHits for " + label);
315 lines->SetMarkerStyle(6);
316 lines->SetMainTransparency(60);
333 track->AddElement(lines);
343 TVector3 track_pos = TVector3(0, 0, trgTrack.getZ0());
344 B2Vector3D track_mom = (trgTrack.getChargeSign() == 0) ?
345 trgTrack.getDirection() * 1000 :
346 trgTrack.getMomentum(1.5);
348 TEveRecTrack rectrack;
349 rectrack.fP.Set(track_mom);
350 rectrack.fV.Set(track_pos);
353 track_lines->SetName(label);
355 track_lines->SetLineColor(kOrange + 2);
356 track_lines->SetLineWidth(1);
358 TString::Format(
"\ncharge: %d, phi: %.2fdeg, pt: %.2fGeV, theta: %.2fdeg, z: %.2fcm",
359 trgTrack.getChargeSign(),
360 trgTrack.getPhi0() * 180 / M_PI,
361 trgTrack.getTransverseMomentum(1.5),
362 trgTrack.getDirection().Theta() * 180 / M_PI,
366 track_lines->SetCharge(trgTrack.getChargeSign());
369 if (trgTrack.getZ0() == 0 && trgTrack.getCotTheta() == 0)
370 track_lines->SetLineStyle(2);
382 B2ERROR(
"Track without TrackFitResult skipped.");
390 bool drawDetectors =
false;
391 bool drawHits =
false;
392 bool drawPlanes =
false;
395 for (
size_t i = 0; i <
m_options.length(); i++) {
396 if (
m_options.at(i) ==
'D') drawDetectors =
true;
397 if (
m_options.at(i) ==
'H') drawHits =
true;
398 if (
m_options.at(i) ==
'P') drawPlanes =
true;
406 bool isPruned = (track ==
nullptr);
409 TEveRecTrackD recTrack;
411 recTrack.fV.Set(poca);
414 if (std::isfinite(poca_momentum.
Mag()))
415 recTrack.fP.Set(poca_momentum);
421 eveTrack->SetName(label);
428 representation = track->getCardinalRepresentation();
429 B2DEBUG(100,
"Draw cardinal rep");
431 const auto& representations = track->getRepresentations();
432 if (representations.empty()) {
433 B2ERROR(
"No representations found in the reco track!");
436 B2DEBUG(100,
"Draw representation number 0.");
437 representation = representations.front();
440 if (!track->hasTrackFitStatus(representation)) {
441 B2ERROR(
"RecoTrack without FitStatus: will be skipped!");
459 const auto& hitPoints = track->getHitPointsWithMeasurement();
460 const unsigned int numpoints = hitPoints.size();
467 if (! tp->hasFitterInfo(representation)) {
468 B2ERROR(
"trackPoint has no fitterInfo for rep");
478 B2ERROR(
"Can only display KalmanFitterInfo or GblFitterInfo");
483 B2FATAL(
"AbsFitterInfo dynamic-casted to both KalmanFitterInfo and GblFitterInfo!");
486 if (fi && ! tp->hasRawMeasurements()) {
487 B2ERROR(
"trackPoint has no raw measurements");
491 if (fi && ! fi->hasPredictionsAndUpdates()) {
492 B2ERROR(
"KalmanFitterInfo does not have all predictions and updates");
500 fittedState = &(fi->getFittedState(
true));
502 B2ERROR(e.what() <<
" - can not get fitted state");
506 TVector3 track_pos = representation->
getPos(*fittedState);
509 if (prevFittedState != NULL) {
511 TEvePathMark::EType_e markType = TEvePathMark::kReference;
512 if (hitCounter + 1 ==
static_cast<int>(numpoints))
513 markType = TEvePathMark::kDecay;
524 makeLines(eveTrack, prevFi->getForwardUpdate(), fi->getForwardPrediction(), representation, markType,
m_drawErrors, 0);
526 makeLines(eveTrack, prevFi->getBackwardPrediction(), fi->getBackwardUpdate(), representation, markType,
m_drawErrors);
528 if (
m_drawRefTrack && fi->hasReferenceState() && prevFi->hasReferenceState())
529 makeLines(eveTrack, prevFi->getReferenceState(), fi->getReferenceState(), representation, markType,
false);
533 if (gfi && prevGFi) {
539 if (
m_drawRefTrack && gfi->hasReferenceState() && prevGFi->hasReferenceState()) {
542 makeLines(eveTrack, &prevSop, &sop, representation, markType,
false);
549 prevFittedState = fittedState;
553 const int numMeasurements = tp->getNumRawMeasurements();
554 for (
int iMeasurement = 0; iMeasurement < numMeasurements; iMeasurement++) {
557 TVectorT<double> hit_coords;
558 TMatrixTSym<double> hit_cov;
563 hit_coords.ResizeTo(mop->getState());
564 hit_cov.ResizeTo(mop->getCov());
565 hit_coords = mop->getState();
566 hit_cov = mop->getCov();
573 hit_coords.ResizeTo(gblMeas.getState());
574 hit_cov.ResizeTo(gblMeas.getCov());
575 hit_coords = gblMeas.getState();
576 hit_cov = gblMeas.getCov();
582 TVector3 o = fittedState->getPlane()->getO();
583 TVector3 u = fittedState->getPlane()->getU();
584 TVector3 v = fittedState->getPlane()->getV();
586 bool planar_hit =
false;
587 bool planar_pixel_hit =
false;
588 bool space_hit =
false;
589 bool wire_hit =
false;
590 bool wirepoint_hit =
false;
593 double_t plane_size = 4;
595 int hit_coords_dim = m->getDim();
599 if (hit_coords_dim == 1) {
600 hit_u = hit_coords(0);
601 }
else if (hit_coords_dim == 2) {
602 planar_pixel_hit =
true;
603 hit_u = hit_coords(0);
604 hit_v = hit_coords(1);
612 hit_u = fabs(hit_coords(0));
613 hit_v = v * (track_pos - o);
615 wirepoint_hit =
true;
616 hit_v = hit_coords(1);
619 B2ERROR(
"Hit " << hitCounter <<
", Measurement " << iMeasurement <<
": Unknown measurement type: skipping hit!");
626 if (drawPlanes || (drawDetectors && planar_hit)) {
627 TVector3 move(0, 0, 0);
628 if (wire_hit) move = v * (v * (track_pos - o));
629 TEveBox* box =
boxCreator(o + move, u, v, plane_size, plane_size, 0.01);
630 if (drawDetectors && planar_hit) {
631 box->SetMainColor(kCyan);
633 box->SetMainColor(kGray);
635 box->SetMainTransparency(50);
636 eveTrack->AddElement(box);
644 TEveGeoShape* det_shape =
new TEveGeoShape(
"det_shape");
645 det_shape->SetShape(
new TGeoTube(std::max(0., (
double)(hit_u - 0.0105 / 2.)), hit_u + 0.0105 / 2., plane_size));
646 fixGeoShapeRefCount(det_shape);
648 TVector3 norm = u.Cross(v);
649 TGeoRotation det_rot(
"det_rot", (u.Theta() * 180) / TMath::Pi(), (u.Phi() * 180) / TMath::Pi(),
650 (norm.Theta() * 180) / TMath::Pi(), (norm.Phi() * 180) / TMath::Pi(),
651 (v.Theta() * 180) / TMath::Pi(), (v.Phi() * 180) / TMath::Pi());
652 TVector3 move = v * (v * (track_pos - o));
653 TGeoCombiTrans det_trans(o(0) + move.X(),
657 det_shape->SetTransMatrix(det_trans);
658 det_shape->SetMainColor(kCyan);
659 det_shape->SetMainTransparency(25);
660 if ((drawHits && (hit_u + 0.0105 / 2 > 0)) || !drawHits) {
661 eveTrack->AddElement(det_shape);
672 if (!planar_pixel_hit) {
677 B2WARNING(
"SVD recohit couldn't be converted... ");
684 double hit_res_u = hit_cov(0, 0);
685 if (recoHit->
isU()) {
687 dv = sensor.getLength();
690 du = sensor.getWidth();
694 double depth = sensor.getThickness();
695 TEveBox* hit_box =
boxCreator(a, u, v, du, dv, depth);
696 hit_box->SetName(
"SVDRecoHit");
698 hit_box->SetMainTransparency(0);
699 eveTrack->AddElement(hit_box);
703 TMatrixDSymEigen eigen_values(hit_cov);
704 TEveGeoShape* cov_shape =
new TEveGeoShape(
"PXDRecoHit");
705 const TVectorD& ev = eigen_values.GetEigenValues();
706 const TMatrixD& eVec = eigen_values.GetEigenVectors();
712 cov_shape->SetShape(
new TGeoEltu(pseudo_res_0, pseudo_res_1, 0.0105));
713 fixGeoShapeRefCount(cov_shape);
714 TVector3 pix_pos = o + hit_u * u + hit_v * v;
715 TVector3 u_semiaxis = (pix_pos + eVec(0, 0) * u + eVec(1, 0) * v) - pix_pos;
716 TVector3 v_semiaxis = (pix_pos + eVec(0, 1) * u + eVec(1, 1) * v) - pix_pos;
717 TVector3 norm = u.Cross(v);
721 TGeoRotation det_rot(
"det_rot", (u_semiaxis.Theta() * 180) / TMath::Pi(), (u_semiaxis.Phi() * 180) / TMath::Pi(),
722 (v_semiaxis.Theta() * 180) / TMath::Pi(), (v_semiaxis.Phi() * 180) / TMath::Pi(),
723 (norm.Theta() * 180) / TMath::Pi(), (norm.Phi() * 180) / TMath::Pi());
724 TGeoCombiTrans det_trans(pix_pos(0), pix_pos(1), pix_pos(2), &det_rot);
725 cov_shape->SetTransMatrix(det_trans);
729 cov_shape->SetMainTransparency(0);
730 eveTrack->AddElement(cov_shape);
739 TMatrixDSymEigen eigen_values(m->getRawHitCov());
740 TEveGeoShape* cov_shape =
new TEveGeoShape(
"SpacePoint Hit");
741 cov_shape->SetShape(
new TGeoSphere(0., 1.));
742 fixGeoShapeRefCount(cov_shape);
743 const TVectorD& ev = eigen_values.GetEigenValues();
744 const TMatrixD& eVec = eigen_values.GetEigenVectors();
745 TVector3 eVec1(eVec(0, 0), eVec(1, 0), eVec(2, 0));
746 TVector3 eVec2(eVec(0, 1), eVec(1, 1), eVec(2, 1));
747 TVector3 eVec3(eVec(0, 2), eVec(1, 2), eVec(2, 2));
748 TVector3 norm = u.Cross(v);
752 TGeoRotation det_rot(
"det_rot", (eVec1.Theta() * 180) / TMath::Pi(), (eVec1.Phi() * 180) / TMath::Pi(),
753 (eVec2.Theta() * 180) / TMath::Pi(), (eVec2.Phi() * 180) / TMath::Pi(),
754 (eVec3.Theta() * 180) / TMath::Pi(), (eVec3.Phi() * 180) / TMath::Pi());
763 TGeoGenTrans det_trans(o(0), o(1), o(2),
766 pseudo_res_0, pseudo_res_1, pseudo_res_2,
768 cov_shape->SetTransMatrix(det_trans);
772 cov_shape->SetMainTransparency(10);
773 eveTrack->AddElement(cov_shape);
779 const double cdcErrorScale = 1.0;
780 TEveGeoShape* cov_shape =
new TEveGeoShape(
"CDCRecoHit");
781 double pseudo_res_0 = cdcErrorScale *
std::sqrt(hit_cov(0, 0));
782 double pseudo_res_1 = plane_size;
783 if (wirepoint_hit) pseudo_res_1 = cdcErrorScale *
std::sqrt(hit_cov(1, 1));
785 cov_shape->SetShape(
new TGeoTube(std::max(0., (
double)(hit_u - pseudo_res_0)), hit_u + pseudo_res_0, pseudo_res_1));
786 fixGeoShapeRefCount(cov_shape);
787 TVector3 norm = u.Cross(v);
790 TGeoRotation det_rot(
"det_rot", (u.Theta() * 180) / TMath::Pi(), (u.Phi() * 180) / TMath::Pi(),
791 (norm.Theta() * 180) / TMath::Pi(), (norm.Phi() * 180) / TMath::Pi(),
792 (v.Theta() * 180) / TMath::Pi(), (v.Phi() * 180) / TMath::Pi());
793 TGeoCombiTrans det_trans(o(0) + hit_v * v.X(),
794 o(1) + hit_v * v.Y(),
795 o(2) + hit_v * v.Z(),
797 cov_shape->SetTransMatrix(det_trans);
801 cov_shape->SetMainTransparency(50);
802 eveTrack->AddElement(cov_shape);
810 auto& firstref = eveTrack->RefPathMarks().front();
811 auto& lastref = eveTrack->RefPathMarks().back();
812 double f = firstref.fV.Distance(recTrack.fV);
813 double b = lastref.fV.Distance(recTrack.fV);
814 if (f > 100 and f > b) {
815 B2WARNING(
"Decay vertex is much closer to POCA than first vertex, reversing order of track points... (this is intended for cosmic tracks, if you see this message in other context it might indicate a problem)");
817 lastref.fType = TEvePathMarkD::kReference;
818 firstref.fType = TEvePathMarkD::kDecay;
819 std::reverse(eveTrack->RefPathMarks().begin(), eveTrack->RefPathMarks().end());
822 eveTrack->SetTitle(TString::Format(
"%s\n"
827 isPruned ?
" yes" :
"no",
828 poca_momentum.
Pt(), poca_momentum.
Pz(),
832 eveTrack->SetLineStyle(1);
833 eveTrack->SetLineWidth(3.0);
853 TEveBox* box =
new TEveBox;
854 box->SetPickable(
true);
856 TVector3 norm = u.Cross(v);
859 norm *= (0.5 * depth);
862 for (
int k = 0; k < 8; ++k) {
865 int signU = ((k + 1) & 2) ? -1 : 1;
866 int signV = (k & 4) ? -1 : 1;
867 int signN = (k & 2) ? -1 : 1;
869 for (
int i = 0; i < 3; ++i) {
870 vertex[i] = o(i) + signU * u(i) + signV * v(i) + signN * norm(i);
872 box->SetVertex(k, vertex);
880 TEvePathMark::EType_e markType,
bool drawErrors,
int markerPos)
884 TVector3 pos, dir, oldPos, oldDir;
886 rep->
getPosDir(*prevState, oldPos, oldDir);
888 double distA = (pos - oldPos).Mag();
889 double distB = distA;
890 if ((pos - oldPos)*oldDir < 0)
892 if ((pos - oldPos)*dir < 0)
897 TEveVector(pos(0), pos(1), pos(2)),
898 TEveVector(dir(0), dir(1), dir(2))
900 eveTrack->AddPathMark(mark);
910 if (measuredState != NULL) {
915 eval = 0.2 * distA * oldDir;
917 eval = -0.2 * distB * dir;
922 TVector3 position, direction;
923 rep->
getPosMomCov(*measuredState, position, direction, cov);
926 TMatrixDSymEigen eigen_values(cov.GetSub(0, 2, 0, 2));
927 const TVectorD& ev = eigen_values.GetEigenValues();
928 const TMatrixD& eVec = eigen_values.GetEigenVectors();
929 TVector3 eVec1, eVec2;
931 static const double maxErr = 1000.;
932 double ev0 = std::min(ev(0), maxErr);
933 double ev1 = std::min(ev(1), maxErr);
934 double ev2 = std::min(ev(2), maxErr);
937 if (ev0 < ev1 && ev0 < ev2) {
938 eVec1.SetXYZ(eVec(0, 1), eVec(1, 1), eVec(2, 1));
940 eVec2.SetXYZ(eVec(0, 2), eVec(1, 2), eVec(2, 2));
942 }
else if (ev1 < ev0 && ev1 < ev2) {
943 eVec1.SetXYZ(eVec(0, 0), eVec(1, 0), eVec(2, 0));
945 eVec2.SetXYZ(eVec(0, 2), eVec(1, 2), eVec(2, 2));
948 eVec1.SetXYZ(eVec(0, 0), eVec(1, 0), eVec(2, 0));
950 eVec2.SetXYZ(eVec(0, 1), eVec(1, 1), eVec(2, 1));
954 if (eVec1.Cross(eVec2)*
eval < 0)
958 TVector3 oldEVec1(eVec1);
960 const int nEdges = 24;
961 std::vector<TVector3> vertices;
963 vertices.push_back(position);
966 for (
int i = 0; i < nEdges; ++i) {
967 const double angle = 2 * TMath::Pi() / nEdges * i;
968 vertices.push_back(position + cos(angle)*eVec1 + sin(angle)*eVec2);
974 newPlane->setO(position +
eval);
989 TMatrixDSymEigen eigen_values2(cov.GetSub(0, 2, 0, 2));
990 const TVectorD& eVal = eigen_values2.GetEigenValues();
991 const TMatrixD& eVect = eigen_values2.GetEigenVectors();
993 ev0 = std::min(eVal(0), maxErr);
994 ev1 = std::min(eVal(1), maxErr);
995 ev2 = std::min(eVal(2), maxErr);
998 if (ev0 < ev1 && ev0 < ev2) {
999 eVec1.SetXYZ(eVect(0, 1), eVect(1, 1), eVect(2, 1));
1001 eVec2.SetXYZ(eVect(0, 2), eVect(1, 2), eVect(2, 2));
1003 }
else if (ev1 < ev0 && ev1 < ev2) {
1004 eVec1.SetXYZ(eVect(0, 0), eVect(1, 0), eVect(2, 0));
1006 eVec2.SetXYZ(eVect(0, 2), eVect(1, 2), eVect(2, 2));
1009 eVec1.SetXYZ(eVect(0, 0), eVect(1, 0), eVect(2, 0));
1011 eVec2.SetXYZ(eVect(0, 1), eVect(1, 1), eVect(2, 1));
1012 } eVec2 *=
sqrt(ev1);
1015 if (eVec1.Cross(eVec2)*
eval < 0)
1019 if (oldEVec1 * eVec1 < 0) {
1025 double angle0 = eVec1.Angle(oldEVec1);
1026 if (eVec1 * (
eval.Cross(oldEVec1)) < 0)
1028 for (
int i = 0; i < nEdges; ++i) {
1029 const double angle = 2 * TMath::Pi() / nEdges * i - angle0;
1030 vertices.push_back(position + cos(angle)*eVec1 + sin(angle)*eVec2);
1033 vertices.push_back(position);
1036 TEveTriangleSet* error_shape =
new TEveTriangleSet(vertices.size(), nEdges * 2);
1037 for (
unsigned int k = 0; k < vertices.size(); ++k) {
1038 error_shape->SetVertex(k, vertices[k].X(), vertices[k].Y(), vertices[k].Z());
1041 assert(vertices.size() == 2 * nEdges + 2);
1044 for (
int i = 0; i < nEdges; ++i) {
1046 error_shape->SetTriangle(iTri++, i + 1, i + 1 + nEdges, (i + 1) % nEdges + 1);
1047 error_shape->SetTriangle(iTri++, (i + 1) % nEdges + 1, i + 1 + nEdges, (i + 1) % nEdges + 1 + nEdges);
1054 error_shape->SetMainTransparency(25);
1055 eveTrack->AddElement(error_shape);
1062 addSimHit(ROOT::Math::XYZVector(hit->getPosWire()), particle);
1067 const ROOT::Math::XYZVector& global_pos = geo.
get(hit->getSensorID()).
pointToGlobal(hit->getPosIn());
1073 const ROOT::Math::XYZVector& global_pos = geo.
get(hit->getSensorID()).
pointToGlobal(hit->getPosIn());
1078 const TVector3& global_pos = hit->getPosition();
1086 track->simhits->SetNextPoint(v.X(), v.Y(), v.Z());
1093 const TString pointsTitle(
"Unassigned SimHits");
1109 particle = particle->getMother();
1113 const ROOT::Math::XYZVector& p = particle->getMomentum();
1114 const ROOT::Math::XYZVector& vertex = particle->getProductionVertex();
1115 const int pdg = particle->getPDG();
1116 TParticle tparticle(pdg, particle->getStatus(),
1117 (particle->getMother() ? particle->getMother()->getIndex() : 0), 0, particle->getFirstDaughter(), particle->getLastDaughter(),
1118 p.X(), p.Y(), p.Z(), particle->getEnergy(),
1119 vertex.X(), vertex.Y(), vertex.Z(), particle->getProductionTime());
1120 TEveMCTrack mctrack;
1121 mctrack = tparticle;
1122 mctrack.fTDecay = particle->getDecayTime();
1123 mctrack.fVDecay.Set(
B2Vector3D(particle->getDecayVertex()));
1124 mctrack.fDecayed = !boost::math::isinf(mctrack.fTDecay);
1125 mctrack.fIndex = particle->getIndex();
1130 bool hasTrajectory(
false);
1131 for (
auto rel : mcTrajectories.relations()) {
1134 if (rel.weight <= 0)
continue;
1145 (&pt == &trajectory.
back()) ? TEvePathMark::kDecay : TEvePathMark::kReference,
1146 TEveVector(pt.x, pt.y, pt.z),
1147 TEveVector(pt.px, pt.py, pt.pz)
1151 hasTrajectory =
true;
1156 if (!hasTrajectory) {
1158 for (
int iDaughter = particle->getFirstDaughter(); iDaughter <= particle->getLastDaughter(); iDaughter++) {
1164 TEvePathMarkD refMark(TEvePathMarkD::kDaughter);
1165 refMark.fV.Set(
B2Vector3D(daughter->getProductionVertex()));
1166 refMark.fP.Set(
B2Vector3D(daughter->getMomentum()));
1167 refMark.fTime = daughter->getProductionTime();
1174 and mctrack.fDecayed) {
1175 TEvePathMarkD decayMark(TEvePathMarkD::kDecay);
1176 decayMark.fV.Set(
B2Vector3D(particle->getDecayVertex()));
1180 TString particle_name(mctrack.GetName());
1183 const MCParticle* mom = particle->getMother();
1190 if (!hasTrajectory) {
1193 title +=
"\n(track estimated from initial momentum)";
1239 MCTrack& mcTrack = mcTrackPair.second;
1240 if (mcTrack.
track) {
1241 if (mcTrack.
simhits->Size() > 0) {
1245 destroyEveElement(mcTrack.
simhits);
1252 parent = parentIt->second.track;
1255 parent->AddElement(mcTrack.
track);
1257 gEve->AddElement(mcTrack.
simhits);
1264 for (
size_t i = 0; i <
m_options.length(); i++) {
1271 m.SetMarkerStyle(1);
1303 if (groupPair.second.group)
1304 groupPair.second.visible = groupPair.second.group->GetRnrState();
1305 groupPair.second.group =
nullptr;
1317 float ecl_threshold = 0.01;
1319 ecl_threshold =
m_eclData->GetSliceThreshold(0);
1324 m_eclData->RefSliceInfo(0).Setup(
"ECL", ecl_threshold, kRed);
1330 gEve->GetSelection()->RemoveElements();
1331 gEve->GetHighlight()->RemoveElements();
1340 TVector3 v = vertex->getPos();
1345 vertexPoint->SetNextPoint(v.X(), v.Y(), v.Z());
1347 TMatrixDSymEigen eigen_values(vertex->getCov());
1349 det_shape->SetShape(
new TGeoSphere(0., 1.));
1350 fixGeoShapeRefCount(det_shape);
1351 const TVectorD& ev = eigen_values.GetEigenValues();
1352 const TMatrixD& eVec = eigen_values.GetEigenVectors();
1353 TVector3 eVec1(eVec(0, 0), eVec(1, 0), eVec(2,
1355 TVector3 eVec2(eVec(0, 1), eVec(1, 1), eVec(2,
1357 TVector3 eVec3(eVec(0, 2), eVec(1, 2), eVec(2, 2));
1361 TGeoRotation det_rot(
"det_rot", (eVec1.Theta() * 180) / TMath::Pi(), (eVec1.Phi() * 180) / TMath::Pi(),
1362 (eVec2.Theta() * 180) / TMath::Pi(), (eVec2.Phi() * 180) / TMath::Pi(),
1363 (eVec3.Theta() * 180) / TMath::Pi(), (eVec3.Phi() * 180) / TMath::Pi());
1376 TGeoGenTrans det_trans(v(0), v(1), v(2), pseudo_res_0, pseudo_res_1, pseudo_res_2,
1378 det_shape->SetTransMatrix(det_trans);
1381 det_shape->SetMainColor(kOrange);
1382 det_shape->SetMainTransparency(0);
1384 vertexPoint->AddElement(det_shape);
1396 const float phi = cluster->getPhi();
1397 float dPhi = cluster->getUncertaintyPhi();
1398 float dTheta = cluster->getUncertaintyTheta();
1399 if (dPhi >= M_PI / 4 or dTheta >= M_PI / 4 or cluster->getUncertaintyEnergy() == 1.0) {
1400 B2WARNING(
"Found ECL cluster with broken errors (unit matrix or too large). Using 0.05 as error in phi/theta. The 3x3 error matrix previously was:");
1401 cluster->getCovarianceMatrix3x3().Print();
1402 dPhi = dTheta = 0.05;
1405 if (!std::isfinite(dPhi) or !std::isfinite(dTheta)) {
1406 B2ERROR(
"ECLCluster phi or theta error is NaN or infinite, skipping cluster!");
1412 thetaLow.SetPtThetaPhi(1.0, cluster->getTheta() - dTheta, phi);
1414 thetaHigh.SetPtThetaPhi(1.0, cluster->getTheta() + dTheta, phi);
1415 float etaLow = thetaLow.Eta();
1416 float etaHigh = thetaHigh.Eta();
1417 if (etaLow > etaHigh) {
1418 std::swap(etaLow, etaHigh);
1421 int id =
m_eclData->AddTower(etaLow, etaHigh, phi - dPhi, phi + dPhi);
1429 const double layerThicknessCm = 3.16;
1430 const double layerDistanceCm = 9.1 - layerThicknessCm;
1433 ROOT::Math::XYZVector position = cluster->getClusterPosition();
1434 TVector3 startPos(position.X(), position.Y(), position.Z());
1437 bool isBarrel = (startPos.Z() > -175.0 and startPos.Z() < 270.0);
1440 b = TVector3(0, 0, 1);
1441 a = startPos.Cross(b).Unit();
1442 double c = M_PI / 4.0;
1443 double offset = c / 2.0 + M_PI;
1444 a.SetPhi(
int((a.Phi() + offset) / (c))*c - M_PI);
1445 TVector3 perp = b.Cross(a);
1447 const double barrelRadiusCm = 204.0;
1448 startPos.SetMag(barrelRadiusCm / perp.Dot(startPos.Unit()));
1450 dir = startPos.Unit();
1451 dir.SetMag((layerDistanceCm + layerThicknessCm) / perp.Dot(dir));
1454 b = TVector3(startPos.X(), startPos.Y(), 0).Unit();
1455 a = startPos.Cross(b).Unit();
1456 double endcapStartZ = 284;
1457 if (startPos.Z() < 0)
1458 endcapStartZ = -189.5;
1460 double scaleFac = endcapStartZ / startPos.Z();
1461 startPos.SetMag(startPos.Mag() * scaleFac);
1463 dir = startPos.Unit();
1464 dir.SetMag((layerDistanceCm + layerThicknessCm) / fabs(dir.Z()));
1467 for (
int i = 0; i < cluster->getLayers(); i++) {
1468 TVector3 layerPos = startPos;
1469 layerPos += (cluster->getInnermostLayer() + i) * dir;
1470 auto* layer =
boxCreator(layerPos, a, b, 20.0, 20.0, layerThicknessCm / 2);
1472 layer->SetMainTransparency(70);
1487 CLHEP::Hep3Vector global;
1494 CLHEP::Hep3Vector local = module->globalToLocal(global);
1499 double du = module->getPhiStripWidth() * Nphistrip;
1500 double dv = module->getZStripWidth() * Nztrip;
1503 CLHEP::Hep3Vector localU(local[0], local[1] + 1.0, local[2]);
1504 CLHEP::Hep3Vector localV(local[0], local[1], local[2] + 1.0);
1506 CLHEP::Hep3Vector globalU = module->localToGlobal(localU);
1507 CLHEP::Hep3Vector globalV = module->localToGlobal(localV);
1509 TVector3 o(global[0], global[1], global[2]);
1510 TVector3 u(globalU[0], globalU[1], globalU[2]);
1511 TVector3 v(globalV[0], globalV[1], globalV[2]);
1514 TEveBox* bklmbox =
boxCreator(o, u - o, v - o, du, dv, 1.0);
1516 bklmbox->SetMainColor(kGreen);
1518 bklmbox->SetName(
"BKLMHit2d");
1526 const double du = 2.0;
1527 const double dv = 2.0;
1528 ROOT::Math::XYZVector hitPosition = eklm2dhit->
getPosition();
1529 TVector3 o(hitPosition.X(), hitPosition.Y(), hitPosition.Z());
1530 TVector3 u(1.0, 0.0, 0.0);
1531 TVector3 v(0.0, 1.0, 0.0);
1532 TEveBox* eklmbox =
boxCreator(o, u, v, du, dv, 4.0);
1533 eklmbox->SetMainColor(kGreen);
1534 eklmbox->SetName(
"EKLMHit2d");
1543 VxdID sensorID = roi->getSensorID();
1546 double minU = aSensorInfo.
getUCellPosition(roi->getMinUid(), roi->getMinVid());
1548 double maxU = aSensorInfo.
getUCellPosition(roi->getMaxUid(), roi->getMaxVid());
1552 ROOT::Math::XYZVector localA(minU, minV, 0);
1553 ROOT::Math::XYZVector localB(minU, maxV, 0);
1554 ROOT::Math::XYZVector localC(maxU, minV, 0);
1556 ROOT::Math::XYZVector globalA = aSensorInfo.
pointToGlobal(localA);
1557 ROOT::Math::XYZVector globalB = aSensorInfo.
pointToGlobal(localB);
1558 ROOT::Math::XYZVector globalC = aSensorInfo.
pointToGlobal(localC);
1564 ROIbox->SetMainColor(kSpring - 9);
1565 ROIbox->SetMainTransparency(50);
1576 ROOT::Math::XYZVector a, b;
1577 if (hit->isUCluster()) {
1578 const float u = hit->getPosition();
1579 a = sensor.pointToGlobal(ROOT::Math::XYZVector(sensor.getBackwardWidth() / sensor.getWidth(0) * u, -0.5 * sensor.getLength(), 0.0));
1580 b = sensor.pointToGlobal(ROOT::Math::XYZVector(sensor.getForwardWidth() / sensor.getWidth(0) * u, +0.5 * sensor.getLength(), 0.0));
1582 const float v = hit->getPosition();
1583 a = sensor.pointToGlobal(ROOT::Math::XYZVector(-0.5 * sensor.getWidth(v), v, 0.0));
1584 b = sensor.pointToGlobal(ROOT::Math::XYZVector(+0.5 * sensor.getWidth(v), v, 0.0));
1587 lines->AddLine(a.X(), a.Y(), a.Z(), b.X(), b.Y(), b.Z());
1597 lines->AddLine(wire_pos_f.X(), wire_pos_f.Y(), wire_pos_f.Z(), wire_pos_b.X(), wire_pos_b.Y(), wire_pos_b.Z());
1608 TEveGeoShape* cov_shape =
new TEveGeoShape(
"cov_shape");
1612 driftLengthRes = std::max(driftLengthRes, 0.005);
1613 const double lengthOfWireSection = 3.0;
1616 const TVector3 zaxis = wire_pos_b - wire_pos_f;
1617 const TVector3 xaxis = zaxis.Orthogonal();
1618 const TVector3 yaxis = xaxis.Cross(zaxis);
1621 const TVector3 midPoint = wire_pos_f - zaxis * (wire_pos_f.Z() / zaxis.Z());
1623 cov_shape->SetShape(
new TGeoTube(std::max(0., (
double)(driftLength - driftLengthRes)), driftLength + driftLengthRes,
1624 lengthOfWireSection));
1625 fixGeoShapeRefCount(cov_shape);
1627 TGeoRotation det_rot(
"det_rot",
1628 xaxis.Theta() * 180 / TMath::Pi(), xaxis.Phi() * 180 / TMath::Pi(),
1629 yaxis.Theta() * 180 / TMath::Pi(), yaxis.Phi() * 180 / TMath::Pi(),
1630 zaxis.Theta() * 180 / TMath::Pi(), zaxis.Phi() * 180 / TMath::Pi()
1633 TGeoCombiTrans det_trans(midPoint(0), midPoint(1), midPoint(2), &det_rot);
1634 cov_shape->SetTransMatrix(det_trans);
1637 bool isPartOfTS =
false;
1639 if (showTriggerHits && segments.size() > 0) {
1643 if (hit->getISuperLayer() % 2 == 0) {
1645 cov_shape->SetMainColor(kCyan + 3);
1647 cov_shape->SetMainColor(kCyan);
1650 cov_shape->SetMainColor(kPink + 6);
1652 cov_shape->SetMainColor(kPink + 7);
1655 cov_shape->SetMainTransparency(50);
1657 cov_shape->SetTitle(
ObjectInfo::getInfo(hit) + TString::Format(
"\nWire ID: %d\nADC: %d\nTDC: %d",
1658 hit->getID(), hit->getADCCount(), hit->getTDCCount()));
1663 addToGroup(
"CDCTriggerSegmentHits", cov_shape);
1664 for (
auto rel : segments.relations()) {
1673 TEveStraightLineSet* shape =
new TEveStraightLineSet();
1677 if (hit->getPriorityPosition() < 3) iL -= 1;
1679 unsigned iCenter = hit->getIWire();
1680 if (hit->getPriorityPosition() == 1) iCenter += 1;
1691 std::vector<int> layershift = { -2, -1, 0, 1, 2};
1692 std::vector<std::vector<float>> cellshift = {
1706 if (hit->getISuperLayer() == 0) {
1707 layershift = { 0, 1, 2, 3, 4};
1712 { -1.5, -0.5, 0.5, 1.5},
1718 for (
unsigned il = 0; il < layershift.size(); ++il) {
1719 for (
unsigned ic = 0; ic < cellshift[il].size(); ++ic) {
1720 TVector3 corners[2][2];
1721 for (
unsigned ir = 0; ir < 2; ++ir) {
1722 double r = cdcgeo.
fieldWireR(iL + layershift[il] - ir);
1723 double fz = cdcgeo.
fieldWireFZ(iL + layershift[il] - ir);
1724 double bz = cdcgeo.
fieldWireBZ(iL + layershift[il] - ir);
1725 for (
unsigned iphi = 0; iphi < 2; ++iphi) {
1726 double phib = (iCenter + cellshift[il][ic] + iphi - 0.5) * 2 * M_PI / nWires;
1727 double phif = phib + cdcgeo.
nShifts(iL + layershift[il]) * M_PI / nWires;
1729 TVector3 pos_f = TVector3(cos(phif) * r, sin(phif) * r, fz);
1730 TVector3 pos_b = TVector3(cos(phib) * r, sin(phib) * r, bz);
1731 TVector3 zaxis = pos_b - pos_f;
1732 corners[ir][iphi] = pos_f - zaxis * (pos_f.Z() / zaxis.Z());
1736 shape->AddLine(corners[0][0].X(), corners[0][0].Y(), 0,
1737 corners[0][1].X(), corners[0][1].Y(), 0);
1738 shape->AddLine(corners[0][1].X(), corners[0][1].Y(), 0,
1739 corners[1][1].X(), corners[1][1].Y(), 0);
1740 shape->AddLine(corners[1][1].X(), corners[1][1].Y(), 0,
1741 corners[1][0].X(), corners[1][0].Y(), 0);
1742 shape->AddLine(corners[1][0].X(), corners[1][0].Y(), 0,
1743 corners[0][0].X(), corners[0][0].Y(), 0);
1747 if (hit->getISuperLayer() % 2 == 0) {
1748 shape->SetMainColor(kCyan + 3);
1750 shape->SetMainColor(kPink + 6);
1755 TString::Format(
"\nPriority: %d\nLeft/Right: %d",
1756 hit->getPriorityPosition(), hit->getLeftRight()));
1765 int hitModule = hit->getModule();
1766 float fi = arichGeo->getDetectorPlane().getSlotPhi(hitModule);
1768 TVector3 centerPos3D = hit->getPosition();
1770 TVector3 channelX(1, 0, 0); channelX.RotateZ(fi);
1771 TVector3 channelY(0, 1, 0); channelY.RotateZ(fi);
1773 auto* arichbox =
boxCreator(centerPos3D, arichGeo->getMasterVolume().momentumToGlobal(channelX),
1774 arichGeo->getMasterVolume().momentumToGlobal(channelY), 0.49, 0.49, 0.05);
1775 arichbox->SetMainColor(kOrange + 10);
1776 arichbox->SetName((std::to_string(hitModule)).c_str());
1785 std::map<int, int> m_topSummary;
1786 for (
const TOPDigit& hit : digits) {
1787 int mod = hit.getModuleID();
1788 ++m_topSummary[mod];
1791 for (
auto modCountPair : m_topSummary) {
1792 if (modCountPair.second > maxcount)
1793 maxcount = modCountPair.second;
1795 for (
auto modCountPair : m_topSummary) {
1797 double phi = topmod.getPhi();
1798 double r_center = topmod.getRadius();
1799 double z = topmod.getZc();
1801 TVector3 centerPos3D;
1802 centerPos3D.SetMagThetaPhi(r_center, M_PI / 2, phi);
1803 centerPos3D.SetZ(z);
1805 TVector3 channelX(1, 0, 0); channelX.RotateZ(phi);
1806 TVector3 channelY(0, 1, 0); channelY.RotateZ(phi);
1809 auto* moduleBox =
boxCreator(centerPos3D, channelX, channelY,
1810 3.0 * topmod.getBarThickness(), topmod.getBarWidth(), topmod.getBarLength());
1811 moduleBox->SetMainColor(kAzure + 10);
1812 double weight = double(modCountPair.second) / maxcount;
1813 moduleBox->SetMainTransparency(90 - weight * 50);
1814 moduleBox->SetName((
"TOP module " + std::to_string(modCountPair.first)).c_str());
1815 moduleBox->SetTitle(TString::Format(
"#TOPDigits: %d ", modCountPair.second));
1819 for (
const TOPDigit& hit : digits) {
1820 if (modCountPair.first == hit.getModuleID())
1829 for (
const auto& labelPair : displayData.
m_labels) {
1830 TEveText* text =
new TEveText(labelPair.first.c_str());
1831 text->SetName(labelPair.first.c_str());
1832 text->SetTitle(labelPair.first.c_str());
1833 text->SetMainColor(kGray + 1);
1834 const ROOT::Math::XYZVector& p = labelPair.second;
1835 text->PtrMainTrans()->SetPos(p.X(), p.Y(), p.Z());
1839 for (
const auto& pointPair : displayData.
m_pointSets) {
1840 TEvePointSet* points =
new TEvePointSet(pointPair.first.c_str());
1841 points->SetTitle(pointPair.first.c_str());
1842 points->SetMarkerStyle(7);
1843 points->SetMainColor(kGreen);
1844 for (
const auto& p : pointPair.second) {
1845 points->SetNextPoint(p.X(), p.Y(), p.Z());
1850 int randomColor = 2;
1851 for (
const auto& arrow : displayData.
m_arrows) {
1852 const ROOT::Math::XYZVector pos = arrow.start;
1853 const ROOT::Math::XYZVector dir = arrow.end - pos;
1854 TEveArrow* eveArrow =
new TEveArrow(dir.X(), dir.Y(), dir.Z(), pos.X(), pos.Y(), pos.Z());
1855 eveArrow->SetName(arrow.name.c_str());
1856 eveArrow->SetTitle(arrow.name.c_str());
1857 int arrowColor = arrow.color;
1858 if (arrowColor == -1) {
1859 arrowColor = randomColor;
1862 eveArrow->SetMainColor(arrowColor);
1865 TEveText* text =
new TEveText(arrow.name.c_str());
1866 text->SetMainColor(arrowColor);
1869 ROOT::Math::XYZVector orthogonalDir;
1870 if (std::abs(dir.X()) < std::abs(dir.Y())) {
1871 if (std::abs(dir.X()) < std::abs(dir.Z())) {
1872 orthogonalDir.SetCoordinates(0, dir.Z(), -dir.Y());
1874 orthogonalDir.SetCoordinates(dir.Y(), -dir.X(), 0);
1877 if (std::abs(dir.Y()) < std::abs(dir.Z())) {
1878 orthogonalDir.SetCoordinates(-dir.Z(), 0, dir.X());
1880 orthogonalDir.SetCoordinates(dir.Y(), -dir.X(), 0);
1883 const ROOT::Math::XYZVector& labelPos = pos + 0.5 * dir + 0.1 * orthogonalDir;
1884 text->PtrMainTrans()->SetPos(labelPos.X(), labelPos.Y(), labelPos.Z());
1885 eveArrow->AddElement(text);
1898 const std::string& groupName = boost::algorithm::trim_copy_if(name, boost::algorithm::is_any_of(
"/"));
1900 TEveElementList* group =
m_groups[groupName].group;
1902 group =
new TEveElementList(groupName.c_str(), groupName.c_str());
1903 group->SetRnrState(
m_groups[groupName].visible);
1908 auto lastSlash = boost::algorithm::find_last(groupName,
"/");
1910 const std::string parentGroup(groupName.begin(), lastSlash.begin());
1911 const std::string thisGroup(lastSlash.end(), groupName.end());
1912 group->SetElementName(thisGroup.c_str());
1915 gEve->AddElement(group);
1918 group->AddElement(elem);
Datastore class that holds photon hits. Input to the reconstruction.
DataType Pz() const
access variable Z (= .at(2) without boundary check)
DataType Mag() const
The magnitude (rho in spherical coordinate system).
DataType Pt() const
The transverse component (R in cylindrical coordinate system).
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
This class is used to transfer CDC information to the track fit.
Combination of several CDCHits to a track segment hit for the trigger.
Track created by the CDC trigger.
The Class for CDC Geometry Parameters.
int nShifts(int layerId) const
Returns number shift.
double fieldWireR(int layerId) const
Returns radius of field wire in each layer.
const B2Vector3D wireForwardPosition(uint layerId, int cellId, EWirePosition set=c_Base) const
Returns the forward position of the input sense wire.
const B2Vector3D wireBackwardPosition(uint layerId, int cellId, EWirePosition set=c_Base) const
Returns the backward position of the input sense wire.
unsigned nWiresInLayer(int layerId) const
Returns wire numbers in a layer.
double fieldWireBZ(int layerId) const
Returns backward z position of field wire in each layer.
double fieldWireFZ(int layerId) const
Returns forward z position of field wire in each layer.
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.
Translator mirroring the realistic Digitization.
double getDriftLength(unsigned short tdcCount, const WireID &wireID=WireID(), double timeOfFlightEstimator=0, bool leftRight=false, double z=0, double alpha=0, double theta=static_cast< double >(TMath::Pi()/2.), unsigned short adcCount=0) override
Get Drift length.
double getDriftLengthResolution(double driftLength, const WireID &wireID=WireID(), bool leftRight=false, double z=0, double alpha=0, double=static_cast< double >(TMath::Pi()/2.)) override
Get position resolution^2 corresponding to the drift length from getDriftLength of this class.
static const ChargedStable pion
charged pion particle
Class for accessing objects in the database.
Add custom information to the display.
std::vector< Arrow > m_arrows
List of arrows.
std::map< std::string, std::vector< ROOT::Math::XYZVector > > m_pointSets
name -> points map
std::vector< std::pair< std::string, ROOT::Math::XYZVector > > m_labels
text labels (to be shown at a given position).
@ c_nPhotons
CR is split into n photons (N1)
void clearEvent()
clear event data.
void setOptions(const std::string &opts)
Set the display options.
static constexpr double c_minPCut
don't show MCParticles with momentum below this cutoff.
void addTrackCandidateImproved(const std::string &collectionName, const RecoTrack &recoTrack)
Add a RecoTrack, but use stored genfit track representation to make visualisation objects.
EveVisBField * m_bfield
The global magnetic field.
TEveStraightLineSet * m_unassignedRecoHits
Unassigned recohits.
static const int c_recoHitColor
Color for reco hits.
void addCDCHit(const CDCHit *hit, bool showTriggerHits=false)
show CDCHits directly.
std::map< const MCParticle *, MCTrack > m_mcparticleTracks
map MCParticles to MCTrack (so hits can be added to the correct track).
void addBKLMHit2d(const KLMHit2d *bklm2dhit)
Add a reconstructed 2d hit in the BKLM.
EVEVisualization()
Constructor.
void setErrScale(double errScale=1.)
Set the scaling factor for the visualization of track hit errors.
bool m_drawRefTrack
Draw reference track in addTrack.
void addVertex(const genfit::GFRaveVertex *vertex)
Add a vertex point and its covariance matrix.
bool m_drawForward
draw forward in addTrack
TEveCalo3D * m_calo3d
Object for the energy bar visualisation.
bool m_drawCardinalRep
Draw cardinal representation in addTrack.
void addCDCTriggerTrack(const std::string &collectionName, const CDCTriggerTrack &track)
Add a CDCTriggerTrack.
void addCDCTriggerSegmentHit(const std::string &collectionName, const CDCTriggerSegmentHit *hit)
show outline of track segments.
TEveTrackPropagator * m_trackpropagator
Track propagator for MCParticles.
std::map< std::string, ElementGroup > m_groups
name -> grouping element.
void addSimHit(const CDCSimHit *hit, const MCParticle *particle)
Add a CDCSimHit.
void addECLCluster(const ECLCluster *cluster)
Add a reconstructed cluster in the ECL.
TEveTrackList * m_tracklist
parent object for MC tracks.
void addToGroup(const std::string &name, TEveElement *elem)
Add 'elem' to the element group 'name' (created if necessary).
void makeTracks()
Create visual representation of all tracks.
void addRecoHit(const SomeVXDHit *hit, TEveStraightLineSet *lines)
adds given VXD hit to lines.
void addTrack(const Belle2::Track *belle2Track)
Add this genfit::Track to event data.
bool m_unassignedRecoHitsVisibility
is m_unassignedRecoHits visible?
static const int c_trackMarkerColor
Color for track markers.
TEveTrackPropagator * m_gftrackpropagator
Track propagator for genfit::Tracks (different mainly because of drawing options)
std::string m_options
Option string for genfit::Track visualisation.
static const int c_trackColor
Color for tracks.
static const int c_unassignedHitColor
Color for unassigned (reco)hits.
bool m_hideSecondaries
If true, secondary MCParticles (and hits created by them) will not be shown.
void addEKLMHit2d(const KLMHit2d *eklm2dhit)
Add a reconstructed 2d hit in the EKLM.
TEveBox * boxCreator(const TVector3 &o, TVector3 u, TVector3 v, float ud, float vd, float depth)
Create a box around o, oriented along u and v with widths ud, vd and depth and return a pointer to th...
void addARICHHit(const ARICHHit *hit)
Add recontructed hit in ARICH.
void showUserData(const DisplayData &displayData)
Add user-defined data (labels, points, etc.)
std::set< const TObject * > m_shownRecohits
List of shown recohits (PXDCluster, SVDCluster, CDCHit).
bool m_drawBackward
draw backward in addTrack
TEveTrackPropagator * m_consttrackpropagator
Track propagator for CDCTriggerTracks (uses constant B field)
bool m_assignToPrimaries
If true, hits created by secondary particles (e.g.
~EVEVisualization()
Destructor.
bool m_drawErrors
Draw errors in addTrack.
double m_errorScale
Rescale PXD/SVD errors with this factor to ensure visibility.
void addTOPDigits(const StoreArray< TOPDigit > &digits)
Add TOPDigits (shown aggregated per module).
void addROI(const ROIid *roi)
Add a Region Of Interest, computed by the PXDDataReduction module.
void addKLMCluster(const KLMCluster *cluster)
Add a reconstructed cluster in the KLM.
static const int c_klmClusterColor
Color for KLMCluster objects.
MCTrack * addMCParticle(const MCParticle *particle)
Return MCTrack for given particle, add it if it doesn't exist yet.
TEveCaloDataVec * m_eclData
ECL cluster data.
static const int c_recoTrackColor
Color for TrackCandidates.
void addTrackCandidate(const std::string &collectionName, const RecoTrack &recoTrack)
Add a RecoTrack, to evaluate track finding.
void addObject(const TObject *dataStoreObject, TEveElement *visualRepresentation)
Generic function to keep track of which objects have which visual representation.
void makeLines(TEveTrack *eveTrack, const genfit::StateOnPlane *prevState, const genfit::StateOnPlane *state, const genfit::AbsTrackRep *rep, TEvePathMark::EType_e markType, bool drawErrors, int markerPos=1)
Create hit visualisation for the given options, and add them to 'eveTrack'.
Provide magnetic field values for TEveTrackPropagator.
int getLayer() const
Get layer number.
int getZStripMax() const
Get last strip number for z plane.
int getSection() const
Get section number.
float getPositionZ() const
Get hit global position z coordinate.
int getSector() const
Get sector number.
float getPositionX() const
Set hit global position.
int getPhiStripMin() const
Get strip number for phi plane.
int getZStripMin() const
Get strip number for z plane.
ROOT::Math::XYZVector getPosition() const
Get hit global position.
int getPhiStripMax() const
Get last strip number for phi plane.
float getPositionY() const
Get hit global position y coordinate.
Class to save the full simulated trajectory of a particle.
const MCTrajectoryPoint & back() const
return reference to the last point
A Class to store the Monte Carlo particle information.
@ c_PrimaryParticle
bit 0: Particle is primary particle.
@ c_StoppedInDetector
bit 3: Particle was stopped in the detector (the simulation volume).
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
Class PXDSimHit - Geant4 simulated hit for the PXD.
ROIid stores the U and V ids and the sensor id of the Region Of Interest.
This is the Reconstruction Event-Data Model Track.
std::vector< Belle2::RecoTrack::UsedSVDHit * > getSVDHitList() const
Return an unsorted list of svd hits.
ROOT::Math::XYZVector getPositionSeed() const
Return the position seed stored in the reco track. ATTENTION: This is not the fitted position.
std::vector< Belle2::RecoTrack::UsedPXDHit * > getPXDHitList() const
Return an unsorted list of pxd hits.
std::vector< Belle2::RecoTrack::UsedCDCHit * > getCDCHitList() const
Return an unsorted list of cdc hits.
const genfit::TrackPoint * getCreatedTrackPoint(const RecoHitInformation *recoHitInformation) const
Get a pointer to the TrackPoint that was created from this hit.
std::vector< RecoHitInformation * > getRecoHitInformations(bool getSorted=false) const
Return a list of all RecoHitInformations associated with the RecoTrack.
short int getChargeSeed() const
Return the charge seed stored in the reco track. ATTENTION: This is not the fitted charge.
ROOT::Math::XYZVector getMomentumSeed() const
Return the momentum seed stored in the reco track. ATTENTION: This is not the fitted momentum.
T * getRelated(const std::string &name="", const std::string &namedRelation="") const
Get the object to or from which this object has a relation.
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
SVDRecoHit - an extended form of SVDHit containing geometry information.
bool isU() const
Is the coordinate u or v?
VxdID getSensorID() const
Get the compact ID.
Class SVDSimHit - Geant4 simulated hit for the SVD.
Class to store TOP digitized hits (output of TOPDigitizer or raw data unpacker) relations to TOPSimHi...
const TOPGeometry * getGeometry() const
Returns pointer to geometry object using basf2 units.
static TOPGeometryPar * Instance()
Static method to obtain the pointer to its instance.
Values of the result of a track fit with a given particle hypothesis.
Helix getHelix() const
Conversion to framework Helix (without covariance).
short getChargeSign() const
Return track charge (1 or -1).
double getPValue() const
Getter for Chi2 Probability of the track fit.
ROOT::Math::XYZVector getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
ROOT::Math::XYZVector getPosition() const
Getter for vector of position at closest approach of track in r/phi projection.
Class that bundles various TrackFitResults.
const TrackFitResult * getTrackFitResultWithClosestMass(const Const::ChargedStable &requestedType) const
Return the track fit for a fit hypothesis with the closest mass.
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
static GeoCache & getInstance()
Return a reference to the singleton instance.
static const SensorInfoBase & get(Belle2::VxdID id)
Return a reference to the SensorInfo of a given SensorID.
Base class to provide Sensor Information for PXD and SVD.
double getVCellPosition(int vID) const
Return the position of a specific strip/pixel in v direction.
double getUCellPosition(int uID, int vID=-1) const
Return the position of a specific strip/pixel in u direction.
ROOT::Math::XYZVector pointToGlobal(const ROOT::Math::XYZVector &local, bool reco=false) const
Convert a point from local to global coordinates.
void addCluster(const TObject *dataStoreObject, TEveCaloData *caloData, int towerID)
Selection inside TEveCalo* is complicated, use this to keep track of ECL clusters.
static VisualRepMap * getInstance()
get instance pointer.
void clear()
Remove all contents in map.
void add(const TObject *dataStoreObject, TEveElement *visualRepresentation)
Generic function to keep track of which objects have which visual representation.
Class to uniquely identify a any structure of the PXD and SVD.
Class to identify a wire inside the CDC.
unsigned short getICLayer() const
Getter for continuous layer numbering.
Provides BKLM geometry parameters for simulation, reconstruction etc (from Gearbox or DataBase)
const Module * findModule(int section, int sector, int layer) const
Get the pointer to the definition of a module.
static GeometryPar * instance(void)
Static method to get a reference to the singleton GeometryPar instance.
Define the geometry of a BKLM module Each sector [octant] contains Modules.
This class collects all information needed and produced by a specific AbsFitter and is specific to on...
Contains the measurement and covariance in raw detector coordinates.
Abstract base class for a track representation.
void getPosDir(const StateOnPlane &state, TVector3 &pos, TVector3 &dir) const
Get cartesian position and direction vector of a state.
virtual double extrapolateToPlane(StateOnPlane &state, const genfit::SharedPlanePtr &plane, bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
Extrapolates the state to plane, and returns the extrapolation length and, via reference,...
virtual TVector3 getPos(const StateOnPlane &state) const =0
Get the cartesian position of a state.
virtual void getPosMomCov(const MeasuredStateOnPlane &state, TVector3 &pos, TVector3 &mom, TMatrixDSym &cov) const =0
Translates MeasuredStateOnPlane into 3D position, momentum and 6x6 covariance.
Exception class for error handling in GENFIT (provides storage for diagnostic information)
Class where important numbers and properties of a fit can be stored.
bool isTrackPruned() const
Has the track been pruned after the fit?
Collects information needed and produced by a GblFitter/GBL and is specific to one AbsTrackRep of the...
const MeasuredStateOnPlane & getFittedState(bool afterKink=true) const override
Get the prediction at this point Always biased in GBL (global fit) There are 2 states,...
MeasurementOnPlane getMeasurement() const
Get the measurement on plane from stored measurement data (from last construction/update)
StateOnPlane getReferenceState() const
Returns (copy of) the stored reference 5D state at current plane with internal rep.
Collects information needed and produced by a AbsKalmanFitter implementations and is specific to one ...
#StateOnPlane with additional covariance matrix.
Measured coordinates on a plane.
Measurement class implementing a planar hit geometry (1 or 2D).
Class for measurements implementing a space point hit geometry.
A state with arbitrary dimension defined in a DetPlane.
Object containing AbsMeasurement and AbsFitterInfo objects.
AbsFitterInfo * getFitterInfo(const AbsTrackRep *rep=nullptr) const
Get fitterInfo for rep. Per default, use cardinal rep.
Class for measurements in wire detectors (Straw tubes and drift chambers) which do not measure the co...
Class for measurements in wire detectors (Straw tubes and drift chambers) which do not measure the co...
Class for measurements in wire detectors (Straw tubes and drift chambers) which can measure the coord...
static constexpr auto XYZToTVector
Helper function to convert XYZVector to TVector3.
B2Vector3< double > B2Vector3D
typedef for common usage with double
double sqrt(double a)
sqrt for double
const TOPGeoModule & getModule(int moduleID) const
Returns module.
double eval(const std::vector< double > &spl, const std::vector< double > &vals, double x)
Evaluate spline (zero order or first order) in point x.
double getMaxR()
find a point that is inside the top node.
TString getIdentifier(const TObject *obj)
Where is this object in the datastore?
TString getInfo(const TObject *obj)
Get object info HTML (e.g.
TString getTitle(const TObject *obj)
Get plain text for TEve object titles (shown on mouse-over).
Implements a colour palette, see http://sobac.com/sobac/tangocolors.htm.
int getTColorID(const std::string &tangoName, int tangoId=1)
Get TColor ID for given name in tango colour palette.
Abstract base class for different kinds of events.
Defines for I/O streams used for error and debug printing.
std::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.
Hold MC tracks and associated visualisation objects.
TEvePointSet * simhits
simhit positions.
const MCParticle * parentParticle
parent particle, or nullptr.
TEveTrack * track
the actual MC track.
Small struct to encode a position/momentum without additional overhead.