source: trunk/Documentation/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch04s05.html @ 902

Last change on this file since 902 was 901, checked in by garnier, 16 years ago

Add Geant4 Documentation at 8.12.2008

File size: 8.4 KB
Line 
1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>4.5.  Digitization</title><link rel="stylesheet" href="../xml/XSLCustomizationLayer/G4HTMLStylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.71.1"><link rel="start" href="index.html" title="Geant4 User's Guide for Application Developers"><link rel="up" href="ch04.html" title="Chapter 4.  Detector Definition and Response"><link rel="prev" href="ch04s04.html" title="4.4.  Hits"><link rel="next" href="ch04s06.html" title="4.6.  Object Persistency"><script language="JavaScript">
2function remote_win(fName)
3{
4   var url = "AllResources/Detector/geometry.src/" + fName;
5   RemoteWin=window.open(url,"","resizable=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,copyhistory=0,width=520,height=520")
6   RemoteWin.creator=self
7}
8</script></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">4.5. 
9Digitization
10</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s04.html"><img src="AllResources/IconsGIF/prev.gif" alt="Prev"></a> </td><th width="60%" align="center">Chapter 4. 
11Detector Definition and Response
12</th><td width="20%" align="right"> <a accesskey="n" href="ch04s06.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect.Digi"></a>4.5. 
13Digitization
14</h2></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.Digi.Digi"></a>4.5.1. 
15Digi
16</h3></div></div></div><p>
17A hit is created by a sensitive detector when a step goes through
18it. Thus, the sensitive detector is associated to the corresponding
19<span class="emphasis"><em>G4LogicalVolume</em></span> object(s). On the other hand, a digit is
20created using information of hits and/or other digits by a
21digitizer module. The digitizer module is not associated with any
22volume, and you have to implicitly invoke the <code class="literal">Digitize()</code>
23method of your concrete <span class="emphasis"><em>G4VDigitizerModule</em></span> class.
24</p><p>
25Typical usages of digitizer module include:
26
27</p><div class="itemizedlist"><ul type="disc" compact><li><p>
28    simulate ADC and/or TDC
29  </p></li><li><p>
30    simulate readout scheme
31  </p></li><li><p>
32    generate raw data
33  </p></li><li><p>
34    simulate trigger logics
35  </p></li><li><p>
36    simulate pile up
37  </p></li></ul></div><p>
38</p><h5><a name="id431887"></a>
39G4VDigi
40</h5><p>
41<span class="emphasis"><em>G4VDigi</em></span> is an abstract base class which represents a
42digit. You have to inherit this base class and derive your own
43concrete digit class(es). The member data of your concrete digit
44class should be defined by yourself. <span class="emphasis"><em>G4VDigi</em></span> has two virtual
45methods, <code class="literal">Draw()</code> and <code class="literal">Print()</code>.
46</p><h5><a name="id431920"></a>
47G4TDigiCollection
48</h5><p>
49<span class="emphasis"><em>G4TDigiCollection</em></span> is a template class for digits
50collections, which is derived from the abstract base class
51<span class="emphasis"><em>G4VDigiCollection</em></span>. <span class="emphasis"><em>G4Event</em></span> has a
52<span class="emphasis"><em>G4DCofThisEvent</em></span> object, which is a container class of
53collections of digits. The usages of <span class="emphasis"><em>G4VDigi</em></span> and
54<span class="emphasis"><em>G4TDigiCollection</em></span> are almost the same as <span class="emphasis"><em>G4VHit</em></span> and
55<span class="emphasis"><em>G4THitsCollection</em></span>, respectively, explained in the previous
56section.
57</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.Digi.DigMod"></a>4.5.2. 
58Digitizer module
59</h3></div></div></div><h5><a name="id431976"></a>
60G4VDigitizerModule
61</h5><p>
62<span class="emphasis"><em>G4VDigitizerModule</em></span> is an abstract base class which
63represents a digitizer module. It has a pure virtual method,
64<code class="literal">Digitize()</code>. A concrete digitizer module must have an
65implementation of this virtual method. The Geant4 kernel classes do
66not have a ``built-in'' invocation to the <code class="literal">Digitize()</code>
67method. You have to implement your code to invoke this method of
68your digitizer module.
69</p><p>
70In the <code class="literal">Digitize()</code> method, you construct your
71<span class="emphasis"><em>G4VDigi</em></span> concrete class objects and store them to your
72<span class="emphasis"><em>G4TDigiCollection</em></span> concrete class object(s). Your
73collection(s) should be associated with the <span class="emphasis"><em>G4DCofThisEvent</em></span>
74object.
75</p><h5><a name="id432028"></a>
76G4DigiManager
77</h5><p>
78<span class="emphasis"><em>G4DigiManager</em></span> is the singleton manager class of the
79digitizer modules. All of your concrete digitizer modules should be
80registered to <span class="emphasis"><em>G4DigiManager</em></span> with their unique names.
81
82</p><div class="informalexample"><pre class="programlisting">
83     G4DigiManager * fDM = G4DigiManager::GetDMpointer();
84     MyDigitizer * myDM = new MyDigitizer( "/myDet/myCal/myEMdigiMod" );
85     fDM-&gt;AddNewModule(myDM);
86</pre></div><p> 
87</p><p>
88Your concrete digitizer module can be accessed from your code using
89the unique module name.
90
91</p><div class="informalexample"><pre class="programlisting">
92     G4DigiManager * fDM = G4DigiManager::GetDMpointer();
93     MyDigitizer * myDM = fDM-&gt;FindDigitizerModule( "/myDet/myCal/myEMdigiMod" );
94     myDM-&gt;Digitize();
95</pre></div><p> 
96</p><p>
97Also, <span class="emphasis"><em>G4DigiManager</em></span> has a <span class="emphasis"><em>Digitize()</em></span> 
98method which takes the unique module name.
99
100</p><div class="informalexample"><pre class="programlisting">
101     G4DigiManager * fDM = G4DigiManager::GetDMpointer();
102     MyDigitizer * myDM = fDM-&gt;Digitize( "/myDet/myCal/myEMdigiMod" );
103</pre></div><p> 
104</p><h5><a name="id432095"></a>
105How to get hitsCollection and/or digiCollection
106</h5><p>
107<span class="emphasis"><em>G4DigiManager</em></span> has the following methods to access to the
108hits or digi collections of the currently processing event or of
109previous events.
110</p><p>
111First, you have to get the collection ID number of the hits or
112digits collection.
113
114</p><div class="informalexample"><pre class="programlisting">
115     G4DigiManager * fDM = G4DigiManager::GetDMpointer();
116     G4int myHitsCollID = fDM-&gt;GetHitsCollectionID( "hits_collection_name" );
117     G4int myDigiCollID = fDM-&gt;GetDigiCollectionID( "digi_collection_name" );
118</pre></div><p> 
119</p><p>
120Then, you can get the pointer to your concrete
121<span class="emphasis"><em>G4THitsCollection</em></span> object or
122<span class="emphasis"><em>G4TDigiCollection</em></span> object of the currently processing event.
123
124</p><div class="informalexample"><pre class="programlisting"> 
125     MyHitsCollection * HC = fDM-&gt;GetHitsCollection( myHitsCollID );
126     MyDigiCollection * DC = fDM-&gt;GetDigiCollection( myDigiCollID );
127</pre></div><p> 
128</p><p>
129In case you want to access to the hits or digits collection of
130previous events, add the second argument.
131
132</p><div class="informalexample"><pre class="programlisting"> 
133     MyHitsCollection * HC = fDM-&gt;GetHitsCollection( myHitsCollID, n );
134     MyDigiCollection * DC = fDM-&gt;GetDigiCollection( myDigiCollID, n );
135</pre></div><p> 
136
137where, <code class="literal">n</code> indicates the hits or digits collection of the
138<code class="literal">n</code><sup>th</sup> previous event.
139</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s04.html"><img src="AllResources/IconsGIF/prev.gif" alt="Prev"></a> </td><td width="20%" align="center"><a accesskey="u" href="ch04.html"><img src="AllResources/IconsGIF/up.gif" alt="Up"></a></td><td width="40%" align="right"> <a accesskey="n" href="ch04s06.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">4.4. 
140Hits
141 </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="AllResources/IconsGIF/home.gif" alt="Home"></a></td><td width="40%" align="right" valign="top"> 4.6. 
142Object Persistency
143</td></tr></table></div></body></html>
Note: See TracBrowser for help on using the repository browser.