CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
GflashEMShowerModel Class Reference

#include <GflashEMShowerModel.h>

Inheritance diagram for GflashEMShowerModel:

Public Member Functions

void DoIt (const G4FastTrack &, G4FastStep &)
 
 GflashEMShowerModel (const G4String &name, G4Envelope *env, const edm::ParameterSet &parSet)
 
G4bool IsApplicable (const G4ParticleDefinition &)
 
G4bool ModelTrigger (const G4FastTrack &)
 
virtual ~GflashEMShowerModel ()
 

Private Member Functions

G4bool excludeDetectorRegion (const G4FastTrack &fastTrack)
 
void makeHits (const G4FastTrack &fastTrack)
 
void updateGflashStep (const G4ThreeVector &position, G4double time)
 

Private Attributes

G4Navigator * theGflashNavigator
 
G4Step * theGflashStep
 
G4TouchableHandle theGflashTouchableHandle
 
edm::ParameterSet theParSet
 
GflashEMShowerProfiletheProfile
 
const G4Region * theRegion
 

Detailed Description

Definition at line 28 of file GflashEMShowerModel.h.

Constructor & Destructor Documentation

GflashEMShowerModel::GflashEMShowerModel ( const G4String &  name,
G4Envelope *  env,
const edm::ParameterSet parSet 
)

Definition at line 24 of file GflashEMShowerModel.cc.

References theGflashNavigator, theGflashStep, theGflashTouchableHandle, theProfile, and theRegion.

27  : G4VFastSimulationModel(modelName, envelope), theParSet(parSet) {
28 
29  theProfile = new GflashEMShowerProfile(parSet);
30  theRegion = const_cast<const G4Region*>(envelope);
31 
32  theGflashStep = new G4Step();
33  theGflashTouchableHandle = new G4TouchableHistory();
34  theGflashNavigator = new G4Navigator();
35 
36 }
G4TouchableHandle theGflashTouchableHandle
edm::ParameterSet theParSet
const G4Region * theRegion
GflashEMShowerProfile * theProfile
G4Navigator * theGflashNavigator
GflashEMShowerModel::~GflashEMShowerModel ( )
virtual

Definition at line 40 of file GflashEMShowerModel.cc.

References theGflashStep, and theProfile.

40  {
41 
42  delete theProfile;
43  delete theGflashStep;
44 }
GflashEMShowerProfile * theProfile

Member Function Documentation

void GflashEMShowerModel::DoIt ( const G4FastTrack &  fastTrack,
G4FastStep &  fastStep 
)

Definition at line 73 of file GflashEMShowerModel.cc.

References RecoTauCleanerPlugins::charge, relval_parameters_module::energy, Gflash::findShowerType(), GeV, GflashEMShowerProfile::initialize(), makeHits(), GflashEMShowerProfile::parameterization(), position, and theProfile.

73  {
74 
75  // Kill the parameterised particle:
76  fastStep.KillPrimaryTrack();
77  fastStep.ProposePrimaryTrackPathLength(0.0);
78 
79  //input variables for GflashEMShowerProfile with showerType = 1,5 (shower starts inside crystals)
80  G4double energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy()/GeV;
81  G4double globalTime = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetGlobalTime();
82  G4double charge = fastTrack.GetPrimaryTrack()->GetStep()->GetPreStepPoint()->GetCharge();
83  G4ThreeVector position = fastTrack.GetPrimaryTrack()->GetPosition() / cm;
84  G4ThreeVector momentum = fastTrack.GetPrimaryTrack()->GetMomentum()/GeV;
85  G4int showerType = Gflash::findShowerType(position);
86 
87  // Do actual parameterization. The result of parameterization is gflashHitList
88  theProfile->initialize(showerType,energy,globalTime,charge,position,momentum);
90 
91  //make hits
92  makeHits(fastTrack);
93 }
const double GeV
Definition: MathUtil.h:16
GflashEMShowerProfile * theProfile
void initialize(int showerType, double energy, double globalTime, double charge, Gflash3Vector &position, Gflash3Vector &momentum)
int findShowerType(const Gflash3Vector &position)
static int position[264][3]
Definition: ReadPGInfo.cc:509
void makeHits(const G4FastTrack &fastTrack)
G4bool GflashEMShowerModel::excludeDetectorRegion ( const G4FastTrack &  fastTrack)
private

Definition at line 145 of file GflashEMShowerModel.cc.

References eta.

Referenced by ModelTrigger().

145  {
146 
147  G4bool isExcluded=false;
148 
149  //exclude regions where geometry are complicated
150  //+- one supermodule around the EB/EE boundary: 1.479 +- 0.0174*5
151  G4double eta = fastTrack.GetPrimaryTrack()->GetPosition().pseudoRapidity() ;
152  if(std::fabs(eta) > 1.392 && std::fabs(eta) < 1.566) { return true; }
153 
154  return isExcluded;
155 }
G4bool GflashEMShowerModel::IsApplicable ( const G4ParticleDefinition &  particleType)

Definition at line 46 of file GflashEMShowerModel.cc.

46  {
47 
48  return ( &particleType == G4Electron::ElectronDefinition() ||
49  &particleType == G4Positron::PositronDefinition() );
50 
51 }
tuple particleType
void GflashEMShowerModel::makeHits ( const G4FastTrack &  fastTrack)
private

Definition at line 95 of file GflashEMShowerModel.cc.

