Geant4  10.03
GFlashHitMaker.cc
Go to the documentation of this file.
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 // $Id: GFlashHitMaker.cc 98338 2016-07-07 08:20:39Z gcosmo $
27 //
28 //
29 // ------------------------------------------------------------
30 // GEANT 4 class implementation
31 //
32 // ---------------- GFlashHitMaker ----------------
33 //
34 // Authors: E.Barberio & Joanna Weng
35 // ------------------------------------------------------------
36 
37 #include "G4ios.hh"
39 #include "G4VSensitiveDetector.hh"
40 #include "G4TouchableHandle.hh"
42 
43 #include "GFlashHitMaker.hh"
44 #include "G4GFlashSpot.hh"
45 
47 {
48  fTouchableHandle = new G4TouchableHistory(); // talk to ?@@@
49  fpNavigator = new G4Navigator();
50  fNaviSetup = false;
51 }
52 
54 {
55  delete fpNavigator;
56 }
57 
59 {
60  // Locate the spot
61  if (!fNaviSetup)
62  {
63  fpNavigator->
65  GetNavigatorForTracking()->GetWorldVolume() );
66  fpNavigator->
67  LocateGlobalPointAndUpdateTouchable(aSpot->GetPosition(),
68  fTouchableHandle(), false);
69  fNaviSetup = true;
70  }
71  else
72  {
73  fpNavigator->
74  LocateGlobalPointAndUpdateTouchable(aSpot->GetPosition(),
76  }
77 
78  //--------------------------------------
79  // Fills attribute of the G4Step needed
80  // by our sensitive detector:
81  //-------------------------------------
82  // set spot information:
83  G4GFlashSpot theSpot(aSpot, aT, fTouchableHandle);
85  //--------------------------------------
86  // Produce Hits
87  // call sensitive part: taken/adapted from the stepping:
88  // Send G4Step information to Hit/Dig if the volume is sensitive
89  //--------------G4TouchableHistory----------------------------------------
90 
91  G4VPhysicalVolume* pCurrentVolume = fTouchableHandle()->GetVolume();
92  G4VSensitiveDetector* pSensitive;
93  if( pCurrentVolume != 0 )
94  {
95  pSensitive = pCurrentVolume->GetLogicalVolume()->GetSensitiveDetector();
96  G4VGFlashSensitiveDetector * gflashSensitive =
97  dynamic_cast<G4VGFlashSensitiveDetector * > (pSensitive);
98  if( gflashSensitive )
99  {
100  gflashSensitive->Hit(&theSpot);
101  }
102  else if (( pSensitive ) &&
103  ( pCurrentVolume->GetLogicalVolume()->GetFastSimulationManager() )
104  ) // Using gflash without implementing the
105  // gflashSensitive detector interface -> not allowed!
106 
107  {
108  G4cerr << "ERROR - GFlashHitMaker::make()" << G4endl
109  << " It is required to implement the "<< G4endl
110  << " G4VGFlashSensitiveDetector interface in "<< G4endl
111  << " addition to the usual SensitiveDetector class."
112  << G4endl;
113  G4Exception("GFlashHitMaker::make()", "InvalidSetup", FatalException,
114  "G4VGFlashSensitiveDetector interface not implemented.");
115  }
116  }
117  else
118  {
119  #ifdef GFLASH_DEBUG
120  G4cout << "GFlashHitMaker::Out of volume "<< G4endl;
121  #endif
122  }
123 }
G4bool Hit(G4GFlashSpot *aSpot)
void make(GFlashEnergySpot *aSpot, const G4FastTrack *aT)
G4GLOB_DLL std::ostream G4cout
G4FastSimulationManager * GetFastSimulationManager() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4TransportationManager * GetTransportationManager()
G4LogicalVolume * GetLogicalVolume() const
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
Definition: G4VTouchable.cc:44
G4Navigator * fpNavigator
#define G4endl
Definition: G4ios.hh:61
G4TouchableHandle fTouchableHandle
G4VSensitiveDetector * GetSensitiveDetector() const
G4ThreeVector GetPosition() const
G4GLOB_DLL std::ostream G4cerr