Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
GammaRayTelDigitizer.cc
이 파일의 문서화 페이지로 가기
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: GammaRayTelDigitizer.cc 66508 2012-12-19 10:16:45Z gcosmo $
28 // ------------------------------------------------------------
29 // GEANT 4 class implementation file
30 // CERN Geneva Switzerland
31 //
32 //
33 // ------------ GammaRayTelDigitizer ------
34 // by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
35 //
36 // ************************************************************
37 
38 #include <vector>
39 
40 #include "GammaRayTelDigitizer.hh"
41 #include "GammaRayTelDigi.hh"
43 
44 #include "GammaRayTelTrackerHit.hh"
47 
48 #include "G4SystemOfUnits.hh"
49 #include "G4EventManager.hh"
50 #include "G4Event.hh"
51 #include "G4SDManager.hh"
52 #include "G4DigiManager.hh"
53 #include "G4ios.hh"
54 
55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
56 
58  :G4VDigitizerModule(name)
59 {
60 
61 
62  G4String colName = "DigitsCollection";
63  collectionName.push_back(colName);
64  Energy_Threshold = 120.*keV;
65  TotalEnergy = 0.;
66  ACDThreshold = 15*keV;
67 
68 //create a messenger for this class
70 
71 }
72 
73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
74 
76 {
77  delete digiMessenger;
78 }
79 
80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
81 
83 {
85  ("GammaRayTelDigitizer","DigitsCollection"); // to create the Digi Collection
86 
88 
89  G4int THCID; // TrackerCollection
90  G4int CHCID; // CalorimeterCollection
91  G4int AHCID; // AnticoincidenceCollection
92 
93  TotalEnergy = 0.; // at each event
94 
95  // TKR Hits collection
96 
97  THCID = DigiMan->GetHitsCollectionID("TrackerCollection");
100  (DigiMan->GetHitsCollection(THCID));
101 
102 
103  // CAL Hits collection
104 
105  CHCID = DigiMan->GetHitsCollectionID("CalorimeterCollection");
108  (DigiMan->GetHitsCollection(CHCID));
109 
110  // ACD Hits collection
111 
112  AHCID = DigiMan->GetHitsCollectionID("AnticoincidenceCollection");
115  (DigiMan->GetHitsCollection(AHCID));
116 
117 
118  if (THC)
119  {
120  G4int n_hit = THC->entries();
121 
122  for (G4int i=0;i<n_hit;i++)
123  {
124  G4double ESil = (*THC)[i]->GetEdepSil();
125  G4int NStrip = (*THC)[i]->GetNStrip();
126  G4int NPlane = (*THC)[i]->GetNSilPlane();
127  G4int IsX = (*THC)[i]->GetPlaneType();
128 
129  // digi generation only if energy deposit greater than threshold
130 
131  if (ESil>Energy_Threshold)
132  {
133  GammaRayTelDigi* Digi = new GammaRayTelDigi();
134  Digi->SetPlaneNumber(NPlane);
135  Digi->SetPlaneType(IsX);
136  Digi->SetStripNumber(NStrip);
137  Digi->SetDigiType(0);
138  Digi->SetEnergy(0.);
139  DigitsCollection->insert(Digi);
140  }
141  }
142  }
143  if (CHC)
144  {
145  G4int n_hit = CHC->entries();
146 
147  for (G4int i=0;i<n_hit;i++)
148  {
149  TotalEnergy +=(*CHC)[i]->GetEdepCAL();
150  }
151  // digi generation only if energy deposit greater than 0.
152 
153  if (TotalEnergy>0.)
154  {
155  GammaRayTelDigi* Digi = new GammaRayTelDigi();
156  Digi->SetPlaneNumber(0);
157  Digi->SetPlaneType(0);
158  Digi->SetStripNumber(0);
159  Digi->SetDigiType(1);
160  Digi->SetEnergy(TotalEnergy);
161  DigitsCollection->insert(Digi);
162  }
163 
164  }
165 
166  if (AHC)
167  {
168  G4int n_hit = AHC->entries();
169 
170  for (G4int i=0;i<n_hit;i++)
171  {
172  G4double energy = (*AHC)[i]->GetEdepACD();
173  G4int type = (*AHC)[i]->GetACDTileNumber();
174 
175  // digi generation only if energy deposit greater than 0.
176 
177  if (energy>ACDThreshold)
178  {
179  GammaRayTelDigi* Digi = new GammaRayTelDigi();
180  Digi->SetPlaneNumber(0);
181  Digi->SetPlaneType(0);
182  Digi->SetStripNumber(type);
183  Digi->SetDigiType(2);
184  Digi->SetEnergy(energy);
185  DigitsCollection->insert(Digi);
186  }
187 
188  }
189  }
190 
191  if (THC||AHC||CHC){
192  G4cout << "Number of digits in this event = "
194  // << " " << DigitsCollection->GetName()
195  // << " " << DigitsCollection->GetDMname()
196  << G4endl;
197  }
198 
200 
201  G4int DCID = -1;
202  if(DCID<0)
203  {
204  // DigiMan->List();
205  DCID = DigiMan->GetDigiCollectionID("GammaRayTelDigitizer/DigitsCollection");
206  }
207 
208 
209 }
210 
211 
212 
213 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
214 
215 
216 
217 
218 
219 
220 
221 
222 
223 
static G4DigiManager * GetDMpointer()
const XML_Char * name
Definition: expat.h:151
G4int insert(T *aHit)
G4int GetDigiCollectionID(G4String DCname)
std::vector< G4String > collectionName
static constexpr double keV
Definition: G4SIunits.hh:216
#define G4endl
Definition: G4ios.hh:61
const G4VHitsCollection * GetHitsCollection(G4int HCID, G4int eventID=0)
void SetPlaneType(G4int PlaneTyp)
G4TDigiCollection< GammaRayTelDigi > GammaRayTelDigitsCollection
GammaRayTelDigitizerMessenger * digiMessenger
double G4double
Definition: G4Types.hh:76
double energy
Definition: plottest35.C:25
G4int entries() const
void SetStripNumber(G4int StripNum)
int G4int
Definition: G4Types.hh:78
G4int GetHitsCollectionID(G4String HCname)
G4GLOB_DLL std::ostream G4cout
void SetPlaneNumber(G4int PlaneNum)
void SetDigiType(G4int DigiID)
GammaRayTelDigitizer(G4String name)
GammaRayTelDigitsCollection * DigitsCollection
void SetEnergy(G4double Ene)
void StoreDigiCollection(G4VDigiCollection *aDC)