Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
geo::GeometryBase Class Reference

The geometry of one entire detector (near, far, ipnd) More...

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-27/GeometryObjects/GeometryBase.h"

Inheritance diagram for geo::GeometryBase:
geo::Geometry

Classes

struct  DetectorParams
 
struct  Params
 

Public Types

template<class T >
using Atom = fhicl::Atom< T >
 
template<class T >
using Table = fhicl::Table< T >
 
using Comment = fhicl::Comment
 
using Name = fhicl::Name
 

Public Member Functions

 GeometryBase (const Params &params)
 
virtual ~GeometryBase ()
 
const PlaneGeoPlane (unsigned int i) const
 
const std::set< unsigned int > & GetPlanesByView (View_t v=kXorY) const
 
const unsigned int NextPlaneInView (unsigned int p, int d=+1) const
 
const unsigned int NextPlaneOtherView (unsigned int p, int d=+1) const
 
const unsigned int FirstPlaneInMuonCatcher () const
 Returns the index of the first plane contained in the muon catcher. More...
 
double CellTpos (unsigned int ip, unsigned int ic, double w=0.0) const
 
void CellInfo (unsigned int ip, unsigned int ic, View_t *view=0, double *pos=0, double *dpos=0) const
 
const CellGeoIdToCell (const CellUniqueId &id, int *iplane, int *icell) const
 
const PlaneGeoIdToPlane (const CellUniqueId &id, int *iplane) const
 
int getPlaneID (const CellUniqueId &id) const
 
int getCellID (const CellUniqueId &id) const
 
bool getPlaneAndCellID (const CellUniqueId &id, int &plane, int &cell) const
 
int getPlaneID (const double &x, const double &y, const double &z) const
 
int getCellID (const double &x, const double &y, const double &z) const
 
bool getPlaneAndCellID (const double &x, const double &y, const double &z, int &plane, int &cell) const
 
void CountCellsOnLine (double X1, double Y1, double Z1, double X2, double Y2, double Z2, std::vector< OfflineChan > &Xhitsonline, std::vector< OfflineChan > &Yhitsonline)
 
void CountCellsOnLine (TVector3 r1, TVector3 r2, std::vector< OfflineChan > &Xhitsonline, std::vector< OfflineChan > &Yhitsonline)
 
void CountCellsOnLine (double X1, double Y1, double Z1, double X2, double Y2, double Z2, std::vector< CellOnLine > &Xhitsonline, std::vector< CellOnLine > &Yhitsonline)
 Make list of cells in each view traversed by a line segment and the entry and exit points into each cell. More...
 
void CountCellsOnLine (TVector3 r1, TVector3 r2, std::vector< CellOnLine > &Xhitsonline, std::vector< CellOnLine > &Yhitsonline)
 
void CountCellsOnLineFast (double x1, double y1, double z1, double x2, double y2, double z2, std::vector< OfflineChan > &Xhitsonline, std::vector< OfflineChan > &Yhitsonline)
 Make list of cells in each view traversed by a line segment. More...
 
void CountCellsOnLineFast (TVector3 r1, TVector3 r2, std::vector< OfflineChan > &Xhitsonline, std::vector< OfflineChan > &Yhitsonline)
 
void CountCellsOnLineFast (geo::View_t view, double v1, double z1, double v2, double z2, std::vector< OfflineChan > &hitsonline)
 2D version More...
 
unsigned int NPlanes () const
 
double DetHalfWidth () const
 
double DetHalfHeight () const
 
double DetLength () const
 
double SurfaceY () const
 
TVector3 NuMIBeamDirection () const
 Direction of neutrinos from the NuMI beam (unit vector) More...
 
TVector3 BoosterBeamDirection () const
 Direction of neutrinos from the Booster beam (unit vector) More...
 
double DistToElectronics (double localz, const CellGeo &cell) const
 get distance from local z position in cell to apd in cm, including pigtail More...
 
double GetPigtail (const CellUniqueId &id) const
 Return length of fiber in cm from end of cell to apd. More...
 
void WorldBox (double *xlo_cm, double *xhi_cm, double *ylo_cm, double *yhi_cm, double *zlo_cm, double *zhi_cm) const
 
void DetectorEnclosureBox (double *xlo_cm, double *xhi_cm, double *ylo_cm, double *yhi_cm, double *zlo_cm, double *zhi_cm) const
 
void DetectorBigBox (double *xlo_cm, double *xhi_cm, double *ylo_cm, double *yhi_cm, double *zlo_cm, double *zhi_cm) const
 
bool IntersectsDetector (double *xyz_cm, double *dxyz) const
 
bool IntersectsBigBox (double *xyz_cm, double *dxyz) const
 
bool isDetectorBigBoxUsed () const
 Do we use the Detector Big Box. More...
 
bool isInsideDetectorBigBox (const double x_cm, const double y_cm, const double z_cm) const
 Is the particle inside the detector Big Box? More...
 
bool isInsideFiducialVolume (const double x_cm, const double y_cm, const double z_cm) const
 Is the particle inside the detector Fiducial Volume? More...
 
bool isInsideFiducialVolume (const double *xyz_dimensionless) const
 
void FiducialBox (TVector3 &r0, TVector3 &r1) const
 
int CurrentCell (int *ip, int *ic) const
 
const CellUniqueId CurrentCellId () const
 
const CellUniqueId CellId (const double &x, const double &y, const double &z, double dxds=0., double dyds=0., double dzds=1., double step=0.01) const
 
TGeoMaterial * Material (double x, double y, double z) const
 
bool IsActive (const TGeoMaterial *m) const
 
double TotalMass (const char *volume="vDetEnclosure") const
 
double MassBetweenPoints (double *p1, double *p2) const
 
void MaterialsBetweenPoints (const double *p1, const double *p2, std::vector< double > &ds, std::vector< const TGeoMaterial * > &mat) const
 
void MaterialsBetweenPoints (TVector3 v1, TVector3 v2, std::vector< double > &ds, std::vector< const TGeoMaterial * > &mat) const
 
bool calculateMassesLong (const unsigned int number_of_points, CLHEP::HepRandomEngine &engine) const
 
double DEdge (const double *x0, const double *dx, double *exitp=0) const
 
double ClosestApproach (unsigned int ip, unsigned int ic, const TVector3 &vtx, const TVector3 &dir, double dx=0.0, double dy=0.0, double *w=0, double *s=0, TVector3 *point_in_cell=0, TVector3 *point_on_track=0) const
 Find the distance of closest approach between a cell and a track. More...
 
std::string GDMLFile () const
 
std::string ROOTFile () const
 
std::string GDMLFromFCL () const
 
std::string FileBaseName () const
 
int Run () const
 
TGeoManager * ROOTGeoManager () const
 
novadaq::cnv::DetId DetId () const
 Prefer ds::DetectorService::DetId() instead. More...
 
CoordinateTransformationgetCoordinateTransformation () const
 
std::string ExtractGDML () const
 Extract contents from fGDMLFile and return as a string. More...
 

Static Public Member Functions

static std::string ExtractGDML (std::string fname, bool fullpath)
 Extract contents from fname and return as a string. More...
 

Protected Types

typedef std::unordered_map< CellUniqueId, OfflineChanUIDMap
 

Protected Member Functions

geo::OfflineChan getPlaneCellMap (const CellUniqueId &id) const
 
virtual void setDetectorID (novadaq::cnv::DetId)
 Method to set DetectorID. More...
 
void setDetectorBigBox (double detector_bigbox_range)
 
void FindPlanes (std::vector< const TGeoNode * > &n, unsigned int depth, bool inMuonCatcher=false)
 
void MakePlane (std::vector< const TGeoNode * > &n, unsigned int depth, bool inMuonCatcher)
 
void SetDrawOptions ()
 
void BuildMaps ()
 
void SetDetectorSize ()
 
bool LoadGeometryFile (std::string gdmlfile, novadaq::cnv::DetId det_id=novadaq::cnv::kUNKNOWN_DET)
 In case of unknown ID, guesses from the filename. More...
 
int MakeTmpFile (std::string gdmlInfo)
 
void RemoveTmpFile (std::string fileName)
 Method to remove temporary file that holds detector geometry file. More...
 

Static Protected Member Functions

static std::string FindGDMLFile (std::string fname)
 Search for Geometry/gdml/fname in FW_SEARCH_PATH, return full path. More...
 

Protected Attributes

Params fParams
 
std::string fGDMLFile
 gdml file holding the geometry More...
 
std::string fROOTFile
 root file holding the geometry More...
 
std::string fGDMLFromFCL
 keep track of original fcl parameter More...
 
novadaq::cnv::DetId fDetId
 id for the detector being used More...
 
CoordinateTransformation fCoordinateTransformation
 Coordinate Transformation class. More...
 
std::vector< PlaneGeo * > fPlanes
 The detector planes. More...
 
std::vector< PlaneGeo * > fPlanesInMuonCatcher
 Same pointers as fPlanes. More...
 
UIDMap fIdMap
 Unique ID -> Plane,Cell. More...
 
std::set< unsigned intfAllPlanes
 List of all planes. More...
 
std::set< unsigned intfXplanes
 List of X measuring planes. More...
 
std::set< unsigned intfYplanes
 List of Y measuring planes. More...
 
double fDetLength
 Detector length (cm) More...
 
double fDetHalfHeight
 Detector 1/2 height (cm) More...
 
double fDetHalfWidth
 Detector 1/2 width (cm) More...
 
bool fIsDetectorBigBoxUsed
 Do we need to use the BigBox cut? More...
 
double fBigBoxRange
 Range of big box. More...
 
double fDetectorBigBoxXHi
 Dimensions of the DetectorBigBox in cm. More...
 
double fDetectorBigBoxXLo
 
double fDetectorBigBoxYHi
 
double fDetectorBigBoxYLo
 
double fDetectorBigBoxZHi
 
double fDetectorBigBoxZLo
 
fhicl::ParameterSet fConfigNDOS
 
fhicl::ParameterSet fConfigND
 
fhicl::ParameterSet fConfigFD
 
fhicl::ParameterSet fConfigTB
 
double fFiducialVolumeXHi
 
double fFiducialVolumeXLo
 
double fFiducialVolumeYHi
 
double fFiducialVolumeYLo
 
double fFiducialVolumeZHi
 
double fFiducialVolumeZLo
 
std::string fStoreTempGeo
 folder to store temp geo file More...
 
unsigned int fRunNumber
 Run number of configuration. More...
 

Detailed Description

The geometry of one entire detector (near, far, ipnd)

Definition at line 49 of file GeometryBase.h.

Member Typedef Documentation

template<class T >
using geo::GeometryBase::Atom = fhicl::Atom<T>

Definition at line 51 of file GeometryBase.h.

Definition at line 53 of file GeometryBase.h.

Definition at line 54 of file GeometryBase.h.

template<class T >
using geo::GeometryBase::Table = fhicl::Table<T>

Definition at line 52 of file GeometryBase.h.

typedef std::unordered_map<CellUniqueId, OfflineChan> geo::GeometryBase::UIDMap
protected

Definition at line 255 of file GeometryBase.h.

Constructor & Destructor Documentation

geo::GeometryBase::GeometryBase ( const Params params)

Definition at line 47 of file GeometryBase.cxx.

References ana::assert(), fGDMLFile, fGDMLFromFCL, cet::search_path::find_file(), geo::GeometryBase::Params::ForceUseFCLOnly, fParams, fROOTFile, geo::GeometryBase::Params::GDMLFile, novadaq::cnv::kUNKNOWN_DET, LoadGeometryFile(), and setDetectorID().

48  : fParams(params)
50  , fRunNumber(0)
51  {
53 
54  // If they want to force FCL usage only, they better have supplied a file
55  assert(!(fParams.ForceUseFCLOnly() && fParams.GDMLFile().empty()));
56  if(fParams.GDMLFile().empty()){
57  // That's fine. Normal operating mode. We'll get GDML information in
58  // beginRun().
59  return;
60  }
61 
62  //NOTE: Setting fROOTFile to the same thing as GDMLFile, in the future
63  //this should be removed but for now EventGeneratorBase has a print
64  //statement requiring the root file name
66 
68 
69  // constructor decides if initialized value is a path or an environment variable
70  cet::search_path sp("FW_SEARCH_PATH");
71 
72  if ( !sp.find_file(fParams.GDMLFile(), fGDMLFile) ) {
73  throw cet::exception("GeometryFileLoad")
74  << "cannot find GDML file " << fGDMLFile << " bail ungracefully\n"
75  << __FILE__ << ":" << __LINE__ << "\n";
76  }
77  mf::LogWarning("LoadNewGeometry") << "loading new geometry files\n"
78  << fGDMLFile << "\n";
79 
81  }
novadaq::cnv::DetId fDetId
id for the detector being used
Definition: GeometryBase.h:285
Atom< bool > ForceUseFCLOnly
Definition: GeometryBase.h:71
std::string fROOTFile
root file holding the geometry
Definition: GeometryBase.h:282
std::string fGDMLFile
gdml file holding the geometry
Definition: GeometryBase.h:281
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
unsigned int fRunNumber
Run number of configuration.
Definition: GeometryBase.h:332
bool LoadGeometryFile(std::string gdmlfile, novadaq::cnv::DetId det_id=novadaq::cnv::kUNKNOWN_DET)
In case of unknown ID, guesses from the filename.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
assert(nhit_max >=nhit_nbins)
Atom< std::string > GDMLFile
Definition: GeometryBase.h:70
std::string fGDMLFromFCL
keep track of original fcl parameter
Definition: GeometryBase.h:283
virtual void setDetectorID(novadaq::cnv::DetId)
Method to set DetectorID.
geo::GeometryBase::~GeometryBase ( )
virtual

Definition at line 84 of file GeometryBase.cxx.

References fGDMLFile, fPlanes, MECModelEnuComparisons::i, and RemoveTmpFile().

85  {
86  for (unsigned int i=0; i<fPlanes.size(); ++i) {
87  if (fPlanes[i]) { delete fPlanes[i]; fPlanes[i] = 0; }
88  }
89 
90  //clean up an existing temporary file
91  if (fGDMLFile.find("TEMP_GEO_GDML") != std::string::npos){
92  this->RemoveTmpFile(fGDMLFile);
93  }
94 
95 
96  }
std::string fGDMLFile
gdml file holding the geometry
Definition: GeometryBase.h:281
std::vector< PlaneGeo * > fPlanes
The detector planes.
Definition: GeometryBase.h:291
void RemoveTmpFile(std::string fileName)
Method to remove temporary file that holds detector geometry file.

Member Function Documentation

TVector3 geo::GeometryBase::BoosterBeamDirection ( ) const

Direction of neutrinos from the Booster beam (unit vector)

Definition at line 557 of file GeometryBase.cxx.

References e, fDetId, novadaq::cnv::kNDOS, and novadaq::cnv::kNEARDET.

558  {
559  // No simulation available for NDOS Booster. These values copied from the Cana
560  // package, where the comment read:
561  //
562  // NDOS BNB direction from Zelimir Djurcic <zdjurcic@hep.anl.gov> 2/26/2011,
563  // private communication.
564  //
565  // ND BNB direction from Ryan Murphy <rwmurphy@indiana.edu> 10/14/2016
566  // Used same method as described in NuMIBeamDirection()
567  // CAF File used:
568  // NearDet:
569  // /nova/ana/users/rwmurphy/bnb_mc_all_hadd_caf.caf.root
570 
571  switch(fDetId){
572  case novadaq::cnv::kNDOS: return TVector3(-0.367, 0.012, 0.930).Unit();
573 
574  case novadaq::cnv::kNEARDET: return TVector3(-2.961e-01, -1.206e-01,+9.475e-01).Unit();
575 
576  default:
577  throw cet::exception("BadGeoConfig")
578  << "Bad geometry configuration: " << fDetId << "\n"
579  << __FILE__ << ":" << __LINE__ << "\n";
580  }
581  }
novadaq::cnv::DetId fDetId
id for the detector being used
Definition: GeometryBase.h:285
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
Prototype Near Detector on the surface at FNAL.
Near Detector in the NuMI cavern.
Float_t e
Definition: plot.C:35
void geo::GeometryBase::BuildMaps ( )
protected

Build maps used for quick access to the geometry

Definition at line 996 of file GeometryBase.cxx.

References plot_validation_datamc::c, geo::PlaneGeo::Cell(), fAllPlanes, fIdMap, fPlanes, fXplanes, fYplanes, MECModelEnuComparisons::i, geo::CellGeo::Id(), calib::j, geo::kX, geo::kY, geo::PlaneGeo::Ncells(), and Plane().

Referenced by LoadGeometryFile().

997  {
998  fAllPlanes.clear();
999  fXplanes.clear();
1000  fYplanes.clear();
1001 
1002  // Sets which list planes by view
1003  for (unsigned int i=0; i<fPlanes.size(); ++i) {
1004  fAllPlanes.insert(i);
1005  if (fPlanes[i]->View()==kX) fXplanes.insert(i);
1006  else if (fPlanes[i]->View()==kY) fYplanes.insert(i);
1007  else {
1008  throw cet::exception("BAD_GEO_CONFIG")
1009  << "Bad plane view" << fPlanes[i]->View() << ", plane " << i << "\n"
1010  << __FILE__ << ":" << __LINE__ << "\n";
1011  }
1012  }
1013 
1014  // Unique Id -> cell map
1015  for (unsigned int i=0; i<fPlanes.size(); ++i) {
1016  const PlaneGeo* p = fPlanes[i];
1017  for (unsigned int j=0; j<p->Ncells(); ++j) {
1018  // Assert that the cell ids are in fact unique
1019  if (fIdMap.find(this->Plane(i)->Cell(j)->Id())!=fIdMap.end()) {
1020  throw cet::exception("BAD_CELL_UNIQUE_ID")
1021  << "Duplicate Cell UIDs" << this->Plane(i)->Cell(j)->Id()
1022  << ", plane " << i << ", cell " << j << "\n"
1023  << __FILE__ << ":" << __LINE__ << "\n";
1024  }
1025  OfflineChan c(i,j);
1026  fIdMap[this->Plane(i)->Cell(j)->Id()] = c;
1027  }
1028  }
1029  }// end of BuildMaps
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
const char * p
Definition: xmltok.h:285
Vertical planes which measure X.
Definition: PlaneGeo.h:28
std::set< unsigned int > fAllPlanes
List of all planes.
Definition: GeometryBase.h:295
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
const PlaneGeo * Plane(unsigned int i) const
std::vector< PlaneGeo * > fPlanes
The detector planes.
Definition: GeometryBase.h:291
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
const CellUniqueId & Id() const
Definition: CellGeo.h:55
std::set< unsigned int > fYplanes
List of Y measuring planes.
Definition: GeometryBase.h:297
UIDMap fIdMap
Unique ID -> Plane,Cell.
Definition: GeometryBase.h:293
const double j
Definition: BetheBloch.cxx:29
Definition: View.py:1
std::set< unsigned int > fXplanes
List of X measuring planes.
Definition: GeometryBase.h:296
bool geo::GeometryBase::calculateMassesLong ( const unsigned int  number_of_points,
CLHEP::HepRandomEngine engine 
) const

Method to calculate masses of the detector

Definition at line 1068 of file GeometryBase.cxx.

References CLHEP::cm, CLHEP::cm3, om::cout, barite::density, fDetHalfHeight, fDetHalfWidth, fDetLength, CLHEP::RandFlat::fire(), CLHEP::g, isInsideFiducialVolume(), CLHEP::kg, CLHEP::m3, Material(), ROOTGeoManager(), string, submit_syst::x, submit_syst::y, and test::z.

Referenced by geo::Geometry::calculateMassesLong().

