#include <UnObserverStepAction.h>
Inheritance diagram for UnObserverStepAction:
Definition at line 11 of file UnObserverStepAction.h.
typedef std::map<const IDetectorElement*,unsigned int> QueriableStepAction::DetectorIdCache_t [protected, inherited] |
Definition at line 88 of file QueriableStepAction.h.
enum QueriableStepAction::EParamIds [protected, inherited] |
Definition at line 93 of file QueriableStepAction.h.
00093 { 00094 kPar_Unknown = 0 00095 , kPar_START_VERTEX 00097 // Applies to end-of-step (Vertex) only 00098 , kPar_Step_dE // double 00099 , kPar_Step_dE_Ion // double 00100 , kPar_Step_qdE // double 00101 , kPar_Step_dx // double 00102 , kPar_Step_dt // double 00103 , kPar_Step_dAngle // double 00104 , kPar_capTargetZ // int 00105 , kPar_capTargetA // int | No correct A info. 8/2008 Wei 00106 00107 , kPar_Step_E_weighted_x // double 00108 , kPar_Step_E_weighted_y // double 00109 , kPar_Step_E_weighted_z // double 00110 , kPar_Step_E_weighted_t // double 00111 , kPar_Step_qE_weighted_x // double 00112 , kPar_Step_qE_weighted_y // double 00113 , kPar_Step_qE_weighted_z // double 00114 , kPar_Step_qE_weighted_t // double 00115 00116 , kPar_IsStopping // int 00117 , kPar_IsStarting // int 00118 , kPar_StepNumber // int 00119 00120 , kPar_VolumeChanged // int as bool 00121 , kPar_MaterialChanged // int as bool 00122 00124 // Both Vertex and Track: 00125 , kPar_START_TRACK 00126 , kPar_t // double | 00127 , kPar_x // double | 00128 , kPar_y // double | 00129 , kPar_z // double | 00130 , kPar_r // double | 00131 , kPar_local_x // double | 00132 , kPar_local_y // double | 00133 , kPar_local_z // double | all of these guys refer to prepoint for tracks 00134 , kPar_local_r // double | or postpoint for vertices. 00135 , kPar_LogicalVolumeName // string 00136 , kPar_MaterialName // string 00137 , kPar_DetectorElement // custom 00138 , kPar_DetectorElementName // string 00139 , kPar_DetectorElementMatch // int 00140 , kPar_NicheId // int 00141 , kPar_DetectorId // int 00142 , kPar_SiteId // int 00143 , kPar_Site // int 00144 , kPar_AD // int 00145 , kPar_momentum // double | 00146 , kPar_TotEnergy // double | 00147 , kPar_KineticEnergy // double | 00148 , kPar_vx // double | 00149 , kPar_vy // double | 00150 , kPar_vz // double | 00151 , kPar_local_vx // double | 00152 , kPar_local_vy // double | 00153 , kPar_local_vz // double | 00154 , kPar_ProcessType // int | 00155 , kPar_ProcessName // string | 00156 00157 , kPar_Pdg // int 00158 , kPar_Charge // int 00159 , kPar_TrackId // int 00160 , kPar_CreatorPdg // int 00161 , kPar_AncestorPdg // int 00162 , kPar_mass // double 00163 , kPar_ParticleName // string 00164 , kPar_Prescale // custom 00165 , kPar_CreatorProcessName // string 00166 , kPar_END_VERTEX 00167 , kPar_END_QUERIABLE 00168 };
UnObserverStepAction::UnObserverStepAction | ( | const std::string & | type, | |
const std::string & | name, | |||
const IInterface * | parent | |||
) |
Definition at line 26 of file UnObserverStepAction.cc.
00030 : QueriableStepAction( type , name , parent ) 00031 , m_Stats() 00032 { 00033 // Declare some good starting stats. 00034 m_Stats.push_back(AddableVector().add("photon_created_energy" ).add( "E" ).add( "StepNumber==1 and pdg==20022" ) ); 00035 m_Stats.push_back(AddableVector().add("photon_backscatter_r" ).add( "local_r" ).add( "pdg==20022 and dAngle >= 90" ) ); 00036 m_Stats.push_back(AddableVector().add("photon_forescatter_r" ).add( "local_r" ).add( "pdg==20022 and (dAngle <= 90 and dAngle > 0)" ) ); 00037 m_Stats.push_back(AddableVector().add("photon_stop_r" ).add( "local_r" ).add( "(pdg==20022) and ((IsStopping == 1) and (LogicalVolumeName == '/dd/Geometry/PMT/lvPmtHemi'))" ) ); 00038 m_Stats.push_back(AddableVector().add("pmt_hit" ).add( "t" ).add( "pdg==20022 and (IsStopping == 1 and (LogicalVolumeName=='/dd/Geometry/PMT/lvPmtHemi'))" ) ); 00039 m_Stats.push_back(AddableVector().add("edep-water").add( "dE").add( "pdg!=20022 and (MaterialName == '/dd/Materials/Water')") ); 00040 m_Stats.push_back(AddableVector().add("edep-oil").add( "dE").add( "pdg!=20022 and (MaterialName == '/dd/Materials/Oil')") ); 00041 m_Stats.push_back(AddableVector().add("edep-ls").add( "dE").add( "pdg!=20022 and (MaterialName == '/dd/Materials/LiquidScintillator')") ); 00042 m_Stats.push_back(AddableVector().add("edep-gdls").add( "dE").add( "pdg!=20022 and (MaterialName == '/dd/Materials/GdDopedLS')") ); 00043 m_Stats.push_back(AddableVector().add("edep-acryilc").add("dE").add( "pdg!=20022 and (MaterialName == '/dd/Materials/Acrylic')") ); 00044 m_Stats.push_back(AddableVector().add("edep-ad1" ).add("dE" ).add("pdg!=20022 and ((MaterialName == '/dd/Materials/LiquidScintillator' or MaterialName == '/dd/Materials/GdDopedLS') and AD==1)" ) ); 00045 m_Stats.push_back(AddableVector().add("edep-ad2" ).add("dE" ).add("pdg!=20022 and ((MaterialName == '/dd/Materials/LiquidScintillator' or MaterialName == '/dd/Materials/GdDopedLS') and AD==2)" ) ); 00046 m_Stats.push_back(AddableVector().add("edep-ad3" ).add("dE" ).add("pdg!=20022 and ((MaterialName == '/dd/Materials/LiquidScintillator' or MaterialName == '/dd/Materials/GdDopedLS') and AD==3)" ) ); 00047 m_Stats.push_back(AddableVector().add("edep-ad4" ).add("dE" ).add("pdg!=20022 and ((MaterialName == '/dd/Materials/LiquidScintillator' or MaterialName == '/dd/Materials/GdDopedLS') and AD==4)" ) ); 00048 m_Stats.push_back(AddableVector().add("qedep-ad1" ).add("qdE" ).add("pdg!=20022 and ((MaterialName == '/dd/Materials/LiquidScintillator' or MaterialName == '/dd/Materials/GdDopedLS') and AD==1)" ) ); 00049 m_Stats.push_back(AddableVector().add("qedep-ad2" ).add("qdE" ).add("pdg!=20022 and ((MaterialName == '/dd/Materials/LiquidScintillator' or MaterialName == '/dd/Materials/GdDopedLS') and AD==2)" ) ); 00050 m_Stats.push_back(AddableVector().add("qedep-ad3" ).add("qdE" ).add("pdg!=20022 and ((MaterialName == '/dd/Materials/LiquidScintillator' or MaterialName == '/dd/Materials/GdDopedLS') and AD==3)" ) ); 00051 m_Stats.push_back(AddableVector().add("qedep-ad4" ).add("qdE" ).add("pdg!=20022 and ((MaterialName == '/dd/Materials/LiquidScintillator' or MaterialName == '/dd/Materials/GdDopedLS') and AD==4)" ) ); 00052 m_Stats.push_back(AddableVector().add("mu-path-water").add( "dx").add( "(pdg==13 || pdg==-13) and MaterialName == '/dd/Materials/Water'") ); 00053 m_Stats.push_back(AddableVector().add("mu-path-oil").add( "dx").add( "(pdg==13 || pdg==-13) and MaterialName == '/dd/Materials/Oil'") ); 00054 m_Stats.push_back(AddableVector().add("mu-path-ls").add( "dx").add( "(pdg==13 || pdg==-13) and MaterialName == '/dd/Materials/LiquidScintillator'") ); 00055 m_Stats.push_back(AddableVector().add("mu-path-gdls").add( "dx").add( "(pdg==13 || pdg==-13) and MaterialName == '/dd/Materials/GdDopedLS'") ); 00056 m_Stats.push_back(AddableVector() 00057 .add("ad" ).add( "AD" ) 00058 .add("expos" ).add("Ex" ) 00059 .add("eypos" ).add("Ey" ) 00060 .add("ezpos" ).add("Ez" ) 00061 .add("et" ).add("Et" ) 00062 .add("qexpos").add("qEx" ) 00063 .add("qeypos").add("qEy" ) 00064 .add("qezpos").add("qEz" ) 00065 .add("qet" ).add("qEt" ) 00066 .add( "(pdg!=20022) and (MaterialName == '/dd/Materials/LiquidScintillator' or MaterialName == '/dd/Materials/GdDopedLS')" ) ); 00067 00068 declareProperty("Stats",m_Stats); 00069 00070 00071 // Also, change the default search path: 00072 m_DetectorElementSearchPath = AddableVector() 00073 .add("/dd/Structure/DayaBay") 00074 .add("/dd/Structure/Sites") 00075 .add("/dd/Structure/Pool") 00076 .add("/dd/Structure/AD") 00077 .add("/dd/Structure/RPC"); 00078 00079 00080 }
UnObserverStepAction::~UnObserverStepAction | ( | ) | [virtual] |
Definition at line 82 of file UnObserverStepAction.cc.
00083 { 00084 for(size_t i=0;i<mGroups.size();i++) { 00085 if(mGroups[i].mRule) delete mGroups[i].mRule; 00086 } 00087 }
UnObserverStepAction::UnObserverStepAction | ( | ) | [private] |
no default constructor
UnObserverStepAction::UnObserverStepAction | ( | const UnObserverStepAction & | ) | [private] |
no copy
StatusCode UnObserverStepAction::initialize | ( | ) | [virtual] |
Reimplemented from QueriableStepAction.
Definition at line 90 of file UnObserverStepAction.cc.
00091 { 00092 info() << "UnObserverStepAction::initialize()" << endreq; 00093 00094 StatusCode sc = QueriableStepAction::initialize(); 00095 if (sc.isFailure()) return sc; 00096 00097 sc = service("HistoryKeeper",mKeeper,true); 00098 if (sc.isFailure()) return sc; 00099 00101 // Build the selection rules. 00102 00103 using namespace RuleParser; 00104 using std::string; 00105 00107 ParameterList plist; 00108 QueriableStepAction::GetVertexParameterList(plist); 00109 00110 // Now loop through the various statistics that have been offered. 00111 for(size_t istat = 0; istat < m_Stats.size(); istat++ ){ 00112 std::vector<std::string>& stat = m_Stats[istat]; 00113 00114 // Check basic layout. Odd number of strings. 00115 if(stat.size()%2 != 1) { 00116 err() << "Bad configuration given to the UnObserverStepAction:" << endreq; 00117 err() << " Expected strings of the form <name> : <parameter> [: <name> : <parameter> ..]: <cut>" << endreq; 00118 err() << " but got " << stat.size() << " strings" 00119 //<< " \"" << line << << "\"" 00120 << endreq; 00121 return StatusCode::FAILURE; 00122 } 00123 00124 StatGroup statgroup; 00125 00126 // Compile the cut 00127 statgroup.mRule = 0; 00128 bool compiled = RuleParser::CreateRules(stat[stat.size()-1],plist,statgroup.mRule); 00129 if(!compiled || !statgroup.mRule) { 00130 err() << "Bad configuration given to the UnObserverStepAction:" << endreq; 00131 err() << " Expected 3 strings of the form <name>,<parameter>,<cut>" << endreq; 00132 err() << " but I failed to interpret selection string: " << stat[stat.size()-1] << endreq; 00133 return StatusCode::FAILURE; 00134 } 00135 info() << "Cut group : " << stat[stat.size()-1] << endreq; 00136 00137 for(size_t isub=0; isub<(stat.size()-1)/2 ; isub+=2) { 00138 // Check that the paramter name matches something, and record the match. 00139 std::string parname = stat[isub+1]; 00140 for(std::string::iterator c = parname.begin(); c!= parname.end(); ++c) *c = tolower(*c); 00141 00142 bool foundit = false; 00143 int parid = 0; 00144 for(size_t ipar = 0; ipar < plist.size(); ipar++) { 00145 std::string temp = plist[ipar].name(); 00146 for(std::string::iterator c = temp.begin(); c!= temp.end(); ++c) *c = tolower(*c); 00147 if(parname==temp) { 00148 foundit = true; 00149 parid = plist[ipar].id(); 00150 } 00151 } 00152 if(!foundit) { 00153 err() << "Bad configuration given to the UnObserverStepAction:" << endreq; 00154 err() << "Didn't recognize parameter name " << parname << endreq; 00155 return StatusCode::FAILURE; 00156 } 00157 // Report success and record the info we'll need at runtime. 00158 info() << " Statistic " << stat[isub] 00159 << " param=" << parname << " (id=" << parid <<")" 00160 << endreq; 00161 00162 NamedStat ns; 00163 ns.mName = stat[isub]; 00164 ns.mParam = parid; 00165 00166 statgroup.push_back(ns); 00167 } 00168 if(statgroup.size()) 00169 mGroups.push_back(statgroup); 00170 } 00171 00172 // keep track of bail-out messages 00173 mBail = 0; 00174 00175 return StatusCode::SUCCESS; 00176 }
StatusCode UnObserverStepAction::finalize | ( | ) | [virtual] |
Reimplemented from QueriableStepAction.
Definition at line 178 of file UnObserverStepAction.cc.
00179 { 00180 info() << "UnObserverStepAction::finalize()" << endreq; 00181 info() << "There were "<<mBail<<" bail-out warnings encountered in UserSteppingAction."<<endreq; 00182 return QueriableStepAction::finalize(); 00183 }
void UnObserverStepAction::UserSteppingAction | ( | const G4Step * | ) | [virtual] |
Implements QueriableStepAction.
Definition at line 187 of file UnObserverStepAction.cc.
00188 { 00194 00195 // Use the PreStepPoint to correctly evaluate geometry-, material-, volume-related information 00196 // Use the PostStepPoint to evaluate 'track'-related infomation (ie, energy loss, step length) 00197 00198 // Reference material: 00199 // The algorithm to handle a single step in G4: 00200 // http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch05.html#sect.Track.Basic 00201 // G4 stepping info from http://geant4.cern.ch/support/faq.shtml#TRACK-1 : 00202 // "Hereafter we call current volume the volume where the step has just 00203 // gone through. Geometrical informations are available from preStepPoint." 00204 // 00205 // Reset temporary things: 00206 QueriableStepAction::Reset(g4step,g4step->GetTrack(),g4step->GetPostStepPoint()); 00207 if ( g4step->GetTrack()->GetCurrentStepNumber() == 1 ) 00208 // This is the first step. 00209 // The interesting point is the first one. 00210 QueriableStepAction::Reset(g4step,g4step->GetTrack(),g4step->GetPreStepPoint()); 00211 00212 // The following is useful for intensive debugging of each step on every track. 00213 // Make it so it does not get executed without re-compilation. 00214 if ( 0 && g4step->GetTrack()->GetDefinition()->GetParticleName() != "opticalphoton" ) 00215 { 00216 G4StepPoint* pre = g4step->GetPreStepPoint(); 00217 G4String mpre = "NONE", mpost = "NONE", status1 = "", status2 = ""; 00218 G4String ppre = "NONE",ppost = "NONE",lpre = "NONE",lpost = "NONE"; 00219 G4ThreeVector localPosition = 0, worldPosition = 0; 00220 if (pre) { 00221 if ( pre->GetStepStatus() == fGeomBoundary ) status1 = "Entering"; 00222 G4Material* mm = pre->GetMaterial(); 00223 if (mm) mpre = mm->GetName(); 00224 G4TouchableHandle touch = pre->GetTouchableHandle(); 00225 G4VPhysicalVolume* volume = touch->GetVolume(); 00226 ppre = volume->GetName(); 00227 G4LogicalVolume* lvolume = volume->GetLogicalVolume(); 00228 lpre = lvolume->GetName(); 00229 } 00230 else { 00231 verbose() << " THERE IS NO PRE-STEP-POINT FOR THIS STEP " << endreq; 00232 } 00233 pre = g4step->GetPostStepPoint(); 00234 if (pre) { 00235 if (pre->GetStepStatus() == fGeomBoundary ) status2 = "Leaving"; 00236 G4Material* mm = pre->GetMaterial(); 00237 if (mm) mpost = mm->GetName(); 00238 G4TouchableHandle touch = pre->GetTouchableHandle(); 00239 if (touch) { 00240 worldPosition = pre->GetPosition(); 00241 localPosition = touch->GetHistory()->GetTopTransform().TransformPoint( worldPosition ); 00242 G4VPhysicalVolume* volume = touch->GetVolume(); 00243 if (volume) { 00244 ppost = volume->GetName(); 00245 G4LogicalVolume* lvolume = volume->GetLogicalVolume(); 00246 if (lvolume) lpost = lvolume->GetName(); 00247 } 00248 } 00249 } 00250 else { 00251 verbose() << " THERE IS NO POST-STEP-POINT FOR THIS STEP " << endreq; 00252 } 00253 00254 verbose() << "Track in " << g4step->GetTrack()->GetVolume()->GetName() 00255 << ", particle is " << g4step->GetTrack()->GetDefinition()->GetParticleName() 00256 << " Etot(MeV) " << g4step->GetTrack()->GetTotalEnergy()/MeV 00257 << " Ekin(MeV) " << g4step->GetTrack()->GetKineticEnergy()/MeV 00258 << " worldX,Y,Z " << worldPosition.x() << ", " << worldPosition.y() << ", " << worldPosition.z() 00259 << " localX,Y,Z " << localPosition.x() << ", " << localPosition.y() << ", " << localPosition.z() 00260 << " DirX,Y,Z " << g4step->GetTrack()->GetMomentumDirection().x() 00261 << ", " << g4step->GetTrack()->GetMomentumDirection().y() 00262 << ", " << g4step->GetTrack()->GetMomentumDirection().z() 00263 << " G4TrackID "<< g4step->GetTrack()->GetTrackID() 00264 << " current step# " << g4step->GetTrack()->GetCurrentStepNumber() 00265 << " step length(mm) " << g4step->GetTrack()->GetStepLength()/mm 00266 << " status " << g4step->GetTrack()->GetTrackStatus() << endreq; 00267 verbose() << " ...." << status1 << " " << status2 00268 << " prestep (current) material " << mpre << " pVol " << ppre << " lVol " << lpre 00269 << " poststep material " << mpost << " pVol " << ppost << " lVol " << lpost 00270 << endreq; 00271 } 00272 00273 // djaffe Bail with warning if we are in uppermost 'universe' volume 00274 if ( g4step->GetTrack()->GetVolume()->GetMotherLogical() == 0x0 ) { 00275 mBail++; 00276 if (mBail <= 10) { 00277 warning() << "Bailing out because track is in " << g4step->GetTrack()->GetVolume()->GetName() 00278 << ", particle is " << g4step->GetTrack()->GetDefinition()->GetParticleName() 00279 << " with total energy(MeV) " << g4step->GetTrack()->GetTotalEnergy()/MeV 00280 << " & kinetic energy(MeV) " << g4step->GetTrack()->GetKineticEnergy()/MeV 00281 << " G4TrackID "<< g4step->GetTrack()->GetTrackID() 00282 << " current step# " << g4step->GetTrack()->GetCurrentStepNumber() 00283 << " step length(mm) " << g4step->GetTrack()->GetStepLength()/mm 00284 << " status " << g4step->GetTrack()->GetTrackStatus() 00285 << endreq; 00286 } 00287 if (mBail > 10) { 00288 debug() << "Bailing out because track is in " << g4step->GetTrack()->GetVolume()->GetName() 00289 << ", particle is " << g4step->GetTrack()->GetDefinition()->GetParticleName() 00290 << " with total energy(MeV) " << g4step->GetTrack()->GetTotalEnergy()/MeV 00291 << " & kinetic energy(MeV) " << g4step->GetTrack()->GetKineticEnergy()/MeV 00292 << " G4TrackID "<< g4step->GetTrack()->GetTrackID() 00293 << " current step# " << g4step->GetTrack()->GetCurrentStepNumber() 00294 << " step length(mm) " << g4step->GetTrack()->GetStepLength()/mm 00295 << " status " << g4step->GetTrack()->GetTrackStatus() 00296 << endreq; 00297 } 00298 if (mBail == 10) { 00299 warning() << "Additional bail-out messages will be suppressed" << endreq; 00300 } 00301 return; 00302 } 00303 00304 // Get the current set of stats. 00305 SimUnobservableStatisticsHeader* ush = 0; 00306 StatusCode sc = mKeeper->GetCurrentUnobservable(ush); 00307 if(sc.isFailure() || (!ush)) { 00308 err() << "Problem with Keeper." << endreq; 00309 return; 00310 } 00311 assert(ush); 00312 00313 SimUnobservableStatisticsHeader::stat_map& statmap = ush->stats(); 00314 if(ush->stats().size() == 0) { 00315 00316 // This is a first call. Make sure that all the stats get intialized, by simply looking them up. 00317 for(size_t igrp = 0; igrp < mGroups.size(); igrp++) { 00318 StatGroup& statgroup = mGroups[igrp]; 00319 for(size_t istat = 0; istat < statgroup.size(); istat++ ){ 00320 statmap[statgroup[istat].mName]; 00321 verbose() << "Initializing group " << igrp << " stat " << istat 00322 << " name=" <<statgroup[istat].mName << " paramid=" << statgroup[istat].mParam << endreq; 00323 } 00324 } 00325 } 00326 00327 for(size_t igrp = 0; igrp < mGroups.size(); igrp++) { 00328 StatGroup& statgroup = mGroups[igrp]; 00329 00330 // The magic line.. does this step pass the cut? 00331 verbose() << " Group " << igrp << " statgroup.mRule->name() " << statgroup.mRule->name() << endreq; 00332 if(statgroup.mRule->select(this)) { 00333 // yes, so loop over the parameters. 00334 for(size_t istat = 0; istat < statgroup.size(); istat++ ){ 00335 double x = 0; 00336 queryParam(statgroup[istat].mParam,x); 00337 SimStatistic& stat = statmap[statgroup[istat].mName]; 00338 verbose() << "Querying group " << igrp << " stat " << istat 00339 << " name=" <<statgroup[istat].mName << " paramid=" << statgroup[istat].mParam 00340 << " and incrementing by " << x << endreq; 00341 stat.increment(x); 00342 } 00343 } 00344 } 00345 00346 }
UnObserverStepAction& UnObserverStepAction::operator= | ( | const UnObserverStepAction & | ) | [private] |
no =
StatusCode QueriableStepAction::GetTrackParameterList | ( | RuleParser::ParameterList & | ) | [virtual, inherited] |
To get the initial list of Queriables.
Usually called at initialize()
Definition at line 107 of file QueriableStepAction.cc.
00108 { 00109 using namespace RuleParser; 00110 using std::string; 00111 00112 tplist.add<double>(kPar_t,"time","t"); 00113 tplist.add<double>(kPar_x,"x","global_x"); 00114 tplist.add<double>(kPar_y,"y","global_y"); 00115 tplist.add<double>(kPar_z,"z","global_z"); 00116 tplist.add<double>(kPar_r,"r","radius","pos_r"); 00117 tplist.add<double>(kPar_local_x,"lx","local_x","det_x"); 00118 tplist.add<double>(kPar_local_y,"ly","local_y","det_y"); 00119 tplist.add<double>(kPar_local_z,"lz","local_z","det_z"); 00120 tplist.add<double>(kPar_local_r,"lr","local_r","det_r"); 00121 tplist.add<string>(kPar_LogicalVolumeName,"Volume","LogicalVolumeName","LogicalVolume","VolumeName"); 00122 tplist.add<string>(kPar_MaterialName,"Material","MaterialName"); 00123 tplist.add<string>(kPar_DetectorElementName,"DetectorElementName"); 00124 tplist.add<double>(kPar_DetectorElementMatch,"Match","DetectorElementMatch"); 00125 tplist.add<double>(kPar_NicheId,"NicheId","Niche"); 00126 tplist.add<double>(kPar_DetectorId,"DetectorId"); 00127 tplist.add<double>(kPar_SiteId,"SiteId"); 00128 tplist.add<double>(kPar_Site,"Site"); 00129 tplist.add<double>(kPar_AD,"AD","AdNumber"); 00130 00131 tplist.add<double>(kPar_momentum,"momentum","p"); 00132 tplist.add<double>(kPar_TotEnergy,"E","totEnergy","TotalEnergy"); 00133 tplist.add<double>(kPar_KineticEnergy,"KE","kineticEnergy"); 00134 tplist.add<double>(kPar_vx,"vx","global_dir_x","global_u"); 00135 tplist.add<double>(kPar_vy,"vy","global_dir_y","global_v"); 00136 tplist.add<double>(kPar_vz,"vz","global_dir_z","global_w"); 00137 tplist.add<double>(kPar_local_vx,"lvx","local_dir_x","local_u"); 00138 tplist.add<double>(kPar_local_vy,"lvy","local_dir_y","local_v"); 00139 tplist.add<double>(kPar_local_vz,"lvz","local_dir_z","local_w"); 00140 tplist.add<double>(kPar_ProcessType,"ProcessType"); 00141 tplist.add<string>(kPar_ProcessName,"Process","ProcessName"); 00142 tplist.add<double>(kPar_Pdg,"pdg","pdgcode","particle"); 00143 tplist.add<double>(kPar_Charge,"charge","ParticleCharge","q"); 00144 tplist.add<double>(kPar_TrackId,"id","trackid"); 00145 tplist.add<double>(kPar_CreatorPdg,"creatorPdg","creator"); 00146 tplist.add<double>(kPar_AncestorPdg,"ParentPdg","AncestorPdg","Ancestor"); 00147 tplist.add<double>(kPar_mass,"mass","m"); 00148 tplist.add<string>(kPar_ParticleName,"ParticleName"); 00149 tplist.add<string>(kPar_CreatorProcessName,"CreatorProcessName","CreatorProcess"); 00150 00151 00152 00153 boost::shared_ptr<RuleFactory> prescaleFactory(new PrescaleRuleFactory); 00154 boost::shared_ptr<RuleFactory> customFactory(new DetElemContainsRuleFactory<QueriableStepAction>(this)); 00155 tplist.add<int>(kPar_Prescale,"Prescale","by",prescaleFactory); 00156 tplist.add<const IDetectorElement*>(kPar_DetectorElement,"DetElem","in",customFactory); 00157 tplist.add<const IDetectorElement*>(kPar_DetectorElement,"DetectorElement","in",customFactory); 00158 00159 00160 return StatusCode::SUCCESS; 00161 }
StatusCode QueriableStepAction::GetVertexParameterList | ( | RuleParser::ParameterList & | ) | [virtual, inherited] |
Definition at line 164 of file QueriableStepAction.cc.
00165 { 00167 GetTrackParameterList(vplist); // Everything valid for a track is valid for a vertex. 00168 00169 using namespace RuleParser; 00170 using std::string; 00171 00172 00173 // And add vertex-specific stuff: 00174 vplist.add<double>(kPar_Step_dE,"Step_dE","dE"); 00175 vplist.add<double>(kPar_Step_dE_Ion,"Step_dE_Ion","de_ion","ionization"); 00176 vplist.add<double>(kPar_Step_qdE,"Step_qDE","quenched_dE","qdE"); 00177 vplist.add<double>(kPar_Step_dx,"Step_dx","StepLength","dx"); 00178 vplist.add<double>(kPar_Step_dt,"Step_dt","StepDuration","dt"); 00179 vplist.add<double>(kPar_Step_dAngle,"Step_dAngle","dAngle"); 00180 vplist.add<double>(kPar_capTargetZ,"capTargetZ"); 00181 vplist.add<double>(kPar_capTargetA,"capTargetA"); 00182 vplist.add<double>(kPar_Step_E_weighted_x,"Ex","E_weighted_x"); 00183 vplist.add<double>(kPar_Step_E_weighted_y,"Ey","E_weighted_y"); 00184 vplist.add<double>(kPar_Step_E_weighted_z,"Ez","E_weighted_z"); 00185 vplist.add<double>(kPar_Step_E_weighted_t,"Et","E_weighted_t"); 00186 vplist.add<double>(kPar_Step_qE_weighted_x,"qEx","qE_weighted_x","quenched_weighted_x"); 00187 vplist.add<double>(kPar_Step_qE_weighted_y,"qEy","qE_weighted_y","quenched_weighted_y"); 00188 vplist.add<double>(kPar_Step_qE_weighted_z,"qEz","qE_weighted_z","quenched_weighted_z"); 00189 vplist.add<double>(kPar_Step_qE_weighted_t,"qEt","qE_weighted_t","quenched_weighted_t"); 00190 00191 00192 vplist.add<double>(kPar_IsStopping,"IsStopping","stop","End"); 00193 vplist.add<double>(kPar_IsStarting,"IsStarting","start","begin"); 00194 vplist.add<double>(kPar_StepNumber,"StepNumber"); 00195 vplist.add<double>(kPar_VolumeChanged,"VolumeChanged","NewVolume"); 00196 vplist.add<double>(kPar_MaterialChanged,"MaterialChanged","NewMaterial"); 00197 00198 00199 verbose() << " kPar_MaterialName " << kPar_MaterialName << " kPar_MaterialChanged " << kPar_MaterialChanged 00200 << " kPar_VolumeChanged " << kPar_VolumeChanged << " kPar_Pdg " << kPar_Pdg 00201 << " kPar_LogicalVolumeName " << kPar_LogicalVolumeName 00202 << endreq; 00203 00204 return StatusCode::SUCCESS; 00205 }
void QueriableStepAction::Reset | ( | const G4Step * | , | |
const G4Track * | , | |||
const G4StepPoint * | ||||
) | [inherited] |
To prepare a Step for querying:.
Definition at line 85 of file QueriableStepAction.cc.
00089 { 00090 mCurrentStep = step; 00091 mCurrentTrack = track; 00092 mCurrentStepPoint = point; 00093 00094 mDetElement=0; 00095 mDetElementMatch=-1; 00096 mLogicVolume=0; 00097 mPhysVolume=0; 00098 mProcess=SimProcess(); 00099 mQuenchedEnergy = -1e9; 00100 mUserTrackInfo = 0; 00101 mDetectorId = 0xFFFFFFF; 00102 00103 verbose() << " The current track has been reset " << endreq; 00104 }
void QueriableStepAction::queryParam | ( | int | id, | |
double & | output | |||
) | const [virtual, inherited] |
Reimplemented from RuleParser::Queriable.
Reimplemented in HistorianStepAction.
Definition at line 211 of file QueriableStepAction.cc.
00212 { 00213 00214 switch(id) { 00215 case kPar_IsStopping: 00216 output = ( ( mCurrentTrack->GetTrackStatus() == fStopAndKill) 00217 || ( mCurrentTrack->GetTrackStatus() == fKillTrackAndSecondaries ) ); 00218 break; 00219 00220 case kPar_IsStarting: 00221 output = (mCurrentTrack->GetCurrentStepNumber() == 1); 00222 break; 00223 00224 case kPar_StepNumber: 00225 output = mCurrentTrack->GetCurrentStepNumber(); 00226 break; 00227 00228 case kPar_MaterialChanged: 00229 output = (mCurrentStep->GetPostStepPoint()->GetMaterial() != mCurrentStep->GetPreStepPoint()->GetMaterial()); 00230 break; 00231 00232 case kPar_VolumeChanged: 00233 output = (mCurrentStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary); 00234 break; 00235 00236 case kPar_DetectorElementMatch: 00237 output = getDetectorElementMatch(); 00238 break; 00239 00240 case kPar_ProcessType: 00241 output = getProcess().type(); 00242 break; 00243 00244 case kPar_Pdg: 00245 output = mCurrentTrack->GetDefinition()->GetPDGEncoding(); 00246 break; 00247 00248 case kPar_Charge: 00249 output = mCurrentTrack->GetDefinition()->GetPDGCharge(); 00250 break; 00251 00252 case kPar_TrackId: 00253 output = mCurrentStep->GetTrack()->GetTrackID(); 00254 break; 00255 00256 // wangzhe 00257 // Help me track things. 00258 case kPar_CreatorPdg: { 00259 G4HistoryUserTrackInfo* userinfo = dynamic_cast<G4HistoryUserTrackInfo*> 00260 ( mCurrentStep->GetTrack()->GetUserInformation() ); 00261 if(userinfo) 00262 output = userinfo->parentPdg(); 00263 break; 00264 } 00265 00266 case kPar_AncestorPdg: { 00267 G4HistoryUserTrackInfo* userinfo = dynamic_cast<G4HistoryUserTrackInfo*> 00268 ( mCurrentStep->GetTrack()->GetUserInformation() ); 00269 if(userinfo) 00270 output = userinfo->track().track()->particle(); // This will bring me to ancestor track 00271 break; 00272 } 00273 // wz 00274 00275 case kPar_Step_dE: 00276 output = mCurrentStep->GetTotalEnergyDeposit(); 00277 break; 00278 case kPar_Step_dE_Ion: 00279 output = mCurrentStep->GetTotalEnergyDeposit() - mCurrentStep->GetNonIonizingEnergyDeposit(); 00280 break; 00281 case kPar_Step_qdE: 00282 output = getQuenchedEnergy(); 00283 break; 00284 case kPar_Step_dx: 00285 output = mCurrentStep->GetStepLength(); 00286 break; 00287 case kPar_Step_dt: 00288 output = mCurrentStep->GetDeltaTime(); 00289 break; 00290 case kPar_Step_dAngle: 00291 output = acos(mCurrentStep->GetPostStepPoint()->GetMomentumDirection().dot( 00292 mCurrentStep->GetPreStepPoint()->GetMomentumDirection()) 00293 ) * CLHEP::radian; 00294 break; 00295 case kPar_capTargetZ: 00296 // Return the neutron capture target Z 00297 output = m_capinfo->getCapture().GetCapTargetZ(); 00298 //info()<<"stepAction: Z "<<m_capinfo->getCapture().GetCapTargetZ() 00299 // <<" A: "<<m_capinfo->getCapture().GetCapTargetA() 00300 // <<" time: "<<m_capinfo->getCapture().GetCapTime() 00301 // <<" gammaNum: "<<m_capinfo->getCapture().GetCapGammaN() 00302 // <<endreq; 00303 break; 00304 case kPar_capTargetA: 00305 // Return the neutron capture target A 00306 output = m_capinfo->getCapture().GetCapTargetA(); 00307 //info()<<"stepAction: A"<<m_capinfo->getCapture().GetCapTargetA() 00308 // <<endreq; 00309 break; 00310 // For energy-weighted quantities, use the average position or time of the step rather than 00311 // the final position or time of the step. 00312 case kPar_Step_E_weighted_x: 00313 output = mCurrentStep->GetPreStepPoint()->GetPosition().x(); 00314 if ( mCurrentStep->GetPostStepPoint() ) output = 0.5*(output + mCurrentStep->GetPostStepPoint()->GetPosition().x()); 00315 output = mCurrentStep->GetTotalEnergyDeposit() * output; 00316 break; 00317 case kPar_Step_E_weighted_y: 00318 output = mCurrentStep->GetPreStepPoint()->GetPosition().y(); 00319 if ( mCurrentStep->GetPostStepPoint() ) output = 0.5*(output + mCurrentStep->GetPostStepPoint()->GetPosition().y()); 00320 output = mCurrentStep->GetTotalEnergyDeposit() * output; 00321 break; 00322 case kPar_Step_E_weighted_z: 00323 output = mCurrentStep->GetPreStepPoint()->GetPosition().z(); 00324 if ( mCurrentStep->GetPostStepPoint() ) output = 0.5*(output + mCurrentStep->GetPostStepPoint()->GetPosition().z()); 00325 output = mCurrentStep->GetTotalEnergyDeposit() * output; 00326 break; 00327 case kPar_Step_E_weighted_t: 00328 output = mCurrentStep->GetTotalEnergyDeposit() * mCurrentStepPoint->GetGlobalTime(); 00329 output = mCurrentStep->GetPreStepPoint()->GetGlobalTime(); 00330 if ( mCurrentStep->GetPostStepPoint() ) output = 0.5*(output + mCurrentStep->GetPostStepPoint()->GetGlobalTime()); 00331 output = mCurrentStep->GetTotalEnergyDeposit() * output; 00332 break; 00333 00334 case kPar_Step_qE_weighted_x: 00335 output = mCurrentStep->GetPreStepPoint()->GetPosition().x(); 00336 if ( mCurrentStep->GetPostStepPoint() ) output = 0.5*(output + mCurrentStep->GetPostStepPoint()->GetPosition().x()); 00337 output = getQuenchedEnergy() * output ; 00338 break; 00339 case kPar_Step_qE_weighted_y: 00340 output = mCurrentStep->GetPreStepPoint()->GetPosition().y(); 00341 if ( mCurrentStep->GetPostStepPoint() ) output = 0.5*(output + mCurrentStep->GetPostStepPoint()->GetPosition().y()); 00342 output = getQuenchedEnergy() * output ; 00343 break; 00344 case kPar_Step_qE_weighted_z: 00345 output = mCurrentStep->GetPreStepPoint()->GetPosition().z(); 00346 if ( mCurrentStep->GetPostStepPoint() ) output = 0.5*(output + mCurrentStep->GetPostStepPoint()->GetPosition().z()); 00347 output = getQuenchedEnergy() * output ; 00348 break; 00349 case kPar_Step_qE_weighted_t: 00350 output = mCurrentStep->GetPreStepPoint()->GetGlobalTime(); 00351 if ( mCurrentStep->GetPostStepPoint() ) output = 0.5*(output + mCurrentStep->GetPostStepPoint()->GetGlobalTime()); 00352 output = getQuenchedEnergy() * output ; 00353 break; 00354 00355 case kPar_t: 00356 output = mCurrentStepPoint->GetGlobalTime(); 00357 break; 00358 case kPar_x: 00359 output = mCurrentStepPoint->GetPosition().x(); 00360 break; 00361 case kPar_y: 00362 output = mCurrentStepPoint->GetPosition().y(); 00363 break; 00364 case kPar_z: 00365 output = mCurrentStepPoint->GetPosition().z(); 00366 break; 00367 case kPar_r: 00368 output = sqrt(mCurrentStepPoint->GetPosition().x()*mCurrentStepPoint->GetPosition().x() + 00369 mCurrentStepPoint->GetPosition().y()*mCurrentStepPoint->GetPosition().y()); 00370 break; 00371 00372 case kPar_local_x: 00373 case kPar_local_y: 00374 case kPar_local_z: 00375 case kPar_local_r: 00376 { 00377 const G4AffineTransform transformation = 00378 mCurrentStepPoint->GetTouchable()->GetHistory()->GetTopTransform(); 00379 G4ThreeVector local = transformation.TransformPoint(mCurrentStepPoint->GetPosition()); 00380 00381 switch(id){ 00382 case kPar_local_x: output = local.x(); break; 00383 case kPar_local_y: output = local.y(); break; 00384 case kPar_local_z: output = local.z(); break; 00385 case kPar_local_r: output = sqrt(local.x()*local.x() + local.y()*local.y()); break; 00386 } 00387 } 00388 break; 00389 00390 case kPar_NicheId: 00391 output = getDetectorId(); 00392 break; 00393 00394 case kPar_DetectorId: 00395 output = getDetectorId() & 0xFFFF0000; 00396 break; 00397 case kPar_SiteId: 00398 output = getDetectorId() & 0xFF000000; 00399 break; 00400 case kPar_AD: 00401 output = (getDetectorId() & 0x00FF0000) >> 16; 00402 break; 00403 case kPar_Site: 00404 output = (getDetectorId() & 0xFF000000) >> 24; 00405 break; 00406 00407 case kPar_momentum: 00408 output = mCurrentStepPoint->GetMomentum().mag(); 00409 break; 00410 case kPar_TotEnergy: 00411 output = mCurrentStepPoint->GetTotalEnergy(); 00412 break; 00413 case kPar_KineticEnergy: 00414 output = mCurrentStepPoint->GetKineticEnergy(); 00415 break; 00416 case kPar_mass: 00417 output = mCurrentStep->GetTrack()->GetDynamicParticle()->GetMass(); 00418 break; 00419 case kPar_vx: 00420 output = mCurrentStepPoint->GetMomentumDirection().x(); 00421 break; 00422 case kPar_vy: 00423 output = mCurrentStepPoint->GetMomentumDirection().y(); 00424 break; 00425 case kPar_vz: 00426 output = mCurrentStepPoint->GetMomentumDirection().z(); 00427 break; 00428 00429 case kPar_local_vx: 00430 case kPar_local_vy: 00431 case kPar_local_vz: 00432 { 00433 const G4AffineTransform transformationV = 00434 mCurrentStepPoint->GetTouchable()->GetHistory()->GetTopTransform(); 00435 G4ThreeVector localV = transformationV.TransformAxis(mCurrentStepPoint->GetMomentumDirection()); 00436 00437 switch(id){ 00438 case kPar_local_vx: output = localV.x(); break; 00439 case kPar_local_vy: output = localV.y(); break; 00440 case kPar_local_vz: output = localV.z(); break; 00441 } 00442 } 00443 break; 00444 00445 default: 00446 err() << "Unknown real parameter " << id << endreq; 00447 output = 0; 00448 } 00449 verbose() << " id " << id << " output " << output << endreq; 00450 00451 }
void QueriableStepAction::queryParam | ( | int | id, | |
std::string & | output | |||
) | const [virtual, inherited] |
Reimplemented from RuleParser::Queriable.
Reimplemented in HistorianStepAction.
Definition at line 453 of file QueriableStepAction.cc.
00454 { 00455 const ILVolume* volume = 0; 00456 const IDetectorElement* ide = 0; 00457 00458 switch(id) { 00459 case kPar_CreatorProcessName: 00460 if(mCurrentTrack->GetParentID()==0) // This is a primary. 00461 mProcess = SimProcess(SimProcess::kPrimaryVertex,""); 00462 else if(mCurrentTrack->GetCreatorProcess()) 00463 mProcess = SimProcess(SimProcess::kParticleStart,mCurrentTrack->GetCreatorProcess()->GetProcessName()); 00464 else 00465 mProcess = SimProcess(SimProcess::kParticleStart,""); 00466 output = mProcess.name(); 00467 verbose()<<" id " << id << " creator process name "<<output<<endreq; 00468 return; 00469 00470 case kPar_ProcessName: 00471 switch(mCurrentStep->GetPostStepPoint()->GetStepStatus()) { 00472 case fWorldBoundary: mProcess = SimProcess(SimProcess::kWorldBoundary,""); break; 00473 case fGeomBoundary: mProcess = SimProcess(SimProcess::kGeomBoundary,""); break; 00474 default: 00475 SimProcessFromG4Process(mCurrentStep->GetPostStepPoint()->GetProcessDefinedStep(),mProcess); 00476 } 00477 output = mProcess.name(); 00478 verbose()<<" id " << id << " process name "<<output<<endreq; 00479 return; 00480 00481 case kPar_DetectorElementName: 00482 ide = getDetectorElement(); 00483 if(ide) output = ide->name(); 00484 else output = ""; 00485 verbose() << " id " << id << " detector element output " << output << endreq; 00486 return; 00487 00488 case kPar_LogicalVolumeName: 00489 volume = getLogicalVolume(); 00490 if(volume) output = volume->name(); 00491 else output = ""; 00492 verbose() << " id " << id << " logical volume name output " << output << endreq; 00493 return; 00494 00495 case kPar_MaterialName: 00496 volume = getLogicalVolume(); 00497 if(volume)output = volume->materialName(); 00498 else output =""; 00499 verbose() << " id " << id << " material name output " << output << endreq; 00500 return; 00501 00502 case kPar_ParticleName: 00503 output = mCurrentStep->GetTrack()->GetDefinition()->GetParticleName(); 00504 verbose() << " id " << id << " particle name output " << output << endreq; 00505 return; 00506 00507 default: 00508 err() << "Unknown string parameter " << id << endreq; 00509 output = ""; 00510 } 00511 }
const IDetectorElement * QueriableStepAction::getDetectorElement | ( | ) | const [inherited] |
Definition at line 518 of file QueriableStepAction.cc.
00519 { 00520 if(!mDetElement) { 00521 // wangzhe: 00522 // (GetPhysicalVolume() == 0) at the boundary of the world. 00523 // (MotherLogical pointer == 0) means that current step point is 00524 // in the outmost volume, "Universe". 00525 // Currently no touchable history info is available here, so neglect 00526 // any query in this volume. 00527 if(mCurrentStep->GetPreStepPoint()->GetPhysicalVolume() == 0) { 00528 return 0; 00529 } 00530 if(mCurrentStep->GetPreStepPoint()->GetPhysicalVolume()->GetMotherLogical() == 0) { 00531 return 0; 00532 } 00533 // wz 00534 G4VTouchable* touch = mCurrentStep->GetPreStepPoint()->GetTouchableHandle()(); 00535 G4TouchableHistory* hist = dynamic_cast<G4TouchableHistory*>(touch); 00536 assert(hist); 00537 00538 if (!hist->GetHistoryDepth()) { 00539 err() << "getDetectorElement(): given empty touchable history" << endreq; 00540 return 0; 00541 } 00542 00543 StatusCode sc = mTouchToDetElem->GetBestDetectorElement(hist, 00544 m_DetectorElementSearchPath, 00545 mDetElement, 00546 mDetElementMatch); 00547 if (sc.isFailure()) { 00548 err() << "Failed to get best detector element" << endreq; 00549 return 0; 00550 } 00551 } 00552 return mDetElement; 00553 }
int QueriableStepAction::getDetectorElementMatch | ( | ) | const [inherited] |
Definition at line 555 of file QueriableStepAction.cc.
00556 { 00557 getDetectorElement(); 00558 return mDetElementMatch; 00559 }
const ILVolume * QueriableStepAction::getLogicalVolume | ( | ) | const [inherited] |
Definition at line 561 of file QueriableStepAction.cc.
00562 { 00563 if(!mLogicVolume) { 00564 const IPVolume* pvol = getPhysicalVolume(); 00565 if(pvol) mLogicVolume = pvol->lvolume(); 00566 } 00567 return mLogicVolume; 00568 }
const IPVolume * QueriableStepAction::getPhysicalVolume | ( | ) | const [inherited] |
Definition at line 570 of file QueriableStepAction.cc.
00571 { 00572 if(!mPhysVolume) { 00573 mTouchToDetElem->G4VolumeToDetDesc(mCurrentStep->GetPreStepPoint()->GetPhysicalVolume(), 00574 mPhysVolume 00575 ); 00576 } 00577 return mPhysVolume; 00578 }
const SimProcess & QueriableStepAction::getProcess | ( | ) | const [inherited] |
Definition at line 580 of file QueriableStepAction.cc.
00581 { 00582 if(!mProcess.isValid()){ 00583 if(mCurrentStepPoint == mCurrentStep->GetPreStepPoint()) { 00584 if(mCurrentTrack->GetParentID()==0) // This is a primary. 00585 mProcess = SimProcess(SimProcess::kPrimaryVertex,""); 00586 else if(mCurrentTrack->GetCreatorProcess()) 00587 mProcess = SimProcess(SimProcess::kParticleStart,mCurrentTrack->GetCreatorProcess()->GetProcessName()); 00588 else 00589 mProcess = SimProcess(SimProcess::kParticleStart,""); 00590 } else { 00591 switch(mCurrentStep->GetPostStepPoint()->GetStepStatus()) { 00592 case fWorldBoundary: mProcess = SimProcess(SimProcess::kWorldBoundary,""); break; 00593 case fGeomBoundary: mProcess = SimProcess(SimProcess::kGeomBoundary,""); break; 00594 default: 00595 SimProcessFromG4Process(mCurrentStepPoint->GetProcessDefinedStep(),mProcess); 00596 } 00597 } 00598 } 00599 return mProcess; 00600 }
double QueriableStepAction::getQuenchedEnergy | ( | ) | const [inherited] |
Definition at line 602 of file QueriableStepAction.cc.
00603 { 00604 if(mQuenchedEnergy>=0) return mQuenchedEnergy; 00605 G4Track *aTrack = mCurrentStep->GetTrack(); 00606 G4ParticleDefinition* aParticle = aTrack->GetDefinition(); 00607 G4String particleName = aParticle->GetParticleName(); 00608 //info()<<"particle name "<<particleName<<endreq; 00609 00610 double dE = mCurrentStep->GetTotalEnergyDeposit(); 00611 double dx = mCurrentStep->GetStepLength(); 00612 00613 // Find quenched energy deposit. 00614 mQuenchedEnergy = 0; 00615 if(dE > 0) { 00616 if(aParticle == G4Gamma::Gamma()) // It is a gamma 00617 { 00618 G4LossTableManager* manager = G4LossTableManager::Instance(); 00619 dx = manager->GetRange(G4Electron::Electron(), dE, aTrack->GetMaterialCutsCouple()); 00620 //info()<<"dE_dx = "<<dE/dx/(MeV/mm)<<"MeV/mm"<<endreq; 00621 } 00622 G4Material* aMaterial = mCurrentStep->GetPreStepPoint()->GetMaterial(); 00623 G4MaterialPropertiesTable* aMaterialPropertiesTable = 00624 aMaterial->GetMaterialPropertiesTable(); 00625 if (aMaterialPropertiesTable) { 00626 00627 // There are some properties. Is there a scintillator property? 00628 const G4MaterialPropertyVector* Fast_Intensity = 00629 aMaterialPropertiesTable->GetProperty("FASTCOMPONENT"); 00630 const G4MaterialPropertyVector* Slow_Intensity = 00631 aMaterialPropertiesTable->GetProperty("SLOWCOMPONENT"); 00632 00633 if (Fast_Intensity || Slow_Intensity ) { 00634 // It's a scintillator. 00635 double delta = dE/dx/aMaterial->GetDensity(); 00636 //double birk1 = 0.0125*g/cm2/MeV; 00637 double birk1 = m_BirksConstant1; 00638 if(mCurrentTrack->GetDefinition()->GetPDGCharge()>1.1)//for particle charge greater than 1. 00639 birk1 = 0.57*birk1; 00640 //double birk2 = (0.0031*g/MeV/cm2)*(0.0031*g/MeV/cm2); 00641 double birk2 = m_BirksConstant2; 00642 mQuenchedEnergy= dE /(1+birk1*delta+birk2*delta*delta); 00643 } 00644 } 00645 } 00646 return mQuenchedEnergy; 00647 }
const G4HistoryUserTrackInfo * QueriableStepAction::getUserTrackInfo | ( | ) | const [inherited] |
Definition at line 649 of file QueriableStepAction.cc.
00650 { 00651 if(!mUserTrackInfo) { 00652 mUserTrackInfo = dynamic_cast<G4HistoryUserTrackInfo*>(mCurrentTrack->GetUserInformation()); 00653 } 00654 return mUserTrackInfo; 00655 }
unsigned int QueriableStepAction::getDetectorId | ( | ) | const [inherited] |
Definition at line 657 of file QueriableStepAction.cc.
00658 { 00659 if(mDetectorId==0xFFFFFFF) { 00660 const IDetectorElement* de = getDetectorElement(); 00661 mDetectorId = getDetectorId(de); 00662 } 00663 return mDetectorId; 00664 }
unsigned int QueriableStepAction::getDetectorId | ( | const IDetectorElement * | ) | const [inherited] |
Definition at line 666 of file QueriableStepAction.cc.
00667 { 00668 DetectorIdCache_t::iterator it = mDetectorIdCache.find(de); 00669 if(it!=mDetectorIdCache.end()) { 00670 return it->second; 00671 } 00672 00673 const ParamValidDataObject* params = de->params(); 00674 00675 // Check each type of user param that the user could have provided: 00676 for(unsigned int ip = 0; ip<m_IdParameterNames.size(); ip++) { 00677 if (params->exists(m_IdParameterNames[ip])) { 00678 if (unsigned int id = (unsigned int)(params->param<int>(m_IdParameterNames[ip]))) { 00679 // Got it! 00680 mDetectorIdCache[de] = id; // cache it for next time 00681 //info() << "Found id for " << getDetectorElement()->name() << " --> id " << std::hex << mDetectorId << std::dec << endreq; 00682 return id; 00683 } 00684 } 00685 } 00686 00687 // Ok, we didnt' find it. 00688 // So, move up the support tree recursively. 00689 00690 // --this does't work because geo->detElem() is private 00691 // const IGeometryInfo* igeo = de->geometry(); 00692 // ILVolume::ReplicaPath dummy; 00693 // IGeometryInfo* nextGeo = 0; 00694 // igeo->location(nextGeo, dummy); 00695 // if(nextGeo==0) return 0x0; // We failed to find any kind of ID. 00696 // const GeometryInfoPlus* geoplus = dynamic_cast<GeometryInfoPlus*>(nextGeo); 00697 // assert(geoplus); // What's up with this? 00698 // return getDetectorId(geoplus->detElem()); 00699 00700 // -- this works if the child elements are all set correctly in the XML. 00701 const IDetectorElement* nextElem = de->parentIDetectorElement(); 00702 if(nextElem==0) { 00703 const IDetectorElement* ide = getDetectorElement(); 00704 std::string DeName; 00705 if(ide) DeName = ide->name(); 00706 else DeName = ""; 00707 warning() << "Found no next-element for " << DeName << " --> id " << std::hex << mDetectorId << std::dec << endreq; 00708 mDetectorIdCache[de] = 0; 00709 return 0; 00710 } 00711 unsigned int id = getDetectorId(nextElem); 00712 mDetectorIdCache[de] = id; 00713 return id; 00714 }
std::vector< std::vector<std::string> > UnObserverStepAction::m_Stats [private] |
Definition at line 25 of file UnObserverStepAction.h.
std::vector<StatGroup> UnObserverStepAction::mGroups [private] |
Definition at line 36 of file UnObserverStepAction.h.
IHistoryKeeper* UnObserverStepAction::mKeeper [private] |
Definition at line 39 of file UnObserverStepAction.h.
int UnObserverStepAction::mBail [private] |
Definition at line 46 of file UnObserverStepAction.h.
std::vector<std::string> QueriableStepAction::m_DetectorElementSearchPath [protected, inherited] |
Definition at line 68 of file QueriableStepAction.h.
std::string QueriableStepAction::m_TouchableToDetelem_name [protected, inherited] |
Definition at line 69 of file QueriableStepAction.h.
std::vector<std::string> QueriableStepAction::m_IdParameterNames [protected, inherited] |
Definition at line 70 of file QueriableStepAction.h.
const G4Step* QueriableStepAction::mCurrentStep [protected, inherited] |
Definition at line 73 of file QueriableStepAction.h.
const G4Track* QueriableStepAction::mCurrentTrack [protected, inherited] |
Definition at line 74 of file QueriableStepAction.h.
const G4StepPoint* QueriableStepAction::mCurrentStepPoint [protected, inherited] |
Definition at line 75 of file QueriableStepAction.h.
ITouchableToDetectorElement* QueriableStepAction::mTouchToDetElem [protected, inherited] |
Definition at line 76 of file QueriableStepAction.h.
const IDetectorElement* QueriableStepAction::mDetElement [mutable, protected, inherited] |
Definition at line 80 of file QueriableStepAction.h.
int QueriableStepAction::mDetElementMatch [mutable, protected, inherited] |
Definition at line 81 of file QueriableStepAction.h.
const ILVolume* QueriableStepAction::mLogicVolume [mutable, protected, inherited] |
Definition at line 82 of file QueriableStepAction.h.
const IPVolume* QueriableStepAction::mPhysVolume [mutable, protected, inherited] |
Definition at line 83 of file QueriableStepAction.h.
DayaBay::SimProcess QueriableStepAction::mProcess [mutable, protected, inherited] |
Definition at line 84 of file QueriableStepAction.h.
double QueriableStepAction::mQuenchedEnergy [mutable, protected, inherited] |
Definition at line 85 of file QueriableStepAction.h.
G4HistoryUserTrackInfo* QueriableStepAction::mUserTrackInfo [mutable, protected, inherited] |
Definition at line 86 of file QueriableStepAction.h.
unsigned int QueriableStepAction::mDetectorId [mutable, protected, inherited] |
Definition at line 87 of file QueriableStepAction.h.
DetectorIdCache_t QueriableStepAction::mDetectorIdCache [mutable, protected, inherited] |
Definition at line 89 of file QueriableStepAction.h.