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] [ 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 /processes/parameterisation/src/G4FastTrack.cc (Version 11.3.0) and /processes/parameterisation/src/G4FastTrack.cc (Version 11.1.3)


  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 //                                                 27 //
 28 //--------------------------------------------     28 //---------------------------------------------------------------
 29 //                                                 29 //
 30 //  G4FastTrack.cc                                 30 //  G4FastTrack.cc
 31 //                                                 31 //
 32 //  Description:                                   32 //  Description:
 33 //    Keeps the current track information and      33 //    Keeps the current track information and special features
 34 //    for Parameterised Simulation Models.         34 //    for Parameterised Simulation Models.
 35 //                                                 35 //
 36 //  History:                                       36 //  History:
 37 //    Oct 97: Verderi && MoraDeFreitas - First     37 //    Oct 97: Verderi && MoraDeFreitas - First Implementation.
 38 //                                                 38 //
 39 //--------------------------------------------     39 //---------------------------------------------------------------
 40                                                    40 
                                                   >>  41 #include "G4ios.hh"
 41 #include "G4FastTrack.hh"                          42 #include "G4FastTrack.hh"
 42                                                << 
 43 #include "G4TouchableHandle.hh"                << 
 44 #include "G4TransportationManager.hh"              43 #include "G4TransportationManager.hh"
 45 #include "G4ios.hh"                            <<  44 #include "G4TouchableHistoryHandle.hh"
 46                                                    45 
 47 // -----------                                     46 // -----------
 48 // Constructor                                     47 // Constructor
 49 // -----------                                     48 // -----------
 50 //                                                 49 //
 51 G4FastTrack::G4FastTrack(G4Envelope* anEnvelop <<  50 G4FastTrack::G4FastTrack(G4Envelope *anEnvelope, G4bool IsUnique)
 52   : fEnvelope(anEnvelope), fIsUnique(IsUnique) <<  51   : fTrack                      ( nullptr    ),
                                                   >>  52     fAffineTransformationDefined( false      ),
                                                   >>  53     fEnvelope                   ( anEnvelope ),
                                                   >>  54     fIsUnique                   ( IsUnique   ),
                                                   >>  55     fEnvelopeLogicalVolume      ( nullptr    ),
                                                   >>  56     fEnvelopePhysicalVolume     ( nullptr    ),
                                                   >>  57     fEnvelopeSolid              ( nullptr    )
                                                   >>  58 {}
                                                   >>  59 
                                                   >>  60 // -----------
                                                   >>  61 // Destructor:
                                                   >>  62 // -----------
                                                   >>  63 G4FastTrack::~G4FastTrack()
 53 {}                                                 64 {}
 54                                                    65 
 55 //--------------------------------------------     66 //------------------------------------------------------------
 56 // The parameterised simulation manager uses t     67 // The parameterised simulation manager uses the SetCurrentTrack
 57 // method to setup the current G4FastTrack obj <<  68 // method to setup the current G4FastTrack object 
 58 //--------------------------------------------     69 //------------------------------------------------------------
 59 void G4FastTrack::SetCurrentTrack(const G4Trac <<  70 void G4FastTrack::SetCurrentTrack(const G4Track& track,
                                                   >>  71                                   const G4Navigator* theNavigator) 
 60 {                                                  72 {
                                                   >>  73 
 61   // -- Register track pointer (used everywher     74   // -- Register track pointer (used everywhere):
 62   fTrack = &track;                                 75   fTrack = &track;
 63                                                    76 
 64   //------------------------------------------     77   //-----------------------------------------------------
 65   // First time the track enters the volume or     78   // First time the track enters the volume or if the
 66   // Logical Volume was placed n-Times in the      79   // Logical Volume was placed n-Times in the geometry :
 67   //                                           <<  80   // 
 68   // Records the Rotation+Translation for the      81   // Records the Rotation+Translation for the Envelope !
 69   // When the particle is inside or on the bou <<  82   // When the particle is inside or on the boundary, the 
 70   // NavigationHistory IS UP TO DATE.              83   // NavigationHistory IS UP TO DATE.
 71   //------------------------------------------     84   //------------------------------------------------------
 72   if (!fAffineTransformationDefined || !fIsUni     85   if (!fAffineTransformationDefined || !fIsUnique) FRecordsAffineTransformation(theNavigator);
 73                                                <<  86   
 74   //------------------------------------------     87   //-------------------------------------------
 75   // Records local position/momentum/direction     88   // Records local position/momentum/direction
 76   // of the Track.                                 89   // of the Track.
 77   // They are accessible to the user through a     90   // They are accessible to the user through a
 78   // set of Get functions and should be useful     91   // set of Get functions and should be useful
 79   // to decide to trigger or not.                  92   // to decide to trigger or not.
 80   //------------------------------------------     93   //-------------------------------------------
 81   // -- local position:                            94   // -- local position:
 82   fLocalTrackPosition = fAffineTransformation.     95   fLocalTrackPosition = fAffineTransformation.TransformPoint(fTrack->GetPosition());
 83   // -- local momentum:                            96   // -- local momentum:
 84   fLocalTrackMomentum = fAffineTransformation.     97   fLocalTrackMomentum = fAffineTransformation.TransformAxis(fTrack->GetMomentum());
 85   // -- local direction:                           98   // -- local direction:
 86   fLocalTrackDirection = fLocalTrackMomentum.u     99   fLocalTrackDirection = fLocalTrackMomentum.unit();
 87   // -- local polarization:                       100   // -- local polarization:
 88   fLocalTrackPolarization = fAffineTransformat    101   fLocalTrackPolarization = fAffineTransformation.TransformAxis(fTrack->GetPolarization());
 89 }                                                 102 }
 90                                                   103 
 91 //------------------------------------            104 //------------------------------------
 92 //                                                105 //
 93 // 3D transformation of the envelope              106 // 3D transformation of the envelope
 94 // This is Done only one time.                    107 // This is Done only one time.
 95 //                                                108 //
 96 //------------------------------------            109 //------------------------------------
 97 void G4FastTrack::FRecordsAffineTransformation << 110 void 
                                                   >> 111 G4FastTrack::FRecordsAffineTransformation(const G4Navigator* theNavigator)
 98 {                                                 112 {
                                                   >> 113 
 99   //------------------------------------------    114   //--------------------------------------------------------
100   // Get the touchable history which represent    115   // Get the touchable history which represents the current
101   // volume hierachy the particle is in.          116   // volume hierachy the particle is in.
102   // Note that TouchableHistory allocated by t    117   // Note that TouchableHistory allocated by the Navigator
103   // must be deleted by G4FastTrack.              118   // must be deleted by G4FastTrack.
104   //------------------------------------------    119   //--------------------------------------------------------
105   const G4Navigator* NavigatorToUse;              120   const G4Navigator* NavigatorToUse;
106   if (theNavigator != nullptr)                 << 121   if(theNavigator != nullptr ) NavigatorToUse = theNavigator;
107     NavigatorToUse = theNavigator;             << 122   else NavigatorToUse = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
108   else                                         << 123   
109     NavigatorToUse = G4TransportationManager:: << 124   G4TouchableHistoryHandle history = NavigatorToUse->CreateTouchableHistoryHandle();
110                                                << 125   
111   G4TouchableHandle history = NavigatorToUse-> << 
112                                                << 
113   //------------------------------------------    126   //-----------------------------------------------------
114   // Run accross the hierarchy to find the phy    127   // Run accross the hierarchy to find the physical volume
115   // associated with the envelope                 128   // associated with the envelope
116   //------------------------------------------    129   //-----------------------------------------------------
117   auto depth = (G4int)history->GetHistory()->G << 130   G4int depth = (G4int)history->GetHistory()->GetDepth();
118   G4int idepth;                                   131   G4int idepth;
119   G4bool Done = false;                            132   G4bool Done = false;
120   for (idepth = 0; idepth <= depth; ++idepth)  << 133   for (idepth = 0; idepth <= depth; ++idepth)
                                                   >> 134   {
121     G4VPhysicalVolume* currPV = history->GetHi    135     G4VPhysicalVolume* currPV = history->GetHistory()->GetVolume(idepth);
122     G4LogicalVolume* currLV = currPV->GetLogic << 136     G4LogicalVolume* currLV   = currPV->GetLogicalVolume();
123     if ((currLV->GetRegion() == fEnvelope) &&  << 137     if ( (currLV->GetRegion() == fEnvelope) && (currLV->IsRootRegion()) )
                                                   >> 138     {
124       fEnvelopePhysicalVolume = currPV;           139       fEnvelopePhysicalVolume = currPV;
125       fEnvelopeLogicalVolume = currLV;         << 140       fEnvelopeLogicalVolume  = currLV;
126       fEnvelopeSolid = currLV->GetSolid();     << 141       fEnvelopeSolid          = currLV->GetSolid();
127       Done = true;                                142       Done = true;
128       break;                                      143       break;
129     }                                             144     }
130   }                                               145   }
131   //------------------------------------------    146   //---------------------------------------------
132   //-- Verification: should be removed in futu    147   //-- Verification: should be removed in future:
133   //------------------------------------------    148   //---------------------------------------------
134   if (!Done) {                                 << 149   if ( Done == false )
135     G4ExceptionDescription ed;                 << 150     {
136     ed << "Can't find transformation for `" << << 151       G4ExceptionDescription ed;
137     G4Exception("G4FastTrack::FRecordsAffineTr << 152       ed << "Can't find transformation for `" << fEnvelopePhysicalVolume->GetName() << "'" << G4endl;
138   }                                            << 153       G4Exception("G4FastTrack::FRecordsAffineTransformation()",
139   else {                                       << 154       "FastSim011",
140     //---------------------------------------- << 155       JustWarning, ed);
141     // Records the transformation and inverse  << 156     }
142     //---------------------------------------- << 157   else
143     fAffineTransformation = history->GetHistor << 158     {
144     fInverseAffineTransformation = fAffineTran << 159       //-------------------------------------------------------
145                                                << 160       // Records the transformation and inverse transformation:
146     fAffineTransformationDefined = true;       << 161       //-------------------------------------------------------
147   }                                            << 162       fAffineTransformation = history->GetHistory()->GetTransform(idepth);
                                                   >> 163       fInverseAffineTransformation = fAffineTransformation.Inverse();
                                                   >> 164       
                                                   >> 165       fAffineTransformationDefined = true;
                                                   >> 166     }
148 }                                                 167 }
149                                                   168