CMS 3D CMS Logo

SteppingAction Class Reference

#include <SimG4Core/Application/interface/SteppingAction.h>

List of all members.

Public Member Functions

 SteppingAction (EventAction *ea, const edm::ParameterSet &ps)
void UserSteppingAction (const G4Step *aStep)
 ~SteppingAction ()

Public Attributes

SimActivityRegistry::G4StepSignal m_g4StepSignal

Private Member Functions

void catchLowEnergyInVacuumHere (const G4Step *aStep)
void catchLowEnergyInVacuumNext (const G4Step *aStep)
bool initPointer ()
bool isThisVolume (const G4VTouchable *touch, G4VPhysicalVolume *pv)

Private Attributes

G4VPhysicalVolume * calo
EventActioneventAction_
bool initialized
bool killBeamPipe
double theCriticalDensity
double theCriticalEnergyForVacuum
G4VPhysicalVolume * tracker
int verbose


Detailed Description

Definition at line 13 of file SteppingAction.h.


Constructor & Destructor Documentation

SteppingAction::SteppingAction ( EventAction ea,
const edm::ParameterSet ps 
)

Definition at line 13 of file SteppingAction.cc.

00014   : eventAction_(e),
00015     killBeamPipe(p.getParameter<bool>("KillBeamPipe")),
00016     theCriticalEnergyForVacuum(p.getParameter<double>("CriticalEnergyForVacuum")*MeV),
00017     theCriticalDensity(p.getParameter<double>("CriticalDensity")*g/cm3),
00018     verbose(p.getUntrackedParameter<int>("Verbosity",0)), 
00019     initialized(false), tracker(0), calo(0) {}

SteppingAction::~SteppingAction (  ) 

Definition at line 21 of file SteppingAction.cc.

00021 {}


Member Function Documentation

void SteppingAction::catchLowEnergyInVacuumHere ( const G4Step *  aStep  )  [private]

Definition at line 52 of file SteppingAction.cc.

References g.

Referenced by UserSteppingAction().

00052                                                                     {
00053   G4Track * theTrack = aStep->GetTrack();
00054   double theKenergy = theTrack->GetKineticEnergy();
00055   if (theTrack->GetVolume()!=0) {
00056     double density = theTrack->GetVolume()->GetLogicalVolume()->GetMaterial()->GetDensity();
00057     if (theKenergy <= theCriticalEnergyForVacuum && theKenergy > 0.0 &&
00058         density <= theCriticalDensity && theTrack->GetDefinition()->GetPDGCharge() != 0 &&
00059         theTrack->GetTrackStatus() != fStopAndKill) {
00060       if (verbose>1)
00061         edm::LogInfo("SimG4CoreApplication") 
00062           <<   " SteppingAction: LoopCatchSteppingAction:catchLowEnergyInVacuumHere: "
00063           << " Track from " << theTrack->GetDefinition()->GetParticleName()
00064           << " of kinetic energy " << theKenergy/MeV << " MeV "
00065           << " killed in " << theTrack->GetVolume()->GetLogicalVolume()->GetName()
00066           << " of density " << density/(g/cm3) << " g/cm3" ;
00067       theTrack->SetTrackStatus(fStopAndKill);
00068     }
00069   }
00070 }

void SteppingAction::catchLowEnergyInVacuumNext ( const G4Step *  aStep  )  [private]

Definition at line 72 of file SteppingAction.cc.

References g.

Referenced by UserSteppingAction().

00072                                                                     {
00073   G4Track * theTrack = aStep->GetTrack();
00074   double theKenergy = theTrack->GetKineticEnergy();
00075   if (theTrack->GetNextVolume()) {
00076     double density = theTrack->GetNextVolume()->GetLogicalVolume()->GetMaterial()->GetDensity();
00077     if (theKenergy <=  theCriticalEnergyForVacuum && theKenergy > 0.0 &&
00078         density <= theCriticalDensity && theTrack->GetDefinition()->GetPDGCharge() != 0 &&
00079         theTrack->GetTrackStatus() != fStopAndKill) {
00080       if (verbose>1)
00081         edm::LogInfo("SimG4CoreApplication") 
00082           << " SteppingAction: LoopCatchSteppingAction::catchLowEnergyInVacuumNext: "
00083           << " Track from " << theTrack->GetDefinition()->GetParticleName()
00084           << " of kinetic energy " << theKenergy/MeV << " MeV "
00085           << " stopped in " << theTrack->GetVolume()->GetLogicalVolume()->GetName()
00086           << " before going into "<< theTrack->GetNextVolume()->GetLogicalVolume()->GetName()
00087           << " of density " << density/(g/cm3) << " g/cm3" ;
00088       theTrack->SetTrackStatus(fStopButAlive);
00089     }
00090   }
00091 }

bool SteppingAction::initPointer (  )  [private]

Definition at line 93 of file SteppingAction.cc.

References calo, LogDebug, and tracker.

