source: trunk/documents/UserDoc/UsersGuides/ForApplicationDeveloper/html/Detector/digitization.html @ 1208

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

CVS update

File size: 5.3 KB
Line 
1<HTML>
2<TITLE>
3</TITLE>
4<!-- Changed by: Katsuya Amako, 21-Sep-1998 -->
5<!-- Changed by: Dennis Wright, 27-Nov-2001 -->
6<!-- Proof read by: Joe Chuma,  30-Jun-1999 -->
7
8<BODY>
9<TABLE WIDTH="100%"><TR>
10<TD>
11
12
13<A HREF="index.html">
14<IMG SRC="../../../../resources/html/IconsGIF/Contents.gif" ALT="Contents"></A>
15<A HREF="hit.html">
16<IMG SRC="../../../../resources/html/IconsGIF/Previous.gif" ALT="Previous"></A>
17<A HREF="persistency.html">
18<IMG SRC="../../../../resources/html/IconsGIF/Next.gif" ALT="Next"></A>
19</TD>
20<TD ALIGN="Right">
21<FONT SIZE="-1" COLOR="#238E23">
22<B>Geant4 User's Guide</B>
23<BR>
24<B>For Application Developers</B>
25<BR>
26<B>Detector Definition and Response</B>
27</FONT>
28</TD>
29</TR></TABLE>
30<BR><BR>
31
32<P ALIGN="Center">
33<FONT SIZE="+3" COLOR="#238E23">
34<B>4.5 Digitization</B>
35</FONT>
36<BR><BR>
37
38<HR ALIGN="Center" SIZE="7%">
39<p>
40
41<a name="4.5.1">
42<H2>4.5.1 Digi</H2></a>
43
44 A hit is created by a sensitive detector when a step goes through
45 it. Thus, the sensitive detector is associated to the corresponding
46 <i>G4LogicalVolume</i> object(s). On the other hand, a digit is
47 created using information of hits and/or other digits by a digitizer
48 module. The digitizer module is not associated with any volume, and
49 you have to implicitly invoke the <tt>Digitize()</tt> method of your
50 concrete <i>G4VDigitizerModule</i> class.
51<p>
52 Typical usages of digitizer module include:
53 <ul>
54  <li>simulate ADC and/or TDC
55  <li>simulate readout scheme
56  <li>generate raw data
57  <li>simulate trigger logics
58  <li>simulate pile up
59 </ul>
60<p>
61
62<B><i>G4VDigi</i></B>
63<P>
64 <i>G4VDigi</i> is an abstract base class which represents a digit.
65 You have to inherit this base class and derive your own concrete
66 digit class(es). The member data of your concrete digit class
67 should be defined by yourself. <i>G4VDigi</i> has two virtual methods,
68 <tt>Draw()</tt> and <tt>Print()</tt>.
69<p>
70
71<B><i>G4TDigiCollection</i></B>
72<P>
73 <i>G4TDigiCollection</i> is a template class for digits collections,
74 which is derived from the abstract base class <i>G4VDigiCollection</i>.
75 <i>G4Event</i> has a <i>G4DCofThisEvent</i> object, which is a
76 container class of collections of digits. The usages of <i>G4VDigi</i>
77 and <i>G4TDigiCollection</i> are almost the same as <i>G4VHit</i> and
78 <i>G4THitsCollection</i>, respectively, explained in the previous
79 section.
80<p>
81
82<HR>
83<a name="4.5.2">
84<H2>4.5.2 Digitizer module</H2></a>
85
86<B><i>G4VDigitizerModule</i></B>
87<P>
88 <i>G4VDigitizerModule</i> is an abstract base class which represents
89 a digitizer module. It has a pure virtual method, <tt>Digitize()</tt>.
90 A concrete digitizer module must have an implementation of this
91 virtual method.  The Geant4 kernel classes do not have a ``built-in'' invocation to
92 the <tt>Digitize()</tt> method. You have to implement your code to invoke
93 this method of your digitizer module.
94<p>
95 In the <tt>Digitize()</tt> method, you construct your <i>G4VDigi</i>
96 concrete class objects and store them to your <i>G4TDigiCollection</i>
97 concrete class object(s). Your collection(s) should be associated
98 with the <i>G4DCofThisEvent</i> object.
99<p>
100
101<B><i>G4DigiManager</i></B>
102<P>
103 <i>G4DigiManager</i> is the singleton manager class of the digitizer
104 modules. All of your concrete digitizer modules should be registered
105 to <i>G4DigiManager</i> with their unique names.
106 <pre>
107     G4DigiManager * fDM = G4DigiManager::GetDMpointer();
108     MyDigitizer * myDM = new MyDigitizer( "/myDet/myCal/myEMdigiMod" );
109     fDM-&gt;AddNewModule(myDM);
110 </pre>
111 Your concrete digitizer module can be accessed from your code using
112 the unique module name.
113 <pre>
114     G4DigiManager * fDM = G4DigiManager::GetDMpointer();
115     MyDigitizer * myDM = fDM-&gt;FindDigitizerModule( "/myDet/myCal/myEMdigiMod" );
116     myDM-&gt;Digitize();
117 </pre>
118 Also, <i>G4DigiManager</i> has a <i>Digitize()</i> method which takes
119 the unique module name.
120 <pre>
121     G4DigiManager * fDM = G4DigiManager::GetDMpointer();
122     MyDigitizer * myDM = fDM-&gt;Digitize( "/myDet/myCal/myEMdigiMod" );
123 </pre>
124<p>
125
126<B>How to get hitsCollection and/or digiCollection</B>
127<P>
128 <i>G4DigiManager</i> has the following methods to access to the
129 hits or digi collections of the currently processing event
130 or of previous events.
131<p>
132 First, you have to get the collection ID number of the hits or digits
133 collection.
134 <pre>
135     G4DigiManager * fDM = G4DigiManager::GetDMpointer();
136     G4int myHitsCollID = fDM-&gt;GetHitsCollectionID( "hits_collection_name" );
137     G4int myDigiCollID = fDM-&gt;GetDigiCollectionID( "digi_collection_name" );
138 </pre>
139 Then, you can get the pointer to your concrete <i>G4THitsCollection</i>
140 object or <i>G4TDigiCollection</i> object of the currently processing
141 event.
142 <pre>
143     MyHitsCollection * HC = fDM-&gt;GetHitsCollection( myHitsCollID );
144     MyDigiCollection * DC = fDM-&gt;GetDigiCollection( myDigiCollID );
145 </pre>
146 In case you want to access to the hits or digits collection of previous
147 events, add the second argument.
148 <pre>
149     MyHitsCollection * HC = fDM-&gt;GetHitsCollection( myHitsCollID, n );
150     MyDigiCollection * DC = fDM-&gt;GetDigiCollection( myDigiCollID, n );
151 </pre>
152 where, <tt>n</tt> indicates the hits or digits collection of the <tt>n</tt><sup>th</sup>
153 previous event.
154<p>
155
156<BR><BR>
157<HR>
158<A HREF="../../../../Authors/html/subjectsToAuthors.html">
159<I>About the authors</I></A>
160
161</BODY>
162</HTML>
Note: See TracBrowser for help on using the repository browser.