Monte Carlo run header.
More...
#include <JHead.hh>
|
static const std::string | GENHEN = "GENHEN" |
| Generators. More...
|
|
static const std::string | GENIE = "GENIE" |
|
static const std::string | GSEAGEN = "gSeaGen" |
|
static const std::string | MUPAGE = "HEMAS-DPM" |
|
static const std::string | JSIRENE = "JSirene" |
|
static const std::string | KM3 = "KM3" |
|
static const std::string | KM3SIM = "KM3Sim" |
|
|
template<class T > |
static bool | match (const T &first, const T &second) |
| Test match. More...
|
|
template<class T > |
static bool | match (const std::vector< T > &first, const std::vector< T > &second) |
| Test one container is subset of other container or vice versa. More...
|
|
template<class T > |
static bool | match (const JHead &first, const JHead &second, const bool option, T JHead::*pd) |
| Test match of given data member of headers. More...
|
|
Monte Carlo run header.
This class extends the Head class so that the data from specific tags can be promoted to concrete data types.
Note that for the copy of new JHead data (e.g. data not obtained via a previous JAANET::copy) to become effective, the key words in the corresponding map of the Head class should be set.
To this end, member method JHead::push can be used.
Definition at line 839 of file JHead.hh.
◆ JHead() [1/2]
Default constructor.
Definition at line 857 of file JHead.hh.
◆ JHead() [2/2]
JAANET::JHead::JHead |
( |
const Head & |
header | ) |
|
|
inline |
Copy constructor.
- Parameters
-
Definition at line 866 of file JHead.hh.
◆ ~JHead()
virtual JAANET::JHead::~JHead |
( |
| ) |
|
|
inlinevirtual |
Virtual destructor.
Definition at line 875 of file JHead.hh.
◆ getHeader() [1/2]
const JHead& JAANET::JHead::getHeader |
( |
| ) |
const |
|
inline |
Get header.
- Returns
- header
Definition at line 884 of file JHead.hh.
886 return static_cast<const JHead&>(*
this);
◆ getHeader() [2/2]
JHead& JAANET::JHead::getHeader |
( |
| ) |
|
|
inline |
Get header.
- Returns
- header
Definition at line 895 of file JHead.hh.
897 return static_cast<JHead&>(*
this);
◆ setHeader()
void JAANET::JHead::setHeader |
( |
const JHead & |
header | ) |
|
|
inline |
Set header.
- Parameters
-
Definition at line 906 of file JHead.hh.
908 static_cast<JHead&>(*
this) = header;
◆ pull() [1/2]
template<class T >
const_iterator JAANET::JHead::pull |
( |
T JHead::* |
pd | ) |
const |
|
inline |
Pull given data member from Head.
- Parameters
-
- Returns
- iterator of Head
Definition at line 919 of file JHead.hh.
◆ pull() [2/2]
template<class T >
iterator JAANET::JHead::pull |
( |
T JHead::* |
pd | ) |
|
|
inline |
Pull given data member from Head.
- Parameters
-
- Returns
- iterator of Head
Definition at line 932 of file JHead.hh.
◆ push()
template<class T >
void JAANET::JHead::push |
( |
T JHead::* |
pd | ) |
|
|
inline |
Push given data member to Head.
- Parameters
-
Definition at line 944 of file JHead.hh.
◆ erase()
template<class T >
void JAANET::JHead::erase |
( |
T JHead::* |
pd | ) |
|
|
inline |
Remove given data member from Head.
- Parameters
-
Definition at line 956 of file JHead.hh.
960 if (p != this->end()) {
964 static_cast<Head*>(
this)->erase(p);
◆ match() [1/4]
bool JAANET::JHead::match |
( |
const JHead & |
header, |
|
|
const bool |
option = true |
|
) |
| const |
|
inline |
Test match of headers.
Note that if option is set to false
, the match applies only to data which have a corresponding entry in the underlying map of the given header.
- Parameters
-
header | second header |
option | option |
- Returns
- true if matches; else false
Definition at line 979 of file JHead.hh.
◆ less()
bool JAANET::JHead::less |
( |
const JHead & |
header | ) |
const |
|
inline |
Comparison of headers.
- Parameters
-
- Returns
- true if this header less than given header; else false
Definition at line 1006 of file JHead.hh.
◆ add()
Addition of headers.
- Parameters
-
- Returns
- this header
Definition at line 1023 of file JHead.hh.
1025 if (
match(header)) {
1034 THROW(JException,
"JHead::add() headers do not match.");
◆ getEquationParameters()
Get equation parameters corresponding to Monte Carlo ASCII format, i.e:
<key>: <value> [<value>]*
<key>: <value> [<value>]*
- Returns
- equation parameters
Definition at line 1106 of file JHead.hh.
◆ setEquationParameters()
Set equation parameters.
- Parameters
-
equation | equation parameters |
Definition at line 1119 of file JHead.hh.
◆ read()
std::istream & JAANET::JHead::read |
( |
std::istream & |
in | ) |
|
Read header from input.
- Parameters
-
- Returns
- input stream
Definition at line 41 of file JHead.cc.
54 JRootReadableClass cls(*
this);
56 for (JEquation equation; reader >> equation && equation.getKey() != end_event::Class_Name(); ) {
58 JRedirectString redirect(reader, equation.getValue());
60 const JRootReadableClass abc = cls.find(equation.getKey().c_str());
63 reader.getObject(abc);
66 (*this)[equation.getKey()] = equation.getValue();
◆ write()
std::ostream & JAANET::JHead::write |
( |
std::ostream & |
out | ) |
const |
Write header to output.
- Parameters
-
- Returns
- output stream
Definition at line 79 of file JHead.cc.
86 JRootWritableClass cls(*
this);
88 TIterator* i = cls.getClass()->GetListOfDataMembers()->MakeIterator();
90 for (
const TDataMember* p; (p = (
const TDataMember*) i->Next()) != NULL; ) {
91 if (!JRootClass::is_static(*p)) {
92 if (this->find(p->GetName()) != this->end() ||
95 writer.put(p->GetName(), cls.get(*p),
true);
◆ print()
std::ostream & JAANET::JHead::print |
( |
std::ostream & |
out | ) |
const |
Print header to output.
- Parameters
-
- Returns
- output stream
Definition at line 110 of file JHead.cc.
119 JRootWritableClass cls(*
this);
121 TIterator* i = cls.getClass()->GetListOfDataMembers()->MakeIterator();
125 for (
const TDataMember* p; (p = (
const TDataMember*) i->Next()) != NULL; ) {
126 if (!JRootClass::is_static(*p)) {
128 writer.put(p->GetName(), cls.get(*p),
true);
130 end_event = make_pair(p->GetName(), cls.get(*p));
134 for (JHead::const_iterator i = this->begin(); i != this->end(); ++i) {
135 if (!cls.find(i->first.c_str()).
is_valid()) {
136 out << i->first << parameters.getDefaultSeparator() << parameters.getDefaultWhiteSpace() << i->second << parameters.getDefaultEndOfLine();
◆ ClassDef() [1/2]
JAANET::JHead::ClassDef |
( |
JHead |
, |
|
|
3 |
|
|
) |
| |
◆ match() [2/4]
template<class T >
static bool JAANET::JHead::match |
( |
const T & |
first, |
|
|
const T & |
second |
|
) |
| |
|
inlinestaticprivate |
Test match.
- Parameters
-
first | first object |
second | second object |
- Returns
- true if matches; else false
Definition at line 1163 of file JHead.hh.
1166 return first.match(second);
◆ match() [3/4]
Test one container is subset of other container or vice versa.
- Parameters
-
first | first object |
second | second object |
- Returns
- true if first (second) is subset of second (first); else false
Definition at line 1178 of file JHead.hh.
1181 if (!first.empty() && !second.empty()) {
1187 if (
match(*ix, *iy)) {
1193 return ns == first.size() || ns == second.size();
1197 return first.empty() && second.empty();
◆ match() [4/4]
template<class T >
static bool JAANET::JHead::match |
( |
const JHead & |
first, |
|
|
const JHead & |
second, |
|
|
const bool |
option, |
|
|
T JHead::* |
pd |
|
) |
| |
|
inlinestaticprivate |
Test match of given data member of headers.
Note that if option is set to false
, the match applies only to data which have a corresponding tag in the underlying map of the second header.
- Parameters
-
first | first header |
second | second header |
option | option |
pd | pointer to data member
|
- Returns
- true if matches; else false
Definition at line 1214 of file JHead.hh.
1219 if (option || second.
pull(pd) != second.end())
1220 return match(first.*pd, second.*pd);
◆ have_line()
bool Head::have_line |
( |
std::string |
key | ) |
const |
|
inlineinherited |
Check availability of data with the given key.
- Parameters
-
- Returns
- true if data are available; else false
Definition at line 48 of file Head.hh.
50 return count( key ) != 0;
◆ get_line() [1/2]
const std::string& Head::get_line |
( |
std::string |
key | ) |
const |
|
inlineinherited |
Get data with the given key.
This method throws a run-time exception if no data are available.
- Parameters
-
- Returns
- data
Definition at line 60 of file Head.hh.
◆ get_line() [2/2]
std::string& Head::get_line |
( |
std::string |
key | ) |
|
|
inlineinherited |
Get data with the given key.
This method throws a run-time exception if no data are available.
- Parameters
-
- Returns
- data
Definition at line 72 of file Head.hh.
◆ set_line()
void Head::set_line |
( |
std::string |
key, |
|
|
std::string |
line |
|
) |
| |
|
inlineinherited |
Set data with the given key.
- Parameters
-
Definition at line 83 of file Head.hh.
◆ get_field() [1/2]
std::string Head::get_field |
( |
std::string |
key, |
|
|
int |
idx |
|
) |
| const |
|
inlineinherited |
Get data with the given key at given index.
This method throws a run-time exception if no data are available.
- Parameters
-
- Returns
- data
Definition at line 96 of file Head.hh.
102 if ( idx < 0 || idx >
int (
v.size() ) )
104 THROW(
Exception,
"Cannot find word number " << idx <<
" in line " <<
get_line(key) <<
" for key: " << key);
◆ get_field() [2/2]
std::string Head::get_field |
( |
std::string |
key, |
|
|
std::string |
field |
|
) |
| const |
|
inlineinherited |
Get data with the given key at given field.
This method throws a run-time exception if no field is available.
Note that this method uses the dictionary define in method Head::_hdr_dict.
- Parameters
-
- Returns
- data
Definition at line 136 of file Head.hh.
◆ get_index_of_field()
int Head::get_index_of_field |
( |
std::string |
key, |
|
|
std::string |
field |
|
) |
| const |
|
inlineinherited |
Get index of data with the given key at given field.
Note that this method uses the dictionary define in method Head::_hdr_dict.
- Parameters
-
- Returns
- index (-1 if not present)
Definition at line 118 of file Head.hh.
121 auto i = std::find (
v.begin(),
v.end(), field );
122 if (i==
v.end())
return -1;
123 return i -
v.begin();
◆ set_field()
void Head::set_field |
( |
std::string |
key, |
|
|
std::string |
field, |
|
|
std::string |
value |
|
) |
| |
|
inlineinherited |
Set data with the given key at given field.
This method throws a run-time exception if no field available.
Note that this method uses the dictionary define in method Head::_hdr_dict.
- Parameters
-
key | key |
field | field |
value | vakue |
Definition at line 159 of file Head.hh.
163 if ( field ==
"" )
get_line( key ) = value;
169 THROW(
Exception,
"GFailed to find field in header line: " << key <<
" " << field);
175 while (
int( vals.size() ) <= idx ) vals.push_back(
"0");
◆ _hdr_dict()
Get internal description of the known lines in header.
- Returns
- internal dictionary
Definition at line 209 of file Head.hh.
216 if (
r.size() > 0 )
return r;
220 "cut_primary cut_seamuon cut_in cut_nu:Emin Emax cosTmin cosTmax\n"
221 "generator physics simul: program version date time\n"
222 "seed:program level iseed\n"
223 "PM1_type_area:type area TTS\n"
225 "model:interaction muon scattering numberOfEnergyBins\n"
227 "genvol:zmin zmax r volume numberOfEvents\n"
229 "coord_origin:x y z\n"
231 "genhencut:gDir Emin\n"
233 "norma:primaryFlux numberOfPrimaries\n"
234 "livetime:numberOfSeconds errorOfSeconds\n"
235 "flux:type key file_1 file_2\n"
237 "fixedcan:xcenter ycenter zmin zmax radius\n"
◆ ngen()
double Head::ngen |
( |
| ) |
const |
|
inlineinherited |
Get the number of generated events needed for computing event rates.
- Returns
- number of events
Definition at line 259 of file Head.hh.
261 return stod (
get_field(
"genvol",
"numberOfEvents") );
◆ daq_livetime()
double Head::daq_livetime |
( |
| ) |
const |
|
inlineinherited |
Get the the live time provided by the DAQ sytstem (=number of processed timeslices * frametime).
- Returns
- live time [s]
Definition at line 269 of file Head.hh.
271 return stod (
get_field(
"DAQ",
"livetime") );
◆ mc_livetime()
double Head::mc_livetime |
( |
| ) |
const |
|
inlineinherited |
Get the Monte Carlo live time.
- Returns
- live time [s]
Definition at line 280 of file Head.hh.
282 return stod (
get_field(
"livetime",
"numberOfSeconds") );
◆ coord_origin()
Vec Head::coord_origin |
( |
| ) |
const |
|
inlineinherited |
Get coordinate origin.
- Returns
- position
Definition at line 290 of file Head.hh.
◆ translate()
Vec Head::translate |
( |
| ) |
const |
|
inlineinherited |
Get coordinate translation.
- Returns
- translation
Definition at line 302 of file Head.hh.
◆ ClassDef() [2/2]
Head::ClassDef |
( |
Head |
, |
|
|
2 |
|
|
) |
| |
|
inherited |
◆ operator==
bool operator== |
( |
const JHead & |
first, |
|
|
const JHead & |
second |
|
) |
| |
|
friend |
Equal operator.
Note that this operator uses the JHead::match method.
- Parameters
-
first | first header |
second | second header |
- Returns
- true if two headers are equal; else false
Definition at line 1050 of file JHead.hh.
1053 return first.
match(second);
◆ operator<
bool operator< |
( |
const JHead & |
first, |
|
|
const JHead & |
second |
|
) |
| |
|
friend |
Less than operator.
- Parameters
-
first | first header |
second | second header |
- Returns
- true if first header is less than second header; else false
Definition at line 1064 of file JHead.hh.
1067 return first.
less(second);
◆ GENHEN
const std::string JAANET::JHead::GENHEN = "GENHEN" |
|
static |
Generators.
Applications.
Definition at line 845 of file JHead.hh.
◆ GENIE
const std::string JAANET::JHead::GENIE = "GENIE" |
|
static |
◆ GSEAGEN
const std::string JAANET::JHead::GSEAGEN = "gSeaGen" |
|
static |
◆ MUPAGE
const std::string JAANET::JHead::MUPAGE = "HEMAS-DPM" |
|
static |
◆ JSIRENE
const std::string JAANET::JHead::JSIRENE = "JSirene" |
|
static |
◆ KM3
const std::string JAANET::JHead::KM3 = "KM3" |
|
static |
◆ KM3SIM
const std::string JAANET::JHead::KM3SIM = "KM3Sim" |
|
static |
◆ start_run
◆ XSecFile
◆ detector
◆ muon_desc_file
◆ target
◆ physics
◆ simul
◆ cut_primary
◆ cut_seamuon
◆ cut_in
◆ cut_nu
◆ spectrum
◆ can
◆ fixedcan
◆ genvol
◆ coord_origin
◆ genhencut
◆ norma
◆ livetime
◆ seabottom
◆ DAQ
◆ tgen
◆ primary
◆ end_event
The documentation for this struct was generated from the following files:
std::vector< JAANET::physics > physics
std::vector< JAANET::simul > simul
bool match(const JHead &header, const bool option=true) const
Test match of headers.
JAANET::end_event end_event
JAANET::fixedcan fixedcan
static std::map< std::string, std::vector< std::string > > & _hdr_dict()
Get internal description of the known lines in header.
bool less(const cut &object) const
Comparison.
livetime & add(const livetime &object)
Addition.
JAANET::livetime livetime
T & getInstance(const T &object)
Get static instance from temporary object.
bool is_valid(const T &value)
Check validity of given value.
JAANET::seabottom seabottom
bool less(const primary &object) const
Comparison.
JAANET::start_run start_run
genvol & add(const genvol &object)
Addition.
void copy(const Head &from, JHead &to)
Copy header from from to to.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::vector< std::string > splitstring(const std::string &str, char delim=' ')
Split string into separate tokens.
const TDataMember * getDataMember(const JRootClass &parent, const JRootClass &member)
Get ROOT data member for given parent and member class.
const_iterator pull(T JHead::*pd) const
Pull given data member from Head.
static JStat getFileStatus
Function object for file status.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Phase space of primary particle.
const std::string & get_line(std::string key) const
Get data with the given key.
std::string get_field(std::string key, int idx) const
Get data with the given key at given index.
Simple data structure to support I/O of equations (see class JLANG::JEquation).
int get_index_of_field(std::string key, std::string field) const
Get index of data with the given key at given field.
static JLANG::JEquationParameters & getEquationParameters()
Get equation parameters corresponding to Monte Carlo ASCII format, i.e:
Vec coord_origin() const
Get coordinate origin.
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Normalisation of MUPAGE events.
JAANET::cut_seamuon cut_seamuon
norma & add(const norma &object)
Addition.
JAANET::spectrum spectrum
void set_line(std::string key, std::string line)
Set data with the given key.
Normlisation of CORSIKA events.
bool less(const JHead &header) const
Comparison of headers.
JAANET::cut_primary cut_primary
DAQ & add(const DAQ &object)
Addition.