17 #include "DAQChannelMap/DAQChannelMap.h" 26 #include "TGeoManager.h" 48 mf::LogInfo(
"LiveGeometry") <<
"LiveGeometry found " 59 for(
int i = 0;
i<12;
i++) {
60 for(
int j = 0;
j<14;
j++) {
86 bool badxz=
false, badyz =
false, edgexz=
false, edgeyz=
false;
91 LOG_DEBUG(
"LiveGeometry") <<
"outside of the detector";
113 if(edgexz&&edgeyz) info = 5;
114 if(edgexz||edgeyz) info = 4;
118 else if(badxz&&edgexz) {
122 else if(badyz&&edgeyz) {
126 else if(badxz||badyz) {
141 <<
", " << vertex.Y()
142 <<
", " << vertex.Z()
143 <<
") is not live, info: " 152 double tdist, mindist = 9999999;
153 int wall = 0, twall = 0;
160 else if(dir.Z() < 0) {
167 if(tdist < mindist) {
176 else if(dir.Y() < 0) {
181 if(tdist < mindist) {
190 else if(dir.X() < 0) {
195 if(tdist < mindist) {
206 double distToEdge, distToNextBad, distDead;
207 if(
ProjectedDistance(vertex, dir, distToEdge, distToNextBad, distDead))
return(distToEdge);
213 double distToEdge, distToNextBad, distDead;
215 if(
ProjectedDistance(vertex, dir, distToEdge, distToNextBad, distDead))
return(distToNextBad);
221 double distToEdge, distToNextBad, distDead;
222 if(
ProjectedDistance(vertex, dir, distToEdge, distToNextBad, distDead))
return(distToEdge-distDead);
231 float minedgedist = 999999.0, minbaddist=99999.0, tdist;
240 distToNextBad = -999.;
244 if(dir.Z() >= 0)
return false;
246 if(tdist < minedgedist) minedgedist = tdist;
250 if(dir.Z() <= 0)
return false;
252 if(tdist < minedgedist) minedgedist = tdist;
256 if(dir.Y() <= 0)
return false;
258 if(tdist < minedgedist) minedgedist = tdist;
261 if(dir.Y() >= 0)
return false;
263 if(tdist < minedgedist) minedgedist = tdist;
267 if(dir.X() <= 0)
return false;
269 if(tdist < minedgedist) minedgedist = tdist;
273 if(dir.X() >= 0)
return false;
275 if(tdist < minedgedist) minedgedist = tdist;
278 distToEdge = -minedgedist;
279 distToNextBad = -minedgedist;
290 distToNextBad = -9999.;
294 if(tdist < minedgedist) minedgedist = tdist;
296 if(dir.Y() > 0) tdist = (
fEdgeTopYZ-vertex.Y())/dir.Y();
297 else if(dir.Y() < 0) tdist = (
fEdgeBottomYZ-vertex.Y())/dir.Y();
299 if(tdist < minedgedist) minedgedist = tdist;
301 if(dir.X() > 0) tdist = (
fEdgeXPlusXZ-vertex.X())/dir.X();
302 else if(dir.X() < 0) tdist = (
fEdgeXMinusXZ-vertex.X())/dir.X();
304 if(tdist < minedgedist) minedgedist = tdist;
313 tdist = (xyz[2] - vertex.Z())/dir.Z();
315 if(tdist < minbaddist && tdist > 0) minbaddist = tdist;
317 else if(tdist < minedgedist && tdist > 0) minedgedist = tdist;
322 tdist = (xyz[2] - vertex.Z())/dir.Z();
324 if(tdist < minbaddist && tdist > 0) minbaddist = tdist;
326 else if(tdist < minedgedist && tdist > 0) minedgedist = tdist;
331 tdist = (xyz[2] - vertex.Z())/dir.Z();
333 if(tdist < minbaddist && tdist > 0) minbaddist = tdist;
335 else if(tdist < minedgedist && tdist > 0) minedgedist = tdist;
340 tdist = (xyz[2] - vertex.Z())/dir.Z();
342 if(tdist < minbaddist && tdist > 0) minbaddist = tdist;
344 else if(tdist < minedgedist && tdist > 0) minedgedist = tdist;
352 tdist = (xyz[2] - vertex.Z())/dir.Z();
354 if(tdist < minbaddist && tdist > 0) minbaddist = tdist;
356 else if(tdist < minedgedist && tdist > 0) minedgedist = tdist;
361 tdist = (xyz[2] - vertex.Z())/dir.Z();
363 if(tdist < minbaddist && tdist > 0) minbaddist = tdist;
365 else if(tdist < minedgedist && tdist > 0) minedgedist = tdist;
370 tdist = (xyz[2] - vertex.Z())/dir.Z();
372 if(tdist < minbaddist && tdist > 0) minbaddist = tdist;
374 else if(tdist < minedgedist && tdist > 0) minedgedist = tdist;
379 tdist = (xyz[2] - vertex.Z())/dir.Z();
381 if(tdist < minbaddist && tdist > 0) minbaddist = tdist;
383 else if(tdist < minedgedist && tdist > 0) minedgedist = tdist;
387 distToEdge = minedgedist;
392 else distToNextBad =
std::min(minbaddist,minedgedist);
394 if(distToNextBad >= distToEdge) {
406 unsigned int maxstep = 100000;
407 for(
unsigned int istep = 0; istep < maxstep; istep++) {
408 position = position + ss*
dir;
411 if(info==5||info==4||info==2||info==0) {
412 if(distToNextBad == 0) distToEdge = minbaddist+ss*istep;
415 if(info==3) distDead+=
ss;
416 if(info==1) distDead+=ss/2.0;
419 if(info==5||info==4||info==3) distDead+=
ss;
420 else distDead+=ss/2.0;
439 double distToEdge, distToNextBad, distDead;
441 TVector3 r2 = vertex + distToEdge*
dir;
442 std::vector< OfflineChan > xhits, yhits;
444 return(xhits.size() + yhits.size());
453 double distToEdge, distToNextBad, distDead;
456 TVector3 r2 = vertex + distToNextBad*
dir;
457 std::vector< OfflineChan > xhits, yhits;
459 return(xhits.size() + yhits.size());
468 double distToEdge, distToNextBad, distDead;
470 TVector3 r2 = vertex + distToEdge*
dir;
471 std::vector< OfflineChan > xhits, yhits;
473 int nlivecells = (xhits.size() + yhits.size()) * (1- (distDead/distToEdge) ) + 1;
508 double fDistBack = 0;
721 for(
int i = 0;
i<12;
i++) {
722 for(
int j = 0;
j<14;
j++) {
783 int numinst[14][12] = {{0}};
785 for(
int i = 0;
i<12;
i++) {
786 for(
int j = 0;
j<14;
j++) {
792 for(
int idib = 0; idib < RunHist->
NDiBlocks(); idib++) {
796 for(
int idcm = 0; idcm <
int(dib.
dcm.size()); idcm++) {
804 for(
int idcm = 0; idcm <
fNumDCMs; idcm++) {
806 else if(numinst[idib][idcm] < 56)
fDCMs[idcm][idib] = 2;
834 std::cout<<
"GetBCInfo() has incorrect mapping for TestBeam. Setting NBadChan and NDropouts to zero!"<<
std::endl;
846 int jplane, jcell1, jcell2;
848 int nbadDCM[12] = {0};
849 int nbadcount[12] = {0};
851 for(
int idcm = 0; idcm < fNumDCMs/2; idcm++) {
852 if(
fDCMs[idcm][idib]==1) {
853 for(
int iplane = 0; iplane < 32; iplane++) {
856 jplane = (idib*64) + (2*iplane) + 1;
857 for(
int icell = 0; icell < 32; icell++) {
858 jcell1 = icell + 64*idcm;
859 jcell2 = icell + 32 + 64*idcm;
860 if(BadList->
IsBad(jplane,jcell1)) nfeb1++;
861 if(BadList->
IsBad(jplane,jcell2)) nfeb2++;
863 if(nfeb1 > 6) nbadDCM[idcm]++;
864 if(nfeb2 > 6) nbadDCM[idcm]++;
865 nbadcount[idcm]+=(nfeb1+nfeb2);
870 for(
int idcm = fNumDCMs/2; idcm <
fNumDCMs; idcm++) {
871 if(
fDCMs[idcm][idib]==1) {
872 for(
int iplane = 0; iplane < 32; iplane++) {
875 jplane = (idib*64) + (2*iplane);
876 for(
int icell = 0; icell < 32; icell++) {
877 jcell1 = icell + 64*(11-idcm);
878 jcell2 = icell + 32 + 64*(11-idcm);
879 if(BadList->
IsBad(jplane,jcell1)) nfeb1++;
880 if(BadList->
IsBad(jplane,jcell2)) nfeb2++;
882 if(nfeb1 > 6) nbadDCM[idcm]++;
883 if(nfeb2 > 6) nbadDCM[idcm]++;
884 nbadcount[idcm]+=(nfeb1+nfeb2);
889 for(
int idcm = 0; idcm <
fNumDCMs; idcm++) {
892 if(idcm==0||idcm==3) {
893 if(nbadDCM[idcm] > 4 &&
fDCMs[idcm][idib]==1) {
894 fDCMs[idcm][idib] = 0;
898 else if((nbadDCM[idcm] > 8) &&
fDCMs[idcm][idib]==1) {
899 fDCMs[idcm][idib] = 0;
903 else if((nbadDCM[idcm] > 8) &&
fDCMs[idcm][idib]==1) {
904 fDCMs[idcm][idib] = 0;
908 std::cout <<
"LiveGeometry: fDCMs: dib " << idib+1 <<
" DCM " << idcm+1 <<
" value " <<
fDCMs[idcm][idib] <<
" # bc: " << nbadcount[idcm] <<
" # bad FEBs " << nbadDCM[idcm] <<
" count of bad DCMs: " <<
fNBadChan <<
std::endl;
920 double xyz1[3], xyz2[3];
1015 int DCM[12][14] = {{0}};
1031 double xyz1[3], xyz2[3];
1040 for(
int idcm = 0; idcm < fNumDCMs/2; idcm++) {
1041 if(
fDCMs[idcm][idib]!=2) xzview[idib] =
false;
1043 if(xzview[idib]==
true)
for(
int idcm = 0; idcm < fNumDCMs/2; idcm++) {
1044 DCM[idcm][idib] = 1;
1046 for(
int idcm = fNumDCMs/2; idcm <
fNumDCMs; idcm++) {
1047 if(
fDCMs[idcm][idib]!=2) yzview[idib] =
false;
1049 if(yzview[idib]==
true)
for(
int idcm = fNumDCMs/2; idcm <
fNumDCMs; idcm++) {
1050 DCM[idcm][idib] = 1;
1057 for(
int idib = 0; idib<fNumDiblocks+1; idib++) {
1059 if(xzview[idib]==
false||idib==fNumDiblocks) {
1060 if(cstart==-5)
continue;
1061 else if(cstart>=0) {
1065 tBox.
Z1 = xyz1[2]-3.5;
1066 tBox.
XY2 = xyz1[0]+2.3;
1068 tBox.
Z2 = xyz1[2]+3.5;
1069 tBox.
XY1 = xyz1[0]-2.3;
1078 if(xzview[idib]==
true) {
1088 for(
int idib = 0; idib<fNumDiblocks+1; idib++) {
1090 if(yzview[idib]==
false||idib==fNumDiblocks) {
1091 if(cstart==-5)
continue;
1092 else if(cstart>=0) {
1097 tBox.
Z1 = xyz1[2]-3.5;
1099 tBox.
XY2 = xyz1[1]+2.3;
1101 tBox.
Z2 = xyz1[2]+3.5;
1103 tBox.
XY1 = xyz1[1]-2.3;
1112 if(yzview[idib]==
true) {
1125 for(
int idcm = 0; idcm < fNumDCMs/2; idcm++) {
1126 if(DCM[idcm][idib]==0) {
1130 tBox.
Z1 = xyz1[2]-3.5;
1131 tBox.
Z2 = xyz2[2]+3.5;
1132 tBox.
XY1 = (xyz1[0]+xyz2[0])/2.0 - 2.3;
1135 tBox.
XY2 = (xyz1[0]+xyz2[0])/2.0 + 2.3;
1136 if(
fDCMs[idcm][idib] == 2) tBox.
type = 0;
1138 bool connected =
true;
1140 if(idib==13 || idib == 0 || idcm == 0 || idcm == 5) tBox.
edge =
true;
1143 if(DCM[idcm][
i]==1) connected =
false;
1145 if(connected ==
true) tBox.
edge =
true;
1147 for(
int i = 0;
i < idib;
i++) {
1148 if(DCM[idcm][
i]==1) connected =
false;
1150 if(connected ==
true) tBox.
edge =
true;
1152 for(
int i = 0;
i < idcm;
i++) {
1153 if(DCM[
i][idib]==1) connected =
false;
1155 if(connected ==
true) tBox.
edge =
true;
1157 for(
int i = idcm+1;
i < fNumDCMs/2;
i++) {
1158 if(DCM[
i][idib]==1) connected =
false;
1160 if(connected ==
true) tBox.
edge =
true;
1172 tBox.
Z1 = xyz1[2]-3.5;
1173 tBox.
Z2 = xyz2[2]+3.5;
1174 tBox.
XY1 = (xyz1[0]+xyz2[0])/2.0 - 2.3;
1177 tBox.
XY2 = (xyz1[0]+xyz2[0])/2.0 + 2.3;
1178 if(
fDCMs[idcm][idib] == 2) tBox.
type = 0;
1188 for(
int idcm = fNumDCMs/2; idcm <
fNumDCMs; idcm++) {
1189 if(DCM[idcm][idib]==0) {
1193 tBox.
Z1 = (xyz1[2]+xyz2[2])/2.0 - 3.5;
1195 tBox.
XY1 = (xyz1[1]+xyz2[1])/2.0 - 2.3;
1197 tBox.
Z2 = (xyz1[2]+xyz2[2])/2.0 + 3.5;
1199 tBox.
XY2 = (xyz1[1]+xyz2[1])/2.0 + 2.3;
1200 if(
fDCMs[idcm][idib] == 2) tBox.
type = 0;
1202 bool connected =
true;
1204 if(idib==13 || idib == 0 || idcm == fNumDCMs/2 || idcm == fNumDCMs) tBox.
edge =
true;
1206 if(DCM[idcm][
i]==1) connected =
false;
1208 if(connected ==
true) tBox.
edge =
true;
1210 for(
int i = 0;
i < idib;
i++) {
1211 if(DCM[idcm][
i]==1) connected =
false;
1213 if(connected ==
true) tBox.
edge =
true;
1215 for(
int i = fNumDCMs/2;
i < idcm;
i++) {
1216 if(DCM[
i][idib]==1) connected =
false;
1218 if(connected ==
true) tBox.
edge =
true;
1221 if(DCM[
i][idib]==1) connected =
false;
1223 if(connected ==
true) tBox.
edge =
true;
1230 tBox.
Z1 = (xyz1[2]+xyz2[2])/2.0 - 3.5;
1232 tBox.
XY1 = (xyz1[1]+xyz2[1])/2.0 - 2.3;
1234 tBox.
Z2 = (xyz1[2]+xyz2[2])/2.0 + 3.5;
1236 tBox.
XY2 = (xyz1[1]+xyz2[1])/2.0 + 2.3;
1241 tBox.
Z1 = (xyz1[2]+xyz2[2])/2.0 - 3.5;
1243 tBox.
XY1 = (xyz1[1]+xyz2[1])/2.0 - 2.3;
1245 tBox.
Z2 = (xyz1[2]+xyz2[2])/2.0 + 3.5;
1247 tBox.
XY2 = (xyz1[1]+xyz2[1])/2.0 + 2.3;
1250 if(
fDCMs[idcm][idib] == 2) tBox.
type = 0;
1292 int dibs[14] = {0}, dibsUD[14] = {0}, dibsRH[14] = {0};
1297 for(
int idib = RunHist->
NDiBlocks()-1; idib >= 0; idib--) {
1305 if(dibsUD[
i]==1&&dibsRH[
i]==1) dibs[
i]=1;
1327 for (
int i = fNumDiblocks-1;
i>=0;
i--) {
1407 if(backDwnstrm>0&&backUpstrm>0)
return 2;
1408 else if(backDwnstrm>0&&backUpstrm==0)
return 1;
1417 std::cout <<
"You are trying to use a near detector only function, but this isn't a near detector file!" <<
std::endl;
1432 std::cout <<
"You are trying to use a near detector only function, but this isn't a near detector file!" <<
std::endl;
1435 if(dir.Z() < 0 && vertex.Z() <
fMCFront)
return 0;
1436 if(dir.Z() > 0 && vertex.Z() >
fMCFront)
return 0;
1437 double xyz[3], dxyz[3];
1438 xyz[0] = vertex.X();
1439 xyz[1] = vertex.Y();
1440 xyz[2] = vertex.Z();
1459 std::cout <<
"You are trying to use a near detector only function, but this isn't a near detector file!" <<
std::endl;
1463 double distX, distY, distZ;
1467 if(dir.Z() > 0) distZ = (
fMCBack-vertex.Z())/dir.Z();
1468 else if(dir.Z() < 0) distZ = (
fMCFront-vertex.Z())/dir.Z();
1473 if(dir.Y() > 0) distY = (
fMCTop-vertex.Y())/dir.Y();
1474 else if(dir.Y() < 0) distY = (-
fMCEdge-vertex.Y())/dir.Y();
1475 else distY = 999999;
1477 if(dir.X() > 0) distX = (
fMCEdge-vertex.X())/dir.X();
1478 else if(dir.X() < 0) distX = (-
fMCEdge-vertex.X())/dir.X();
1479 else distX = 999999;
1485 if(vertex.Z() >
fMCFront)
return 0;
1486 if(dir.Z() < 0)
return 0;
1490 TVector3 vertex2(Xtran, Ytran,
fMCFront+0.01);
1492 std::cout <<
"Something weird with muon catcher distance projection in LiveGeometry... email this situation to bays@caltech.edu" <<
std::endl;
1507 std::cout <<
"You are trying to use a near detector only function, but this isn't a near detector file!" <<
std::endl;
1511 std::vector< OfflineChan > xhits, yhits;
1516 return xhits.size() + yhits.size();
1520 if(vertex.Z() >
fMCFront)
return 0;
1521 if(dir.Z() < 0)
return 0;
1525 TVector3 vertex2(Xtran, Ytran,
fMCFront+0.01);
1527 std::cout <<
"Something weird with muon catcher distance projection in LiveGeometry... email this situation to bays@caltech.edu" <<
std::endl;
1542 std::cout <<
"You are trying to use a near detector only function, but this isn't a near detector file!" <<
std::endl;
1546 double xyz[3], dxyz[3];
1547 xyz[0] = vertex.X();
1548 xyz[1] = vertex.Y();
1549 xyz[2] = vertex.Z();
1561 for(
int i = 0;
i<100;
i++) {
1575 std::cout <<
"You are trying to use a near detector only function, but this isn't a near detector file!" <<
std::endl;
1578 if(dir.Z() == 0)
return -9999;
1579 return vertex.X() + dir.X()*(
fMCFront-vertex.Z())/dir.Z();
1587 std::cout <<
"You are trying to use a near detector only function, but this isn't a near detector file!" <<
std::endl;
1590 if(dir.Z() == 0)
return -9999;
1591 return vertex.Y() + dir.Y()*(
fMCFront-vertex.Z())/dir.Z();
1599 std::cout <<
"You are trying to use a near detector only function, but this isn't a near detector file!" <<
std::endl;
1604 double mindist = 9999;
1606 if(mindist > (
fMCEdge+vertex.X())) {
1611 if(mindist > (
fMCEdge-vertex.X())) {
1616 if(mindist > (
fMCEdge+vertex.Y())) {
1621 if(mindist > (
fMCTop-vertex.Y())) {
1622 mindist =
fMCTop-vertex.Y();
1626 if(mindist > (
fMCBack-vertex.Z())) {
1639 std::cout <<
"You are trying to use a near detector only function, but this isn't a near detector file!" <<
std::endl;
1642 std::vector< OfflineChan > xhits, yhits;
1643 TVector3
out = vertex;
1645 if(wall == 0)
return 0;
1646 if(wall == 1) out.SetX(vertex.X()+
dist);
1647 if(wall == 2) out.SetX(vertex.X()-
dist);
1648 if(wall == 3) out.SetY(vertex.Y()+
dist);
1649 if(wall == 4) out.SetY(vertex.Y()-
dist);
1650 if(wall == 6) out.SetZ(vertex.Z()+
dist);
1652 return xhits.size()+yhits.size();
1660 std::cout <<
"You are trying to use a near detector only function, but this isn't a near detector file!" <<
std::endl;
1666 TVector3 posattrans;
1667 posattrans.SetX(vertex.X() + dir.X()*(
fMCFront-vertex.Z())/dir.Z());
1668 posattrans.SetY(vertex.Y() + dir.Y()*(
fMCFront-vertex.Z())/dir.Z());
1671 TVector3 posatmctop;
1672 posatmctop.SetX(vertex.X() + dir.X()*(
fMCTop-vertex.Y())/dir.Y());
1674 posatmctop.SetZ(vertex.Z() + dir.Z()*(
fMCTop-vertex.Y())/dir.Y());
1676 if(dir.Z() > 0 && vertex.Z() >
fMCFront) posattrans = vertex;
1677 if(dir.Z() < 0 && vertex.Z() >
fMCFront) posatmctop = vertex;
1679 return (posatmctop-posattrans).Mag();
1687 std::cout <<
"You are trying to use a near detector only function, but this isn't a near detector file!" <<
std::endl;
1693 double p1[3] = {0},
p2[3], linedist;
1709 p2[0] = p1[0] + linedist*dir.X();
1710 p2[1] = p1[1] + linedist*dir.Y();
1711 p2[2] = p1[2] + linedist*dir.Z();
1713 std::vector< double >
ds;
1714 std::vector < const TGeoMaterial * >
mat;
1718 double steeldist = 0;
1720 for(
unsigned int i = 0;
i < mat.size();
i++) {
1721 if(strncmp(
"Steel",mat[
i]->
GetName(),5) == 0){
1755 if(
fDCMs[dcm-1][dib-1]==2)
return 0;
1756 if(
fDCMs[dcm-1][dib-1]==0)
return 2;
1757 if(
fDCMs[dcm-1][dib-1]==1)
return 1;
1777 double mindist = 999999, tdist;
1788 if(tdist < mindist) mindist = tdist;
1791 if(tdist < mindist) mindist = tdist;
1794 if(tdist < mindist) mindist = tdist;
1797 if(tdist < mindist) mindist = tdist;
1800 if(tdist < mindist) mindist = tdist;
1803 if(tdist < mindist) mindist = tdist;
1810 if(tdist < mindist) mindist = tdist;
1815 if(tdist < mindist) mindist = tdist;
1822 if(tdist < mindist) mindist = tdist;
1831 if(tdist < mindist) mindist = tdist;
1836 if(tdist < mindist) mindist = tdist;
1843 if(tdist < mindist) mindist = tdist;
int PlanesToEdge(TVector3 vertex)
T max(const caf::Proxy< T > &a, T b)
#define LOG_DEBUG(stream)
const XML_Char XML_Encoding * info
void preBeginEvent(art::Event const &evt)
double GetBadBoxCorner(bool view, int coord, int i)
Get the corner of a bad box (hook for evend display)
int NDiBlocks()
gives number of active diblocks only, may be less than 14
void GetCenter(double *xyz, double localz=0.0) const
int CellsToEdgeY(TVector3 vertex)
double fMCTop
muon catcher boundaries
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...
unsigned int type
0 means uninstrumented, 1 means bad
bool IsDiBlockFullyInstrumented(int idb)
returns true if nInstrumentedFEBs in diblock (which counts FEBs that are instrumented, active, and unmasked only) is >= 700
fvar< T > fabs(const fvar< T > &x)
LiveGeometry(const Parameters ¶ms, art::ActivityRegistry ®)
double ProjectedSteelDist(TVector3 vertex, TVector3 dir)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
#define DEFINE_ART_SERVICE(svc)
int CellsToEdgeXMinus(TVector3 vertex)
double DistToEdgeXY(TVector3 vertex)
double DistToEdgeY(TVector3 vertex)
const CellGeo * Cell(int icell) const
The instrumented geometry of one entire detector (near, far, ipnd)
DiBlock GetDiBlock(int i, bool loadAll=true)
get ith diblock is RH list (which only includes diblocks with activity), starting with i=0...
int NumBadBoxesX()
Size of the vector of bad boxes in the XZ view.
int CellsToTop(TVector3 vertex)
int CellsToBottom(TVector3 vertex)
int ProjectedCellsToNextBadRegion(TVector3 vertex, TVector3 dir)
double DistanceToEdgeInMC(TVector3 vertex, int &wall)
GlobalSignal< detail::SignalResponseType::LIFO, void(SubRun const &)> sPostBeginSubRun
bool fSetup
have we done setup yet this run
double DistToClosestBadRegion(TVector3 vertex)
double DistToEdgeX(TVector3 vertex)
double DistToFront(TVector3 vertex)
std::vector< BadBox > fBadBoxYZ
const PlaneGeo * Plane(unsigned int i) const
double DistToBack(TVector3 vertex)
double LiveDetectorVolume()
in ktons
int ProjectedCellsToEdge(TVector3 vertex, TVector3 dir)
void MaterialsBetweenPoints(const double *p1, const double *p2, std::vector< double > &ds, std::vector< const TGeoMaterial * > &mat) const
void GetBCInfo()
Get bad regions from BadChannels.
int ProjectedLiveCellsToEdge(TVector3 vertex, TVector3 dir)
recommended projection to use
float Z1
point 1 for minima, point 2 for maxima
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 ProjectToBoxEdgeFromOutside(const double xyz[], const double dxyz[], int axis, double edge, double xyzout[])
Project from a position outside of a box to an edge of the box with coordinate value edge for the axi...
void postBeginSubRun(art::SubRun const &subrun)
bool ProjectedDistance(TVector3 vertex, TVector3 dir, double &distToEdge, double &distToNextBad, double &distDead)
double DistToTop(TVector3 vertex)
fhicl::Atom< bool > CheckBadChannels
double InstrumentedDetLength()
get instrumented detector length of downstream part
double ProjectedLiveDistanceToEdge(TVector3 vertex, TVector3 dir)
Far Detector at Ash River, MN.
std::string GetName(int i)
void SetInstrumentation()
calculate the detector end information
int ProjectedCellsInMC(TVector3 vertex, TVector3 dir)
double DistToBottom(TVector3 vertex)
double DistToEdgeZ(TVector3 vertex)
double fEdgeBottomYZ
proper 2D detector boundaries in YZ
int CellsToEdgeXY(TVector3 vertex)
double YPositionAtTransition(TVector3 vertex, TVector3 dir)
double InstrumentedDetFront()
get instrumented detector front of downstream part
std::vector< BadBox > fBadBoxXZ
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
void GetEvInfo()
Get event by event information.
int FullNDProjectedCells(TVector3 vertex, TVector3 dir)
Near Detector in the NuMI cavern.
int CellsToEdgeInMC(TVector3 vertex, int &wall)
Collect Geo headers and supply basic geometry functions.
double InstrumentedDetBack()
get instrumented detector back of downstream part
bool fEvFlag
have we read in information for this event yet? (don't use preBeginEvent since race w/ BadChan) ...
int CellsToEdgeXPlus(TVector3 vertex)
void GetRHInfo()
Get uninstrumented regions from RunHistory.
bool IsPointLiveInfo(TVector3 vertex, int &info)
Note the muon catcher is considered bad; use in combination with InMuonCatcher if needed...
void SetupLiveGeo()
Necessary set up before anything; get boudnaries, find and fill bad boxes.
void GetDetectorEdges()
Get proper detector boundaries for each view.
A very simple service to remember what detector we're working in.
int CellsToEdgeX(TVector3 vertex)
int ProjectedWall(TVector3 vertex, TVector3 dir)
if we assume the downstream InstrumentedDetEnds, what wall would this projected track exit from...
fhicl::Atom< bool > Verbose
double ProjectedDistanceInMC(TVector3 vertex, TVector3 dir)
double DistToEdgeXMinus(TVector3 vertex)
double ProjectedDistanceToNextBadRegion(TVector3 vertex, TVector3 dir)
GlobalSignal< detail::SignalResponseType::FIFO, void(Event const &)> sPreProcessEvent
bool edge
are we connected to the detector edge?
bool IsPointLive(TVector3 vertex)
Note the muon catcher is considered bad; use in combination with InMuonCatcher if needed...
double XPositionAtTransition(TVector3 vertex, TVector3 dir)
double ProjectedAirDist(TVector3 vertex, TVector3 dir)
assert(nhit_max >=nhit_nbins)
int DCMStatus(unsigned int dib, unsigned int dcm)
returns: 0: RH says is bad; 1: good; 2: bad, either BC or DCM drop
double fEdgeXPlusXZ
proper 2D detector boundaries in XZ
T min(const caf::Proxy< T > &a, T b)
nova::dbi::DataType GetDataType()
bool InMuonCatcher(TVector3 vertex)
int nInstrumentedFEBs
number of FEBs that were instrumented and active in run and not masked
bool IsBad(int plane, int cell)
int InstrumentedDetEnds(double &frontDwnstrm, double &backDwnstrm, double &frontUpstrm, double &backUpstrm)
give all detector ends information; most general
Simple object representing a (plane, cell) pair.
void FillBadBoxes()
Fill bad and uninstrumented regions of detector.
int NumBadBoxesY()
Size of the vector of bad boxes in the YZ view.
Encapsulate the geometry of one entire detector (near, far, ndos)
int PlanesToBack(TVector3 vertex)
double ProjectedDistanceToEdge(TVector3 vertex, TVector3 dir)
int DoWeEnterMC(TVector3 vertex, TVector3 dir)
double DistToEdgeXPlus(TVector3 vertex)
int PlanesToFront(TVector3 vertex)