11 #include <sys/types.h> 18 #include "TGeoManager.h" 20 #include "TStopwatch.h" 21 #include "TVirtualGeoPainter.h" 24 #include "cetlib_except/exception.h" 33 #include "Utilities/func/MathUtil.h" 40 double xyz1[3], xyz2[3];
43 return xyz1[2]<xyz2[2];
74 <<
"cannot find GDML file " <<
fGDMLFile <<
" bail ungracefully\n" 75 << __FILE__ <<
":" << __LINE__ <<
"\n";
77 mf::LogWarning(
"LoadNewGeometry") <<
"loading new geometry files\n" 86 for (
unsigned int i=0;
i<
fPlanes.size(); ++
i) {
91 if (
fGDMLFile.find(
"TEMP_GEO_GDML") != std::string::npos){
120 if ( ((fStat = mkstemp(tmp)) == -1) ||
121 ((tmpFile = fopen(tmp,
"w+")) == NULL) ) {
126 std::cerr<<
"Error making temporary file " 139 tmpFileName +=
".gdml";
143 gdmlFile = fopen(tmpFileName.c_str(),
"w+");
144 if (gdmlFile == NULL){
148 remove(tmpFileName.c_str());
149 std::cerr<<
"Error making temporary file " 155 fputs (gdmlInfo.c_str(), gdmlFile);
176 remove(fileName.c_str());
192 std::ifstream geoFile(fname.c_str());
195 if (geoFile.is_open()){
196 while (geoFile.good()){
197 getline(geoFile, line);
211 size_t lastSlash = fname.find_last_of(
"/");
214 fname =
"Geometry/gdml/"+basename;
219 <<
"cannot find GDML file " << fname <<
" bail ungracefully\n" 220 << __FILE__ <<
":" << __LINE__ <<
"\n";
232 int old_verbosity = gGeoManager->GetVerboseLevel();
236 gGeoManager->SetVerboseLevel(0);
240 if (gdmlfile.empty() ||
stat(gdmlfile.c_str(), &sb)!=0) {
243 <<
"empty GDML string " << gdmlfile <<
" bail ungracefully\n" 244 << __FILE__ <<
":" << __LINE__ <<
"\n";
247 for (
unsigned int i=0;
i<
fPlanes.size(); ++
i) {
255 TGeoManager::Import(gdmlfile.c_str());
259 std::vector<const TGeoNode*>
n(16);
260 n[0] = gGeoManager->GetTopNode();
292 <<
"Detector geometry loaded from " << gdmlfile;
297 gGeoManager->SetVerboseLevel(old_verbosity);
315 size_t lastSlash =
fGDMLFile.find_last_of(
"/");
319 almost.resize(almost.length() - 5);
339 << __FILE__ <<
":" << __LINE__ <<
"\n";
353 if(path.find(
"Cell") == std::string::npos){
354 LOG_DEBUG(
"Geometry") <<
"no Cell in the path to the current volume:" << path <<
std::endl;
357 if(path.find(
"HAirBubble") != std::string::npos){
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]);
397 double dxds,
double dyds,
double dzds,
405 gGeoManager->InitTrack(x, y, z, dxds, dyds, dzds);
406 gGeoManager->FindNextBoundary(1.
E-6);
408 if (ID != 0)
return ID;
417 const double eps_s = eps*
s;
422 gGeoManager->InitTrack(x-dxds*eps_s, y-dyds*eps_s, z-dzds*eps_s, dxds, dyds, dzds);
423 gGeoManager->FindNextBoundary(1.
E-6);
425 if (ID != 0)
return ID;
429 gGeoManager->InitTrack(x+dxds*eps_s, y+dyds*eps_s, z+dzds*eps_s, dxds, dyds, dzds);
431 if (ID != 0)
return ID;
445 const TGeoNode*
node = gGeoManager->FindNode(x,y,z);
446 return node->GetMedium()->GetMaterial();
455 if (scint == m->GetName())
return true;
517 <<
"Bad geometry configuration: " << (
int)
fDetId <<
"\n" 518 << __FILE__ <<
":" << __LINE__ <<
"\n";
551 <<
"Bad geometry configuration: " <<
fDetId <<
"\n" 552 << __FILE__ <<
":" << __LINE__ <<
"\n";
578 <<
"Bad geometry configuration: " <<
fDetId <<
"\n" 579 << __FILE__ <<
":" << __LINE__ <<
"\n";
597 double* zlo,
double* zhi)
const {
598 const TGeoShape*
s = gGeoManager->GetVolume(
"vWorld")->GetShape();
603 s->GetAxisRange(1,x1,x2);
if (xlo) *xlo =
x1;
if (xhi) *xhi =
x2;
607 s->GetAxisRange(2,y1,y2);
if (ylo) *ylo =
y1;
if (yhi) *yhi =
y2;
611 s->GetAxisRange(3,z1,z2);
if (zlo) *zlo = z1;
if (zhi) *zhi = z2;
629 double* zlo,
double* zhi)
const {
630 const TGeoShape*
s = gGeoManager->GetVolume(
"vDetEnclosure")->GetShape();
635 s->GetAxisRange(1,x1,x2);
if (xlo) *xlo =
x1;
if (xhi) *xhi =
x2;
639 s->GetAxisRange(2,y1,y2);
if (ylo) *ylo =
y1;
if (yhi) *yhi =
y2;
643 s->GetAxisRange(3,z1,z2);
if (zlo) *zlo = z1;
if (zhi) *zhi = z2;
660 double* zlo,
double* zhi)
const {
707 const char*
nm = n[depth]->GetName();
708 if (strncmp(nm,
"vPlane", 6)==0) {
709 this->
MakePlane(n, depth, inMuonCatcher);
713 if(strncmp(nm,
"vBlockMuon", 10) == 0) inMuonCatcher =
true;
716 unsigned int deeper = depth+1;
717 if (deeper>=n.size()) {
719 <<
"Exceeded maximum depth (" << n.size() <<
") " << deeper <<
"\n" 720 << __FILE__ <<
":" << __LINE__ <<
"\n";
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);
752 <<
"Plane index " << i <<
" out of range " <<
fPlanes.size() <<
"\n" 753 << __FILE__ <<
":" << __LINE__ <<
"\n";
775 <<
" iplane " << ip <<
" [0," << this->
NPlanes() <<
")\n" 776 << __FILE__ <<
":" << __LINE__ <<
"\n";
782 <<
" iplane " << ic <<
" [0," << p->
Ncells() <<
")\n" 783 << __FILE__ <<
":" << __LINE__ <<
"\n";
789 if (p->
View() ==
kX) {
return pos[0]; }
790 if (p->
View() ==
kY) {
return pos[1]; }
792 <<
"view " << p->
View() <<
"\n" 793 << __FILE__ <<
":" << __LINE__ <<
"\n";
817 <<
" iplane " << ip <<
" [0," << this->
NPlanes() <<
")\n" 818 << __FILE__ <<
":" << __LINE__ <<
"\n";
822 if (view) *view = p->
View();
826 <<
" iplane " << ic <<
" [0," << p->
Ncells() <<
")\n" 827 << __FILE__ <<
":" << __LINE__ <<
"\n";
834 dpos[0] = c->
HalfW();
835 dpos[1] = c->
HalfL();
836 dpos[2] = c->
HalfD();
838 else if (p->
View() ==
kY) {
839 dpos[0] = c->
HalfL();
840 dpos[1] = c->
HalfW();
841 dpos[2] = c->
HalfD();
863 *iplane = (
int)offline_chan.
Plane();
864 *icell = (
int)offline_chan.
Cell();
865 return this->
Plane(*iplane)->
Cell(*icell);
881 return this->
Plane(*iplane);
895 cell = (
int)offline_chan.
Cell();
901 UIDMap::const_iterator itr =
fIdMap.find(
id);
902 if (itr ==
fIdMap.end()) {
904 <<
"CellUniqueId " <<
id <<
"\n" 905 << __FILE__ <<
":" << __LINE__ <<
"\n";
940 int s = (d>0 ? 1 : -1);
943 for (
unsigned int p2=p1+s; 1;
p2+=
s) {
965 int s = (d>0 ? 1 : -1);
968 for (
unsigned int p2=p1+s; 1;
p2+=
s) {
982 mf::LogWarning(
"GeometryBase") <<
"Requesting muon catcher info for a detector without one";
1003 for (
unsigned int i=0;
i<
fPlanes.size(); ++
i) {
1009 <<
"Bad plane view" <<
fPlanes[
i]->View() <<
", plane " <<
i <<
"\n" 1010 << __FILE__ <<
":" << __LINE__ <<
"\n";
1015 for (
unsigned int i=0;
i<
fPlanes.size(); ++
i) {
1017 for (
unsigned int j=0;
j<p->
Ncells(); ++
j) {
1022 <<
", plane " <<
i <<
", cell " <<
j <<
"\n" 1023 << __FILE__ <<
":" << __LINE__ <<
"\n";
1041 const TGeoVolume *enclosure = gGeoManager->FindVolumeFast(volume);
1043 int old_verbosity = gGeoManager->GetVerboseLevel();
1044 gGeoManager->SetVerboseLevel(0);
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){
1055 name.erase(name.find(
'_'));
1056 mass += gGeoManager->FindVolumeFast(name.c_str())->
Weight();
1059 gGeoManager->SetVerboseLevel(old_verbosity);
1071 std::map <std::string, double>
density;
1072 std::map <std::string, double>
volume;
1073 std::map <std::string, double> mass;
1074 std::map <std::string, double> volume_fiducial;
1075 std::map <std::string, double> mass_fiducial;
1086 for(
unsigned int ipoint = 0; ipoint < number_of_points; ++ipoint){
1089 ROOTGeoManager()->GetGeomPainter()->OpProgress(
"Calculating masses", ipoint, number_of_points-1, &timer, kFALSE);
1095 const double current_position[3] = {
x,
y,z};
1098 const TGeoMaterial* current_material =
Material(x/CLHEP::cm,
1103 const std::string current_material_name = current_material->GetName();
1106 if(density.find(current_material_name) == density.end()){
1107 density [current_material_name] = current_material->GetDensity() * (
CLHEP::g/
CLHEP::cm3);
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;
1115 volume[current_material_name] += cell_volume;
1116 mass [current_material_name] += cell_volume * density[current_material_name];
1120 volume_fiducial[current_material_name] += cell_volume;
1121 mass_fiducial [current_material_name] += cell_volume * density[current_material_name];
1126 std::cout<<
"Calculated masses, volumes etc.:\n";
1129 for(std::map<std::string, double>::iterator iter = density.begin(); iter != density.end(); ++iter) {
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";
1162 double columnD = 0.;
1168 double dxyz[3] = {(p2[0]-p1[0])/length,
1170 (p2[2]-p1[2])/length};
1172 gGeoManager->InitTrack(p1,dxyz);
1173 gGeoManager->FindNextBoundary(1.
E-6);
1176 TGeoNode *
node = gGeoManager->GetCurrentNode();
1181 while(!gGeoManager->IsSameLocation(p2[0], p2[1], p2[2])){
1182 gGeoManager->FindNextBoundary();
1185 gGeoManager->GetStep() *
1186 node->GetMedium()->GetMaterial()->GetDensity();
1190 node = gGeoManager->Step();
1196 const double *current = gGeoManager->GetCurrentPoint();
1200 columnD += length*node->GetMedium()->GetMaterial()->GetDensity();
1210 std::vector<double>&
ds,
1211 std::vector<const TGeoMaterial*>&
m)
const 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;
1219 gGeoManager->InitTrack(p1,d);
1220 gGeoManager->FindNextBoundary(1.
E-6);
1221 TGeoNode *
node = gGeoManager->GetCurrentNode();
1223 while (!gGeoManager->IsSameLocation(p2[0], p2[1], p2[2])) {
1224 gGeoManager->FindNextBoundary();
1229 double step = gGeoManager->GetStep();
1230 if(step < 1.0
e-12)
break;
1233 m.push_back(node->GetMedium()->GetMaterial());
1235 node = gGeoManager->Step();
1237 std::cerr << __FILE__ <<
":" << __LINE__
1238 <<
" Cannot continue tracking MaterialsBetweenPoints(). " 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());
1260 std::vector<double>& ds,
1261 std::vector<const TGeoMaterial*>& m)
const 1263 double p1[3], p2[3];
1283 const TGeoVolume* vvp = gGeoManager->GetVolume(
"vPlaneV");
1284 const TGeoVolume* hvp = gGeoManager->GetVolume(
"vPlaneH");
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");
1299 if (vvp==0 || hvp==0) {
1301 <<
"Warning! BAD_GEO_CONFIG. Unable to find shapes to set detector size\n" 1302 <<
"Now getting the detector size from vDetEnclosure\n";
1305 const TGeoVolume* vdet_enclosure = gGeoManager->GetVolume(
"vDetEnclosure");
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);
1325 const TGeoShape* vp = vvp->GetShape();
1326 const TGeoShape* hp = hvp->GetShape();
1332 double vplanez1, vplanez2;
1333 vp->GetAxisRange(2,vplanez1,vplanez2);
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);
1429 double* exitp)
const 1438 exitp[0] = xyzout[0];
1439 exitp[1] = xyzout[1];
1440 exitp[2] = xyzout[2];
1464 const TVector3& vtx,
1465 const TVector3&
dir,
1470 TVector3* point_in_cell,
1471 TVector3* point_on_track)
const 1481 double p0[3], p1[3];
1489 if (view==
kX) { p0[0] +=
dx; p1[0] +=
dx; }
1490 else if (view==
kY) { p0[1] +=
dx; p1[1] +=
dx; }
1492 TVector3 P0(p0[0], p0[1], p0[2]);
1493 TVector3 P1(p1[0], p1[1], p1[2]);
1497 TVector3 Q1(vtx); Q1 +=
dir;
1518 <<
"GeometryBase::setDetectorID\n";
1557 std::vector<OfflineChan>& xhitsonline,
1558 std::vector<OfflineChan>& yhitsonline)
1560 std::vector<CellOnLine> xhs, yhs;
1563 for(
const CellOnLine&
c: xhs) xhitsonline.push_back(
c.chan);
1564 for(
const CellOnLine&
c: yhs) yhitsonline.push_back(
c.chan);
1573 std::vector<OfflineChan>& xhitsonline,
1574 std::vector<OfflineChan>& yhitsonline)
1577 xhitsonline, yhitsonline);
1587 std::vector<CellOnLine>& xhitsonline, std::vector<CellOnLine>& yhitsonline)
1601 double xyz[3] = {
x1,
y1, z1};
1603 double dxyz[3] = {(x2-
x1)/d, (y2-y1)/
d, (z2-z1)/d};
1605 gGeoManager->InitTrack(xyz, dxyz);
1606 const double*
pos = gGeoManager->GetCurrentPoint();
1608 double dtemp =
util::pythag(pos[0]-x1, pos[1]-y1, pos[2]-z1);
1619 if(strncmp(
"Scintillator", gGeoManager->GetCurrentNode()->GetVolume()->GetMaterial()->GetName(), 12) == 0) {
1622 col.
entry = TVector3(pos[0],pos[1],pos[2]);
1631 gGeoManager->FindNextBoundary();
1632 gGeoManager->Step(kTRUE,kTRUE);
1640 col.
exit = TVector3(pos[0], pos[1], pos[2]);
1643 col.
exit = TVector3(x2, y2, z2);
1647 if(view ==
geo::kX){ xhitsonline.push_back(col); }
1648 if(view ==
geo::kY){ yhitsonline.push_back(col); }
1662 std::vector<CellOnLine>& Xhitsonline,
1663 std::vector<CellOnLine>& Yhitsonline)
1666 Xhitsonline, Yhitsonline);
1675 double v1,
double z1,
1676 double v2,
double z2,
1677 std::vector<OfflineChan>& hitsonline)
1681 std::vector<OfflineChan> junk;
1694 double x2,
double y2,
double z2,
1695 std::vector<OfflineChan>& xhitsonline,
1696 std::vector<OfflineChan>& yhitsonline)
1699 xhitsonline, yhitsonline);
1708 std::vector<OfflineChan>& xhitsonline,
1709 std::vector<OfflineChan>& yhitsonline)
1718 const double z1 = r1.Z();
1719 const double z2 = r2.Z();
1721 const unsigned int planeMax =
fPlanes.size();
1728 const double zc = xyzp[2];
1729 const double dz = geocell0->
HalfD();
1731 if(z1 > zc+dz)
continue;
1733 if(z2 < zc-dz)
break;
1737 const double v1 = r1[
view];
1738 const double v2 = r2[
view];
1740 const double denom = z2-z1;
1741 const double dvdz = denom ? (v2-v1)/denom : 0;
1744 const double zin =
std::max(zc-dz, z1);
1745 double vlo = v1+(zin-z1)*dvdz;
1747 const double zout =
std::min(zc+dz, z2);
1748 double vhi = v1+(zout-z1)*dvdz;
1755 const double vc = xyz[
view];
1758 if(vlo > vc+dv)
continue;
1760 if(vhi < vc-dv)
break;
1780 this->
IdToCell(
id, &planeid, &cellid);
1785 const int kCellsPerModule = 32;
1786 cellid = cellid % kCellsPerModule;
1793 if(cellid < 0 || cellid >= kCellsPerModule)
return 100;
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
1803 return kPigtails[cellid];
novadaq::cnv::DetId fDetId
id for the detector being used
double fFiducialVolumeZLo
T max(const caf::Proxy< T > &a, T b)
#define LOG_DEBUG(stream)
Atom< double > FiducialVolumeYLo
double CellTpos(unsigned int ip, unsigned int ic, double w=0.0) const
void GetCenter(double *xyz, double localz=0.0) const
TVector3 BoosterBeamDirection() const
Direction of neutrinos from the Booster beam (unit vector)
Atom< bool > ForceUseFCLOnly
bool getPlaneAndCellID(const CellUniqueId &id, int &plane, int &cell) const
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...
double fDetectorBigBoxXHi
Dimensions of the DetectorBigBox in cm.
static constexpr double cm3
TGeoMaterial * Material(double x, double y, double z) const
GeometryBase(const Params ¶ms)
double fDetLength
Detector length (cm)
Float_t y1[n_points_granero]
std::string fROOTFile
root file holding the geometry
static constexpr double g
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
void MakePlane(std::vector< const TGeoNode * > &n, unsigned int depth, bool inMuonCatcher)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
const PlaneGeo * IdToPlane(const CellUniqueId &id, int *iplane) const
Float_t x1[n_points_granero]
const CellGeo * Cell(int icell) const
bool calculateMassesLong(const unsigned int number_of_points, CLHEP::HepRandomEngine &engine) const
const CellUniqueId CurrentCellId() const
Vertical planes which measure X.
unsigned int Ncells() const
Number of cells in this plane.
std::string fGDMLFile
gdml file holding the geometry
static constexpr Double_t nm
Table< DetectorParams > tb
Table< DetectorParams > nd
bool fIsDetectorBigBoxUsed
Do we need to use the BigBox cut?
TGeoManager * ROOTGeoManager() const
std::set< unsigned int > fAllPlanes
List of all planes.
double fFiducialVolumeXLo
Atom< double > BigBoxRange
::xsd::cxx::tree::exception< char > exception
Table< DetectorParams > ndos
double MassBetweenPoints(double *p1, double *p2) const
bool ClampRayToDetectorVolume(TVector3 *p0, TVector3 *p1, const GeometryBase *geom)
If either endpoint is outside the detector move it to the edge.
const PlaneGeo * Plane(unsigned int i) const
double fDetHalfHeight
Detector 1/2 height (cm)
std::vector< PlaneGeo * > fPlanes
The detector planes.
void MaterialsBetweenPoints(const double *p1, const double *p2, std::vector< double > &ds, std::vector< const TGeoMaterial * > &mat) const
double fDetHalfWidth
Detector 1/2 width (cm)
std::string find_file(std::string const &filename) const
TVector3 exit
Exit point from cell.
static constexpr double kg
CellUniqueId NodesToUniqueId(const std::vector< const TGeoNode * > &n, unsigned int depth)
double fFiducialVolumeXHi
Horizontal planes which measure Y.
void CellInfo(unsigned int ip, unsigned int ic, View_t *view=0, double *pos=0, double *dpos=0) const
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.
int CurrentCell(int *ip, int *ic) const
const CellUniqueId & Id() const
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
static constexpr double cm
Atom< double > FiducialVolumeXHi
void CountCellsOnLine(double X1, double Y1, double Z1, double X2, double Y2, double Z2, std::vector< OfflineChan > &Xhitsonline, std::vector< OfflineChan > &Yhitsonline)
double DEdge(const double *x0, const double *dx, double *exitp=0) const
View_t View() const
Which coordinate does this plane measure.
Far Detector at Ash River, MN.
Atom< double > FiducialVolumeZLo
Encapsulate the geometry of one entire detector (near, far, ndos)
void WorldBox(double *xlo_cm, double *xhi_cm, double *ylo_cm, double *yhi_cm, double *zlo_cm, double *zhi_cm) const
Prototype Near Detector on the surface at FNAL.
TVector3 entry
Entry point into cell.
bool LoadGeometryFile(std::string gdmlfile, novadaq::cnv::DetId det_id=novadaq::cnv::kUNKNOWN_DET)
In case of unknown ID, guesses from the filename.
std::set< unsigned int > fYplanes
List of Y measuring planes.
UIDMap fIdMap
Unique ID -> Plane,Cell.
void setDetectorBigBox(double detector_bigbox_range)
int getPlaneID(const CellUniqueId &id) const
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Geometry information for a single readout plane.
double fDetectorBigBoxZHi
static std::string FindGDMLFile(std::string fname)
Search for Geometry/gdml/fname in FW_SEARCH_PATH, return full path.
Near Detector in the NuMI cavern.
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
bool isInsideDetectorBigBox(const double x_cm, const double y_cm, const double z_cm) const
Is the particle inside the detector Big Box?
Collect Geo headers and supply basic geometry functions.
CoordinateTransformation fCoordinateTransformation
Coordinate Transformation class.
double fDetectorBigBoxXLo
Atom< double > FiducialVolumeYHi
double fDetectorBigBoxYLo
double fFiducialVolumeZHi
double DetHalfHeight() const
double fBigBoxRange
Range of big box.
static constexpr double m3
Atom< std::string > StoreTempGeo
static const double ns
Module that plots metrics from reconstructed cosmic ray data.
static bool plane_sort(const PlaneGeo *p1, const PlaneGeo *p2)
A very simple service to remember what detector we're working in.
void FindPlanes(std::vector< const TGeoNode * > &n, unsigned int depth, bool inMuonCatcher=false)
unsigned short Plane() const
std::vector< PlaneGeo * > fPlanesInMuonCatcher
Same pointers as fPlanes.
double GetPigtail(const CellUniqueId &id) const
Return length of fiber in cm from end of cell to apd.
TVector3 NuMIBeamDirection() const
Direction of neutrinos from the NuMI beam (unit vector)
unsigned long long int CellUniqueId
std::set< unsigned int > fXplanes
List of X measuring planes.
double fDetectorBigBoxZLo
OfflineChan chan
Channel passed through by line.
Atom< double > FiducialVolumeXLo
double TotalMass(const char *volume="vDetEnclosure") const
unsigned short Cell() const
int MakeTmpFile(std::string gdmlInfo)
double DetHalfWidth() const
Table< DetectorParams > fd
double ClosestApproach(const double point[], const double intercept[], const double slopes[], double closest[])
Find the distance of closest approach between point and line.
double DistToElectronics(double localz, const CellGeo &cell) const
get distance from local z position in cell to apd in cm, including pigtail
double pythag(double x, double y)
2D Euclidean distance
void FiducialBox(TVector3 &r0, TVector3 &r1) const
Atom< double > FiducialVolumeZHi
const unsigned int NextPlaneInView(unsigned int p, int d=+1) 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.
const std::set< unsigned int > & GetPlanesByView(View_t v=kXorY) const
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
assert(nhit_max >=nhit_nbins)
int getCellID(const CellUniqueId &id) const
std::string ExtractGDML() const
Extract contents from fGDMLFile and return as a string.
bool IntersectsDetector(double *xyz_cm, double *dxyz) const
void DetectorEnclosureBox(double *xlo_cm, double *xhi_cm, double *ylo_cm, double *yhi_cm, double *zlo_cm, double *zhi_cm) const
double fDetectorBigBoxYHi
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.
Atom< std::string > GDMLFile
unsigned int NPlanes() const
T min(const caf::Proxy< T > &a, T b)
double fFiducialVolumeYHi
std::string fGDMLFromFCL
keep track of original fcl parameter
bool IntersectsBigBox(double *xyz_cm, double *dxyz) const
const CellGeo * IdToCell(const CellUniqueId &id, int *iplane, int *icell) const
Encapsulate the cell geometry.
double fFiducialVolumeYLo
geo::OfflineChan getPlaneCellMap(const CellUniqueId &id) const
bool IsActive(const TGeoMaterial *m) const
bool isInsideFiducialVolume(const double x_cm, const double y_cm, const double z_cm) const
Is the particle inside the detector Fiducial Volume?
virtual void setDetectorID(novadaq::cnv::DetId)
Method to set DetectorID.
const unsigned int NextPlaneOtherView(unsigned int p, int d=+1) const
void DetectorBigBox(double *xlo_cm, double *xhi_cm, double *ylo_cm, double *yhi_cm, double *zlo_cm, double *zhi_cm) const
std::string FileBaseName() const
void RemoveTmpFile(std::string fileName)
Method to remove temporary file that holds detector geometry file.
const unsigned int FirstPlaneInMuonCatcher() const
Returns the index of the first plane contained in the muon catcher.