source: trunk/documents/UserDoc/UsersGuides/ForApplicationDeveloper/html/Visualization/filtering.html @ 1231

Last change on this file since 1231 was 1208, checked in by garnier, 15 years ago

CVS update

File size: 6.1 KB
Line 
1<HTML>
2<TITLE>Filtering</title>
3<HEAD>
4</HEAD>
5<BODY>
6
7<TABLE WIDTH="100%" >
8<TR>
9<TD>
10</A>
11<A HREF="index.html">
12<IMG SRC="../../../../resources/html/IconsGIF/Contents.gif" ALT="Contents" HEIGHT=16 WIDTH=59></A>
13<A HREF="enhanceddrawing.html">
14<IMG SRC="../../../../resources/html/IconsGIF/Previous.gif" ALT="Previous" HEIGHT=16 WIDTH=59></A>
15<a href="markertext.html">
16<IMG SRC="../../../../resources/html/IconsGIF/Next.gif" ALT="Next" HEIGHT=16 WIDTH=59></a>
17</TD>
18
19<TD ALIGN="Right"><FONT COLOR="#238E23"><FONT SIZE=-1>
20<B>Geant4 User's Guide</B> <BR>
21<B>For Application Developers</B> <BR>
22<B>Visualization</B> </FONT></FONT> </TD>
23</TR>
24</TABLE>
25
26<CENTER><FONT COLOR="#238E23"><FONT SIZE=+3>
27<b>8.8 Filtering</b><BR>
28</FONT></FONT></CENTER>
29<BR>
30
31<HR ALIGN="Center" SIZE="7%"><BR>
32
33<!-- ============================================== Section -->
34<h4>8.8.1 Trajectory Filtering</h4>   
35Trajectory filtering allows you to visualise a subset of available trajectories. This
36can be useful if you only want to view interesting trajectories and discard uninteresting ones.
37
38Trajectory filtering can be run in two modes:
39<BR>
40<UL>
41<LI><B>Soft filtering</b>: In this mode, uninteresting trajectories are marked invisible. Hence,
42they are still written, but (depending on the driver) will not be displayed. Some drivers, for example
43the HepRepFile driver, will allow you to selectively view these soft filtered trajectories
44<BR></br>
45<LI><B>Hard filtering</b>: In this mode, uninteresting trajectories are not drawn at all. This mode
46is especially useful if the job produces huge graphics files, dominated by data from uninteresting
47trajectories.
48</UL>
49
50Trajectory filter models are used to apply filtering according to specific criteria. The following
51models are currently supplied with the Geant4 distribution:
52
53<BR>
54<UL>
55<LI>G4TrajectoryChargeFilter (chargeFilter)
56<LI>G4TrajectoryParticleFilter (particleFilter)
57<LI>G4TrajectoryOriginVolumeFilter (originVolumeFilter)
58<LI>G4TrajectoryAttributeFilter (attributeFilter)
59</UL>
60Multiple filters are automatically chained together, and can configured either interactively or
61in commands or in compiled code. The filters can be inverted, set to be inactive or set in
62a verbose mode. The above models are described briefly below, followed by some example
63configuration commands.
64
65<h4>G4TrajectoryChargeFilter</h4>
66This model filters trajectories according to charge. In standard running mode, only
67trajectories with charges matching those registered with the model will pass the filter.
68
69<h4>G4TrajectoryParticleFilter</h4>
70This model filters trajectories according to particle type. In standard running mode, only
71trajectories with particle types matching those registered with the model will pass the filter.
72
73<h4>G4TrajectoryOriginVolumeFilter</h4>
74This model filters trajectories according to originating volume name. In standard running mode, only
75trajectories with originating volumes matching those registered with the model will pass the filter.
76
77<h4>G4TrajectoryAttributeFilter</h4>
78This model filters trajectories based on the HepRep style attributes associated with trajectories. Each attribute drawer can be configured with
79 interval and/or single value data. Single value data should override the interval data.
80 Units should be specified on the command line if the attribute unit is specified either as a G4BestUnit or if the unit is part of the value string.
81
82<h4>8.8.1.1 <A NAME="commandcontrol">Controlling from Commands</A></h4>
83Multiple trajectory filter models can be created and configured using commands in the
84"<TT>/vis/filtering/trajectories/</TT>" directory. All generated filter models
85are chained together automatically.
86
87<P>
88Model configuration commands are generated dynamically when a filter model is instantiated.
89These commands apply directly to that instance.
90
91<BR></br>
92See the interactive help for more information on the available commands.
93<BR>
94<h4>8.8.1.2 Example commands</h4>
95
96#Create a particle filter. Configure to pass only gammas. Then<BR>
97#invert to pass anything other than gammas. Set verbose printout,<BR>
98#and then deactivate filter<BR>
99<TT>/vis/filtering/trajectories/create/particleFilter</TT> <BR>
100<TT>/vis/filtering/trajectories/particleFilter-0/add gamma</TT> <BR>
101<TT>/vis/filtering/trajectories/particleFilter-0/invert true </TT> <BR>
102<TT>/vis/filtering/trajectories/particleFilter-0/verbose true </TT> <BR>
103<TT>/vis/filtering/trajectories/particleFilter-0/active false</TT> <BR><BR>
104
105#Create a charge filter. Configure to pass only neutral trajectories.<BR>
106#Set verbose printout. Reset filter and reconfigure to pass only<BR>
107#negativly charged trajectories.<BR>
108<TT>/vis/filtering/trajectories/create/chargeFilter</TT> <BR>
109<TT>/vis/filtering/trajectories/chargeFilter-0/add 0</TT> <BR>
110<TT>/vis/filtering/trajectories/chargeFilter-0/verbose true </TT> <BR>
111<TT>/vis/filtering/trajectories/chargeFilter-0/reset true</TT> <BR>
112<TT>/vis/filtering/trajectories/chargeFilter-0/add -1</TT> <BR><BR>
113
114#Create an attribute filter named attributeFilter-0</TT> <BR>
115<TT>/vis/filtering/trajectories/create/attributeFilter </TT> <BR><BR>
116
117#Select attribute "IMag"</TT> <BR>
118<TT>/vis/filtering/trajectories/attributeFilter-0/setAttribute IMag </TT> <BR><BR>
119
120#Select trajectories with 2.5 MeV <= IMag< 1000 MeV</TT> <BR>
121<TT>/vis/filtering/trajectories/attributeFilter-0/addInterval 2.5 MeV 1000 MeV</TT> <BR><BR>
122
123#List filters<BR>
124<TT>/vis/filtering/trajectories/list</TT> <BR><BR>
125
126#Note that although particleFilter-0 and chargeFilter-0 are automatically<BR>
127#chained, particleFilter-0 will not have any effect since <BR>
128#it is has been deactivated.<BR>
129<BR>
130
131<h4>8.8.2 Hit Filtering</h4>   
132<P>
133The attribute based filtering can be used on hits as well as trajectories. To active the interactive attribute based hit filtering, a filter call should be added to the "Draw" method of the hit class:
134
135<PRE>
136   void MyHit::Draw()
137   {
138      ...
139      if (! pVVisManager->FilterHit(*this)) return;
140      ...
141   }
142</PRE>
143
144Interactive filtering can then be done through the commands in /vis/filtering/hits.
145
146<HR>
147 <A HREF="markertext.html">Next section</A><BR>
148 <A HREF="index.html">Back to contents</A>
149
150</BODY>
151</HTML>
Note: See TracBrowser for help on using the repository browser.