CMS 3D CMS Logo

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 &) override
 
 GFlashEMShowerModel (const G4String &name, G4Envelope *env, const edm::ParameterSet &parSet)
 
G4bool IsApplicable (const G4ParticleDefinition &) override
 
G4bool ModelTrigger (const G4FastTrack &) override
 
 ~GFlashEMShowerModel () override
 

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
 
G4Region * theRegion
 
bool theWatcherOn
 

Detailed Description

Definition at line 29 of file GFlashEMShowerModel.h.

Constructor & Destructor Documentation

◆ GFlashEMShowerModel()

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

Definition at line 27 of file GFlashEMShowerModel.cc.

References edm::ParameterSet::getParameter(), theGflashNavigator, theGflashStep, theGflashTouchableHandle, theProfile, theRegion, and theWatcherOn.

30  : G4VFastSimulationModel(modelName, envelope), theParSet(parSet) {
31  theWatcherOn = parSet.getParameter<bool>("watcherOn");
32 
33  theProfile = new GflashEMShowerProfile(parSet);
34  theRegion = reinterpret_cast<G4Region*>(envelope);
35 
36  theGflashStep = new G4Step();
37  theGflashTouchableHandle = new G4TouchableHistory();
38  theGflashNavigator = new G4Navigator();
39 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
G4TouchableHandle theGflashTouchableHandle
GflashEMShowerProfile * theProfile
edm::ParameterSet theParSet
G4Navigator * theGflashNavigator

◆ ~GFlashEMShowerModel()

GFlashEMShowerModel::~GFlashEMShowerModel ( )
override

Definition at line 43 of file GFlashEMShowerModel.cc.

References theGflashStep, and theProfile.

43  {
44  delete theProfile;
45  delete theGflashStep;
46 }
GflashEMShowerProfile * theProfile

Member Function Documentation

◆ DoIt()

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

Definition at line 78 of file GFlashEMShowerModel.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, hcalRecHitTable_cff::energy, Gflash::findShowerType(), GflashEMShowerProfile::initialize(), makeHits(), GflashEMShowerProfile::parameterization(), position, and theProfile.

78  {
79  // Kill the parameterised particle:
80  fastStep.KillPrimaryTrack();
81  fastStep.ProposePrimaryTrackPathLength(0.0);
82 
83  // Input variables for GFlashEMShowerProfile with showerType = 1,5
84  // Shower starts inside crystals
85  G4double energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy() / GeV;
86  G4double globalTime = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetGlobalTime();
87  G4double charge = fastTrack.GetPrimaryTrack()->GetStep()->GetPreStepPoint()->GetCharge();
88  G4ThreeVector position = fastTrack.GetPrimaryTrack()->GetPosition() / cm;
89  G4ThreeVector momentum = fastTrack.GetPrimaryTrack()->GetMomentum() / GeV;
90  G4int showerType = Gflash::findShowerType(position);
91 
92  // Do actual parameterization
93  // The result of parameterization is gflashHitList
94  theProfile->initialize(showerType, energy, globalTime, charge, position, momentum);
96 
97  // Make hits
98  makeHits(fastTrack);
99 }
void makeHits(const G4FastTrack &fastTrack)
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:289

◆ excludeDetectorRegion()

G4bool GFlashEMShowerModel::excludeDetectorRegion ( const G4FastTrack &  fastTrack)
private

Definition at line 162 of file GFlashEMShowerModel.cc.

References PVValHelper::eta.

Referenced by ModelTrigger().

162  {
163  //exclude regions where geometry are complicated
164  //+- one supermodule around the EB/EE boundary: 1.479 +- 0.0174*5
165  G4double eta = fastTrack.GetPrimaryTrack()->GetPosition().pseudoRapidity();
166  return (std::fabs(eta) > 1.392 && std::fabs(eta) < 1.566);
167 }

◆ IsApplicable()

G4bool GFlashEMShowerModel::IsApplicable ( const G4ParticleDefinition &  particleType)
override

Definition at line 48 of file GFlashEMShowerModel.cc.

References nanoDQM_cfi::Electron, and PbPb_ZMuSkimMuonDPG_cff::particleType.

48  {
49  return (&particleType == G4Electron::Electron() || &particleType == G4Positron::Positron());
50 }

◆ makeHits()

void GFlashEMShowerModel::makeHits ( const G4FastTrack &  fastTrack)
private

Definition at line 102 of file GFlashEMShowerModel.cc.

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

Referenced by DoIt().

102  {
103  std::vector<GflashHit>& gflashHitList = theProfile->getGflashHitList();
104 
105  theGflashStep->SetTrack(const_cast<G4Track*>(fastTrack.GetPrimaryTrack()));
106 
107  theGflashStep->GetPostStepPoint()->SetProcessDefinedStep(
108  const_cast<G4VProcess*>(fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetProcessDefinedStep()));
109  theGflashNavigator->SetWorldVolume(
110  G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume());
111 
112  std::vector<GflashHit>::const_iterator spotIter = gflashHitList.begin();
113  std::vector<GflashHit>::const_iterator spotIterEnd = gflashHitList.end();
114 
115  for (; spotIter != spotIterEnd; ++spotIter) {
116  // Put touchable for each hit so that touchable history
117  // keeps track of each step.
118  theGflashNavigator->LocateGlobalPointAndUpdateTouchableHandle(
119  spotIter->getPosition(), G4ThreeVector(0, 0, 0), theGflashTouchableHandle, false);
120  updateGflashStep(spotIter->getPosition(), spotIter->getTime());
121 
122  // If there is a watcher defined in a job and the flag is turned on
123  if (theWatcherOn) {
124  SteppingAction* userSteppingAction = (SteppingAction*)G4EventManager::GetEventManager()->GetUserSteppingAction();
125  userSteppingAction->m_g4StepSignal(theGflashStep);
126  }
127 
128  // Send G4Step information to Hit/Digi if the volume is sensitive
129  // Copied from G4SteppingManager.cc
130 
131  G4VPhysicalVolume* aCurrentVolume = theGflashStep->GetPreStepPoint()->GetPhysicalVolume();
132  if (aCurrentVolume == nullptr) {
133  continue;
134  }
135 
136  G4LogicalVolume* lv = aCurrentVolume->GetLogicalVolume();
137  if (lv->GetRegion() != theRegion) {
138  continue;
139  }
140 
141  theGflashStep->GetPreStepPoint()->SetSensitiveDetector(aCurrentVolume->GetLogicalVolume()->GetSensitiveDetector());
142  G4VSensitiveDetector* aSensitive = theGflashStep->GetPreStepPoint()->GetSensitiveDetector();
143 
144  if (aSensitive == nullptr) {
145  continue;
146  }
147 
148  theGflashStep->SetTotalEnergyDeposit(spotIter->getEnergy());
149  aSensitive->Hit(theGflashStep);
150  }
151 }
std::vector< GflashHit > & getGflashHitList()
G4TouchableHandle theGflashTouchableHandle
SimActivityRegistry::G4StepSignal m_g4StepSignal
GflashEMShowerProfile * theProfile
void updateGflashStep(const G4ThreeVector &position, G4double time)
G4Navigator * theGflashNavigator

◆ ModelTrigger()

G4bool GFlashEMShowerModel::ModelTrigger ( const G4FastTrack &  fastTrack)
override

Definition at line 53 of file GFlashEMShowerModel.cc.

References Gflash::energyCutOff, excludeDetectorRegion(), and theRegion.

53  {
54  // Mininum energy cutoff to parameterize
55  if (fastTrack.GetPrimaryTrack()->GetKineticEnergy() < Gflash::energyCutOff) {
56  return false;
57  }
58  if (excludeDetectorRegion(fastTrack)) {
59  return false;
60  }
61 
62  // This will be changed accordingly when the way
63  // dealing with CaloRegion changes later.
64  const G4TouchableHistory* touch = static_cast<const G4TouchableHistory*>(fastTrack.GetPrimaryTrack()->GetTouchable());
65  const G4VPhysicalVolume* pCurrentVolume = touch->GetVolume();
66  if (pCurrentVolume == nullptr) {
67  return false;
68  }
69 
70  const G4LogicalVolume* lv = pCurrentVolume->GetLogicalVolume();
71  if (lv->GetRegion() != theRegion) {
72  return false;
73  }
74  return true;
75 }
const double energyCutOff
G4bool excludeDetectorRegion(const G4FastTrack &fastTrack)

◆ updateGflashStep()

void GFlashEMShowerModel::updateGflashStep ( const G4ThreeVector &  position,
G4double  time 
)
private

Definition at line 154 of file GFlashEMShowerModel.cc.

References theGflashStep, and theGflashTouchableHandle.

Referenced by makeHits().

154  {
155  theGflashStep->GetPostStepPoint()->SetGlobalTime(timeGlobal);
156  theGflashStep->GetPreStepPoint()->SetPosition(spotPosition);
157  theGflashStep->GetPostStepPoint()->SetPosition(spotPosition);
158  theGflashStep->GetPreStepPoint()->SetTouchableHandle(theGflashTouchableHandle);
159 }
G4TouchableHandle theGflashTouchableHandle

Member Data Documentation

◆ theGflashNavigator

G4Navigator* GFlashEMShowerModel::theGflashNavigator
private

Definition at line 52 of file GFlashEMShowerModel.h.

Referenced by GFlashEMShowerModel(), and makeHits().

◆ theGflashStep

G4Step* GFlashEMShowerModel::theGflashStep
private

◆ theGflashTouchableHandle

G4TouchableHandle GFlashEMShowerModel::theGflashTouchableHandle
private

Definition at line 53 of file GFlashEMShowerModel.h.

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

◆ theParSet

edm::ParameterSet GFlashEMShowerModel::theParSet
private

Definition at line 44 of file GFlashEMShowerModel.h.

◆ theProfile

GflashEMShowerProfile* GFlashEMShowerModel::theProfile
private

Definition at line 47 of file GFlashEMShowerModel.h.

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

◆ theRegion

G4Region* GFlashEMShowerModel::theRegion
private

Definition at line 49 of file GFlashEMShowerModel.h.

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

◆ theWatcherOn

bool GFlashEMShowerModel::theWatcherOn
private

Definition at line 45 of file GFlashEMShowerModel.h.

Referenced by GFlashEMShowerModel(), and makeHits().