GENIEGenerator
Loading...
Searching...
No Matches
ROOTGeomAnalyzer.h
Go to the documentation of this file.
1//____________________________________________________________________________
2/*!
3
4\class genie::geometry::ROOTGeomAnalyzer
5
6\brief A ROOT/GEANT4 geometry driver
7
8\author Anselmo Meregaglia <anselmo.meregaglia \at cern.ch>
9 ETH Zurich
10
11 Costas Andreopoulos <c.andreopoulos \at cern.ch>
12 University of Liverpool
13
14 Robert Hatcher <rhatcher \at fnal.gov>
15 Fermilab
16
17\created May 24, 2005
18
19\cpright Copyright (c) 2003-2025, The GENIE Collaboration
20 For the full text of the license visit http://copyright.genie-mc.org
21
22*/
23//____________________________________________________________________________
24
25#ifndef _ROOT_GEOMETRY_ANALYZER_H_
26#define _ROOT_GEOMETRY_ANALYZER_H_
27
28#include <string>
29#include <algorithm>
30
31#include <TGeoManager.h>
32#include <TVector3.h>
33
36
37class TGeoVolume;
38class TGeoMaterial;
39class TGeoMixture;
40class TGeoElement;
41class TGeoHMatrix;
42
43using std::string;
44
45namespace genie {
46
47class GFluxI;
48
49namespace geometry {
50
51class PathSegmentList;
53
55
56public :
57 ROOTGeomAnalyzer(string geometry_filename);
58 ROOTGeomAnalyzer(TGeoManager * gm);
59 ROOTGeomAnalyzer() : GeomAnalyzerI() { ; } // used ONLY for derived class overloading
61
62 /// implement the GeomAnalyzerI interface
63
64 virtual const PDGCodeList & ListOfTargetNuclei (void);
65 virtual const PathLengthList & ComputeMaxPathLengths (void);
66
67 virtual const PathLengthList & ComputePathLengths(const TLorentzVector & x,
68 const TLorentzVector & p);
69
70 virtual std::vector< std::pair<double, const TGeoMaterial*> > ComputeMatLengths(const TLorentzVector & x,
71 const TLorentzVector & p);
72
73 virtual const TVector3 & GenerateVertex(const TLorentzVector & x,
74 const TLorentzVector & p, int tgtpdg);
75
76 virtual int GetTargetPdgCode (const TGeoMaterial * const m) const;
77 virtual int GetTargetPdgCode (const TGeoMixture * const m, int ielement) const;
78
79 /// set geometry driver's configuration options
80
81 virtual void SetScannerNPoints (int np) { fNPoints = np; } /* box scanner */
82 virtual void SetScannerNRays (int nr) { fNRays = nr; } /* box scanner */
83 virtual void SetScannerNParticles (int np) { fNParticles = np; } /* flux scanner */
84 virtual void SetScannerFlux (GFluxI* f) { fFlux = f; } /* flux scanner */
85 virtual void SetWeightWithDensity (bool wt) { fDensWeight = wt; }
86 virtual void SetMixtureWeightsSum (double sum);
87 virtual void SetLengthUnits (double lu);
88 virtual void SetDensityUnits (double du);
89 virtual void SetMaxPlSafetyFactor (double sf);
90 virtual void SetTopVolName (string nm);
91 virtual void SetKeepSegPath (bool keep) { fKeepSegPath = keep; }
92 virtual void SetDebugFlags (int flgs) { fDebugFlags = flgs; }
93
94 /// retrieve geometry driver's configuration options
95
96 virtual int ScannerNPoints (void) const { return fNPoints; }
97 virtual int ScannerNRays (void) const { return fNRays; }
98 virtual int ScannerNParticles (void) const { return fNParticles; }
99 virtual bool WeightWithDensity (void) const { return fDensWeight; }
100 virtual double LengthUnits (void) const { return fLengthScale; }
101 virtual double DensityUnits (void) const { return fDensityScale; }
102 virtual double MixtureWeightsSum (void) const { return fMixtWghtSum; }
103 virtual double MaxPlSafetyFactor (void) const { return fMaxPlSafetyFactor; }
104 virtual string TopVolName (void) const { return fTopVolumeName; }
105 virtual TGeoManager * GetGeometry (void) const { return fGeometry; }
106 virtual bool GetKeepSegPath (void) const { return fKeepSegPath; }
107 virtual const PathLengthList& GetMaxPathLengths(void) const { return *fCurrMaxPathLengthList; } // call only after ComputeMaxPathLengths() has been called
108
109 /// access to geometry coordinate/unit transforms for validation/test purposes
110
111 virtual void Local2SI (PathLengthList & pl) const;
112 virtual void Local2SI (TVector3 & v) const;
113 virtual void SI2Local (TVector3 & v) const;
114 virtual void Master2Top (TVector3 & v) const;
115 virtual void Master2TopDir (TVector3 & v) const;
116 virtual void Top2Master (TVector3 & v) const;
117 virtual void Top2MasterDir (TVector3 & v) const;
118
119 /// configure processing to perform path segment trimming
120
121 virtual GeomVolSelectorI* AdoptGeomVolSelector (GeomVolSelectorI* selector) /// take ownership, return old
122 { std::swap(selector,fGeomVolSelector); return selector; }
123
124
125protected:
126
127 virtual void Initialize (void);
128 virtual void CleanUp (void);
129 virtual void Load (string geometry_filename);
130 virtual void Load (TGeoManager * gm);
131 virtual void BuildListOfTargetNuclei (void);
132
133 virtual double GetWeight (const TGeoMaterial * mat, int pdgc);
134 virtual double GetWeight (const TGeoMixture * mixt, int pdgc);
135 virtual double GetWeight (const TGeoMixture * mixt, int ielement, int pdgc);
136
137 virtual void MaxPathLengthsFluxMethod(void);
138 virtual void MaxPathLengthsBoxMethod (void);
139 virtual bool GenBoxRay (int indx, TLorentzVector& x4, TLorentzVector& p4);
140
141 virtual double ComputePathLengthPDG (const TVector3 & r, const TVector3 & udir, int pdgc);
142 virtual void SwimOnce (const TVector3 & r, const TVector3 & udir);
143
144 virtual bool FindMaterialInCurrentVol(int pdgc);
145 virtual bool WillNeverEnter (double step);
146 virtual double StepToNextBoundary (void);
147 virtual double Step (void);
148 virtual double StepUntilEntering (void);
149
150
151
152 int fMaterial; ///< input selected material for vertex generation
153 TGeoManager * fGeometry; ///< input detector geometry
154 string fTopVolumeName; ///< input top vol [other than TGeoManager::GetTopVolume()]
155 int fNPoints; ///< max path length scanner (box method): points/surface [def:200]
156 int fNRays; ///< max path length scanner (box method): rays/point [def:200]
157 int fNParticles; ///< max path length scanner (flux method): particles in [def:10000]
158 GFluxI * fFlux; ///< a flux objects that can be used to scan the max path lengths
159 bool fDensWeight; ///< if true pathlengths are weighted with density [def:true]
160 double fLengthScale; ///< conversion factor: input geometry length units -> meters
161 double fDensityScale; ///< conversion factor: input geometry density units -> kgr/meters^3
162 double fMaxPlSafetyFactor; ///< factor that can multiply the computed max path lengths
163 double fMixtWghtSum; ///< norm of relative weights (<0 if explicit summing required)
164 TVector3 * fCurrVertex; ///< current generated vertex
165 PathLengthList * fCurrPathLengthList; ///< current list of path-lengths
166 PathLengthList * fCurrMaxPathLengthList; ///< current list of max path-lengths
167 PDGCodeList * fCurrPDGCodeList; ///< current list of target nuclei
168 TGeoVolume * fTopVolume; ///< top volume
169 TGeoHMatrix * fMasterToTop; ///< matrix connecting master coordinates to top volume coordinates
170 bool fMasterToTopIsIdentity; ///< is fMasterToTop matrix the identity matrix?
171
172 bool fKeepSegPath; ///< need to fill path segment "path"
173 PathSegmentList* fCurrPathSegmentList; ///< current list of path-segments
174 GeomVolSelectorI* fGeomVolSelector; ///< optional path seg trimmer (owned)
175
176 // used by GenBoxRay to retain history between calls
181 double fdx, fdy, fdz, fox, foy, foz; ///< top vol size/origin (top vol units)
182
183 // test purposes
184 double fmxddist, fmxdstep; ///< max errors in pathsegmentlist
186
187};
188
189} // geometry namespace
190} // genie namespace
191
192#endif // _ROOT_GEOMETRY_ANALYZER_H_
GENIE Interface for user-defined flux classes.
Definition GFluxI.h:29
A list of PDG codes.
Definition PDGCodeList.h:32
Object to be filled with the neutrino path-length, for all detector geometry materials,...
GENIE Interface for user-defined volume selector functors.
Object to be filled with the neutrino path-segments representing geometry volume steps (generally bou...
GeomVolSelectorI * fGeomVolSelector
optional path seg trimmer (owned)
int fNRays
max path length scanner (box method): rays/point [def:200]
double fMixtWghtSum
norm of relative weights (<0 if explicit summing required)
virtual void SetTopVolName(string nm)
int fNPoints
max path length scanner (box method): points/surface [def:200]
virtual bool WillNeverEnter(double step)
string fTopVolumeName
input top vol [other than TGeoManager::GetTopVolume()]
ROOTGeomAnalyzer(string geometry_filename)
virtual double DensityUnits(void) const
virtual double MixtureWeightsSum(void) const
virtual void Top2Master(TVector3 &v) const
bool fMasterToTopIsIdentity
is fMasterToTop matrix the identity matrix?
virtual void Master2TopDir(TVector3 &v) const
virtual void SetScannerNPoints(int np)
set geometry driver's configuration options
TGeoManager * fGeometry
input detector geometry
virtual void SwimOnce(const TVector3 &r, const TVector3 &udir)
virtual void SetLengthUnits(double lu)
virtual double GetWeight(const TGeoMaterial *mat, int pdgc)
virtual void SetMixtureWeightsSum(double sum)
virtual void Local2SI(PathLengthList &pl) const
access to geometry coordinate/unit transforms for validation/test purposes
virtual TGeoManager * GetGeometry(void) const
bool fKeepSegPath
need to fill path segment "path"
double fDensityScale
conversion factor: input geometry density units -> kgr/meters^3
TGeoHMatrix * fMasterToTop
matrix connecting master coordinates to top volume coordinates
double fmxdstep
max errors in pathsegmentlist
virtual double LengthUnits(void) const
virtual void Top2MasterDir(TVector3 &v) const
virtual double ComputePathLengthPDG(const TVector3 &r, const TVector3 &udir, int pdgc)
virtual int ScannerNRays(void) const
virtual void SetKeepSegPath(bool keep)
double fLengthScale
conversion factor: input geometry length units -> meters
virtual const PathLengthList & ComputeMaxPathLengths(void)
virtual const PathLengthList & ComputePathLengths(const TLorentzVector &x, const TLorentzVector &p)
virtual bool WeightWithDensity(void) const
virtual int ScannerNPoints(void) const
retrieve geometry driver's configuration options
TVector3 * fCurrVertex
current generated vertex
virtual int ScannerNParticles(void) const
virtual bool GenBoxRay(int indx, TLorentzVector &x4, TLorentzVector &p4)
virtual void Master2Top(TVector3 &v) const
GFluxI * fFlux
a flux objects that can be used to scan the max path lengths
bool fDensWeight
if true pathlengths are weighted with density [def:true]
PathLengthList * fCurrMaxPathLengthList
current list of max path-lengths
virtual string TopVolName(void) const
virtual void SetDensityUnits(double du)
virtual void SetDebugFlags(int flgs)
double foz
top vol size/origin (top vol units)
virtual const TVector3 & GenerateVertex(const TLorentzVector &x, const TLorentzVector &p, int tgtpdg)
virtual double MaxPlSafetyFactor(void) const
virtual std::vector< std::pair< double, const TGeoMaterial * > > ComputeMatLengths(const TLorentzVector &x, const TLorentzVector &p)
virtual int GetTargetPdgCode(const TGeoMaterial *const m) const
virtual void SetMaxPlSafetyFactor(double sf)
virtual bool GetKeepSegPath(void) const
int fNParticles
max path length scanner (flux method): particles in [def:10000]
virtual void SI2Local(TVector3 &v) const
virtual void SetScannerFlux(GFluxI *f)
int fMaterial
input selected material for vertex generation
virtual void SetWeightWithDensity(bool wt)
virtual GeomVolSelectorI * AdoptGeomVolSelector(GeomVolSelectorI *selector)
configure processing to perform path segment trimming
virtual const PathLengthList & GetMaxPathLengths(void) const
PathLengthList * fCurrPathLengthList
current list of path-lengths
virtual void Load(string geometry_filename)
PDGCodeList * fCurrPDGCodeList
current list of target nuclei
double fMaxPlSafetyFactor
factor that can multiply the computed max path lengths
virtual const PDGCodeList & ListOfTargetNuclei(void)
implement the GeomAnalyzerI interface
virtual bool FindMaterialInCurrentVol(int pdgc)
virtual void SetScannerNParticles(int np)
PathSegmentList * fCurrPathSegmentList
current list of path-segments
GENIE geometry drivers.
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25