source: trunk/source/digits_hits/detector/include/G4VPrimitiveScorer.hh @ 1340

Last change on this file since 1340 was 1340, checked in by garnier, 14 years ago

update ti head

File size: 4.9 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26//
27// $Id: G4VPrimitiveScorer.hh,v 1.6 2010/07/22 07:36:50 taso Exp $
28// GEANT4 tag $Name:  $
29//
30
31#ifndef G4VPrimitiveScorer_h
32#define G4VPrimitiveScorer_h 1
33
34class G4Step;
35class G4HCofThisEvent;
36class G4TouchableHistory;
37#include "globals.hh"
38#include "G4VSDFilter.hh"
39#include "G4MultiFunctionalDetector.hh"
40
41// class description:
42//
43//  This is the base class of the sensitive detector which owns
44// only one hits collection.
45//  A concrete class object derived from this base class can be
46// used either as a sensitive detector or to be registered to
47// G4MultiFunctionalDetector to define multiple functionalities.
48//
49//
50
51class G4VPrimitiveScorer
52{
53  friend class G4MultiFunctionalDetector;
54
55  public: // with description
56      G4VPrimitiveScorer(G4String name, G4int depth=0);
57      virtual ~G4VPrimitiveScorer();
58
59  protected: // with description
60      virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*)=0;
61      // This is the method must be implemented in each concrete class.
62
63      virtual G4int GetIndex(G4Step*);
64      // This is a function mapping from copy number(s) to an index of
65      // the hit collection. In the default implementation, just the
66      // copy number of the physical volume is taken.
67
68  public: // with description
69      G4int GetCollectionID(G4int);
70      // This method returns the ID of its hitsCollection. This mehod
71      // gives valid value only after it is registered to G4MultiFunctionalDetector
72      // and the G4MultiFunctionalDetector is registered to G4SDManager.
73
74      virtual void Initialize(G4HCofThisEvent*);
75      virtual void EndOfEvent(G4HCofThisEvent*);
76      virtual void clear();
77      virtual void DrawAll();
78      virtual void PrintAll();
79      // These five methods are exactly identical to those in G4VSensitiveDetector.
80      // These methods are invoked by G4SDManager through G4MultiFunctionalDetector.
81
82       virtual void SetUnit(const G4String& unit)=0;
83       G4String GetUnit() const { return unitName;}
84       G4double  GetUnitValue() const { return unitValue;}
85
86  protected:
87     void CheckAndSetUnit(const G4String& unit,const G4String& category);
88
89  protected:
90      G4String primitiveName;
91      G4MultiFunctionalDetector* detector;
92      G4VSDFilter* filter;
93      G4int verboseLevel;
94      G4int indexDepth;
95      G4String unitName;
96      G4double unitValue;
97
98  public: // with description
99      // Set/Get methods
100      inline void SetMultiFunctionalDetector(G4MultiFunctionalDetector* d)
101      { detector = d; }
102      inline G4MultiFunctionalDetector* GetMultiFunctionalDetector() const
103      { return detector; }
104      inline G4String GetName() const
105      { return primitiveName; }
106      inline void SetFilter(G4VSDFilter* f)
107      { filter = f; }
108      inline G4VSDFilter* GetFilter() const
109      { return filter; }
110      inline void SetVerboseLevel(G4int vl)
111      { verboseLevel = vl; }
112      inline G4int GetVerboseLevel() const
113      { return verboseLevel; }
114
115  private:
116      inline G4bool HitPrimitive(G4Step*aStep,G4TouchableHistory*ROhis)
117      {
118        if(filter)
119        { if(!(filter->Accept(aStep))) return false; }
120        return ProcessHits(aStep,ROhis);
121      }
122 
123  protected:
124     G4int fNi, fNj, fNk; // used for 3D scorers
125  public:
126     inline void SetNijk(G4int i,G4int j,G4int k)
127     { fNi = i; fNj = j; fNk = k; }
128};
129
130
131
132#endif
133
Note: See TracBrowser for help on using the repository browser.