Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4VGFlashSensitiveDetector.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 
0052 class G4VGFlashSensitiveDetector 
0053 {
0054 
0055   public: // with description
0056 
0057       G4VGFlashSensitiveDetector() {}
0058       G4VGFlashSensitiveDetector(const G4VGFlashSensitiveDetector &) {}
0059        // Constructors. The user's concrete class must use one of these
0060        // constructors by the constructor initializer of the derived class.
0061        // The name of the sensitive detector must be the same as for the
0062        // corresponding GG4VSensitiveDetector.
0063 
0064   public: // without description
0065 
0066       virtual ~G4VGFlashSensitiveDetector() {}
0067 
0068       G4bool operator==(const G4VGFlashSensitiveDetector &right) const
0069         {return this == &right;}
0070       G4bool operator!=(const G4VGFlashSensitiveDetector &right) const
0071         {return this != &right;}
0072 
0073   public: // without description
0074 
0075       inline G4bool Hit(G4GFlashSpot * aSpot)
0076       {
0077         // This is the public method invoked by GFlashHitMaker for generating
0078         // hits. The actual user's implementation for generating hits must be
0079         // implemented in GenerateHits() virtual protected method. 
0080 
0081         G4bool result = true; 
0082         G4VSensitiveDetector * This
0083           = dynamic_cast<G4VSensitiveDetector *>(this);
0084         if(!This)
0085         {
0086           G4Exception("G4VGFlashSensitiveDetector::Hit()",
0087                       "InvalidSetup", FatalException,
0088                       "Needs also to inherit from G4VSensitiveDetector!");
0089           return false;
0090         }
0091         if(This->isActive())
0092         { 
0093           G4VReadOutGeometry * ROgeometry = 0;
0094           G4TouchableHistory* ROhis = 0;
0095 
0096           if(This) ROgeometry = This->GetROgeometry();
0097           if(ROgeometry)
0098           {
0099             // fake pre-step point for touchable from read-out geometry.
0100             G4Step fakeStep;
0101             G4StepPoint * tmpPoint = fakeStep.GetPreStepPoint();
0102             tmpPoint->SetTouchableHandle(aSpot->GetTouchableHandle());
0103             tmpPoint->SetPosition(aSpot->GetPosition());
0104             tmpPoint->SetMomentumDirection(aSpot->GetOriginatorTrack()
0105                                ->GetPrimaryTrack()->GetMomentumDirection());
0106             result = ROgeometry->CheckROVolume(&fakeStep, ROhis); 
0107           }
0108           if(result) result = ProcessHits(aSpot, ROhis); 
0109         }
0110         else 
0111         {
0112           result = false;
0113         }
0114         return result;
0115       }
0116 
0117   protected: // with description
0118 
0119       virtual G4bool ProcessHits(G4GFlashSpot*aSpot,
0120                                  G4TouchableHistory*ROhist) = 0;
0121        // The user MUST implement this method for generating hit(s) from the
0122        // GFlashSpots. Be aware that this method is a protected method and it
0123        // will be invoked by Hit() method of the Base class once the Readout
0124        // geometry that may be associated to the corresponding
0125        // G4VSensitiveDetector was taken into account.
0126 };
0127 
0128 #endif
0129