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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 /tracking/src/G4TrackingMessenger.cc (Version 11.3.0) and /tracking/src/G4TrackingMessenger.cc (Version 11.1.1)


  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 // G4TrackingMessenger class implementation        26 // G4TrackingMessenger class implementation
 27 //                                                 27 //
 28 // Contact:                                        28 // Contact:
 29 //   Questions and comments to this code shoul     29 //   Questions and comments to this code should be sent to
 30 //     Katsuya Amako  (e-mail: Katsuya.Amako@k     30 //     Katsuya Amako  (e-mail: Katsuya.Amako@kek.jp)
 31 //     Makoto  Asai   (e-mail: asai@slac.stanf     31 //     Makoto  Asai   (e-mail: asai@slac.stanford.edu)
 32 //     Takashi Sasaki (e-mail: Takashi.Sasaki@     32 //     Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
 33 // -------------------------------------------     33 // --------------------------------------------------------------------
 34                                                    34 
 35 #include "G4TrackingMessenger.hh"                  35 #include "G4TrackingMessenger.hh"
 36                                                << 
 37 #include "G4IdentityTrajectoryFilter.hh"       << 
 38 #include "G4PropagatorInField.hh"              << 
 39 #include "G4SteppingManager.hh"                << 
 40 #include "G4TrackStatus.hh"                    << 
 41 #include "G4TrackingManager.hh"                << 
 42 #include "G4TransportationManager.hh"          << 
 43 #include "G4UIcmdWithAnInteger.hh"             << 
 44 #include "G4UIcmdWithoutParameter.hh"          << 
 45 #include "G4UIdirectory.hh"                        36 #include "G4UIdirectory.hh"
                                                   >>  37 #include "G4UIcmdWithoutParameter.hh"
                                                   >>  38 #include "G4UIcmdWithAnInteger.hh"
 46 #include "G4UImanager.hh"                          39 #include "G4UImanager.hh"
 47 #include "G4Threading.hh"                      << 
 48 #include "G4ClonedTrajectory.hh"               << 
 49 #include "G4ClonedTrajectoryPoint.hh"          << 
 50 #include "G4ClonedRichTrajectory.hh"           << 
 51 #include "G4ClonedRichTrajectoryPoint.hh"      << 
 52 #include "G4ClonedSmoothTrajectory.hh"         << 
 53 #include "G4ClonedSmoothTrajectoryPoint.hh"    << 
 54 #include "G4ios.hh"                            << 
 55 #include "globals.hh"                              40 #include "globals.hh"
                                                   >>  41 #include "G4TrackingManager.hh"
                                                   >>  42 #include "G4SteppingManager.hh"
                                                   >>  43 #include "G4TrackStatus.hh"
                                                   >>  44 #include "G4ios.hh"
                                                   >>  45 #include "G4TransportationManager.hh"
                                                   >>  46 #include "G4PropagatorInField.hh"
                                                   >>  47 #include "G4IdentityTrajectoryFilter.hh"
 56                                                    48 
 57 //////////////////////////////////////////////     49 ///////////////////////////////////////////////////////////////////
 58 G4TrackingMessenger::G4TrackingMessenger(G4Tra     50 G4TrackingMessenger::G4TrackingMessenger(G4TrackingManager* trMan)
 59   //////////////////////////////////////////// <<  51 ///////////////////////////////////////////////////////////////////
 60   : trackingManager(trMan)                         52   : trackingManager(trMan)
 61 {                                                  53 {
 62   steppingManager = trackingManager->GetSteppi     54   steppingManager = trackingManager->GetSteppingManager();
 63                                                    55 
 64   TrackingDirectory = new G4UIdirectory("/trac     56   TrackingDirectory = new G4UIdirectory("/tracking/");
 65   TrackingDirectory->SetGuidance("TrackingMana     57   TrackingDirectory->SetGuidance("TrackingManager and SteppingManager control commands.");
 66                                                    58 
 67   AbortCmd = new G4UIcmdWithoutParameter("/tra <<  59   AbortCmd = new G4UIcmdWithoutParameter("/tracking/abort",this);
 68   AbortCmd->SetGuidance("Abort current G4Track     60   AbortCmd->SetGuidance("Abort current G4Track processing.");
 69                                                    61 
 70   ResumeCmd = new G4UIcmdWithoutParameter("/tr <<  62   ResumeCmd = new G4UIcmdWithoutParameter("/tracking/resume",this);
 71   ResumeCmd->SetGuidance("Resume current G4Tra     63   ResumeCmd->SetGuidance("Resume current G4Track processing.");
 72                                                    64 
 73   StoreTrajectoryCmd = new G4UIcmdWithAnIntege <<  65   StoreTrajectoryCmd = new G4UIcmdWithAnInteger("/tracking/storeTrajectory",this);
 74   StoreTrajectoryCmd->SetGuidance("Store traje     66   StoreTrajectoryCmd->SetGuidance("Store trajectories or not.");
 75   StoreTrajectoryCmd->SetGuidance(" 0 : Don't      67   StoreTrajectoryCmd->SetGuidance(" 0 : Don't Store trajectories.");
 76   StoreTrajectoryCmd->SetGuidance(" !=0 : Stor     68   StoreTrajectoryCmd->SetGuidance(" !=0 : Store trajectories.");
 77   StoreTrajectoryCmd->SetGuidance(" 1 : Choose     69   StoreTrajectoryCmd->SetGuidance(" 1 : Choose G4Trajectory as default.");
 78   StoreTrajectoryCmd->SetGuidance(" 2 : Choose     70   StoreTrajectoryCmd->SetGuidance(" 2 : Choose G4SmoothTrajectory as default.");
 79   StoreTrajectoryCmd->SetGuidance(" 3 : Choose     71   StoreTrajectoryCmd->SetGuidance(" 3 : Choose G4RichTrajectory as default.");
 80   StoreTrajectoryCmd->SetGuidance(" 4 : Choose     72   StoreTrajectoryCmd->SetGuidance(" 4 : Choose G4RichTrajectory with auxiliary points as default.");
 81   StoreTrajectoryCmd->SetParameterName("Store" <<  73   StoreTrajectoryCmd->SetParameterName("Store",true);
 82   StoreTrajectoryCmd->SetDefaultValue(0);          74   StoreTrajectoryCmd->SetDefaultValue(0);
 83   StoreTrajectoryCmd->SetRange("Store >=0 && S <<  75   StoreTrajectoryCmd->SetRange("Store >=0 && Store <= 4"); 
 84                                                    76 
 85   VerboseCmd = new G4UIcmdWithAnInteger("/trac <<  77   VerboseCmd = new G4UIcmdWithAnInteger("/tracking/verbose",this);
 86 #ifdef G4VERBOSE                                   78 #ifdef G4VERBOSE
 87   VerboseCmd->SetGuidance("Set Verbose level o     79   VerboseCmd->SetGuidance("Set Verbose level of tracking category.");
 88   VerboseCmd->SetGuidance(" -1 : Silent.");        80   VerboseCmd->SetGuidance(" -1 : Silent.");
 89   VerboseCmd->SetGuidance(" 0 : Silent.");         81   VerboseCmd->SetGuidance(" 0 : Silent.");
 90   VerboseCmd->SetGuidance(" 1 : Minimum inform     82   VerboseCmd->SetGuidance(" 1 : Minimum information of each Step.");
 91   VerboseCmd->SetGuidance(" 2 : Addition to Le     83   VerboseCmd->SetGuidance(" 2 : Addition to Level=1, info of secondary particles.");
 92   VerboseCmd->SetGuidance(" 3 : Addition to Le     84   VerboseCmd->SetGuidance(" 3 : Addition to Level=1, pre/postStepoint information");
 93   VerboseCmd->SetGuidance("     after all Alon     85   VerboseCmd->SetGuidance("     after all AlongStep/PostStep process executions.");
 94   VerboseCmd->SetGuidance(" 4 : Addition to Le     86   VerboseCmd->SetGuidance(" 4 : Addition to Level=3, pre/postStepoint information");
 95   VerboseCmd->SetGuidance("     at each AlongS <<  87   VerboseCmd->SetGuidance("     at each AlongStepPostStep process execution."); 
 96   VerboseCmd->SetGuidance(" 5 : Addition to Le     88   VerboseCmd->SetGuidance(" 5 : Addition to Level=4, proposed Step length information");
 97   VerboseCmd->SetGuidance("     from each Alon <<  89   VerboseCmd->SetGuidance("     from each AlongStepPostStep process."); 
 98   VerboseCmd->SetParameterName("verbose_level" <<  90   VerboseCmd->SetParameterName("verbose_level",true);
 99   VerboseCmd->SetDefaultValue(0);                  91   VerboseCmd->SetDefaultValue(0);
100   VerboseCmd->SetRange("verbose_level >=-1  ")     92   VerboseCmd->SetRange("verbose_level >=-1  ");
101 #else                                          <<  93 #else 
102   VerboseCmd->SetGuidance("You need to recompi <<  94   VerboseCmd->SetGuidance("You need to recompile the tracking category defining G4VERBOSE ");  
103 #endif                                             95 #endif
104 }                                                  96 }
105                                                    97 
106 ////////////////////////////////////////////       98 ////////////////////////////////////////////
107 G4TrackingMessenger::~G4TrackingMessenger()        99 G4TrackingMessenger::~G4TrackingMessenger()
108 ////////////////////////////////////////////      100 ////////////////////////////////////////////
109 {                                                 101 {
110   delete TrackingDirectory;                       102   delete TrackingDirectory;
111   delete AbortCmd;                                103   delete AbortCmd;
112   delete ResumeCmd;                               104   delete ResumeCmd;
113   delete StoreTrajectoryCmd;                      105   delete StoreTrajectoryCmd;
114   delete VerboseCmd;                              106   delete VerboseCmd;
115   delete auxiliaryPointsFilter;                << 
116 }                                                 107 }
117                                                   108 
118 //////////////////////////////////////////////    109 ///////////////////////////////////////////////////////////////////////////////
119 void G4TrackingMessenger::SetNewValue(G4UIcomm << 110 void G4TrackingMessenger::SetNewValue(G4UIcommand* command,G4String newValues)
120 //////////////////////////////////////////////    111 ///////////////////////////////////////////////////////////////////////////////
121 {                                                 112 {
122   if (command == VerboseCmd) {                 << 113   if( command == VerboseCmd )
                                                   >> 114   {
123     trackingManager->SetVerboseLevel(VerboseCm    115     trackingManager->SetVerboseLevel(VerboseCmd->ConvertToInt(newValues));
124   }                                               116   }
125                                                   117 
126   if (command == AbortCmd) {                   << 118   if( command == AbortCmd )
                                                   >> 119   {
127     steppingManager->GetTrack()->SetTrackStatu    120     steppingManager->GetTrack()->SetTrackStatus(fStopAndKill);
128     G4UImanager::GetUIpointer()->ApplyCommand(    121     G4UImanager::GetUIpointer()->ApplyCommand("/control/exit");
129   }                                               122   }
130                                                   123 
131   if (command == ResumeCmd) {                  << 124   if( command == ResumeCmd )
                                                   >> 125   {
132     G4UImanager::GetUIpointer()->ApplyCommand(    126     G4UImanager::GetUIpointer()->ApplyCommand("/control/exit");
133   }                                               127   }
134                                                   128 
135   if (command == StoreTrajectoryCmd) {         << 129   static G4ThreadLocal
                                                   >> 130          G4IdentityTrajectoryFilter* auxiliaryPointsFilter = nullptr;
                                                   >> 131   if(auxiliaryPointsFilter == nullptr)
                                                   >> 132   {
                                                   >> 133     auxiliaryPointsFilter = new G4IdentityTrajectoryFilter;
                                                   >> 134   }
                                                   >> 135   if( command == StoreTrajectoryCmd )
                                                   >> 136   {
136     G4int trajType = StoreTrajectoryCmd->Conve    137     G4int trajType = StoreTrajectoryCmd->ConvertToInt(newValues);
137     if (trajType == 2 || trajType == 4) {      << 138     if(trajType==2||trajType==4)
138                                                << 139     {
139       if (nullptr == auxiliaryPointsFilter) {  << 
140   auxiliaryPointsFilter = new G4IdentityTrajec << 
141       }                                        << 
142       G4TransportationManager::GetTransportati    140       G4TransportationManager::GetTransportationManager()
143         ->GetPropagatorInField()               << 141         ->GetPropagatorInField()->SetTrajectoryFilter(auxiliaryPointsFilter);
144         ->SetTrajectoryFilter(auxiliaryPointsF << 
145     }                                             142     }
146     else {                                     << 143     else
                                                   >> 144     {
147       G4TransportationManager::GetTransportati    145       G4TransportationManager::GetTransportationManager()
148         ->GetPropagatorInField()               << 146         ->GetPropagatorInField()->SetTrajectoryFilter(0);
149         ->SetTrajectoryFilter(nullptr);        << 
150     }                                             147     }
151     trackingManager->SetStoreTrajectory(trajTy    148     trackingManager->SetStoreTrajectory(trajType);
152                                                << 
153     // Make sure cloning works for sub-event p << 
154     if(G4Threading::IsMasterThread() && trajTy << 
155       static G4bool traj_1 = false, traj_2 = f << 
156       G4VTrajectory* traj = nullptr;           << 
157       G4VTrajectoryPoint* trajp = nullptr;     << 
158       switch (trajType) {                      << 
159        case 1:                                 << 
160         if(!traj_1) {                          << 
161           traj = new G4ClonedTrajectory();     << 
162           trajp = new G4ClonedTrajectoryPoint( << 
163           traj_1 = true;                       << 
164         }                                      << 
165         break;                                 << 
166        case 2:                                 << 
167         if(!traj_2) {                          << 
168           traj = new G4ClonedSmoothTrajectory( << 
169           trajp = new G4ClonedSmoothTrajectory << 
170           traj_2 = true;                       << 
171         }                                      << 
172         break;                                 << 
173        case 3:                                 << 
174        case 4:                                 << 
175         if(!traj_3) {                          << 
176           traj = new G4ClonedRichTrajectory(); << 
177           trajp = new G4ClonedRichTrajectoryPo << 
178           traj_3 = true;                       << 
179         }                                      << 
180         break;                                 << 
181        default:                                << 
182         break;                                 << 
183       }                                        << 
184       if(traj!=nullptr) delete traj;           << 
185       if(trajp!=nullptr) delete trajp;         << 
186     }                                          << 
187   }                                               149   }
188                                                << 
189 }                                                 150 }
190                                                   151 
191 //////////////////////////////////////////////    152 ////////////////////////////////////////////////////////////////////
192 G4String G4TrackingMessenger::GetCurrentValue(    153 G4String G4TrackingMessenger::GetCurrentValue(G4UIcommand* command)
193 //////////////////////////////////////////////    154 ////////////////////////////////////////////////////////////////////
194 {                                                 155 {
195   if (command == VerboseCmd) {                 << 156   if( command == VerboseCmd )
                                                   >> 157   {
196     return VerboseCmd->ConvertToString(trackin    158     return VerboseCmd->ConvertToString(trackingManager->GetVerboseLevel());
197   }                                               159   }
198   if (command == StoreTrajectoryCmd) {         << 160   else if( command == StoreTrajectoryCmd )
199     return StoreTrajectoryCmd->ConvertToString << 161   {
                                                   >> 162     return StoreTrajectoryCmd
                                                   >> 163            ->ConvertToString(trackingManager->GetStoreTrajectory());
200   }                                               164   }
201   return G4String(1, '\0');                    << 165   return G4String(1,'\0');
202 }                                                 166 }
203                                                   167