Skip to content

Commit

Permalink
add optional hadronic GFlash to any Physics List
Browse files Browse the repository at this point in the history
  • Loading branch information
civanch committed Dec 15, 2014
1 parent bf3e4fa commit 9dcbc92
Show file tree
Hide file tree
Showing 6 changed files with 472 additions and 69 deletions.
65 changes: 65 additions & 0 deletions SimG4Core/Application/interface/GFlashHadronShowerModel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#ifndef GflashHadronShowerModel_H
#define GflashHadronShowerModel_H

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "G4VFastSimulationModel.hh"

#include "G4TouchableHandle.hh"
#include "G4Navigator.hh"
#include "G4Step.hh"

class GflashHadronShowerProfile;
class GflashPiKShowerProfile;
class GflashKaonPlusShowerProfile;
class GflashKaonMinusShowerProfile;
class GflashProtonShowerProfile;
class GflashAntiProtonShowerProfile;
class G4Region;
//class GflashHistogram;

class GFlashHadronShowerModel : public G4VFastSimulationModel
{
public:
//-------------------------
// Constructor, destructor
//-------------------------
GFlashHadronShowerModel (G4String modelName, G4Region* envelope,
const edm::ParameterSet& parSet);
~GFlashHadronShowerModel ();

//------------------------------------------------------------------------
// Virtual methods that should be implemented for this hadron shower model
//------------------------------------------------------------------------

G4bool IsApplicable(const G4ParticleDefinition&);
G4bool ModelTrigger(const G4FastTrack &);
void DoIt(const G4FastTrack&, G4FastStep&);

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

private:

G4bool theWatcherOn;
edm::ParameterSet theParSet;
GflashHadronShowerProfile *theProfile;
GflashPiKShowerProfile *thePiKProfile;
GflashKaonPlusShowerProfile *theKaonPlusProfile;
GflashKaonMinusShowerProfile *theKaonMinusProfile;
GflashProtonShowerProfile *theProtonProfile;
GflashAntiProtonShowerProfile *theAntiProtonProfile;

const G4Region* theRegion;

G4Step *theGflashStep;
G4Navigator *theGflashNavigator;
G4TouchableHandle theGflashTouchableHandle;

//debugging histograms
//GflashHistogram* theHisto;
};

#endif
7 changes: 5 additions & 2 deletions SimG4Core/Application/interface/ParametrisedEMPhysics.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "G4VPhysicsConstructor.hh"

class GFlashEMShowerModel;
class GFlashHadronShowerModel;
class ElectronLimiter;

class ParametrisedEMPhysics : public G4VPhysicsConstructor
Expand All @@ -28,8 +29,10 @@ class ParametrisedEMPhysics : public G4VPhysicsConstructor

edm::ParameterSet theParSet;

GFlashEMShowerModel *theEMShowerModel;
GFlashEMShowerModel *theHadShowerModel;
GFlashEMShowerModel *theEcalEMShowerModel;
GFlashEMShowerModel *theHcalEMShowerModel;
GFlashHadronShowerModel *theEcalHadShowerModel;
GFlashHadronShowerModel *theHcalHadShowerModel;

ElectronLimiter *theElectronLimiter;
ElectronLimiter *thePositronLimiter;
Expand Down
10 changes: 7 additions & 3 deletions SimG4Core/Application/src/GFlashEMShowerModel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ GFlashEMShowerModel::IsApplicable(const G4ParticleDefinition& particleType)
G4bool GFlashEMShowerModel::ModelTrigger(const G4FastTrack & fastTrack )
{
// Mininum energy cutoff to parameterize
if(fastTrack.GetPrimaryTrack()->GetKineticEnergy() < GeV) { return false; }
if(fastTrack.GetPrimaryTrack()->GetKineticEnergy() < Gflash::energyCutOff)
{ return false; }
if(excludeDetectorRegion(fastTrack)) { return false; }

// This will be changed accordingly when the way
Expand Down Expand Up @@ -133,12 +134,15 @@ void GFlashEMShowerModel::makeHits(const G4FastTrack& fastTrack)

// Put touchable for each hit so that touchable history
// keeps track of each step.
theGflashNavigator->LocateGlobalPointAndUpdateTouchableHandle(spotIter->getPosition(),G4ThreeVector(0,0,0),theGflashTouchableHandle, false);
theGflashNavigator->LocateGlobalPointAndUpdateTouchableHandle(spotIter->getPosition(),
G4ThreeVector(0,0,0),
theGflashTouchableHandle, false);
updateGflashStep(spotIter->getPosition(),spotIter->getTime());

// If there is a watcher defined in a job and the flag is turned on
if(theWatcherOn) {
SteppingAction* userSteppingAction = (SteppingAction*) G4EventManager::GetEventManager()->GetUserSteppingAction();
SteppingAction* userSteppingAction =
(SteppingAction*) G4EventManager::GetEventManager()->GetUserSteppingAction();
userSteppingAction->m_g4StepSignal(theGflashStep);
}

Expand Down
Loading

0 comments on commit 9dcbc92

Please sign in to comment.