1069  {
1070 
1071  std::map <std::string, double> density; // Map of densities of all materials in the detector. Dimensionless. Mapped by material names.
1072  std::map <std::string, double> volume; // Map of volumes of all materials in the detector. Dimensionless. Mapped by material names.
1073  std::map <std::string, double> mass; // Map of total masses of all materials the detector. Dimensionless. Mapped by material names.
1074  std::map <std::string, double> volume_fiducial; // Map of volumes of all materials in the fiducial region of the detector. Dimensionless. Mapped by material names.
1075  std::map <std::string, double> mass_fiducial; // Map of total masses of all materials in the fiducial region of the detector. Dimensionless. Mapped by material names.
1076 
1077  CLHEP::RandFlat flat(engine);
1078 
1079  TStopwatch timer;
1080  timer.Start();
1081 
1082  // Effective cell volume for a point
1083  const double cell_volume = (2.0*fDetHalfWidth*CLHEP::cm)*(2.0*fDetHalfHeight*CLHEP::cm)*(fDetLength*CLHEP::cm) / double(number_of_points);
1084 
1085  // Loop over points
1086  for(unsigned int ipoint = 0; ipoint < number_of_points; ++ipoint){
1087 
1088  // Set the progress bar
1089  ROOTGeoManager()->GetGeomPainter()->OpProgress("Calculating masses", ipoint, number_of_points-1, &timer, kFALSE);
1090 
1091  // X, Y, Z of the point in cm
1092  const double x = flat.fire(-fDetHalfWidth , fDetHalfWidth ) * CLHEP::cm;
1093  const double y = flat.fire(-fDetHalfHeight, fDetHalfHeight) * CLHEP::cm;
1094  const double z = flat.fire(0.0 , fDetLength ) * CLHEP::cm;
1095  const double current_position[3] = {x,y,z};
1096 
1097  // Get the material of the point
1098  const TGeoMaterial* current_material = Material(x/CLHEP::cm,
1099  y/CLHEP::cm,
1100  z/CLHEP::cm
1101  );
1102  // Get the material name
1103  const std::string current_material_name = current_material->GetName();
1104 
1105  // See if we have not defined the material
1106  if(density.find(current_material_name) == density.end()){
1107  density [current_material_name] = current_material->GetDensity() * (CLHEP::g/CLHEP::cm3); //http://indra.in2p3.fr/KaliVedaDoc/1.8.1/src/KVedaLossMaterial.h.html
1108  // Initialize these to zero
1109  volume [current_material_name] = 0.0;
1110  volume_fiducial[current_material_name] = 0.0;
1111  mass [current_material_name] = 0.0;
1112  mass_fiducial [current_material_name] = 0.0;
1113  }// end of searching current_material_name
1114 
1115  volume[current_material_name] += cell_volume;
1116  mass [current_material_name] += cell_volume * density[current_material_name];
1117 
1118  // See if the point is inside fiducial volume
1119  if(isInsideFiducialVolume(current_position)){
1120  volume_fiducial[current_material_name] += cell_volume;
1121  mass_fiducial [current_material_name] += cell_volume * density[current_material_name];
1122  }// end of checking if the point is inside fiducial volume
1123 
1124  }// end of looping over points
1125 
1126  std::cout<<"Calculated masses, volumes etc.:\n";
1127 
1128  // Printing the mass table for each detector material
1129  for(std::map<std::string, double>::iterator iter = density.begin(); iter != density.end(); ++iter) {
1130 
1131  const std::string key_str = iter->first;
1132 
1133  std::cout<<std::setw(9)<<"\t\tMaterial="<<std::setw(20)<<key_str
1134  <<std::setw(10)<<" density="<<std::setw(10)<<density[key_str]/CLHEP::kg*CLHEP::m3<<std::setw(6)<<"kg/m3"
1135  <<std::setw(9)<<" volume="<<std::setw(10)<<volume[key_str]/CLHEP::m3<<std::setw(2)<<"m3"
1136  <<std::setw(7)<<" mass="<<std::setw(10)<<mass[key_str] / CLHEP::kg<<std::setw(2)<<"kg"
1137  <<std::setw(17)<<" volume_fiducial="<<std::setw(10)<<volume_fiducial[key_str] / CLHEP::m3<<std::setw(1)<<"m3"
1138  <<std::setw(15)<<" mass_fiducial="<<std::setw(10)<<mass_fiducial[key_str] / CLHEP::kg<<std::setw(3)<<"kg\n";
1139 
1140  }// end of printing the mass table for each detector material
1141 
1142  return true;
1143  }
static constexpr double cm3
TGeoMaterial * Material(double x, double y, double z) const
double fDetLength
Detector length (cm)
Definition: GeometryBase.h:299
static constexpr double g
TGeoManager * ROOTGeoManager() const
double fDetHalfHeight
Detector 1/2 height (cm)
Definition: GeometryBase.h:300
double fDetHalfWidth
Detector 1/2 width (cm)
Definition: GeometryBase.h:301
static constexpr double kg
static constexpr double cm
Definition: SystemOfUnits.h:99
Definition: structs.h:1
static constexpr double m3
z
Definition: test.py:28
OStream cout
Definition: OStream.cxx:6
tuple density
Definition: barite.py:33
bool isInsideFiducialVolume(const double x_cm, const double y_cm, const double z_cm) const
Is the particle inside the detector Fiducial Volume?
enum BeamMode string
const CellUniqueId geo::GeometryBase::CellId ( const double &  x,
const double &  y,
const double &  z,
double  dxds = 0.,
double  dyds = 0.,
double  dzds = 1.,
double  step = 0.01 
) const

Return the unique cel id for a specified location and direction in the detector

Parameters
x- x position coordinate (cm, world coordinates)
y- y position coordinate (cm, world coordinates)
z- z position coordinate (cm, world coordinates)
dxds- dxds direction in which to explore a step
dyds- dyds direction in which to explore a step
dzds- dzds direction in which to explore a step
step- step size to take

For the sake of efficiency, this method does no checking to ensure that the location is in fact inside a cell. The user is expected to perform that check before using the position (x,y,z).

Note further, that this uses the gGeoManager->InitTrack method and will disrupt TGeo-based tracking and should be called once any TGeo-based tracking is completed.

Definition at line 396 of file GeometryBase.cxx.

References CurrentCellId(), E, e, and std::max().

Referenced by fuzz::FuzzyKVertex::AddProng(), calib::MuondEdx::filter(), calib::MuonTrackHits::filter(), calib::MuondEdxAna::filter(), lem::FindCellRobust(), fuzz::ViewMatchAlg::Matching(), nerd::ViewMatchAlg::Matching(), trk::KalmanGeoHelper::MatchTrajectoryToPlane(), slid::Recluster::produce(), jmshower::RecoJMShower::RecoShowers(), g4n::FLSHitListAction::SteppingAction(), geo::GeometryTest::testCellId(), geo::GeometryTest::testCellIdFromPos(), and slid::NuEEnergyAlg::VertexEnergy().

398  {
399  // The strategy for finding the cell ID is to try the exact point
400  // we've been handed. If that does not return a valid cell ID, then
401  // try shifting the point around slightly to account for tracking
402  // and edge finding uncertainties. If after trying that we still
403  // don't have a valid ID, return 0.
404 
405  gGeoManager->InitTrack(x, y, z, dxds, dyds, dzds);
406  gGeoManager->FindNextBoundary(1.E-6);
407  CellUniqueId ID = this->CurrentCellId();
408  if (ID != 0) return ID;
409 
410  double eps = 1.0E-1;
411  const double s = std::max(step, 1.e-3);
412 
413  // walk the step points backwards and forwards to see if we can find the
414  // cell
415  while(eps < 1.){
416 
417  const double eps_s = eps*s;
418 
419  // std::cout << "step back pos " << x-dxds*eps*s
420  // << "," << y-dyds*eps*s << "," << z-dzds*eps*s
421  // << " " << eps << " " << step << std::endl;
422  gGeoManager->InitTrack(x-dxds*eps_s, y-dyds*eps_s, z-dzds*eps_s, dxds, dyds, dzds);
423  gGeoManager->FindNextBoundary(1.E-6);
424  ID = this->CurrentCellId();
425  if (ID != 0) return ID;
426 
427  // std::cout << "step forward pos " << x+dxds*eps*s
428  // << "," << y+dyds*eps*s << "," << z+dzds*eps*s << std::endl;
429  gGeoManager->InitTrack(x+dxds*eps_s, y+dyds*eps_s, z+dzds*eps_s, dxds, dyds, dzds);
430  ID = this->CurrentCellId();
431  if (ID != 0) return ID;
432 
433  eps += 1.e-1;
434  }
435 
436  // No valid ID found
437  return 0;
438  }// end of CellId
T max(const caf::Proxy< T > &a, T b)
const CellUniqueId CurrentCellId() const
const XML_Char * s
Definition: expat.h:262
Float_t E
Definition: plot.C:20
z
Definition: test.py:28
unsigned long long int CellUniqueId
Definition: CellUniqueId.h:15
Float_t e
Definition: plot.C:35
void geo::GeometryBase::CellInfo ( unsigned int  ip,
unsigned int  ic,
View_t view = 0,
double *  pos = 0,
double *  dpos = 0 
) const

Given a plane and cell number, return which view the cell measures, its nominal center position, and nominal size about that center position.

Parameters
ip- plane number
ic- cell number
view- on return, the view this cell measures in
pos- the nominal (xyz) center position of this cell (cm)
dpos- half-dimensions of the cell in xyz (cm)
Exceptions
geo::Exception

Definition at line 813 of file GeometryBase.cxx.

References plot_validation_datamc::c, geo::PlaneGeo::Cell(), geo::CellGeo::GetCenter(), geo::CellGeo::HalfD(), geo::CellGeo::HalfL(), geo::CellGeo::HalfW(), geo::kX, geo::kY, geo::PlaneGeo::Ncells(), NPlanes(), Plane(), and geo::PlaneGeo::View().

Referenced by tbana::DetectorRateShutOff::analyze(), htk::HoughTrack::analyze(), comi::Leana::AnaNHit(), noe::build_cell_lookup_table(), noe::cart_to_cp(), evd::HitTower::Draw(), evd::RawDataDrawer::Draw3DHitBoxes(), skim::CosmicBeamComparison::FillNumuHistograms(), tut::TutProducer::FitPhoton(), evd::RecoBaseDrawer::GetClusterOutlines(), evd::GeometryDrawer::GetDCMBoxes(), evd::SimulationDrawer::GetLimits(), mono::MonopoleTrack::hit_is_on_track(), mono::operator<<(), earms::ElasticArmsHS::produce(), htk::Track3D::time_fit(), mono::Track3D::time_fit(), and dt::ViewMerger::ZipVerticalTracks().

814  {
815  if (ip>=this->NPlanes()) {
816  throw cet::exception("BAD_PLANE_NUMBER")
817  << " iplane " << ip << " [0," << this->NPlanes() << ")\n"
818  << __FILE__ << ":" << __LINE__ << "\n";
819  }
820  const PlaneGeo* p = this->Plane(ip);
821  if (p) {
822  if (view) *view = p->View();
823 
824  if (ic>=p->Ncells()) {
825  throw cet::exception("BAD_CELL_NUMBER")
826  << " iplane " << ic << " [0," << p->Ncells() << ")\n"
827  << __FILE__ << ":" << __LINE__ << "\n";
828  }
829  const CellGeo* c = p->Cell(ic);
830  if (pos) c->GetCenter(pos);
831 
832  if (dpos) {
833  if (p->View() == kX) {
834  dpos[0] = c->HalfW();
835  dpos[1] = c->HalfL();
836  dpos[2] = c->HalfD();
837  }
838  else if (p->View() == kY) {
839  dpos[0] = c->HalfL();
840  dpos[1] = c->HalfW();
841  dpos[2] = c->HalfD();
842  }
843  }
844  }
845  }// end of CellInfo
const char * p
Definition: xmltok.h:285
Vertical planes which measure X.
Definition: PlaneGeo.h:28
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
TString ip
Definition: loadincs.C:5
const PlaneGeo * Plane(unsigned int i) const
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
unsigned int NPlanes() const
double geo::GeometryBase::CellTpos ( unsigned int  ip,
unsigned int  ic,
double  w = 0.0 
) const

Return the transverse position of the cell in which ever view its in

Parameters
ip- plane number
ic- cell number
w- optional position along the local cell z-axis
Returns
- transverse position in units of cm
Exceptions
-geo::Exception is plane, cell, or view are out of range

Definition at line 772 of file GeometryBase.cxx.

References plot_validation_datamc::c, geo::PlaneGeo::Cell(), geo::CellGeo::GetCenter(), geo::kX, geo::kY, geo::PlaneGeo::Ncells(), NPlanes(), Plane(), elec2geo::pos, and geo::PlaneGeo::View().

Referenced by mono::operator<<(), htk::Track3D::time_fit(), and mono::Track3D::time_fit().

772  {
773  if (ip>=this->NPlanes()) {
774  throw cet::exception("BAD_PLANE_NUMBER")
775  << " iplane " << ip << " [0," << this->NPlanes() << ")\n"
776  << __FILE__ << ":" << __LINE__ << "\n";
777  }
778  const PlaneGeo* p = this->Plane(ip);
779  if (p) {
780  if (ic>=p->Ncells()) {
781  throw cet::exception("BAD_CELL_NUMBER")
782  << " iplane " << ic << " [0," << p->Ncells() << ")\n"
783  << __FILE__ << ":" << __LINE__ << "\n";
784  }
785  const CellGeo* c = p->Cell(ic);
786  if (c) {
787  double pos[3];
788  c->GetCenter(pos,w);
789  if (p->View() == kX) { return pos[0]; }
790  if (p->View() == kY) { return pos[1]; }
791  throw cet::exception("BAD_PLANE_VIEW")
792  << "view " << p->View() << "\n"
793  << __FILE__ << ":" << __LINE__ << "\n";
794  return 0.0;
795  }
796  }
797  return 0.0;
798  }// end of CellTpos
const char * p
Definition: xmltok.h:285
Vertical planes which measure X.
Definition: PlaneGeo.h:28
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
TString ip
Definition: loadincs.C:5
const PlaneGeo * Plane(unsigned int i) const
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
unsigned int NPlanes() const
Float_t w
Definition: plot.C:20
double geo::GeometryBase::ClosestApproach ( unsigned int  ip,
unsigned int  ic,
const TVector3 &  vtx,
const TVector3 &  dir,
double  dx = 0.0,
double  dy = 0.0,
double *  w = 0,
double *  s = 0,
TVector3 *  point_in_cell = 0,
TVector3 *  point_on_track = 0 
) const

Find the distance of closest approach between a cell and a track.

Parameters
ip- plane number
ic- cell number
vtx- track start point
dir- track direction
dx- offset within the cell (in cm, dx=0 is center of cell)
dy- offset within the cell (in cm, dy=0 is center of cell)
w- Distance from read-out end where the closest approach occurs (cm)
s- Distance down the track where the closest approach occurs (cm)
point_in_cell- Point inside the cell where the closest approach occurs
point_on_track- Point on track where the closest approach occurs
Returns
The distance^2 of closest approach

Definition at line 1462 of file GeometryBase.cxx.

References getBrightness::cell, geo::PlaneGeo::Cell(), geo::ClosestApproach(), dir, dx, dy, dz, geo::CellGeo::GetCenter(), geo::CellGeo::HalfL(), geo::kX, geo::kY, PandAna.Demos.pi0_spectra::p0, Plane(), NDAPDHVSetting::plane, POTSpillRate::view, and geo::PlaneGeo::View().

Referenced by fuzz::ViewMatchAlg::CalcEnergyProfile(), and nerd::ViewMatchAlg::CalcEnergyProfile().

1472  {
1473  // ==
1474  // Find the line that runs down the cell at the request position
1475  //
1476  const PlaneGeo* plane = this->Plane(ip);
1477  View_t view = plane->View();;
1478 
1479  const CellGeo* cell = plane->Cell(ic);
1480 
1481  double p0[3], p1[3];
1482  double dz = cell->HalfL();
1483  cell->GetCenter(p0, +dz);
1484  cell->GetCenter(p1, -dz);
1485 
1486  // Shift to the ray requested
1487  p0[2] += dy;
1488  p1[2] += dy;
1489  if (view==kX) { p0[0] += dx; p1[0] += dx; }
1490  else if (view==kY) { p0[1] += dx; p1[1] += dx; }
1491 
1492  TVector3 P0(p0[0], p0[1], p0[2]);
1493  TVector3 P1(p1[0], p1[1], p1[2]);
1494  // ==
1495 
1496  // Get two points on the track, the vertex and a point at vertex+dir
1497  TVector3 Q1(vtx); Q1 += dir;
1498 
1499  // Use the closest approach function to compute the rest
1500  return geo::ClosestApproach(P0, P1,
1501  vtx, Q1,
1502  w, s,
1503  point_in_cell,
1504  point_on_track);
1505  }
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Vertical planes which measure X.
Definition: PlaneGeo.h:28
TString ip
Definition: loadincs.C:5
const PlaneGeo * Plane(unsigned int i) const
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
const XML_Char * s
Definition: expat.h:262
double dy[NP][NC]
double dx[NP][NC]
double dz[NP][NC]
double ClosestApproach(const double point[], const double intercept[], const double slopes[], double closest[])
Find the distance of closest approach between point and line.
Definition: Geo.cxx:222
TDirectory * dir
Definition: macro.C:5
Float_t w
Definition: plot.C:20
void geo::GeometryBase::CountCellsOnLine ( double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2,
std::vector< OfflineChan > &  xhitsonline,
std::vector< OfflineChan > &  yhitsonline 
)

Method to count the number of cells passed through by a line segment between two points in the detector.

Definition at line 1556 of file GeometryBase.cxx.

References plot_validation_datamc::c.

Referenced by calib::HitEfficiency::analyze(), bpfit::dEdxCalculator::computeDEDX(), and CountCellsOnLine().

1559  {
1560  std::vector<CellOnLine> xhs, yhs;
1561  CountCellsOnLine(x1, y1, z1, x2, y2, z2, xhs, yhs);
1562 
1563  for(const CellOnLine& c: xhs) xhitsonline.push_back(c.chan);
1564  for(const CellOnLine& c: yhs) yhitsonline.push_back(c.chan);
1565  } // end CountCellsOnLine
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
void CountCellsOnLine(double X1, double Y1, double Z1, double X2, double Y2, double Z2, std::vector< OfflineChan > &Xhitsonline, std::vector< OfflineChan > &Yhitsonline)
void geo::GeometryBase::CountCellsOnLine ( TVector3  r1,
TVector3  r2,
std::vector< OfflineChan > &  xhitsonline,
std::vector< OfflineChan > &  yhitsonline 
)

Method to count the number of cells passed through by a line segment between two points in the detector.

Definition at line 1572 of file GeometryBase.cxx.

References CountCellsOnLine().

1575  {
1576  CountCellsOnLine(r1.X(), r1.Y(), r1.Z(), r2.X(), r2.Y(), r2.Z(),
1577  xhitsonline, yhitsonline);
1578  }
void CountCellsOnLine(double X1, double Y1, double Z1, double X2, double Y2, double Z2, std::vector< OfflineChan > &Xhitsonline, std::vector< OfflineChan > &Yhitsonline)
void geo::GeometryBase::CountCellsOnLine ( double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2,
std::vector< CellOnLine > &  xhitsonline,
std::vector< CellOnLine > &  yhitsonline 
)

Make list of cells in each view traversed by a line segment and the entry and exit points into each cell.

Method to count the number of cells passed through by a line segment between two points in the detector and keep track of the entry and exit points of the line on the cells

Definition at line 1586 of file GeometryBase.cxx.

References getBrightness::cell, geo::CellOnLine::chan, col, CurrentCellId(), d, geo::CellOnLine::entry, geo::CellOnLine::exit, IdToCell(), geo::kX, geo::kY, geo::OfflineChan::Plane(), Plane(), NDAPDHVSetting::plane, elec2geo::pos, util::pythag(), POTSpillRate::view, x1, and y1.

1588  {
1589 
1590  // This function returns a vector of cells crossed by the line and the
1591  // entry and exit points of the line through the cells for each view. If
1592  // the end point is within a cell, the entry or exit point is set to be
1593  // the end of the line.
1594  //
1595  // WARNING: This function makes use of gGeoManager and is therefore
1596  // accessing global variables! Take caution to properly
1597  // initialize these global variables when accessing them after
1598  // using this function!
1599 
1600  // define initial position and normalized direction vector
1601  double xyz[3] = {x1, y1, z1};
1602  double d = util::pythag(x2-x1, y2-y1, z2-z1);
1603  double dxyz[3] = {(x2-x1)/d, (y2-y1)/d, (z2-z1)/d};
1604 
1605  gGeoManager->InitTrack(xyz, dxyz);
1606  const double* pos = gGeoManager->GetCurrentPoint();
1607 
1608  double dtemp = util::pythag(pos[0]-x1, pos[1]-y1, pos[2]-z1);
1609 
1610  bool enter = false;
1611 
1612  // We update the properties of this cell intersection as we go, and store
1613  // it one every exit.
1614  CellOnLine col;
1615 
1616  // create a list of positions in scintillator
1617  while(dtemp <= d) {
1618  // if the current material is scintillator, count that as a cell passed through
1619  if(strncmp("Scintillator", gGeoManager->GetCurrentNode()->GetVolume()->GetMaterial()->GetName(), 12) == 0) {
1620  enter = true;
1621 
1622  col.entry = TVector3(pos[0],pos[1],pos[2]);
1623 
1624  int plane, cell;
1625  IdToCell(CurrentCellId(), &plane, &cell);
1626 
1627  col.chan = OfflineChan(plane, cell);
1628  }
1629 
1630  // step forward to the next material boundary
1631  gGeoManager->FindNextBoundary();
1632  gGeoManager->Step(kTRUE,kTRUE);
1633 
1634  dtemp = util::pythag(pos[0]-x1, pos[1]-y1, pos[2]-z1);
1635 
1636  if(enter){
1637  enter = false;
1638 
1639  if(dtemp <= d){
1640  col.exit = TVector3(pos[0], pos[1], pos[2]);
1641  }
1642  else{
1643  col.exit = TVector3(x2, y2, z2);
1644  }
1645 
1646  const View_t view = Plane(col.chan.Plane())->View();
1647  if(view == geo::kX){ xhitsonline.push_back(col); }
1648  if(view == geo::kY){ yhitsonline.push_back(col); }
1649 
1650  }
1651  }
1652 
1653  } // end CountCellsOnLine
Float_t y1[n_points_granero]
Definition: compare.C:5
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Float_t x1[n_points_granero]
Definition: compare.C:5
const CellUniqueId CurrentCellId() const
Vertical planes which measure X.
Definition: PlaneGeo.h:28
const PlaneGeo * Plane(unsigned int i) const
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
Int_t col[ntarg]
Definition: Style.C:29
Float_t d
Definition: plot.C:236
Definition: View.py:1
double pythag(double x, double y)
2D Euclidean distance
Definition: MathUtil.h:29
const CellGeo * IdToCell(const CellUniqueId &id, int *iplane, int *icell) const
void geo::GeometryBase::CountCellsOnLine ( TVector3  r1,
TVector3  r2,
std::vector< CellOnLine > &  Xhitsonline,
std::vector< CellOnLine > &  Yhitsonline 
)

