ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GammaRayTelDigitizer.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file 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 // ------------------------------------------------------------
28 // GEANT 4 class implementation file
29 // CERN Geneva Switzerland
30 //
31 //
32 // ------------ GammaRayTelDigitizer ------
33 // by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
34 //
35 // ************************************************************
36 
37 #include <vector>
38 
39 #include "GammaRayTelDigitizer.hh"
40 #include "GammaRayTelDigi.hh"
42 
43 #include "GammaRayTelTrackerHit.hh"
46 
47 #include "G4SystemOfUnits.hh"
48 #include "G4EventManager.hh"
49 #include "G4Event.hh"
50 #include "G4SDManager.hh"
51 #include "G4DigiManager.hh"
52 #include "G4ios.hh"
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
55 
57  :G4VDigitizerModule(name)
58 {
59 
60 
61  G4String colName = "DigitsCollection";
62  collectionName.push_back(colName);
63  Energy_Threshold = 120.*keV;
64  TotalEnergy = 0.;
65  ACDThreshold = 15*keV;
66 
67 //create a messenger for this class
69 
70 }
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
73 
75 {
76  delete digiMessenger;
77 }
78 
79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
80 
82 {
84  ("GammaRayTelDigitizer","DigitsCollection"); // to create the Digi Collection
85 
87 
88  G4int THCID; // TrackerCollection
89  G4int CHCID; // CalorimeterCollection
90  G4int AHCID; // AnticoincidenceCollection
91 
92  TotalEnergy = 0.; // at each event
93 
94  // TKR Hits collection
95 
96  THCID = DigiMan->GetHitsCollectionID("TrackerCollection");
99  (DigiMan->GetHitsCollection(THCID));
100 
101 
102  // CAL Hits collection
103 
104  CHCID = DigiMan->GetHitsCollectionID("CalorimeterCollection");
107  (DigiMan->GetHitsCollection(CHCID));
108 
109  // ACD Hits collection
110 
111  AHCID = DigiMan->GetHitsCollectionID("AnticoincidenceCollection");
114  (DigiMan->GetHitsCollection(AHCID));
115 
116 
117  if (THC)
118  {
119  G4int n_hit = THC->entries();
120 
121  for (G4int i=0;i<n_hit;i++)
122  {
123  G4double ESil = (*THC)[i]->GetEdepSil();
124  G4int NStrip = (*THC)[i]->GetNStrip();
125  G4int NPlane = (*THC)[i]->GetNSilPlane();
126  G4int IsX = (*THC)[i]->GetPlaneType();
127 
128  // digi generation only if energy deposit greater than threshold
129 
130  if (ESil>Energy_Threshold)
131  {
132  GammaRayTelDigi* Digi = new GammaRayTelDigi();
133  Digi->SetPlaneNumber(NPlane);
134  Digi->SetPlaneType(IsX);
135  Digi->SetStripNumber(NStrip);
136  Digi->SetDigiType(0);
137  Digi->SetEnergy(0.);
138  DigitsCollection->insert(Digi);
139  }
140  }
141  }
142  if (CHC)
143  {
144  G4int n_hit = CHC->entries();
145 
146  for (G4int i=0;i<n_hit;i++)
147  {
148  TotalEnergy +=(*CHC)[i]->GetEdepCAL();
149  }
150  // digi generation only if energy deposit greater than 0.
151 
152  if (TotalEnergy>0.)
153  {
154  GammaRayTelDigi* Digi = new GammaRayTelDigi();
155  Digi->SetPlaneNumber(0);
156  Digi->SetPlaneType(0);
157  Digi->SetStripNumber(0);
158  Digi->SetDigiType(1);
159  Digi->SetEnergy(TotalEnergy);
160  DigitsCollection->insert(Digi);
161  }
162 
163  }
164 
165  if (AHC)
166  {
167  G4int n_hit = AHC->entries();
168 
169  for (G4int i=0;i<n_hit;i++)
170  {
171  G4double energy = (*AHC)[i]->GetEdepACD();
172  G4int type = (*AHC)[i]->GetACDTileNumber();
173 
174  // digi generation only if energy deposit greater than 0.
175 
176  if (energy>ACDThreshold)
177  {
178  GammaRayTelDigi* Digi = new GammaRayTelDigi();
179  Digi->SetPlaneNumber(0);
180  Digi->SetPlaneType(0);
181  Digi->SetStripNumber(type);
182  Digi->SetDigiType(2);
183  Digi->SetEnergy(energy);
184  DigitsCollection->insert(Digi);
185  }
186 
187  }
188  }
189 
190  if (THC||AHC||CHC){
191  G4cout << "Number of digits in this event = "
193  // << " " << DigitsCollection->GetName()
194  // << " " << DigitsCollection->GetDMname()
195  << G4endl;
196  }
197 
199 
200  G4int DCID = -1;
201  if(DCID<0)
202  {
203  // DigiMan->List();
204  DCID = DigiMan->GetDigiCollectionID("GammaRayTelDigitizer/DigitsCollection");
205  }
206 
207 
208 }
209 
210 
211 
212 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
213 
214 
215 
216 
217 
218 
219 
220 
221 
222