Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
B5HadCalorimeterSD.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 // $Id: B5HadCalorimeterSD.cc 101036 2016-11-04 09:00:23Z gcosmo $
27 //
30 
31 #include "B5HadCalorimeterSD.hh"
32 #include "B5HadCalorimeterHit.hh"
33 #include "B5Constants.hh"
34 
35 #include "G4HCofThisEvent.hh"
36 #include "G4TouchableHistory.hh"
37 #include "G4Track.hh"
38 #include "G4Step.hh"
39 #include "G4SDManager.hh"
40 #include "G4ios.hh"
41 
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43 
45 : G4VSensitiveDetector(name),
46  fHitsCollection(nullptr), fHCID(-1)
47 {
48  collectionName.insert("HadCalorimeterColl");
49 }
50 
51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
52 
54 {}
55 
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57 
59 {
62  if (fHCID<0) {
64  }
66 
67  // fill calorimeter hits with zero energy deposition
68  for (auto column=0;column<kNofHadColumns;column++) {
69  for (auto row=0;row<kNofHadRows;row++) {
71  }
72  }
73 }
74 
75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
76 
78 {
79  auto edep = step->GetTotalEnergyDeposit();
80  if (edep==0.) return true;
81 
82  auto touchable = step->GetPreStepPoint()->GetTouchable();
83  auto rowNo = touchable->GetCopyNumber(2);
84  auto columnNo = touchable->GetCopyNumber(3);
85  auto hitID = kNofHadRows*columnNo+rowNo;
86  auto hit = (*fHitsCollection)[hitID];
87 
88  // check if it is first touch
89  if (hit->GetColumnID()<0) {
90  hit->SetColumnID(columnNo);
91  hit->SetRowID(rowNo);
92  auto depth = touchable->GetHistory()->GetDepth();
93  auto transform = touchable->GetHistory()->GetTransform(depth-2);
94  transform.Invert();
95  hit->SetRot(transform.NetRotation());
96  hit->SetPos(transform.NetTranslation());
97  }
98  // add energy deposition
99  hit->AddEdep(edep);
100 
101  return true;
102 }
103 
104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:135
const XML_Char * name
Definition: expat.h:151
const G4VTouchable * GetTouchable() const
G4THitsCollection< B5HadCalorimeterHit > B5HadCalorimeterHitsCollection
G4StepPoint * GetPreStepPoint() const
Definition of the B5HadCalorimeterHit class.
B5HadCalorimeterSD(G4String name)
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
B5HadCalorimeterHitsCollection * fHitsCollection
bool G4bool
Definition: G4Types.hh:79
virtual void Initialize(G4HCofThisEvent *HCE)
constexpr G4int kNofHadRows
Definition: B5Constants.hh:43
constexpr G4int kNofHadColumns
Definition: B5Constants.hh:42
G4double GetTotalEnergyDeposit() const
Definition: G4Step.hh:76
G4int GetCopyNumber(G4int depth=0) const
Double_t edep
virtual G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist)
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
G4CollectionNameVector collectionName
Definition of the B5HadCalorimeterSD class.
Definition of constants.