G4VGFlashSensitiveDetector.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id: G4VGFlashSensitiveDetector.hh 69796 2013-05-15 13:26:12Z gcosmo $
00028 //
00029 //
00030 //---------------------------------------------------------------
00031 //  GEANT 4 class header file
00032 //
00033 //  G4VGFlashSensitiveDetector
00034 //
00035 //  Class description:
00036 //
00037 // Abstract base class of the sensitive detector for use with GFlash.
00038 // The user's sensitive detector which generates hits must be derived
00039 // from this class, and G4VSensitiveDetector.
00040 
00041 //---------------------------------------------------------------
00042 #ifndef G4VGFlashSensitiveDetector_h
00043 #define G4VGFlashSensitiveDetector_h 1
00044 
00045 #include "G4Step.hh"
00046 #include "G4VReadOutGeometry.hh"
00047 #include "G4TouchableHistory.hh"
00048 #include "GFlashEnergySpot.hh"
00049 #include "G4GFlashSpot.hh"
00050 
00051 class G4VGFlashSensitiveDetector 
00052 {
00053 
00054   public: // with description
00055 
00056       G4VGFlashSensitiveDetector() {}
00057       G4VGFlashSensitiveDetector(const G4VGFlashSensitiveDetector &) {}
00058        // Constructors. The user's concrete class must use one of these
00059        // constructors by the constructor initializer of the derived class.
00060        // The name of the sensitive detector must be the same as for the
00061        // corresponding GG4VSensitiveDetector.
00062 
00063   public: // without description
00064 
00065       virtual ~G4VGFlashSensitiveDetector() {}
00066 
00067       G4int operator==(const G4VGFlashSensitiveDetector &right) const
00068         {return this == &right;}
00069       G4int operator!=(const G4VGFlashSensitiveDetector &right) const
00070         {return this != &right;}
00071 
00072   public: // without description
00073 
00074       inline G4bool Hit(G4GFlashSpot * aSpot)
00075       {
00076         // This is the public method invoked by GFlashHitMaker for generating
00077         // hits. The actual user's implementation for generating hits must be
00078         // implemented in GenerateHits() virtual protected method. 
00079 
00080         G4bool result = true; 
00081         G4VSensitiveDetector * This
00082           = dynamic_cast<G4VSensitiveDetector *>(this);
00083         if(!This)
00084         {
00085           G4Exception("G4VGFlashSensitiveDetector::Hit()",
00086                       "InvalidSetup", FatalException,
00087                       "Needs also to inherit from G4VSensitiveDetector!");
00088           return false;
00089         }
00090         if(This->isActive())
00091         { 
00092           G4VReadOutGeometry * ROgeometry = 0;
00093           G4TouchableHistory* ROhis = 0;
00094 
00095           if(This) ROgeometry = This->GetROgeometry();
00096           if(ROgeometry)
00097           {
00098             // fake pre-step point for touchable from read-out geometry.
00099             G4Step fakeStep;
00100             G4StepPoint * tmpPoint = fakeStep.GetPreStepPoint();
00101             tmpPoint->SetTouchableHandle(aSpot->GetTouchableHandle());
00102             tmpPoint->SetPosition(aSpot->GetPosition());
00103             tmpPoint->SetMomentumDirection(aSpot->GetOriginatorTrack()
00104                                ->GetPrimaryTrack()->GetMomentumDirection());
00105             result = ROgeometry->CheckROVolume(&fakeStep, ROhis); 
00106           }
00107           if(result) result = ProcessHits(aSpot, ROhis); 
00108         }
00109         else 
00110         {
00111           result = false;
00112         }
00113         return result;
00114       }
00115 
00116   protected: // with description
00117 
00118       virtual G4bool ProcessHits(G4GFlashSpot*aSpot,
00119                                  G4TouchableHistory*ROhist) = 0;
00120        // The user MUST implement this method for generating hit(s) from the
00121        // GFlashSpots. Be aware that this method is a protected method and it
00122        // will be invoked by Hit() method of the Base class once the Readout
00123        // geometry that may be associated to the corresponding
00124        // G4VSensitiveDetector was taken into account.
00125 };
00126 
00127 #endif
00128 

Generated on Mon May 27 17:50:13 2013 for Geant4 by  doxygen 1.4.7