Method to count the number of cells passed through by a line segment between two points in the detector and keep track of the entry and exit points of the line on the cells

Definition at line 1661 of file GeometryBase.cxx.

References CountCellsOnLine().

1664  {
1665  CountCellsOnLine(r1.X(), r1.Y(), r1.Z(), r2.X(), r2.Y(), r2.Z(),
1666  Xhitsonline, Yhitsonline);
1667  }
void CountCellsOnLine(double X1, double Y1, double Z1, double X2, double Y2, double Z2, std::vector< OfflineChan > &Xhitsonline, std::vector< OfflineChan > &Yhitsonline)
void geo::GeometryBase::CountCellsOnLineFast ( double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2,
std::vector< OfflineChan > &  xhitsonline,
std::vector< OfflineChan > &  yhitsonline 
)

Make list of cells in each view traversed by a line segment.

Unlike CountCellsOnLine, which uses the full geometry, here we make some assumptions about cuboidal cells and the effects of alignment. For this loss in accuracy we gain a lot of speed.

Fast method to count the number of cells passed through by a line segment between two points in the detector.

Definition at line 1693 of file GeometryBase.cxx.

Referenced by chaninfo::CosmicEff::analyze(), hough::HoughValidate::analyze(), geo::LiveGeometry::CellsToEdgeInMC(), CountCellsOnLineFast(), dt::ViewMerger::CountUnexplainedOnLine(), chaninfo::FindSwappedChannels::filter(), geo::LiveGeometry::ProjectedCellsInMC(), geo::LiveGeometry::ProjectedCellsToEdge(), geo::LiveGeometry::ProjectedCellsToNextBadRegion(), and geo::LiveGeometry::ProjectedLiveCellsToEdge().

1697  {
1698  CountCellsOnLineFast(TVector3(x1, y1, z1), TVector3(x2, y2, z2),
1699  xhitsonline, yhitsonline);
1700  }
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
void CountCellsOnLineFast(double x1, double y1, double z1, double x2, double y2, double z2, std::vector< OfflineChan > &Xhitsonline, std::vector< OfflineChan > &Yhitsonline)
Make list of cells in each view traversed by a line segment.
void geo::GeometryBase::CountCellsOnLineFast ( TVector3  r1,
TVector3  r2,
std::vector< OfflineChan > &  xhitsonline,
std::vector< OfflineChan > &  yhitsonline 
)

Fast method to count the number of cells passed through by a line segment between two points in the detector.

Definition at line 1707 of file GeometryBase.cxx.

References getBrightness::cell, geo::PlaneGeo::Cell(), geo::ClampRayToDetectorVolume(), dz, fPlanes, geo::CellGeo::GetCenter(), geo::CellGeo::HalfD(), geo::CellGeo::HalfW(), geo::kX, geo::kY, std::max(), std::min(), geo::PlaneGeo::Ncells(), NDAPDHVSetting::plane, std::swap(), POTSpillRate::view, and geo::PlaneGeo::View().

1710  {
1711  // Otherwise we would count when the ray was outside the detector in the
1712  // other view.
1713  ClampRayToDetectorVolume(&r1, &r2, this);
1714 
1715  // We assume downstream-going below
1716  if(r1.Z() > r2.Z()) std::swap(r1, r2);
1717 
1718  const double z1 = r1.Z();
1719  const double z2 = r2.Z();
1720 
1721  const unsigned int planeMax = fPlanes.size();
1722  for(unsigned int plane = 0; plane < planeMax; ++plane){
1723  const geo::PlaneGeo* geoplane = fPlanes[plane];
1724  const geo::CellGeo* geocell0 = geoplane->Cell(0);
1725  // Assuming here perfect alignment and identical cells across plane
1726  double xyzp[3];
1727  geocell0->GetCenter(xyzp);
1728  const double zc = xyzp[2];
1729  const double dz = geocell0->HalfD();
1730 
1731  if(z1 > zc+dz) continue;
1732  // Plane positions increase monotonically
1733  if(z2 < zc-dz) break;
1734 
1735  const geo::View_t view = geoplane->View();
1736 
1737  const double v1 = r1[view];
1738  const double v2 = r2[view];
1739 
1740  const double denom = z2-z1;
1741  const double dvdz = denom ? (v2-v1)/denom : 0;
1742 
1743  // Position entering the cell or starting
1744  const double zin = std::max(zc-dz, z1);
1745  double vlo = v1+(zin-z1)*dvdz;
1746  // Position exiting or ending
1747  const double zout = std::min(zc+dz, z2);
1748  double vhi = v1+(zout-z1)*dvdz;
1749  // Ensure they're from low to high instead
1750  if(vlo > vhi) std::swap(vlo, vhi);
1751 
1752  for(unsigned int cell = 0; cell < geoplane->Ncells(); ++cell){
1753  double xyz[3];
1754  geoplane->Cell(cell)->GetCenter(xyz);
1755  const double vc = xyz[view];
1756  const double dv = geoplane->Cell(cell)->HalfW();
1757 
1758  if(vlo > vc+dv) continue;
1759  // Cell positions increase monotonically
1760  if(vhi < vc-dv) break;
1761 
1762  if(view == geo::kX) xhitsonline.push_back(geo::OfflineChan(plane, cell));
1763  if(view == geo::kY) yhitsonline.push_back(geo::OfflineChan(plane, cell));
1764  } // end for cell
1765  } // end for plane
1766  }
T max(const caf::Proxy< T > &a, T b)
double HalfD() const
Definition: CellGeo.cxx:205
void GetCenter(double *xyz, double localz=0.0) const
Definition: CellGeo.cxx:159
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
Vertical planes which measure X.
Definition: PlaneGeo.h:28
unsigned int Ncells() const
Number of cells in this plane.
Definition: PlaneGeo.h:43
double HalfW() const
Definition: CellGeo.cxx:191
bool ClampRayToDetectorVolume(TVector3 *p0, TVector3 *p1, const GeometryBase *geom)
If either endpoint is outside the detector move it to the edge.
Definition: Geo.cxx:640
std::vector< PlaneGeo * > fPlanes
The detector planes.
Definition: GeometryBase.h:291
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:53
double dz[NP][NC]
Geometry information for a single readout plane.
Definition: PlaneGeo.h:36
A (plane, cell) pair.
Definition: OfflineChan.h:17
T min(const caf::Proxy< T > &a, T b)
Encapsulate the cell geometry.
Definition: CellGeo.h:25
void geo::GeometryBase::CountCellsOnLineFast ( geo::View_t  view,
double  v1,
double  z1,
double  v2,
double  z2,
std::vector< OfflineChan > &  hitsonline 
)

2D version

Fast method to count the number of cells passed through by a line segment between two points in the detector.

Definition at line 1674 of file GeometryBase.cxx.

References ana::assert(), CountCellsOnLineFast(), geo::kX, and geo::kY.

1678  {
1679  assert(view == geo::kX || view == geo::kY);
1680 
1681  std::vector<OfflineChan> junk;
1682  if(view == geo::kX)
1683  CountCellsOnLineFast(v1, 0, z1, v2, 0, z2, hitsonline, junk);
1684  else
1685  CountCellsOnLineFast(0, v1, z1, 0, v2, z2, junk, hitsonline);
1686  }
Vertical planes which measure X.
Definition: PlaneGeo.h:28
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
void CountCellsOnLineFast(double x1, double y1, double z1, double x2, double y2, double z2, std::vector< OfflineChan > &Xhitsonline, std::vector< OfflineChan > &Yhitsonline)
Make list of cells in each view traversed by a line segment.
assert(nhit_max >=nhit_nbins)
int geo::GeometryBase::CurrentCell ( int planeid,
int cellid 
) const

Return the plane and cell number for the current tracking position held by the gGeoManager

Parameters
planeid: pointer to plane number, >=0 on success, -1 on failure
cellid: pointer to cell number, >=0 on success, -1 on failure
Returns
>0 if cell is found, <0 if not found.

Definition at line 333 of file GeometryBase.cxx.

References CurrentCellId(), and IdToCell().

Referenced by geo::GeometryTest::testFindCell().

333  {
334  if (! this->IdToCell(this->CurrentCellId(), planeid, cellid)) {
335  *planeid = -1;
336  *cellid = -1;
337  throw cet::exception("UNKNOWN_ID")
338  << "unknown id " << this->CurrentCellId() << "\n"
339  << __FILE__ << ":" << __LINE__ << "\n";
340  }
341  return 1;
342  }// end of
const CellUniqueId CurrentCellId() const
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
const CellGeo * IdToCell(const CellUniqueId &id, int *iplane, int *icell) const
const CellUniqueId geo::GeometryBase::CurrentCellId ( ) const

Return the unique cell id for the current cell – zero if not in any cell

Definition at line 348 of file GeometryBase.cxx.

References allTimeWatchdog::endl, MECModelEnuComparisons::i, LOG_DEBUG, geo::NodesToUniqueId(), ns, path, and string.

Referenced by CellId(), CountCellsOnLine(), and CurrentCell().

348  {
349  const std::string path = gGeoManager->GetPath();
350  //std::cout << "path to cell is " << path << std::endl;
351 
352  // check that the path actually contains a cell
353  if(path.find("Cell") == std::string::npos){
354  LOG_DEBUG("Geometry") << "no Cell in the path to the current volume:" << path << std::endl;
355  return 0;
356  }
357  if(path.find("HAirBubble") != std::string::npos){
358  LOG_DEBUG("Geometry") << "This an air bubble, not a cell:" << path << std::endl;
359  return 0;
360  }
361 
362  // We used to return PathToUniqueId(path.c_str()) at this point, but as of
363  // the root6 upgrade, the paths are all like
364  // vPlaneV_0/vModuleV_0/vExtruV_0/vCellV_0 rather than
365  // vPlaneV_3/vModuleV_1/vExtruV_4/vCellV_1, so use the list of parent
366  // pointers to determine the unique ID instead. The code here is derived
367  // from what TGeoManager::GetPath() does.
368  TGeoNodeCache* cache = gGeoManager->GetCurrentNavigator()->GetCache();
369  std::vector<const TGeoNode*> ns;
370  for(int i = 0; i <= cache->GetLevel(); ++i){
371  ns.push_back(((TGeoNode**)cache->GetBranch())[i]);
372  }
373  return NodesToUniqueId(ns, ns.size()-1);
374  }// end of CurrentCellId
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
CellUniqueId NodesToUniqueId(const std::vector< const TGeoNode * > &n, unsigned int depth)
static const double ns
Module that plots metrics from reconstructed cosmic ray data.
const std::string path
Definition: plot_BEN.C:43
enum BeamMode string
double geo::GeometryBase::DEdge ( const double *  x0,
const double *  dx,
double *  exitp = 0 
) const

Compute the distance from a point to the detector wall along a particular direction.

Parameters
x0- Input, [x,y,z] start point (cm)
dx- Input, direction vector
exitp- Ouput, Calculated [x,y,z] of exit point (cm)
Returns
distance to exit point in cm

Definition at line 1427 of file GeometryBase.cxx.

References fDetHalfHeight, fDetHalfWidth, fDetLength, geo::ProjectToBoxEdge(), and util::pythag().

Referenced by bpfit::Path::FindLayers(), comi::Cana::produce(), and crvtx::CosmicRayVertex::produce().

1430  {
1431  double xyzout[3];
1435  0, fDetLength,
1436  xyzout);
1437  if (exitp!=0) {
1438  exitp[0] = xyzout[0];
1439  exitp[1] = xyzout[1];
1440  exitp[2] = xyzout[2];
1441  }
1442  return util::pythag(x0[0]-xyzout[0],
1443  x0[1]-xyzout[1],
1444  x0[2]-xyzout[2]);
1445  }// end of GeometryBase::DEdge
double fDetLength
Detector length (cm)
Definition: GeometryBase.h:299
double fDetHalfHeight
Detector 1/2 height (cm)
Definition: GeometryBase.h:300
double fDetHalfWidth
Detector 1/2 width (cm)
Definition: GeometryBase.h:301
double dx[NP][NC]
double pythag(double x, double y)
2D Euclidean distance
Definition: MathUtil.h:29
void ProjectToBoxEdge(const double xyz[], const double dxyz[], double xlo, double xhi, double ylo, double yhi, double zlo, double zhi, double xyzout[])
Project along a direction from a particular starting point to the edge of a box.
Definition: Geo.cxx:38
void geo::GeometryBase::DetectorBigBox ( double *  xlo,
double *  xhi,
double *  ylo,
double *  yhi,
double *  zlo,
double *  zhi 
) const

Return the ranges of x,y and z for the "Detector volume" that the entire geometry lives in. If any pointers are 0, then those coordinates are ignored.

Parameters
xlo: On return, lower bound on x positions
xhi: On return, upper bound on x positions
ylo: On return, lower bound on y positions
yhi: On return, upper bound on y positions
zlo: On return, lower bound on z positions
zhi: On return, upper bound on z positions

Definition at line 658 of file GeometryBase.cxx.

References fDetectorBigBoxXHi, fDetectorBigBoxXLo, fDetectorBigBoxYHi, fDetectorBigBoxYLo, fDetectorBigBoxZHi, and fDetectorBigBoxZLo.

Referenced by evgen::CosmicsGen::DetectorBigBoxCut(), evgen::CORSIKAGen::DetectorBigBoxCut(), evgen::CORSIKAGen::populateNShowers(), and evgen::CosmicsGen::ProjectMuonsToDetectorBigBox().

660  {
661  //we don't want to return without passing along the big box coordinates
662  //note the big box is set by default to just be the detector size
663  //if 'isDetectorBigBox' is false
664  //if(!this->isDetectorBigBoxUsed())return;
669  *zlo = fDetectorBigBoxZLo;
670  *zhi = fDetectorBigBoxZHi;
671  }// end of DetectorBigBox
double fDetectorBigBoxXHi
Dimensions of the DetectorBigBox in cm.
Definition: GeometryBase.h:314
double fDetectorBigBoxZHi
Definition: GeometryBase.h:318
double fDetectorBigBoxXLo
Definition: GeometryBase.h:315
double fDetectorBigBoxYLo
Definition: GeometryBase.h:317
double fDetectorBigBoxZLo
Definition: GeometryBase.h:319
double fDetectorBigBoxYHi
Definition: GeometryBase.h:316
void geo::GeometryBase::DetectorEnclosureBox ( double *  xlo,
double *  xhi,
double *  ylo,
double *  yhi,
double *  zlo,
double *  zhi 
) const

Return the ranges of x,y and z for the "Detector volume" that the entire geometry lives in. If any pointers are 0, then those coordinates are ignored.

Parameters
xlo: On return, lower bound on x positions
xhi: On return, upper bound on x positions
ylo: On return, lower bound on y positions
yhi: On return, upper bound on y positions
zlo: On return, lower bound on z positions
zhi: On return, upper bound on z positions

Definition at line 627 of file GeometryBase.cxx.

References ana::assert(), x1, submit_syst::x2, y1, and submit_syst::y2.

Referenced by g4n::FLSHitListAction::ParticleProjection(), and setDetectorBigBox().

629  {
630  const TGeoShape* s = gGeoManager->GetVolume("vDetEnclosure")->GetShape();
631  assert(s);
632 
633  if (xlo || xhi) {
634  double x1, x2;
635  s->GetAxisRange(1,x1,x2); if (xlo) *xlo = x1; if (xhi) *xhi = x2;
636  }
637  if (ylo || yhi) {
638  double y1, y2;
639  s->GetAxisRange(2,y1,y2); if (ylo) *ylo = y1; if (yhi) *yhi = y2;
640  }
641  if (zlo || zhi) {
642  double z1, z2;
643  s->GetAxisRange(3,z1,z2); if (zlo) *zlo = z1; if (zhi) *zhi = z2;
644  }
645  }// end ofDetectorEnclosureBox
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
const XML_Char * s
Definition: expat.h:262
assert(nhit_max >=nhit_nbins)
double geo::GeometryBase::DetHalfHeight ( ) const

Definition at line 474 of file GeometryBase.cxx.

References ana::assert(), fDetHalfHeight, fDetId, and novadaq::cnv::kUNKNOWN_DET.

Referenced by caf::AddCosmicTruthToVec(), caf::CAFMaker::AddMCTruthToVec(), fuzz::FuzzyKVertex::AddProng(), geo::GeometryTest::analyze(), calib::HitEfficiency::analyze(), mcchk::LeptonAna::analyze(), earms::ElasticArmsValidate::analyze(), mcchk::DetSimAna::analyze(), air::AirKalmanAna::analyze(), slid::LIDTraining::analyze(), trk::CosmicTrackAna::analyze(), mcchk::NeutrinoAna::AnalyzeNeutrinoInteraction(), calib::CosmicCalib::beginRun(), mcchk::CosmicAna::beginRun(), mcchk::NeutrinoAna::beginRun(), calib::MakeAttenuationProfiles::beginRun(), numue::NumuEAna::beginRun(), mcchk::LeptonAna::beginRun(), calib::AttenFit::beginRun(), calib::StopperThreshold::beginRun(), calib::AttenuationFit::beginRun(), trk::KalmanTrackMerge::CanJoinTracks(), geo::ClampRayToDetectorVolume(), bpfit::BreakPoint::ClampToDetector(), trk::KalmanTrackAna::Containment(), trk::KalmanGeoHelper::CountMissedCellsOnLine(), evd::Display3DPad::Draw(), evd::HitTower::Draw(), evd::RawDataDrawer::Draw3DHitBoxes(), evd::RecoBaseDrawer::DrawHoughResults2D(), calib::AttenFit::expFit(), calib::AttenuationFit::expFit(), calib::StopperThreshold::FillHist(), calib::CosmicTrends::FillHistograms(), calib::StopperThreshold::FillTree(), filter::Filter::FillTruthVariables(), trk::KalmanTrack::FilterTracker(), vdt::VertexDT::FindMinMax(), calib::AttenFit::fit_channel_prof(), calib::AttenuationFit::fit_channel_prof(), evgen::GENIENeutronOscGen::GENIENeutronOscGen(), evd::SliceNavigator::GetBounds(), evd::SliceNavigator::GetBox(), nuesand::FillNueSandbox::GetECF(), jmshower::RecoJMShower::GetInterCellTransDedxProb(), jmshower::RecoJMShower::GetInterPlaneDedxProb(), hough::HoughValidate::HoughLineToDetector(), bsf::BremShowerFilter::inFiducial(), dif::DiFShowerFinder::inFiducial(), g4n::NeutronSubstitutionProcess::InsideDetector(), calib::RockMuonStopperSelection::IsContainedStopper(), comi::CosmicMetrics::IsEntering(), align::AlignInspect::IsGoodTrack(), align::Alignment::IsGoodTrack(), comi::Leana::IsPointOnEdge(), calib::RockMuonStopperSelection::IsTrulyContainedStopper(), calib::RockMuonStopperSelection::IsTrulyInFiducial(), calib::ThroughgoingSelection::IsTrulyUncontained(), calib::ThroughgoingSelection::IsUncontained(), evd::TZProjPad::LayoutHisto(), calib::AttenFit::lowessFit(), calib::AttenuationFit::lowessFit(), fuzz::ViewMatchAlg::Matching(), nerd::ViewMatchAlg::Matching(), trk::KalmanGeoHelper::MatchTrajectoryToPlane(), numue::NumuEAlg::NumuEAlg(), cheat::TrackCheater::produce(), jmshower::JMTrackMerge::produce(), calib::FiberCalibration::produce(), earms::ElasticArmsHS::produce(), comi::Cana::produce(), evgen::GENIERockGen::produce(), crvtx::CosmicRayVertex::produce(), cheat::MCCheater::produce(), remid::RecoMuon::produce(), evd::RawDataDrawer::RawDigit3D(), trk::RLFit::RLFit(), calib::AttenFit::rolloffFit(), calib::AttenuationFit::rolloffFit(), evd::TZProjPad::ShowFull(), evd::TZProjPad::ShowPartial(), numue::NumuEAna::TotalLengthInDetector(), cheat::RecoCheckAna::TotalLengthInDetector(), and trk::KalmanTrackAna::TotalLengthInDetector().

475  {
477  return fDetHalfHeight;
478  }
novadaq::cnv::DetId fDetId
id for the detector being used
Definition: GeometryBase.h:285
double fDetHalfHeight
Detector 1/2 height (cm)
Definition: GeometryBase.h:300
assert(nhit_max >=nhit_nbins)
double geo::GeometryBase::DetHalfWidth ( ) const

Definition at line 467 of file GeometryBase.cxx.

References ana::assert(), fDetHalfWidth, fDetId, and novadaq::cnv::kUNKNOWN_DET.

