LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::InteractionDescriptor Class Reference

#include "LArInteractionTypeHelper.h"

Public Member Functions

 InteractionDescriptor (const bool isCC, const bool isQE, const bool isRes, const bool isDIS, const bool isCoherent, const bool isNumu, const bool isNue, const unsigned int nPiPlus, const unsigned int nPiMinus, const unsigned int nPhotons, const unsigned int nProtons)
 Constructor. More...
 
bool IsCC () const
 Whether or not the interaction is CC. More...
 
bool IsQE () const
 Whether or not the interaction is QE. More...
 
bool IsResonant () const
 Whether or not the interaction is resonant. More...
 
bool IsDIS () const
 Whether or not the interaction is DIS. More...
 
bool IsCoherent () const
 Whether or not the interaction is coherent. More...
 
bool IsMuonNeutrino () const
 Whether or not the interaction is muon neutrino. More...
 
bool IsElectronNeutrino () const
 Whether or not the interaction is electron neutrino. More...
 
unsigned int GetNumPiZero () const
 Retrieve the number of pi zeros. More...
 
unsigned int GetNumPiPlus () const
 Retrieve the number of pi plus. More...
 
unsigned int GetNumPiMinus () const
 Retrieve the number of pi minus. More...
 
unsigned int GetNumPhotons () const
 Retrieve the number of photons. More...
 
unsigned int GetNumProtons () const
 Retrieve the number of protons. More...
 
int GetUniqueId () const
 Retrieve a unique ID describing the event (that is, a given type of interaction with specific final state particles has a particular ID) More...
 
const std::string & ToString () const
 Retrieve the string descriptor for the event. More...
 

Static Public Attributes

static const int CC = 8192
 
static const int NC = 4096
 
static const int QE = 2560
 
static const int RES = 2048
 
static const int DIS = 1536
 
static const int COH = 1024
 
static const int OTH = 512
 
static const int MU = 256
 
static const int E = 128
 
static const int PIZERO = 64
 
static const int PIPLUS = 32
 
static const int PIMINUS = 16
 
static const int PHOTON = 8
 
static const int NP = 6
 

Private Attributes

const bool m_isCC
 
const bool m_isQE
 
const bool m_isResonant
 
const bool m_isDIS
 
const bool m_isCoherent
 
const bool m_isNumu
 
const bool m_isNue
 
const unsigned int m_nPiZero
 
const unsigned int m_nPiPlus
 
const unsigned int m_nPiMinus
 
const unsigned int m_nPhotons
 
const unsigned int m_nProtons
 
int m_id
 
std::string m_descriptor
 

Detailed Description

Definition at line 331 of file LArInteractionTypeHelper.h.

Constructor & Destructor Documentation

lar_content::InteractionDescriptor::InteractionDescriptor ( const bool  isCC,
const bool  isQE,
const bool  isRes,
const bool  isDIS,
const bool  isCoherent,
const bool  isNumu,
const bool  isNue,
const unsigned int  nPiPlus,
const unsigned int  nPiMinus,
const unsigned int  nPhotons,
const unsigned int  nProtons 
)

Constructor.

Parameters
isCCWhether or not the interaction is a CC interaction
isQEWhether or not the interaction is a QE interaction
isResWhether or not the interaction is a resonant interaction
isDISWhether or not the interaction is a DIS interaction
isCoherentWhether or not the interaction is a coherent interaction
isNumuWhether or not the interaction is a numu interaction
isNueWhether or not the interaction is a nue interaction
nPiPlusNumber of pi plus in the final state
nPiMinusNumber of pi minus in the final state
nPhotonsNumber of photons in the final state
nProtonsNumber of protons in the final state

Definition at line 747 of file LArInteractionTypeHelper.cc.

References CC, COH, DIS, E, m_descriptor, m_id, m_isCC, m_isCoherent, m_isDIS, m_isNue, m_isNumu, m_isQE, m_isResonant, m_nPhotons, m_nPiMinus, m_nPiPlus, m_nPiZero, m_nProtons, MU, NC, NP, OTH, PHOTON, PIMINUS, PIPLUS, PIZERO, QE, RES, and util::to_string().

