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

Detailed Description

Definition at line 29 of file GFlashEMShowerModel.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file GFlashEMShowerModel.cc.

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

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

Definition at line 43 of file GFlashEMShowerModel.cc.

References theGflashStep, and theProfile.

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

Member Function Documentation

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

Definition at line 90 of file GFlashEMShowerModel.cc.

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

92 {
93  // Kill the parameterised particle:
94  fastStep.KillPrimaryTrack();
95  fastStep.ProposePrimaryTrackPathLength(0.0);
96 
97  // Input variables for GFlashEMShowerProfile with showerType = 1,5
98  // Shower starts inside crystals
99  G4double energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy()/GeV;
100  G4double globalTime =
101  fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetGlobalTime();
102  G4double charge =
103  fastTrack.GetPrimaryTrack()->GetStep()->GetPreStepPoint()->GetCharge();
104  G4ThreeVector position = fastTrack.GetPrimaryTrack()->GetPosition()/cm;
105  G4ThreeVector momentum = fastTrack.GetPrimaryTrack()->GetMomentum()/GeV;
106  G4int showerType = Gflash::findShowerType(position);
107 
108  // Do actual parameterization
109  // The result of parameterization is gflashHitList
110  theProfile->initialize(showerType,energy,globalTime,charge,
111  position,momentum);
113 
114  // Make hits
115  makeHits(fastTrack);
116 }
void makeHits(const G4FastTrack &fastTrack)
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
G4bool GFlashEMShowerModel::excludeDetectorRegion ( const G4FastTrack &  fastTrack)
private

Definition at line 180 of file GFlashEMShowerModel.cc.

References PVValHelper::eta.

Referenced by ModelTrigger().

181 {
182  G4bool isExcluded=false;
183 
184  //exclude regions where geometry are complicated
185  //+- one supermodule around the EB/EE boundary: 1.479 +- 0.0174*5
186  G4double eta = fastTrack.GetPrimaryTrack()->GetPosition().pseudoRapidity();
187  if(std::fabs(eta) > 1.392 && std::fabs(eta) < 1.566) { return true; }
188 
189  return isExcluded;
190 }
G4bool GFlashEMShowerModel::IsApplicable ( const G4ParticleDefinition &  particleType)
override

Definition at line 50 of file GFlashEMShowerModel.cc.

References nanoDQM_cfi::Electron.

51 {
52  return ( &particleType == G4Electron::Electron() ||
53  &particleType == G4Positron::Positron() );
54 }
void GFlashEMShowerModel::makeHits ( const G4FastTrack &  fastTrack)
private

Definition at line 119 of file GFlashEMShowerModel.cc.

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

Referenced by DoIt().

120 {
121  std::vector<GflashHit>& gflashHitList = theProfile->getGflashHitList();
122 
123  theGflashStep->SetTrack(const_cast<G4Track*>(fastTrack.GetPrimaryTrack()));
124 
125  theGflashStep->GetPostStepPoint()
126  ->SetProcessDefinedStep(const_cast<G4VProcess*>(fastTrack.GetPrimaryTrack()
127  ->GetStep()->GetPostStepPoint()->GetProcessDefinedStep()));
128  theGflashNavigator->SetWorldVolume(G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume());
129 
130  std::vector<GflashHit>::const_iterator spotIter = gflashHitList.begin();
131  std::vector<GflashHit>::const_iterator spotIterEnd = gflashHitList.end();
132 
133  for(; spotIter != spotIterEnd; spotIter++){
134 
135  // Put touchable for each hit so that touchable history
136  // keeps track of each step.
137  theGflashNavigator->LocateGlobalPointAndUpdateTouchableHandle(spotIter->getPosition(),
138  G4ThreeVector(0,0,0),
139  theGflashTouchableHandle, false);
140  updateGflashStep(spotIter->getPosition(),spotIter->getTime());
141 
142  // If there is a watcher defined in a job and the flag is turned on
143  if(theWatcherOn) {
144  SteppingAction* userSteppingAction =
145  (SteppingAction*) G4EventManager::GetEventManager()->GetUserSteppingAction();
146  userSteppingAction->m_g4StepSignal(theGflashStep);
147  }
148 
149  // Send G4Step information to Hit/Digi if the volume is sensitive
150  // Copied from G4SteppingManager.cc
151 
152  G4VPhysicalVolume* aCurrentVolume =
153  theGflashStep->GetPreStepPoint()->GetPhysicalVolume();
154  if( aCurrentVolume == nullptr ) { continue; }
155 
156  G4LogicalVolume* lv = aCurrentVolume->GetLogicalVolume();
157  if(lv->GetRegion() != theRegion) { continue; }
158 
159  theGflashStep->GetPreStepPoint()->SetSensitiveDetector(aCurrentVolume->GetLogicalVolume()->GetSensitiveDetector());
160  G4VSensitiveDetector* aSensitive = theGflashStep->GetPreStepPoint()->GetSensitiveDetector();
161 
162  if( aSensitive == nullptr ) { continue; }
163 
164  theGflashStep->SetTotalEnergyDeposit(spotIter->getEnergy());
165  aSensitive->Hit(theGflashStep);
166  }
167 }
std::vector< GflashHit > & getGflashHitList()
G4TouchableHandle theGflashTouchableHandle
SimActivityRegistry::G4StepSignal m_g4StepSignal
GflashEMShowerProfile * theProfile
const G4Region * theRegion
void updateGflashStep(const G4ThreeVector &position, G4double time)
G4Navigator * theGflashNavigator
G4bool GFlashEMShowerModel::ModelTrigger ( const G4FastTrack &  fastTrack)
override

