00001 #include "BDSGlobalConstants.hh"
00002 #include "BDSShowerModel.hh"
00003 #include "G4ThreeVector.hh"
00004 #include "GVFlashShowerParameterisation.hh"
00005
00006 BDSShowerModel::BDSShowerModel(G4String modelName, G4Region* envelope):GFlashShowerModel(modelName, envelope){
00007 }
00008
00009 BDSShowerModel::BDSShowerModel(G4String modelName):GFlashShowerModel(modelName){
00010 }
00011
00012 BDSShowerModel::~BDSShowerModel(){
00013 }
00014
00015 G4bool BDSShowerModel::CheckContainment(const G4FastTrack& fastTrack){
00016 G4bool filter=false;
00017
00018 G4ThreeVector DirectionShower=fastTrack.GetPrimaryTrackLocalDirection();
00019 G4ThreeVector InitialPositionShower=fastTrack.GetPrimaryTrackLocalPosition();
00020
00021 G4ThreeVector OrthoShower, CrossShower;
00022
00023 OrthoShower = DirectionShower.orthogonal();
00024
00025 CrossShower = DirectionShower.cross(OrthoShower);
00026
00027 G4double R = Parameterisation->GetAveR99();
00028 G4double Z = Parameterisation->GetAveT99();
00029 G4int CosPhi[4] = {1,0,-1,0};
00030 G4int SinPhi[4] = {0,1,0,-1};
00031
00032 G4ThreeVector Position;
00033 G4int NlateralInside=0;
00034
00035 G4VSolid *SolidCalo = fastTrack.GetEnvelopeSolid();
00036 for(int i=0; i<4 ;i++)
00037 {
00038
00039 Position = InitialPositionShower +
00040 Z*DirectionShower +
00041 R*CosPhi[i]*OrthoShower +
00042 R*SinPhi[i]*CrossShower ;
00043
00044 if(SolidCalo->Inside(Position) != kOutside)
00045 NlateralInside++;
00046 }
00047
00048
00049 if(NlateralInside==4) filter=true;
00050
00051 return filter;
00052 }