digits_hits/detector/include/G4VPrimitiveScorer.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: G4VPrimitiveScorer.hh,v 1.3 2007/08/28 07:51:45 asaim Exp $
00028 // GEANT4 tag $Name: geant4-09-01-patch-01 $
00029 //
00030 
00031 #ifndef G4VPrimitiveScorer_h
00032 #define G4VPrimitiveScorer_h 1
00033 
00034 class G4Step;
00035 class G4HCofThisEvent;
00036 class G4TouchableHistory;
00037 #include "globals.hh"
00038 #include "G4VSDFilter.hh"
00039 #include "G4MultiFunctionalDetector.hh"
00040 
00041 // class description:
00042 //
00043 //  This is the base class of the sensitive detector which owns
00044 // only one hits collection.
00045 //  A concrete class object derived from this base class can be
00046 // used either as a sensitive detector or to be registered to 
00047 // G4MultiFunctionalDetector to define multiple functionalities.
00048 
00049 class G4VPrimitiveScorer
00050 {
00051   friend class G4MultiFunctionalDetector;
00052 
00053   public: // with description
00054       G4VPrimitiveScorer(G4String name, G4int depth=0);
00055       virtual ~G4VPrimitiveScorer();
00056 
00057   protected: // with description
00058       virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*)=0;
00059       // This is the method must be implemented in each concrete class.
00060 
00061       virtual G4int GetIndex(G4Step*);
00062       // This is a function mapping from copy number(s) to an index of 
00063       // the hit collection. In the default implementation, just the
00064       // copy number of the physical volume is taken.
00065 
00066   public: // with description
00067       G4int GetCollectionID(G4int);
00068       // This method returns the ID of its hitsCollection. This mehod
00069       // gives valid value only after it is registered to G4MultiFunctionalDetector
00070       // and the G4MultiFunctionalDetector is registered to G4SDManager.
00071 
00072       virtual void Initialize(G4HCofThisEvent*);
00073       virtual void EndOfEvent(G4HCofThisEvent*);
00074       virtual void clear();
00075       virtual void DrawAll();
00076       virtual void PrintAll();
00077       // These five methods are exactly identical to those in G4VSensitiveDetector.
00078       // These methods are invoked by G4SDManager through G4MultiFunctionalDetector.
00079 
00080   protected:
00081       G4String primitiveName;
00082       G4MultiFunctionalDetector* detector;
00083       G4VSDFilter* filter;
00084       G4int verboseLevel;
00085       G4int indexDepth;
00086 
00087   public: // with description
00088       // Set/Get methods
00089       inline void SetMultiFunctionalDetector(G4MultiFunctionalDetector* d)
00090       { detector = d; }
00091       inline G4MultiFunctionalDetector* GetMultiFunctionalDetector() const
00092       { return detector; }
00093       inline G4String GetName() const
00094       { return primitiveName; }
00095       inline void SetFilter(G4VSDFilter* f)
00096       { filter = f; }
00097       inline G4VSDFilter* GetFilter() const
00098       { return filter; }
00099       inline void SetVerboseLevel(G4int vl)
00100       { verboseLevel = vl; }
00101       inline G4int GetVerboseLevel() const
00102       { return verboseLevel; }
00103 
00104   private:
00105       inline G4bool HitPrimitive(G4Step*aStep,G4TouchableHistory*ROhis)
00106       {
00107         if(filter)
00108         { if(!(filter->Accept(aStep))) return false; }
00109         return ProcessHits(aStep,ROhis);
00110       }
00111  
00112   protected:
00113      G4int fNi, fNj, fNk; // used for 3D scorers
00114   public:
00115      inline void SetNijk(G4int i,G4int j,G4int k)
00116      { fNi = i; fNj = j; fNk = k; }
00117 };
00118 
00119 
00120 
00121 #endif
00122 

Generated on Fri Apr 11 17:09:45 2008 for Geant4 by  doxygen 1.4.7