Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:15:14

0001 # ifndef REACTION_ROUNTINE_CC
0002 # define REACTION_ROUNTINE_CC
0003 
0004 #include "eic_pim.h"
0005 
0006 #include <string>
0007 #include <fstream>
0008 
0009 #include <TStopwatch.h>
0010 #include <TDatime.h>
0011 
0012 #include "TF1.h"
0013 #include "TLorentzVector.h"
0014 
0015 #include "particleType.h"
0016 
0017 #include "TCanvas.h"
0018 
0019 #include "Particle.hxx"
0020 #include "CustomRand.hxx"
0021 
0022 class Reaction{
0023 
0024 public:
0025   Reaction();
0026   Reaction(TString);
0027   Reaction(TString, TString);
0028   ~Reaction();
0029 
0030   void process_reaction();      
0031   TString GetEjectile() {return rEjectile;};        
0032   TString GetRecoilHadron() {return rRecoil;};
0033   
0034 protected:
0035   TStopwatch tTime;
0036 
0037   TString rEjectile;
0038   TString rRecoil;
0039 
0040 };
0041 
0042 class DEMP_Reaction {
0043 
0044 public:
0045   DEMP_Reaction();
0046   DEMP_Reaction(TString, TString);
0047   ~DEMP_Reaction();
0048 
0049   void process_reaction();      
0050   TString GetEjectile() {return rEjectile;};        
0051   TString GetRecoilHadron() {return rRecoil;};
0052   
0053 protected:
0054 
0055   void Init();
0056   void Processing_Event();
0057   void Progress_Report();
0058   void Detail_Output();
0059   void Lund_Output();
0060   void DEMPReact_Pythia6_Out_Init();
0061   void DEMPReact_Pythia6_Output();
0062   void DEMPReact_HEPMC3_Out_Init();
0063   void DEMPReact_HEPMC3_Output();
0064   
0065   TRandom2* rRanBd;
0066   TRandom2* rRand;
0067         
0068   Particle_t recoil_hadron;
0069   Particle_t produced_X;
0070 
0071   Double_t Get_Phi_X_LeptonPlane_RF();
0072   Double_t Get_Phi_TargPol_LeptonPlane_RF();
0073 
0074   Double_t Get_Total_Cross_Section(); 
0075 
0076   //  Double_t GetPi0_CrossSection();
0077 
0078   /*--------------------------------------------------*/
0079   // Parameters
0080 
0081   TStopwatch tTime;
0082   TString rEjectile;
0083   TString rEjectile_charge;
0084   TString rEjectile_scat_hadron;
0085   TString rRecoil;
0086 
0087   std::string sTFile;   /// Generator output files. For documentation and monitoring purposes 
0088   std::string sLFile;   /// Lund input file into the EIC simulation
0089   std::string sDFile;   /// Root diagnostic plot in root file format
0090 
0091   std::ofstream DEMPOut;     
0092   std::ofstream DEMPDetails;
0093 
0094   TFile* dRootFile;
0095   TTree* dRootTree;
0096   
0097   Double_t calculate_psf_t(const TLorentzVector& psf_photon, const TLorentzVector& psf_ejectile); // Love Preet - Added for phase space factor calculations
0098   void calculate_psf_max_min(double value, double& maxValue, double& minValue);
0099   Double_t psf();
0100   TLorentzVector psf_scatelec, psf_ejectile;
0101   TLorentzVector psf_photon;
0102 
0103   long long int qsq_ev, t_ev, w_neg_ev, w_ev;
0104   long long int evts;
0105         
0106   long long int rNEvents;
0107   long long int rNEvent_itt;
0108   TDatime dFractTime; 
0109 
0110   double rDEG2RAD;
0111                    
0112   double f_Ejectile_Theta_I, f_Ejectile_Theta_F;
0113 
0114   TLorentzVector GetProtonVector_lab();
0115   TLorentzVector GetElectronVector_lab();
0116 
0117   TLorentzVector r_lproton;     // Proton in collider (lab) frame
0118   TLorentzVector r_lprotong;    
0119 
0120   TLorentzVector r_lelectron;   // Electron in collider (lab) frame
0121   TLorentzVector r_lelectrong;  
0122 
0123   TLorentzVector r_lhadron_beam;    
0124   TLorentzVector r_lhadron_beamg;
0125 
0126   Double_t r_lhadron_beam_mass; 
0127   Double_t r_lhadron_beam_massg;    
0128         
0129   TVector3 beta_col_rf; // Boost vector from collider (lab) frame to protons rest frame (Fix target)
0130 
0131   void Consider_Proton_Fermi_Momentum();
0132 
0133   Double_t rFermiMomentum;
0134 
0135   Double_t f_Ejectile_Theta_Col, f_Ejectile_Phi_Col;
0136 
0137   TLorentzVector r_lscatelec; 
0138   TLorentzVector r_lscatelecg;
0139 
0140   TLorentzVector r_lphoton;
0141   TLorentzVector r_lphotong;
0142     
0143   TLorentzVector r_l_Ejectile;
0144   TLorentzVector r_l_Ejectile_g;
0145 
0146   TLorentzVector r_l_Ejectile_solved;
0147   TLorentzVector r_l_Recoil_solved;
0148 
0149   double f_Ejectile_Mass;
0150   double f_Ejectile_Mass_GeV;
0151 
0152   double f_Recoil_Mass;     
0153   double f_Recoil_Mass_GeV;
0154 
0155   TLorentzVector l_Recoil;
0156   TLorentzVector l_Recoil_g;
0157 
0158   TLorentzVector r_lw;
0159 
0160   TLorentzVector lwp;
0161 
0162   TLorentzVector fsini;
0163   TLorentzVector fsfin;
0164   TLorentzVector fsinig;
0165   TLorentzVector fsfing;
0166 
0167   pim* pd;
0168 
0169   ///////////////////////////////////////////
0170   //Transformation of e', pi- and recoil proton to target's rest frmae without energy loss 
0171 
0172   TLorentzVector lproton_rf;
0173   TLorentzVector lproton_rfg;
0174 
0175   TLorentzVector lelectron_rf;
0176   TLorentzVector lelectron_rfg;
0177 
0178   TLorentzVector lscatelec_rf;
0179   TLorentzVector lscatelec_rfg;
0180 
0181   TLorentzVector lphoton_rf;
0182   TLorentzVector lphoton_rfg;
0183 
0184   TLorentzVector l_Ejectile_rf;
0185   TLorentzVector l_Ejectile_rfg;
0186 
0187   TLorentzVector l_scat_hadron_rf;
0188   TLorentzVector l_scat_hadron_rf_g;
0189 
0190   ///////////////////////////////////////////
0191   /// Center of Mass parameters for particle X
0192 
0193   double fBeta_CM_RF, fGamma_CM_RF, f_Ejectile_Energy_CM, f_Ejectile_Mom_CM, f_Ejectile_Energy_CM_GeV, f_Ejectile_Mom_CM_GeV;
0194 
0195   TLorentzVector lt;
0196   TLorentzVector ltg;
0197   TLorentzVector lu;
0198   TLorentzVector lug;
0199 
0200   ///////////////////////////////////////////
0201 
0202   TVector3 v3Photon;   
0203   TVector3 v3Electron; 
0204   TVector3 v3X;    
0205   TVector3 v3S;        
0206   TVector3 v3PhotonUnit;
0207   TVector3 v3QxL;       
0208   TVector3 v3QxP;       
0209   TVector3 v3QxS;       
0210   TVector3 v3LxP;       
0211   TVector3 v3LxS;       
0212   TVector3 v3PxL;       
0213   TVector3 v3QUnitxL;  
0214   TVector3 v3QUnitxP;   
0215   TVector3 v3QUnitxS;   
0216 
0217   double fCos_Phi_X_LeptonPlane_RF, fSin_Phi_X_LeptonPlane_RF, fTheta_X_Photon_RF, fPhi_X_LeptonPlane_RF;
0218   Double_t r_fSig;
0219   Double_t r_fSig_T;
0220   Double_t r_fSig_L;
0221 
0222   unsigned long long int print_itt;
0223 
0224   ///*--------------------------------------------------*/ 
0225   // Rory Check algorithm
0226 
0227   TLorentzVector* Interaction_Solve;
0228   TLorentzVector* Target_Solve;
0229 
0230   TLorentzVector* VertBeamElec;
0231   TLorentzVector* VertScatElec;
0232   
0233   TLorentzVector* Initial;
0234   TLorentzVector* Target;
0235   TLorentzVector* Photon;
0236   TLorentzVector* Interaction;
0237   TLorentzVector* Final;
0238   
0239   bool SolnCheck();
0240   double W_in_Solve(); 
0241   double W_out_Solve();
0242   double W_in_val;
0243 
0244   TRandom3* CoinToss;
0245   CustomRand* AngleGen;
0246  
0247   TF1* F;
0248   TVector3* UnitVect;
0249 
0250   int Solve();
0251   int Solve(double theta, double phi);
0252 
0253   double W_in();
0254   double W_out();
0255   
0256   ///*--------------------------------------------------*/ 
0257   // Needed for the Solve function
0258 
0259   double theta;
0260   double phi;
0261   double P;
0262   double P2;
0263 
0264   double tc;
0265   double tc_GeV;
0266   double uc;
0267   double uc_GeV;
0268   ///*--------------------------------------------------*/ 
0269 
0270 };
0271 
0272 //class Pi0_Production:DEMP_Reaction{
0273 // 
0274 // public:
0275 //  Pi0_Production();
0276 //  Pi0_Production(TString);
0277 //  ~Pi0_Production();
0278 //
0279 //  void process_reaction();
0280 //  void Detail_Output();
0281 //  void Processing_Event();
0282 //  Double_t Get_CrossSection();
0283 //
0284 //  void Pi0_decay(TLorentzVector);
0285 //
0286 //  bool if_pi0_decay;
0287 //
0288 //  void Pi0_Decay_Pythia6_Out_Init();
0289 //  void Pi0_Decay_Pythia6_Output();
0290 //  
0291 //  ///----------------------------------------------------*/
0292 //  /// Output algorithm into HEPMC3 format
0293 //
0294 //  void Pi0_HEPMC3_Out_Init();
0295 //  void Pi0_HEPMC3_Output();
0296 //
0297 //  unsigned long long int print_itt;
0298 //
0299 // private:
0300 //
0301 //  Double_t theta_X_rf;
0302 //
0303 //  Double_t ft_min;
0304 //  Double_t fu_min;
0305 //
0306 //  Double_t ft;
0307 //  Double_t fu;
0308 //
0309 //  std::ofstream polar_out;     
0310 //
0311 //  TLorentzVector l_photon_1;
0312 //  TLorentzVector l_photon_2;
0313 //
0314 //  void Pi0_Lund_Output();
0315 //  void Pi0_Decay_Lund_Output();
0316 //
0317 //  //          template <class T> 
0318 //  //          inline int 
0319 //  //          sgn(T val) {
0320 //  //              return (T(0) < val) - (val < T(0));
0321 //  //          }
0322 //
0323 //  template <class T>
0324 //    T Sign (T a, T b) {
0325 //    return (a < b) - (b < a);
0326 //  }
0327 //
0328 //};
0329 
0330 # endif