ATLAS Offline Software
Loading...
Searching...
No Matches
ServiceMaterial.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ServiceMaterial_H
6#define ServiceMaterial_H
7
8#include <string>
9#include <vector>
10#include <iosfwd>
11
13public:
14
21 struct Entry {
22 Entry( const std::string& nam, int num, bool lin) : name(nam), number(num), linear(lin), weight(1) {}
23 Entry( const std::string& nam, int num, bool lin, double w) : name(nam), number(num), linear(lin), weight(w) {}
24
25 std::string name;
26 int number;
27 bool linear;
28 double weight;
29 };
30
31 typedef std::vector< Entry> EntryContainer;
32 typedef EntryContainer::const_iterator EntryIter;
33
35
36 ServiceMaterial( const std::string& name, const std::vector< Entry>& cmp) :
37 m_name(name), m_components(cmp) {}
38
39 ServiceMaterial( const std::string& name) :
40 m_name(name), m_components() { m_components.reserve(6);}
41
43 // ServiceMaterial( const std::string& name, double lw) :
44 // m_name(name), m_linearWeight(lw), m_components() {}
45
46 const std::string& name() const {return m_name;}
47
48 const std::vector< Entry>& components() const {return m_components;}
49
50 void addEntry( const Entry& e) { m_components.push_back( e);}
51
52 void addEntry( const std::string& nam, int num, bool lin, double w=1) {
53 m_components.push_back( Entry( nam, num, lin, w));
54 }
55
56 //ServiceMaterial operator*( double len) const {return ServiceMaterial( name(), len*linearWeight(), m_components);}
57 void multiply( int factor) {
58 for ( std::vector< Entry>::iterator i=m_components.begin(); i!=m_components.end(); ++i) {
59 i->number *= factor;
60 }
61 }
62
63 void dump( std::ostream& os) const;
64
65private:
66
67 std::string m_name;
68 std::vector< Entry> m_components;
69
70};
71
72#endif
const std::string & name() const
Constructor for elementary material (no components)
void addEntry(const Entry &e)
ServiceMaterial(const std::string &name, const std::vector< Entry > &cmp)
const std::vector< Entry > & components() const
std::vector< Entry > m_components
void multiply(int factor)
void addEntry(const std::string &nam, int num, bool lin, double w=1)
EntryContainer::const_iterator EntryIter
std::vector< Entry > EntryContainer
std::string m_name
ServiceMaterial(const std::string &name)
-event-from-file
Structure holding one service material.
Entry(const std::string &nam, int num, bool lin)
Entry(const std::string &nam, int num, bool lin, double w)