GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SKPrimaryLeptonGenerator.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2024, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5 
6  Chris Marshall <marshall \at pas.rochester.edu>
7  University of Rochester
8 
9  Martti Nirkko
10  University of Berne
11 */
12 //____________________________________________________________________________
13 
20 
21 using namespace genie;
22 
23 //___________________________________________________________________________
25 PrimaryLeptonGenerator("genie::SKPrimaryLeptonGenerator")
26 {
27 
28 }
29 //___________________________________________________________________________
31 PrimaryLeptonGenerator("genie::SKPrimaryLeptonGenerator", config)
32 {
33 
34 }
35 //___________________________________________________________________________
37 {
38 
39 }
40 //___________________________________________________________________________
42 {
43 
44  // no modification is required to the std implementation
46 
47  if(evrec->FinalStatePrimaryLepton()->IsOffMassShell()) {
48  LOG("LeptonicVertex", pERROR)
49  << "*** Selected kinematics lead to off mass shell lepton!";
50  evrec->EventFlags()->SetBitNumber(kLeptoGenErr, true);
52  exception.SetReason("E<m for final state lepton");
53  exception.SwitchOnFastForward();
54  throw exception;
55  }
56  //CalculatePrimaryLepton(evrec);
57 }
58 /*
59 //___________________________________________________________________________
60 void SKPrimaryLeptonGenerator::CalculatePrimaryLepton(GHepRecord * evrec) const
61 {
62 // This method generates the final state primary lepton in single-K events
63 
64  Interaction * interaction = evrec->Summary();
65  const InitialState & init_state = interaction->InitState();
66 
67  // Look-up selected kinematics
68  double lep_t = interaction->Kine().GetKV(kKVSelTl);
69  double lep_costheta = interaction->Kine().GetKV(kKVSelctl);
70 
71  // Auxiliary params
72  double ml = interaction->FSPrimLepton()->Mass();
73  double ml2 = TMath::Power(ml,2);
74  double El = lep_t + ml;
75  double plep = TMath::Sqrt( El*El - ml2 );
76 
77  // Randomize transverse components
78  RandomGen * rnd = RandomGen::Instance();
79  double phi = 2*kPi * rnd->RndLep().Rndm();
80 
81  LOG( "SKLepton", pDEBUG )
82  << "lepton T = " << lep_t << " cos theta = " << lep_costheta << " random phi = " << phi;
83 
84  // Lepton 3vector w.r.t. neutrino direction
85  TVector3 p3l(0,0,0);
86  p3l.SetMagThetaPhi(plep, TMath::ACos(lep_costheta), phi);
87 
88  // Take a unit vector along the neutrino direction
89  TVector3 unit_nudir = evrec->Probe()->P4()->Vect().Unit();
90 
91  // Rotate lepton momentum vector from the reference frame (x'y'z') where
92  // {z':(neutrino direction), z'x':(theta plane)} to the LAB
93  p3l.RotateUz(unit_nudir);
94 
95  LOG( "SKLepton", pDEBUG )
96  << "lab frame lepton px = " << p3l.x() << " py = " << p3l.y() << " pz = " << p3l.z();
97 
98  // Lepton 4-momentum in LAB
99  TLorentzVector p4l(p3l,El);
100 
101  // Figure out the Final State Lepton PDG Code
102  int pdgc = interaction->FSPrimLepton()->PdgCode();
103 
104  // Create a GHepParticle and add it to the event record
105  this->AddToEventRecord(evrec, pdgc, p4l);
106 
107  // Set final state lepton polarization
108  this->SetPolarization(evrec);
109 }
110 */
#define pERROR
Definition: Messenger.h:59
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
virtual void ProcessEventRecord(GHepRecord *evrec) const
void ProcessEventRecord(GHepRecord *event_rec) const
virtual GHepParticle * FinalStatePrimaryLepton(void) const
Definition: GHepRecord.cxx:333
Abstract class. Is used to pass common implementation to concrete implementations of the EventRecordV...
bool IsOffMassShell(void) const
virtual TBits * EventFlags(void) const
Definition: GHepRecord.h:117
GENIE&#39;s GHEP MC event record.
Definition: GHepRecord.h:45