| 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | // $Id: TiaraStackingAction.cc,v 1.5 2006/06/29 15:45:34 gunter Exp $
|
|---|
| 27 | // GEANT4 tag $Name: $
|
|---|
| 28 | //
|
|---|
| 29 |
|
|---|
| 30 | #include "TiaraStackingAction.hh"
|
|---|
| 31 | #include "G4ClassificationOfNewTrack.hh"
|
|---|
| 32 | #include "G4Track.hh"
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 | TiaraStackingAction::
|
|---|
| 36 | TiaraStackingAction() :
|
|---|
| 37 | fParticleCut(),
|
|---|
| 38 | fMinEnergyCut(-1)
|
|---|
| 39 | {}
|
|---|
| 40 |
|
|---|
| 41 | TiaraStackingAction::~TiaraStackingAction()
|
|---|
| 42 | {}
|
|---|
| 43 |
|
|---|
| 44 | void TiaraStackingAction::AddParticleCut(const G4String &particle,
|
|---|
| 45 | G4double cut){
|
|---|
| 46 | fParticleCut[particle] = cut;
|
|---|
| 47 | if (cut < fMinEnergyCut || fMinEnergyCut < 0) {
|
|---|
| 48 | fMinEnergyCut = cut;
|
|---|
| 49 | }
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | G4ClassificationOfNewTrack
|
|---|
| 53 | TiaraStackingAction::ClassifyNewTrack(const G4Track* aTrack) {
|
|---|
| 54 | G4ClassificationOfNewTrack result(fUrgent);
|
|---|
| 55 |
|
|---|
| 56 | G4double kinEnergy = aTrack->GetKineticEnergy();
|
|---|
| 57 |
|
|---|
| 58 | if (fMinEnergyCut>0 && kinEnergy < fMinEnergyCut ) {
|
|---|
| 59 | // kill any particle with kinetic enerfy lower than the lowest cut
|
|---|
| 60 | result = fKill;
|
|---|
| 61 | }
|
|---|
| 62 | else {
|
|---|
| 63 | G4ParticleDefinition* pParticle = aTrack->GetDefinition();
|
|---|
| 64 | G4String pName = pParticle->GetParticleName();
|
|---|
| 65 | std::map<G4String, G4double>::const_iterator itP =
|
|---|
| 66 | fParticleCut.find(pName);
|
|---|
| 67 | if (itP != fParticleCut.end()) {
|
|---|
| 68 | if (kinEnergy < itP->second) {
|
|---|
| 69 | // kill particle if it's energy is below it's cut
|
|---|
| 70 | result = fKill;
|
|---|
| 71 | }
|
|---|
| 72 | }
|
|---|
| 73 | else {
|
|---|
| 74 | // kill any particle not in the map
|
|---|
| 75 | result = fKill;
|
|---|
| 76 | }
|
|---|
| 77 | }
|
|---|
| 78 | return result;
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|