LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
larg4::OverlaidWireplanesAction Class Reference

#include "OpParamAction.h"

Inheritance diagram for larg4::OverlaidWireplanesAction:
larg4::OpParamAction

Public Member Functions

 OverlaidWireplanesAction (std::vector< std::vector< double >>, int)
 
 ~OverlaidWireplanesAction ()
 
double GetAttenuationFraction (G4ThreeVector PhotonDirection, G4ThreeVector PhotonPosition)
 

Private Attributes

G4ThreeVector fPlaneNormal
 
std::vector< G4ThreeVector > fWireDirections
 
std::vector< double > fDPRatios
 

Detailed Description

Definition at line 92 of file OpParamAction.h.

Constructor & Destructor Documentation

larg4::OverlaidWireplanesAction::OverlaidWireplanesAction ( std::vector< std::vector< double >>  InputVectors,
int  Orientation 
)

Definition at line 66 of file OpParamAction.cxx.

68  {
69 
70  G4ThreeVector WireBasis1, WireBasis2;
71 
72  if (Orientation == 0) {
73  fPlaneNormal = G4ThreeVector(1, 0, 0);
74  WireBasis1 = G4ThreeVector(0, 1, 0);
75  WireBasis2 = G4ThreeVector(0, 0, 1);
76  }
77  else if (Orientation == 1) {
78  fPlaneNormal = G4ThreeVector(0, 1, 0);
79  WireBasis1 = G4ThreeVector(1, 0, 0);
80  WireBasis2 = G4ThreeVector(0, 0, 1);
81  }
82  else if (Orientation == 2) {
83  fPlaneNormal = G4ThreeVector(0, 0, 1);
84  WireBasis1 = G4ThreeVector(0, 1, 0);
85  WireBasis2 = G4ThreeVector(0, 0, 1);
86  }
87  else {
88  throw cet::exception("OpParamAction")
89  << "Unrecognized wireplane orientation. Options are 1=Xdrift, 2=Ydrift, 3=Zdrift\n";
90  }
91  for (size_t i = 0; i != InputVectors.size(); ++i) {
92  if (InputVectors.at(i).size() != 3) {
93  throw cet::exception("OpParamAction")
94  << "Unrecognized wireplane parameter format. Expected vector(3)'s with v[0] = wire "
95  "angle, v[1] = wire pitch, v[2] = wire diameter\n";
96  }
97  else {
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]);
101  }
102  }
103  }
std::vector< double > fDPRatios
std::vector< G4ThreeVector > fWireDirections
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
larg4::OverlaidWireplanesAction::~OverlaidWireplanesAction ( )

Definition at line 107 of file OpParamAction.cxx.

107 {}

Member Function Documentation

double larg4::OverlaidWireplanesAction::GetAttenuationFraction ( G4ThreeVector  PhotonDirection,
G4ThreeVector  PhotonPosition 
)
virtual

Reimplemented from larg4::OpParamAction.

Definition at line 111 of file OpParamAction.cxx.

References util::abs().

113  {
114 
115  double AttenFraction = 1.;
116 
117  for (size_t i = 0; i != fWireDirections.size(); ++i) {
118  G4ThreeVector ProjDirection =
119  PhotonDirection -
120  fWireDirections.at(i) * (fWireDirections.at(i).dot(PhotonDirection.unit()));
121 
122  // fWireDirections.at(i).cross(PhotonDirection.cross(fWireDirections.at(i)).unit());
123  double CosTheta =
124  (ProjDirection.mag() > 0 ? std::abs(fPlaneNormal.dot(ProjDirection)) / ProjDirection.mag() :
125  1.0);
126  if (CosTheta < fDPRatios.at(i))
127  return 0;
128  else
129  AttenFraction *= (1.0 - fDPRatios.at(i) / CosTheta);
130  }
131  return AttenFraction;
132  }
constexpr auto abs(T v)
Returns the absolute value of the argument.
std::vector< double > fDPRatios
std::vector< G4ThreeVector > fWireDirections

Member Data Documentation

std::vector<double> larg4::OverlaidWireplanesAction::fDPRatios
private

Definition at line 102 of file OpParamAction.h.

G4ThreeVector larg4::OverlaidWireplanesAction::fPlaneNormal
private

Definition at line 100 of file OpParamAction.h.

std::vector<G4ThreeVector> larg4::OverlaidWireplanesAction::fWireDirections
private

Definition at line 101 of file OpParamAction.h.


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