Referenced by UserSteppingAction().

00093                                  {
00094 
00095   const G4PhysicalVolumeStore * pvs = G4PhysicalVolumeStore::GetInstance();
00096   if (pvs) {
00097     std::vector<G4VPhysicalVolume*>::const_iterator pvcite;
00098     for (pvcite = pvs->begin(); pvcite != pvs->end(); pvcite++) {
00099       if ((*pvcite)->GetName() == "Tracker") tracker = (*pvcite);
00100       if ((*pvcite)->GetName() == "CALO")    calo    = (*pvcite);
00101       if (tracker && calo) break;
00102     }
00103     edm::LogInfo("SimG4CoreApplication") << "Pointer for Tracker " << tracker
00104                                          << " and for Calo " << calo;
00105     if (tracker) LogDebug("SimG4CoreApplication") << "Tracker vol name "
00106                                                   << tracker->GetName();
00107     if (calo)    LogDebug("SimG4CoreApplication") << "Calorimeter vol name "
00108                                                   << calo->GetName();
00109     return true;
00110   }
00111   return false;
00112 }

bool SteppingAction::isThisVolume ( const G4VTouchable *  touch,
G4VPhysicalVolume *  pv 
) [private]

Definition at line 114 of file SteppingAction.cc.

References level.

Referenced by UserSteppingAction().

00115                                                          {
00116 
00117   int level = ((touch->GetHistoryDepth())+1);
00118   if (level > 0 && level >= 3) {
00119     int ii = level - 3;
00120     return (touch->GetVolume(ii) == pv);
00121   }
00122   return false;
00123 }

void SteppingAction::UserSteppingAction ( const G4Step *  aStep  ) 

Definition at line 23 of file SteppingAction.cc.

References EventAction::addTkCaloStateInfo(), calo, catchLowEnergyInVacuumHere(), catchLowEnergyInVacuumNext(), eventAction_, initialized, initPointer(), isThisVolume(), killBeamPipe, m_g4StepSignal, p, tracker, x, y, and z.

00023                                                             {
00024   if (!initialized) initialized = initPointer();
00025   m_g4StepSignal(aStep);
00026   if (killBeamPipe){
00027     catchLowEnergyInVacuumHere(aStep);
00028     catchLowEnergyInVacuumNext(aStep);
00029   }
00030   if (aStep->GetPostStepPoint()->GetPhysicalVolume() != 0) {
00031     bool ok = (isThisVolume(aStep->GetPreStepPoint()->GetTouchable(),tracker)&&
00032                isThisVolume(aStep->GetPostStepPoint()->GetTouchable(),calo));
00033     if (ok) {
00034 
00035       math::XYZVectorD pos((aStep->GetPreStepPoint()->GetPosition()).x(),
00036                            (aStep->GetPreStepPoint()->GetPosition()).y(),
00037                            (aStep->GetPreStepPoint()->GetPosition()).z());
00038       
00039       math::XYZTLorentzVectorD mom((aStep->GetPreStepPoint()->GetMomentum()).x(),
00040                                    (aStep->GetPreStepPoint()->GetMomentum()).y(),
00041                                    (aStep->GetPreStepPoint()->GetMomentum()).z(),
00042                                    aStep->GetPreStepPoint()->GetTotalEnergy());
00043       
00044       uint32_t id = aStep->GetTrack()->GetTrackID();
00045       
00046       std::pair<math::XYZVectorD,math::XYZTLorentzVectorD> p(pos,mom);
00047       eventAction_->addTkCaloStateInfo(id,p);
00048     }
00049   }
00050 }


Member Data Documentation

G4VPhysicalVolume * SteppingAction::calo [private]

Definition at line 33 of file SteppingAction.h.

Referenced by initPointer(), and UserSteppingAction().

EventAction* SteppingAction::eventAction_ [private]

Definition at line 27 of file SteppingAction.h.

Referenced by UserSteppingAction().

bool SteppingAction::initialized [private]

Definition at line 32 of file SteppingAction.h.

Referenced by UserSteppingAction().

bool SteppingAction::killBeamPipe [private]

Definition at line 28 of file SteppingAction.h.

Referenced by UserSteppingAction().

SimActivityRegistry::G4StepSignal SteppingAction::m_g4StepSignal

Definition at line 20 of file SteppingAction.h.

Referenced by RunManager::initializeUserActions(), and UserSteppingAction().

double SteppingAction::theCriticalDensity [private]

Definition at line 30 of file SteppingAction.h.

double SteppingAction::theCriticalEnergyForVacuum [private]

Definition at line 29 of file SteppingAction.h.

G4VPhysicalVolume* SteppingAction::tracker [private]

Definition at line 33 of file SteppingAction.h.

Referenced by initPointer(), and UserSteppingAction().

int SteppingAction::verbose [private]

Definition at line 31 of file SteppingAction.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:32:48 2009 for CMSSW by  doxygen 1.5.4