MINT2
IEvtGen.cpp
Go to the documentation of this file.
1 #include "Mint/IEvtGen.h"
2 
3 using namespace MINT;
4 
5 IEvtGen::IEvtGen( const std::string& inputFileName,
6  const std::vector<int>& pattern,
7  TRandom* rand, const double& unitConversion )
8  : m_unitConversion(unitConversion)
9 {
11 
12  DalitzEventPattern pdg(pattern);
13  if( pattern[0] < 0 )
14  pdg = pdg.makeCPConjugate();
15 
16  std::cout << "Mother Particle " << pattern[0] << std::endl
17  << " got event pattern: " << pdg << std::endl;
18 
19  m_sg = new SignalGenerator(pdg, rand);
20 }
21 
22 void IEvtGen::GenerateEvent( std::vector<std::vector<double>>& daughters,
23  double& weight_gen )
24 {
26  const IDalitzEvent* const event = newEvt.get();
27  //const IDalitzEvent* const event = m_sg->newEvent().get();
28 
29  //0th entry is the mother particle
30  for( unsigned int i=1;
31  i<static_cast<unsigned int>(event->eventPattern().numDaughters()+1);
32  ++i ){
33  const std::vector<double> daughter = GetDaughter(event, i);
34  daughters.push_back(daughter);
35  }
36 
37  weight_gen = event->getGeneratorPdfRelativeToPhaseSpace();
38 }
39 
40 std::vector<double> IEvtGen::GetDaughter( const IDalitzEvent* const event,
41  const unsigned int& daughter_id )
42 {
43  std::vector<double> daughter;
44  daughter.push_back(event->p(daughter_id).T()/m_unitConversion);
45  daughter.push_back(event->p(daughter_id).X()/m_unitConversion);
46  daughter.push_back(event->p(daughter_id).Y()/m_unitConversion);
47  daughter.push_back(event->p(daughter_id).Z()/m_unitConversion);
48 
49  return daughter;
50 }
virtual MINT::counted_ptr< IDalitzEvent > newEvent()
IEvtGen(const std::string &inputFileName, const std::vector< int > &pattern, TRandom *rand, const double &unitConversion)
Definition: IEvtGen.cpp:5
static bool setDefaultInputFile(const std::string &fname)
virtual const TLorentzVector & p(unsigned int i) const =0
void GenerateEvent(std::vector< std::vector< double >> &daughters, double &weight_gen)
Definition: IEvtGen.cpp:22
SignalGenerator * m_sg
Definition: IEvtGen.h:47
const double m_unitConversion
Definition: IEvtGen.h:45
DalitzEventPattern makeCPConjugate() const
std::vector< double > GetDaughter(const IDalitzEvent *const event, const unsigned int &daughter_id)
Definition: IEvtGen.cpp:40
X * get() const
Definition: counted_ptr.h:123