Referenced by caf::AddCosmicTruthToVec(), caf::CAFMaker::AddMCTruthToVec(), fuzz::FuzzyKVertex::AddProng(), geo::GeometryTest::analyze(), calib::HitEfficiency::analyze(), mcchk::LeptonAna::analyze(), earms::ElasticArmsValidate::analyze(), mcchk::DetSimAna::analyze(), air::AirKalmanAna::analyze(), slid::LIDTraining::analyze(), trk::CosmicTrackAna::analyze(), mcchk::NeutrinoAna::AnalyzeNeutrinoInteraction(), calib::CosmicCalib::beginRun(), mcchk::CosmicAna::beginRun(), mcchk::NeutrinoAna::beginRun(), numue::NumuEAna::beginRun(), calib::MakeAttenuationProfiles::beginRun(), mcchk::LeptonAna::beginRun(), calib::AttenFit::beginRun(), calib::StopperThreshold::beginRun(), calib::AttenuationFit::beginRun(), trk::KalmanTrackMerge::CanJoinTracks(), geo::ClampRayToDetectorVolume(), bpfit::BreakPoint::ClampToDetector(), trk::KalmanTrackAna::Containment(), trk::KalmanGeoHelper::CountMissedCellsOnLine(), evd::Display3DPad::Draw(), evd::HitTower::Draw(), evd::RawDataDrawer::Draw3DHitBoxes(), evd::RecoBaseDrawer::DrawHoughResults2D(), calib::SystematicUncertaintyScaleAna::endJob(), calib::AttenFit::expFit(), calib::AttenuationFit::expFit(), calib::StopperThreshold::FillHist(), calib::CosmicTrends::FillHistograms(), calib::StopperThreshold::FillTree(), filter::Filter::FillTruthVariables(), trk::KalmanTrack::FilterTracker(), vdt::VertexDT::FindMinMax(), calib::AttenFit::fit_channel_prof(), calib::AttenuationFit::fit_channel_prof(), evgen::GENIENeutronOscGen::GENIENeutronOscGen(), evd::SliceNavigator::GetBounds(), evd::SliceNavigator::GetBox(), nuesand::FillNueSandbox::GetECF(), airshower::AirSlicer::GetHoughAngles(), airshower::AirSlicer::GetHoughMap(), airshower::AirSlicer::GetHoughRhos(), jmshower::RecoJMShower::GetInterCellTransDedxProb(), jmshower::RecoJMShower::GetInterPlaneDedxProb(), hough::HoughValidate::HoughLineToDetector(), bsf::BremShowerFilter::inFiducial(), dif::DiFShowerFinder::inFiducial(), g4n::NeutronSubstitutionProcess::InsideDetector(), calib::RockMuonStopperSelection::IsContainedStopper(), comi::CosmicMetrics::IsEntering(), align::AlignInspect::IsGoodTrack(), align::Alignment::IsGoodTrack(), comi::Leana::IsPointOnEdge(), calib::RockMuonStopperSelection::IsTrulyContainedStopper(), calib::RockMuonStopperSelection::IsTrulyInFiducial(), calib::ThroughgoingSelection::IsTrulyUncontained(), calib::ThroughgoingSelection::IsUncontained(), evd::TZProjPad::LayoutHisto(), calib::AttenFit::lowessFit(), calib::AttenuationFit::lowessFit(), fuzz::ViewMatchAlg::Matching(), nerd::ViewMatchAlg::Matching(), trk::KalmanGeoHelper::MatchTrajectoryToPlane(), numue::NumuEAlg::NumuEAlg(), cheat::TrackCheater::produce(), jmshower::JMTrackMerge::produce(), calib::FiberCalibration::produce(), earms::ElasticArmsHS::produce(), comi::Cana::produce(), evgen::GENIERockGen::produce(), crvtx::CosmicRayVertex::produce(), cheat::MCCheater::produce(), remid::RecoMuon::produce(), evd::RawDataDrawer::RawDigit3D(), trk::RLFit::RLFit(), calib::AttenFit::rolloffFit(), calib::AttenuationFit::rolloffFit(), evd::TZProjPad::ShowFull(), evd::TZProjPad::ShowPartial(), numue::NumuEAna::TotalLengthInDetector(), cheat::RecoCheckAna::TotalLengthInDetector(), and trk::KalmanTrackAna::TotalLengthInDetector().

468  {
470  return fDetHalfWidth;
471  }
novadaq::cnv::DetId fDetId
id for the detector being used
Definition: GeometryBase.h:285
double fDetHalfWidth
Detector 1/2 width (cm)
Definition: GeometryBase.h:301
assert(nhit_max >=nhit_nbins)
novadaq::cnv::DetId geo::GeometryBase::DetId ( ) const
inline

Prefer ds::DetectorService::DetId() instead.

Definition at line 243 of file GeometryBase.h.

Referenced by calib::ADCShapeFitAna::analyze(), geo::GeometryTest::analyze(), align::SplitTracks::analyze(), comi::DataCheck::analyze(), bpfit::BPFTmvaTrainer::analyze(), LightLevels::analyze(), CerenkovResponse::analyze(), util::StoreGDML::beginRun(), calib::ThresholdAna::beginRun(), slicer::Slicer4D::beginRun(), presel::RockPresel::beginRun(), presel::CosmicVeto::beginRun(), wsnumu::WSNumu::beginRun(), presel::CosmicCVNVeto::beginRun(), presel::NuePresel::beginRun(), mcchk::CloseInTime::beginRun(), dprf::ChannelPlots::beginRun(), comi::NumiFiltering::beginRun(), mcchk::DetAna::beginRun(), calib::CosmicCalib::beginRun(), dprf::TrackPlots::beginRun(), calib::FiberCalibration::beginRun(), evgen::CosmicsGen::beginRun(), evgen::CosmicPionGen::beginRun(), numue::NumuEAna::beginRun(), calib::MakeAttenuationProfiles::beginRun(), evgen::IsoGen::beginRun(), supernova::SnovaGen::beginRun(), comi::NumiFilteringAna::beginRun(), evgen::GENIERockGen::beginRun(), evgen::SupernovaGen::beginRun(), calib::TimingCalibration::beginRun(), evgen::SingleGen::beginRun(), remid::ReMIdDedx::beginRun(), chaninfo::BadChanValidate::beginRun(), dif::DiFShowerFinder::beginRun(), calib::DriftResponseCalc::beginRun(), calib::PEResponse::beginRun(), evgen::CORSIKAGen::beginRun(), evgen::GENIEGen::beginRun(), calib::AttenFit::beginRun(), jmshower::NueSel::beginRun(), jmshower::NueSelLID::beginRun(), slid::SPIDBuilder::beginRun(), comi::NearlineAna::beginRun(), remid::ReMIdDedxRock::beginRun(), murem::MuonRemove::beginRun(), photrans::ImprovedTransport::beginRun(), remid::ReMIdDedxFD::beginRun(), remid::ReMIdDedxStudies::beginRun(), calib::AttenuationFit::beginRun(), calib::DCMTimingOffset::beginRun(), rsim::ReadoutSim::beginRun(), evgen::GENIENeutronOscGen::beginRun(), slid::LIDTraining::beginRun(), jmshower::RecoJMShower::beginRun(), slicemergeviews::SliceMergeViews::beginRun(), evgen::TextFileGen::beginRun(), tdslicer::TDSlicer::beginRun(), caf::CAFMaker::beginRun(), DataCheck::HardwareStatusCheck::beginSubRun(), comi::DataCheck::beginSubRun(), slicer::Slicer::BlockSlice(), slid::NuEEnergyAlg::CellADCToGeV(), slid::NuEEnergyAlg::CellEDataMC(), slid::NuEEnergyAlg::CellEnergy(), geo::LiveGeometry::CellsToEdgeInMC(), calib::AttenFit::ConsolidateViews(), calib::AttenuationFit::ConsolidateViews(), remid::ReMIdTrain::ContainedEvent(), chaninfo::BadChanList::CountDCMHits(), rsim::ReadoutSim::CreateRawDigits(), evgen::CosmicsGen::DetectorBigBoxCut(), evgen::CORSIKAGen::DetectorBigBoxCut(), geo::LiveGeometry::DistanceToEdgeInMC(), geo::LiveGeometry::DistToClosestBadRegion(), geo::LiveGeometry::DoWeEnterMC(), evd::HardwarePad::Draw(), evd::GeometryDrawer::DrawCells2D(), calib::SystematicUncertaintyScaleAna::endJob(), comi::CosmicMetrics::endJob(), comi::DataCheck::endJob(), calib::AttenFit::endJob(), calib::DCMTimingOffset::endJob(), calib::Calibrator::EnsureTimingCacheVldTime(), calib::AttenFit::expFit(), calib::AttenuationFit::expFit(), geo::LiveGeometry::FillBadBoxes(), dqsf::DQSpillFlags::FillCountVars(), meta::Metadata::FillMetadata(), calib::CosmicCalib::FillPathLengthInfo(), calib::MakeAttenuationProfiles::FillPathLengthInfo(), util::RemoveBeamSpills::filter(), util::RemoveBeamSpillsPrecise::filter(), comi::NumiFiltering::filter(), calib::MuondEdx::filter(), calib::MuonTrackHits::filter(), calib::MuondEdxAna::filter(), calib::AttenFit::fit_channel_prof(), calib::AttenuationFit::fit_channel_prof(), geo::LiveGeometry::FullNDProjectedCells(), calib::Calibrator::GetAdcPerPE(), calib::Calibrator::GetAttenCurve(), calib::Calibrator::GetAttenScale(), geo::LiveGeometry::GetBCInfo(), LSTME::SliceVars::getCoarseTiming(), evd::GeometryDrawer::GetDCMBoxes(), geo::LiveGeometry::GetDetectorEdges(), skim::ParametersNumu::GetDetectorEdges(), LSTME::SliceVars::getLowGain(), numusand::NumuSandFxs::getMissingE(), calib::Calibrator::GetPECorrToGeVScale(), GetPigtail(), photrans::ImprovedTransport::GetPosCorr(), geo::LiveGeometry::GetRHInfo(), calib::Calibrator::GetTimeRes(), calib::Calibrator::GetTimingOffset(), calib::Calibrator::GetTNS(), calib::ThresholdAna::GetView(), calib::CosmicCalib::GetView(), calib::MakeAttenuationProfiles::GetView(), calib::AttenFit::GetView(), calib::AttenuationFit::GetView(), calib::AttenCache::GetView(), chaninfo::BadChanList::InDroppedDCM(), mcdatadaq::Configuration::init(), qeef::QeFinder::Init(), remid::RecoMuon::Init(), slid::SPIDAlg::Initialize(), slid::LIDAlg::Initialize(), geo::LiveGeometry::InMuonCatcher(), geo::LiveGeometry::InstrumentedDetBack(), geo::LiveGeometry::InstrumentedDetEnds(), geo::LiveGeometry::InstrumentedDetFront(), geo::LiveGeometry::InstrumentedDetLength(), chaninfo::BadChanList::IsBadUncached(), calib::RockMuonStopperSelection::IsContainedStopper(), calib::StopperSelection::IsContainedStopper(), remid::RecoMuon::IsTrackContained(), filter::Filter::isVertexInFiducial(), evd::TZProjPad::LayoutHisto(), calib::AttenCache::LoadFromDatabase(), calib::AttenCache::LoadFromDatabaseUncalibratedMask(), chaninfo::BadChanList::LoadNewData(), calib::AttenFit::lowessFit(), calib::AttenuationFit::lowessFit(), calib::Calibrator::MakeCellHit(), evtsum::EventSummary::MakeOutput(), chaninfo::BadChanList::NBadInSubRun(), slicer::Slicer::NeighborSlice(), numue::NumuEAlg::NumuEAlg(), trk::CosmicTrackUtilities::PointInDetector(), calib::Calibrator::postBeginRun(), geo::Geometry::preBeginRun(), SliceLID::FillSliceLID::predict(), LSTME::FillLSTME::predictEnergy(), wsnumu::WSNumu::produce(), calib::ResizeDetector::produce(), calib::FiberCalibration::produce(), cosrej::CosRej::produce(), numue::NumuEnergy::produce(), calib::TimingCalibration::produce(), rwgt::MakeGENIEReweightTable::produce(), calib::DriftResponseCalc::produce(), slid::LIDBuilder::produce(), dqsf::DQSpillFlags::produce(), bpfit::BPFEnergyEstimator::produce(), remid::RecoMuon::produce(), bpfit::BPFPIdMaker::produce(), g4rwgt::MakeG4WeightTable::produce(), rsim::ReadoutSim::produce(), evgen::CosmicsGen::ProjectCosmicsToSurface(), geo::LiveGeometry::ProjectedAirDist(), geo::LiveGeometry::ProjectedCellsInMC(), geo::LiveGeometry::ProjectedDistanceInMC(), geo::LiveGeometry::ProjectedSteelDist(), evgen::CosmicsGen::ProjectMuonsToDetectorBigBox(), evgen::CosmicsGen::ProjectToSurface(), evd::RawDataDrawer::RawDigitHardware(), lem::GenFromLib::readNext(), cheat::BackTracker::Rebuild(), calib::AttenCache::RepresentativePlane(), calib::AttenFit::rolloffFit(), calib::AttenuationFit::rolloffFit(), LSTME::FillLSTME::selectModel(), geo::LiveGeometry::SetInstrumentation(), trk::KalmanGeoHelper::SetupHelper(), geo::LiveGeometry::SetupLiveGeo(), photrans::ImprovedTransport::StepAlongHit(), calib::Calibrator::SystematicUncertaintyScale(), calib::AttenCache::TranslateChannelData(), calib::AttenCache::TranslateChannelMC(), evd::TZProjPad::TZProjPad(), slid::NuEEnergyAlg::VertexEnergy(), rb::Cluster::W(), rb::Prong::W(), rb::Track::W(), calib::AttenuationFit::WriteDummyCSVRow(), calib::AttenuationFit::writeResults(), geo::LiveGeometry::XPositionAtTransition(), and geo::LiveGeometry::YPositionAtTransition().

243 { return fDetId; }
novadaq::cnv::DetId fDetId
id for the detector being used
Definition: GeometryBase.h:285
double geo::GeometryBase::DetLength ( ) const

Definition at line 481 of file GeometryBase.cxx.

References ana::assert(), fDetId, fDetLength, and novadaq::cnv::kUNKNOWN_DET.

Referenced by caf::AddCosmicTruthToVec(), caf::CAFMaker::AddMCTruthToVec(), fuzz::FuzzyKVertex::AddProng(), mcchk::CosmicAna::analyze(), mcchk::LeptonAna::analyze(), earms::ElasticArmsValidate::analyze(), mcchk::DetSimAna::analyze(), air::AirKalmanAna::analyze(), slid::LIDTraining::analyze(), trk::CosmicTrackAna::analyze(), mcchk::NeutrinoAna::AnalyzeNeutrinoInteraction(), mcchk::CosmicAna::beginRun(), mcchk::NeutrinoAna::beginRun(), numue::NumuEAna::beginRun(), mcchk::LeptonAna::beginRun(), geo::ClampRayToDetectorVolume(), bpfit::BreakPoint::ClampToDetector(), trk::KalmanTrackAna::Containment(), trk::KalmanGeoHelper::CountMissedCellsOnLine(), evd::Display3DPad::Draw(), evd::RecoBaseDrawer::DrawHoughResults2D(), calib::CosmicTrends::FillHistograms(), filter::Filter::FillTruthVariables(), trk::KalmanTrack::FilterTracker(), vdt::VertexDT::FindMinMax(), evgen::GENIENeutronOscGen::GENIENeutronOscGen(), evd::SliceNavigator::GetBounds(), evd::SliceNavigator::GetBox(), nuesand::FillNueSandbox::GetECF(), airshower::AirSlicer::GetHoughMap(), airshower::AirSlicer::GetHoughRhos(), hough::HoughValidate::HoughLineToDetector(), g4n::NeutronSubstitutionProcess::InsideDetector(), calib::RockMuonStopperSelection::IsContainedStopper(), comi::CosmicMetrics::IsEntering(), align::AlignInspect::IsGoodTrack(), align::Alignment::IsGoodTrack(), calib::RockMuonStopperSelection::IsTrulyContainedStopper(), calib::ThroughgoingSelection::IsTrulyUncontained(), calib::ThroughgoingSelection::IsUncontained(), evd::TZProjPad::LayoutHisto(), fuzz::ViewMatchAlg::Matching(), nerd::ViewMatchAlg::Matching(), numue::NumuEAlg::NumuEAlg(), cheat::TrackCheater::produce(), evgen::CosmicsGen::produce(), evgen::CosmicPionGen::produce(), earms::ElasticArmsHS::produce(), comi::Cana::produce(), evgen::GENIERockGen::produce(), vdt::VertexDT::produce(), crvtx::CosmicRayVertex::produce(), cheat::MCCheater::produce(), remid::RecoMuon::produce(), geo::LiveGeometry::ProjectedWall(), trk::RLFit::RLFit(), evd::TZProjPad::ShowFull(), evd::TZProjPad::ShowPartial(), numue::NumuEAna::TotalLengthInDetector(), cheat::RecoCheckAna::TotalLengthInDetector(), trk::KalmanTrackAna::TotalLengthInDetector(), and dt::Chain::ToTrack().

482  {
484  return fDetLength;
485  }
novadaq::cnv::DetId fDetId
id for the detector being used
Definition: GeometryBase.h:285
double fDetLength
Detector length (cm)
Definition: GeometryBase.h:299
assert(nhit_max >=nhit_nbins)
double geo::GeometryBase::DistToElectronics ( double  localz,
const CellGeo cell 
) const

get distance from local z position in cell to apd in cm, including pigtail

Return distance from a point in the cell to readout electronics, including pigtail

Parameters
localz: Z position in cm in local cell frame

Definition at line 1771 of file GeometryBase.cxx.

References GetPigtail(), geo::CellGeo::HalfL(), and geo::CellGeo::Id().

Referenced by calib::HitEfficiency::analyze(), jmshower::RecoJMShower::GetTrkHitPos(), calib::GetXYZD(), and slid::NuEEnergyAlg::VertexEnergy().

1772  {
1773  return (cell.HalfL() - localz + this->GetPigtail(cell.Id()));
1774  }
double GetPigtail(const CellUniqueId &id) const
Return length of fiber in cm from end of cell to apd.
std::string geo::GeometryBase::ExtractGDML ( ) const
std::string geo::GeometryBase::ExtractGDML ( std::string  fname,
bool  fullpath 
)
static

Extract contents from fname and return as a string.

Parameters
fullpathIf false, search for the file in FW_SEARCH_PATH

Definition at line 186 of file GeometryBase.cxx.

References FindGDMLFile(), make_syst_table_plots::line, and string.

187  {
189 
190  std::string gdmlInfo;
191 
192  std::ifstream geoFile(fname.c_str());
194 
195  if (geoFile.is_open()){
196  while (geoFile.good()){
197  getline(geoFile, line);
198  gdmlInfo += line;
199  gdmlInfo += '\n';
200  }
201  geoFile.close();
202  }
203 
204  return gdmlInfo;
205  }
static std::string FindGDMLFile(std::string fname)
Search for Geometry/gdml/fname in FW_SEARCH_PATH, return full path.
enum BeamMode string
void geo::GeometryBase::FiducialBox ( TVector3 &  r0,
TVector3 &  r1 
) const
std::string geo::GeometryBase::FileBaseName ( ) const

Method to extract gdml file basename and store as an std::string

Definition at line 307 of file GeometryBase.cxx.

References ana::assert(), fGDMLFile, and string.

Referenced by geo::GeometryTest::analyze(), util::StoreGDML::beginRun(), evgen::CosmicsGen::beginRun(), evgen::CosmicPionGen::beginRun(), supernova::SnovaGen::beginRun(), evgen::IsoGen::beginRun(), evgen::GENIERockGen::beginRun(), evgen::SupernovaGen::beginRun(), evgen::SingleGen::beginRun(), evgen::GENIEGen::beginRun(), evgen::CORSIKAGen::beginRun(), evgen::GENIENeutronOscGen::beginRun(), evgen::TextFileGen::beginRun(), and lem::GenFromLib::readNext().

307  {
308  assert(fGDMLFile.find(".gdml") != std::string::npos);
309 
310  // to find the base name of the file
311  // use string operations to find the last
312  // instance of "/" in the fROOTFile string
313  // and the last instance of ".", the base
314  // string should be between those
315  size_t lastSlash = fGDMLFile.find_last_of("/");
316  std::string almost = fGDMLFile.substr(lastSlash+1);
317 
318  // resize almost to drop the file ".gdml"
319  almost.resize(almost.length() - 5);
320 
321  return almost;
322  }// end of FileBaseName
std::string fGDMLFile
gdml file holding the geometry
Definition: GeometryBase.h:281
assert(nhit_max >=nhit_nbins)
enum BeamMode string
std::string geo::GeometryBase::FindGDMLFile ( std::string  fname)
staticprotected

Search for Geometry/gdml/fname in FW_SEARCH_PATH, return full path.

Definition at line 208 of file GeometryBase.cxx.

References cet::search_path::find_file(), runNovaSAM::ret, and string.

Referenced by ExtractGDML(), and geo::Geometry::preBeginRun().

209  {
210  cet::search_path sp("FW_SEARCH_PATH");
211  size_t lastSlash = fname.find_last_of("/");
212  std::string basename = fname.substr(lastSlash+1);
213 
214  fname = "Geometry/gdml/"+basename;
215 
217  if(!sp.find_file(fname, ret)){
218  throw cet::exception("FindGDMLFile")
219  << "cannot find GDML file " << fname << " bail ungracefully\n"
220  << __FILE__ << ":" << __LINE__ << "\n";
221  }
222  return ret;
223  }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
enum BeamMode string
void geo::GeometryBase::FindPlanes ( std::vector< const TGeoNode * > &  n,
unsigned int  depth,
bool  inMuonCatcher = false 
)
protected

