Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-16 09:02:08

0001 /**
0002  \file
0003  Implementation of class erhic::EventRapgap.
0004  
0005  \author    Thomas Burton
0006  \date      2011-08-31
0007  \copyright 2011 Brookhaven National Lab
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& /* Unused */)
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 >>  // Skip first int in the line
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   // Protect against errors in the input file or the stream
0063   return !ss.fail();
0064 }
0065 
0066 // Look for the scattered lepton in the event record.
0067 // This is the first (only?) particle that matches the following:
0068 //  1) pdg code equals that of incident lepton beam.
0069 //  2) status code is 1 i.e. it's a stable/final-state particle.
0070 //  3) the parent is track three (counting from 1).
0071 const ParticleMC* EventPythia::ScatteredLepton() const {
0072   // Look for the lepton beam to get the species.
0073   // If we don't get it we can't find the scattered
0074   // lepton so return NULL.
0075   const VirtualParticle* beam = BeamLepton();
0076   if (!beam) {
0077     return NULL;
0078   }  // if
0079   const int species = beam->Id().Code();
0080   // Get the final state particles and search them for
0081   // the scattered lepton.
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     // We already know the particle is final state, so
0087     // check its species and parent index.
0088     if ((*iter)->GetParentIndex() == 3 &&
0089        (*iter)->Id().Code() == species) {
0090       // Found it, cast to required particle type and return.
0091       return static_cast<const ParticleMC*>(*iter);
0092     }  // if
0093   }  // for
0094   // No luck, couldn't find the scattered lepton.
0095   return NULL;
0096 }
0097 
0098   EventBeagle::EventBeagle(const std::string& str/* Unused */): 
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   } // EventBeagle::EventBeagle()
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 //  number >> number >>  // Skip first int in the line
0144 //  genevent >> process >> nucleon >> tgtparton >> xtgtparton >>
0145 //  beamparton >> xbeamparton >> thetabeamparton >> trueY >> trueQ2 >>
0146 //  trueX >> trueW2 >> trueNu >> leptonphi >> sHat >> t_hat >> u_hat >>
0147 //  pt2_hat >> Q2_hat >> F2 >> F1 >> R >> sigma_rad >> SigRadCor >> EBrems >>
0148 //  photonflux >> nTracks;
0149   number >> number >>  // Skip first int in the line
0150   genevent >> 
0151   lepton >> Atarg >> Ztarg >> pzlep >> pztarg >> pznucl >> crang >> crori >>//added variables
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 >> //added variables
0158   NINC >> NINCch >> d1st >> davg >> pxf >> pyf >> pzf >> Eexc >> RAevt >> User1 >> User2 >> User3 >> //added variables
0159   nTracks;
0160   // Protect against errors in the input file or the stream
0161   return !ss.fail();
0162 }
0163 }  // namespace erhic