11 #include "G4Electron.hh"
12 #include "G4Positron.hh"
13 #include "G4VProcess.hh"
14 #include "G4VPhysicalVolume.hh"
15 #include "G4LogicalVolume.hh"
16 #include "G4TransportationManager.hh"
17 #include "G4EventManager.hh"
18 #include "G4FastSimulationManager.hh"
19 #include "G4TouchableHandle.hh"
20 #include "G4VSensitiveDetector.hh"
22 using namespace CLHEP;
27 : G4VFastSimulationModel(modelName, envelope), theParSet(parSet) {
32 theRegion =
const_cast<const G4Region*
>(envelope);
50 return ( &particleType == G4Electron::ElectronDefinition() ||
51 &particleType == G4Positron::PositronDefinition() );
59 if(fastTrack.GetPrimaryTrack()->GetKineticEnergy() <
GeV) {
return false; }
64 G4TouchableHistory* touch =
65 (G4TouchableHistory*)(fastTrack.GetPrimaryTrack()->GetTouchable());
66 G4VPhysicalVolume* pCurrentVolume = touch->GetVolume();
67 if( pCurrentVolume == 0) {
return false; }
69 G4LogicalVolume* lv = pCurrentVolume->GetLogicalVolume();
70 if(lv->GetRegion() !=
theRegion) {
return false; }
93 fastStep.KillPrimaryTrack();
94 fastStep.ProposePrimaryTrackPathLength(0.0);
97 G4double
energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy()/
GeV;
98 G4double globalTime = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetGlobalTime();
99 G4double
charge = fastTrack.GetPrimaryTrack()->GetStep()->GetPreStepPoint()->GetCharge();
100 G4ThreeVector
position = fastTrack.GetPrimaryTrack()->GetPosition() / cm;
101 G4ThreeVector momentum = fastTrack.GetPrimaryTrack()->GetMomentum()/
GeV;
116 theGflashStep->SetTrack(const_cast<G4Track*>(fastTrack.GetPrimaryTrack()));
118 theGflashStep->GetPostStepPoint()->SetProcessDefinedStep(const_cast<G4VProcess*>
119 (fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetProcessDefinedStep()));
120 theGflashNavigator->SetWorldVolume(G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume());
122 std::vector<GflashHit>::const_iterator spotIter = gflashHitList.begin();
123 std::vector<GflashHit>::const_iterator spotIterEnd = gflashHitList.end();
125 for( ; spotIter != spotIterEnd; spotIter++){
128 theGflashNavigator->LocateGlobalPointAndUpdateTouchableHandle(spotIter->getPosition(),G4ThreeVector(0,0,0),
141 G4VPhysicalVolume* aCurrentVolume =
theGflashStep->GetPreStepPoint()->GetPhysicalVolume();
142 if( aCurrentVolume == 0 )
continue;
144 G4LogicalVolume* lv = aCurrentVolume->GetLogicalVolume();
145 if(lv->GetRegion() !=
theRegion)
continue;
147 theGflashStep->GetPreStepPoint()->SetSensitiveDetector(aCurrentVolume->GetLogicalVolume()->GetSensitiveDetector());
148 G4VSensitiveDetector* aSensitive =
theGflashStep->GetPreStepPoint()->GetSensitiveDetector();
150 if( aSensitive == 0 )
continue;
161 theGflashStep->GetPostStepPoint()->SetGlobalTime(timeGlobal);
163 theGflashStep->GetPostStepPoint()->SetPosition(spotPosition);
170 G4bool isExcluded=
false;
174 G4double
eta = fastTrack.GetPrimaryTrack()->GetPosition().pseudoRapidity() ;
175 if(std::fabs(eta) > 1.392 && std::fabs(eta) < 1.566) {
return true; }
std::vector< GflashHit > & getGflashHitList()
SimActivityRegistry::G4StepSignal m_g4StepSignal
void DoIt(const G4FastTrack &, G4FastStep &)
virtual ~GflashEMShowerModel()
G4bool excludeDetectorRegion(const G4FastTrack &fastTrack)
G4TouchableHandle theGflashTouchableHandle
const G4Region * theRegion
GflashEMShowerProfile * theProfile
GflashEMShowerModel(const G4String &name, G4Envelope *env, const edm::ParameterSet &parSet)
void initialize(int showerType, double energy, double globalTime, double charge, Gflash3Vector &position, Gflash3Vector &momentum)
G4bool IsApplicable(const G4ParticleDefinition &)
int findShowerType(const Gflash3Vector &position)
void updateGflashStep(const G4ThreeVector &position, G4double time)
static int position[264][3]
G4Navigator * theGflashNavigator
void makeHits(const G4FastTrack &fastTrack)
G4bool ModelTrigger(const G4FastTrack &)