749  :
750  m_isCC{isCC},
751  m_isQE{isQE},
752  m_isResonant{isRes},
753  m_isDIS{isDIS},
754  m_isCoherent{isCoherent},
755  m_isNumu{isNumu},
756  m_isNue{isNue},
757  m_nPiZero{nPhotons / 2},
758  m_nPiPlus{nPiPlus},
759  m_nPiMinus{nPiMinus},
760  m_nPhotons{nPhotons % 2},
761  m_nProtons{nProtons},
762  m_id{0},
763  m_descriptor{}
764 {
765  m_id += m_isCC ? CC : NC;
766  m_descriptor += m_isCC ? "CC" : "NC";
767  if (isQE)
768  {
769  m_id += QE;
770  m_descriptor += "QE";
771  }
772  else if (isRes)
773  {
774  m_id += RES;
775  m_descriptor += "RES";
776  }
777  else if (isDIS)
778  {
779  m_id += DIS;
780  m_descriptor += "DIS";
781  }
782  else if (isCoherent)
783  {
784  m_id += COH;
785  m_descriptor += "COH";
786  }
787  else
788  {
789  m_id += OTH;
790  m_descriptor += "OTH";
791  }
792 
793  if (m_isNumu)
794  {
795  m_id += MU;
796  m_descriptor += "_MU";
797  }
798  else if (m_isNue)
799  {
800  m_id += E;
801  m_descriptor += "_E";
802  }
803 
804  m_id += m_nPiZero == 1 ? PIZERO : 0;
805  m_descriptor += m_nPiZero == 1 ? "_PIZERO" : m_nPiZero > 0 ? "_NPIZERO" : "";
806  m_id += m_nPiPlus == 1 ? PIPLUS : 0;
807  m_descriptor += m_nPiPlus == 1 ? "_PIPLUS" : m_nPiPlus > 0 ? "_NPIPLUS" : "";
808  m_id += m_nPiMinus == 1 ? PIMINUS : 0;
809  m_descriptor += m_nPiMinus == 1 ? "_PIMINUS" : m_nPiMinus > 0 ? "_NPIMINUS" : "";
810  m_id += m_nPhotons == 1 ? PHOTON : 0;
811  m_descriptor += m_nPhotons == 1 ? "_PHOTON" : "";
812  m_id += m_nProtons < NP ? m_nProtons : NP;
813  m_descriptor += m_nProtons >= NP ? "NP" : m_nProtons > 0 ? "_" + std::to_string(m_nProtons) + "P" : "";
814 }
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.

Member Function Documentation

unsigned int lar_content::InteractionDescriptor::GetNumPhotons ( ) const
inline

Retrieve the number of photons.

Returns
Retrieve the number of photons

Definition at line 555 of file LArInteractionTypeHelper.h.

556 {
557  return m_nPhotons;
558 }
unsigned int lar_content::InteractionDescriptor::GetNumPiMinus ( ) const
inline

Retrieve the number of pi minus.

Returns
Retrieve the number of pi minus

Definition at line 548 of file LArInteractionTypeHelper.h.

549 {
550  return m_nPiMinus;
551 }
unsigned int lar_content::InteractionDescriptor::GetNumPiPlus ( ) const
inline

Retrieve the number of pi plus.

Returns
Retrieve the number of pi plus

Definition at line 541 of file LArInteractionTypeHelper.h.

542 {
543  return m_nPiPlus;
544 }
unsigned int lar_content::InteractionDescriptor::GetNumPiZero ( ) const
inline

Retrieve the number of pi zeros.

Returns
Retrieve the number of pi zeros

Definition at line 534 of file LArInteractionTypeHelper.h.

535 {
536  return m_nPiZero;
537 }
unsigned int lar_content::InteractionDescriptor::GetNumProtons ( ) const
inline

Retrieve the number of protons.

Returns
Retrieve the number of protons

Definition at line 562 of file LArInteractionTypeHelper.h.

563 {
564  return m_nProtons;
565 }
int lar_content::InteractionDescriptor::GetUniqueId ( ) const
inline

Retrieve a unique ID describing the event (that is, a given type of interaction with specific final state particles has a particular ID)

Returns
The unique identifier for the event

Definition at line 569 of file LArInteractionTypeHelper.h.

570 {
571  return m_id;
572 }
bool lar_content::InteractionDescriptor::IsCC ( ) const
inline

Whether or not the interaction is CC.

Returns
Whether or not the interaction is CC

Definition at line 485 of file LArInteractionTypeHelper.h.

Referenced by lar_content::HierarchyValidationAlgorithm::Run().

486 {
487  return m_isCC;
488 }
bool lar_content::InteractionDescriptor::IsCoherent ( ) const
inline

Whether or not the interaction is coherent.

Returns
Whether or not the interaction is coherent

Definition at line 513 of file LArInteractionTypeHelper.h.

514 {
515  return m_isCoherent;
516 }
bool lar_content::InteractionDescriptor::IsDIS ( ) const
inline

Whether or not the interaction is DIS.

Returns
Whether or not the interaction is DIS

Definition at line 506 of file LArInteractionTypeHelper.h.

507 {
508  return m_isDIS;
509 }
bool lar_content::InteractionDescriptor::IsElectronNeutrino ( ) const
inline

Whether or not the interaction is electron neutrino.

