/scratch0/jsnuveri/BDSIM/BDSIMgit/bdsim/src/BDSShowerModel.cc

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   // track informations
00018   G4ThreeVector DirectionShower=fastTrack.GetPrimaryTrackLocalDirection();
00019   G4ThreeVector InitialPositionShower=fastTrack.GetPrimaryTrackLocalPosition();
00020   
00021   G4ThreeVector OrthoShower, CrossShower; 
00022   // Returns orthogonal vector 
00023   OrthoShower = DirectionShower.orthogonal();
00024   // Shower in direction perpendicular to OrthoShower and DirectionShower
00025   CrossShower = DirectionShower.cross(OrthoShower);
00026   
00027   G4double  R     = Parameterisation->GetAveR99(); //The shower model is changed here for BDSIM - 99% of the shower shape is considered instead of 90%
00028   G4double  Z     = Parameterisation->GetAveT99(); //i.e. GetAveR99 etc. instead of GetAveR90 etc. when deciding if the shower is contained or not
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   // pointer to solid we're in
00035   G4VSolid *SolidCalo = fastTrack.GetEnvelopeSolid();
00036   for(int i=0; i<4 ;i++)
00037     {
00038       // polar coordinates
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   // choose to parameterise or flag when all inetc...
00049   if(NlateralInside==4) filter=true;
00050   // G4cout << " points =   " <<NlateralInside << G4endl;
00051   return filter;
00052 }

Generated on 28 Jun 2015 for BDSIM by  doxygen 1.4.7