File indexing completed on 2026-11-28 09:20:47
0001
0002
0003
0004 #include "TransformLocalFFFrameToLabFrame.h"
0005
0006 #include <Math/GenVector/Cartesian3D.h>
0007 #include <Math/GenVector/DisplacementVector3D.h>
0008 #include <Math/GenVector/RotationY.h>
0009 #include <Math/Vector3Dfwd.h>
0010 #include <edm4eic/unit_system.h>
0011 #include <edm4hep/Vector3f.h>
0012 #include <edm4hep/utils/vector_utils.h>
0013 #include <tuple>
0014
0015 #include "TransformLocalFFFrameToLabFrameConfig.h"
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 void eicrecon::TransformLocalFFFrameToLabFrame::process(
0028 const TransformLocalFFFrameToLabFrame::Input& input,
0029 const TransformLocalFFFrameToLabFrame::Output& output) const {
0030
0031 const auto [ff_particles_local_frame] = input;
0032 auto [ff_particles_lab_frame] = output;
0033
0034 double rotationAngleY = m_cfg.m_crossing_angle;
0035 ROOT::Math::RotationY rotationAboutY(rotationAngleY);
0036
0037 for (const auto& localParticle : *ff_particles_local_frame) {
0038 const auto& rp = localParticle.getReferencePoint();
0039 if (edm4hep::utils::magnitude(rp) > 1e-6 * edm4eic::unit::mm) {
0040 warning("Non-origin referencePoint ({}, {}, {}) mm is left un-rotated; "
0041 "lab-frame position will be inconsistent with the rotated momentum",
0042 rp.x, rp.y, rp.z);
0043 }
0044 auto labParticle = localParticle.clone();
0045
0046 const auto& localFrameVector = localParticle.getMomentum();
0047 ROOT::Math::XYZVector labFrameVector = rotationAboutY(
0048 ROOT::Math::XYZVector(localFrameVector.x, localFrameVector.y, localFrameVector.z));
0049
0050 labParticle.setMomentum({static_cast<float>(labFrameVector.X()),
0051 static_cast<float>(labFrameVector.Y()),
0052 static_cast<float>(labFrameVector.Z())});
0053
0054 labParticle.addToParticles(localParticle);
0055 ff_particles_lab_frame->push_back(labParticle);
0056 }
0057 }