Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4SmartFilter< T > Class Template Referenceabstract

#include <G4SmartFilter.hh>

Inheritance diagram for G4SmartFilter< T >:
Collaboration diagram for G4SmartFilter< T >:

Public Member Functions

 G4SmartFilter (const G4String &name)
 
virtual ~G4SmartFilter ()
 
virtual G4bool Evaluate (const T &) const =0
 
virtual void Print (std::ostream &ostr) const =0
 
virtual void Clear ()=0
 
G4bool Accept (const T &) const
 
virtual void PrintAll (std::ostream &ostr) const
 
virtual void Reset ()
 
void SetActive (const G4bool &)
 
G4bool GetActive () const
 
void SetInvert (const G4bool &)
 
G4bool GetInvert () const
 
void SetVerbose (const G4bool &)
 
G4bool GetVerbose () const
 
- Public Member Functions inherited from G4VFilter< T >
 G4VFilter (const G4String &name)
 
virtual ~G4VFilter ()
 
G4String Name () const
 
G4String GetName () const
 

Additional Inherited Members

- Public Types inherited from G4VFilter< T >
typedef T Type
 

Detailed Description

template<typename T>
class G4SmartFilter< T >

Definition at line 39 of file G4SmartFilter.hh.

Constructor & Destructor Documentation

template<typename T >
G4SmartFilter< T >::G4SmartFilter ( const G4String name)

Definition at line 91 of file G4SmartFilter.hh.

93  ,fActive(true)
94  ,fInvert(false)
95  ,fVerbose(false)
96  ,fNPassed(0)
97  ,fNProcessed(0)
98 {}
const XML_Char * name
Definition: expat.h:151
template<typename T >
G4SmartFilter< T >::~G4SmartFilter ( )
virtual

Definition at line 101 of file G4SmartFilter.hh.

101 {}

Member Function Documentation

template<typename T>
G4bool G4SmartFilter< T >::Accept ( const T &  object) const
virtual

Implements G4VFilter< T >.

Definition at line 105 of file G4SmartFilter.hh.

106 {
107  if (fVerbose) {
108  G4cout<<"Begin verbose printout for filter "<<G4VFilter<T>::Name()<<G4endl;
109  G4cout<<"Active ? : "<<fActive<<G4endl;
110  }
111 
112  fNProcessed++;
113 
114  // Pass everything if filter is not active
115  if (!fActive) {
116  fNPassed++;
117  return true;
118  }
119 
120  // Do filtering
121  G4bool passed = Evaluate(object);
122 
123  // Apply inversion if applicable
124  if (fInvert) passed = !passed;
125 
126  if (passed) fNPassed++;
127 
128  if (fVerbose) {
129  G4cout<<"Inverted ? : "<<fInvert<<G4endl;
130  G4cout<<"Passed ? : "<<passed<<G4endl;
131  G4cout<<"End verbose printout for filter "<<G4VFilter<T>::Name()<<G4endl;
132  }
133 
134  return passed;
135 }
virtual G4bool Evaluate(const T &) const =0
G4String Name() const
Definition: G4VFilter.hh:81
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

template<typename T>
virtual G4bool G4SmartFilter< T >::Evaluate ( const T &  ) const
pure virtual
template<typename T >
G4bool G4SmartFilter< T >::GetActive ( ) const

Definition at line 173 of file G4SmartFilter.hh.

174 {
175  return fActive;
176 }
template<typename T >
G4bool G4SmartFilter< T >::GetInvert ( ) const

Definition at line 187 of file G4SmartFilter.hh.

188 {
189  return fInvert;
190 }
template<typename T >
G4bool G4SmartFilter< T >::GetVerbose ( ) const

Definition at line 201 of file G4SmartFilter.hh.

202 {
203  return fVerbose;
204 }
template<typename T>
virtual void G4SmartFilter< T >::Print ( std::ostream &  ostr) const
pure virtual
template<typename T >
void G4SmartFilter< T >::PrintAll ( std::ostream &  ostr) const
virtual

Implements G4VFilter< T >.

Definition at line 139 of file G4SmartFilter.hh.

140 {
141  ostr<<"Printing data for filter: "<<G4VFilter<T>::Name()<<G4endl;
142 
143  Print(ostr);
144 
145  ostr<<"Active ? : " <<fActive<<G4endl;
146  ostr<<"Inverted ? : " <<fInvert<<G4endl;
147  ostr<<"#Processed : " <<fNProcessed<<G4endl;
148  ostr<<"#Passed : " <<fNPassed<<G4endl;
149 }
G4String Name() const
Definition: G4VFilter.hh:81
virtual void Print(std::ostream &ostr) const =0
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

template<typename T >
void G4SmartFilter< T >::Reset ( )
virtual

Implements G4VFilter< T >.

Definition at line 153 of file G4SmartFilter.hh.

154 {
155  fActive = true;
156  fInvert = false;
157  fNProcessed = 0;
158  fNPassed = 0;
159 
160  // Clear subclass data
161  Clear();
162 }
virtual void Clear()=0

Here is the call graph for this function:

template<typename T >
void G4SmartFilter< T >::SetActive ( const G4bool active)

Definition at line 166 of file G4SmartFilter.hh.

167 {
168  fActive = active;
169 }
template<typename T >
void G4SmartFilter< T >::SetInvert ( const G4bool invert)

Definition at line 180 of file G4SmartFilter.hh.

181 {
182  fInvert = invert;
183 }
template<typename T >
void G4SmartFilter< T >::SetVerbose ( const G4bool verbose)

Definition at line 194 of file G4SmartFilter.hh.

195 {
196  fVerbose = verbose;
197 }

The documentation for this class was generated from the following file: