Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GammaRayTelDigitizer.cc
Go to the documentation of this file.
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
69  digiMessenger = new GammaRayTelDigitizerMessenger(this);
70 
71 }
72 
73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
74 
76 {
77  delete digiMessenger;
78 }
79 
80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
81 
83 {
84  DigitsCollection = new GammaRayTelDigitsCollection
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 = "
193  << DigitsCollection->entries()
194  // << " " << DigitsCollection->GetName()
195  // << " " << DigitsCollection->GetDMname()
196  << G4endl;
197  }
198 
199  StoreDigiCollection(DigitsCollection);
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 
G4int insert(T *aHit)
void SetStripNumber(G4int StripNum)
static G4DigiManager * GetDMpointer()
const XML_Char * name
void SetPlaneType(G4int PlaneTyp)
GammaRayTelDigitizer(G4String name)
const G4VHitsCollection * GetHitsCollection(G4int HCID, G4int eventID=0)
int G4int
Definition: G4Types.hh:78
double precision function energy(A, Z)
Definition: dpm25nuc6.f:4106
G4GLOB_DLL std::ostream G4cout
G4int GetHitsCollectionID(G4String HCname)
G4int entries() const
void SetEnergy(G4double Ene)
void SetPlaneNumber(G4int PlaneNum)
G4int GetDigiCollectionID(G4String DCname)
void StoreDigiCollection(G4VDigiCollection *aDC)
G4TDigiCollection< GammaRayTelDigi > GammaRayTelDigitsCollection
#define G4endl
Definition: G4ios.hh:61
void SetDigiType(G4int DigiID)
double G4double
Definition: G4Types.hh:76
std::vector< G4String > collectionName