source: trunk/documents/UserDoc/DocBookUsersGuides/ForApplicationDeveloper/xml/Detector/digitization.xml@ 1185

Last change on this file since 1185 was 904, checked in by garnier, 17 years ago

ajout de la doc

File size: 6.6 KB
Line 
1<!-- ******************************************************** -->
2<!-- -->
3<!-- [History] -->
4<!-- Converted to DocBook: Katsuya Amako, Aug-2006 -->
5<!-- Changed by: Katsuya Amako, 21-Sep-1998 -->
6<!-- Changed by: Dennis Wright, 27-Nov-2001 -->
7<!-- Proof read by: Joe Chuma, 30-Jun-1999 -->
8<!-- -->
9<!-- ******************************************************** -->
10
11
12<!-- ******************* Section (Level#1) ****************** -->
13<sect1 id="sect.Digi">
14<title>
15Digitization
16</title>
17
18
19<!-- ******************* Section (Level#2) ****************** -->
20<sect2 id="sect.Digi.Digi">
21<title>
22Digi
23</title>
24
25<para>
26A hit is created by a sensitive detector when a step goes through
27it. Thus, the sensitive detector is associated to the corresponding
28<emphasis>G4LogicalVolume</emphasis> object(s). On the other hand, a digit is
29created using information of hits and/or other digits by a
30digitizer module. The digitizer module is not associated with any
31volume, and you have to implicitly invoke the <literal>Digitize()</literal>
32method of your concrete <emphasis>G4VDigitizerModule</emphasis> class.
33</para>
34
35<para>
36Typical usages of digitizer module include:
37
38<itemizedlist spacing="compact">
39 <listitem><para>
40 simulate ADC and/or TDC
41 </para></listitem>
42 <listitem><para>
43 simulate readout scheme
44 </para></listitem>
45 <listitem><para>
46 generate raw data
47 </para></listitem>
48 <listitem><para>
49 simulate trigger logics
50 </para></listitem>
51 <listitem><para>
52 simulate pile up
53 </para></listitem>
54</itemizedlist>
55</para>
56
57
58<!-- ******* Bridgehead ******* -->
59<bridgehead renderas='sect4'>
60G4VDigi
61</bridgehead>
62
63<para>
64<emphasis>G4VDigi</emphasis> is an abstract base class which represents a
65digit. You have to inherit this base class and derive your own
66concrete digit class(es). The member data of your concrete digit
67class should be defined by yourself. <emphasis>G4VDigi</emphasis> has two virtual
68methods, <literal>Draw()</literal> and <literal>Print()</literal>.
69</para>
70
71<!-- ******* Bridgehead ******* -->
72<bridgehead renderas='sect4'>
73G4TDigiCollection
74</bridgehead>
75
76<para>
77<emphasis>G4TDigiCollection</emphasis> is a template class for digits
78collections, which is derived from the abstract base class
79<emphasis>G4VDigiCollection</emphasis>. <emphasis>G4Event</emphasis> has a
80<emphasis>G4DCofThisEvent</emphasis> object, which is a container class of
81collections of digits. The usages of <emphasis>G4VDigi</emphasis> and
82<emphasis>G4TDigiCollection</emphasis> are almost the same as <emphasis>G4VHit</emphasis> and
83<emphasis>G4THitsCollection</emphasis>, respectively, explained in the previous
84section.
85</para>
86
87</sect2>
88
89
90<!-- ******************* Section (Level#2) ****************** -->
91<sect2 id="sect.Digi.DigMod">
92<title>
93Digitizer module
94</title>
95
96<!-- ******* Bridgehead ******* -->
97<bridgehead renderas='sect4'>
98G4VDigitizerModule
99</bridgehead>
100
101<para>
102<emphasis>G4VDigitizerModule</emphasis> is an abstract base class which
103represents a digitizer module. It has a pure virtual method,
104<literal>Digitize()</literal>. A concrete digitizer module must have an
105implementation of this virtual method. The Geant4 kernel classes do
106not have a ``built-in'' invocation to the <literal>Digitize()</literal>
107method. You have to implement your code to invoke this method of
108your digitizer module.
109</para>
110
111<para>
112In the <literal>Digitize()</literal> method, you construct your
113<emphasis>G4VDigi</emphasis> concrete class objects and store them to your
114<emphasis>G4TDigiCollection</emphasis> concrete class object(s). Your
115collection(s) should be associated with the <emphasis>G4DCofThisEvent</emphasis>
116object.
117</para>
118
119<!-- ******* Bridgehead ******* -->
120<bridgehead renderas='sect4'>
121G4DigiManager
122</bridgehead>
123
124<para>
125<emphasis>G4DigiManager</emphasis> is the singleton manager class of the
126digitizer modules. All of your concrete digitizer modules should be
127registered to <emphasis>G4DigiManager</emphasis> with their unique names.
128
129<informalexample>
130<programlisting>
131 G4DigiManager * fDM = G4DigiManager::GetDMpointer();
132 MyDigitizer * myDM = new MyDigitizer( "/myDet/myCal/myEMdigiMod" );
133 fDM-&gt;AddNewModule(myDM);
134</programlisting>
135</informalexample>
136</para>
137
138<para>
139Your concrete digitizer module can be accessed from your code using
140the unique module name.
141
142<informalexample>
143<programlisting>
144 G4DigiManager * fDM = G4DigiManager::GetDMpointer();
145 MyDigitizer * myDM = fDM-&gt;FindDigitizerModule( "/myDet/myCal/myEMdigiMod" );
146 myDM-&gt;Digitize();
147</programlisting>
148</informalexample>
149</para>
150
151<para>
152Also, <emphasis>G4DigiManager</emphasis> has a <emphasis>Digitize()</emphasis>
153method which takes the unique module name.
154
155<informalexample>
156<programlisting>
157 G4DigiManager * fDM = G4DigiManager::GetDMpointer();
158 MyDigitizer * myDM = fDM-&gt;Digitize( "/myDet/myCal/myEMdigiMod" );
159</programlisting>
160</informalexample>
161</para>
162
163<!-- ******* Bridgehead ******* -->
164<bridgehead renderas='sect4'>
165How to get hitsCollection and/or digiCollection
166</bridgehead>
167
168<para>
169<emphasis>G4DigiManager</emphasis> has the following methods to access to the
170hits or digi collections of the currently processing event or of
171previous events.
172</para>
173
174<para>
175First, you have to get the collection ID number of the hits or
176digits collection.
177
178<informalexample>
179<programlisting>
180 G4DigiManager * fDM = G4DigiManager::GetDMpointer();
181 G4int myHitsCollID = fDM-&gt;GetHitsCollectionID( "hits_collection_name" );
182 G4int myDigiCollID = fDM-&gt;GetDigiCollectionID( "digi_collection_name" );
183</programlisting>
184</informalexample>
185</para>
186
187<para>
188Then, you can get the pointer to your concrete
189<emphasis>G4THitsCollection</emphasis> object or
190<emphasis>G4TDigiCollection</emphasis> object of the currently processing event.
191
192<informalexample>
193<programlisting>
194 MyHitsCollection * HC = fDM-&gt;GetHitsCollection( myHitsCollID );
195 MyDigiCollection * DC = fDM-&gt;GetDigiCollection( myDigiCollID );
196</programlisting>
197</informalexample>
198</para>
199
200<para>
201In case you want to access to the hits or digits collection of
202previous events, add the second argument.
203
204<informalexample>
205<programlisting>
206 MyHitsCollection * HC = fDM-&gt;GetHitsCollection( myHitsCollID, n );
207 MyDigiCollection * DC = fDM-&gt;GetDigiCollection( myDigiCollID, n );
208</programlisting>
209</informalexample>
210
211where, <literal>n</literal> indicates the hits or digits collection of the
212<literal>n</literal><superscript>th</superscript> previous event.
213</para>
214
215</sect2>
216</sect1>
Note: See TracBrowser for help on using the repository browser.