File indexing completed on 2024-09-28 07:02:50
0001
0002
0003
0004
0005
0006
0007 #include "eicsmear/erhic/EventSartre.h"
0008
0009 #include <cmath>
0010 #include <sstream>
0011 #include <string>
0012
0013 namespace erhic {
0014
0015 EventSartre::EventSartre()
0016 : genevent(-1)
0017 , trueT(NAN)
0018 , trueQ2(NAN)
0019 , trueX(NAN)
0020 , trueY(NAN)
0021 , trueW2(NAN)
0022 , trueNu(NAN)
0023 , trueXpom(NAN)
0024 , s_cm(NAN)
0025 , pol(-1)
0026 , dmode(-1)
0027 , bup(-1){
0028 }
0029
0030 bool EventSartre::Parse(const std::string& line) {
0031 static std::stringstream ss;
0032 ss.str("");
0033 ss.clear();
0034 ss << line;
0035 ss >>
0036 number >> number >>
0037 genevent >>
0038 trueT >> trueQ2 >> trueX >> trueY >> trueW2 >> trueNu >>
0039 trueXpom >> s_cm >> pol >> dmode >> bup;
0040
0041 return !ss.fail();
0042 }
0043
0044
0045
0046
0047
0048
0049 const ParticleMC* EventSartre::ScatteredLepton() const {
0050
0051
0052
0053 const VirtualParticle* beam = BeamLepton();
0054 if (!beam) {
0055 return NULL;
0056 }
0057 const int species = beam->Id().Code();
0058
0059
0060 std::vector<const VirtualParticle*> final;
0061 FinalState(final);
0062 std::vector<const VirtualParticle*>::const_iterator iter;
0063 for (iter = final.begin(); iter != final.end(); ++iter) {
0064
0065
0066 if ( (*iter)->Id().Code() == species &&
0067 ( (*iter)->GetParentIndex() == 1 || (*iter)->GetParentIndex() == 2 )
0068 ) {
0069
0070 return static_cast<const ParticleMC*>(*iter);
0071 }
0072 }
0073
0074 return nullptr;
0075 }
0076
0077
0078
0079
0080
0081 const ParticleMC* EventSartre::ExchangeBoson() const {
0082 for ( auto particle : EventMC::GetTracks() ){
0083 if ( particle->GetStatus() != 21 ) continue;
0084 if ( particle->GetParentIndex() != 1 && particle->GetParentIndex() == 2 ) continue;
0085 if ( particle->Id().Code() == 22 || particle->Id().Code() == 23 || std::abs(particle->Id().Code()) == 24 ){
0086
0087 return static_cast<const ParticleMC*>(particle);
0088 }
0089 }
0090
0091 return nullptr;
0092 }
0093
0094 }
0095
0096
0097