Target.h
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \class genie::Target
5 
6 \brief A Neutrino Interaction Target. Is a transparent encapsulation of
7  quite different physical systems such as a nuclear target, a
8  'spectator' nuclear target with a Hit nucleon, a free nucleon or
9  a free particle (eg a e- target in the inverse muon decay reaction)
10 
11 \author Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
12  University of Liverpool & STFC Rutherford Appleton Lab
13 
14 \created May 03, 2004
15 
16 \cpright Copyright (c) 2003-2019, The GENIE Collaboration
17  For the full text of the license visit http://copyright.genie-mc.org
18  or see $GENIE/LICENSE
19 */
20 //____________________________________________________________________________
21 
22 #ifndef _TARGET_H_
23 #define _TARGET_H_
24 
25 #include <ostream>
26 #include <string>
27 
28 #include <TLorentzVector.h>
29 #include <TObject.h>
30 
31 using std::ostream;
32 using std::string;
33 
34 class TRootIOCtor;
35 
36 namespace genie {
37 
38 class Target;
39 ostream & operator << (ostream & stream, const Target & t);
40 
41 class Target : public TObject {
42 
43 using TObject::Print; // suppress clang 'hides overloaded virtual function [-Woverloaded-virtual]' warnings
44 using TObject::Compare;
45 using TObject::Copy;
46 
47 public:
48  Target();
49  Target(int pdgc);
50  Target(int Z, int A);
51  Target(int Z, int A, int hit_nucleon_pdgc);
52  Target(const Target & tgt);
53  Target(TRootIOCtor*);
54  ~Target();
55 
56  //-- Set target properties
57 
58  void SetId (int pdgc);
59  void SetId (int Z, int A);
60  void SetHitNucPdg (int pdgc);
61  void SetHitNucP4 (const TLorentzVector & p4);
62  void SetHitNucPosition (double r);
63  void SetHitQrkPdg (int pdgc);
64  void SetHitSeaQrk (bool tf);
65  void ForceHitNucOnMassShell (void);
66 
67  //-- Query target information
68 
69  int Z (void) const { return fZ; }
70  int N (void) const { return fA-fZ; }
71  int A (void) const { return fA; }
72  int Pdg (void) const { return fTgtPDG; }
73  double Mass (void) const;
74  double Charge (void) const;
75  bool IsFreeNucleon (void) const;
76  bool IsProton (void) const;
77  bool IsNeutron (void) const;
78  bool IsNucleus (void) const;
79  bool IsParticle (void) const;
80  bool IsValidNucleus (void) const;
81  bool HitNucIsSet (void) const;
82  bool HitQrkIsSet (void) const;
83  bool HitSeaQrk (void) const;
84  bool IsEvenEven (void) const;
85  bool IsEvenOdd (void) const;
86  bool IsOddOdd (void) const;
87  int HitNucPdg (void) const;
88  int HitQrkPdg (void) const;
89  double HitNucMass (void) const;
90  double HitNucPosition (void) const { return fHitNucRad; }
91 
92  const TLorentzVector & HitNucP4 (void) const { return *this->HitNucP4Ptr(); }
93  TLorentzVector * HitNucP4Ptr (void) const;
94 
95  //-- Copy, reset, compare, print itself and build string code
96  void Reset (void);
97  void Copy (const Target & t);
98  bool Compare (const Target & t) const;
99  string AsString (void) const;
100  void Print (ostream & stream) const;
101 
102  bool operator == (const Target & t) const; ///< equal?
103  Target & operator = (const Target & t); ///< copy
104  friend ostream & operator << (ostream & stream, const Target & t); ///< print
105 
106 private:
107 
108  //-- Methods for Target initialization and clean up
109  void Init (void);
110  void CleanUp (void);
111 
112  //-- Methods assuring nucleus & hit nucleon validity
113  void ForceNucleusValidity (void);
114  bool ForceHitNucValidity (void);
115  void AutoSetHitNuc (void);
116 
117  //-- Private data members
118  int fZ; ///< nuclear target Z
119  int fA; ///< nuclear target A
120  int fTgtPDG; ///< nuclear target PDG code
121  int fHitNucPDG; ///< hit nucleon PDG code
122  int fHitQrkPDG; ///< hit quark PDG code
123  bool fHitSeaQrk; ///< hit quark from sea?
124  TLorentzVector * fHitNucP4; ///< hit nucleon 4p
125  double fHitNucRad; ///< hit nucleon position
126 
127 ClassDef(Target,2)
128 };
129 
130 } // genie namespace
131 
132 #endif // _TARGET_H_
133 
Target & operator=(const Target &t)
copy
Definition: Target.cxx:458
string AsString(void) const
Definition: Target.cxx:400
bool HitSeaQrk(void) const
Definition: Target.cxx:316
void AutoSetHitNuc(void)
Definition: Target.cxx:390
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
int HitNucPdg(void) const
Definition: Target.cxx:321
bool IsNeutron(void) const
Definition: Target.cxx:284
int fZ
nuclear target Z
Definition: Target.h:118
int A(void) const
Definition: Target.h:71
int HitQrkPdg(void) const
Definition: Target.cxx:259
bool operator==(const Target &t) const
equal?
Definition: Target.cxx:453
double HitNucMass(void) const
Definition: Target.cxx:250
bool IsNucleus(void) const
Definition: Target.cxx:289
int Pdg(void) const
Definition: Target.h:72
void SetHitNucP4(const TLorentzVector &p4)
Definition: Target.cxx:206
void SetHitQrkPdg(int pdgc)
Definition: Target.cxx:201
void SetHitNucPosition(double r)
Definition: Target.cxx:227
Timing fit.
void Compare(const std::vector< TH1 * > &hs)
double Mass(void) const
Definition: Target.cxx:241
void SetId(int pdgc)
Definition: Target.cxx:166
void Init(void)
Definition: Target.cxx:116
double Charge(void) const
Definition: Target.cxx:232
bool IsValidNucleus(void) const
Definition: Target.cxx:326
int fHitNucPDG
hit nucleon PDG code
Definition: Target.h:121
friend ostream & operator<<(ostream &stream, const Target &t)
print
int fHitQrkPDG
hit quark PDG code
Definition: Target.h:122
void CleanUp(void)
Definition: Target.cxx:128
bool IsEvenEven(void) const
Definition: Target.cxx:339
const TLorentzVector & HitNucP4(void) const
Definition: Target.h:92
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
Definition: Target.h:41
int Z(void) const
Definition: Target.h:69
bool IsOddOdd(void) const
Definition: Target.cxx:357
int fTgtPDG
nuclear target PDG code
Definition: Target.h:120
bool IsEvenOdd(void) const
Definition: Target.cxx:349
void Reset(void)
Definition: Target.cxx:110
void Print(std::string prefix, std::string name, std::string suffix="")
Definition: nue_pid_effs.C:68
int N(void) const
Definition: Target.h:70
TLorentzVector * HitNucP4Ptr(void) const
Definition: Target.cxx:264
bool Compare(const Target &t) const
Definition: Target.cxx:439
bool HitNucIsSet(void) const
Definition: Target.cxx:300
bool HitQrkIsSet(void) const
Definition: Target.cxx:309
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
void SetHitNucPdg(int pdgc)
Definition: Target.cxx:188
double HitNucPosition(void) const
Definition: Target.h:90
double fHitNucRad
hit nucleon position
Definition: Target.h:125
TRandom3 r(0)
TLorentzVector * fHitNucP4
hit nucleon 4p
Definition: Target.h:124
void Copy(const Target &t)
Definition: Target.cxx:133
void SetHitSeaQrk(bool tf)
Definition: Target.cxx:212
void Print(ostream &stream) const
Definition: Target.cxx:416
bool fHitSeaQrk
hit quark from sea?
Definition: Target.h:123
bool IsProton(void) const
Definition: Target.cxx:279
bool IsParticle(void) const
Definition: Target.cxx:294
bool ForceHitNucValidity(void)
Definition: Target.cxx:367
void ForceNucleusValidity(void)
Definition: Target.cxx:379
bool IsFreeNucleon(void) const
Definition: Target.cxx:274
void ForceHitNucOnMassShell(void)
Definition: Target.cxx:217
int fA
nuclear target A
Definition: Target.h:119
enum BeamMode string