Match header for JSirene.cc.
More...
#include <JHeadToolkit.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...
|
|
Match header for JSirene.cc.
Definition at line 99 of file JHeadToolkit.hh.
◆ getSireneHeader()
JAANET::getSireneHeader::getSireneHeader |
( |
| ) |
|
|
inline |
◆ coord_origin()
Vec Head::coord_origin |
( |
| ) |
const |
|
inlineinherited |
Get coordinate origin.
- Returns
- position
Definition at line 290 of file Head.hh.
◆ getHeader() [1/2]
const JHead& JAANET::JHead::getHeader |
( |
| ) |
const |
|
inlineinherited |
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 |
( |
| ) |
|
|
inlineinherited |
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 | ) |
|
|
inlineinherited |
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 |
|
inlineinherited |
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 | ) |
|
|
inlineinherited |
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 | ) |
|
|
inlineinherited |
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 | ) |
|
|
inlineinherited |
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 |
|
inlineinherited |
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.
◆ match() [2/4]
template<class T >
static bool JAANET::JHead::match |
( |
const T & |
first, |
|
|
const T & |
second |
|
) |
| |
|
inlinestaticprivateinherited |
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]
template<class T >
|
inlinestaticprivateinherited |
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 |
|
) |
| |
|
inlinestaticprivateinherited |
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);
◆ less()
bool JAANET::JHead::less |
( |
const JHead & |
header | ) |
const |
|
inlineinherited |
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 | ) |
|
|
inherited |
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 |
|
inherited |
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 |
|
inherited |
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 |
|
|
) |
| |
|
inherited |
◆ ClassDef() [2/2]
Head::ClassDef |
( |
Head |
, |
|
|
2 |
|
|
) |
| |
|
inherited |
◆ 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") );
◆ translate()
Vec Head::translate |
( |
| ) |
const |
|
inlineinherited |
Get coordinate translation.
- Returns
- translation
Definition at line 302 of file Head.hh.
◆ GENHEN
const std::string JAANET::JHead::GENHEN = "GENHEN" |
|
staticinherited |
Generators.
Applications.
Definition at line 845 of file JHead.hh.
◆ GENIE
const std::string JAANET::JHead::GENIE = "GENIE" |
|
staticinherited |
◆ GSEAGEN
const std::string JAANET::JHead::GSEAGEN = "gSeaGen" |
|
staticinherited |
◆ MUPAGE
const std::string JAANET::JHead::MUPAGE = "HEMAS-DPM" |
|
staticinherited |
◆ JSIRENE
const std::string JAANET::JHead::JSIRENE = "JSirene" |
|
staticinherited |
◆ KM3
const std::string JAANET::JHead::KM3 = "KM3" |
|
staticinherited |
◆ KM3SIM
const std::string JAANET::JHead::KM3SIM = "KM3Sim" |
|
staticinherited |
◆ 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 file:
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.
static const std::string JSIRENE
JAANET::seabottom seabottom
bool less(const primary &object) const
Comparison.
JAANET::start_run start_run
genvol & add(const genvol &object)
Addition.
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.
void push(T JHead::*pd)
Push given data member to Head.
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.
JAANET::cut_primary cut_primary
DAQ & add(const DAQ &object)
Addition.