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"
25 : G4VFastSimulationModel(modelName, envelope), theParSet(parSet) {
30 theRegion =
const_cast<const G4Region*
>(envelope);
48 return ( &particleType == G4Electron::ElectronDefinition() ||
49 &particleType == G4Positron::PositronDefinition() );
57 if(fastTrack.GetPrimaryTrack()->GetKineticEnergy() < GeV) {
return false; }
62 G4TouchableHistory* touch =
63 (G4TouchableHistory*)(fastTrack.GetPrimaryTrack()->GetTouchable());
64 G4VPhysicalVolume* pCurrentVolume = touch->GetVolume();
65 if( pCurrentVolume == 0) {
return false; }
67 G4LogicalVolume* lv = pCurrentVolume->GetLogicalVolume();
68 if(lv->GetRegion() !=
theRegion) {
return false; }
91 fastStep.KillPrimaryTrack();
92 fastStep.ProposePrimaryTrackPathLength(0.0);
95 G4double
energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy()/GeV;
96 G4double globalTime = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetGlobalTime();
97 G4double
charge = fastTrack.GetPrimaryTrack()->GetStep()->GetPreStepPoint()->GetCharge();
98 G4ThreeVector
position = fastTrack.GetPrimaryTrack()->GetPosition() / cm;
99 G4ThreeVector momentum = fastTrack.GetPrimaryTrack()->GetMomentum()/GeV;
114 theGflashStep->SetTrack(const_cast<G4Track*>(fastTrack.GetPrimaryTrack()));
116 theGflashStep->GetPostStepPoint()->SetProcessDefinedStep(const_cast<G4VProcess*>
117 (fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetProcessDefinedStep()));
118 theGflashNavigator->SetWorldVolume(G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume());
120 std::vector<GflashHit>::const_iterator spotIter = gflashHitList.begin();
121 std::vector<GflashHit>::const_iterator spotIterEnd = gflashHitList.end();
123 for( ; spotIter != spotIterEnd; spotIter++){
126 theGflashNavigator->LocateGlobalPointAndUpdateTouchableHandle(spotIter->getPosition(),G4ThreeVector(0,0,0),
139 G4VPhysicalVolume* aCurrentVolume =
theGflashStep->GetPreStepPoint()->GetPhysicalVolume();
140 if( aCurrentVolume == 0 )
continue;
142 G4LogicalVolume* lv = aCurrentVolume->GetLogicalVolume();
143 if(lv->GetRegion() !=
theRegion)
continue;
145 theGflashStep->GetPreStepPoint()->SetSensitiveDetector(aCurrentVolume->GetLogicalVolume()->GetSensitiveDetector());
146 G4VSensitiveDetector* aSensitive =
theGflashStep->GetPreStepPoint()->GetSensitiveDetector();
148 if( aSensitive == 0 )
continue;
159 theGflashStep->GetPostStepPoint()->SetGlobalTime(timeGlobal);
161 theGflashStep->GetPostStepPoint()->SetPosition(spotPosition);
168 G4bool isExcluded=
false;
172 G4double
eta = fastTrack.GetPrimaryTrack()->GetPosition().pseudoRapidity() ;
173 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
static int position[TOTALCHAMBERS][3]
const G4Region * theRegion
int findShowerType(const Gflash3Vector position)
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 &)
void updateGflashStep(const G4ThreeVector &position, G4double time)
G4Navigator * theGflashNavigator
void makeHits(const G4FastTrack &fastTrack)
G4bool ModelTrigger(const G4FastTrack &)