1 #ifndef __JAANET__JNEUTRINOINTERACTIONCATEGORY__
2 #define __JAANET__JNEUTRINOINTERACTIONCATEGORY__
59 const int absType = abs(type);
82 istringstream iss(i->buffer);
84 for (
string buffer; iss >> buffer ;) {
87 return JInteractionTypeGENIE_t::WEAK_NEUTRAL_CURRENT;
89 return JInteractionTypeGENIE_t::WEAK_CHARGED_CURRENT;
118 if (! (iss.peek() == (
int)
'A' &&
119 iss.ignore() && iss >> A &&
120 iss.peek() == (
int)
'Z' &&
121 iss.ignore() && iss >> Z &&
127 return make_pair(Z,A);
135 public JClonable<JEvtCategory, JNeutrinoInteractionCategory>
166 this->primaryType = neutrinoType;
187 coszRange (coszRange)
189 this->primaryType = neutrinoType;
213 interactionType((int) interactionType),
214 scatteringType ((int) scatteringType),
218 coszRange (coszRange)
220 this->primaryType = neutrinoType;
233 const int primaryType) :
245 this->primaryType = primaryType;
247 THROW(
JValueOutOfRange,
"JNeutrinoInteractionCategory::JNeutrinoInteractionCategory(): Given header does not match with given primary type " << primaryType <<
".");
253 interactionType = (int) intType;
259 targetZ = targetInfo.first;
260 targetA = targetInfo.second;
300 if ( interactionType.isDefined() &&
301 !(interactionType.getValue() > (
int) JInteractionTypeGENIE_t::INTERACTION_TYPES_START &&
302 interactionType.getValue() < (
int) JInteractionTypeGENIE_t::INTERACTION_TYPES_END) ) {
306 if ( scatteringType.isDefined() &&
307 !((scatteringType > (
int) JScatteringTypeGENIE_t::NEUTRINO_SCATTERING_TYPES_START &&
308 scatteringType < (
int) JScatteringTypeGENIE_t::NEUTRINO_SCATTERING_TYPES_END) ||
309 (scatteringType > (
int) JScatteringTypeGENIE_t::DARK_MATTER_SCATTERING_TYPES_START &&
310 scatteringType < (
int) JScatteringTypeGENIE_t::DARK_MATTER_SCATTERING_TYPES_END)) ) {
314 if (targetZ.isDefined() && targetZ.getValue() <= 0) {
318 if ( targetA.isDefined() &&
319 (!targetZ.isDefined() || targetA.getValue() < targetZ.getValue())) {
323 return Erange.is_valid() && coszRange.is_valid();
339 return (this->primaryType == cat.primaryType &&
342 this->targetZ == cat.
targetZ &&
343 this->targetA == cat.
targetA &&
344 this->Erange .overlap(cat.
Erange) &&
345 this->coszRange .overlap(cat.
coszRange));
369 if (interactionType.isDefined() &&
375 if (scatteringType.isDefined() &&
381 if (targetZ.isDefined() &&
408 #define RETURN_IF_DIFFERENT(A, B) \
409 if (A != B) { return A < B; }
415 if (p == NULL) {
return false; }
422 if (p->
Erange != this->Erange) {
431 #undef RETURN_IF_DIFFERENT
479 template<
class JNeutrinoInteractionCategory_t>
484 (*this)[
"neutrinoType"] = cat.primaryType;
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition of GENIE neutrino interaction types.
#define RETURN_IF_DIFFERENT(A, B)
Definition of particle types.
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Auxiliary class to define a range between two values.
std::vector< JAANET::flux > flux
std::vector< JAANET::physics > physics
Utility class to parse parameter values.
Simple data structure to support I/O of equations (see class JLANG::JEquation).
Exception for accessing a value in a collection that is outside of its range.
Extensions to Evt data format.
JScatteringTypeGENIE_t
Enumeration of GENIE scattering types.
const Trk & get_primary(const Evt &evt)
Get primary.
std::pair< JParameter< int >, JParameter< int > > getTargetInfo(const JHead &header)
Auxiliary function to retrieve the target atomic number and mass number.
static const char *const CHARGED_CURRENT
Charged current header string identifier.
JInteractionTypeGENIE_t getInteractionType(const JHead &header)
Auxiliary function to retrieve the GENIE interaction type corresponding to a given header.
bool is_neutrino(const Trk &track)
Test whether given track is a neutrino.
JInteractionTypeGENIE_t
Enumeration of GENIE interaction types.
@ UNDEFINED
Unknown interaction type.
static const char *const NEUTRAL_CURRENT
Neutral current header string identifier.
bool is_gseagen(const JHead &header)
Check for generator.
static const JRange< double > DEFAULT_NEUTRINO_ENERGY_RANGE
Default neutrino energy range [GeV].
bool is_neutrino_primary(const int type)
Auxiliary function to check if given PDG code corresponds to a neutrino.
static const JRange< double > DEFAULT_NEUTRINO_COSINE_ZENITH_ANGLE_RANGE
Default neutrino cosine zenith angle range [-].
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Low-level interface for event categories.
static JEquationParameters & getEquationParameters()
Get equation parameters.
Auxiliary class for I/O of neutrino interaction category.
JNeutrinoInteractionCategoryHelper(JNeutrinoInteractionCategory_t &cat, const JEquationParameters &eqpars)
Constructor.
Class for neutrino interaction categories.
JNeutrinoInteractionCategory(const JHead &header, const int primaryType)
Constructor.
bool is_valid() const override final
Check if neutrino interaction categories is valid.
JProperties getProperties(const JEquationParameters &eqpars=JEvtCategory::getEquationParameters()) override final
Get properties of this class.
JTOOLS::JRange< double > JRange_t
bool match(const Evt &event) const override final
Check whether given event matches with this event category.
JParameter< int > interactionType
interaction type
JNeutrinoInteractionCategory(const int neutrinoType, const JRange_t &Erange, const JRange_t &coszRange)
Constructor.
JNeutrinoInteractionCategory(const JHead &header)
Constructor.
JRange_t coszRange
cosine zenith range
JNeutrinoInteractionCategory(const int neutrinoType, const JInteractionTypeGENIE_t interactionType, const JScatteringTypeGENIE_t scatteringType, const int targetZ, const int targetA, const JRange_t &Erange, const JRange_t &coszRange)
Constructor.
bool less(const JEvtCategory &category) const override final
Less-than method.
JNeutrinoInteractionCategory()
Default constructor.
JNeutrinoInteractionCategory(const int neutrinoType)
Constructor.
JParameter< int > targetZ
target atomic number
JProperties getProperties(const JEquationParameters &eqpars=JEvtCategory::getEquationParameters()) const override final
Get properties of this class.
JRange_t Erange
neutrino energy range
bool match(const JHead &header) const override final
Check whether this event category matches with the given MC header.
JParameter< int > targetA
target mass number
JParameter< int > scatteringType
scattering type
std::string buffer
General purpose name.
General purpose class of phase space generation.
JRange_t cosT
Cosine zenith angle range
JRange_t E
Energy range [GeV].
Template class for object cloning.
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
static const int W2LIST_GSEAGEN_CC
Charged current interaction flag.
static const int W2LIST_GSEAGEN_TARGETZ
number of protons in the target
static const int W2LIST_GSEAGEN_TARGETA
number of nuclons in the target
static const int W2LIST_GSEAGEN_ICHAN
Interaction channel.