All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OpParamSD.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file OpParamSD.h
3 //
4 /// \author bjpjones@mit.edu
5 ////////////////////////////////////////////////////////////////////////
6 //
7 // This class represents a partially opaque, parameterized optical volume.
8 //
9 // The photon transmission probability is determined as a function of
10 // photon position and momentum direction by a derived class of
11 // OpParamAction. The particlar derived class to use is specified in a string given to
12 // the constructor, along with any parameters required to define that object.
13 // This implementation allows for generic extensions to new types of wireplanes
14 // or opaque surfaces for future liquid argon TPC detectors.
15 //
16 // On each step of a photon within this volume, the GetAttenuationFraction
17 // method of the OpParamAction derivative is called to get a photon
18 // transmission probability. A fraction of all photons are killed
19 // accordingly.
20 //
21 // This sensitive detector object is attached to physical volumes by the
22 // OpDetReadoutGeometry class.
23 //
24 //
25 // Ben Jones, MIT,2013
26 //
27 
28 #ifndef OpParamSD_h
29 #define OpParamSD_h 1
30 
31 #include "Geant4/G4String.hh"
32 #include "Geant4/G4Types.hh"
33 #include "Geant4/G4VSensitiveDetector.hh"
34 #include "Geant4/Randomize.hh"
35 
36 #include <map>
37 #include <string>
38 #include <vector>
39 
40 class G4HCofThisEvent;
41 class G4Step;
42 class G4TouchableHistory;
43 
44 namespace larg4 {
45 
46  class OpParamAction;
47 
48  class OpParamSD : public G4VSensitiveDetector
49  {
50 
51 
52  public:
53  OpParamSD(G4String name, std::string ModelName, int Orientation, std::vector<std::vector<double> > Parameters);
54  virtual ~OpParamSD(){}
55 
56 
57  // Beginning and end of event
58  virtual void Initialize(G4HCofThisEvent*);
59  virtual void EndOfEvent(G4HCofThisEvent*){}
60 
61  // Tidy up event in abort
62  virtual void clear(){}
63 
64  // Run per step in sensitive volume
65  virtual G4bool ProcessHits( G4Step*, G4TouchableHistory*);
66 
67 
68  // Required but empty
69  virtual void DrawAll(){}
70  virtual void PrintAll(){}
71 
72 
73  private:
74  G4bool G4BooleanRand(const G4double prob) const;
75 
77  std::map<G4int, bool> fPhotonAlreadyCrossed;
78 
79  };
80 
81 
82 
83  inline
84  G4bool OpParamSD::G4BooleanRand(const G4double prob) const
85  {
86  /* Returns a random boolean variable with the specified probability */
87  return (G4UniformRand() < prob);
88  }
89 
90 
91 
92 }
93 
94 #endif
virtual void DrawAll()
Definition: OpParamSD.h:69
virtual void Initialize(G4HCofThisEvent *)
Definition: OpParamSD.cxx:83
virtual void PrintAll()
Definition: OpParamSD.h:70
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
virtual G4bool ProcessHits(G4Step *, G4TouchableHistory *)
Definition: OpParamSD.cxx:56
virtual ~OpParamSD()
Definition: OpParamSD.h:54
G4bool G4BooleanRand(const G4double prob) const
Definition: OpParamSD.h:84
std::map< G4int, bool > fPhotonAlreadyCrossed
Definition: OpParamSD.h:77
fhicl::Table< sbnd::crt::CRTDetSimParams > Parameters
virtual void EndOfEvent(G4HCofThisEvent *)
Definition: OpParamSD.h:59
virtual void clear()
Definition: OpParamSD.h:62
then echo fcl name
OpParamSD(G4String name, std::string ModelName, int Orientation, std::vector< std::vector< double > > Parameters)
Definition: OpParamSD.cxx:28
OpParamAction * fOpa
Definition: OpParamSD.h:76