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"> |
---|
2 | function 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. |
---|
9 | Digitization |
---|
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. |
---|
11 | Detector 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. |
---|
13 | Digitization |
---|
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. |
---|
15 | Digi |
---|
16 | </h3></div></div></div><p> |
---|
17 | A hit is created by a sensitive detector when a step goes through |
---|
18 | it. 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 |
---|
20 | created using information of hits and/or other digits by a |
---|
21 | digitizer module. The digitizer module is not associated with any |
---|
22 | volume, and you have to implicitly invoke the <code class="literal">Digitize()</code> |
---|
23 | method of your concrete <span class="emphasis"><em>G4VDigitizerModule</em></span> class. |
---|
24 | </p><p> |
---|
25 | Typical 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> |
---|
39 | G4VDigi |
---|
40 | </h5><p> |
---|
41 | <span class="emphasis"><em>G4VDigi</em></span> is an abstract base class which represents a |
---|
42 | digit. You have to inherit this base class and derive your own |
---|
43 | concrete digit class(es). The member data of your concrete digit |
---|
44 | class should be defined by yourself. <span class="emphasis"><em>G4VDigi</em></span> has two virtual |
---|
45 | methods, <code class="literal">Draw()</code> and <code class="literal">Print()</code>. |
---|
46 | </p><h5><a name="id431920"></a> |
---|
47 | G4TDigiCollection |
---|
48 | </h5><p> |
---|
49 | <span class="emphasis"><em>G4TDigiCollection</em></span> is a template class for digits |
---|
50 | collections, 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 |
---|
53 | collections 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 |
---|
56 | section. |
---|
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. |
---|
58 | Digitizer module |
---|
59 | </h3></div></div></div><h5><a name="id431976"></a> |
---|
60 | G4VDigitizerModule |
---|
61 | </h5><p> |
---|
62 | <span class="emphasis"><em>G4VDigitizerModule</em></span> is an abstract base class which |
---|
63 | represents a digitizer module. It has a pure virtual method, |
---|
64 | <code class="literal">Digitize()</code>. A concrete digitizer module must have an |
---|
65 | implementation of this virtual method. The Geant4 kernel classes do |
---|
66 | not have a ``built-in'' invocation to the <code class="literal">Digitize()</code> |
---|
67 | method. You have to implement your code to invoke this method of |
---|
68 | your digitizer module. |
---|
69 | </p><p> |
---|
70 | In 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 |
---|
73 | collection(s) should be associated with the <span class="emphasis"><em>G4DCofThisEvent</em></span> |
---|
74 | object. |
---|
75 | </p><h5><a name="id432028"></a> |
---|
76 | G4DigiManager |
---|
77 | </h5><p> |
---|
78 | <span class="emphasis"><em>G4DigiManager</em></span> is the singleton manager class of the |
---|
79 | digitizer modules. All of your concrete digitizer modules should be |
---|
80 | registered 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->AddNewModule(myDM); |
---|
86 | </pre></div><p> |
---|
87 | </p><p> |
---|
88 | Your concrete digitizer module can be accessed from your code using |
---|
89 | the unique module name. |
---|
90 | |
---|
91 | </p><div class="informalexample"><pre class="programlisting"> |
---|
92 | G4DigiManager * fDM = G4DigiManager::GetDMpointer(); |
---|
93 | MyDigitizer * myDM = fDM->FindDigitizerModule( "/myDet/myCal/myEMdigiMod" ); |
---|
94 | myDM->Digitize(); |
---|
95 | </pre></div><p> |
---|
96 | </p><p> |
---|
97 | Also, <span class="emphasis"><em>G4DigiManager</em></span> has a <span class="emphasis"><em>Digitize()</em></span> |
---|
98 | method which takes the unique module name. |
---|
99 | |
---|
100 | </p><div class="informalexample"><pre class="programlisting"> |
---|
101 | G4DigiManager * fDM = G4DigiManager::GetDMpointer(); |
---|
102 | MyDigitizer * myDM = fDM->Digitize( "/myDet/myCal/myEMdigiMod" ); |
---|
103 | </pre></div><p> |
---|
104 | </p><h5><a name="id432095"></a> |
---|
105 | How 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 |
---|
108 | hits or digi collections of the currently processing event or of |
---|
109 | previous events. |
---|
110 | </p><p> |
---|
111 | First, you have to get the collection ID number of the hits or |
---|
112 | digits collection. |
---|
113 | |
---|
114 | </p><div class="informalexample"><pre class="programlisting"> |
---|
115 | G4DigiManager * fDM = G4DigiManager::GetDMpointer(); |
---|
116 | G4int myHitsCollID = fDM->GetHitsCollectionID( "hits_collection_name" ); |
---|
117 | G4int myDigiCollID = fDM->GetDigiCollectionID( "digi_collection_name" ); |
---|
118 | </pre></div><p> |
---|
119 | </p><p> |
---|
120 | Then, 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->GetHitsCollection( myHitsCollID ); |
---|
126 | MyDigiCollection * DC = fDM->GetDigiCollection( myDigiCollID ); |
---|
127 | </pre></div><p> |
---|
128 | </p><p> |
---|
129 | In case you want to access to the hits or digits collection of |
---|
130 | previous events, add the second argument. |
---|
131 | |
---|
132 | </p><div class="informalexample"><pre class="programlisting"> |
---|
133 | MyHitsCollection * HC = fDM->GetHitsCollection( myHitsCollID, n ); |
---|
134 | MyDigiCollection * DC = fDM->GetDigiCollection( myDigiCollID, n ); |
---|
135 | </pre></div><p> |
---|
136 | |
---|
137 | where, <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. |
---|
140 | Hits |
---|
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. |
---|
142 | Object Persistency |
---|
143 | </td></tr></table></div></body></html> |
---|