Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
LXePMTSD.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: LXePMTSD.cc 110138 2018-05-16 07:31:43Z gcosmo $
27 //
30 //
31 //
32 #include "LXePMTSD.hh"
33 #include "LXePMTHit.hh"
36 
37 #include "G4VPhysicalVolume.hh"
38 #include "G4LogicalVolume.hh"
39 #include "G4Track.hh"
40 #include "G4Step.hh"
41 #include "G4VTouchable.hh"
42 #include "G4TouchableHistory.hh"
43 #include "G4ios.hh"
44 #include "G4ParticleTypes.hh"
45 #include "G4ParticleDefinition.hh"
46 
47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48 
50  : G4VSensitiveDetector(name),fPMTHitCollection(nullptr),
51  fPMTPositionsX(nullptr),fPMTPositionsY(nullptr),fPMTPositionsZ(nullptr)
52 {
53  collectionName.insert("pmtHitCollection");
54 }
55 
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57 
59 
60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
61 
62 void LXePMTSD::SetPmtPositions(const std::vector<G4ThreeVector>& positions)
63 {
64  for (G4int i=0; i<G4int(positions.size()); ++i) {
65  if(fPMTPositionsX)fPMTPositionsX->push_back(positions[i].x());
66  if(fPMTPositionsY)fPMTPositionsY->push_back(positions[i].y());
67  if(fPMTPositionsZ)fPMTPositionsZ->push_back(positions[i].z());
68  }
69 }
70 
71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
72 
76  //Store collection with event and keep ID
77  static G4int hitCID = -1;
78  if(hitCID<0){
79  hitCID = GetCollectionID(0);
80  }
81  hitsCE->AddHitsCollection( hitCID, fPMTHitCollection );
82 }
83 
84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85 
87  return false;
88 }
89 
90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
91 
92 //Generates a hit and uses the postStepPoint's mother volume replica number
93 //PostStepPoint because the hit is generated manually when the photon is
94 //absorbed by the photocathode
95 
98 
99  //need to know if this is an optical photon
100  if(aStep->GetTrack()->GetDefinition()
101  != G4OpticalPhoton::OpticalPhotonDefinition()) return false;
102 
103  //User replica number 1 since photocathode is a daughter volume
104  //to the pmt which was replicated
105  G4int pmtNumber=
107  G4VPhysicalVolume* physVol=
108  aStep->GetPostStepPoint()->GetTouchable()->GetVolume(1);
109 
110  //Find the correct hit collection
112  LXePMTHit* hit = nullptr;
113  for(G4int i=0;i<n;i++){
114  if((*fPMTHitCollection)[i]->GetPMTNumber()==pmtNumber){
115  hit=(*fPMTHitCollection)[i];
116  break;
117  }
118  }
119 
120  if (hit == nullptr) {//this pmt wasnt previously hit in this event
121  hit = new LXePMTHit(); //so create new hit
122  hit->SetPMTNumber(pmtNumber);
123  hit->SetPMTPhysVol(physVol);
125  hit->SetPMTPos((*fPMTPositionsX)[pmtNumber],(*fPMTPositionsY)[pmtNumber],
126  (*fPMTPositionsZ)[pmtNumber]);
127  }
128 
129  hit->IncPhotonCount(); //increment hit for the selected pmt
130 
132  hit->SetDrawit(true);
133  //If the sphere is disabled then this hit is automaticaly drawn
134  }
135  else{//sphere enabled
136  LXeUserTrackInformation* trackInfo=
138  if(trackInfo->GetTrackStatus()&hitSphere)
139  //only draw this hit if the photon has hit the sphere first
140  hit->SetDrawit(true);
141  }
142 
143  return true;
144 }
145 
146 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
147 
149 
150 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
151 
153 
154 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
155 
157 
158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
159 
Float_t x
Definition: compare.C:6
virtual G4int GetCollectionID(G4int i)
const XML_Char * name
Definition: expat.h:151
const G4VTouchable * GetTouchable() const
void SetPmtPositions(const std::vector< G4ThreeVector > &positions)
Definition: LXePMTSD.cc:62
virtual ~LXePMTSD()
Definition: LXePMTSD.cc:58
LXePMTSD(G4String name)
Definition: LXePMTSD.cc:49
void SetPMTNumber(G4int n)
Definition: LXePMTHit.hh:71
void SetDrawit(G4bool b)
Definition: LXePMTHit.hh:65
void IncPhotonCount()
Definition: LXePMTHit.hh:68
Float_t y
Definition: compare.C:6
Double_t z
virtual void Initialize(G4HCofThisEvent *)
Definition: LXePMTSD.cc:73
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
Definition: G4VTouchable.cc:44
void DrawAll()
Definition: LXePMTSD.cc:156
G4ParticleDefinition * GetDefinition() const
void PrintAll()
Definition: LXePMTSD.cc:160
virtual void clear()
Definition: LXePMTSD.cc:152
bool G4bool
Definition: G4Types.hh:79
G4DataVector * fPMTPositionsY
Definition: LXePMTSD.hh:81
G4THitsCollection< LXePMTHit > LXePMTHitsCollection
Definition: LXePMTHit.hh:93
G4bool ProcessHits_constStep(const G4Step *, G4TouchableHistory *)
Definition: LXePMTSD.cc:96
Definition of the LXeUserTrackInformation class.
G4DataVector * fPMTPositionsZ
Definition: LXePMTSD.hh:82
G4Track * GetTrack() const
static G4OpticalPhoton * OpticalPhotonDefinition()
Definition: G4Step.hh:76
G4StepPoint * GetPostStepPoint() const
Definition of the LXeDetectorConstruction class.
G4DataVector * fPMTPositionsX
Definition: LXePMTSD.hh:80
virtual void EndOfEvent(G4HCofThisEvent *)
Definition: LXePMTSD.cc:148
LXePMTHitsCollection * fPMTHitCollection
Definition: LXePMTSD.hh:78
int G4int
Definition: G4Types.hh:78
void SetPMTPhysVol(G4VPhysicalVolume *physVol)
Definition: LXePMTHit.hh:74
G4CollectionNameVector collectionName
virtual G4int GetReplicaNumber(G4int depth=0) const
Definition: G4VTouchable.cc:58
Definition of the LXePMTSD class.
G4VUserTrackInformation * GetUserInformation() const
Char_t n[5]
void SetPMTPos(G4double x, G4double y, G4double z)
Definition: LXePMTHit.hh:77
Definition of the LXePMTHit class.
virtual G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *)
Definition: LXePMTSD.cc:86