Recursively search for planes in the geometry

Parameters
n- Array holding the path of nodes traversed
depth- Depth of the search to this point
inMuonCatcher- internal flag, recursed into the muon catcher?
Exceptions
geo::Exceptionis maximum depth is exceeded.

Definition at line 703 of file GeometryBase.cxx.

References MECModelEnuComparisons::i, MakePlane(), nd, Munits::nm, and registry_explorer::v.

Referenced by LoadGeometryFile().

706  {
707  const char* nm = n[depth]->GetName();
708  if (strncmp(nm,"vPlane", 6)==0) {
709  this->MakePlane(n, depth, inMuonCatcher);
710  return;
711  }
712 
713  if(strncmp(nm, "vBlockMuon", 10) == 0) inMuonCatcher = true;
714 
715  // Explore the next layer down
716  unsigned int deeper = depth+1;
717  if (deeper>=n.size()) {
718  throw cet::exception("BAD_NODE")
719  << "Exceeded maximum depth (" << n.size() << ") " << deeper << "\n"
720  << __FILE__ << ":" << __LINE__ << "\n";
721  }
722  const TGeoVolume* v = n[depth]->GetVolume();
723  int nd = v->GetNdaughters();
724  for (int i=0; i<nd; ++i) {
725  n[deeper] = v->GetNode(i);
726  this->FindPlanes(n, deeper, inMuonCatcher);
727  }
728  }// end of FindPlanes
void MakePlane(std::vector< const TGeoNode * > &n, unsigned int depth, bool inMuonCatcher)
static constexpr Double_t nm
Definition: Munits.h:133
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
void FindPlanes(std::vector< const TGeoNode * > &n, unsigned int depth, bool inMuonCatcher=false)
const unsigned int geo::GeometryBase::FirstPlaneInMuonCatcher ( ) const

Returns the index of the first plane contained in the muon catcher.

Or kPLANE_NOT_FOUND if there is no muon catcher

Definition at line 979 of file GeometryBase.cxx.

References ana::assert(), fPlanes, fPlanesInMuonCatcher, it, and geo::kPLANE_NOT_FOUND.

Referenced by LightLevels::analyze(), CerenkovResponse::analyze(), calib::SystematicUncertaintyScaleAna::endJob(), calib::AttenuationFit::expFit(), dqsf::DQSpillFlags::FillCountVars(), calib::MuondEdx::filter(), calib::MuonTrackHits::filter(), calib::MuondEdxAna::filter(), calib::AttenuationFit::fit_channel_prof(), calib::Calibrator::GetAttenCurve(), calib::ThresholdAna::GetView(), calib::CosmicCalib::GetView(), calib::MakeAttenuationProfiles::GetView(), calib::AttenFit::GetView(), calib::AttenuationFit::GetView(), calib::AttenCache::GetView(), remid::RecoMuon::IsTrackContained(), calib::AttenCache::LoadFromDatabase(), calib::AttenuationFit::lowessFit(), numue::NumuEAlg::NumuEAlg(), calib::AttenCache::RepresentativePlane(), calib::AttenuationFit::rolloffFit(), photrans::ImprovedTransport::StepAlongHit(), calib::Calibrator::SystematicUncertaintyScale(), calib::AttenCache::TranslateChannelMC(), calib::AttenuationFit::WriteDummyCSVRow(), and calib::AttenuationFit::writeResults().

980  {
981  if(fPlanesInMuonCatcher.empty()){
982  mf::LogWarning("GeometryBase") << "Requesting muon catcher info for a detector without one";
983  return kPLANE_NOT_FOUND;
984  }
985 
986  auto it = std::find(fPlanes.begin(), fPlanes.end(), fPlanesInMuonCatcher[0]);
987 
988  assert(it != fPlanes.end());
989  return it-fPlanes.begin();
990  }
set< int >::iterator it
std::vector< PlaneGeo * > fPlanes
The detector planes.
Definition: GeometryBase.h:291
std::vector< PlaneGeo * > fPlanesInMuonCatcher
Same pointers as fPlanes.
Definition: GeometryBase.h:292
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
assert(nhit_max >=nhit_nbins)
std::string geo::GeometryBase::GDMLFile ( ) const
inline

Definition at line 235 of file GeometryBase.h.

Referenced by geo::GeometryTest::analyze(), g4n::G4Alg::G4Alg(), and rawp::CheckDAQChannelMap::Reco().

235 { return fGDMLFile; }
std::string fGDMLFile
gdml file holding the geometry
Definition: GeometryBase.h:281
std::string geo::GeometryBase::GDMLFromFCL ( ) const
inline

Definition at line 237 of file GeometryBase.h.

References string.

237 { return fGDMLFromFCL; }
std::string fGDMLFromFCL
keep track of original fcl parameter
Definition: GeometryBase.h:283
int geo::GeometryBase::getCellID ( const CellUniqueId id) const

Definition at line 888 of file GeometryBase.cxx.

References geo::OfflineChan::Cell(), and getPlaneCellMap().

888  {
889  return getPlaneCellMap(id).Cell();
890  }
unsigned short Cell() const
Definition: OfflineChan.h:32
geo::OfflineChan getPlaneCellMap(const CellUniqueId &id) const
int geo::GeometryBase::getCellID ( const double &  x,
const double &  y,
const double &  z 
) const
inline

Definition at line 107 of file GeometryBase.h.

References getCellID().

Referenced by getCellID().

107 {return getCellID(CellId(x,y,z));}
const CellUniqueId CellId(const double &x, const double &y, const double &z, double dxds=0., double dyds=0., double dzds=1., double step=0.01) const
z
Definition: test.py:28
int getCellID(const CellUniqueId &id) const
CoordinateTransformation* geo::GeometryBase::getCoordinateTransformation ( ) const
inline

Definition at line 245 of file GeometryBase.h.

References plot_validation_datamc::fname, submit_nova_art::fullpath, and string.

Referenced by mcchk::NeutrinoAna::AnalyzeNeutrinoInteraction(), and geo::Geometry::getDirectionInBeamCoordinates().

245 { return (CoordinateTransformation*)&fCoordinateTransformation;}
CoordinateTransformation fCoordinateTransformation
Coordinate Transformation class.
Definition: GeometryBase.h:289
double geo::GeometryBase::GetPigtail ( const CellUniqueId id) const

Return length of fiber in cm from end of cell to apd.

Definition at line 1777 of file GeometryBase.cxx.

References DetId(), IdToCell(), IdToPlane(), novadaq::cnv::kTESTBEAM, geo::kY, and POTSpillRate::view.

Referenced by DistToElectronics(), photrans::PhotonTransport::produce(), jmshower::RecoJMShower::RecoShowers(), and photrans::ImprovedTransport::StepAlongHit().

1778  {
1779  int planeid,cellid;
1780  this->IdToCell(id, &planeid, &cellid);
1781  View_t view = (this->IdToPlane(id,&planeid))->View();
1782  //NOTE: Do we think 32 cells per module can ever change
1783  //This number can be found in DAQChannelMap but did not want to add that
1784  //dependency to geometry unless needed.
1785  const int kCellsPerModule = 32;
1786  cellid = cellid % kCellsPerModule;
1787  // In vertical planes, high cell numbers have longer fibres.
1788  // In horizontal planes it's the opposite, so flip it round.
1789  // For Test Beam, vertical planes actually follow the same pattern as
1790  // the horizontals, so flip both.
1791  if( view == geo::kY || this->DetId() == novadaq::cnv::kTESTBEAM ) cellid = kCellsPerModule-cellid-1;
1792  // This should really never happen, but just to be safe...
1793  if(cellid < 0 || cellid >= kCellsPerModule) return 100;
1794  // Email from Tom Chase 2011-04-29
1795  // NB: this isn't just a ~3.8cm change per cell. Every 8 cells something
1796  // different happens.
1797  const double kPigtails[kCellsPerModule] = {
1798  34.5738, 38.4379, 42.3020, 46.1660, 50.0301, 53.8942, 57.7582, 61.6223,
1799  64.7504, 68.6144, 72.4785, 76.3426, 80.2067, 84.0707, 87.9348, 91.0790,
1800  95.3301, 99.1941, 103.058, 106.922, 110.786, 114.650, 118.514, 122.379,
1801  125.507, 129.371, 133.235, 137.099, 140.963, 144.827, 148.691, 150.751
1802  };
1803  return kPigtails[cellid];
1804  }
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
const PlaneGeo * IdToPlane(const CellUniqueId &id, int *iplane) const
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
Definition: View.py:1
const CellGeo * IdToCell(const CellUniqueId &id, int *iplane, int *icell) const
bool geo::GeometryBase::getPlaneAndCellID ( const CellUniqueId id,
int plane,
int cell 
) const

Definition at line 892 of file GeometryBase.cxx.

References geo::OfflineChan::Cell(), getPlaneCellMap(), makeTrainCVSamples::int, and geo::OfflineChan::Plane().

892  {
893  const OfflineChan offline_chan = getPlaneCellMap(id);
894  plane = (int)offline_chan.Plane();
895  cell = (int)offline_chan.Cell();
896  return true;
897  }
geo::OfflineChan getPlaneCellMap(const CellUniqueId &id) const
bool geo::GeometryBase::getPlaneAndCellID ( const double &  x,
const double &  y,
const double &  z,
int plane,
int cell 
) const
inline

Definition at line 108 of file GeometryBase.h.

References getPlaneAndCellID(), ana::NuMIBeamDirection(), POTSpillRate::view, x1, X1, submit_syst::x2, X2, y1, Y1, submit_syst::y2, Y2, Z1, and Z2.

Referenced by getPlaneAndCellID().

108 {return getPlaneAndCellID(CellId(x,y,z), plane, cell);}
bool getPlaneAndCellID(const CellUniqueId &id, int &plane, int &cell) const
const CellUniqueId CellId(const double &x, const double &y, const double &z, double dxds=0., double dyds=0., double dzds=1., double step=0.01) const
z
Definition: test.py:28
OfflineChan geo::GeometryBase::getPlaneCellMap ( const CellUniqueId id) const
protected

Definition at line 899 of file GeometryBase.cxx.

References fIdMap.

Referenced by getCellID(), getPlaneAndCellID(), getPlaneID(), IdToCell(), and IdToPlane().

899  {
900 
901  UIDMap::const_iterator itr = fIdMap.find(id);
902  if (itr == fIdMap.end()) {
903  throw cet::exception("BAD_CELL_UNIQUE_ID")
904  << "CellUniqueId " << id << "\n"
905  << __FILE__ << ":" << __LINE__ << "\n";
906  }
907 
908  return itr->second;
909  }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
UIDMap fIdMap
Unique ID -> Plane,Cell.
Definition: GeometryBase.h:293
int geo::GeometryBase::getPlaneID ( const CellUniqueId id) const

Same as IdToCell and IdToPlane, but doesn't calculate CellGeo (PlaneGeo), just the global plane number or cell number

Definition at line 884 of file GeometryBase.cxx.

References getPlaneCellMap(), and geo::OfflineChan::Plane().

Referenced by fuzz::FuzzyKVertex::AddProng(), calib::MuondEdx::filter(), calib::MuonTrackHits::filter(), calib::MuondEdxAna::filter(), fuzz::ViewMatchAlg::Matching(), nerd::ViewMatchAlg::Matching(), slid::Recluster::produce(), jmshower::RecoJMShower::RecoShowers(), and slid::NuEEnergyAlg::VertexEnergy().

884  {
885  return getPlaneCellMap(id).Plane();
886  }
unsigned short Plane() const
Definition: OfflineChan.h:31
geo::OfflineChan getPlaneCellMap(const CellUniqueId &id) const
int geo::GeometryBase::getPlaneID ( const double &  x,
const double &  y,
const double &  z 
) const
inline

Definition at line 106 of file GeometryBase.h.

References getPlaneID().

Referenced by getPlaneID().

106 {return getPlaneID(CellId(x,y,z));}
int getPlaneID(const CellUniqueId &id) const
const CellUniqueId CellId(const double &x, const double &y, const double &z, double dxds=0., double dyds=0., double dzds=1., double step=0.01) const
z
Definition: test.py:28
const std::set< unsigned int > & geo::GeometryBase::GetPlanesByView ( View_t  v = kXorY) const

Return list of planes which measure the requested projection

Parameters
v: X/Y or All (see View_t typedef in PlaneGeo.h)
Returns
: a set of plane indices satisfying the request
Exceptions
geo::Exception if initialization fails

Definition at line 918 of file GeometryBase.cxx.

References fAllPlanes, fXplanes, fYplanes, geo::kX, and geo::kY.

Referenced by mcchk::CosmicAna::analyze(), htk::HoughTrack::analyze(), dprf::ChannelPlots::beginRun(), dprf::TrackPlots::beginRun(), mcchk::DetAna::beginRun(), calib::DriftResponseCalc::beginRun(), calib::CosmicTrends::beginRun(), calib::DriftResponseCalc::endRun(), rsim::RecordNoiseSpectrumFile::endSubRun(), LightLevels::endSubRun(), calib::AttenCache::RepresentativePlane(), chaninfo::BadChanList::SetRandomBadChannels(), geo::GeometryTest::testFindPlanes(), and dt::View::View().

918  {
919  // Return the user's choice, fall back on all planes
920  if (v==kX) return fXplanes;
921  else if (v==kY) return fYplanes;
922  return fAllPlanes;
923  }// end of GetPlanesByView
Vertical planes which measure X.
Definition: PlaneGeo.h:28
std::set< unsigned int > fAllPlanes
List of all planes.
Definition: GeometryBase.h:295
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
std::set< unsigned int > fYplanes
List of Y measuring planes.
Definition: GeometryBase.h:297
std::set< unsigned int > fXplanes
List of X measuring planes.
Definition: GeometryBase.h:296
const CellGeo * geo::GeometryBase::IdToCell ( const CellUniqueId id,
int iplane,
int icell 
) const

Given a unique cell identifier, look up the plane and cell numbers.

Parameters
id: Cell identifier
iplane: pointer to return plane number
icell: pointer to return cell number
Returns
cell geometry description
Exceptions
geo::Exceptionif id is not found

Definition at line 859 of file GeometryBase.cxx.

References geo::OfflineChan::Cell(), geo::PlaneGeo::Cell(), getPlaneCellMap(), makeTrainCVSamples::int, geo::OfflineChan::Plane(), and Plane().

Referenced by CountCellsOnLine(), CurrentCell(), GetPigtail(), photrans::ImprovedTransport::GetPosCorr(), g4n::FLSHitListAction::SteppingAction(), geo::GeometryTest::testUniqueId(), and lem::VertexToPlaneAndCell().

861  {
862  const OfflineChan offline_chan = getPlaneCellMap(id);
863  *iplane = (int)offline_chan.Plane();
864  *icell = (int)offline_chan.Cell();
865  return this->Plane(*iplane)->Cell(*icell);
866  }// end of IdToCell
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
const PlaneGeo * Plane(unsigned int i) const
geo::OfflineChan getPlaneCellMap(const CellUniqueId &id) const
const PlaneGeo * geo::GeometryBase::IdToPlane ( const CellUniqueId id,
int iplane 
) const

Given a unique cell identifier, look up the plane number.

Parameters
id: Cell identifier
iplane: optional, pointer to return plane number
Returns
Plane geometry description
Exceptions
geo::Exceptionif id is not found

Definition at line 879 of file GeometryBase.cxx.

References getPlaneCellMap(), geo::OfflineChan::Plane(), and Plane().

Referenced by GetPigtail(), and trk::KalmanGeoHelper::MatchTrajectoryToPlane().

879  {
880  *iplane = getPlaneCellMap(id).Plane();
881  return this->Plane(*iplane);
882  }// end of IdToCell
const PlaneGeo * Plane(unsigned int i) const
unsigned short Plane() const
Definition: OfflineChan.h:31
geo::OfflineChan getPlaneCellMap(const CellUniqueId &id) const
bool geo::GeometryBase::IntersectsBigBox ( double *  xyz_cm,
double *  dxyz 
) const

Definition at line 682 of file GeometryBase.cxx.

References fDetectorBigBoxXHi, fDetectorBigBoxXLo, fDetectorBigBoxYHi, fDetectorBigBoxYLo, fDetectorBigBoxZHi, fDetectorBigBoxZLo, and geo::IntersectsBox().

