Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JAANET::JNeutrinoInteractionCategory Struct Referencefinal

Class for neutrino interaction categories. More...

#include <JNeutrinoInteractionCategory.hh>

Inheritance diagram for JAANET::JNeutrinoInteractionCategory:
JLANG::JClonable< JClonable_t, JDerived_t >

Classes

struct  JNeutrinoInteractionCategoryHelper
 Auxiliary class for I/O of neutrino interaction category. More...
 

Public Types

typedef JTOOLS::JRange< double > JRange_t
 
typedef JClonable< JClonable_t >::clone_type clone_type
 

Public Member Functions

 JNeutrinoInteractionCategory ()
 Default constructor.
 
 JNeutrinoInteractionCategory (const int neutrinoType)
 Constructor.
 
 JNeutrinoInteractionCategory (const int neutrinoType, const JRange_t &Erange, const JRange_t &coszRange)
 Constructor.
 
 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.
 
 JNeutrinoInteractionCategory (const JHead &header, const int primaryType)
 Constructor.
 
 JNeutrinoInteractionCategory (const JHead &header)
 Constructor.
 
bool is_valid () const override final
 Check if neutrino interaction categories is valid.
 
bool match (const JHead &header) const override final
 Check whether this event category matches with the given MC header.
 
bool match (const Evt &event) const override final
 Check whether given event matches with this event category.
 
bool less (const JEvtCategory &category) const override final
 Less-than method.
 
JProperties getProperties (const JEquationParameters &eqpars=JEvtCategory::getEquationParameters()) override final
 Get properties of this class.
 
JProperties getProperties (const JEquationParameters &eqpars=JEvtCategory::getEquationParameters()) const override final
 Get properties of this class.
 
virtual clone_type clone () const override
 Get clone of this object.
 

Private Attributes

JParameter< int > interactionType
 interaction type
 
JParameter< int > scatteringType
 scattering type
 
JParameter< int > targetZ
 target atomic number
 
JParameter< int > targetA
 target mass number
 
JRange_t Erange
 neutrino energy range
 
JRange_t coszRange
 cosine zenith range
 

Detailed Description

Class for neutrino interaction categories.

Definition at line 134 of file JNeutrinoInteractionCategory.hh.

Member Typedef Documentation

◆ JRange_t

◆ clone_type

template<class JClonable_t , class JDerived_t >
JClonable<JClonable_t>::clone_type JLANG::JClonable< JClonable_t, JDerived_t >::clone_type
inherited

Definition at line 61 of file JClonable.hh.

Constructor & Destructor Documentation

◆ JNeutrinoInteractionCategory() [1/6]

JAANET::JNeutrinoInteractionCategory::JNeutrinoInteractionCategory ( )
inline

Default constructor.

Definition at line 143 of file JNeutrinoInteractionCategory.hh.

143 :
146 targetZ (),
147 targetA (),
150 {}
static const JRange< double > DEFAULT_NEUTRINO_ENERGY_RANGE
Default neutrino energy range [GeV].
static const JRange< double > DEFAULT_NEUTRINO_COSINE_ZENITH_ANGLE_RANGE
Default neutrino cosine zenith angle range [-].
JParameter< int > interactionType
interaction type
JParameter< int > targetZ
target atomic number
JParameter< int > targetA
target mass number
JParameter< int > scatteringType
scattering type

◆ JNeutrinoInteractionCategory() [2/6]

JAANET::JNeutrinoInteractionCategory::JNeutrinoInteractionCategory ( const int neutrinoType)
inline

Constructor.

Parameters
neutrinoTypeneutrino PDG type

Definition at line 158 of file JNeutrinoInteractionCategory.hh.

158 :
161 targetZ (),
162 targetA (),
165 {
166 this->primaryType = neutrinoType;
167
168 check_validity();
169 }

◆ JNeutrinoInteractionCategory() [3/6]

JAANET::JNeutrinoInteractionCategory::JNeutrinoInteractionCategory ( const int neutrinoType,
const JRange_t & Erange,
const JRange_t & coszRange )
inline

Constructor.

Parameters
neutrinoTypeneutrino PDG type
Erangeneutrino energy range
coszRangezenith-angle range

