Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/optical/OpNovice2/src/SteppingAction.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/extended/optical/OpNovice2/src/SteppingAction.cc (Version 11.3.0) and /examples/extended/optical/OpNovice2/src/SteppingAction.cc (Version 10.6.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
 27 /// \file optical/OpNovice2/src/SteppingAction     27 /// \file optical/OpNovice2/src/SteppingAction.cc
 28 /// \brief Implementation of the SteppingActio     28 /// \brief Implementation of the SteppingAction class
 29 //                                                 29 //
 30 //....oooOO0OOooo........oooOO0OOooo........oo     30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 31                                                    31 
 32 #include "SteppingAction.hh"                       32 #include "SteppingAction.hh"
 33                                                <<  33 //#include "EventAction.hh"
 34 #include "HistoManager.hh"                         34 #include "HistoManager.hh"
 35 #include "Run.hh"                              << 
 36 #include "SteppingMessenger.hh"                << 
 37 #include "TrackInformation.hh"                     35 #include "TrackInformation.hh"
                                                   >>  36 #include "Run.hh"
 38                                                    37 
 39 #include "G4Cerenkov.hh"                           38 #include "G4Cerenkov.hh"
 40 #include "G4Event.hh"                          << 
 41 #include "G4EventManager.hh"                   << 
 42 #include "G4OpBoundaryProcess.hh"              << 
 43 #include "G4OpticalPhoton.hh"                  << 
 44 #include "G4ProcessManager.hh"                 << 
 45 #include "G4RunManager.hh"                     << 
 46 #include "G4Scintillation.hh"                      39 #include "G4Scintillation.hh"
                                                   >>  40 #include "G4OpBoundaryProcess.hh"
                                                   >>  41 
 47 #include "G4Step.hh"                               42 #include "G4Step.hh"
                                                   >>  43 #include "G4Track.hh"
                                                   >>  44 #include "G4OpticalPhoton.hh"
                                                   >>  45 #include "G4Event.hh"
                                                   >>  46 #include "G4EventManager.hh"
 48 #include "G4SteppingManager.hh"                    47 #include "G4SteppingManager.hh"
                                                   >>  48 #include "G4RunManager.hh"
                                                   >>  49 #include "G4ProcessManager.hh"
                                                   >>  50 
 49 #include "G4SystemOfUnits.hh"                      51 #include "G4SystemOfUnits.hh"
 50 #include "G4Track.hh"                          << 
 51                                                    52 
 52 //....oooOO0OOooo........oooOO0OOooo........oo     53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 53 SteppingAction::SteppingAction() : G4UserStepp <<  54 SteppingAction::SteppingAction()
 54 {                                              <<  55 : G4UserSteppingAction(),
 55   fSteppingMessenger = new SteppingMessenger(t <<  56   fVerbose(0)
 56 }                                              <<  57 {}
 57                                                    58 
 58 //....oooOO0OOooo........oooOO0OOooo........oo     59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 59 SteppingAction::~SteppingAction()                  60 SteppingAction::~SteppingAction()
 60 {                                              <<  61 {}
 61   delete fSteppingMessenger;                   << 
 62 }                                              << 
 63                                                    62 
 64 //....oooOO0OOooo........oooOO0OOooo........oo     63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 65 void SteppingAction::UserSteppingAction(const      64 void SteppingAction::UserSteppingAction(const G4Step* step)
 66 {                                                  65 {
 67   static G4ParticleDefinition* opticalphoton = <<  66   static G4ParticleDefinition* opticalphoton = 
 68                                                <<  67               G4OpticalPhoton::OpticalPhotonDefinition();
 69   G4AnalysisManager* analysisMan = G4AnalysisM     68   G4AnalysisManager* analysisMan = G4AnalysisManager::Instance();
 70   Run* run = static_cast<Run*>(G4RunManager::G <<  69   Run* run = static_cast<Run*>(
                                                   >>  70                G4RunManager::GetRunManager()->GetNonConstCurrentRun());
 71                                                    71 
 72   G4Track* track = step->GetTrack();               72   G4Track* track = step->GetTrack();
 73   G4StepPoint* endPoint = step->GetPostStepPoi <<  73   G4StepPoint* endPoint   = step->GetPostStepPoint();
 74   G4StepPoint* startPoint = step->GetPreStepPo     74   G4StepPoint* startPoint = step->GetPreStepPoint();
 75                                                    75 
 76   const G4DynamicParticle* theParticle = track <<  76   G4String particleName = track->GetDynamicParticle()->
 77   const G4ParticleDefinition* particleDef = th <<  77                                  GetParticleDefinition()->GetParticleName();
 78                                                    78 
 79   auto trackInfo = (TrackInformation*)(track-> <<  79   TrackInformation* trackInfo = 
                                                   >>  80                         (TrackInformation*)(track->GetUserInformation());
 80                                                    81 
 81   if (particleDef == opticalphoton) {          <<  82   if (particleName == "opticalphoton") {
 82     const G4VProcess* pds = endPoint->GetProce     83     const G4VProcess* pds = endPoint->GetProcessDefinedStep();
 83     G4String procname = pds->GetProcessName(); <<  84     if (pds->GetProcessName() == "OpAbsorption") {
 84     if (procname == "OpAbsorption") {          <<  85       run->AddOpAbsorption(); 
 85       run->AddOpAbsorption();                  << 
 86       if (trackInfo->GetIsFirstTankX()) {          86       if (trackInfo->GetIsFirstTankX()) {
 87         run->AddOpAbsorptionPrior();               87         run->AddOpAbsorptionPrior();
 88       }                                            88       }
 89     }                                          <<  89     } 
 90     else if (procname == "OpRayleigh") {       <<  90     else if (pds->GetProcessName() == "OpRayleigh") {
 91       run->AddRayleigh();                          91       run->AddRayleigh();
 92     }                                              92     }
 93     else if (procname == "OpWLS") {            << 
 94       G4double en = track->GetKineticEnergy(); << 
 95       run->AddWLSAbsorption();                 << 
 96       run->AddWLSAbsorptionEnergy(en);         << 
 97       analysisMan->FillH1(4, en / eV);  // abs << 
 98       // loop over secondaries, create statist << 
 99       // const std::vector<const G4Track*>* se << 
100       auto secondaries = step->GetSecondaryInC << 
101       for (auto sec : *secondaries) {          << 
102         en = sec->GetKineticEnergy();          << 
103         run->AddWLSEmission();                 << 
104         run->AddWLSEmissionEnergy(en);         << 
105         analysisMan->FillH1(5, en / eV);  // e << 
106         G4double time = sec->GetGlobalTime();  << 
107         analysisMan->FillH1(6, time / ns);     << 
108       }                                        << 
109     }                                          << 
110     else if (procname == "OpWLS2") {           << 
111       G4double en = track->GetKineticEnergy(); << 
112       run->AddWLS2Absorption();                << 
113       run->AddWLS2AbsorptionEnergy(en);        << 
114       analysisMan->FillH1(7, en / eV);  // abs << 
115       // loop over secondaries, create statist << 
116       // const std::vector<const G4Track*>* se << 
117       auto secondaries = step->GetSecondaryInC << 
118       for (auto sec : *secondaries) {          << 
119         en = sec->GetKineticEnergy();          << 
120         run->AddWLS2Emission();                << 
121         run->AddWLS2EmissionEnergy(en);        << 
122         analysisMan->FillH1(8, en / eV);  // e << 
123         G4double time = sec->GetGlobalTime();  << 
124         analysisMan->FillH1(9, time / ns);     << 
125       }                                        << 
126     }                                          << 
127                                                    93 
128     // optical process has endpt on bdry,      <<  94     // optical process has endpt on bdry, 
129     if (endPoint->GetStepStatus() == fGeomBoun     95     if (endPoint->GetStepStatus() == fGeomBoundary) {
130       G4ThreeVector p0 = startPoint->GetMoment <<  96 
131       G4ThreeVector p1 = endPoint->GetMomentum <<  97       const G4DynamicParticle* theParticle = track->GetDynamicParticle();
                                                   >>  98 
                                                   >>  99       G4ThreeVector oldMomentumDir = theParticle->GetMomentumDirection();
                                                   >> 100 
                                                   >> 101       G4ThreeVector m0 = startPoint->GetMomentumDirection();
                                                   >> 102       G4ThreeVector m1 = endPoint->GetMomentumDirection();
132                                                   103 
133       G4OpBoundaryProcessStatus theStatus = Un    104       G4OpBoundaryProcessStatus theStatus = Undefined;
134                                                   105 
135       G4ProcessManager* OpManager = opticalpho << 106       G4ProcessManager* OpManager = 
136       G4ProcessVector* postStepDoItVector = Op << 107         G4OpticalPhoton::OpticalPhoton()->GetProcessManager();
137       G4int n_proc = postStepDoItVector->entri << 108       G4int MAXofPostStepLoops = 
                                                   >> 109         OpManager->GetPostStepProcessVector()->entries();
                                                   >> 110       G4ProcessVector* postStepDoItVector = 
                                                   >> 111         OpManager->GetPostStepProcessVector(typeDoIt);
138                                                   112 
139       if (trackInfo->GetIsFirstTankX()) {         113       if (trackInfo->GetIsFirstTankX()) {
140         G4double px1 = p1.x();                 << 114         G4ThreeVector momdir = endPoint->GetMomentumDirection();
141         G4double py1 = p1.y();                 << 115         G4double px1 = momdir.x();
142         G4double pz1 = p1.z();                 << 116         G4double py1 = momdir.y();
143         // do not count Absorbed or Detected p << 117         G4double pz1 = momdir.z();
144         if (track->GetTrackStatus() != fStopAn << 118         if (px1 < 0.) {
145           if (px1 < 0.) {                      << 119           analysisMan->FillH1(4, px1);
146             analysisMan->FillH1(11, px1);      << 120           analysisMan->FillH1(5, py1);
147             analysisMan->FillH1(12, py1);      << 121           analysisMan->FillH1(6, pz1);
148             analysisMan->FillH1(13, pz1);      << 122         } else if (px1 >= 0.) {
149           }                                    << 123           analysisMan->FillH1(7, px1);
150           else {                               << 124           analysisMan->FillH1(8, py1);
151             analysisMan->FillH1(14, px1);      << 125           analysisMan->FillH1(9, pz1);
152             analysisMan->FillH1(15, py1);      << 
153             analysisMan->FillH1(16, pz1);      << 
154           }                                    << 
155         }                                         126         }
156                                                   127 
157         trackInfo->SetIsFirstTankX(false);        128         trackInfo->SetIsFirstTankX(false);
158         run->AddTotalSurface();                << 129         run->AddTotalSurface(); 
159                                                   130 
160         for (G4int i = 0; i < n_proc; ++i) {   << 131         for (G4int i=0; i<MAXofPostStepLoops; ++i) {
161           G4VProcess* currentProcess = (*postS    132           G4VProcess* currentProcess = (*postStepDoItVector)[i];
162                                                   133 
163           auto opProc = dynamic_cast<G4OpBound << 134           G4OpBoundaryProcess* opProc = 
                                                   >> 135             dynamic_cast<G4OpBoundaryProcess*>(currentProcess);
164           if (opProc) {                           136           if (opProc) {
165             G4double angle = std::acos(p0.x()) << 
166             theStatus = opProc->GetStatus();      137             theStatus = opProc->GetStatus();
167             analysisMan->FillH1(10, theStatus) << 138             analysisMan->FillH1(3, theStatus);
168             switch (theStatus) {               << 139             if (theStatus == Transmission) {
169               case Transmission:               << 140               run->AddTransmission();
170                 run->AddTransmission();        << 141             }
171                 analysisMan->FillH1(25, angle  << 142             else if (theStatus == FresnelRefraction) {
172                 break;                         << 143               run->AddFresnelRefraction(); 
173               case FresnelRefraction:          << 144               analysisMan->FillH1(10, px1);
174                 run->AddFresnelRefraction();   << 145               analysisMan->FillH1(11, py1);
175                 analysisMan->FillH1(17, px1);  << 146               analysisMan->FillH1(12, pz1);
176                 analysisMan->FillH1(18, py1);  << 147             }
177                 analysisMan->FillH1(19, pz1);  << 148             else if (theStatus == FresnelReflection) { 
178                 analysisMan->FillH1(20, angle  << 149               run->AddFresnelReflection(); 
179                 break;                         << 150             }
180               case FresnelReflection:          << 151             else if (theStatus == TotalInternalReflection) { 
181                 run->AddFresnelReflection();   << 152               run->AddTotalInternalReflection();
182                 analysisMan->FillH1(21, angle  << 153             }
183                 analysisMan->FillH1(23, angle  << 154             else if (theStatus == LambertianReflection) {
184                 break;                         << 155               run->AddLambertianReflection();
185               case TotalInternalReflection:    << 156             }
186                 run->AddTotalInternalReflectio << 157             else if (theStatus == LobeReflection) {
187                 analysisMan->FillH1(22, angle  << 158               run->AddLobeReflection();
188                 analysisMan->FillH1(23, angle  << 159             }
189                 break;                         << 160             else if (theStatus == SpikeReflection) {
190               case LambertianReflection:       << 161               run->AddSpikeReflection();
191                 run->AddLambertianReflection() << 162             }
192                 break;                         << 163             else if (theStatus == BackScattering) {
193               case LobeReflection:             << 164               run->AddBackScattering();
194                 run->AddLobeReflection();      << 165             }
195                 break;                         << 166             else if (theStatus == Absorption) {
196               case SpikeReflection:            << 167               run->AddAbsorption();
197                 run->AddSpikeReflection();     << 168             }
198                 analysisMan->FillH1(26, angle  << 169             else if (theStatus == Detection) {
199                 break;                         << 170               run->AddDetection();
200               case BackScattering:             << 
201                 run->AddBackScattering();      << 
202                 break;                         << 
203               case Absorption:                 << 
204                 analysisMan->FillH1(24, angle  << 
205                 run->AddAbsorption();          << 
206                 break;                         << 
207               case Detection:                  << 
208                 run->AddDetection();           << 
209                 break;                         << 
210               case NotAtBoundary:              << 
211                 run->AddNotAtBoundary();       << 
212                 break;                         << 
213               case SameMaterial:               << 
214                 run->AddSameMaterial();        << 
215                 break;                         << 
216               case StepTooSmall:               << 
217                 run->AddStepTooSmall();        << 
218                 break;                         << 
219               case NoRINDEX:                   << 
220                 run->AddNoRINDEX();            << 
221                 break;                         << 
222               case PolishedLumirrorAirReflecti << 
223                 run->AddPolishedLumirrorAirRef << 
224                 break;                         << 
225               case PolishedLumirrorGlueReflect << 
226                 run->AddPolishedLumirrorGlueRe << 
227                 break;                         << 
228               case PolishedAirReflection:      << 
229                 run->AddPolishedAirReflection( << 
230                 break;                         << 
231               case PolishedTeflonAirReflection << 
232                 run->AddPolishedTeflonAirRefle << 
233                 break;                         << 
234               case PolishedTiOAirReflection:   << 
235                 run->AddPolishedTiOAirReflecti << 
236                 break;                         << 
237               case PolishedTyvekAirReflection: << 
238                 run->AddPolishedTyvekAirReflec << 
239                 break;                         << 
240               case PolishedVM2000AirReflection << 
241                 run->AddPolishedVM2000AirRefle << 
242                 break;                         << 
243               case PolishedVM2000GlueReflectio << 
244                 run->AddPolishedVM2000AirRefle << 
245                 break;                         << 
246               case EtchedLumirrorAirReflection << 
247                 run->AddEtchedLumirrorAirRefle << 
248                 break;                         << 
249               case EtchedLumirrorGlueReflectio << 
250                 run->AddEtchedLumirrorGlueRefl << 
251                 break;                         << 
252               case EtchedAirReflection:        << 
253                 run->AddEtchedAirReflection(); << 
254                 break;                         << 
255               case EtchedTeflonAirReflection:  << 
256                 run->AddEtchedTeflonAirReflect << 
257                 break;                         << 
258               case EtchedTiOAirReflection:     << 
259                 run->AddEtchedTiOAirReflection << 
260                 break;                         << 
261               case EtchedTyvekAirReflection:   << 
262                 run->AddEtchedTyvekAirReflecti << 
263                 break;                         << 
264               case EtchedVM2000AirReflection:  << 
265                 run->AddEtchedVM2000AirReflect << 
266                 break;                         << 
267               case EtchedVM2000GlueReflection: << 
268                 run->AddEtchedVM2000AirReflect << 
269                 break;                         << 
270               case GroundLumirrorAirReflection << 
271                 run->AddGroundLumirrorAirRefle << 
272                 break;                         << 
273               case GroundLumirrorGlueReflectio << 
274                 run->AddGroundLumirrorGlueRefl << 
275                 break;                         << 
276               case GroundAirReflection:        << 
277                 run->AddGroundAirReflection(); << 
278                 break;                         << 
279               case GroundTeflonAirReflection:  << 
280                 run->AddGroundTeflonAirReflect << 
281                 break;                         << 
282               case GroundTiOAirReflection:     << 
283                 run->AddGroundTiOAirReflection << 
284                 break;                         << 
285               case GroundTyvekAirReflection:   << 
286                 run->AddGroundTyvekAirReflecti << 
287                 break;                         << 
288               case GroundVM2000AirReflection:  << 
289                 run->AddGroundVM2000AirReflect << 
290                 break;                         << 
291               case GroundVM2000GlueReflection: << 
292                 run->AddGroundVM2000AirReflect << 
293                 break;                         << 
294               case Dichroic:                   << 
295                 run->AddDichroic();            << 
296                 break;                         << 
297               case CoatedDielectricReflection: << 
298                 run->AddCoatedDielectricReflec << 
299                 break;                         << 
300               case CoatedDielectricRefraction: << 
301                 run->AddCoatedDielectricRefrac << 
302                 break;                         << 
303               case CoatedDielectricFrustratedT << 
304                 run->AddCoatedDielectricFrustr << 
305                 break;                         << 
306               default:                         << 
307                 G4cout << "theStatus: " << the << 
308                 break;                         << 
309             }                                     171             }
                                                   >> 172             else if (theStatus == NotAtBoundary) {
                                                   >> 173               run->AddNotAtBoundary();
                                                   >> 174             }
                                                   >> 175             else if (theStatus == SameMaterial) {
                                                   >> 176               run->AddSameMaterial();
                                                   >> 177             }
                                                   >> 178             else if (theStatus == StepTooSmall) {
                                                   >> 179               run->AddStepTooSmall();
                                                   >> 180             }
                                                   >> 181             else if (theStatus == NoRINDEX) {
                                                   >> 182               run->AddNoRINDEX();
                                                   >> 183             }
                                                   >> 184             else if (theStatus == PolishedLumirrorAirReflection) {
                                                   >> 185               run->AddPolishedLumirrorAirReflection();
                                                   >> 186             }
                                                   >> 187             else if (theStatus == PolishedLumirrorGlueReflection) {
                                                   >> 188               run->AddPolishedLumirrorGlueReflection();
                                                   >> 189             }
                                                   >> 190             else if (theStatus == PolishedAirReflection) {
                                                   >> 191               run->AddPolishedAirReflection();
                                                   >> 192             }
                                                   >> 193             else if (theStatus == PolishedTeflonAirReflection) {
                                                   >> 194               run->AddPolishedTeflonAirReflection();
                                                   >> 195             }
                                                   >> 196             else if (theStatus == PolishedTiOAirReflection) {
                                                   >> 197               run->AddPolishedTiOAirReflection();
                                                   >> 198             }
                                                   >> 199             else if (theStatus == PolishedTyvekAirReflection) {
                                                   >> 200               run->AddPolishedTyvekAirReflection();
                                                   >> 201             }
                                                   >> 202             else if (theStatus == PolishedVM2000AirReflection) {
                                                   >> 203               run->AddPolishedVM2000AirReflection();
                                                   >> 204             }
                                                   >> 205             else if (theStatus == PolishedVM2000GlueReflection) {
                                                   >> 206               run->AddPolishedVM2000AirReflection();
                                                   >> 207             }
                                                   >> 208             else if (theStatus == EtchedLumirrorAirReflection) {
                                                   >> 209               run->AddEtchedLumirrorAirReflection();
                                                   >> 210             }
                                                   >> 211             else if (theStatus == EtchedLumirrorGlueReflection) {
                                                   >> 212               run->AddEtchedLumirrorGlueReflection();
                                                   >> 213             }
                                                   >> 214             else if (theStatus == EtchedAirReflection) {
                                                   >> 215               run->AddEtchedAirReflection();
                                                   >> 216             }
                                                   >> 217             else if (theStatus == EtchedTeflonAirReflection) {
                                                   >> 218               run->AddEtchedTeflonAirReflection();
                                                   >> 219             }
                                                   >> 220             else if (theStatus == EtchedTiOAirReflection) {
                                                   >> 221               run->AddEtchedTiOAirReflection();
                                                   >> 222             }
                                                   >> 223             else if (theStatus == EtchedTyvekAirReflection) {
                                                   >> 224               run->AddEtchedTyvekAirReflection();
                                                   >> 225             }
                                                   >> 226             else if (theStatus == EtchedVM2000AirReflection) {
                                                   >> 227               run->AddEtchedVM2000AirReflection();
                                                   >> 228             }
                                                   >> 229             else if (theStatus == EtchedVM2000GlueReflection) {
                                                   >> 230               run->AddEtchedVM2000AirReflection();
                                                   >> 231             }
                                                   >> 232             else if (theStatus == GroundLumirrorAirReflection) {
                                                   >> 233               run->AddGroundLumirrorAirReflection();
                                                   >> 234             }
                                                   >> 235             else if (theStatus == GroundLumirrorGlueReflection) {
                                                   >> 236               run->AddGroundLumirrorGlueReflection();
                                                   >> 237             }
                                                   >> 238             else if (theStatus == GroundAirReflection) {
                                                   >> 239               run->AddGroundAirReflection();
                                                   >> 240             }
                                                   >> 241             else if (theStatus == GroundTeflonAirReflection) {
                                                   >> 242               run->AddGroundTeflonAirReflection();
                                                   >> 243             }
                                                   >> 244             else if (theStatus == GroundTiOAirReflection) {
                                                   >> 245               run->AddGroundTiOAirReflection();
                                                   >> 246             }
                                                   >> 247             else if (theStatus == GroundTyvekAirReflection) {
                                                   >> 248               run->AddGroundTyvekAirReflection();
                                                   >> 249             }
                                                   >> 250             else if (theStatus == GroundVM2000AirReflection) {
                                                   >> 251               run->AddGroundVM2000AirReflection();
                                                   >> 252             }
                                                   >> 253             else if (theStatus == GroundVM2000GlueReflection) {
                                                   >> 254               run->AddGroundVM2000AirReflection();
                                                   >> 255             }
                                                   >> 256             else if (theStatus == Dichroic) {
                                                   >> 257               run->AddDichroic();
                                                   >> 258             }
                                                   >> 259             
                                                   >> 260             else {
                                                   >> 261               G4cout << "theStatus: " << theStatus 
                                                   >> 262                      << " was none of the above." << G4endl;
                                                   >> 263             }
                                                   >> 264 
310           }                                       265           }
311         }                                         266         }
312       }                                           267       }
313       // when studying boundary scattering, it << 
314       // visualize the photon before and after << 
315       // selected, kill the photon when reachi << 
316       // (note that there are 2 steps at the b << 
317       // equals 0 and 1 on the first surface)  << 
318       if (fKillOnSecondSurface) {              << 
319         if (trackInfo->GetReflectionNumber() > << 
320           track->SetTrackStatus(fStopAndKill); << 
321         }                                      << 
322       }                                        << 
323       trackInfo->IncrementReflectionNumber();  << 
324     }                                          << 
325                                                << 
326     // This block serves to test that G4OpBoun << 
327     // velocity correctly. It is not necessary << 
328     // Only steps where pre- and post- are the << 
329     // incorrect checks (so, in practice, set  << 
330     // for particles to step in the interior o << 
331     if (endPoint->GetMaterial() == startPoint- << 
332       G4double trackVelocity = track->GetVeloc << 
333       G4double materialVelocity = CLHEP::c_lig << 
334       G4MaterialPropertyVector* velVector =    << 
335         endPoint->GetMaterial()->GetMaterialPr << 
336       if (velVector) {                         << 
337         materialVelocity = velVector->Value(th << 
338       }                                        << 
339                                                << 
340       if (std::abs(trackVelocity - materialVel << 
341         G4ExceptionDescription ed;             << 
342         ed << "Optical photon group velocity:  << 
343            << " cm/ns is not what is expected  << 
344            << materialVelocity / (cm / ns) <<  << 
345         G4Exception("OpNovice2 SteppingAction" << 
346       }                                        << 
347     }                                             268     }
348     // end of group velocity test              << 
349   }                                               269   }
350                                                   270 
351   else {  // particle != opticalphoton         << 271   else { // particle != opticalphoton
352     // print how many Cerenkov and scint photo    272     // print how many Cerenkov and scint photons produced this step
353     // this demonstrates use of GetNumPhotons(    273     // this demonstrates use of GetNumPhotons()
354     auto proc_man = track->GetDynamicParticle( << 274     auto proc_man = track->GetDynamicParticle()->GetParticleDefinition()
                                                   >> 275                          ->GetProcessManager();
                                                   >> 276     G4int n_proc = proc_man->GetPostStepProcessVector()->entries();
355     G4ProcessVector* proc_vec = proc_man->GetP    277     G4ProcessVector* proc_vec = proc_man->GetPostStepProcessVector(typeDoIt);
356     G4int n_proc = proc_vec->entries();        << 
357                                                   278 
358     G4int n_scint = 0;                            279     G4int n_scint = 0;
359     G4int n_cer = 0;                           << 280     G4int n_cer   = 0;
360     for (G4int i = 0; i < n_proc; ++i) {          281     for (G4int i = 0; i < n_proc; ++i) {
361       G4String proc_name = (*proc_vec)[i]->Get << 282       if ((*proc_vec)[i]->GetProcessName().compare("Cerenkov") == 0) {
362       if (proc_name == "Cerenkov") {           << 
363         auto cer = (G4Cerenkov*)(*proc_vec)[i]    283         auto cer = (G4Cerenkov*)(*proc_vec)[i];
364         n_cer = cer->GetNumPhotons();             284         n_cer = cer->GetNumPhotons();
365       }                                           285       }
366       else if (proc_name == "Scintillation") { << 286       else if ((*proc_vec)[i]->GetProcessName().compare("Scintillation") == 0) {
367         auto scint = (G4Scintillation*)(*proc_    287         auto scint = (G4Scintillation*)(*proc_vec)[i];
368         n_scint = scint->GetNumPhotons();         288         n_scint = scint->GetNumPhotons();
369       }                                           289       }
370     }                                             290     }
371     if (fVerbose > 0) {                           291     if (fVerbose > 0) {
372       if (n_cer > 0 || n_scint > 0) {             292       if (n_cer > 0 || n_scint > 0) {
373         G4cout << "In this step, " << n_cer << << 293         G4cout << "In this step, " << n_cer
                                                   >> 294                << " Cerenkov and " << n_scint
374                << " scintillation photons were    295                << " scintillation photons were produced." << G4endl;
375       }                                           296       }
376     }                                             297     }
377                                                   298 
378     // loop over secondaries, create statistic    299     // loop over secondaries, create statistics
379     const std::vector<const G4Track*>* seconda << 300     const std::vector<const G4Track*>* secondaries =
                                                   >> 301                                 step->GetSecondaryInCurrentStep();
380                                                   302 
381     for (auto sec : *secondaries) {               303     for (auto sec : *secondaries) {
382       if (sec->GetDynamicParticle()->GetPartic << 304       if (sec->GetDynamicParticle()->GetParticleDefinition() == opticalphoton){
383         G4String creator_process = sec->GetCre << 305         if (sec->GetCreatorProcess()->GetProcessName().compare("Cerenkov")==0){
384         if (creator_process == "Cerenkov") {   << 
385           G4double en = sec->GetKineticEnergy(    306           G4double en = sec->GetKineticEnergy();
386           run->AddCerenkovEnergy(en);             307           run->AddCerenkovEnergy(en);
387           run->AddCerenkov();                     308           run->AddCerenkov();
388           analysisMan->FillH1(1, en / eV);     << 309           G4AnalysisManager::Instance()->FillH1(1, en/eV);
389         }                                         310         }
390         else if (creator_process == "Scintilla << 311         else if (sec->GetCreatorProcess()
                                                   >> 312                     ->GetProcessName().compare("Scintillation") == 0) {
391           G4double en = sec->GetKineticEnergy(    313           G4double en = sec->GetKineticEnergy();
392           run->AddScintillationEnergy(en);        314           run->AddScintillationEnergy(en);
393           run->AddScintillation();                315           run->AddScintillation();
394           analysisMan->FillH1(2, en / eV);     << 316           G4AnalysisManager::Instance()->FillH1(2, en/eV);
395                                                   317 
396           G4double time = sec->GetGlobalTime()    318           G4double time = sec->GetGlobalTime();
397           analysisMan->FillH1(3, time / ns);   << 319           analysisMan->FillH1(13, time/ns);
398         }                                         320         }
399       }                                           321       }
400     }                                             322     }
401   }                                            << 323   } 
402                                                   324 
403   return;                                         325   return;
                                                   >> 326 
404 }                                                 327 }
405                                                   328 
406 //....oooOO0OOooo........oooOO0OOooo........oo    329 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
407                                                   330