682  {
683  return geo::IntersectsBox(xyz, dxyz,
687  }// end of IntersectsBigBox
bool IntersectsBox(const double xyz[], const double dxyz[], double xlo, double xhi, double ylo, double yhi, double zlo, double zhi)
Determine if a particle starting at xyz with direction dxyz will intersect a box defined by xlo...
Definition: Geo.cxx:97
double fDetectorBigBoxXHi
Dimensions of the DetectorBigBox in cm.
Definition: GeometryBase.h:314
double fDetectorBigBoxZHi
Definition: GeometryBase.h:318
double fDetectorBigBoxXLo
Definition: GeometryBase.h:315
double fDetectorBigBoxYLo
Definition: GeometryBase.h:317
double fDetectorBigBoxZLo
Definition: GeometryBase.h:319
double fDetectorBigBoxYHi
Definition: GeometryBase.h:316
bool geo::GeometryBase::IntersectsDetector ( double *  xyz_cm,
double *  dxyz 
) const

Definition at line 674 of file GeometryBase.cxx.

References fDetHalfHeight, fDetHalfWidth, fDetLength, and geo::IntersectsBox().

Referenced by crvtx::CosmicRayVertex::produce().

674  {
675  return geo::IntersectsBox(xyz, dxyz,
678  0., fDetLength);
679  }// end of IntersectsDetector
bool IntersectsBox(const double xyz[], const double dxyz[], double xlo, double xhi, double ylo, double yhi, double zlo, double zhi)
Determine if a particle starting at xyz with direction dxyz will intersect a box defined by xlo...
Definition: Geo.cxx:97
double fDetLength
Detector length (cm)
Definition: GeometryBase.h:299
double fDetHalfHeight
Detector 1/2 height (cm)
Definition: GeometryBase.h:300
double fDetHalfWidth
Detector 1/2 width (cm)
Definition: GeometryBase.h:301
bool geo::GeometryBase::IsActive ( const TGeoMaterial *  m) const

Is the material m an active or passive material?

Definition at line 453 of file GeometryBase.cxx.

References string.

Referenced by bpfit::Path::FindLayers().

453  {
454  const std::string scint = "Scintillator";
455  if (scint == m->GetName()) return true;
456  return false;
457  }
Definition: scint.py:1
enum BeamMode string
bool geo::GeometryBase::isDetectorBigBoxUsed ( ) const
inline

Do we use the Detector Big Box.

Definition at line 190 of file GeometryBase.h.

References geo::ClosestApproach(), dir, dx, dy, CLHEP::m, plot_validation_datamc::p1, plot_validation_datamc::p2, fillBadChanDBTables::step, w, submit_syst::x, submit_syst::y, and test::z.

Referenced by g4n::FLSHitListAction::SteppingAction().

190 {return fIsDetectorBigBoxUsed;}
bool fIsDetectorBigBoxUsed
Do we need to use the BigBox cut?
Definition: GeometryBase.h:310
bool geo::GeometryBase::isInsideDetectorBigBox ( const double  x_cm,
const double  y_cm,
const double  z_cm 
) const

Is the particle inside the detector Big Box?

Definition at line 1371 of file GeometryBase.cxx.

References fDetectorBigBoxXLo, fDetectorBigBoxYLo, and fDetectorBigBoxZLo.

Referenced by nuesand::FillNueSandbox::FillTruthVars(), cheat::BackTracker::InterceptsDetector(), g4n::ParticleListAction::PostTrackingAction(), rwgt::MakeGENIEReweightTable::produce(), RockFilter_A(), RockFilter_B(), RockFilter_C(), RockFilter_D(), g4n::ParticleListAction::SteppingAction(), and g4n::FLSHitListAction::SteppingAction().

1371  {
1372  if( x < fDetectorBigBoxXHi && x > fDetectorBigBoxXLo &&
1373  y < fDetectorBigBoxYHi && y > fDetectorBigBoxYLo &&
1374  z < fDetectorBigBoxZHi && z > fDetectorBigBoxZLo)
1375  return true;
1376  return false;
1377  }// end of GeometryBase::isInsideDetectorBigBox
double fDetectorBigBoxXLo
Definition: GeometryBase.h:315
double fDetectorBigBoxYLo
Definition: GeometryBase.h:317
double fDetectorBigBoxZLo
Definition: GeometryBase.h:319
bool geo::GeometryBase::isInsideFiducialVolume ( const double  x_cm,
const double  y_cm,
const double  z_cm 
) const

Is the particle inside the detector Fiducial Volume?

Is the particle inside the fiducial volume?

Parameters
x_cm: x coordinate in cm
y_cm: y coordinate in cm
z_cm: z coordinate in cm

Definition at line 1389 of file GeometryBase.cxx.

References fFiducialVolumeXLo, fFiducialVolumeYLo, and fFiducialVolumeZLo.

Referenced by calculateMassesLong(), filter::Filter::FillTruthVariables(), bsf::BremShowerFilter::findShowerByTruth(), isInsideFiducialVolume(), nuesand::FillNueSandbox::produce(), presel::NuePresel::produce(), and lem::Preselection::produce().

1389  {
1390 
1391  return (x_cm < fFiducialVolumeXHi && x_cm > fFiducialVolumeXLo &&
1392  y_cm < fFiducialVolumeYHi && y_cm > fFiducialVolumeYLo &&
1393  z_cm < fFiducialVolumeZHi && z_cm > fFiducialVolumeZLo);
1394  }// end of GeometryBase::isInsideFiducialVolume
double fFiducialVolumeZLo
Definition: GeometryBase.h:328
double fFiducialVolumeXLo
Definition: GeometryBase.h:324
double fFiducialVolumeYLo
Definition: GeometryBase.h:326
bool geo::GeometryBase::isInsideFiducialVolume ( const double *  xyz) const

Is the particle inside the fiducial volume?

Parameters
xyz: pointer to array holding xyz in world coordinates

Definition at line 1402 of file GeometryBase.cxx.

References CLHEP::cm, and isInsideFiducialVolume().

1402  {
1403 
1404  return isInsideFiducialVolume(xyz[0]/CLHEP::cm,
1405  xyz[1]/CLHEP::cm,
1406  xyz[2]/CLHEP::cm);
1407  }// end of GeometryBase::isInsideFiducialVolume
static constexpr double cm
Definition: SystemOfUnits.h:99
bool isInsideFiducialVolume(const double x_cm, const double y_cm, const double z_cm) const
Is the particle inside the detector Fiducial Volume?
bool geo::GeometryBase::LoadGeometryFile ( std::string  gdmlfile,
novadaq::cnv::DetId  detId = novadaq::cnv::kUNKNOWN_DET 
)
protected

In case of unknown ID, guesses from the filename.

Method to load detector geometry file

Definition at line 229 of file GeometryBase.cxx.

References BuildMaps(), geo::CellGeo::clear(), fBigBoxRange, fDetectorBigBoxXHi, fDetectorBigBoxXLo, fDetectorBigBoxYHi, fDetectorBigBoxYLo, fDetectorBigBoxZHi, fDetectorBigBoxZLo, fDetHalfHeight, fDetHalfWidth, fDetLength, fIdMap, FindPlanes(), fIsDetectorBigBoxUsed, fPlanes, fPlanesInMuonCatcher, MECModelEnuComparisons::i, novadaq::cnv::kFARDET, novadaq::cnv::kNDOS, novadaq::cnv::kNEARDET, novadaq::cnv::kTESTBEAM, novadaq::cnv::kUNKNOWN_DET, getGoodRuns4SAM::n, geo::plane_sort(), setDetectorBigBox(), setDetectorID(), SetDetectorSize(), and SetDrawOptions().

Referenced by GeometryBase(), and geo::Geometry::preBeginRun().

230  {
231 
232  int old_verbosity = gGeoManager->GetVerboseLevel();
233 
234  // TGeoManager is too verbose when loading geometry.
235  // Make it quiet.
236  gGeoManager->SetVerboseLevel(0);
237 
238  // Open the GDML file
239  struct stat sb;
240  if (gdmlfile.empty() || stat(gdmlfile.c_str(), &sb)!=0) {
241  // failed to resolve the file name
242  throw cet::exception("GeometryFileLoad")
243  << "empty GDML string " << gdmlfile << " bail ungracefully\n"
244  << __FILE__ << ":" << __LINE__ << "\n";
245  }
246  // clear the plane array and id map
247  for (unsigned int i=0; i<fPlanes.size(); ++i) {
248  if (fPlanes[i]) { delete fPlanes[i]; fPlanes[i] = 0; }
249  }
250  fPlanes.clear();
251  fPlanesInMuonCatcher.clear();
252  fIdMap.clear();
253  CellGeo::clear();
254 
255  TGeoManager::Import(gdmlfile.c_str());
256 
257  this->SetDrawOptions();
258 
259  std::vector<const TGeoNode*> n(16);
260  n[0] = gGeoManager->GetTopNode();
261  this->FindPlanes(n, 0);
262  sort(fPlanes.begin(), fPlanes.end(), plane_sort);
264 
265  this->SetDetectorSize();
266  this->BuildMaps();
267 
269  // have to set the fDetId based on the input file then
270  if( gdmlfile.find("ndos") != std::string::npos) detId = novadaq::cnv::kNDOS;
271  else if(gdmlfile.find("near") != std::string::npos) detId = novadaq::cnv::kNEARDET;
272  else if(gdmlfile.find("far") != std::string::npos) detId = novadaq::cnv::kFARDET;
273  else if(gdmlfile.find("testbeam-1x1-2block") != std::string::npos) detId = novadaq::cnv::kTESTBEAM;
274  else if(gdmlfile.find("testbeam-1x1-3block") != std::string::npos) detId = novadaq::cnv::kTESTBEAM;
275  else if(gdmlfile.find("testbeam-2x2-2block") != std::string::npos) detId = novadaq::cnv::kTESTBEAM;
276  else if(gdmlfile.find("testbeam-2x2-3block") != std::string::npos) detId = novadaq::cnv::kTESTBEAM;
277  }
279 
282  else{
288  fDetectorBigBoxZLo = 0.;
289  }
290 
291  mf::LogInfo("LoadGeometryFile")
292  << "Detector geometry loaded from " << gdmlfile;
293 
294 
295  // Restore verbosity level before we leave because
296  // we have to be polite and listen
297  gGeoManager->SetVerboseLevel(old_verbosity);
298 
299  return true;
300  }// end of LoadGeometryFile
double fDetectorBigBoxXHi
Dimensions of the DetectorBigBox in cm.
Definition: GeometryBase.h:314
double fDetLength
Detector length (cm)
Definition: GeometryBase.h:299
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
bool fIsDetectorBigBoxUsed
Do we need to use the BigBox cut?
Definition: GeometryBase.h:310
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
double fDetHalfHeight
Detector 1/2 height (cm)
Definition: GeometryBase.h:300
std::vector< PlaneGeo * > fPlanes
The detector planes.
Definition: GeometryBase.h:291
double fDetHalfWidth
Detector 1/2 width (cm)
Definition: GeometryBase.h:301
Far Detector at Ash River, MN.
Prototype Near Detector on the surface at FNAL.
UIDMap fIdMap
Unique ID -> Plane,Cell.
Definition: GeometryBase.h:293
void setDetectorBigBox(double detector_bigbox_range)
double fDetectorBigBoxZHi
Definition: GeometryBase.h:318
Near Detector in the NuMI cavern.
double fDetectorBigBoxXLo
Definition: GeometryBase.h:315
double fDetectorBigBoxYLo
Definition: GeometryBase.h:317
double fBigBoxRange
Range of big box.
Definition: GeometryBase.h:311
static bool plane_sort(const PlaneGeo *p1, const PlaneGeo *p2)
void FindPlanes(std::vector< const TGeoNode * > &n, unsigned int depth, bool inMuonCatcher=false)
std::vector< PlaneGeo * > fPlanesInMuonCatcher
Same pointers as fPlanes.
Definition: GeometryBase.h:292
double fDetectorBigBoxZLo
Definition: GeometryBase.h:319
static void clear()
Definition: CellGeo.h:57
double fDetectorBigBoxYHi
Definition: GeometryBase.h:316
virtual void setDetectorID(novadaq::cnv::DetId)
Method to set DetectorID.
void geo::GeometryBase::MakePlane ( std::vector< const TGeoNode * > &  n,
unsigned int  depth,
bool  inMuonCatcher 
)
protected

Definition at line 731 of file GeometryBase.cxx.

References fPlanes, and fPlanesInMuonCatcher.

Referenced by FindPlanes().

734  {
735  fPlanes.push_back(new PlaneGeo(n, depth));
736 
737  if(inMuonCatcher) fPlanesInMuonCatcher.push_back(fPlanes.back());
738  }
std::vector< PlaneGeo * > fPlanes
The detector planes.
Definition: GeometryBase.h:291
std::vector< PlaneGeo * > fPlanesInMuonCatcher
Same pointers as fPlanes.
Definition: GeometryBase.h:292
int geo::GeometryBase::MakeTmpFile ( std::string  gdmlInfo)
protected

Method to make a temporary file holding Detector geometry (gdml) file

Definition at line 102 of file GeometryBase.cxx.

References om::cerr, allTimeWatchdog::endl, fclose(), fGDMLFile, fParams, geo::GeometryBase::Params::StoreTempGeo, string, and tmp.

Referenced by geo::Geometry::preBeginRun().

103  {
104  int fStat = -1; //file status variable, -1 indicates error
105  FILE *tmpFile; //file variable
106 
107  //hold temporary gdml file name
108  std::string tmpFileName;
109 
110  //Use mkstemp to make a temporary file, mkstemp takes in a template
111  //character array as an argument. The last 6 characters must be XXXXXX
112  //mkstemp will then attempt to open a file with that template and the
113  //last 6 characters will be changed to be unique. If the file cannot
114  //be successfully opened an error code will be returned.
115  //If a file is properly opened it will be unique. File is set to be
116  //opened in /temp.
117  char tmp[256];
118  sprintf(tmp,"%s/TEMP_GEO_GDML_XXXXXX", fParams.StoreTempGeo().c_str());
119  //check to see if file opens properly
120  if ( ((fStat = mkstemp(tmp)) == -1) ||
121  ((tmpFile = fopen(tmp, "w+")) == NULL) ) {
122 
123  if (fStat != -1){
124  fclose(tmpFile);
125  remove(tmp);
126  std::cerr<<"Error making temporary file "
127  <<tmp<<std::endl;
128  }
129  //if file could not be created properly exit and return -1
130  std::cerr<<"Failed to produce temporary geometry file"<<std::endl;
131  return -1;
132  }
133 
134  //this means a unique file has been properly created and opened
135  fclose(tmpFile); //properly close file
136 
137  //add temp file name to string with proper .gdml extension
138  tmpFileName += tmp;
139  tmpFileName += ".gdml";
140 
141  //now attempt to open new file with .gdml extension
142  FILE *gdmlFile;
143  gdmlFile = fopen(tmpFileName.c_str(), "w+");
144  if (gdmlFile == NULL){
145  //file was not opened properly, remove temp files
146  //and exit with a status -1
147  remove(tmp);
148  remove(tmpFileName.c_str());
149  std::cerr<<"Error making temporary file "
150  <<tmpFileName<<std::endl;
151  return -1;
152  }
153 
154  //temporary gdml file was properly opened, now put our gdml info in file
155  fputs (gdmlInfo.c_str(), gdmlFile);
156 
157  //now remove initial temp file without the .gdml extension
158  remove(tmp);
159 
160  //close temporary gdml file
161  fclose(gdmlFile);
162 
163  //now store name of temporary gdml file in GDMLFile
164  //this way the temp file can also be accessed by GEANT4,
165  //which loads the geometry directly
166  fGDMLFile = tmpFileName;
167 
168  //return 0 indicating successful temporary file creation
169  return 0;
170  }
std::string fGDMLFile
gdml file holding the geometry
Definition: GeometryBase.h:281
OStream cerr
Definition: OStream.cxx:7
Float_t tmp
Definition: plot.C:36
fclose(fg1)
Atom< std::string > StoreTempGeo
Definition: GeometryBase.h:72
enum BeamMode string
double geo::GeometryBase::MassBetweenPoints ( double *  p1,
double *  p2 
) const

Return the column density between 2 points in gm/cm^2

Parameters
p1: pointer to array holding xyz of first point in world coordinates
p2: pointer to array holding xyz of second point in world coordinates

Definition at line 1155 of file GeometryBase.cxx.

References E, demo0::length, MaterialsBetweenPoints(), file_size_ana::node, and util::pythag().

1156  {
1157  // The purpose of this method is to determine the column density
1158  // between the two points given. Do that by starting at p1 and
1159  // stepping until you get to the node of p2. calculate the distance
1160  // between the point just inside that node and p2 to get the last
1161  // bit of column density
1162  double columnD = 0.;
1163 
1164  // first initialize a track - get the direction cosines
1165  double length = util::pythag(p2[0]-p1[0],
1166  p2[1]-p1[1],
1167  p2[2]-p1[2]);
1168  double dxyz[3] = {(p2[0]-p1[0])/length,
1169  (p2[1]-p1[1])/length,
1170  (p2[2]-p1[2])/length};
1171 
1172  gGeoManager->InitTrack(p1,dxyz);
1173  gGeoManager->FindNextBoundary(1.E-6);
1174 
1175  // might be helpful to have a point to a TGeoNode
1176  TGeoNode *node = gGeoManager->GetCurrentNode();
1177 
1178  // check that the points are not in the same volume already.
1179  // if they are in different volumes, keep stepping until you
1180  // are in the same volume as the second point
1181  while(!gGeoManager->IsSameLocation(p2[0], p2[1], p2[2])){
1182  gGeoManager->FindNextBoundary();
1183 
1184  columnD +=
1185  gGeoManager->GetStep() *
1186  node->GetMedium()->GetMaterial()->GetDensity();
1187 
1188  // the act of stepping puts you in the next node and returns that
1189  // node
1190  node = gGeoManager->Step();
1191  } //end loop to get to volume of second point
1192 
1193  // now you are in the same volume as the last point, but not at that
1194  // point. get the distance between the current point and the last
1195  // one
1196  const double *current = gGeoManager->GetCurrentPoint();
1197  length = util::pythag(p2[0]-current[0],
1198  p2[1]-current[1],
1199  p2[2]-current[2]);
1200  columnD += length*node->GetMedium()->GetMaterial()->GetDensity();
1201 
1202  return columnD;
1203  }// end of MassBetweenPoints
length
Definition: demo0.py:21
Float_t E
Definition: plot.C:20
double pythag(double x, double y)
2D Euclidean distance
Definition: MathUtil.h:29
TGeoMaterial * geo::GeometryBase::Material ( double  x,
double  y,
double  z 
) const

Method to obtain current detector material at given (x,y,z) coordinates

Definition at line 444 of file GeometryBase.cxx.

References file_size_ana::node.

Referenced by calculateMassesLong(), and calib::EnergyStandardCandles::FillTrueMichelInfo().

444  {
445  const TGeoNode* node = gGeoManager->FindNode(x,y,z);
446  return node->GetMedium()->GetMaterial();
447  }// end of Material
z
Definition: test.py:28
void geo::GeometryBase::MaterialsBetweenPoints ( const double *  p1,
const double *  p2,
std::vector< double > &  ds,
std::vector< const TGeoMaterial * > &  mat 
) const

Definition at line 1208 of file GeometryBase.cxx.

References om::cerr, d, E, e, allTimeWatchdog::endl, file_size_ana::node, make_associated_cosmic_defs::p3, util::pythag(), and fillBadChanDBTables::step.

Referenced by calib::EnergyStandardCandles::FillTrueMichelInfo(), bpfit::Path::FindLayers(), bpfit::Path::IntegrateLeg(), MassBetweenPoints(), MaterialsBetweenPoints(), and geo::LiveGeometry::ProjectedSteelDist().

1212  {
1213  double d[3], dmag;
1214  dmag = util::pythag(p2[0]-p1[0],p2[1]-p1[1],p2[2]-p1[2]);
1215  d[0] = (p2[0]-p1[0])/dmag;
1216  d[1] = (p2[1]-p1[1])/dmag;
1217  d[2] = (p2[2]-p1[2])/dmag;
1218 
1219  gGeoManager->InitTrack(p1,d);
1220  gGeoManager->FindNextBoundary(1.E-6);
1221  TGeoNode *node = gGeoManager->GetCurrentNode();
1222 
1223  while (!gGeoManager->IsSameLocation(p2[0], p2[1], p2[2])) {
1224  gGeoManager->FindNextBoundary();
1225 
1226  // If we take a step and haven't gone anywhere, then we will be
1227  // stuck in a very long loop. So we will quit if the next step
1228  // takes us nowhere.
1229  double step = gGeoManager->GetStep();
1230  if(step < 1.0e-12) break;
1231 
1232  ds.push_back(step);
1233  m.push_back(node->GetMedium()->GetMaterial());
1234 
1235  node = gGeoManager->Step();
1236  if (node==0) {
1237  std::cerr << __FILE__ << ":" << __LINE__
1238  << " Cannot continue tracking MaterialsBetweenPoints(). "
1239  << "Null node pointer." << std::endl;
1240  return;
1241  }
1242  }
1243  //
1244  // Handle final step by hand
1245  //
1246  const double* p3 = gGeoManager->GetCurrentPoint();
1247  ds.push_back(util::pythag(p3[0]-p2[0],p3[1]-p2[1],p3[2]-p2[2]));
1248  m.push_back(node->GetMedium()->GetMaterial());
1249  }
OStream cerr
Definition: OStream.cxx:7
Float_t E
Definition: plot.C:20
Float_t d
Definition: plot.C:236
A very simple service to remember what detector we&#39;re working in.
double pythag(double x, double y)
2D Euclidean distance
Definition: MathUtil.h:29
Float_t e
Definition: plot.C:35
void geo::GeometryBase::MaterialsBetweenPoints ( TVector3  v1,
TVector3  v2,
std::vector< double > &  ds,
std::vector< const TGeoMaterial * > &  m 
) const

Overloaded MaterialsBetweenPoints to for using TVector3 instead of arrays because rb::Track trajectory points are TVector3 and there is a desire to track a 'track' through the geometry. This will make that easier. Function is really just a wrapper around the array version

Definition at line 1258 of file GeometryBase.cxx.

References MaterialsBetweenPoints().

1262  {
1263  double p1[3], p2[3];
1264  v1.GetXYZ(p1);
1265  v2.GetXYZ(p2);
1266 
1267  MaterialsBetweenPoints(p1, p2, ds, m);
1268  }
void MaterialsBetweenPoints(const double *p1, const double *p2, std::vector< double > &ds, std::vector< const TGeoMaterial * > &mat) const
A very simple service to remember what detector we&#39;re working in.
const unsigned int geo::GeometryBase::NextPlaneInView ( unsigned int  p1,
int  d = +1 
) const

Return the index of the next plane in a particular view

Parameters
p1: Index of current plane
d: Direction to step in (>0 next down stream, <0 upstream)
Returns
Index of next plane in same view. If no plane can be found (eg. reach end of detector) return kPLANE_NOT_FOUND.
Exceptions
Asserts that p1 is in valid range

Definition at line 936 of file GeometryBase.cxx.

References ana::assert(), fPlanes, geo::kPLANE_NOT_FOUND, and plot_validation_datamc::p2.

Referenced by chaninfo::CosmicEff::analyze(), trk::KalmanTrack::FilterTracker(), calib::HasZAdjacents(), and geo::GeometryTest::testFindPlanes().

936  {
937  assert(p1<fPlanes.size());
938 
939  // March along from p1 in the direction d until we find a match
940  int s = (d>0 ? 1 : -1);
941  if (s<0 && p1==0) return kPLANE_NOT_FOUND;
942  if (s>0 && p1==fPlanes.size()-1) return kPLANE_NOT_FOUND;
943  for (unsigned int p2=p1+s; 1; p2+=s) {
944  if (fPlanes[p1]->View() == fPlanes[p2]->View()) return p2;
945  if (p2==fPlanes.size()-1) return kPLANE_NOT_FOUND;
946  if (p2==0) return kPLANE_NOT_FOUND;
947  }
948  }// end of NextPlaneInView
std::vector< PlaneGeo * > fPlanes
The detector planes.
Definition: GeometryBase.h:291
const XML_Char * s
Definition: expat.h:262
Float_t d
Definition: plot.C:236
Definition: View.py:1
assert(nhit_max >=nhit_nbins)
const unsigned int geo::GeometryBase::NextPlaneOtherView ( unsigned int  p1,
int  d = +1 
) const

Return the index of the next plane in a particular view

Parameters
p1: Index of current plane
d: Direction to step in (>0 next down stream, <0 upstream)
Returns
index of next plane in same view.
Exceptions
Asserts that p1 is in valid range

Definition at line 960 of file GeometryBase.cxx.

References ana::assert(), fPlanes, geo::kPLANE_NOT_FOUND, and plot_validation_datamc::p2.

Referenced by fuzz::ViewMatchAlg::Matching(), nerd::ViewMatchAlg::Matching(), lem::FindLEMMatches::MatchToVertex(), lem::LEM::MatchToVertex(), trk::KalmanGeoHelper::MatchTrajectoryToPlaneInView(), calib::AttenCache::RepresentativePlane(), geo::GeometryTest::testFindPlanes(), and lem::VertexToPlaneAndCell().

961  {
962  assert(p1<fPlanes.size());
963 
964  // March along from p1 in the direction d until we find a match
965  int s = (d>0 ? 1 : -1);
966  if (s<0 && p1==0) return kPLANE_NOT_FOUND;
967  if (s>0 && p1==fPlanes.size()-1) return kPLANE_NOT_FOUND;
968  for (unsigned int p2=p1+s; 1; p2+=s) {
969  if (fPlanes[p1]->View() != fPlanes[p2]->View()) return p2;
970  if (p2==fPlanes.size()) return kPLANE_NOT_FOUND;
971  if (p2==0) return kPLANE_NOT_FOUND;
972  }
973  }// end of NextPlaneOtherView
std::vector< PlaneGeo * > fPlanes
The detector planes.
Definition: GeometryBase.h:291
const XML_Char * s
Definition: expat.h:262
Float_t d
Definition: plot.C:236
Definition: View.py:1
assert(nhit_max >=nhit_nbins)
unsigned int geo::GeometryBase::NPlanes ( ) const

Definition at line 460 of file GeometryBase.cxx.

References ana::assert(), fDetId, fPlanes, and novadaq::cnv::kUNKNOWN_DET.

Referenced by align::Alignment::analyze(), chaninfo::BadChanValidate::BadChansFromDB(), chaninfo::CosmicEff::beginRun(), dprf::ChannelPlots::beginRun(), dprf::TrackPlots::beginRun(), calib::HitEfficiency::beginRun(), rsim::ReadoutSim::beginRun(), calib::CosmicTrends::beginRun(), chaninfo::BadChanValidate::beginSubRun(), noe::build_cell_lookup_table(), CellInfo(), CellTpos(), trk::KalmanGeoHelper::CountMissedCellsOnLine(), LightLevels::CreateHistos(), rsim::ReadoutSim::CreateRawDigits(), lem::DefaultVertex(), evd::GeometryDrawer::DrawCells2D(), chaninfo::CosmicEff::endJob(), calib::AttenFit::endJob(), comi::ChanOcc::endSubRun(), rsim::IFPGAAlgorithm::FetchThresholds(), trk::KalmanGeoHelper::fillprivategeo(), trk::CosmicTrackUtilities::FindZBoundaries(), calib::FindZBoundaries(), evd::GeometryDrawer::GetBox(), evd::GeometryDrawer::GetDCMBoxes(), airshower::AirSlicer::GetHoughMap(), airshower::AirSlicer::GetHoughRhos(), calib::GetXYZD(), dt::DiscreteTracker::HighActivity(), calib::RockMuonStopperSelection::IsContainedStopper(), photrans::ImprovedTransport::LoadHistos(), chaninfo::BadChanList::LoadNewData(), lem::FindLEMMatches::MatchToVertex(), lem::LEM::MatchToVertex(), skim::ParametersNumu::ParametersNumu(), chaninfo::BadChanList::preBeginEvent(), trk::KalmanTrack::produce(), lem::AlignLibToVtx::produce(), cvn::RegCVNMapper::produce(), rsim::ReadoutSim::produce(), evd::RawDataDrawer::RawDigit2D(), lem::GenFromLib::readNext(), trk::KalmanGeoHelper::SetupHelper(), geo::GeometryTest::testCellId(), geo::GeometryTest::testCellIdFromPos(), dt::View::View(), and calib::AttenuationFit::writeResults().

461  {
463  return fPlanes.size();
464  }
novadaq::cnv::DetId fDetId
id for the detector being used
Definition: GeometryBase.h:285
std::vector< PlaneGeo * > fPlanes
The detector planes.
Definition: GeometryBase.h:291
assert(nhit_max >=nhit_nbins)
TVector3 geo::GeometryBase::NuMIBeamDirection ( ) const

Direction of neutrinos from the NuMI beam (unit vector)

Because of the varying location of pion decays in the decay pipe, this can only be an average value in the ND and NDOS.

Definition at line 523 of file GeometryBase.cxx.

References e, fDetId, novadaq::cnv::kFARDET, novadaq::cnv::kNDOS, novadaq::cnv::kNEARDET, and novadaq::cnv::kTESTBEAM.

Referenced by cvn::CVNEventProngDump::analyze(), comi::NearlineAna::analyze(), slid::LIDTraining::analyze(), cosrej::CosRejFxs::getAngle(), numusand::NumuSandFxs::getAngle(), nuesand::FillNueSandbox::GetTrackAngle(), numue::NumuEAlg::NumuEAlg(), nussand::FillNusSandbox::produce(), slid::SliceLIDBuilder::produce(), cosrej::CosRej::produce(), comi::Cana::produce(), slid::LIDBuilder::produce(), jmshower::NueSel::produce(), slid::SPIDBuilder::produce(), jmshower::NueSelLID::produce(), cvn::CVNAddTrainingData::produce(), cosrej::MakeNueCosRej::produce(), jmshower::RecoJMShower::RecoShowers(), ncid::MakeNCCosRej::TransMomFraction(), ncid::NCNNKeras::TransMomFraction(), and cosrej::MakeNueCosRej::TransMomFraction().

524  {
525  // These are obtained by plotting rec.mc.nu.p.fP.fZ/rec.mc.nu.p.fE etc from
526  // CAF files and fitting the resulting distribution to a gaussian.
527  // A true vertex inside of the detector is require as well as the NuE group FA reconstruction
528  // and containment cuts.
529  // CAF Files used:
530  // NearDet:
531  // prod_caf_S15-05-22a_nd_genie_fhc_nonswap_ndnewpos
532  // FarDet:
533  // prod_caf_S15-05-22a_fd_genie_fhc_nonswap_fdfluxv08
534  // Unknown for NDOS
535 
536  switch(fDetId){
537  case novadaq::cnv::kFARDET: return TVector3(-6.833e-05,
538  +6.388e-02,
539  +9.980e-1).Unit();
540  case novadaq::cnv::kNDOS: return TVector3(-3.845e-4,
541  +6.517e-2,
542  +9.967e-1).Unit();
543  case novadaq::cnv::kNEARDET: return TVector3(-8.424e-04,
544  -6.174e-02,
545  +9.981e-1).Unit();
546  case novadaq::cnv::kTESTBEAM: return TVector3(0,
547  0,
548  1).Unit();
549  default:
550  throw cet::exception("BadGeoConfig")
551  << "Bad geometry configuration: " << fDetId << "\n"
552  << __FILE__ << ":" << __LINE__ << "\n";
553  }
554  }
novadaq::cnv::DetId fDetId
id for the detector being used
Definition: GeometryBase.h:285
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
Far Detector at Ash River, MN.
Prototype Near Detector on the surface at FNAL.
Near Detector in the NuMI cavern.
Float_t e
Definition: plot.C:35
const PlaneGeo * geo::GeometryBase::Plane ( unsigned int  i) const

Return the geometry description of the ith plane in the detector.

Parameters
i: input plane number, starting from 0
Returns
plane geometry for ith plane
Exceptions
geo::Exceptionif iplane is outside allowed range

Definition at line 749 of file GeometryBase.cxx.

References fPlanes, and MECModelEnuComparisons::i.

Referenced by dif::DiFShowerFinder::adjustPlane(), dif::DiFShowerFinder::adjustPlane_end(), geo::GeometryTest::analyze(), mcchk::DetAna::analyze(), dprf::ChannelPlots::analyze(), zcl::SMMTriggerAna::analyze(), slicer::S4DParamCalc::analyze(), dprf::TrackPlots::analyze(), mcchk::CosmicAna::analyze(), mcchk::RockAna::analyze(), numue::NumuEAna::analyze(), align::Alignment::analyze(), sn::SNSlicerAna::analyze(), calib::AssessCalib::analyze(), calib::HitEfficiency::analyze(), mcchk::LeptonAna::analyze(), comi::NumiFilteringAna::analyze(), zcl::FmmTrackerAna::analyze(), zcl::FmmTrackerValidation::analyze(), trk::KalmanTrackAna::analyze(), showere::ShowerEnergyAna::analyze(), remid::ReMIdDedxRock::analyze(), remid::ReMIdDedxFD::analyze(), remid::ReMIdDedxStudies::analyze(), LightLevels::analyze(), calib::CosmicTrends::analyze(), htk::HoughTrack::analyze(), trk::CosmicTrackAna::analyze(), comi::Leana::AnaNHit(), calib::CalibAna::ApproximateHitPos(), chaninfo::BadChanValidate::BadChansFromDB(), trk::CosmicTrackAna::beginJob(), chaninfo::CosmicEff::beginRun(), dprf::ChannelPlots::beginRun(), mcchk::DetAna::beginRun(), dprf::TrackPlots::beginRun(), calib::DriftResponseCalc::beginRun(), rsim::ReadoutSim::beginRun(), calib::CosmicTrends::beginRun(), chaninfo::BadChanValidate::beginSubRun(), calib::BestPathEstimates(), noe::build_cell_lookup_table(), BuildMaps(), slid::ParticleIDAlg::CalcAsymIneria(), slid::ParticleIDAlg::CalcCellPlaneTransverseDedx(), slid::ParticleIDAlg::CalcPlaneTransverseDedx(), slid::ParticleIDAlg::CalcTrkHitPath(), trk::KalmanTrackMerge::CanJoinTracks(), evd::RecoBaseDrawer::CellHit2D(), evd::RecoBaseDrawer::CellHit3D(), CellInfo(), CellTpos(), murem::TrackCleanUpAlg::CleanUpTrack(), ClosestApproach(), dt::Cand::ClosestToEndCell(), sn::SNMichelAnalyzer::ClusterAroundTrackEnds(), remid::ReMIdTrain::ContainedEvent(), remid::ReMIdDedx::ContainedEvent(), remid::ReMIdDedxRock::ContainedEvent(), remid::ReMIdDedxStudies::ContainedEvent(), skim::SkimmingUtils::CopyProngs(), skim::SkimmingUtils::CopyShowers(), skim::SkimmingUtils::CopySlice(), skim::SkimmingUtils::CopyTracks(), CountCellsOnLine(), trk::KalmanGeoHelper::CountMissedCellsOnLine(), util::CountXY(), LightLevels::CreateHistos(), rsim::ReadoutSim::CreateRawDigits(), murem::TrackCleanUpAlg::DeDxInPlane(), lem::DefaultVertex(), dif::DiFShowerFinder::distancefromtrack(), sn::TrackActivityRemover::DistanceHitToPoint(), sn::SNMichelAnalyzer::DistanceHitToPoint(), sn::TrackActivityRemover::DistanceHitToTrackBody(), slid::DeconvolveAlg::DistanceToCore(), evd::GeometryDrawer::DrawCells2D(), evd::RecoBaseDrawer::DrawCluster2D(), evd::GeometryDrawer::DrawHighlightCell(), evd::RecoBaseDrawer::DrawTrack2D(), skim::ParametersNumu::EarliestLatestHitPos(), mcchk::ShowerAnaCheck::EMMoliereRadius(), mcchk::ShowerAnaCheck::EMShowerWidth(), chaninfo::CosmicEff::endJob(), calib::BetheBlochFit::endJob(), calib::AttenFit::endJob(), calib::FindOutliers::endRun(), comi::ChanOcc::endSubRun(), rsim::RecordNoiseSpectrumFile::endSubRun(), LightLevels::endSubRun(), dif::DiFShowerFinder::eparm(), calib::MakeAttenuationProfiles::event(), util::EventBox(), calib::AttenFit::expFit(), calib::AttenuationFit::expFit(), rsim::IFPGAAlgorithm::FetchThresholds(), geo::LiveGeometry::FillBadBoxes(), caf::FillHadClustVars(), calib::StopperThreshold::FillHist(), calib::CosmicTrends::FillHistograms(), bpfit::BreakPoint::FillHitList(), trk::KalmanGeoHelper::fillprivategeo(), caf::FillSliceInfo(), caf::FillSliceVars(), trk::CosmicTrackAna::FillTrackHistograms(), calib::StopperThreshold::FillTree(), calib::CosmicCalib::filter(), comi::NumiFiltering::filter(), bsf::BremShowerFilter::filter(), showere::ShowerEnergyFilterMC::filter(), calib::FindBelowThresholdCalibCandidates(), trk::WindowTrackingAlg::FindEndPoint(), bsf::BremShowerFilter::findShowerByReco(), dif::DiFShowerFinder::findShowerByReco(), trk::KalmanTrack::FindTracks(), bpfit::DimuonFitter::FindVertexZ(), trk::CosmicTrackUtilities::FindZBoundaries(), calib::FindZBoundaries(), bpfit::BreakPoint::FitTracks(), bpfit::DimuonFitter::FitView(), trk::WindowTrackingAlg::FitWindow(), evd::SimulationDrawer::FLSHit2D(), evd::SimulationDrawer::FLSHit3D(), align::SplitTracks::GeoEstimatePos(), mono::Monopole::get_position(), mono::SlowMonopoleAna::get_position(), numusand::NumuSandFxs::getActivity(), calib::Calibrator::GetAttenCurve(), cosrej::CosRejFxs::getBBC(), evd::SliceNavigator::GetBounds(), evd::GeometryDrawer::GetBox(), evd::SliceNavigator::GetBox(), jmshower::RecoJMShower::GetCellDistToPoint(), jmshower::RecoJMShower::GetCellDistToTrk(), align::SplitTracks::GetCellEndpoints(), slid::ParticleIDAlg::GetCellNodePos(), jmshower::RecoJMShower::GetCellNodePos(), jmshower::RecoJMShower::GetCellTransDedx(), jmshower::RecoJMShower::GetCentroid(), calib::CosmicCalib::GetChannelHists(), calib::MakeAttenuationProfiles::GetChannelHists(), evd::RecoBaseDrawer::GetClusterOutlinesConvexHull(), evd::GeometryDrawer::GetDCMBoxes(), nuesand::FillNueSandbox::GetdEdx(), geo::LiveGeometry::GetDetectorEdges(), skim::ParametersNumu::GetDetectorEdges(), cosrej::CosRejFxs::getFits(), airshower::AirSlicer::GetHitPos(), ndreco::NDRecoFxs::getProngActivity(), ndreco::NDRecoFxs::getProngDedx(), dt::Chunk::GetSegs(), ndreco::NDRecoFxs::getTrackActivity(), ndreco::NDRecoFxs::getTrackDedx(), jmshower::JMShower::GetTransHits(), jmshower::RecoJMShower::GetTrkCPlaneCell(), jmshower::RecoJMShower::GetTrkHitPath(), jmshower::RecoJMShower::GetTrkHitPos(), jmshower::RecoJMShower::GetTrkPlaneCell(), jmshower::RecoJMShower::GetTrkPlaneDistToEdge(), jmshower::RecoJMShower::GetTrkPlanePos(), calib::ThresholdAna::GetView(), calib::CosmicCalib::GetView(), calib::MakeAttenuationProfiles::GetView(), calib::AttenFit::GetView(), calib::AttenuationFit::GetView(), calib::AttenCache::GetView(), calib::GetXYZD(), slid::NuEEnergyAlg::HadronicDepEnergy(), calib::HasXYAdjacents(), dt::DiscreteTracker::HighActivity(), rb::HitList::HitList(), dt::Chunk::HitsOnLine(), nerd::NERDProng::HitToHitDistance(), me::MEFinder::HitToHitDistance(), IdToCell(), IdToPlane(), bsf::BremShowerFilter::inFiducial(), dif::DiFShowerFinder::inFiducial(), remid::RecoMuon::IsTrackContained(), trk::CosmicTrackAlg::IsTrackDownstreamFromTiming(), skim::EvaluatorNue::KeepSlice(), calib::AttenCache::LoadFromDatabase(), photrans::ImprovedTransport::LoadHistos(), chaninfo::BadChanList::LoadNewData(), trk::WindowTrackingAlg::LookForBremsstrahlungHits(), trk::WindowTrackingAlg::Make3DTrack(), calib::Calibrator::MakeCellHit(), evtsum::EventSummary::MakeOutput(), trk::CosmicTrackAlg::MakeTrack(), trk::WindowTrackingAlg::MakeTrack(), trk::WindowTrackingAlg::MakeViewTrack(), calib::MakeZBoundaryMap(), fuzz::ViewMatchAlg::Matching(), nerd::ViewMatchAlg::Matching(), lem::FindLEMMatches::MatchToVertex(), lem::LEM::MatchToVertex(), trk::KalmanGeoHelper::MatchTrajectoryToPlane(), trk::KalmanGeoHelper::MatchTrajectoryToPlaneInView(), rb::Cluster::MinMaxMeanXYZ(), zcl::SMMCluster::MissC(), dif::DiFShowerFinder::muonstub(), numue::NumuEAlg::NumuEAlg(), evd::RecoBaseDrawer::OfflineChans2D(), skim::ParametersNumu::ParametersNumu(), trk::CosmicTrackUtilities::PathLengthInCell(), calib::PathLengthInCell(), calib::CosmicCalib::PCHitPE(), calib::MakeAttenuationProfiles::PCHitPE(), rb::Track::PlaneDirMap(), slid::ParticleIDAlg::PlaneHitCell(), slid::ParticleIDAlg::PlaneHitXYZ(), slid::ParticleIDAlg::PlaneRadius(), chaninfo::BadChanList::preBeginEvent(), ddthelpers::print(), photrans::PhotonSystRewriter::produce(), hv::HoughVertex::produce(), trk::KalmanTrack::produce(), trk::KalmanTrackMerge::produce(), slid::Recluster::produce(), jmshower::JMTrackMerge::produce(), numusand::FillSandbox::produce(), lem::AlignLibToVtx::produce(), lem::MakeLibrary::produce(), photrans::PhotonTransport::produce(), zcl::SMMCluster::produce(), vdt::VertexDT::produce(), jmshower::NueSel::produce(), cvn::RegCVNMapper::produce(), jmshower::NueSelLID::produce(), cheat::MCCheater::produce(), remid::RecoMuon::produce(), rsim::ReadoutSim::produce(), caf::CAFMaker::produce(), slid::ParticleIDAlg::Radius(), evd::RawDataDrawer::RawDigit2D(), lem::GenFromLib::readNext(), jmshower::RecoJMShower::RecoShowers(), calib::AttenCache::RepresentativePlane(), trk::RLFit::RLFit(), hough::MultiHoughT::Scrub(), earms::ElasticArmsHS::Scrub(), vdt::VertexDT::Scrub(), fuzz::FuzzyKVertex::Scrub(), SetDetectorSize(), chaninfo::BadChanList::SetRandomBadChannels(), trk::WindowTrackingAlg::SetTrackEndPoints(), trk::KalmanTrackMerge::ShiftInterpolationPoints(), trk::WindowTrackingAlg::ShortTrack(), trk::WindowTrackingAlg::ShortTrackExtraPlane(), trk::WindowTrackingAlg::ShortViewTrack(), skim::SkimmingUtils::SkimmingUtils(), lem::MakeLibrary::SliceMeanPosEWeighted(), murem::TrackCleanUpAlg::SortByDistFromTrack(), photrans::ImprovedTransport::StepAlongHit(), geo::GeometryTest::testCellId(), geo::GeometryTest::testCellIdFromPos(), geo::GeometryTest::testFindCell(), geo::GeometryTest::testFindPlanes(), calib::StopperThreshold::testPath(), geo::GeometryTest::testStepping(), geo::GeometryTest::testUniqueId(), rb::Prong::TotalLength(), dt::Chain::ToTrack(), zcl::FMMTracker::Tracking2D(), trk::CosmicTrackUtilities::TrackResiduals(), calib::AttenCache::TranslateChannelMC(), trk::CosmicTrackUtilities::TruePathLengthInCell(), slid::NuEEnergyAlg::VertexEnergy(), lem::VertexToPlaneAndCell(), dt::View::View(), trk::KalmanTrackMerge::ViewMergeTracks(), rb::Prong::W(), rb::Track::W(), calib::AttenuationFit::writeResults(), and calib::ZBounds().

749  {
750  if (i>=fPlanes.size()) {
751  throw cet::exception("BAD_PLANE_NUMBER")
752  << "Plane index " << i << " out of range " << fPlanes.size() << "\n"
753  << __FILE__ << ":" << __LINE__ << "\n";
754  return 0;
755  }
756  return fPlanes[i];
757  }//end of Plane
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
std::vector< PlaneGeo * > fPlanes
The detector planes.
Definition: GeometryBase.h:291
void geo::GeometryBase::RemoveTmpFile ( std::string  fileName)
protected

Method to remove temporary file that holds detector geometry file.

Definition at line 175 of file GeometryBase.cxx.

Referenced by geo::Geometry::preBeginRun(), geo::Geometry::~Geometry(), and ~GeometryBase().

175  {
176  remove(fileName.c_str());
177  }
fileName
Definition: plotROC.py:78
std::string geo::GeometryBase::ROOTFile ( ) const
inline

Definition at line 236 of file GeometryBase.h.

236 { return fROOTFile; }
std::string fROOTFile
root file holding the geometry
Definition: GeometryBase.h:282
TGeoManager * geo::GeometryBase::ROOTGeoManager ( ) const
int geo::GeometryBase::Run ( ) const
inline

Definition at line 239 of file GeometryBase.h.

239 { return fRunNumber; }
unsigned int fRunNumber
Run number of configuration.
Definition: GeometryBase.h:332
void geo::GeometryBase::setDetectorBigBox ( double  detector_bigbox_range)
protected

Get the Detector size

Dimensions of the DetectorBigBox in cm

Definition at line 1350 of file GeometryBase.cxx.

References DetectorEnclosureBox(), fDetectorBigBoxXHi, fDetectorBigBoxXLo, fDetectorBigBoxYHi, fDetectorBigBoxYLo, fDetectorBigBoxZHi, fDetectorBigBoxZLo, fIsDetectorBigBoxUsed, x1, submit_syst::x2, y1, and submit_syst::y2.

Referenced by LoadGeometryFile().

