Public Member Functions | Private Member Functions | Private Attributes | List of all members
genie::NHLPrimaryVtxGenerator Class Reference

Neutral Heavy Lepton primary vertex generator. More...

#include <NHLPrimaryVtxGenerator.h>

Inheritance diagram for genie::NHLPrimaryVtxGenerator:
genie::EventRecordVisitorI genie::Algorithm

Public Member Functions

 NHLPrimaryVtxGenerator ()
 
 NHLPrimaryVtxGenerator (string config)
 
 ~NHLPrimaryVtxGenerator ()
 
void ProcessEventRecord (GHepRecord *event) const
 
void Configure (const Registry &config)
 
void Configure (string config)
 
- Public Member Functions inherited from genie::EventRecordVisitorI
virtual ~EventRecordVisitorI ()
 
- Public Member Functions inherited from genie::Algorithm
virtual ~Algorithm ()
 
virtual void FindConfig (void)
 
virtual const RegistryGetConfig (void) const
 
RegistryGetOwnedConfig (void)
 
virtual const AlgIdId (void) const
 Get algorithm ID. More...
 
virtual AlgStatus_t GetStatus (void) const
 Get algorithm status. More...
 
virtual bool AllowReconfig (void) const
 
virtual AlgCmp_t Compare (const Algorithm *alg) const
 Compare with input algorithm. More...
 
virtual void SetId (const AlgId &id)
 Set algorithm ID. More...
 
virtual void SetId (string name, string config)
 
const AlgorithmSubAlg (const RgKey &registry_key) const
 
void AdoptConfig (void)
 
void AdoptSubstructure (void)
 
virtual void Print (ostream &stream) const
 Print algorithm info. More...
 

Private Member Functions

void LoadConfig (void)
 
void AddInitialState (GHepRecord *event) const
 
void GenerateDecayProducts (GHepRecord *event) const
 

Private Attributes

NHLDecayMode_t fCurrDecayMode
 
TGenPhaseSpace fPhaseSpaceGenerator
 

Additional Inherited Members

- Static Public Member Functions inherited from genie::Algorithm
static string BuildParamVectKey (const std::string &comm_name, unsigned int i)
 
static string BuildParamVectSizeKey (const std::string &comm_name)
 
- Protected Member Functions inherited from genie::EventRecordVisitorI
 EventRecordVisitorI ()
 
 EventRecordVisitorI (string name)
 
 EventRecordVisitorI (string name, string config)
 
- Protected Member Functions inherited from genie::Algorithm
 Algorithm ()
 
 Algorithm (string name)
 
 Algorithm (string name, string config)
 
void Initialize (void)
 
void DeleteConfig (void)
 
void DeleteSubstructure (void)
 
RegistryExtractLocalConfig (const Registry &in) const
 
RegistryExtractLowerConfig (const Registry &in, const string &alg_key) const
 Split an incoming configuration Registry into a block valid for the sub-algo identified by alg_key. More...
 
template<class T >
bool GetParam (const RgKey &name, T &p, bool is_top_call=true) const
 
template<class T >
bool GetParamDef (const RgKey &name, T &p, const T &def) const
 
template<class T >
int GetParamVect (const std::string &comm_name, std::vector< T > &v, bool is_top_call=true) const
 Handle to load vectors of parameters. More...
 
int GetParamVectKeys (const std::string &comm_name, std::vector< RgKey > &k, bool is_top_call=true) const
 
int AddTopRegistry (Registry *rp, bool owns=true)
 add registry with top priority, also update ownership More...
 
int AddLowRegistry (Registry *rp, bool owns=true)
 add registry with lowest priority, also update ownership More...
 
int MergeTopRegistry (const Registry &r)
 
int AddTopRegisties (const vector< Registry * > &rs, bool owns=false)
 Add registries with top priority, also udated Ownerships. More...
 
- Protected Attributes inherited from genie::Algorithm
bool fAllowReconfig
 
bool fOwnsSubstruc
 true if it owns its substructure (sub-algs,...) More...
 
AlgId fID
 algorithm name and configuration set More...
 
vector< Registry * > fConfVect
 
vector< boolfOwnerships
 ownership for every registry in fConfVect More...
 
AlgStatus_t fStatus
 algorithm execution status More...
 
AlgMapfOwnedSubAlgMp
 local pool for owned sub-algs (taken out of the factory pool) More...
 

Detailed Description

Neutral Heavy Lepton primary vertex generator.

Author
Costas Andreopoulos <constantinos.andreopoulos cern.ch> University of Liverpool & STFC Rutherford Appleton Laboratory

February 10, 2020

Copyright (c) 2003-2020, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 28 of file NHLPrimaryVtxGenerator.h.

Constructor & Destructor Documentation

NHLPrimaryVtxGenerator::NHLPrimaryVtxGenerator ( )

Definition at line 33 of file NHLPrimaryVtxGenerator.cxx.

33  :
34 EventRecordVisitorI("genie::NHLPrimaryVtxGenerator")
35 {
36 
37 }
NHLPrimaryVtxGenerator::NHLPrimaryVtxGenerator ( string  config)

Definition at line 39 of file NHLPrimaryVtxGenerator.cxx.

39  :
40 EventRecordVisitorI("genie::NHLPrimaryVtxGenerator",config)
41 {
42 
43 }
static Config * config
Definition: config.cpp:1054
NHLPrimaryVtxGenerator::~NHLPrimaryVtxGenerator ( )

Definition at line 45 of file NHLPrimaryVtxGenerator.cxx.

46 {
47 
48 }

Member Function Documentation

void NHLPrimaryVtxGenerator::AddInitialState ( GHepRecord event) const
private

Definition at line 63 of file NHLPrimaryVtxGenerator.cxx.

64 {
65  TLorentzVector v4(0,0,0,0);
66 
67  Interaction * interaction = event->Summary();
68  double E = interaction->InitState().ProbeE(kRfLab);
69  double M = PDGLibrary::Instance()->Find(kPdgNHL)->Mass();
70  double p = TMath::Sqrt(E*E-M*M);
71 
72  TLorentzVector p4(0,0,p,E);
73 
74  event->AddParticle(kPdgNHL, kIStInitialState, 0,-1,-1,-1, p4, v4);
75 }
Summary information for an interaction.
Definition: Interaction.h:56
const int kPdgNHL
Definition: PDGCodes.h:221
p
Definition: test.py:223
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:57
const InitialState & InitState(void) const
Definition: Interaction.h:69
TParticlePDG * Find(int pdgc, bool must_exist=true)
Definition: PDGLibrary.cxx:75
double ProbeE(RefFrame_t rf) const
void NHLPrimaryVtxGenerator::Configure ( const Registry config)
virtual

Configure the algorithm with an external registry The registry is merged with the top level registry if it is owned, Otherwise a copy of it is added with the highest priority

Reimplemented from genie::Algorithm.

Definition at line 198 of file NHLPrimaryVtxGenerator.cxx.

199 {
200  Algorithm::Configure(config);
201  this->LoadConfig();
202 }
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
void NHLPrimaryVtxGenerator::Configure ( string  config)
virtual

Configure the algorithm from the AlgoConfigPool based on param_set string given in input An algorithm contains a vector of registries coming from different xml configuration files, which are loaded according a very precise prioriy This methods will load a number registries in order of priority: 1) "Tunable" parameter set from CommonParametes. This is loaded with the highest prioriry and it is designed to be used for tuning procedure Usage not expected from the user. 2) For every string defined in "CommonParame" the corresponding parameter set will be loaded from CommonParameter.xml 3) parameter set specified by the config string and defined in the xml file of the algorithm 4) if config is not "Default" also the Default parameter set from the same xml file will be loaded Effectively this avoids the repetion of a parameter when it is not changed in the requested configuration

Reimplemented from genie::Algorithm.

Definition at line 204 of file NHLPrimaryVtxGenerator.cxx.

205 {
207  this->LoadConfig();
208 }
static Config * config
Definition: config.cpp:1054
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
void NHLPrimaryVtxGenerator::GenerateDecayProducts ( GHepRecord event) const
private

accept_decay

Definition at line 77 of file NHLPrimaryVtxGenerator.cxx.

