Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
GammaRayTelCalorimeterSD.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: GammaRayTelCalorimeterSD.cc 109971 2018-05-14 07:06:05Z gcosmo $
28 // ------------------------------------------------------------
29 // GEANT 4 class implementation file
30 // CERN Geneva Switzerland
31 //
32 //
33 // ------------ GammaRayTelCalorimeterSD ------
34 // by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
35 //
36 // ************************************************************
37 #include "G4RunManager.hh"
41 
42 #include "G4SystemOfUnits.hh"
43 #include "G4VPhysicalVolume.hh"
44 #include "G4Step.hh"
45 #include "G4VTouchable.hh"
46 #include "G4TouchableHistory.hh"
47 #include "G4SDManager.hh"
48 #include "G4ios.hh"
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
51 
53 {
55  Detector =
57 
60 
61  //G4cout << NbOfCALBars << " bars " << G4endl;
62  //G4cout << NbOfCALLayers << " layers " << G4endl;
63 
65 
68  collectionName.insert("CalorimeterCollection");
69 }
70 
71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
72 
74 {
75  delete [] ChitXID;
76  delete [] ChitYID;
77 }
78 
79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
80 
82 {
85  for (G4int i=0;i<NbOfCALChannels;i++)
86  {
87  ChitXID[i] = -1;
88  ChitYID[i] = -1;
89  };
90 }
91 
92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
93 
95 {
96 
97  G4double edep = 0.;
98  edep = aStep->GetTotalEnergyDeposit();
99  if (edep == 0.) return false;
100 
101  // This TouchableHistory is used to obtain the physical volume
102  // of the hit
103  G4TouchableHistory* theTouchable
105 
106  G4VPhysicalVolume* cal_bar = theTouchable->GetVolume();
107  G4VPhysicalVolume* cal_plane = theTouchable->GetVolume(1);
108 
109  G4int CALBarNumber=cal_bar->GetCopyNo();
110  G4String CALBarName = cal_bar->GetName();
111 
112  G4int PlaneNumber = 0;
113  PlaneNumber=cal_plane->GetCopyNo();
114  G4String PlaneName = cal_plane->GetName();
115 
116 
117  G4int NChannel = 0;
118 
119  NChannel = PlaneNumber * NbOfCALBars + CALBarNumber;
120 
121  if (PlaneName == "CALLayerX" )
122 
123  // The hit is on an X CsI plane
124 
125  {
126  // This is a new hit
127  if (ChitXID[NChannel]==-1)
128  {
130  CalorimeterHit->SetCALType(1);
131  CalorimeterHit->AddEnergy(edep);
132  CalorimeterHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
133  CalorimeterHit->SetCALPlaneNumber(PlaneNumber);
134  CalorimeterHit->SetCALBarNumber(CALBarNumber);
135  ChitXID[NChannel] =
136  CalorimeterCollection->insert(CalorimeterHit) -1;
137  }
138  else // This is not new
139  {
140  (*CalorimeterCollection)
141  [ChitXID[NChannel]]->AddEnergy(edep);
142  }
143  }
144 
145  if (PlaneName == "CALLayerY")
146  // The hit is on an Y CsI plane
147  {
148  // This is a new hit
149  if (ChitYID[NChannel]==-1)
150  {
151  GammaRayTelCalorimeterHit* CalorimeterHit
153  CalorimeterHit->SetCALType(0);
154  CalorimeterHit->AddEnergy(edep);
155  CalorimeterHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
156  CalorimeterHit->SetCALPlaneNumber(PlaneNumber);
157  CalorimeterHit->SetCALBarNumber(CALBarNumber);
158  ChitYID[NChannel] =
159  CalorimeterCollection->insert(CalorimeterHit)-1;
160  }
161  else // This is not new
162  {
163  (*CalorimeterCollection)
164  [ChitYID[NChannel]]->AddEnergy(edep);
165  }
166  }
167 
168  return true;
169 }
170 
171 
172 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
174 {
175  static G4int HCID = -1;
176  if(HCID<0)
177  {
179  }
181 
182 
183  for (G4int i=0;i<NbOfCALChannels;i++)
184  {
185  ChitXID[i] = -1;
186  ChitYID[i] = -1;
187  };
188 }
189 
190 
191 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
192 
194 {}
195 
196 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
197 
199 {}
200 
201 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
202 
204 {}
205 
206 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
207 
208 
209 
210 
211 
212 
213 
214 
215 
216 
217 
218 
219 
220 
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:135
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
const XML_Char * name
Definition: expat.h:151
void EndOfEvent(G4HCofThisEvent *)
const G4VTouchable * GetTouchable() const
G4StepPoint * GetPreStepPoint() const
GammaRayTelDetectorConstruction * Detector
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
G4VPhysicalVolume * GetVolume(G4int depth=0) const
const G4ThreeVector & GetPosition() const
GammaRayTelCalorimeterHitsCollection * CalorimeterCollection
G4double GetTotalEnergyDeposit() const
virtual G4int GetCopyNo() const =0
Definition: G4Step.hh:76
Double_t edep
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
int G4int
Definition: G4Types.hh:78
G4CollectionNameVector collectionName
void Initialize(G4HCofThisEvent *)
G4THitsCollection< GammaRayTelCalorimeterHit > GammaRayTelCalorimeterHitsCollection
G4bool ProcessHits(G4Step *astep, G4TouchableHistory *ROHist)
const G4VUserDetectorConstruction * GetUserDetectorConstruction() const
const G4String & GetName() const