Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
parallel/TopC/ParN04/src/ExN04CalorimeterSD.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: ExN04CalorimeterSD.cc 78055 2013-12-03 08:27:48Z gcosmo $
27 //
30 //
31 
32 #include "ExN04CalorimeterSD.hh"
33 #include "ExN04CalorimeterHit.hh"
34 #include "G4VPhysicalVolume.hh"
35 #include "G4LogicalVolume.hh"
36 #include "G4Track.hh"
37 #include "G4Step.hh"
38 #include "G4ParticleDefinition.hh"
39 #include "G4VTouchable.hh"
40 #include "G4TouchableHistory.hh"
41 #include "G4SystemOfUnits.hh"
42 #include "G4ios.hh"
43 
46  numberOfCellsInZ(20),numberOfCellsInPhi(48)
47 {
48  G4String HCname;
49  collectionName.insert(HCname="calCollection");
50 }
51 
53 {;}
54 
56 {
59  for(G4int j=0;j<numberOfCellsInZ;j++)
60  for(G4int k=0;k<numberOfCellsInPhi;k++)
61  {
62  CellID[j][k] = -1;
63  }
64  verboseLevel = 0;
65 }
66 
68 {
69  if(!ROhist) return false;
71  if(verboseLevel>1) G4cout << "Next step edep(MeV) = " << edep/MeV << G4endl;
72  if(edep==0.) return false;
73 
74  G4VPhysicalVolume* physVol = ROhist->GetVolume();
75  //ROhist->MoveUpHistory();
76  //G4VPhysicalVolume* mothVol = ROhist->GetVolume(1);
77  G4int copyIDinZ = ROhist->GetReplicaNumber();
78  G4int copyIDinPhi = ROhist->GetReplicaNumber(1);
79 
80  if(CellID[copyIDinZ][copyIDinPhi]==-1)
81  {
82  ExN04CalorimeterHit* calHit
84  (physVol->GetLogicalVolume(),copyIDinZ,copyIDinPhi);
85  calHit->SetEdep( edep );
86  G4AffineTransform aTrans = ROhist->GetHistory()->GetTopTransform();
87  aTrans.Invert();
88  calHit->SetPos(aTrans.NetTranslation());
89  calHit->SetRot(aTrans.NetRotation());
90  G4int icell = CalCollection->insert( calHit );
91  CellID[copyIDinZ][copyIDinPhi] = icell - 1;
92  if(verboseLevel>0)
93  { G4cout << " New Calorimeter Hit on CellID "
94  << copyIDinZ << " " << copyIDinPhi << G4endl; }
95  }
96  else
97  {
98  (*CalCollection)[CellID[copyIDinZ][copyIDinPhi]]->AddEdep(edep);
99  if(verboseLevel>0)
100  { G4cout << " Energy added to CellID "
101  << copyIDinZ << " " << copyIDinPhi << G4endl; }
102  }
103 
104  return true;
105 }
106 
108 {
109  static G4int HCID = -1;
110  if(HCID<0)
111  { HCID = GetCollectionID(0); }
112  HCE->AddHitsCollection( HCID, CalCollection );
113 }
114 
116 {
117 }
118 
120 {
121 }
122 
124 {
125 }
126 
virtual G4int GetCollectionID(G4int i)
ExN04CalorimeterHitsCollection * CalCollection
const XML_Char * name
Definition: expat.h:151
virtual G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist)
G4LogicalVolume * GetLogicalVolume() const
static constexpr double MeV
Definition: G4SIunits.hh:214
G4int GetReplicaNumber(G4int depth=0) const
#define G4endl
Definition: G4ios.hh:61
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
G4THitsCollection< ExN04CalorimeterHit > ExN04CalorimeterHitsCollection
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
const G4NavigationHistory * GetHistory() const
G4VPhysicalVolume * GetVolume(G4int depth=0) const
const G4AffineTransform & GetTopTransform() const
G4AffineTransform & Invert()
G4double GetTotalEnergyDeposit() const
Definition: G4Step.hh:76
Double_t edep
G4ThreeVector NetTranslation() const
int G4int
Definition: G4Types.hh:78
G4CollectionNameVector collectionName
G4GLOB_DLL std::ostream G4cout
G4RotationMatrix NetRotation() const