70 #include <TLorentzVector.h>
72 #include <TApplication.h>
73 #include <TPolyMarker3D.h>
86 using namespace genie;
87 using namespace genie::constants;
90 void GetRandomRay (TLorentzVector & x, TLorentzVector & p);
106 int main(
int argc,
char ** argv)
110 #ifdef __GENIE_GEOM_DRIVERS_ENABLED__
112 TApplication theApp(
"App", &argc, argv);
117 <<
"Creating a geometry driver for ROOT geometry at: "
127 <<
"Drawing the ROOT geometry";
128 geom_driver->
GetGeometry()->GetTopVolume()->Draw();
130 TPolyMarker3D * vtxp =
new TPolyMarker3D();
131 vtxp->SetMarkerColor(kRed);
132 vtxp->SetMarkerStyle(8);
133 vtxp->SetMarkerSize(0.4);
138 <<
"Computing max {density-weighted path lengths}";
141 LOG(
"test",
pINFO) <<
"Maximum math lengths: " << maxpl;
143 TFile f(
"geomtest.root",
"recreate");
144 TNtupleD vtxnt(
"vtxnt",
"",
"x:y:z:A:Z");
146 TLorentzVector x(0,0,0,0);
147 TLorentzVector p(0,0,0,0);
159 <<
"Current path lengths: " << pl;
165 if (tpdg == -1)
continue;
166 LOG(
"test",
pINFO) <<
"Selected target material: " << tpdg;
171 <<
"Generated vtx: (x = " << vtx.X()
172 <<
", y = " << vtx.Y() <<
", z = " <<vtx.Z() <<
")";
175 vtxnt.Fill(vtx.X(),vtx.Y(),vtx.Z(),
177 vtxp->SetNextPoint(vtx.X(),vtx.Y(),vtx.Z());
181 <<
" *** Vertices generated so far: " << n;
194 <<
"*** You should have enabled the geometry drivers first!";
207 TVector3 vec = vec0.Orthogonal();
221 vec.Rotate(phi,vec0);
226 TLorentzVector xx(vec, 0.);
235 <<
" x = " << x.X() <<
", y = " << x.Y() <<
", z = " << x.Z();
237 <<
" px = " << p.X() <<
", py = " << p.Y() <<
", pz = " << p.Z();
251 PathLengthList::const_iterator pliter;
253 for(pliter = pl.begin(); pliter != pl.end(); ++pliter) {
254 sum += pliter->second;
256 double cpl = sum * rnd->
RndFlux().Rndm();
258 for(pliter = pl.begin(); pliter != pl.end(); ++pliter) {
259 sum += pliter->second;
261 return pliter->first;
273 if( parser.OptionExists(
'f') ) {
274 LOG(
"test",
pINFO) <<
"Getting ROOT geometry filename";
277 string base_dir = string( gSystem->Getenv(
"GENIE") );
278 string filename = base_dir +
279 string(
"/data/geo/samples/BoxWithLArPbLayers.root");
285 if( parser.OptionExists(
'v') ) {
286 LOG(
"test",
pDEBUG) <<
"Checking for input volume name";
289 LOG(
"test",
pDEBUG) <<
"Using the <master volume>";
293 if( parser.OptionExists(
'd') ) {
294 LOG(
"test",
pINFO) <<
"Reading ray direction";
296 vector<double> dirv = parser.ArgAsDoubleTokens(
'd',
",");
297 assert(dirv.size() == 3);
300 LOG(
"test",
pINFO) <<
"No input ray direction - Using default";
305 if( parser.OptionExists(
's') ) {
306 LOG(
"test",
pINFO) <<
"Reading ray generation surface";
308 vector<double> rsv = parser.ArgAsDoubleTokens(
's',
",");
309 assert(rsv.size() == 3);
312 LOG(
"test",
pINFO) <<
"No input ray generation surface - Using default";
317 if( parser.OptionExists(
'r') ) {
318 LOG(
"test",
pINFO) <<
"Reading radius of ray generation area";
321 LOG(
"test",
pINFO) <<
"No input radius of ray generation area - Using default";
327 if( parser.OptionExists(
'n') ) {
328 LOG(
"test",
pINFO) <<
"Getting number of vertices to generate";
335 if( parser.OptionExists(
'p') ) {
336 LOG(
"test",
pINFO) <<
"Getting 'forced' target pdg";
346 <<
"\n Ray direction: ("
350 <<
"\n Ray generation surface : ("
354 <<
"\n Ray generation area radius : " <<
gOptRayR
355 <<
"\n Number of vertices : " <<
gOptNVtx
double PathLength(int pdgc) const
bool AreAllZero(void) const
virtual const PathLengthList & ComputeMaxPathLengths(void)
static RandomGen * Instance()
Access instance.
int IonPdgCodeToA(int pdgc)
A singleton holding random number generator classes. All random number generation in GENIE should tak...
int main(int argc, char **argv)
virtual const PathLengthList & ComputePathLengths(const TLorentzVector &x, const TLorentzVector &p)
TVector3 gOptRayDirection
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...
string gOptRootGeomTopVol
A ROOT/GEANT4 geometry driver.
TVector3 kDefOptRaySurf(0, 0, 0)
void GetRandomRay(TLorentzVector &x, TLorentzVector &p)
virtual const TVector3 & GenerateVertex(const TLorentzVector &x, const TLorentzVector &p, int tgtpdg)
virtual void SetTopVolName(string nm)
int GetTargetMaterial(const PathLengthList &pl)
TVector3 kDefOptRayDirection(1, 0, 0)
int IonPdgCodeToZ(int pdgc)
Command line argument parser.
void GetCommandLineArgs(int argc, char **argv)
TRandom3 & RndFlux(void) const
rnd number generator used by flux drivers
virtual TGeoManager * GetGeometry(void) const