ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4VGFlashSensitiveDetector.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4VGFlashSensitiveDetector.hh
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 //
28 //
29 //---------------------------------------------------------------
30 // GEANT 4 class header file
31 //
32 // G4VGFlashSensitiveDetector
33 //
34 // Class description:
35 //
36 // Abstract base class of the sensitive detector for use with GFlash.
37 // The user's sensitive detector which generates hits must be derived
38 // from this class, and G4VSensitiveDetector.
39 
40 //---------------------------------------------------------------
41 #ifndef G4VGFlashSensitiveDetector_h
42 #define G4VGFlashSensitiveDetector_h 1
43 
44 #include "G4Step.hh"
45 #include "G4VReadOutGeometry.hh"
46 #include "G4TouchableHistory.hh"
47 #include "GFlashEnergySpot.hh"
48 #include "G4GFlashSpot.hh"
49 #include "G4VSensitiveDetector.hh"
50 
51 
53 {
54 
55  public: // with description
56 
59  // Constructors. The user's concrete class must use one of these
60  // constructors by the constructor initializer of the derived class.
61  // The name of the sensitive detector must be the same as for the
62  // corresponding GG4VSensitiveDetector.
63 
64  public: // without description
65 
67 
69  {return this == &right;}
71  {return this != &right;}
72 
73  public: // without description
74 
75  inline G4bool Hit(G4GFlashSpot * aSpot)
76  {
77  // This is the public method invoked by GFlashHitMaker for generating
78  // hits. The actual user's implementation for generating hits must be
79  // implemented in GenerateHits() virtual protected method.
80 
81  G4bool result = true;
83  = dynamic_cast<G4VSensitiveDetector *>(this);
84  if(!This)
85  {
86  G4Exception("G4VGFlashSensitiveDetector::Hit()",
87  "InvalidSetup", FatalException,
88  "Needs also to inherit from G4VSensitiveDetector!");
89  return false;
90  }
91  if(This->isActive())
92  {
93  G4VReadOutGeometry * ROgeometry = 0;
94  G4TouchableHistory* ROhis = 0;
95 
96  if(This) ROgeometry = This->GetROgeometry();
97  if(ROgeometry)
98  {
99  // fake pre-step point for touchable from read-out geometry.
100  G4Step fakeStep;
101  G4StepPoint * tmpPoint = fakeStep.GetPreStepPoint();
102  tmpPoint->SetTouchableHandle(aSpot->GetTouchableHandle());
103  tmpPoint->SetPosition(aSpot->GetPosition());
104  tmpPoint->SetMomentumDirection(aSpot->GetOriginatorTrack()
106  result = ROgeometry->CheckROVolume(&fakeStep, ROhis);
107  }
108  if(result) result = ProcessHits(aSpot, ROhis);
109  }
110  else
111  {
112  result = false;
113  }
114  return result;
115  }
116 
117  protected: // with description
118 
119  virtual G4bool ProcessHits(G4GFlashSpot*aSpot,
120  G4TouchableHistory*ROhist) = 0;
121  // The user MUST implement this method for generating hit(s) from the
122  // GFlashSpots. Be aware that this method is a protected method and it
123  // will be invoked by Hit() method of the Base class once the Readout
124  // geometry that may be associated to the corresponding
125  // G4VSensitiveDetector was taken into account.
126 };
127 
128 #endif
129