Returns
Whether or not the interaction is electron neutrino

Definition at line 527 of file LArInteractionTypeHelper.h.

528 {
529  return m_isNue;
530 }
bool lar_content::InteractionDescriptor::IsMuonNeutrino ( ) const
inline

Whether or not the interaction is muon neutrino.

Returns
Whether or not the interaction is muon neutrino

Definition at line 520 of file LArInteractionTypeHelper.h.

521 {
522  return m_isNumu;
523 }
bool lar_content::InteractionDescriptor::IsQE ( ) const
inline

Whether or not the interaction is QE.

Returns
Whether or not the interaction is QE

Definition at line 492 of file LArInteractionTypeHelper.h.

493 {
494  return m_isQE;
495 }
bool lar_content::InteractionDescriptor::IsResonant ( ) const
inline

Whether or not the interaction is resonant.

Returns
Whether or not the interaction is resonant

Definition at line 499 of file LArInteractionTypeHelper.h.

500 {
501  return m_isResonant;
502 }
const std::string & lar_content::InteractionDescriptor::ToString ( ) const
inline

Retrieve the string descriptor for the event.

Returns
The string descriptor for the event

Definition at line 576 of file LArInteractionTypeHelper.h.

577 {
578  return m_descriptor;
579 }

Member Data Documentation

const int lar_content::InteractionDescriptor::CC = 8192
static
const int lar_content::InteractionDescriptor::COH = 1024
static
const int lar_content::InteractionDescriptor::DIS = 1536
static
const int lar_content::InteractionDescriptor::E = 128
static
std::string lar_content::InteractionDescriptor::m_descriptor
private

Definition at line 480 of file LArInteractionTypeHelper.h.

Referenced by InteractionDescriptor().

int lar_content::InteractionDescriptor::m_id
private

Definition at line 479 of file LArInteractionTypeHelper.h.

Referenced by InteractionDescriptor().

const bool lar_content::InteractionDescriptor::m_isCC
private

Definition at line 467 of file LArInteractionTypeHelper.h.

Referenced by InteractionDescriptor().

const bool lar_content::InteractionDescriptor::m_isCoherent
private

Definition at line 471 of file LArInteractionTypeHelper.h.

Referenced by InteractionDescriptor().

const bool lar_content::InteractionDescriptor::m_isDIS
private

Definition at line 470 of file LArInteractionTypeHelper.h.

Referenced by InteractionDescriptor().

const bool lar_content::InteractionDescriptor::m_isNue
private

Definition at line 473 of file LArInteractionTypeHelper.h.

Referenced by InteractionDescriptor().

const bool lar_content::InteractionDescriptor::m_isNumu
private

Definition at line 472 of file LArInteractionTypeHelper.h.

Referenced by InteractionDescriptor().

const bool lar_content::InteractionDescriptor::m_isQE
private

Definition at line 468 of file LArInteractionTypeHelper.h.

Referenced by InteractionDescriptor().

const bool lar_content::InteractionDescriptor::m_isResonant
private

Definition at line 469 of file LArInteractionTypeHelper.h.

Referenced by InteractionDescriptor().

const unsigned int lar_content::InteractionDescriptor::m_nPhotons
private

Definition at line 477 of file LArInteractionTypeHelper.h.

Referenced by InteractionDescriptor().

const unsigned int lar_content::InteractionDescriptor::m_nPiMinus
private

Definition at line 476 of file LArInteractionTypeHelper.h.

Referenced by InteractionDescriptor().

const unsigned int lar_content::InteractionDescriptor::m_nPiPlus
private

Definition at line 475 of file LArInteractionTypeHelper.h.

Referenced by InteractionDescriptor().

const unsigned int lar_content::InteractionDescriptor::m_nPiZero
private

Definition at line 474 of file LArInteractionTypeHelper.h.

Referenced by InteractionDescriptor().

const unsigned int lar_content::InteractionDescriptor::m_nProtons
private

Definition at line 478 of file LArInteractionTypeHelper.h.

Referenced by InteractionDescriptor().

const int lar_content::InteractionDescriptor::MU = 256
static
const int lar_content::InteractionDescriptor::NC = 4096
static
const int lar_content::InteractionDescriptor::NP = 6
static
const int lar_content::InteractionDescriptor::OTH = 512
static
const int lar_content::InteractionDescriptor::PHOTON = 8
static
const int lar_content::InteractionDescriptor::PIMINUS = 16
static
const int lar_content::InteractionDescriptor::PIPLUS = 32
static
const int lar_content::InteractionDescriptor::PIZERO = 64
static
const int lar_content::InteractionDescriptor::QE = 2560
static
const int lar_content::InteractionDescriptor::RES = 2048
static

The documentation for this class was generated from the following files: