Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-06-26 07:05:01

0001 #include <cassert>
0002 #include <cmath>
0003 #include <iostream>
0004 #include <map>
0005 
0006 #include <CLHEP/Vector/Boost.h>
0007 #include <CLHEP/Vector/LorentzRotation.h>
0008 #include <CLHEP/Vector/LorentzVector.h>
0009 #include <CLHEP/Vector/Rotation.h>
0010 #include <CLHEP/Vector/ThreeVector.h>
0011 
0012 #include "Afterburner.hh"
0013 
0014 
0015 static void RotY(double theta, double xin, double yin, double zin, double *xout, double *yout, double *zout) {
0016 
0017     *xout = xin*cos(theta) + zin*sin(theta);
0018     *yout = yin;
0019     *zout = zin*cos(theta) - xin*sin(theta);
0020 }
0021 
0022 
0023 static void RotXY(double theta, double phi, double xin, double yin, double zin, double *xout, double *yout, double *zout) {
0024 
0025     *xout = xin*cos(theta) + zin*sin(theta);
0026     *yout = xin*sin(phi)*sin(theta) + yin*cos(phi) - zin*sin(phi)*cos(theta);
0027     *zout = yin*sin(phi) - xin*cos(phi)*sin(theta) + zin*cos(phi)*cos(theta);
0028 }
0029 
0030 
0031 ab::Afterburner::Afterburner() : _smear(1) {}
0032 
0033 CLHEP::HepLorentzVector ab::Afterburner::move_vertex(const CLHEP::HepLorentzVector &init_vtx) {
0034 
0035     double x = init_vtx.x() + _smear.smear(_cfg.vertex_shift_x, _cfg.vertex_smear_width_x, _cfg.vertex_smear_func);
0036     double y = init_vtx.y() + _smear.smear(_cfg.vertex_shift_y, _cfg.vertex_smear_width_y, _cfg.vertex_smear_func);
0037     double z = init_vtx.z() + _smear.smear(_cfg.vertex_shift_z, _cfg.vertex_smear_width_z, _cfg.vertex_smear_func);
0038     double t = init_vtx.t() + _smear.smear(_cfg.vertex_shift_t, _cfg.vertex_smear_width_t, _cfg.vertex_smear_func);
0039     return CLHEP::HepLorentzVector {x, y, z, t};
0040 }
0041 
0042 //! use m_beam_bunch_width to calculate horizontal and vertical collision width
0043 //! \param[in] hv_index 0: horizontal. 1: vertical
0044 //! https://github.com/eic/documents/blob/d06b5597a0a89dcad215bab50fe3eefa17a097a5/reports/general/Note-Simulations-BeamEffects.pdf
0045 double ab::Afterburner::get_collision_width(const double widthA, const double widthB)
0046 {
0047     return widthA * widthB / sqrt(widthA * widthA + widthB * widthB);
0048 }
0049 
0050 
0051 //! generate vertx with bunch interaction according to
0052 //! https://github.com/eic/documents/blob/d06b5597a0a89dcad215bab50fe3eefa17a097a5/reports/general/Note-Simulations-BeamEffects.pdf
0053 //! \return pair of bunch local z position for beam A and beam B
0054 ab::BunchInteractionResult ab::Afterburner::generate_vertx_with_bunch_interaction()
0055 {
0056     using namespace std;
0057 
0058     // Set particle positions
0059     double hadron_z = _smear.gauss(_cfg.hadron_beam.rms_bunch_length);
0060     double lepton_z = _smear.gauss(_cfg.lepton_beam.rms_bunch_length);
0061     double crossing_angle = _cfg.crossing_angle_hor;
0062 
0063     double had_bunch_rms_hor = sqrt(_cfg.hadron_beam.beta_star_hor * _cfg.hadron_beam.rms_emittance_hor);
0064     double had_bunch_rms_ver = sqrt(_cfg.hadron_beam.beta_star_ver * _cfg.hadron_beam.rms_emittance_ver);
0065     double lep_bunch_rms_hor = sqrt(_cfg.lepton_beam.beta_star_hor * _cfg.lepton_beam.rms_emittance_hor);
0066     double lep_bunch_rms_ver = sqrt(_cfg.lepton_beam.beta_star_ver * _cfg.lepton_beam.rms_emittance_ver);
0067     double sigma_hor = get_collision_width(had_bunch_rms_hor, lep_bunch_rms_hor);
0068     double sigma_ver = get_collision_width(had_bunch_rms_ver, lep_bunch_rms_ver);
0069 
0070     // Find Collision time, z position of collision, z position of center of hadron bunch at collision time and x position of collision
0071     // Quantities are found via a system of parametric equations
0072     // Z position of colliding hadron as a function of time: Z_h = Cos(0.5*theta_c)*t + Z_h_offset (Z_h_offset = distance from center of bunch)
0073     // Z position of colliding lepton as a function of time: Z_l = -Cos(0.5*theta_c)*t + Z_l_offset
0074     // Collision time when Z_h = Z_l -> t_int = (Z_l_offset - Z_h_offset)/(2*Cos(0.5*theta_c))
0075     // Z position of collision: Z_int = (Z_l_offset + Z_h_offset)/2
0076     // Z position of center of hadron bunch a collision time - this gives x position of collision via relation x = z*Tan(0.5*theta_c)
0077     // Z_bunch_int = Cos(0.5*theta_c)*t_int
0078     // X_int = Z_bunch_int * Tan(0.5*theta_c)
0079 
0080     double c_c = cos(crossing_angle/2.0);
0081     double s_c = sin(crossing_angle/2.0);
0082     double t_c = tan(crossing_angle/2.0);
0083 
0084     double t_int = (lepton_z - hadron_z)/(2.0*c_c);
0085     double z_int = (lepton_z + hadron_z)/2.0;
0086     double z_bunch_int = c_c*t_int;
0087     double x_int = z_bunch_int*t_c;
0088 
0089     // x_int is the x position of collision assuming the colliding particles are in the center of the bunch. Sample random x position according to x-width of bunches. x_int is then an offset to this. Get y position as well.
0090 
0091     double y_int = 0.;
0092     if(abs(sigma_hor) > 1e-9)
0093     {
0094         x_int += _smear.gauss(sigma_hor);
0095     }
0096 
0097     if(abs(sigma_ver) > 1e-9)
0098     {
0099         y_int += _smear.gauss(sigma_ver);
0100     }
0101 
0102     // We now have the x-y-z position of the collision in the accelerator frame, but we want it in the detector frame. Rotate by 0.5*theta_c to get to accelerator frame
0103 
0104     double tmpVtxX, tmpVtxY, tmpVtxZ;
0105     tmpVtxX = tmpVtxY = tmpVtxZ = 0.;
0106 
0107     RotY(crossing_angle/2.0,x_int,y_int,z_int,&tmpVtxX,&tmpVtxY,&tmpVtxZ);
0108 
0109     CLHEP::Hep3Vector collision_center(tmpVtxX, tmpVtxY, tmpVtxZ);
0110     ab::BunchInteractionResult result;
0111     result.vertex.set(collision_center, t_int);
0112     result.bunch_one_z = hadron_z;
0113     result.bunch_two_z = lepton_z;
0114 
0115 //
0116 //    //  const static CLHEP::Hep3Vector z_axis(0, 0, 1);
0117 //    const static CLHEP::Hep3Vector y_axis(0, 1, 0);
0118 //
0119 //    // the final longitudinal vertex smear axis
0120 //    CLHEP::Hep3Vector beamCenterDiffAxis = (beamA_center - beamB_center);
0121 //    assert(beamCenterDiffAxis.mag() > CLHEP::Hep3Vector::getTolerance());
0122 //    beamCenterDiffAxis = beamCenterDiffAxis / beamCenterDiffAxis.mag();
0123 //
0124 //    CLHEP::Hep3Vector vec_crossing = beamA_center - 0.5 * (beamA_center - beamB_center);
0125 //
0126 //    CLHEP::Hep3Vector vec_longitudinal_collision = beamCenterDiffAxis * (hadron_z + lepton_z) / 2.;
0127 //    double ct_collision = 0.5 * (-hadron_z + lepton_z) / beamCenterDiffAxis.dot(beamA_center);
0128 //    double t_collision = ct_collision ;//* CLHEP::mm / CLHEP::c_light / CLHEP::ns;
0129 //    CLHEP::Hep3Vector vec_crossing_collision = ct_collision * vec_crossing;  // shift of collision to crossing direction
0130 //
0131 //    CLHEP::Hep3Vector horizontal_axis = y_axis.cross(beamCenterDiffAxis);
0132 //    assert(horizontal_axis.mag() > CLHEP::Hep3Vector::getTolerance());
0133 //    horizontal_axis = horizontal_axis.unit();
0134 //
0135 //    CLHEP::Hep3Vector vertical_axis = beamCenterDiffAxis.cross(horizontal_axis);
0136 //    assert(vertical_axis.mag() > CLHEP::Hep3Vector::getTolerance());
0137 //    vertical_axis = vertical_axis.unit();
0138 //
0139 //
0140 //
0141 //
0142 //    double bunch_x = _smear.smear(0, sigma_hor);
0143 //    CLHEP::Hep3Vector vec_horizontal_collision_vertex_smear = horizontal_axis * bunch_x;
0144 //
0145 //    double bunch_y = _smear.smear(0, sigma_ver);
0146 //    CLHEP::Hep3Vector vec_vertical_collision_vertex_smear = vertical_axis * bunch_y;
0147 //
0148 //    CLHEP::Hep3Vector vec_collision_vertex =
0149 //            vec_horizontal_collision_vertex_smear +
0150 //            vec_vertical_collision_vertex_smear +  //
0151 //            vec_crossing_collision + vec_longitudinal_collision;
0152 //
0153 //    ab::BunchInteractionResult result;
0154 //    result.vertex.set(vec_collision_vertex, t_collision);
0155 //    result.bunch_one_z = hadron_z;
0156 //    result.bunch_two_z = lepton_z;
0157 //
0158 //
0159 //    if (m_verbosity)
0160 //    {
0161 //        cout << __PRETTY_FUNCTION__
0162 //             << ":\n  "
0163 //             << "bunch_one_z = " << result.bunch_one_z << ", "
0164 //             << "bunch_two_z = " << result.bunch_two_z<< ", "
0165 //             << "cos(theta/2) = " << beamCenterDiffAxis.dot(beamA_center) << ",\n  "
0166 //
0167 //             << "beamCenterDiffAxis = " << beamCenterDiffAxis << ", "
0168 //             << "vec_crossing = " << vec_crossing << ", "
0169 //             << "horizontal_axis = " << horizontal_axis << ", "
0170 //             << "vertical_axis = " << vertical_axis << ",\n  "
0171 //
0172 //             << "vec_longitudinal_collision = " << vec_longitudinal_collision << ", "
0173 //             << "vec_crossing_collision = " << vec_crossing_collision << ", "
0174 //             << "vec_vertical_collision_vertex_smear = " << vec_vertical_collision_vertex_smear << ", "
0175 //             << "vec_horizontal_collision_vertex_smear = " << vec_horizontal_collision_vertex_smear << ",\n "
0176 //
0177 //             << "vec_collision_vertex = " << vec_collision_vertex << ",\n  "
0178 //
0179 //             << "ct_collision = " << ct_collision << ", "
0180 //             << "t_collision = " << t_collision << ", "
0181 //             << endl;
0182 //    }
0183 
0184     return result;
0185 }
0186 
0187 /// function to convert spherical coordinate to Hep3Vector in x-y-z
0188 CLHEP::Hep3Vector ab::Afterburner::spherical_to_cartesian(const double theta, const double phi) {
0189     return {sin(theta) * cos(phi),
0190             sin(theta) * sin(phi),
0191             cos(theta)};
0192 }
0193 
0194 // function to do angular shifts relative to central beam angle
0195 CLHEP::Hep3Vector ab::Afterburner::smear_beam_divergence(const CLHEP::Hep3Vector &beam_dir, const ab::BeamConfig& beam_cfg, const double vtx_z, const double crab_hor, const double crab_ver) {
0196 
0197     // y direction in accelerator
0198     static const CLHEP::Hep3Vector accelerator_plane(0, 1, 0);
0199 
0200     // Horizontal
0201     double horizontal_angle = vtx_z * crab_hor;                                     // horizontal angle 0
0202     horizontal_angle = _smear.smear(horizontal_angle, beam_cfg.divergence_hor, SmearFuncs::Gauss);    // smear horizontal angle
0203     CLHEP::HepRotation x_smear_in_accelerator_plane(accelerator_plane, horizontal_angle);      // central horizontal angle shift
0204 
0205 
0206     // Vertical
0207     /*
0208     // Calculate angular deflection
0209     double crabAngHad = ((mXAngle/2.0)*hadronPartPos)/(TMath::Sqrt(betaCrabHad*betaStarHad));
0210     double crabAngLep = ((mXAngle/2.0)*leptonPartPos)/(TMath::Sqrt(betaCrabLep*betaStarLep));
0211 
0212     // Calculate Magnitude of Px kick
0213     double crabKickHad = (mIonBeamEnergy + tmpPzA)*TMath::Sin(crabAngHad);
0214     double crabKickLep = (-1.0)*(mLeptonBeamEnergy + tmpPzB)*TMath::Sin(crabAngLep); //
0215 
0216     // Rotate Momentum Kick into Detector Frame
0217     double tmpVertPxA, tmpVertPyA, tmpVertPzA;
0218     double tmpVertPxB, tmpVertPyB, tmpVertPzB;
0219     tmpVertPxA = tmpVertPyA = tmpVertPzA = tmpVertPxB = tmpVertPyB = tmpVertPzB = 0.;
0220 
0221     RotY(mXAngle/2.0,crabKickHad,0.,0.,&tmpVertPxA,&tmpVertPyA,&tmpVertPzA);
0222     RotY(mXAngle/2.0,crabKickLep,0.,0.,&tmpVertPxB,&tmpVertPyB,&tmpVertPzB)
0223     */
0224 
0225     double vertical_angle =  -vtx_z * crab_ver;                                             // vertical angle 0
0226     vertical_angle = _smear.smear(vertical_angle, beam_cfg.divergence_ver, SmearFuncs::Gauss);   // smear vertical angle
0227     auto out_accelerator_plane = accelerator_plane.cross(beam_dir);                             // vertical out acc plane
0228     CLHEP::HepRotation y_smear_out_accelerator_plane(out_accelerator_plane, vertical_angle);    // central vertical angle shift
0229 
0230     // Resulting
0231     return y_smear_out_accelerator_plane * x_smear_in_accelerator_plane * beam_dir;
0232 }
0233 
0234 
0235 ab::AfterburnerEventResult ab::Afterburner::process_event() {
0236     return process_event(CLHEP::HepLorentzVector(0,0,0,0));
0237 }
0238 
0239 //! move vertex in translation,boost,rotation according to vertex settings
0240 ab::AfterburnerEventResult ab::Afterburner::process_event(const CLHEP::HepLorentzVector &init_vtx) {
0241     using namespace std;
0242 
0243     if (m_verbosity) {
0244         print();
0245     }
0246 
0247     AfterburnerEventResult result;
0248 
0249     // now handle the collision vertex first, in the head-on collision frame
0250     // this is used as input to the Crab angle correction
0251     double bunch_one_z;
0252     double bunch_two_z;
0253     if (_cfg.use_beam_bunch_sim)
0254     {
0255         // bunch interaction simulation
0256         auto bunch_interaction = generate_vertx_with_bunch_interaction();
0257         result.vertex = bunch_interaction.vertex;
0258         bunch_one_z = bunch_interaction.bunch_one_z;
0259         bunch_two_z = bunch_interaction.bunch_two_z;
0260     }
0261     else
0262     {
0263         // vertex distribution simulation
0264         // now handle the collision vertex first, in the head-on collision frame
0265         // this is used as input to the Crab angle correction
0266         result.vertex = move_vertex(init_vtx);
0267         bunch_one_z = bunch_two_z = result.vertex.z();
0268     }
0269 
0270     // boost-rotation from beam angles
0271     const static CLHEP::Hep3Vector z_axis(0, 0, 1);
0272     const static CLHEP::Hep3Vector y_axis(0, 1, 0);
0273 
0274     //CLHEP::Hep3Vector ideal_hadron_dir = spherical_to_cartesian(_cfg.hadron_beam.direction_theta, _cfg.hadron_beam.direction_phi);
0275     //CLHEP::Hep3Vector ideal_lepton_dir = spherical_to_cartesian(_cfg.lepton_beam.direction_theta, _cfg.lepton_beam.direction_phi);
0276     CLHEP::Hep3Vector ideal_lepton_dir(0, 0, -1);
0277     CLHEP::Hep3Vector ideal_hadron_dir = CLHEP::Hep3Vector(z_axis).rotateY(_cfg.crossing_angle_hor).rotateX(_cfg.crossing_angle_ver);
0278 
0279     //double crossing_angle = acos(ideal_hadron_dir.unit().dot(-ideal_lepton_dir.unit()));
0280 
0281     if (m_verbosity) {
0282         cout << __PRETTY_FUNCTION__ << ": " << endl;
0283         cout << "ideal_hadron_dir = " << ideal_hadron_dir << endl;
0284         cout << "ideal_lepton_dir = " << ideal_lepton_dir << endl;
0285         cout << "crossing_angle_hor   = " << _cfg.crossing_angle_hor << endl;
0286         cout << "crossing_angle_ver   = " << _cfg.crossing_angle_ver << endl;
0287     }
0288 
0289     assert(fabs(ideal_hadron_dir.mag2() - 1) < CLHEP::Hep3Vector::getTolerance());
0290     assert(fabs(ideal_lepton_dir.mag2() - 1) < CLHEP::Hep3Vector::getTolerance());
0291 
0292     if (ideal_hadron_dir.dot(ideal_lepton_dir) > -0.5) {
0293         cout << "PHHepMCGenHelper::process_event - WARNING -"
0294              << "Beam A and Beam B are not near back to back. "
0295              << "Please double check beam direction setting at set_beam_direction_theta_phi()."
0296              << "beamA_center = " << ideal_hadron_dir << ","
0297              << "beamB_center = " << ideal_lepton_dir << ","
0298              << " Current setting:";
0299 
0300         print();
0301     }
0302 
0303     // Calculate angular deflection
0304     double hadron_crab_hor = _cfg.crossing_angle_hor / 2.0 / sqrt(_cfg.hadron_beam.beta_crab_hor * _cfg.hadron_beam.beta_star_hor);
0305     double hadron_crab_ver = 0;
0306 
0307     double lepton_crab_hor = _cfg.crossing_angle_hor / 2.0 / sqrt(_cfg.lepton_beam.beta_crab_hor * _cfg.lepton_beam.beta_star_hor);
0308     double lepton_crab_ver = 0;
0309 
0310     CLHEP::Hep3Vector real_hadron_dir = smear_beam_divergence(ideal_hadron_dir, _cfg.hadron_beam, bunch_one_z, hadron_crab_hor, hadron_crab_ver);
0311     CLHEP::Hep3Vector real_lepton_dir = smear_beam_divergence(ideal_lepton_dir, _cfg.lepton_beam, bunch_two_z, lepton_crab_hor, lepton_crab_ver);
0312 
0313     if (m_verbosity) {
0314         cout << __PRETTY_FUNCTION__ << ": " << endl;
0315         cout << "beamA_vec = " << real_hadron_dir << endl;
0316         cout << "beamB_vec = " << real_lepton_dir << endl;
0317     }
0318 
0319     assert(fabs(real_hadron_dir.mag2() - 1) < CLHEP::Hep3Vector::getTolerance());
0320     assert(fabs(real_lepton_dir.mag2() - 1) < CLHEP::Hep3Vector::getTolerance());
0321 
0322     // apply minimal beam energy shift rotation and boost
0323     CLHEP::Hep3Vector boost_axis = real_hadron_dir + real_lepton_dir;
0324     if (boost_axis.mag2() > CLHEP::Hep3Vector::getTolerance()) {
0325         //non-zero boost
0326 
0327         // split the boost to half for each beam for minimal beam  energy shift
0328         result.boost = CLHEP::HepBoost(0.5 * boost_axis);
0329 
0330         if (m_verbosity) {
0331             cout << __PRETTY_FUNCTION__ << ": non-zero boost " << endl;
0332         }
0333     }  //    if (cos_rotation_angle> CLHEP::Hep3Vector::getTolerance())
0334     else {
0335         result.boost = CLHEP::HepBoost(CLHEP::Hep3Vector(0, 0, 0));
0336         if (m_verbosity) {
0337             cout << __PRETTY_FUNCTION__ << ": zero boost " << endl;
0338         }
0339     }
0340 
0341     //rotation to collision to along z-axis with beamA pointing to +z
0342     CLHEP::Hep3Vector beamDiffAxis = (real_hadron_dir - real_lepton_dir);
0343     if (beamDiffAxis.mag2() < CLHEP::Hep3Vector::getTolerance()) {
0344         cout << "PHHepMCGenHelper::process_event - Fatal error -"
0345              << "Beam A and Beam B are too close to each other in direction "
0346              << "Please double check beam direction and divergence setting. "
0347              << "real_hadron_dir = " << real_hadron_dir << ","
0348              << "real_lepton_dir = " << real_lepton_dir << ","
0349              << " Current setting:";
0350 
0351         print();
0352 
0353         throw std::runtime_error("Beam A and Beam B are too close to each other in direction ");
0354     }
0355 
0356     beamDiffAxis = beamDiffAxis / beamDiffAxis.mag();
0357     double cos_rotation_angle_to_z = beamDiffAxis.dot(z_axis);
0358     if (m_verbosity) {
0359         cout << __PRETTY_FUNCTION__ << ": check rotation ";
0360         cout << "cos_rotation_angle_to_z= " << cos_rotation_angle_to_z << endl;
0361     }
0362 
0363     if (1 - cos_rotation_angle_to_z < CLHEP::Hep3Vector::getTolerance()) {
0364         //no rotation
0365 
0366         result.rotation = CLHEP::HepRotation(z_axis, 0);
0367 
0368         if (m_verbosity) {
0369             cout << __PRETTY_FUNCTION__ << ": no rotation " << endl;
0370         }
0371     } else if (cos_rotation_angle_to_z + 1 < CLHEP::Hep3Vector::getTolerance()) {
0372         // you got beam flipped
0373         result.rotation = CLHEP::HepRotation(CLHEP::Hep3Vector(0, 1, 0), M_PI);
0374         if (m_verbosity) {
0375             cout << __PRETTY_FUNCTION__ << ": reverse beam direction " << endl;
0376         }
0377     } else {
0378         // need a rotation
0379         CLHEP::Hep3Vector rotation_axis = (real_hadron_dir - real_lepton_dir).cross(z_axis);
0380         const double rotation_angle_to_z = acos(cos_rotation_angle_to_z);   // TODO back to -acos?
0381 
0382         result.rotation = CLHEP::HepRotation(rotation_axis, rotation_angle_to_z);
0383 
0384         if (m_verbosity) {
0385             cout << __PRETTY_FUNCTION__ << ": has rotation " << endl;
0386         }
0387     }  //  if (boost_axis.mag2() > CLHEP::Hep3Vector::getTolerance())
0388 
0389     // rotate the collision vertex z direction to middle of the beam angles
0390 
0391     // the final longitudinal vertex smear axis
0392     CLHEP::Hep3Vector beamCenterDiffAxis = (ideal_hadron_dir - ideal_lepton_dir);
0393     beamCenterDiffAxis = beamCenterDiffAxis / beamCenterDiffAxis.mag();
0394 
0395     double cos_rotation_center_angle_to_z = beamCenterDiffAxis.dot(z_axis);
0396 
0397     if (1 - fabs(cos_rotation_center_angle_to_z) < CLHEP::Hep3Vector::getTolerance()) {
0398         // new axis is basically beam axis
0399 
0400         if (m_verbosity) {
0401             cout << __PRETTY_FUNCTION__
0402                  << ": collision longitudinal axis is very close to z-axis. No additional rotation of vertexes: "
0403                  << "cos_rotation_center_angle_to_z = " << cos_rotation_center_angle_to_z
0404                  << endl;
0405         }
0406     } else {
0407         // need a rotation
0408         CLHEP::Hep3Vector rotation_axis = beamCenterDiffAxis.cross(z_axis);
0409         const double rotation_angle_to_z = -acos(cos_rotation_center_angle_to_z);
0410         const CLHEP::HepRotation rotation(rotation_axis, rotation_angle_to_z);
0411 
0412 
0413         CLHEP::Hep3Vector init_3vertex(
0414                 result.vertex.x(),
0415                 result.vertex.y(),
0416                 result.vertex.z());
0417 
0418         CLHEP::Hep3Vector final_3vertex = init_3vertex;//rotation * init_3vertex;
0419 
0420         result.vertex = CLHEP::HepLorentzVector(
0421                 final_3vertex.x(),
0422                 final_3vertex.y(),
0423                 final_3vertex.z(),
0424                 result.vertex.t());
0425 
0426         if (m_verbosity) {
0427             cout << __PRETTY_FUNCTION__
0428                  << ": collision longitudinal axis is rotated: "
0429                  << "cos_rotation_center_angle_to_z = " << cos_rotation_center_angle_to_z << ", "
0430                  << "rotation_axis = " << rotation_axis << ", "
0431                  << "init_3vertex = " << init_3vertex << ", "
0432                  << "final_3vertex = " << final_3vertex << ", "
0433                  << endl;
0434         }
0435     }
0436 
0437 
0438     if (m_verbosity) {
0439         cout << __PRETTY_FUNCTION__ << ": final boost rotation shift of the collision" << endl;
0440     }
0441     return result;
0442 }
0443 
0444 
0445 
0446 
0447 void ab::Afterburner::print() const {
0448     using namespace std;
0449 
0450     cout << "AFTERBURNER CONFIGURATION\n";
0451     cout << "=========================\n";
0452 
0453     cout << "Crossing angle hor: " << _cfg.crossing_angle_hor << endl;
0454     cout << "Crossing angle ver: " << _cfg.crossing_angle_ver << endl;
0455 
0456     cout << "Vertex distribution width"
0457             "  x: " << _cfg.vertex_smear_width_x
0458          << ", y: " << _cfg.vertex_smear_width_y
0459          << ", z: " << _cfg.vertex_smear_width_z
0460          << ", t: " << _cfg.vertex_smear_width_t
0461          << endl;
0462 
0463     cout << "Vertex distribution function: " << smear_func_to_str(_cfg.vertex_smear_func) << endl;
0464     cout << "Vertex simulation is: " << (_cfg.use_beam_bunch_sim ? string("on") : std::string("off")) << endl;
0465     cout << "Hadron beam:\n";
0466     cout << "   rms emittance   : hor = " << _cfg.hadron_beam.rms_emittance_hor << ", ver = " << _cfg.hadron_beam.rms_emittance_ver << endl;
0467     cout << "   beta star       : hor = " << _cfg.hadron_beam.beta_star_hor << ", ver = " << _cfg.hadron_beam.beta_star_ver << endl;
0468     cout << "   beta crab       : hor = " << _cfg.hadron_beam.beta_crab_hor << endl;
0469     cout << "   rms bunch length: " << _cfg.hadron_beam.rms_bunch_length << endl;
0470 
0471     cout << "Lepton beam:\n";
0472     cout << "   rms emittance   : hor = " << _cfg.lepton_beam.rms_emittance_hor << ", ver = " << _cfg.lepton_beam.rms_emittance_ver << endl;
0473     cout << "   beta star       : hor = " << _cfg.lepton_beam.beta_star_hor << ", ver = " << _cfg.lepton_beam.beta_star_ver << endl;
0474     cout << "   beta crab       : hor = " << _cfg.lepton_beam.beta_crab_hor << endl;
0475     cout << "   rms bunch length: " << _cfg.lepton_beam.rms_bunch_length << endl;
0476 
0477     cout << "=========================\n";
0478 }
0479