EIC Software
Reference for
EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
EventDEMP.cxx
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file EventDEMP.cxx
1
8
#include "
eicsmear/erhic/EventDEMP.h
"
9
10
#include <cmath>
11
#include <sstream>
12
#include <string>
13
14
namespace
erhic {
15
16
EventDEMP::EventDEMP
()
17
: numParticles(NAN)
18
, weight(NAN){
19
}
20
21
bool
EventDEMP::Parse
(
const
std::string& line) {
22
static
std::stringstream ss;
23
ss.str(
""
);
24
ss.clear();
25
ss << line;
26
ss >>
27
number
>>
number
>>
// Skip first int in the line
28
numParticles
>>
weight
;
29
// Protect against errors in the input file or the stream
30
return
!ss.fail();
31
}
32
33
// Look for the scattered lepton in the event record.
34
// This is the first (only?) particle that matches the following:
35
// 1) pdg code equals that of incident lepton beam.
36
// 2) status code is 1 i.e. it's a stable/final-state particle.
37
const
ParticleMC
*
EventDEMP::ScatteredLepton
()
const
{
38
// Look for the lepton beam to get the species.
39
// If we don't get it we can't find the scattered
40
// lepton so return NULL.
41
const
VirtualParticle
*
beam
=
BeamLepton
();
42
if
(!beam) {
43
return
nullptr
;
44
}
// if
45
const
int
species = beam->
Id
().
Code
();
46
// Get the final state particles and search them for
47
// the scattered lepton.
48
std::vector<const VirtualParticle*>
final
;
49
FinalState
(
final
);
50
// std::vector<const VirtualParticle*>::const_iterator iter;
51
for
(
auto
& iter :
final
) {
52
// We already know the particle is final state
53
// could check for its parent but we don't need to
54
if
( iter->Id().Code() == species) {
55
// Found it, cast to required particle type and return.
56
return
static_cast<
const
ParticleMC
*
>
(iter);
57
}
58
}
59
60
// No luck, couldn't find the scattered lepton.
61
return
nullptr
;
62
}
63
64
}
// namespace erhic
eic-smear
blob
master
src
erhic
EventDEMP.cxx
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:32
using
1.8.2 with
EIC GitHub integration