78 {
79  LOG("NHL", pINFO) << "Generating decay...";
80 
82  LOG("NHL", pINFO) << "Decay product IDs: " << pdgv;
83  assert ( pdgv.size() > 1);
84 
85  LOG("NHL", pINFO) << "Performing a phase space decay...";
86 
87  // Get the decay product masses
88 
90  int i = 0;
91  double * mass = new double[pdgv.size()];
92  double sum = 0;
93  for(pdg_iter = pdgv.begin(); pdg_iter != pdgv.end(); ++pdg_iter) {
94  int pdgc = *pdg_iter;
95  double m = PDGLibrary::Instance()->Find(pdgc)->Mass();
96  mass[i++] = m;
97  sum += m;
98  }
99 
100  LOG("NHL", pINFO)
101  << "Decaying N = " << pdgv.size() << " particles / total mass = " << sum;
102 
103  int nhl_id = 0;
104  GHepParticle * nhl = event->Particle(nhl_id);
105  assert(nhl);
106  TLorentzVector * p4d = nhl->GetP4();
107  TLorentzVector * v4d = nhl->GetX4();
108 
109  LOG("NHL", pINFO)
110  << "Decaying system p4 = " << utils::print::P4AsString(p4d);
111 
112  // Set the decay
113  bool permitted = fPhaseSpaceGenerator.SetDecay(*p4d, pdgv.size(), mass);
114  if(!permitted) {
115  LOG("NHL", pERROR)
116  << " *** Phase space decay is not permitted \n"
117  << " Total particle mass = " << sum << "\n"
118  << " Decaying system p4 = " << utils::print::P4AsString(p4d);
119  // clean-up
120  delete [] mass;
121  delete p4d;
122  delete v4d;
123  // throw exception
125  exception.SetReason("Decay not permitted kinematically");
126  exception.SwitchOnFastForward();
127  throw exception;
128  }
129 
130  // Get the maximum weight
131  //double wmax = fPhaseSpaceGenerator.GetWtMax();
132  double wmax = -1;
133  for(int idec=0; idec<200; idec++) {
134  double w = fPhaseSpaceGenerator.Generate();
135  wmax = TMath::Max(wmax,w);
136  }
137  assert(wmax>0);
138  wmax *= 2;
139 
140  LOG("NHL", pNOTICE)
141  << "Max phase space gen. weight @ current hadronic system: " << wmax;
142 
143  // Generate an unweighted decay
144  RandomGen * rnd = RandomGen::Instance();
145 
146  bool accept_decay=false;
147  unsigned int itry=0;
148  while(!accept_decay)
149  {
150  itry++;
151 
153  // report, clean-up and return
154  LOG("NHL", pWARN)
155  << "Couldn't generate an unweighted phase space decay after "
156  << itry << " attempts";
157  // clean up
158  delete [] mass;
159  delete p4d;
160  delete v4d;
161  // throw exception
163  exception.SetReason("Couldn't select decay after N attempts");
164  exception.SwitchOnFastForward();
165  throw exception;
166  }
167  double w = fPhaseSpaceGenerator.Generate();
168  if(w > wmax) {
169  LOG("NHL", pWARN)
170  << "Decay weight = " << w << " > max decay weight = " << wmax;
171  }
172  double gw = wmax * rnd->RndHadro().Rndm();
173  accept_decay = (gw<=w);
174 
175  LOG("NHL", pINFO)
176  << "Decay weight = " << w << " / R = " << gw
177  << " - accepted: " << accept_decay;
178 
179  } //!accept_decay
180 
181  // Insert final state products into a TClonesArray of GHepParticle's
182  TLorentzVector v4(*v4d);
183  int idp = 0;
184  for(pdg_iter = pdgv.begin(); pdg_iter != pdgv.end(); ++pdg_iter) {
185  int pdgc = *pdg_iter;
186  TLorentzVector * p4fin = fPhaseSpaceGenerator.GetDecay(idp);
188  event->AddParticle(pdgc, ist, nhl_id,-1,-1,-1, *p4fin, v4);
189  idp++;
190  }
191 
192  // Clean-up
193  delete [] mass;
194  delete p4d;
195  delete v4d;
196 }
TLorentzVector * GetX4(void) const
#define pERROR
Definition: Messenger.h:59
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:71
string P4AsString(const TLorentzVector *p)
Definition: PrintUtils.cxx:27
static const unsigned int kMaxUnweightDecayIterations
Definition: Controls.h:61
intermediate_table::const_iterator const_iterator
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:29
PDGCodeList DecayProductList(NHLDecayMode_t nhldm)
A list of PDG codes.
Definition: PDGCodeList.h:32
An exception thrown by EventRecordVisitorI when the normal processing sequence has to be disrupted (f...
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
TLorentzVector * GetP4(void) const
size_t size
Definition: lodepng.cpp:55
#define pINFO
Definition: Messenger.h:62
#define pWARN
Definition: Messenger.h:60
TRandom3 & RndHadro(void) const
rnd number generator used by hadronization models
Definition: RandomGen.h:53
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:57
TParticlePDG * Find(int pdgc, bool must_exist=true)
Definition: PDGLibrary.cxx:75
#define pNOTICE
Definition: Messenger.h:61
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
enum genie::EGHepStatus GHepStatus_t
void NHLPrimaryVtxGenerator::LoadConfig ( void  )
private

Definition at line 210 of file NHLPrimaryVtxGenerator.cxx.

211 {
212 
213 }
void NHLPrimaryVtxGenerator::ProcessEventRecord ( GHepRecord event) const
virtual

Implements genie::EventRecordVisitorI.

Definition at line 50 of file NHLPrimaryVtxGenerator.cxx.

51 {
52  Interaction * interaction = event->Summary();
53 
54  fCurrDecayMode = (NHLDecayMode_t) interaction->ExclTag().DecayMode();
55 
56  LOG("NHL", pNOTICE)
57  << "Simulating NHL decay " << utils::nhl::AsString(fCurrDecayMode);
58 
59  this->AddInitialState(event);
60  this->GenerateDecayProducts(event);
61 }
void AddInitialState(GHepRecord *event) const
void GenerateDecayProducts(GHepRecord *event) const
Summary information for an interaction.
Definition: Interaction.h:56
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
int DecayMode(void) const
Definition: XclsTag.h:70
const XclsTag & ExclTag(void) const
Definition: Interaction.h:72
#define pNOTICE
Definition: Messenger.h:61
string AsString(NHLDecayMode_t nhldm)
enum genie::ENHLDecayMode NHLDecayMode_t

Member Data Documentation

NHLDecayMode_t genie::NHLPrimaryVtxGenerator::fCurrDecayMode
mutableprivate

Definition at line 49 of file NHLPrimaryVtxGenerator.h.

TGenPhaseSpace genie::NHLPrimaryVtxGenerator::fPhaseSpaceGenerator
mutableprivate

Definition at line 50 of file NHLPrimaryVtxGenerator.h.


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