File indexing completed on 2024-11-16 09:02:08
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include "eicsmear/erhic/EventPythia.h"
0011
0012 #include <cmath>
0013 #include <limits>
0014 #include <sstream>
0015 #include <string>
0016 #include <vector>
0017
0018 namespace erhic {
0019
0020 EventPythia::EventPythia(const std::string& )
0021 : nucleon(std::numeric_limits<Int_t>::max())
0022 , tgtparton(std::numeric_limits<Int_t>::max())
0023 , beamparton(std::numeric_limits<Int_t>::max())
0024 , genevent(-1)
0025 , xtgtparton(NAN)
0026 , xbeamparton(NAN)
0027 , thetabeamparton(NAN)
0028 , leptonphi(NAN)
0029 , F1(NAN)
0030 , sigma_rad(NAN)
0031 , t_hat(NAN)
0032 , u_hat(NAN)
0033 , Q2_hat(NAN)
0034 , SigRadCor(NAN)
0035 , EBrems(NAN)
0036 , photonflux(NAN)
0037 , trueY(NAN)
0038 , trueQ2(NAN)
0039 , trueX(NAN)
0040 , trueW2(NAN)
0041 , trueNu(NAN)
0042 , F2(NAN)
0043 , R(NAN)
0044 , pt2_hat(NAN)
0045 , sHat(NAN) {
0046 }
0047
0048 EventPythia::~EventPythia() { }
0049
0050 bool EventPythia::Parse(const std::string& line) {
0051 static std::stringstream ss;
0052 ss.str("");
0053 ss.clear();
0054 ss << line;
0055 ss >>
0056 number >> number >>
0057 genevent >> process >> nucleon >> tgtparton >> xtgtparton >>
0058 beamparton >> xbeamparton >> thetabeamparton >> trueY >> trueQ2 >>
0059 trueX >> trueW2 >> trueNu >> leptonphi >> sHat >> t_hat >> u_hat >>
0060 pt2_hat >> Q2_hat >> F2 >> F1 >> R >> sigma_rad >> SigRadCor >> EBrems >>
0061 photonflux >> nTracks;
0062
0063 return !ss.fail();
0064 }
0065
0066
0067
0068
0069
0070
0071 const ParticleMC* EventPythia::ScatteredLepton() const {
0072
0073
0074
0075 const VirtualParticle* beam = BeamLepton();
0076 if (!beam) {
0077 return NULL;
0078 }
0079 const int species = beam->Id().Code();
0080
0081
0082 std::vector<const VirtualParticle*> final;
0083 FinalState(final);
0084 std::vector<const VirtualParticle*>::const_iterator iter;
0085 for (iter = final.begin(); iter != final.end(); ++iter) {
0086
0087
0088 if ((*iter)->GetParentIndex() == 3 &&
0089 (*iter)->Id().Code() == species) {
0090
0091 return static_cast<const ParticleMC*>(*iter);
0092 }
0093 }
0094
0095 return NULL;
0096 }
0097
0098 EventBeagle::EventBeagle(const std::string& str):
0099 EventPythia(str)
0100 , lepton(std::numeric_limits<Int_t>::max())
0101 , Atarg(std::numeric_limits<Int_t>::max())
0102 , Ztarg(std::numeric_limits<Int_t>::max())
0103 , pzlep(NAN)
0104 , pztarg(NAN)
0105 , pznucl(NAN)
0106 , crang(NAN)
0107 , crori(NAN)
0108 , b(NAN)
0109 , Phib(NAN)
0110 , Thickness(NAN)
0111 , ThickScl(NAN)
0112 , Ncollt(std::numeric_limits<Int_t>::max())
0113 , Ncolli(std::numeric_limits<Int_t>::max())
0114 , Nwound(std::numeric_limits<Int_t>::max())
0115 , Nwdch(std::numeric_limits<Int_t>::max())
0116 , Nnevap(std::numeric_limits<Int_t>::max())
0117 , Npevap(std::numeric_limits<Int_t>::max())
0118 , Aremn(std::numeric_limits<Int_t>::max())
0119 , NINC(std::numeric_limits<Int_t>::max())
0120 , NINCch(std::numeric_limits<Int_t>::max())
0121 , d1st(NAN)
0122 , davg(NAN)
0123 , pxf(NAN)
0124 , pyf(NAN)
0125 , pzf(NAN)
0126 , Eexc(NAN)
0127 , RAevt(NAN)
0128 , User1(NAN)
0129 , User2(NAN)
0130 , User3(NAN)
0131 {
0132
0133 }
0134
0135 EventBeagle::~EventBeagle() { }
0136
0137 bool EventBeagle::Parse(const std::string& line) {
0138 static std::stringstream ss;
0139 ss.str("");
0140 ss.clear();
0141 ss << line;
0142 ss >>
0143
0144
0145
0146
0147
0148
0149 number >> number >>
0150 genevent >>
0151 lepton >> Atarg >> Ztarg >> pzlep >> pztarg >> pznucl >> crang >> crori >>
0152 process >> nucleon >> tgtparton >> xtgtparton >>
0153 beamparton >> xbeamparton >> thetabeamparton >> trueY >> trueQ2 >>
0154 trueX >> trueW2 >> trueNu >> leptonphi >> sHat >> t_hat >> u_hat >>
0155 pt2_hat >> Q2_hat >> F2 >> F1 >> R >> sigma_rad >> SigRadCor >> EBrems >>
0156 photonflux >>
0157 b >> Phib >> Thickness >> ThickScl >> Ncollt >> Ncolli >> Nwound >> Nwdch >> Nnevap >> Npevap >> Aremn >>
0158 NINC >> NINCch >> d1st >> davg >> pxf >> pyf >> pzf >> Eexc >> RAevt >> User1 >> User2 >> User3 >>
0159 nTracks;
0160
0161 return !ss.fail();
0162 }
0163 }