Import Geant4 6.2.0 source tree
This commit is contained in:
@@ -0,0 +1,138 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "LXePMTSD.hh"
|
||||
#include "LXePMTHit.hh"
|
||||
#include "LXeDetectorConstruction.hh"
|
||||
#include "LXeUserTrackInformation.hh"
|
||||
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
|
||||
LXePMTSD::LXePMTSD(G4String name)
|
||||
:G4VSensitiveDetector(name),pmtHitCollection(0),pmtPositionsX(0)
|
||||
,pmtPositionsY(0),pmtPositionsZ(0)
|
||||
{
|
||||
collectionName.insert("pmtHitCollection");
|
||||
}
|
||||
|
||||
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
|
||||
LXePMTSD::~LXePMTSD()
|
||||
{}
|
||||
|
||||
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
|
||||
void LXePMTSD::Initialize(G4HCofThisEvent* HCE){
|
||||
pmtHitCollection = new LXePMTHitsCollection
|
||||
(SensitiveDetectorName,collectionName[0]);
|
||||
//Store collection with event and keep ID
|
||||
static G4int HCID = -1;
|
||||
if(HCID<0){
|
||||
HCID = GetCollectionID(0);
|
||||
}
|
||||
HCE->AddHitsCollection( HCID, pmtHitCollection );
|
||||
}
|
||||
|
||||
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
|
||||
G4bool LXePMTSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist){
|
||||
return ProcessHits_constStep(aStep,ROhist);
|
||||
}
|
||||
|
||||
//Generates a hit and uses the postStepPoint's mother volume replica number
|
||||
//PostStepPoint because the hit is generated manually when the photon is
|
||||
//absorbed by the photocathode
|
||||
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
|
||||
G4bool LXePMTSD::ProcessHits_constStep(const G4Step* aStep,
|
||||
G4TouchableHistory* ROhist){
|
||||
|
||||
//need to know if this is an optical photon
|
||||
if(aStep->GetTrack()->GetDefinition()
|
||||
!= G4OpticalPhoton::OpticalPhotonDefinition()) return false;
|
||||
|
||||
//User replica number 1 since photocathode is a daughter volume
|
||||
//to the pmt which was replicated
|
||||
G4int pmtNumber=
|
||||
aStep->GetPostStepPoint()->GetTouchable()->GetReplicaNumber(1);
|
||||
G4VPhysicalVolume* physVol=
|
||||
aStep->GetPostStepPoint()->GetTouchable()->GetVolume(1);
|
||||
|
||||
//Find the correct hit collection
|
||||
G4int n=pmtHitCollection->entries();
|
||||
LXePMTHit* hit=NULL;
|
||||
for(G4int i=0;i<n;i++){
|
||||
if((*pmtHitCollection)[i]->GetPMTNumber()==pmtNumber){
|
||||
hit=(*pmtHitCollection)[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(hit==NULL){//this pmt wasnt previously hit in this event
|
||||
hit = new LXePMTHit(); //so create new hit
|
||||
hit->SetPMTNumber(pmtNumber);
|
||||
hit->SetPMTPhysVol(physVol);
|
||||
pmtHitCollection->insert(hit);
|
||||
hit->SetPMTPos((*pmtPositionsX)[pmtNumber],(*pmtPositionsY)[pmtNumber],
|
||||
(*pmtPositionsZ)[pmtNumber]);
|
||||
}
|
||||
|
||||
hit->IncPhotonCount(); //increment hit for the selected pmt
|
||||
|
||||
if(!LXeDetectorConstruction::GetSphereOn()){
|
||||
hit->SetDrawit(true);
|
||||
//If the sphere is disabled then this hit is automaticaly drawn
|
||||
}
|
||||
else{//sphere enabled
|
||||
LXeUserTrackInformation* trackInfo=
|
||||
(LXeUserTrackInformation*)aStep->GetTrack()->GetUserInformation();
|
||||
if(trackInfo->GetTrackStatus()&hitSphere)
|
||||
//only draw this hit if the photon has hit the sphere first
|
||||
hit->SetDrawit(true);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
|
||||
void LXePMTSD::EndOfEvent(G4HCofThisEvent* HCE){
|
||||
}
|
||||
|
||||
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
|
||||
void LXePMTSD::clear(){
|
||||
}
|
||||
|
||||
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
|
||||
void LXePMTSD::DrawAll(){
|
||||
}
|
||||
|
||||
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
|
||||
void LXePMTSD::PrintAll(){
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user