1350  {
1351  fIsDetectorBigBoxUsed = true;
1352 
1353  double x1, x2;
1354  double y1, y2;
1355  double z1, z2;
1356 
1357  /// Get the Detector size
1358  this->DetectorEnclosureBox(&x1, &x2, &y1, &y2, &z1, &z2);
1359 
1360  /// Dimensions of the DetectorBigBox in cm
1361  fDetectorBigBoxXHi = x2 + detector_bigbox_range;
1362  fDetectorBigBoxXLo = x1 - detector_bigbox_range;
1363  fDetectorBigBoxYHi = y2 + detector_bigbox_range;
1364  fDetectorBigBoxYLo = y1 - detector_bigbox_range;
1365  fDetectorBigBoxZHi = z2 + detector_bigbox_range;
1366  fDetectorBigBoxZLo = z1 - detector_bigbox_range;
1367 
1368  }// end of setDetectorBigBox
double fDetectorBigBoxXHi
Dimensions of the DetectorBigBox in cm.
Definition: GeometryBase.h:314
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
bool fIsDetectorBigBoxUsed
Do we need to use the BigBox cut?
Definition: GeometryBase.h:310
double fDetectorBigBoxZHi
Definition: GeometryBase.h:318
double fDetectorBigBoxXLo
Definition: GeometryBase.h:315
double fDetectorBigBoxYLo
Definition: GeometryBase.h:317
double fDetectorBigBoxZLo
Definition: GeometryBase.h:319
void DetectorEnclosureBox(double *xlo_cm, double *xhi_cm, double *ylo_cm, double *yhi_cm, double *zlo_cm, double *zhi_cm) const
double fDetectorBigBoxYHi
Definition: GeometryBase.h:316
void geo::GeometryBase::setDetectorID ( novadaq::cnv::DetId  det_id)
protectedvirtual

Method to set DetectorID.

Method to set DetectorID

Reimplemented in geo::Geometry.

Definition at line 1515 of file GeometryBase.cxx.

References geo::BEAMTYPE_NUMI, geo::GeometryBase::DetectorParams::BigBoxRange, geo::GeometryBase::DetectorParams::BigBoxUsed, gen_flatrecord::config, fBigBoxRange, fCoordinateTransformation, geo::GeometryBase::Params::fd, fDetHalfHeight, fDetHalfWidth, fDetId, fDetLength, fFiducialVolumeXHi, fFiducialVolumeXLo, fFiducialVolumeYHi, fFiducialVolumeYLo, fFiducialVolumeZHi, fFiducialVolumeZLo, geo::GeometryBase::DetectorParams::FiducialVolumeXHi, geo::GeometryBase::DetectorParams::FiducialVolumeXLo, geo::GeometryBase::DetectorParams::FiducialVolumeYHi, geo::GeometryBase::DetectorParams::FiducialVolumeYLo, geo::GeometryBase::DetectorParams::FiducialVolumeZHi, geo::GeometryBase::DetectorParams::FiducialVolumeZLo, fIsDetectorBigBoxUsed, fParams, novadaq::cnv::kFARDET, novadaq::cnv::kNDOS, novadaq::cnv::kNEARDET, novadaq::cnv::kTESTBEAM, LOG_DEBUG, geo::GeometryBase::Params::nd, geo::GeometryBase::Params::ndos, geo::CoordinateTransformation::setDetectorAndBeam(), and geo::GeometryBase::Params::tb.

Referenced by GeometryBase(), LoadGeometryFile(), and geo::Geometry::setDetectorID().

1516  {
1517  LOG_DEBUG("Geometry")
1518  <<"GeometryBase::setDetectorID\n";
1519 
1520  fDetId = det_id;
1521 
1522  // Change coordinate transformation class as well
1524  //fCoordinateTransformation.print();
1525 
1526  // Work out which config to use
1527  DetectorParams config;
1528  switch(fDetId){
1529  case novadaq::cnv::kNDOS: config = fParams.ndos(); break;
1530  case novadaq::cnv::kNEARDET: config = fParams.nd(); break;
1531  case novadaq::cnv::kFARDET: config = fParams.fd(); break;
1532  case novadaq::cnv::kTESTBEAM: config = fParams.tb(); break;
1533  default: return; // Probably unknown or testbeam. Nothing sane to set the
1534  // below variables to.
1535  }
1536 
1537  // Set fiducial volume
1538  fFiducialVolumeXHi = fDetHalfWidth - config.FiducialVolumeXHi();
1539  fFiducialVolumeXLo = -fDetHalfWidth + config.FiducialVolumeXLo();
1540  fFiducialVolumeYHi = fDetHalfHeight - config.FiducialVolumeYHi();
1541  fFiducialVolumeYLo = -fDetHalfHeight + config.FiducialVolumeYLo();
1542  fFiducialVolumeZHi = fDetLength - config.FiducialVolumeZHi();
1543  fFiducialVolumeZLo = config.FiducialVolumeZLo();
1544 
1545  fIsDetectorBigBoxUsed = config.BigBoxUsed();
1546  fBigBoxRange = config.BigBoxRange();
1547 
1548  }// end of GeometryBase::setDetectorID
novadaq::cnv::DetId fDetId
id for the detector being used
Definition: GeometryBase.h:285
double fFiducialVolumeZLo
Definition: GeometryBase.h:328
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
double fDetLength
Detector length (cm)
Definition: GeometryBase.h:299
bool setDetectorAndBeam(uint32_t detector_id, uint32_t beam_type)
Try to set the detector and beam.
Table< DetectorParams > tb
Definition: GeometryBase.h:77
Table< DetectorParams > nd
Definition: GeometryBase.h:75
bool fIsDetectorBigBoxUsed
Do we need to use the BigBox cut?
Definition: GeometryBase.h:310
double fFiducialVolumeXLo
Definition: GeometryBase.h:324
Table< DetectorParams > ndos
Definition: GeometryBase.h:74
double fDetHalfHeight
Detector 1/2 height (cm)
Definition: GeometryBase.h:300
double fDetHalfWidth
Detector 1/2 width (cm)
Definition: GeometryBase.h:301
double fFiducialVolumeXHi
Definition: GeometryBase.h:323
Far Detector at Ash River, MN.
Prototype Near Detector on the surface at FNAL.
Near Detector in the NuMI cavern.
CoordinateTransformation fCoordinateTransformation
Coordinate Transformation class.
Definition: GeometryBase.h:289
double fFiducialVolumeZHi
Definition: GeometryBase.h:327
double fBigBoxRange
Range of big box.
Definition: GeometryBase.h:311
Table< DetectorParams > fd
Definition: GeometryBase.h:76
double fFiducialVolumeYHi
Definition: GeometryBase.h:325
double fFiducialVolumeYLo
Definition: GeometryBase.h:326
void geo::GeometryBase::SetDetectorSize ( )
protected

Calculate the detector size based on the geometry. Requires a little bit of work, so do this once when the geometry is updated

If there no Vertical or horizontal planes, then we go get the size from the Detector Enclosure It used to be that once this condition is true, then it we would just throw an exception. However, now Giuseppe Ferone and Denis Perevalov are studying interactions in simple detector, which don't have planes in it. Thus, they don't want the code breaking.

Getting Detector enclosure volume

Lo and Hi ranges of each of the axes. To be filled later

Fill them

Set detector size

Definition at line 1274 of file GeometryBase.cxx.

References APDHVSetting::dummy, fDetHalfHeight, fDetHalfWidth, fDetLength, fPlanes, and Plane().

Referenced by LoadGeometryFile().

1275  {
1276  double dummy;
1277 
1278  // Compute the height and width based on the sizes of the vertical
1279  // and horizontal planes. Remember, in the local plane frame z goes
1280  // along the length of the modules. Hence the use of axis=3 to get
1281  // the detector height (from the vertical planes) and width (from
1282  // the horizontal planes).
1283  const TGeoVolume* vvp = gGeoManager->GetVolume("vPlaneV");
1284  const TGeoVolume* hvp = gGeoManager->GetVolume("vPlaneH");
1285 
1286  // Handle the case of the IPND where the volumes are names slightly
1287  // different accounting for the different widths of the modules.
1288  if (vvp==0) vvp = gGeoManager->GetVolume("vPlaneVNDOS");
1289  if (hvp==0) hvp = gGeoManager->GetVolume("vPlaneHNDOS");
1290  if (vvp==0 && hvp==0) {
1291  vvp = gGeoManager->GetVolume("vPlaneVND");
1292  hvp = gGeoManager->GetVolume("vPlaneHND");
1293  }
1294 
1295  /// If there no Vertical or horizontal planes, then we go get the size from the Detector Enclosure
1296  /// It used to be that once this condition is true, then it we would just throw an exception.
1297  /// However, now Giuseppe Ferone and Denis Perevalov are studying interactions in simple detector,
1298  /// which don't have planes in it. Thus, they don't want the code breaking.
1299  if (vvp==0 || hvp==0) {
1300  mf::LogWarning("SetDetectorSize")
1301  << "Warning! BAD_GEO_CONFIG. Unable to find shapes to set detector size\n"
1302  << "Now getting the detector size from vDetEnclosure\n";
1303 
1304  /// Getting Detector enclosure volume
1305  const TGeoVolume* vdet_enclosure = gGeoManager->GetVolume("vDetEnclosure");
1306 
1307  /// Lo and Hi ranges of each of the axes. To be filled later
1308  double x_lo, x_hi;
1309  double y_lo, y_hi;
1310  double z_lo, z_hi;
1311 
1312  /// Fill them
1313  vdet_enclosure->GetShape()->GetAxisRange(1, x_lo, x_hi);
1314  vdet_enclosure->GetShape()->GetAxisRange(2, y_lo, y_hi);
1315  vdet_enclosure->GetShape()->GetAxisRange(3, z_lo, z_hi);
1316 
1317  /// Set detector size
1318  fDetHalfWidth = x_hi;
1319  fDetHalfHeight = y_hi;
1320  fDetLength = z_hi - z_lo;
1321 
1322  return;
1323  }
1324 
1325  const TGeoShape* vp = vvp->GetShape();
1326  const TGeoShape* hp = hvp->GetShape();
1327  vp->GetAxisRange(3,dummy,fDetHalfHeight);
1328  hp->GetAxisRange(3,dummy,fDetHalfWidth);
1329 
1330  // Remember -- in the local plane coordinate frame, the "depth" is
1331  // along y, hence axis=2. In the world coordinate this is along z.
1332  double vplanez1, vplanez2;
1333  vp->GetAxisRange(2,vplanez1,vplanez2);
1334 
1335  // Compute the detector length based on the center positions of
1336  // cells in the first and last plane. Adjust to account for the
1337  // plane widths. This ajustment works if the vertical and horizontal
1338  // planes have the same depth, or if the detector begins and ends
1339  // with vertical planes. As of the TDR both of these conditions was
1340  // true for all the NOvA detectors.
1341  double xyz1[3] = {0,0,0};
1342  double xyz2[3] = {0,0,0};
1343  this->Plane(0)-> Cell(0)->GetCenter(xyz1);
1344  this->Plane(fPlanes.size()-1)->Cell(0)->GetCenter(xyz2);
1345  fDetLength = (xyz2[2]-xyz1[2])+(vplanez2-vplanez1);
1346  }// end of SetDetectorSize
double fDetLength
Detector length (cm)
Definition: GeometryBase.h:299
const PlaneGeo * Plane(unsigned int i) const
double fDetHalfHeight
Detector 1/2 height (cm)
Definition: GeometryBase.h:300
std::vector< PlaneGeo * > fPlanes
The detector planes.
Definition: GeometryBase.h:291
double fDetHalfWidth
Detector 1/2 width (cm)
Definition: GeometryBase.h:301
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
void geo::GeometryBase::SetDrawOptions ( )
protected

Definition at line 691 of file GeometryBase.cxx.

Referenced by LoadGeometryFile().

691 { }
double geo::GeometryBase::SurfaceY ( ) const

A typical y-position value at the surface (where earth meets air) for this detector site

Returns
typical y position at surface in units of cm
Exceptions
geo::Exceptionif detector ID is not set properly
Todo:
: Only far det number is reasonable accurate. Near and IPND need some thought

Definition at line 500 of file GeometryBase.cxx.

References fDetId, makeTrainCVSamples::int, novadaq::cnv::kFARDET, novadaq::cnv::kNDOS, novadaq::cnv::kNEARDET, and novadaq::cnv::kTESTBEAM.

Referenced by evgen::CosmicsGen::produce(), evgen::CosmicPionGen::produce(), and evgen::CosmicsGen::ProjectCosmicsToSurface().

500  {
501 
502  switch(fDetId){
504  return 9.94E2; // far : surface ~10m above det. center
505 
506  case novadaq::cnv::kNDOS:
507  return -1.966E2; // NDOS: surface ~2m below det. center
508 
510  return 130.0E2; // near: surface ~130m above det. center
511 
513  return -1.966E2; // NDOS: surface ~2m below det. center
514 
515  default:
516  throw cet::exception("BadGeoConfig")
517  << "Bad geometry configuration: " << (int)fDetId << "\n"
518  << __FILE__ << ":" << __LINE__ << "\n";
519  }
520  }// end of SurfaceY
novadaq::cnv::DetId fDetId
id for the detector being used
Definition: GeometryBase.h:285
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
Far Detector at Ash River, MN.
Prototype Near Detector on the surface at FNAL.
Near Detector in the NuMI cavern.
double geo::GeometryBase::TotalMass ( const char *  volume = "vDetEnclosure") const

Return the total mass of the detector

Definition at line 1036 of file GeometryBase.cxx.

References d, Munits::nm, file_size_ana::node, and string.

Referenced by geo::GeometryTest::analyze().

1037  {
1038  double mass = 0.;
1039 
1040  // the detector resides in the vDetEnclosure volume so start there
1041  const TGeoVolume *enclosure = gGeoManager->FindVolumeFast(volume);
1042 
1043  int old_verbosity = gGeoManager->GetVerboseLevel();
1044  gGeoManager->SetVerboseLevel(0);
1045  // loop over the daughters in the volume and let ROOT calculate the
1046  // mass in kg for you for the daughter nodes that have vBlock in
1047  // their names this only goes one level down, so no worries of
1048  // double counting non-superblock blocks
1049  //
1050  for(int d = 0; d < enclosure->GetNdaughters(); ++d){
1051  const TGeoNode* node = enclosure->GetNode(d);
1052  const char* nm = node->GetName();
1053  if(strncmp(nm,"vSuperBlock",11) == 0){
1054  std::string name = nm;
1055  name.erase(name.find('_'));
1056  mass += gGeoManager->FindVolumeFast(name.c_str())->Weight();
1057  }
1058  }
1059  gGeoManager->SetVerboseLevel(old_verbosity);
1060  return mass;
1061  }// end of TotalMass
const XML_Char * name
Definition: expat.h:151
static constexpr Double_t nm
Definition: Munits.h:133
Float_t d
Definition: plot.C:236
Definition: structs.h:1
enum BeamMode string
void geo::GeometryBase::WorldBox ( double *  xlo,
double *  xhi,
double *  ylo,
double *  yhi,
double *  zlo,
double *  zhi 
) const

Return the ranges of x,y and z for the "world volume" that the entire geometry lives in. If any pointers are 0, then those coordinates are ignored.

Parameters
xlo: On return, lower bound on x positions
xhi: On return, upper bound on x positions
ylo: On return, lower bound on y positions
yhi: On return, upper bound on y positions
zlo: On return, lower bound on z positions
zhi: On return, upper bound on z positions

Definition at line 595 of file GeometryBase.cxx.

References ana::assert(), x1, submit_syst::x2, y1, and submit_syst::y2.

Referenced by evgen::CORSIKAGen::GetSample(), g4n::FLSHitListAction::ParticleProjection(), evgen::CosmicsGen::ProjectCosmicsToSurface(), and geo::GeometryTest::testProject().

597  {
598  const TGeoShape* s = gGeoManager->GetVolume("vWorld")->GetShape();
599  assert(s);
600 
601  if (xlo || xhi) {
602  double x1, x2;
603  s->GetAxisRange(1,x1,x2); if (xlo) *xlo = x1; if (xhi) *xhi = x2;
604  }
605  if (ylo || yhi) {
606  double y1, y2;
607  s->GetAxisRange(2,y1,y2); if (ylo) *ylo = y1; if (yhi) *yhi = y2;
608  }
609  if (zlo || zhi) {
610  double z1, z2;
611  s->GetAxisRange(3,z1,z2); if (zlo) *zlo = z1; if (zhi) *zhi = z2;
612  }
613  }// end of WorldBox
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
const XML_Char * s
Definition: expat.h:262
assert(nhit_max >=nhit_nbins)

Member Data Documentation

std::set<unsigned int> geo::GeometryBase::fAllPlanes
protected

List of all planes.

Definition at line 295 of file GeometryBase.h.

Referenced by BuildMaps(), and GetPlanesByView().

double geo::GeometryBase::fBigBoxRange
protected

Range of big box.

Definition at line 311 of file GeometryBase.h.

Referenced by LoadGeometryFile(), and setDetectorID().

fhicl::ParameterSet geo::GeometryBase::fConfigFD
protected

Definition at line 321 of file GeometryBase.h.

fhicl::ParameterSet geo::GeometryBase::fConfigND
protected

Definition at line 321 of file GeometryBase.h.

fhicl::ParameterSet geo::GeometryBase::fConfigNDOS
protected

Definition at line 321 of file GeometryBase.h.

fhicl::ParameterSet geo::GeometryBase::fConfigTB
protected

Definition at line 321 of file GeometryBase.h.

CoordinateTransformation geo::GeometryBase::fCoordinateTransformation
protected

Coordinate Transformation class.

Definition at line 289 of file GeometryBase.h.

Referenced by setDetectorID().

double geo::GeometryBase::fDetectorBigBoxXHi
protected

Dimensions of the DetectorBigBox in cm.

Definition at line 314 of file GeometryBase.h.

Referenced by DetectorBigBox(), IntersectsBigBox(), LoadGeometryFile(), and setDetectorBigBox().

double geo::GeometryBase::fDetectorBigBoxXLo
protected
double geo::GeometryBase::fDetectorBigBoxYHi
protected
double geo::GeometryBase::fDetectorBigBoxYLo
protected
double geo::GeometryBase::fDetectorBigBoxZHi
protected
double geo::GeometryBase::fDetectorBigBoxZLo
protected
double geo::GeometryBase::fDetHalfHeight
protected
double geo::GeometryBase::fDetHalfWidth
protected
novadaq::cnv::DetId geo::GeometryBase::fDetId
protected
double geo::GeometryBase::fDetLength
protected
double geo::GeometryBase::fFiducialVolumeXHi
protected

Definition at line 323 of file GeometryBase.h.

Referenced by FiducialBox(), and setDetectorID().

double geo::GeometryBase::fFiducialVolumeXLo
protected

Definition at line 324 of file GeometryBase.h.

Referenced by FiducialBox(), isInsideFiducialVolume(), and setDetectorID().

double geo::GeometryBase::fFiducialVolumeYHi
protected

Definition at line 325 of file GeometryBase.h.

Referenced by FiducialBox(), and setDetectorID().

double geo::GeometryBase::fFiducialVolumeYLo
protected

Definition at line 326 of file GeometryBase.h.

Referenced by FiducialBox(), isInsideFiducialVolume(), and setDetectorID().

double geo::GeometryBase::fFiducialVolumeZHi
protected

Definition at line 327 of file GeometryBase.h.

Referenced by FiducialBox(), and setDetectorID().

double geo::GeometryBase::fFiducialVolumeZLo
protected

Definition at line 328 of file GeometryBase.h.

Referenced by FiducialBox(), isInsideFiducialVolume(), and setDetectorID().

std::string geo::GeometryBase::fGDMLFile
protected

gdml file holding the geometry

Definition at line 281 of file GeometryBase.h.

Referenced by ExtractGDML(), FileBaseName(), GeometryBase(), MakeTmpFile(), geo::Geometry::preBeginRun(), geo::Geometry::~Geometry(), and ~GeometryBase().

std::string geo::GeometryBase::fGDMLFromFCL
protected

keep track of original fcl parameter

Definition at line 283 of file GeometryBase.h.

Referenced by GeometryBase(), and geo::Geometry::preBeginRun().

UIDMap geo::GeometryBase::fIdMap
protected

Unique ID -> Plane,Cell.

Definition at line 293 of file GeometryBase.h.

Referenced by BuildMaps(), getPlaneCellMap(), and LoadGeometryFile().

bool geo::GeometryBase::fIsDetectorBigBoxUsed
protected

Do we need to use the BigBox cut?

Definition at line 310 of file GeometryBase.h.

Referenced by LoadGeometryFile(), setDetectorBigBox(), and setDetectorID().

Params geo::GeometryBase::fParams
protected
std::vector<PlaneGeo*> geo::GeometryBase::fPlanes
protected
std::vector<PlaneGeo*> geo::GeometryBase::fPlanesInMuonCatcher
protected

Same pointers as fPlanes.

Definition at line 292 of file GeometryBase.h.

Referenced by FirstPlaneInMuonCatcher(), LoadGeometryFile(), and MakePlane().

std::string geo::GeometryBase::fROOTFile
protected

root file holding the geometry

Definition at line 282 of file GeometryBase.h.

Referenced by GeometryBase(), and geo::Geometry::preBeginRun().

unsigned int geo::GeometryBase::fRunNumber
protected

Run number of configuration.

Definition at line 332 of file GeometryBase.h.

Referenced by geo::Geometry::preBeginRun().

std::string geo::GeometryBase::fStoreTempGeo
protected

folder to store temp geo file

Definition at line 330 of file GeometryBase.h.

std::set<unsigned int> geo::GeometryBase::fXplanes
protected

List of X measuring planes.

Definition at line 296 of file GeometryBase.h.

Referenced by BuildMaps(), and GetPlanesByView().

std::set<unsigned int> geo::GeometryBase::fYplanes
protected

List of Y measuring planes.

Definition at line 297 of file GeometryBase.h.

Referenced by BuildMaps(), and GetPlanesByView().


The documentation for this class was generated from the following files: