GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PointGeomAnalyzer.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 
7  Costas Andreopoulos <c.andreopoulos \at cern.ch>
8  University of Liverpool - July 14, 2005
9 
10  For the class documentation see the corresponding header file.
11 
12  Important revisions after version 2.0.0 :
13  @ Feb 05, 2008 - CA
14  Support a mix of targets (with their corresponding weights) in the same
15  'point geometry'.
16 */
17 //____________________________________________________________________________
18 
19 #include <TLorentzVector.h>
20 #include <TVector3.h>
21 
28 
29 using namespace genie;
30 using namespace genie::geometry;
31 
32 //___________________________________________________________________________
33 PointGeomAnalyzer::PointGeomAnalyzer(int pdg) :
35 {
36  map<int,double> tgtmap;
37  tgtmap.insert( map<int, double>::value_type(pdg, 1.) );
38 
39  this->Initialize(tgtmap);
40 }
41 //___________________________________________________________________________
43  unsigned int n, const int tgtpdgc[], const double weight[]) :
45 {
46  map<int,double> tgtmap;
47  for(unsigned int i=0; i<n; i++)
48  tgtmap.insert( map<int, double>::value_type(tgtpdgc[i], weight[i]) );
49 
50  this->Initialize(tgtmap);
51 }
52 //___________________________________________________________________________
53 PointGeomAnalyzer::PointGeomAnalyzer(const map<int,double> & tgtmap) :
55 {
56  this->Initialize(tgtmap);
57 }
58 //___________________________________________________________________________
60 {
61  this->CleanUp();
62 }
63 //___________________________________________________________________________
65 {
66 // pdg code list contains a single code corresponding to the material passed
67 // at the geom analyser ctor
68 
69  return *fCurrPDGCodeList;
70 }
71 //___________________________________________________________________________
73 {
74 // this is irrelevant for the 'point' geometry - return a path length of 1.
75 // for the only defined material
76 
77  return *fCurrPathLengthList;
78 }
79 //___________________________________________________________________________
81  const TLorentzVector & /*x*/, const TLorentzVector & /*p*/)
82 {
83 // this is irrelevant for the 'point' geometry - return a path length of 1.
84 // for the only defined material
85 
86  return *fCurrPathLengthList;
87 }
88 //___________________________________________________________________________
90  const TLorentzVector & /*x*/, const TLorentzVector & /*p*/, int /*tgtpdg*/)
91 {
92 // this is irrelevant for the 'point' geometry - return a vtx at (0,0,0)
93 
94  return *fCurrVertex;
95 }
96 //___________________________________________________________________________
97 void PointGeomAnalyzer::Initialize(const map<int,double> & tgtmap)
98 {
99  fCurrVertex = new TVector3(0,0,0);
100 
102  fCurrPDGCodeList->clear();
103 
104  map<int,double>::const_iterator iter;
105  for(iter = tgtmap.begin(); iter != tgtmap.end(); ++iter) {
106  int tgtpdgc = iter->first;
107  fCurrPDGCodeList->push_back(tgtpdgc);
108  }
109 
110  fCurrPathLengthList = new PathLengthList(tgtmap);
111 
112  LOG("PointGeom", pNOTICE) << *fCurrPDGCodeList;
113  LOG("PointGeom", pNOTICE) << *fCurrPathLengthList;
114 }
115 //___________________________________________________________________________
117 {
118  if( fCurrVertex ) delete fCurrVertex;
120  if( fCurrPDGCodeList ) delete fCurrPDGCodeList;
121 }
122 //___________________________________________________________________________
123 
const TVector3 & GenerateVertex(const TLorentzVector &x, const TLorentzVector &p, int tgtpdg)
PDGCodeList * fCurrPDGCodeList
current list of target nuclei
void Initialize(const map< int, double > &tgtmap)
TVector3 * fCurrVertex
current generated vertex
const PathLengthList & ComputePathLengths(const TLorentzVector &x, const TLorentzVector &p)
const PathLengthList & ComputeMaxPathLengths(void)
A list of PDG codes.
Definition: PDGCodeList.h:32
const PDGCodeList & ListOfTargetNuclei(void)
PathLengthList * fCurrPathLengthList
current list of path-lengths
Object to be filled with the neutrino path-length, for all detector geometry materials, when starting from a position x and travelling along the direction of the neutrino 4-momentum.
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pNOTICE
Definition: Messenger.h:61
Defines the GENIE Geometry Analyzer Interface.
Definition: GeomAnalyzerI.h:29
void push_back(int pdg_code)
Definition: PDGCodeList.cxx:58