Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-13 08:58:24

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 //
0028 //
0029 //---------------------------------------------------------------
0030 //  GEANT 4 class header file
0031 //
0032 //  G4VGFlashSensitiveDetector
0033 //
0034 //  Class description:
0035 //
0036 // Abstract base class of the sensitive detector for use with GFlash.
0037 // The user's sensitive detector which generates hits must be derived
0038 // from this class, and G4VSensitiveDetector.
0039 
0040 //---------------------------------------------------------------
0041 #ifndef G4VGFlashSensitiveDetector_h
0042 #define G4VGFlashSensitiveDetector_h 1
0043 
0044 #include "G4Step.hh"
0045 #include "G4VReadOutGeometry.hh"
0046 #include "G4TouchableHistory.hh"
0047 #include "GFlashEnergySpot.hh"
0048 #include "G4GFlashSpot.hh"
0049 #include "G4VSensitiveDetector.hh"
0050 
0051 class G4VGFlashSensitiveDetector
0052 {
0053   public:  // with description
0054     G4VGFlashSensitiveDetector() {}
0055     G4VGFlashSensitiveDetector(const G4VGFlashSensitiveDetector&) {}
0056     // Constructors. The user's concrete class must use one of these
0057     // constructors by the constructor initializer of the derived class.
0058     // The name of the sensitive detector must be the same as for the
0059     // corresponding GG4VSensitiveDetector.
0060 
0061   public:  // without description
0062     virtual ~G4VGFlashSensitiveDetector() {}
0063 
0064     G4bool operator==(const G4VGFlashSensitiveDetector& right) const { return this == &right; }
0065     G4bool operator!=(const G4VGFlashSensitiveDetector& right) const { return this != &right; }
0066 
0067   public:  // without description
0068     inline G4bool Hit(G4GFlashSpot* aSpot)
0069     {
0070       // This is the public method invoked by GFlashHitMaker for generating
0071       // hits. The actual user's implementation for generating hits must be
0072       // implemented in GenerateHits() virtual protected method.
0073 
0074       G4bool result = true;
0075       G4VSensitiveDetector* This = dynamic_cast<G4VSensitiveDetector*>(this);
0076       if (!This) {
0077         G4Exception("G4VGFlashSensitiveDetector::Hit()", "InvalidSetup", FatalException,
0078                     "Needs also to inherit from G4VSensitiveDetector!");
0079         return false;
0080       }
0081       if (This->isActive()) {
0082         G4VReadOutGeometry* ROgeometry = 0;
0083         G4TouchableHistory* ROhis = 0;
0084 
0085         if (This) ROgeometry = This->GetROgeometry();
0086         if (ROgeometry) {
0087           // fake pre-step point for touchable from read-out geometry.
0088           G4Step fakeStep;
0089           G4StepPoint* tmpPoint = fakeStep.GetPreStepPoint();
0090           tmpPoint->SetTouchableHandle(aSpot->GetTouchableHandle());
0091           tmpPoint->SetPosition(aSpot->GetPosition());
0092           tmpPoint->SetMomentumDirection(
0093             aSpot->GetOriginatorTrack()->GetPrimaryTrack()->GetMomentumDirection());
0094           result = ROgeometry->CheckROVolume(&fakeStep, ROhis);
0095         }
0096         if (result) result = ProcessHits(aSpot, ROhis);
0097       }
0098       else {
0099         result = false;
0100       }
0101       return result;
0102     }
0103 
0104   protected:  // with description
0105     virtual G4bool ProcessHits(G4GFlashSpot* aSpot, G4TouchableHistory* ROhist) = 0;
0106     // The user MUST implement this method for generating hit(s) from the
0107     // GFlashSpots. Be aware that this method is a protected method and it
0108     // will be invoked by Hit() method of the Base class once the Readout
0109     // geometry that may be associated to the corresponding
0110     // G4VSensitiveDetector was taken into account.
0111 };
0112 
0113 #endif
0114