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 | // |
---|
27 | // $Id: G4WeightWindowConfigurator.cc,v 1.4 2008/04/21 09:10:29 ahoward Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $ |
---|
29 | // |
---|
30 | // ---------------------------------------------------------------------- |
---|
31 | // Class G4WeightWindowConfigurator |
---|
32 | // |
---|
33 | // Author: Michael Dressel (Michael.Dressel@cern.ch) |
---|
34 | // ---------------------------------------------------------------------- |
---|
35 | |
---|
36 | #include "G4WeightWindowConfigurator.hh" |
---|
37 | #include "G4WeightWindowAlgorithm.hh" |
---|
38 | #include "G4WeightWindowProcess.hh" |
---|
39 | |
---|
40 | G4WeightWindowConfigurator:: |
---|
41 | G4WeightWindowConfigurator(G4VPhysicalVolume* worldvolume, |
---|
42 | const G4String &particlename, |
---|
43 | G4VWeightWindowStore &wwstore, |
---|
44 | const G4VWeightWindowAlgorithm *wwAlg, |
---|
45 | G4PlaceOfAction placeOfAction, G4bool para) |
---|
46 | : fWorld(worldvolume), |
---|
47 | fPlacer(particlename), |
---|
48 | fWeightWindowStore(wwstore), |
---|
49 | fDeleteWWalg( ( ! wwAlg) ), |
---|
50 | fWWalgorithm(( (fDeleteWWalg) ? |
---|
51 | new G4WeightWindowAlgorithm(5,3,5) : wwAlg)), |
---|
52 | fWeightWindowProcess(0), |
---|
53 | fPlaceOfAction(placeOfAction) |
---|
54 | { |
---|
55 | paraflag = para; |
---|
56 | } |
---|
57 | |
---|
58 | G4WeightWindowConfigurator::~G4WeightWindowConfigurator() |
---|
59 | { |
---|
60 | if (fWeightWindowProcess) |
---|
61 | { |
---|
62 | fPlacer.RemoveProcess(fWeightWindowProcess); |
---|
63 | delete fWeightWindowProcess; |
---|
64 | } |
---|
65 | if (fDeleteWWalg) |
---|
66 | { |
---|
67 | delete fWWalgorithm; |
---|
68 | } |
---|
69 | } |
---|
70 | |
---|
71 | void |
---|
72 | G4WeightWindowConfigurator::Configure(G4VSamplerConfigurator *preConf) |
---|
73 | { |
---|
74 | G4cout << " entering weight window configure " << G4endl; |
---|
75 | const G4VTrackTerminator *terminator = 0; |
---|
76 | if (preConf) |
---|
77 | { |
---|
78 | terminator = preConf->GetTrackTerminator(); |
---|
79 | }; |
---|
80 | |
---|
81 | fWeightWindowProcess = |
---|
82 | new G4WeightWindowProcess(*fWWalgorithm, |
---|
83 | fWeightWindowStore, |
---|
84 | terminator, |
---|
85 | fPlaceOfAction,"WeightWindowProcess",paraflag); |
---|
86 | |
---|
87 | if(paraflag) fWeightWindowProcess->SetParallelWorld(fWorld); |
---|
88 | |
---|
89 | fPlacer.AddProcessAsSecondDoIt(fWeightWindowProcess); |
---|
90 | } |
---|
91 | |
---|
92 | const G4VTrackTerminator * |
---|
93 | G4WeightWindowConfigurator::GetTrackTerminator() const |
---|
94 | { |
---|
95 | return fWeightWindowProcess; |
---|
96 | } |
---|
97 | |
---|