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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 4.1.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                    <<   3 // * DISCLAIMER                                                       *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th <<   5 // * The following disclaimer summarizes all the specific disclaimers *
  6 // * the Geant4 Collaboration.  It is provided <<   6 // * of contributors to this software. The specific disclaimers,which *
  7 // * conditions of the Geant4 Software License <<   7 // * govern, are listed with their locations in:                      *
  8 // * LICENSE and available at  http://cern.ch/ <<   8 // *   http://cern.ch/geant4/license                                  *
  9 // * include a list of copyright holders.      << 
 10 // *                                                9 // *                                                                  *
 11 // * Neither the authors of this software syst     10 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     11 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     12 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     13 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  <<  14 // * use.                                                             *
 16 // * for the full disclaimer and the limitatio << 
 17 // *                                               15 // *                                                                  *
 18 // * This  code  implementation is the result  <<  16 // * This  code  implementation is the  intellectual property  of the *
 19 // * technical work of the GEANT4 collaboratio <<  17 // * GEANT4 collaboration.                                            *
 20 // * By using,  copying,  modifying or  distri <<  18 // * By copying,  distributing  or modifying the Program (or any work *
 21 // * any work based  on the software)  you  ag <<  19 // * based  on  the Program)  you indicate  your  acceptance of  this *
 22 // * use  in  resulting  scientific  publicati <<  20 // * statement, and all its terms.                                    *
 23 // * acceptance of all terms of the Geant4 Sof << 
 24 // *******************************************     21 // ********************************************************************
 25 //                                                 22 //
 26 //                                                 23 //
                                                   >>  24 // $Id: G4FastTrack.cc,v 1.6 2001/10/26 14:43:37 mverderi Exp $
                                                   >>  25 // GEANT4 tag $Name: geant4-04-01 $
 27 //                                                 26 //
 28 //--------------------------------------------     27 //---------------------------------------------------------------
 29 //                                                 28 //
 30 //  G4FastTrack.cc                                 29 //  G4FastTrack.cc
 31 //                                                 30 //
 32 //  Description:                                   31 //  Description:
 33 //    Keeps the current track information and      32 //    Keeps the current track information and special features
 34 //    for Parameterised Simulation Models.         33 //    for Parameterised Simulation Models.
 35 //                                                 34 //
 36 //  History:                                       35 //  History:
 37 //    Oct 97: Verderi && MoraDeFreitas - First     36 //    Oct 97: Verderi && MoraDeFreitas - First Implementation.
 38 //                                                 37 //
 39 //--------------------------------------------     38 //---------------------------------------------------------------
 40                                                    39 
                                                   >>  40 #include "G4ios.hh"
 41 #include "G4FastTrack.hh"                          41 #include "G4FastTrack.hh"
 42                                                << 
 43 #include "G4TouchableHandle.hh"                << 
 44 #include "G4TransportationManager.hh"              42 #include "G4TransportationManager.hh"
 45 #include "G4ios.hh"                            << 
 46                                                    43 
 47 // -----------                                     44 // -----------
 48 // Constructor                                     45 // Constructor
 49 // -----------                                     46 // -----------
 50 //                                                 47 //
 51 G4FastTrack::G4FastTrack(G4Envelope* anEnvelop <<  48 G4FastTrack::G4FastTrack(G4Envelope *anEnvelope,
 52   : fEnvelope(anEnvelope), fIsUnique(IsUnique) <<  49        G4bool IsUnique) :
                                                   >>  50   fAffineTransformationDefined(false),   fEnvelope(anEnvelope),
                                                   >>  51   fIsUnique(IsUnique),   fEnvelopeSolid(fEnvelope->GetSolid())
                                                   >>  52 {}
                                                   >>  53 
                                                   >>  54 // -----------
                                                   >>  55 // Destructor:
                                                   >>  56 // -----------
                                                   >>  57 G4FastTrack::~G4FastTrack()
 53 {}                                                 58 {}
 54                                                    59 
 55 //--------------------------------------------     60 //------------------------------------------------------------
 56 // The parameterised simulation manager uses t     61 // The parameterised simulation manager uses the SetCurrentTrack
 57 // method to setup the current G4FastTrack obj <<  62 // method to setup the current G4FastTrack object 
 58 //--------------------------------------------     63 //------------------------------------------------------------
 59 void G4FastTrack::SetCurrentTrack(const G4Trac <<  64 void G4FastTrack::SetCurrentTrack(const G4Track& track,
                                                   >>  65           const G4Navigator* theNavigator) 
 60 {                                                  66 {
                                                   >>  67 
 61   // -- Register track pointer (used everywher     68   // -- Register track pointer (used everywhere):
 62   fTrack = &track;                                 69   fTrack = &track;
 63                                                    70 
 64   //------------------------------------------     71   //-----------------------------------------------------
 65   // First time the track enters the volume or     72   // First time the track enters the volume or if the
 66   // Logical Volume was placed n-Times in the      73   // Logical Volume was placed n-Times in the geometry :
 67   //                                           <<  74   // 
 68   // Records the Rotation+Translation for the      75   // Records the Rotation+Translation for the Envelope !
 69   // When the particle is inside or on the bou <<  76   // When the particle is inside or on the boundary, the 
 70   // NavigationHistory IS UP TO DATE.              77   // NavigationHistory IS UP TO DATE.
 71   //------------------------------------------     78   //------------------------------------------------------
 72   if (!fAffineTransformationDefined || !fIsUni <<  79   if (!fAffineTransformationDefined || !fIsUnique) 
 73                                                <<  80     FRecordsAffineTransformation(theNavigator);
                                                   >>  81   
 74   //------------------------------------------     82   //-------------------------------------------
 75   // Records local position/momentum/direction     83   // Records local position/momentum/direction
 76   // of the Track.                                 84   // of the Track.
 77   // They are accessible to the user through a     85   // They are accessible to the user through a
 78   // set of Get functions and should be useful     86   // set of Get functions and should be useful
 79   // to decide to trigger or not.                  87   // to decide to trigger or not.
 80   //------------------------------------------     88   //-------------------------------------------
 81   // -- local position:                            89   // -- local position:
 82   fLocalTrackPosition = fAffineTransformation. <<  90   fLocalTrackPosition = fAffineTransformation.
                                                   >>  91     TransformPoint(fTrack->GetPosition());
 83   // -- local momentum:                            92   // -- local momentum:
 84   fLocalTrackMomentum = fAffineTransformation. <<  93   fLocalTrackMomentum = fAffineTransformation.
                                                   >>  94     TransformAxis(fTrack->GetMomentum());
 85   // -- local direction:                           95   // -- local direction:
 86   fLocalTrackDirection = fLocalTrackMomentum.u     96   fLocalTrackDirection = fLocalTrackMomentum.unit();
 87   // -- local polarization:                        97   // -- local polarization:
 88   fLocalTrackPolarization = fAffineTransformat <<  98   fLocalTrackPolarization = fAffineTransformation.
                                                   >>  99     TransformAxis(fTrack->GetPolarization());
 89 }                                                 100 }
 90                                                   101 
 91 //------------------------------------            102 //------------------------------------
 92 //                                                103 //
 93 // 3D transformation of the envelope              104 // 3D transformation of the envelope
 94 // This is Done only one time.                    105 // This is Done only one time.
 95 //                                                106 //
 96 //------------------------------------            107 //------------------------------------
 97 void G4FastTrack::FRecordsAffineTransformation << 108 void 
                                                   >> 109 G4FastTrack::FRecordsAffineTransformation(const G4Navigator* theNavigator)
 98 {                                                 110 {
                                                   >> 111 
 99   //------------------------------------------    112   //--------------------------------------------------------
100   // Get the touchable history which represent    113   // Get the touchable history which represents the current
101   // volume hierachy the particle is in.          114   // volume hierachy the particle is in.
102   // Note that TouchableHistory allocated by t    115   // Note that TouchableHistory allocated by the Navigator
103   // must be deleted by G4FastTrack.              116   // must be deleted by G4FastTrack.
104   //------------------------------------------    117   //--------------------------------------------------------
105   const G4Navigator* NavigatorToUse;              118   const G4Navigator* NavigatorToUse;
106   if (theNavigator != nullptr)                 << 119   if(theNavigator != 0 ) NavigatorToUse=theNavigator;
107     NavigatorToUse = theNavigator;             << 
108   else                                            120   else
109     NavigatorToUse = G4TransportationManager:: << 121     NavigatorToUse=
110                                                << 122       G4TransportationManager::GetTransportationManager()->
111   G4TouchableHandle history = NavigatorToUse-> << 123       GetNavigatorForTracking();
112                                                << 124   
                                                   >> 125   G4TouchableHistory *history =  
                                                   >> 126     NavigatorToUse->CreateTouchableHistory();
                                                   >> 127   
113   //------------------------------------------    128   //-----------------------------------------------------
114   // Run accross the hierarchy to find the phy    129   // Run accross the hierarchy to find the physical volume
115   // associated with the envelope                 130   // associated with the envelope
116   //------------------------------------------    131   //-----------------------------------------------------
117   auto depth = (G4int)history->GetHistory()->G << 132   int depth = history->GetHistory()->GetDepth();
118   G4int idepth;                                << 133   int idepth, Done = 0;
119   G4bool Done = false;                         << 134   for (idepth = 0; idepth <= depth; idepth++) {
120   for (idepth = 0; idepth <= depth; ++idepth)  << 135     if (history->GetHistory()->GetVolume(idepth)->GetLogicalVolume() == 
121     G4VPhysicalVolume* currPV = history->GetHi << 136   fEnvelope) {
122     G4LogicalVolume* currLV = currPV->GetLogic << 137       fEnvelopePhysicalVolume=history->GetHistory()->GetVolume(idepth);
123     if ((currLV->GetRegion() == fEnvelope) &&  << 138       Done = 1;
124       fEnvelopePhysicalVolume = currPV;        << 
125       fEnvelopeLogicalVolume = currLV;         << 
126       fEnvelopeSolid = currLV->GetSolid();     << 
127       Done = true;                             << 
128       break;                                      139       break;
129     }                                             140     }
130   }                                               141   }
131   //------------------------------------------    142   //---------------------------------------------
132   //-- Verification: should be removed in futu    143   //-- Verification: should be removed in future:
133   //------------------------------------------    144   //---------------------------------------------
134   if (!Done) {                                 << 145   if ( !Done )
135     G4ExceptionDescription ed;                 << 146     {
136     ed << "Can't find transformation for `" << << 147       G4cout << "\n\nERROR !!! can't find Transform for " <<
137     G4Exception("G4FastTrack::FRecordsAffineTr << 148   fEnvelopePhysicalVolume->GetName() << "\n\n" << G4endl;
138   }                                            << 149     }
139   else {                                       << 150   else
140     //---------------------------------------- << 151     {
141     // Records the transformation and inverse  << 152       //-------------------------------------------------------
142     //---------------------------------------- << 153       // Records the transformation and inverse transformation:
143     fAffineTransformation = history->GetHistor << 154       //-------------------------------------------------------
144     fInverseAffineTransformation = fAffineTran << 155       fAffineTransformation = history->GetHistory()->GetTransform(idepth);
145                                                << 156       fInverseAffineTransformation = fAffineTransformation.Inverse();
146     fAffineTransformationDefined = true;       << 157       
147   }                                            << 158       fAffineTransformationDefined = true;
                                                   >> 159     }
                                                   >> 160   
                                                   >> 161   //------------------------------------------------------
                                                   >> 162   // Delete the TouchableHistory created by the Navigator:
                                                   >> 163   //------------------------------------------------------
                                                   >> 164   delete history;
                                                   >> 165   history = 0;
148 }                                                 166 }
                                                   >> 167 
                                                   >> 168 
149                                                   169