Import Geant4 11.2.0 source tree
This commit is contained in:
@@ -27,11 +27,11 @@
|
||||
#ifndef G4VFASTSIMSENSITIVEDETECTOR_HH
|
||||
#define G4VFASTSIMSENSITIVEDETECTOR_HH
|
||||
|
||||
#include "G4VReadOutGeometry.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "G4FastHit.hh"
|
||||
#include "G4FastTrack.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "G4VReadOutGeometry.hh"
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
|
||||
/**
|
||||
* @brief Base class for the sensitive detector used within the fast simulation
|
||||
@@ -53,71 +53,67 @@
|
||||
|
||||
class G4VFastSimSensitiveDetector
|
||||
{
|
||||
public:
|
||||
virtual ~G4VFastSimSensitiveDetector() = default;
|
||||
/// Create a hit.
|
||||
///
|
||||
/// It checks if G4VSensitiveDetector is also used as a base class,
|
||||
/// and takes into account the readout geometry, if it is defined.
|
||||
/// User instruction on how to deposit energy needs to be implemented in
|
||||
/// ProcessHits method.
|
||||
/// @param[in] aHit Created hit (energy and position)
|
||||
/// @param[in] aTrack Fast track with access to particle's track and
|
||||
/// properties in envelope's local coordinates
|
||||
/// @param[in] aTouchable Touchable with relevant transformations
|
||||
inline G4bool Hit(const G4FastHit* aHit, const G4FastTrack* aTrack,
|
||||
G4TouchableHandle* aTouchable)
|
||||
{
|
||||
G4bool result = true;
|
||||
G4VSensitiveDetector* sensDet = dynamic_cast<G4VSensitiveDetector*>(this);
|
||||
if(sensDet == nullptr)
|
||||
{
|
||||
G4Exception("G4VFastSimSensitiveDetector::Hit()", "InvalidSetup",
|
||||
FatalException,
|
||||
"Sensitive detector needs also to inherit also from "
|
||||
"G4VSensitiveDetector if full "
|
||||
"simulation is used instead!");
|
||||
}
|
||||
if(sensDet->isActive())
|
||||
{
|
||||
G4VReadOutGeometry* ROgeometry = sensDet->GetROgeometry();
|
||||
G4TouchableHistory* ROhistory = 0;
|
||||
public:
|
||||
virtual ~G4VFastSimSensitiveDetector() = default;
|
||||
|
||||
if(ROgeometry)
|
||||
{
|
||||
// create fake pre-step point updating the touchable from read-out
|
||||
// geometry.
|
||||
G4Step fakeStep;
|
||||
const G4Track* currentTrack = aTrack->GetPrimaryTrack();
|
||||
G4StepPoint* tmpPoint = fakeStep.GetPreStepPoint();
|
||||
tmpPoint->SetTouchableHandle(*aTouchable);
|
||||
tmpPoint->SetPosition(aHit->GetPosition());
|
||||
tmpPoint->SetMomentumDirection(currentTrack->GetMomentumDirection());
|
||||
result = ROgeometry->CheckROVolume(&fakeStep, ROhistory);
|
||||
} else {
|
||||
ROhistory = static_cast<G4TouchableHistory*>((*aTouchable)());
|
||||
/// Create a hit.
|
||||
///
|
||||
/// It checks if G4VSensitiveDetector is also used as a base class,
|
||||
/// and takes into account the readout geometry, if it is defined.
|
||||
/// User instruction on how to deposit energy needs to be implemented in
|
||||
/// ProcessHits method.
|
||||
/// @param[in] aHit Created hit (energy and position)
|
||||
/// @param[in] aTrack Fast track with access to particle's track and
|
||||
/// properties in envelope's local coordinates
|
||||
/// @param[in] aTouchable Touchable with relevant transformations
|
||||
inline G4bool Hit(const G4FastHit* aHit, const G4FastTrack* aTrack,
|
||||
G4TouchableHandle* aTouchable)
|
||||
{
|
||||
G4bool result = true;
|
||||
auto sensDet = dynamic_cast<G4VSensitiveDetector*>(this);
|
||||
if (sensDet == nullptr) {
|
||||
G4Exception("G4VFastSimSensitiveDetector::Hit()", "InvalidSetup", FatalException,
|
||||
"Sensitive detector needs also to inherit also from "
|
||||
"G4VSensitiveDetector if full "
|
||||
"simulation is used instead!");
|
||||
}
|
||||
if(result)
|
||||
result = ProcessHits(aHit, aTrack, ROhistory);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
if (sensDet->isActive()) {
|
||||
G4VReadOutGeometry* ROgeometry = sensDet->GetROgeometry();
|
||||
G4TouchableHistory* ROhistory = nullptr;
|
||||
|
||||
private:
|
||||
/// Describes how energy and position of deposits are inserted into the hits
|
||||
/// collection. It is a private method and it will be invoked by Hit() method
|
||||
/// of the base class once the readout geometry that may be associated to the
|
||||
/// corresponding G4VSensitiveDetector is taken into account.
|
||||
/// It needs to be implemented in the derived class.
|
||||
/// @param[in] aHit Created hit (energy and position)
|
||||
/// @param[in] aTrack Fast track with access to particle's track and
|
||||
/// properties in envelope's local coordinates
|
||||
/// @param[in] aROHistory Touchable history with relevant transformations
|
||||
virtual G4bool ProcessHits(const G4FastHit* aHit, const G4FastTrack* aTrack,
|
||||
G4TouchableHistory* aROHistory) = 0;
|
||||
if (ROgeometry != nullptr) {
|
||||
// create fake pre-step point updating the touchable from read-out
|
||||
// geometry.
|
||||
G4Step fakeStep;
|
||||
const G4Track* currentTrack = aTrack->GetPrimaryTrack();
|
||||
G4StepPoint* tmpPoint = fakeStep.GetPreStepPoint();
|
||||
tmpPoint->SetTouchableHandle(*aTouchable);
|
||||
tmpPoint->SetPosition(aHit->GetPosition());
|
||||
tmpPoint->SetMomentumDirection(currentTrack->GetMomentumDirection());
|
||||
result = ROgeometry->CheckROVolume(&fakeStep, ROhistory);
|
||||
}
|
||||
else {
|
||||
ROhistory = static_cast<G4TouchableHistory*>((*aTouchable)());
|
||||
}
|
||||
if (result) result = ProcessHits(aHit, aTrack, ROhistory);
|
||||
}
|
||||
else {
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
/// Describes how energy and position of deposits are inserted into the hits
|
||||
/// collection. It is a private method and it will be invoked by Hit() method
|
||||
/// of the base class once the readout geometry that may be associated to the
|
||||
/// corresponding G4VSensitiveDetector is taken into account.
|
||||
/// It needs to be implemented in the derived class.
|
||||
/// @param[in] aHit Created hit (energy and position)
|
||||
/// @param[in] aTrack Fast track with access to particle's track and
|
||||
/// properties in envelope's local coordinates
|
||||
/// @param[in] aROHistory Touchable history with relevant transformations
|
||||
virtual G4bool ProcessHits(const G4FastHit* aHit, const G4FastTrack* aTrack,
|
||||
G4TouchableHistory* aROHistory) = 0;
|
||||
};
|
||||
#endif /* G4VFASTSIMSENSITIVEDETECTOR_HH */
|
||||
|
||||
Reference in New Issue
Block a user