6 #include "cetlib_except/exception.h" 35 fWireDirection = G4ThreeVector(WireDirection.X(), WireDirection.Y(), WireDirection.Z()).unit();
36 fPlaneNormal = G4ThreeVector(PlaneNormal.X(), PlaneNormal.Y(), PlaneNormal.Z()).unit();
37 fDPRatio = WireDiameter / WirePitch;
53 G4ThreeVector ProjDirection =
54 PhotonDirection - fWireDirection * (fWireDirection.dot(PhotonDirection));
55 double CosTheta =
std::abs(fPlaneNormal.dot(ProjDirection));
56 if (CosTheta < fDPRatio)
59 return (1.0 - fDPRatio / CosTheta);
70 G4ThreeVector WireBasis1, WireBasis2;
72 if (Orientation == 0) {
73 fPlaneNormal = G4ThreeVector(1, 0, 0);
74 WireBasis1 = G4ThreeVector(0, 1, 0);
75 WireBasis2 = G4ThreeVector(0, 0, 1);
77 else if (Orientation == 1) {
78 fPlaneNormal = G4ThreeVector(0, 1, 0);
79 WireBasis1 = G4ThreeVector(1, 0, 0);
80 WireBasis2 = G4ThreeVector(0, 0, 1);
82 else if (Orientation == 2) {
83 fPlaneNormal = G4ThreeVector(0, 0, 1);
84 WireBasis1 = G4ThreeVector(0, 1, 0);
85 WireBasis2 = G4ThreeVector(0, 0, 1);
89 <<
"Unrecognized wireplane orientation. Options are 1=Xdrift, 2=Ydrift, 3=Zdrift\n";
91 for (
size_t i = 0; i != InputVectors.size(); ++i) {
92 if (InputVectors.at(i).size() != 3) {
94 <<
"Unrecognized wireplane parameter format. Expected vector(3)'s with v[0] = wire " 95 "angle, v[1] = wire pitch, v[2] = wire diameter\n";
98 double theta = InputVectors[i][0] * 3.142 / 180.;
99 fWireDirections.push_back(cos(theta) * WireBasis1 + sin(theta) * WireBasis2);
100 fDPRatios.push_back(InputVectors[i][2] / InputVectors[i][1]);
115 double AttenFraction = 1.;
117 for (
size_t i = 0; i != fWireDirections.size(); ++i) {
118 G4ThreeVector ProjDirection =
120 fWireDirections.at(i) * (fWireDirections.at(i).dot(PhotonDirection.unit()));
124 (ProjDirection.mag() > 0 ?
std::abs(fPlaneNormal.dot(ProjDirection)) / ProjDirection.mag() :
126 if (CosTheta < fDPRatios.at(i))
129 AttenFraction *= (1.0 - fDPRatios.at(i) / CosTheta);
131 return AttenFraction;
SimpleWireplaneAction(TVector3 WireDirection, TVector3 PlaneNormal, double WirePitch, double WireDiameter)
OverlaidWireplanesAction(std::vector< std::vector< double >>, int)
double GetAttenuationFraction(G4ThreeVector PhotonDirection, G4ThreeVector PhotonPosition)
constexpr auto abs(T v)
Returns the absolute value of the argument.
double GetAttenuationFraction(G4ThreeVector PhotonDirection, G4ThreeVector PhotonPosition)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
virtual double GetAttenuationFraction(G4ThreeVector PhotonDirection, G4ThreeVector PhotonPosition)
~OverlaidWireplanesAction()
cet::coded_exception< error, detail::translate > exception