Definition at line 57 of file GFlashEMShowerModel.cc.

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

58 {
59  // Mininum energy cutoff to parameterize
60  if(fastTrack.GetPrimaryTrack()->GetKineticEnergy() < Gflash::energyCutOff)
61  { return false; }
62  if(excludeDetectorRegion(fastTrack)) { return false; }
63 
64  // This will be changed accordingly when the way
65  // dealing with CaloRegion changes later.
66  G4TouchableHistory* touch =
67  (G4TouchableHistory*)(fastTrack.GetPrimaryTrack()->GetTouchable());
68  G4VPhysicalVolume* pCurrentVolume = touch->GetVolume();
69  if( pCurrentVolume == nullptr) { return false; }
70 
71  G4LogicalVolume* lv = pCurrentVolume->GetLogicalVolume();
72  if(lv->GetRegion() != theRegion) { return false; }
73  //std::cout << "GFlashEMShowerModel::ModelTrigger: LV "
74  // << lv->GetRegion()->GetName() << std::endl;
75 
76  // The parameterization starts inside crystals
77  //std::size_t pos1 = lv->GetName().find("EBRY");
78  //std::size_t pos2 = lv->GetName().find("EFRY");
79 
80  //std::size_t pos3 = lv->GetName().find("HVQ");
81  //std::size_t pos4 = lv->GetName().find("HF");
82  //if(pos1 == std::string::npos && pos2 == std::string::npos &&
83  // pos3 == std::string::npos && pos4 == std::string::npos) return false;
84 
85  return true;
86 
87 }
const G4Region * theRegion
const double energyCutOff
G4bool excludeDetectorRegion(const G4FastTrack &fastTrack)
void GFlashEMShowerModel::updateGflashStep ( const G4ThreeVector &  position,
G4double  time 
)
private

Definition at line 170 of file GFlashEMShowerModel.cc.

References theGflashStep, and theGflashTouchableHandle.

Referenced by makeHits().

172 {
173  theGflashStep->GetPostStepPoint()->SetGlobalTime(timeGlobal);
174  theGflashStep->GetPreStepPoint()->SetPosition(spotPosition);
175  theGflashStep->GetPostStepPoint()->SetPosition(spotPosition);
176  theGflashStep->GetPreStepPoint()->SetTouchableHandle(theGflashTouchableHandle);
177 }
G4TouchableHandle theGflashTouchableHandle

Member Data Documentation

G4Navigator* GFlashEMShowerModel::theGflashNavigator
private

Definition at line 56 of file GFlashEMShowerModel.h.

Referenced by GFlashEMShowerModel(), and makeHits().

G4Step* GFlashEMShowerModel::theGflashStep
private
G4TouchableHandle GFlashEMShowerModel::theGflashTouchableHandle
private

Definition at line 57 of file GFlashEMShowerModel.h.

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

edm::ParameterSet GFlashEMShowerModel::theParSet
private

Definition at line 48 of file GFlashEMShowerModel.h.

GflashEMShowerProfile* GFlashEMShowerModel::theProfile
private

Definition at line 51 of file GFlashEMShowerModel.h.

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

const G4Region* GFlashEMShowerModel::theRegion
private

Definition at line 53 of file GFlashEMShowerModel.h.

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

bool GFlashEMShowerModel::theWatcherOn
private

Definition at line 49 of file GFlashEMShowerModel.h.

Referenced by GFlashEMShowerModel(), and makeHits().