References GflashEMShowerProfile::getGflashHitList(), theGflashNavigator, theGflashStep, theGflashTouchableHandle, theProfile, theRegion, and updateGflashStep().

Referenced by DoIt().

95  {
96 
97  std::vector<GflashHit>& gflashHitList = theProfile->getGflashHitList();
98 
99  theGflashStep->SetTrack(const_cast<G4Track*>(fastTrack.GetPrimaryTrack()));
100 
101  theGflashStep->GetPostStepPoint()->SetProcessDefinedStep(const_cast<G4VProcess*>
102  (fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetProcessDefinedStep()));
103  theGflashNavigator->SetWorldVolume(G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume());
104 
105  std::vector<GflashHit>::const_iterator spotIter = gflashHitList.begin();
106  std::vector<GflashHit>::const_iterator spotIterEnd = gflashHitList.end();
107 
108  for( ; spotIter != spotIterEnd; spotIter++){
109 
110  //put touchable for each hit so that touchable history keeps track of each step.
111  theGflashNavigator->LocateGlobalPointAndUpdateTouchableHandle(spotIter->getPosition(),G4ThreeVector(0,0,0),
112  theGflashTouchableHandle, false);
113  updateGflashStep(spotIter->getPosition(),spotIter->getTime());
114 
115  // Send G4Step information to Hit/Digi if the volume is sensitive
116  // Copied from G4SteppingManager.cc
117 
118  G4VPhysicalVolume* aCurrentVolume = theGflashStep->GetPreStepPoint()->GetPhysicalVolume();
119  if( aCurrentVolume == 0 ) continue;
120 
121  G4LogicalVolume* lv = aCurrentVolume->GetLogicalVolume();
122  if(lv->GetRegion() != theRegion) continue;
123 
124  theGflashStep->GetPreStepPoint()->SetSensitiveDetector(aCurrentVolume->GetLogicalVolume()->GetSensitiveDetector());
125  G4VSensitiveDetector* aSensitive = theGflashStep->GetPreStepPoint()->GetSensitiveDetector();
126 
127  if( aSensitive == 0 ) continue;
128 
129  theGflashStep->SetTotalEnergyDeposit(spotIter->getEnergy());
130  aSensitive->Hit(theGflashStep);
131  }
132 
133 }
std::vector< GflashHit > & getGflashHitList()
G4TouchableHandle theGflashTouchableHandle
const G4Region * theRegion
GflashEMShowerProfile * theProfile
void updateGflashStep(const G4ThreeVector &position, G4double time)
G4Navigator * theGflashNavigator
G4bool GflashEMShowerModel::ModelTrigger ( const G4FastTrack &  fastTrack)

Definition at line 54 of file GflashEMShowerModel.cc.

References excludeDetectorRegion(), GeV, and theRegion.

54  {
55 
56  // Mininum energy cutoff to parameterize
57  if(fastTrack.GetPrimaryTrack()->GetKineticEnergy() < GeV) { return false; }
58  if(excludeDetectorRegion(fastTrack)) { return false; }
59 
60  // This will be changed accordingly when the way
61  // dealing with CaloRegion changes later.
62  G4TouchableHistory* touch =
63  (G4TouchableHistory*)(fastTrack.GetPrimaryTrack()->GetTouchable());
64  G4VPhysicalVolume* pCurrentVolume = touch->GetVolume();
65  if( pCurrentVolume == 0) { return false; }
66 
67  G4LogicalVolume* lv = pCurrentVolume->GetLogicalVolume();
68  if(lv->GetRegion() != theRegion) { return false; }
69  return true;
70 }
const double GeV
Definition: MathUtil.h:16
G4bool excludeDetectorRegion(const G4FastTrack &fastTrack)
const G4Region * theRegion
void GflashEMShowerModel::updateGflashStep ( const G4ThreeVector &  position,
G4double  time 
)
private

Definition at line 135 of file GflashEMShowerModel.cc.

References theGflashStep, and theGflashTouchableHandle.

Referenced by makeHits().

137 {
138  theGflashStep->GetPostStepPoint()->SetGlobalTime(timeGlobal);
139  theGflashStep->GetPreStepPoint()->SetPosition(spotPosition);
140  theGflashStep->GetPostStepPoint()->SetPosition(spotPosition);
141  theGflashStep->GetPreStepPoint()->SetTouchableHandle(theGflashTouchableHandle);
142 }
G4TouchableHandle theGflashTouchableHandle

Member Data Documentation

G4Navigator* GflashEMShowerModel::theGflashNavigator
private

Definition at line 54 of file GflashEMShowerModel.h.

Referenced by GflashEMShowerModel(), and makeHits().

G4Step* GflashEMShowerModel::theGflashStep
private
G4TouchableHandle GflashEMShowerModel::theGflashTouchableHandle
private

Definition at line 55 of file GflashEMShowerModel.h.

Referenced by GflashEMShowerModel(), makeHits(), and updateGflashStep().

edm::ParameterSet GflashEMShowerModel::theParSet
private

Definition at line 47 of file GflashEMShowerModel.h.

GflashEMShowerProfile* GflashEMShowerModel::theProfile
private

Definition at line 49 of file GflashEMShowerModel.h.

Referenced by DoIt(), GflashEMShowerModel(), makeHits(), and ~GflashEMShowerModel().

const G4Region* GflashEMShowerModel::theRegion
private

Definition at line 51 of file GflashEMShowerModel.h.

Referenced by GflashEMShowerModel(), makeHits(), and ModelTrigger().