Definition at line 179 of file JNeutrinoInteractionCategory.hh.

181 :
184 targetZ (),
185 targetA (),
186 Erange (Erange),
188 {
189 this->primaryType = neutrinoType;
190
191 check_validity();
192 }

◆ JNeutrinoInteractionCategory() [4/6]

JAANET::JNeutrinoInteractionCategory::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 )
inline

Constructor.

Parameters
neutrinoTypeneutrino PDG type
interactionTypeinteraction type
scatteringTypescattering type
targetZtarget atomic number
targetAtarget mass number
Erangeneutrino energy range
coszRangezenith-angle range

Definition at line 206 of file JNeutrinoInteractionCategory.hh.

212 :
217 Erange (Erange),
219 {
220 this->primaryType = neutrinoType;
221
222 check_validity();
223 }

◆ JNeutrinoInteractionCategory() [5/6]

JAANET::JNeutrinoInteractionCategory::JNeutrinoInteractionCategory ( const JHead & header,
const int primaryType )
inline

Constructor.

Parameters
headerMC header
primaryTypeprimary PDG type

Definition at line 232 of file JNeutrinoInteractionCategory.hh.

233 :
235 {
236 using namespace std;
237 using namespace JPP;
238
239 if (is_gseagen(header)) {
240
241 vector<JAANET::flux>::const_iterator i = find_if(header.flux.cbegin(), header.flux.cend(),
242 make_predicate(&JAANET::flux::type, primaryType));
243
244 if (primaryType == header.primary.type || i != header.flux.cend()) {
245 this->primaryType = primaryType;
246 } else {
247 THROW(JValueOutOfRange, "JNeutrinoInteractionCategory::JNeutrinoInteractionCategory(): Given header does not match with given primary type " << primaryType << ".");
248 }
249
250 const JInteractionTypeGENIE_t intType = getInteractionType(header);
251
252 if (intType != JInteractionTypeGENIE_t::UNDEFINED) {
253 interactionType = (int) intType;
254 }
255
257 JParameter<int> > targetInfo = getTargetInfo(header);
258
259 targetZ = targetInfo.first;
260 targetA = targetInfo.second;
261
262 if (header.cut_nu.E.is_valid() &&
263 header.cut_nu.E != cut().E) {
264 Erange = header.cut_nu.E;
265 }
266
267 if (header.cut_nu.cosT.is_valid() &&
268 header.cut_nu.cosT != cut().cosT) {
269 coszRange = header.cut_nu.cosT;
270 }
271 }
272
273 check_validity();
274 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Exception for accessing a value in a collection that is outside of its range.
std::pair< JParameter< int >, JParameter< int > > getTargetInfo(const JHead &header)
Auxiliary function to retrieve the target atomic number and mass number.
JInteractionTypeGENIE_t getInteractionType(const int intType)
Auxiliary function to convert interaction types.
JInteractionTypeGENIE_t
Enumeration of GENIE interaction types.
@ UNDEFINED
Unknown interaction type.
bool is_gseagen(const JHead &header)
Check for generator.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
General purpose class of phase space generation.
Definition JHead.hh:341
int type
Type.
Definition JHead.hh:940

◆ JNeutrinoInteractionCategory() [6/6]

JAANET::JNeutrinoInteractionCategory::JNeutrinoInteractionCategory ( const JHead & header)
inline

Constructor.

N.B.: In this method, the neutrino PDG type is taken from JAANET::JHead::primary::type.

Parameters
headerMC header

Definition at line 284 of file JNeutrinoInteractionCategory.hh.

284 :
285 JNeutrinoInteractionCategory(header, header.primary.type)
286 {}

Member Function Documentation

◆ is_valid()

bool JAANET::JNeutrinoInteractionCategory::is_valid ( ) const
inlinefinaloverride

Check if neutrino interaction categories is valid.

Returns
true if neutrino interaction category is valid; else false

Definition at line 294 of file JNeutrinoInteractionCategory.hh.

295 {
296 if (!is_neutrino_primary(this->primaryType)) {
297 return false;
298 }
299
300 if ( interactionType.isDefined() &&
303 return false;
304 }
305
306 if ( scatteringType.isDefined() &&
311 return false;
312 }
313
314 if (targetZ.isDefined() && targetZ.getValue() <= 0) {
315 return false;
316 }
317
318 if ( targetA.isDefined() &&
319 (!targetZ.isDefined() || targetA.getValue() < targetZ.getValue())) {
320 return false;
321 }
322
323 return Erange.is_valid() && coszRange.is_valid();
324 }
bool is_valid() const
Check validity of range.
Definition JRange.hh:311
@ DARK_MATTER_SCATTERING_TYPES_END
End of dark matter scattering types.
@ NEUTRINO_SCATTERING_TYPES_END
End of standard scattering types.
@ DARK_MATTER_SCATTERING_TYPES_START
Start of dark matter scattering types.
@ NEUTRINO_SCATTERING_TYPES_START
Start of standard scattering types.
@ INTERACTION_TYPES_END
End of interaction types.
@ INTERACTION_TYPES_START
Start of interaction types.
bool is_neutrino_primary(const int type)
Auxiliary function to check if given PDG code corresponds to a neutrino.

◆ match() [1/2]

bool JAANET::JNeutrinoInteractionCategory::match ( const JHead & header) const
inlinefinaloverride

Check whether this event category matches with the given MC header.

Parameters
headerheader
Returns
true if matching; else false

Definition at line 333 of file JNeutrinoInteractionCategory.hh.

334 {
335 if (is_gseagen(header)) {
336
337 const JNeutrinoInteractionCategory cat(header);
338
339 return (this->primaryType == cat.primaryType &&
340 this->interactionType == cat.interactionType &&
341 this->scatteringType == cat.scatteringType &&
342 this->targetZ == cat.targetZ &&
343 this->targetA == cat.targetA &&
344 this->Erange .overlap(cat.Erange) &&
345 this->coszRange .overlap(cat.coszRange));
346
347 } else {
348
349 return false;
350 }
351 }

◆ match() [2/2]

bool JAANET::JNeutrinoInteractionCategory::match ( const Evt & event) const
inlinefinaloverride

Check whether given event matches with this event category.

Parameters
eventevent
Returns
true if matching; else false

Definition at line 360 of file JNeutrinoInteractionCategory.hh.

361 {
362 using namespace std;
363 using namespace JPP;
364
365 const Trk& primary = get_primary(event);
366
367 if (!is_neutrino(primary)) { return false; }
368
369 if (interactionType.isDefined() &&
370 event.w2list.size() > W2LIST_GSEAGEN_CC &&
371 interactionType.getValue() != event.w2list[W2LIST_GSEAGEN_CC]) {
372 return false;
373 }
374
375 if (scatteringType.isDefined() &&
376 event.w2list.size() > W2LIST_GSEAGEN_ICHAN &&
377 scatteringType.getValue() != event.w2list[W2LIST_GSEAGEN_ICHAN]) {
378 return false;
379 }
380
381 if (targetZ.isDefined() &&
382 event.w2list.size() > W2LIST_GSEAGEN_TARGETZ &&
383 targetZ.getValue() != event.w2list[W2LIST_GSEAGEN_TARGETZ]) {
384 return false;
385 }
386
387 if (targetA != 0 &&
388 event.w2list.size() > W2LIST_GSEAGEN_TARGETA &&
389 targetA.getValue() != event.w2list[W2LIST_GSEAGEN_TARGETA]) {
390 return false;
391 }
392
393 return Erange(primary.E) && coszRange(-primary.dir.z);
394 }
const Trk & get_primary(const Evt &evt)
Auxiliary function to retrieve the primary track of an event.
bool is_neutrino(const Trk &track)
Test whether given track is a neutrino.
std::vector< double > w2list
MC: factors that make up w[1]=w2 (see e.g. Tag list or km3net-dataformat/definitions)
Definition Evt.hh:43
Primary particle.
Definition JHead.hh:1174
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition Trk.hh:15
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.

◆ less()

bool JAANET::JNeutrinoInteractionCategory::less ( const JEvtCategory & category) const
inlinefinaloverride

Less-than method.

Note: The energy and cosine zenith-angle ranges are compared based on the lower limit first.
If the lower limits are equal, the upper limits are compared.

Parameters
categoryevent category
Returns
true if first this event category less than given event category; else false

Definition at line 406 of file JNeutrinoInteractionCategory.hh.

407 {
408#define RETURN_IF_DIFFERENT(A, B) \
409 if (A != B) { return A < B; }
410
411 RETURN_IF_DIFFERENT(this->primaryType, category.getPrimaryType());
412
413 const JNeutrinoInteractionCategory* p = dynamic_cast<const JNeutrinoInteractionCategory*>(&category);
414
415 if (p == NULL) { return false; }
416
417 RETURN_IF_DIFFERENT(this->interactionType, p->interactionType);
418 RETURN_IF_DIFFERENT(this->scatteringType, p->scatteringType);
419 RETURN_IF_DIFFERENT(this->targetZ, p->targetZ);
420 RETURN_IF_DIFFERENT(this->targetA, p->targetA);
421
422 if (p->Erange != this->Erange) {
423 return (this->Erange.getLowerLimit() == p->Erange.getLowerLimit() ?
424 this->Erange.getUpperLimit() < p->Erange.getUpperLimit() :
425 this->Erange.getLowerLimit() < p->Erange.getLowerLimit());
426 } else {
427 return (this->coszRange.getLowerLimit() == p->coszRange.getLowerLimit() ?
428 this->coszRange.getUpperLimit() < p->coszRange.getUpperLimit() :
429 this->coszRange.getLowerLimit() < p->coszRange.getLowerLimit());
430 }
431#undef RETURN_IF_DIFFERENT
432 }
#define RETURN_IF_DIFFERENT(A, B)
T getLowerLimit() const
Get lower limit.
Definition JRange.hh:202

◆ getProperties() [1/2]

JProperties JAANET::JNeutrinoInteractionCategory::getProperties ( const JEquationParameters & eqpars = JEvtCategory::getEquationParameters())
inlinefinaloverride

Get properties of this class.

Parameters
eqparsequation parameters

Definition at line 440 of file JNeutrinoInteractionCategory.hh.

441 {
442 return JNeutrinoInteractionCategoryHelper(*this, eqpars);
443 }

◆ getProperties() [2/2]

JProperties JAANET::JNeutrinoInteractionCategory::getProperties ( const JEquationParameters & eqpars = JEvtCategory::getEquationParameters()) const
inlinefinaloverride

Get properties of this class.

Parameters
eqparsequation parameters

Definition at line 451 of file JNeutrinoInteractionCategory.hh.

452 {
453 return JNeutrinoInteractionCategoryHelper(*this, eqpars);
454 }

◆ clone()

template<class JClonable_t , class JDerived_t >
virtual clone_type JLANG::JClonable< JClonable_t, JDerived_t >::clone ( ) const
inlineoverridevirtualinherited

Member Data Documentation

◆ interactionType

JParameter<int> JAANET::JNeutrinoInteractionCategory::interactionType
private

interaction type

Definition at line 459 of file JNeutrinoInteractionCategory.hh.

◆ scatteringType

JParameter<int> JAANET::JNeutrinoInteractionCategory::scatteringType
private

scattering type

Definition at line 460 of file JNeutrinoInteractionCategory.hh.

◆ targetZ

JParameter<int> JAANET::JNeutrinoInteractionCategory::targetZ
private

target atomic number

Definition at line 461 of file JNeutrinoInteractionCategory.hh.

◆ targetA

JParameter<int> JAANET::JNeutrinoInteractionCategory::targetA
private

target mass number

Definition at line 462 of file JNeutrinoInteractionCategory.hh.

◆ Erange

JRange_t JAANET::JNeutrinoInteractionCategory::Erange
private

neutrino energy range

Definition at line 463 of file JNeutrinoInteractionCategory.hh.

◆ coszRange

JRange_t JAANET::JNeutrinoInteractionCategory::coszRange
private

cosine zenith range

Definition at line 464 of file JNeutrinoInteractionCategory.hh.


The documentation for this struct was generated from the following file: