8 #include "cetlib_except/exception.h" 10 #include "Geant4/G4Material.hh" 47 fWireDirection = G4ThreeVector(WireDirection.X(),
49 WireDirection.Z()).unit();
50 fPlaneNormal = G4ThreeVector(PlaneNormal.X(),
52 PlaneNormal.Z()).unit();
53 fDPRatio = WireDiameter/WirePitch;
70 G4ThreeVector ProjDirection = PhotonDirection - fWireDirection*(fWireDirection.dot(PhotonDirection));
71 double CosTheta = std::abs(fPlaneNormal.dot(ProjDirection));
72 if(CosTheta < fDPRatio)
75 return (1.0 - fDPRatio / CosTheta);
88 G4ThreeVector WireBasis1, WireBasis2;
92 fPlaneNormal=G4ThreeVector(1,0,0);
93 WireBasis1 =G4ThreeVector(0,1,0);
94 WireBasis2 =G4ThreeVector(0,0,1);
96 else if(Orientation==1)
98 fPlaneNormal=G4ThreeVector(0,1,0);
99 WireBasis1 =G4ThreeVector(1,0,0);
100 WireBasis2 =G4ThreeVector(0,0,1);
102 else if(Orientation==2)
104 fPlaneNormal=G4ThreeVector(0,0,1);
105 WireBasis1 =G4ThreeVector(0,1,0);
106 WireBasis2 =G4ThreeVector(0,0,1);
110 throw cet::exception(
"OpParamAction") <<
"Unrecognized wireplane orientation. Options are 1=Xdrift, 2=Ydrift, 3=Zdrift\n";
112 for(
size_t i=0; i!=InputVectors.size(); ++i)
114 if(InputVectors.at(i).size()!=3)
116 throw cet::exception(
"OpParamAction") <<
"Unrecognized wireplane parameter format. Expected vector(3)'s with v[0] = wire angle, v[1] = wire pitch, v[2] = wire diameter\n";
120 double theta = InputVectors[i][0]*3.142/180.;
121 fWireDirections.push_back(cos(theta)*WireBasis1 + sin(theta)*WireBasis2);
122 fDPRatios.push_back(InputVectors[i][2]/InputVectors[i][1]);
140 double AttenFraction=1.;
142 for(
size_t i=0; i!=fWireDirections.size(); ++i)
144 G4ThreeVector ProjDirection = PhotonDirection - fWireDirections.at(i) * (fWireDirections.at(i).dot(PhotonDirection.unit()));
147 double CosTheta = (ProjDirection.mag() > 0 ? std::abs(fPlaneNormal.dot(ProjDirection))/ProjDirection.mag() : 1.0);
148 if(CosTheta < fDPRatios.at(i))
151 AttenFraction *= (1.0 - fDPRatios.at(i) / CosTheta);
153 return AttenFraction;
SimpleWireplaneAction(TVector3 WireDirection, TVector3 PlaneNormal, double WirePitch, double WireDiameter)
double GetAttenuationFraction(G4ThreeVector PhotonDirection, G4ThreeVector PhotonPosition)
double GetAttenuationFraction(G4ThreeVector PhotonDirection, G4ThreeVector PhotonPosition)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
OverlaidWireplanesAction(std::vector< std::vector< double > >, int)
virtual double GetAttenuationFraction(G4ThreeVector PhotonDirection, G4ThreeVector PhotonPosition)
~OverlaidWireplanesAction()
cet::coded_exception< error, detail::translate > exception