#include #include #include #include #include using namespace RAT; CalibPMTSD::CalibPMTSD( G4String name, const int lcn, const double threshold, const double efficiency ) : G4VSensitiveDetector( name ), fLCN( lcn ), fThresholdEnergy( threshold ), fEfficiency( efficiency ) { } void CalibPMTSD::Initialize( G4HCofThisEvent* ) { fTotalEnergyDeposited = 0.0; } void CalibPMTSD::EndOfEvent( G4HCofThisEvent* ) { if( fTotalEnergyDeposited > fThresholdEnergy ) { if( G4UniformRand() < fEfficiency ) { DS::MCPE photoelectron; photoelectron.SetPosition( TVector3( 0.0, 0.0, 0.0 ) ); photoelectron.SetCreationTime( 0.0 ); photoelectron.SetCharge( 1.0 ); photoelectron.SetPhotonTrackID( -1 ); for( unsigned int iPE = 0; iPE < 10; iPE++ ) // 10 photoelectrons pretty much guarantee this fires. FIXME GOG with DQXX HitPMTCollection::Get()->DetectPhotoelectron( fLCN, photoelectron ); } } fTotalEnergyDeposited = 0.0; } G4bool CalibPMTSD::ProcessHits( G4Step* step, G4TouchableHistory* ) { fTotalEnergyDeposited += step->GetTotalEnergyDeposit(); return true; }