MARLEY (Model of Argon Reaction Low Energy Yields) v2.0.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
Loading...
Searching...
No Matches
HepMC3::DoubleAttribute Class Reference

Attribute that holds a real number as a double. More...

#include <Attribute.h>

Inheritance diagram for HepMC3::DoubleAttribute:
HepMC3::Attribute

Public Member Functions

 DoubleAttribute ()
 Default constructor.
 
 DoubleAttribute (double val)
 Constructor initializing attribute value.
 
bool from_string (const std::string &att) override
 Implementation of Attribute::from_string.
 
void set_value (const double &d)
 set the value associated to this Attribute.
 
bool to_string (std::string &att) const override
 Implementation of Attribute::to_string.
 
double value () const
 get the value associated to this Attribute.
 
- Public Member Functions inherited from HepMC3::Attribute
 Attribute ()
 Default constructor.
 
virtual ~Attribute ()
 Virtual destructor.
 
const GenEventevent () const
 
virtual bool init ()
 Optionally initialize the attribute after from_string.
 
virtual bool init (const GenRunInfo &)
 Optionally initialize the attribute after from_string.
 
bool is_parsed () const
 Check if this attribute is parsed.
 
GenParticlePtr particle ()
 
ConstGenParticlePtr particle () const
 
const std::string & unparsed_string () const
 Get unparsed string.
 
GenVertexPtr vertex ()
 
ConstGenVertexPtr vertex () const
 

Additional Inherited Members

- Protected Member Functions inherited from HepMC3::Attribute
 Attribute (const std::string &st)
 Protected constructor that allows to set string.
 
void set_is_parsed (bool flag)
 Set is_parsed flag.
 
void set_unparsed_string (const std::string &st)
 Set unparsed string.
 

Detailed Description

Attribute that holds a real number as a double.

Definition at line 245 of file Attribute.h.

Constructor & Destructor Documentation

◆ DoubleAttribute() [1/2]

HepMC3::DoubleAttribute::DoubleAttribute ( )
inline

Default constructor.

Definition at line 249 of file Attribute.h.

249: Attribute(), m_val(0.0) {}
Attribute()
Default constructor.
Definition Attribute.h:51

References HepMC3::Attribute::Attribute().

◆ DoubleAttribute() [2/2]

HepMC3::DoubleAttribute::DoubleAttribute ( double val)
inline

Constructor initializing attribute value.

Definition at line 252 of file Attribute.h.

252: Attribute(), m_val(val) {}

References HepMC3::Attribute::Attribute().

Member Function Documentation

◆ from_string()

bool HepMC3::DoubleAttribute::from_string ( const std::string & att)
inlineoverridevirtual

Implementation of Attribute::from_string.

Implements HepMC3::Attribute.

Definition at line 255 of file Attribute.h.

255 {
256 m_val = atof( att.c_str() );
257 set_is_parsed(true);
258 return true;
259 }
void set_is_parsed(bool flag)
Set is_parsed flag.
Definition Attribute.h:134

References HepMC3::Attribute::set_is_parsed().

◆ set_value()

void HepMC3::DoubleAttribute::set_value ( const double & d)
inline

set the value associated to this Attribute.

Definition at line 276 of file Attribute.h.

276 {
277 m_val = d;
278 set_is_parsed(true);
279 }

References HepMC3::Attribute::set_is_parsed().

◆ to_string()

bool HepMC3::DoubleAttribute::to_string ( std::string & att) const
inlineoverridevirtual

Implementation of Attribute::to_string.

Implements HepMC3::Attribute.

Definition at line 262 of file Attribute.h.

262 {
263 std::ostringstream oss;
264 oss << std::setprecision(std::numeric_limits<double>::digits10)
265 << m_val;
266 att = oss.str();
267 return true;
268 }

◆ value()

double HepMC3::DoubleAttribute::value ( ) const
inline

get the value associated to this Attribute.

Definition at line 271 of file Attribute.h.

271 {
272 return m_val;
273 }

Referenced by marley::OMPWeightCalculator::weight().


The documentation for this class was generated from the following file: