112 lines
3.3 KiB
C++
112 lines
3.3 KiB
C++
/*//////////////////////////////////////////////////////////////////////////////
|
|
// CMT Cosmic Muon Tomography project //////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova
|
|
All rights reserved
|
|
|
|
Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it >
|
|
|
|
------------------------------------------------------------------
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 3.0 of the License, or (at your option) any later version.
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with this library.
|
|
|
|
//////////////////////////////////////////////////////////////////////////////*/
|
|
|
|
|
|
|
|
#ifndef MATTER_H
|
|
#define MATTER_H
|
|
|
|
#include "Core/Object.h"
|
|
#include <Geant4/G4Material.hh>
|
|
#include <Geant4/G4NistManager.hh>
|
|
|
|
class G4Element;
|
|
|
|
namespace uLib {
|
|
namespace Geant {
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
//// ELEMENT ///////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
class Element {
|
|
public:
|
|
|
|
uLibRefMacro(G4Data,G4Element *)
|
|
private:
|
|
G4Element *m_G4Data;
|
|
};
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
//// MATERIAL //////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// TODO: finish from G4NistMaterialBuilder
|
|
|
|
class Material : public Object {
|
|
public:
|
|
uLibTypeMacro(Material, Object)
|
|
|
|
enum State {
|
|
Undefined = 0,
|
|
Solid,
|
|
Liquid,
|
|
Gas
|
|
};
|
|
|
|
Material();
|
|
Material(const char *name);
|
|
~Material();
|
|
|
|
void SetFromNist(const char *name);
|
|
|
|
template <typename Ar>
|
|
void serialize(Ar &ar, const unsigned int /*version*/) {
|
|
ar & HRP("name", std::string(m_G4Data->GetName()));
|
|
ar & HRP("density", (double)m_G4Data->GetDensity());
|
|
ar & serialization::make_hrp_enum("state", (int)m_G4Data->GetState(), {"Undefined", "Solid", "Liquid", "Gas"});
|
|
}
|
|
|
|
G4Material *GetG4Material() { return m_G4Data; }
|
|
|
|
private:
|
|
G4Material *m_G4Data;
|
|
|
|
};
|
|
|
|
// class MaterialCompound : public Material {
|
|
// public:
|
|
|
|
// MaterialCompound(const char *name) {}
|
|
|
|
// void AddMaterial(Material *m, double fractionmass) { m_Materials.push_back(std::make_pair(m, fractionmass)); }
|
|
// void AddElement(Element *e, double fractionmass) { m_Elements.push_back(std::make_pair(e, fractionmass)); }
|
|
// void SetDensity(double density) { m_Density = density; }
|
|
|
|
// private:
|
|
// std::vector<std::pair<Material *, double>> m_Materials;
|
|
// std::vector<std::pair<Element *, double>> m_Elements;
|
|
// double m_Density;
|
|
// };
|
|
|
|
}
|
|
}
|
|
|
|
|
|
#endif // MATTER_H
|