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

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