Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef AB_AFTERBURNER
0002 #define AB_AFTERBURNER
0003 
0004 #include <cmath>
0005 #include <string>
0006 #include <utility>
0007 
0008 #include <CLHEP/Vector/ThreeVector.h>
0009 #include <CLHEP/Vector/LorentzVector.h>
0010 #include <CLHEP/Vector/Boost.h>
0011 #include <CLHEP/Vector/Rotation.h>
0012 
0013 #include <gsl/gsl_rng.h>
0014 
0015 #include "AfterburnerConfig.hh"
0016 #include "Smearer.hh"
0017 
0018 namespace ab{
0019     struct AfterburnerEventResult {
0020         CLHEP::HepBoost boost;
0021         CLHEP::HepRotation rotation;
0022         CLHEP::HepLorentzVector vertex;
0023     };
0024 
0025     /// This class sole function is to be returned from generate_vertx_with_bunch_interaction
0026     struct BunchInteractionResult {
0027         CLHEP::HepLorentzVector vertex;
0028         double bunch_one_z;
0029         double bunch_two_z;
0030     };
0031 
0032     /*!
0033      * \brief Afterburner provides service of DST upload of HepMC subevent, vertex assignment and random generator
0034      */
0035     class Afterburner
0036     {
0037     public:
0038         Afterburner();
0039 
0040         AfterburnerEventResult process_event();
0041 
0042         AfterburnerEventResult process_event(const CLHEP::HepLorentzVector &init_vtx);
0043 
0044         void print() const;
0045 
0046         void set_verbose(int v) { m_verbosity = v; }
0047 
0048         int verbose() const { return m_verbosity; }
0049 
0050         void set_config(ab::AfterburnerConfig config) {
0051             _cfg = config;
0052         }
0053 
0054         ab::AfterburnerConfig config() const {
0055             return _cfg;
0056         }
0057 
0058     private:
0059         /** verbosity */
0060         int m_verbosity = 0;
0061 
0062         AfterburnerConfig _cfg;
0063         Smearer _smear;
0064 
0065         /** Converts from spherical theta-phi to cartesian vector */
0066         static CLHEP::Hep3Vector spherical_to_cartesian(double theta, double phi);
0067 
0068         /** Adds divergense and z kick smearing to a beam */
0069 
0070 
0071         CLHEP::HepLorentzVector move_vertex(const CLHEP::HepLorentzVector &init_vtx);
0072 
0073         double get_collision_width(double widthA, double widthB);
0074 
0075 
0076 
0077         CLHEP::Hep3Vector
0078         smear_beam_divergence(const CLHEP::Hep3Vector &beam_dir,
0079                               const BeamConfig &beam_cfg,
0080                               const double vtx_z,
0081                               const double crab_hor,
0082                               const double crab_ver);
0083 
0084         BunchInteractionResult generate_vertx_with_bunch_interaction();
0085     };
0086 }
0087 
0088 #endif /* AB_AFTERBURNER */