#include <musrDecay.hh>
Protected Member Functions | |
| virtual G4VParticleChange * | DecayIt (const G4Track &aTrack, const G4Step &aStep) |
Protected Attributes | |
| G4ParticleChangeForDecay | pParticleChangeForDecay |
| G4double | m_RemainderLifeTime |
Definition at line 15 of file musrDecay.hh.
|
||||||||||||
|
Definition at line 15 of file musrDecay.cc. 00016 { 00017 00018 00019 00020 00021 // G4cerr<<"METHOD CALLED WHEN SHOULD NOT BE AT ALL!!!!\n";//enable for geant code 00022 // The DecayIt() method returns by pointer a particle-change object. 00023 // Units are expressed in GEANT4 internal units. 00024 // get particle 00025 const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle(); 00026 G4ParticleDefinition* aParticleDef = aParticle->GetDefinition(); 00027 00028 00029 // if particle is not a muon 00030 if(aParticle->GetDefinition()->GetParticleName()!="mu+") 00031 { 00032 G4ParticleChangeForDecay* k; 00033 k = (G4ParticleChangeForDecay*)G4Decay::DecayIt(aTrack,aStep); 00034 return k ; 00035 } 00036 // m_ExtDecayer = 0;//G4Decay::GetExtDecayer(); 00038 00039 G4double p_time = aTrack.GetDynamicParticle()->GetPreAssignedDecayProperTime(); 00040 G4double tp_time = aTrack.GetProperTime(); 00041 m_RemainderLifeTime =p_time-tp_time; 00042 00043 // check if the particle is stable 00044 if (aParticleDef->GetPDGStable()) return &pParticleChangeForDecay ; 00045 00046 00047 //check if thePreAssignedDecayProducts exists 00048 const G4DecayProducts* o_products = (aParticle->GetPreAssignedDecayProducts()); 00049 G4bool isPreAssigned = (o_products != 0); 00050 G4DecayProducts* products = 0; 00051 00052 // decay table 00053 G4DecayTable *decaytable = aParticleDef->GetDecayTable(); 00054 00055 // check if external decayer exists 00056 G4bool isExtDecayer = (decaytable == 0); 00057 00058 // Error due to NO Decay Table 00059 if ( (decaytable == 0) && !isExtDecayer &&!isPreAssigned ){ 00060 #ifdef G4VERBOSE 00061 if (GetVerboseLevel()>0) { 00062 G4cerr << "G4Decay::DoIt : decay table not defined for "; 00063 G4cerr << aParticle->GetDefinition()->GetParticleName()<< G4endl; 00064 } 00065 #endif 00066 pParticleChangeForDecay.SetNumberOfSecondaries(0); 00067 // Kill the parent particle 00068 pParticleChangeForDecay.ProposeTrackStatus( fStopAndKill ) ; 00069 pParticleChangeForDecay.ProposeLocalEnergyDeposit(0.0); 00070 00071 ClearNumberOfInteractionLengthLeft(); 00072 return &pParticleChangeForDecay ; 00073 } 00074 00075 if (isPreAssigned) { 00076 // copy decay products 00077 products = new G4DecayProducts(*o_products); 00078 } else { 00079 00080 00081 //+++++++++++++++++++++++++++++++++++ACCORDING TO DECAY TABLE++++++++++++++++++++++++++ 00082 // decay acoording to decay table 00083 // choose a decay channel 00084 G4VDecayChannel *decaychannel = decaytable->SelectADecayChannel(); 00085 if (decaychannel == 0 ){ 00086 // decay channel not found 00087 G4Exception("G4Decay::DoIt : can not determine decay channel "); 00088 } else { 00089 G4int temp = decaychannel->GetVerboseLevel(); 00090 // execute DecayIt() 00091 #ifdef G4VERBOSE 00092 if (GetVerboseLevel()>1) { 00093 G4cerr << "G4Decay::DoIt : selected decay channel addr:" << decaychannel <<G4endl; 00094 decaychannel->SetVerboseLevel(GetVerboseLevel()); 00095 } 00096 #endif 00097 00098 // CHECK FOR POLARIASATION AND ASSIGN IT TO THE DECAY METHOD 00099 00100 G4ThreeVector parent_polarization = aParticle->GetPolarization(); 00101 00102 //-----------------------------INFORMATION--------------------------------- 00103 // G4cout <<"LEMuSRDecay MESSAGE:: polarization is " << parent_polarization <<" .\n"; 00104 if(aParticle->GetDefinition()->GetParticleName()=="mu+") 00105 { 00106 musrMuonDecayChannel *muondecaychannel =new musrMuonDecayChannel("mu+",1.00); 00107 if(parent_polarization == G4ThreeVector(0,0,0)) 00108 { 00109 products = muondecaychannel->DecayIt(aParticle->GetMass()); 00110 } 00111 if(parent_polarization != G4ThreeVector(0,0,0)) 00112 { 00113 products = muondecaychannel->DecayItPolarized(aParticle->GetMass(),parent_polarization);// has to be included in G4VDecayChannel. 00114 } 00115 } 00116 00117 else products = decaychannel->DecayIt(aParticle->GetMass()) ; 00118 00119 00120 00121 #ifdef G4VERBOSE 00122 if (GetVerboseLevel()>1) { 00123 decaychannel->SetVerboseLevel(temp); 00124 } 00125 #endif 00126 #ifdef G4VERBOSE 00127 // for debug 00128 //if (! products->IsChecked() ) products->DumpInfo(); 00129 #endif 00130 } 00131 } 00132 00133 // get parent particle information ................................... 00134 G4double ParentEnergy = aParticle->GetTotalEnergy(); 00135 G4ThreeVector ParentDirection(aParticle->GetMomentumDirection()); 00136 00137 //boost all decay products to laboratory frame 00138 G4double energyDeposit = 0.0; 00139 G4double finalGlobalTime = aTrack.GetGlobalTime(); 00140 if (aTrack.GetTrackStatus() == fStopButAlive ){ 00141 // AtRest case 00142 finalGlobalTime += m_RemainderLifeTime; 00143 energyDeposit += aParticle->GetKineticEnergy(); 00144 if (isPreAssigned) products->Boost( ParentEnergy, ParentDirection); 00145 } else { 00146 // PostStep case 00147 if (!isExtDecayer) products->Boost( ParentEnergy, ParentDirection); 00148 } 00149 //add products in pParticleChangeForDecay 00150 G4int numberOfSecondaries = products->entries(); 00151 00152 pParticleChangeForDecay.SetNumberOfSecondaries(numberOfSecondaries); 00153 00154 // G4cerr << "G4Decay::DoIt : Decay vertex :"; 00155 // G4cerr << " Time: " << finalGlobalTime/ns << "[ns]"; 00156 // G4cerr << " X:" << (aTrack.GetPosition()).x() /cm << "[cm]"; 00157 // G4cerr << " Y:" << (aTrack.GetPosition()).y() /cm << "[cm]"; 00158 // G4cerr << " Z:" << (aTrack.GetPosition()).z() /cm << "[cm]"; 00159 // G4cerr << G4endl; 00160 // products->DumpInfo(); 00161 00162 G4int index; 00163 G4ThreeVector currentPosition; 00164 const G4TouchableHandle thand = aTrack.GetTouchableHandle(); 00165 00166 for (index=0; index < numberOfSecondaries; index++) 00167 { 00168 // get current position of the track 00169 currentPosition = aTrack.GetPosition(); 00170 // create a new track object 00171 G4Track* secondary = new G4Track( products->PopProducts(), 00172 finalGlobalTime , 00173 currentPosition ); 00174 // switch on good for tracking flag 00175 secondary->SetGoodForTrackingFlag(); 00176 secondary->SetTouchableHandle(thand); 00177 // add the secondary track in the List 00178 pParticleChangeForDecay.AddSecondary(secondary); 00179 } 00180 delete products; 00181 00182 // Kill the parent particle 00183 pParticleChangeForDecay.ProposeTrackStatus( fStopAndKill ) ; 00184 pParticleChangeForDecay.ProposeLocalEnergyDeposit(energyDeposit); 00185 pParticleChangeForDecay.ProposeGlobalTime( finalGlobalTime ); 00186 // reset NumberOfInteractionLengthLeft 00187 ClearNumberOfInteractionLengthLeft(); 00188 00189 return &pParticleChangeForDecay ; 00190 00191 }
|
|
|
Definition at line 27 of file musrDecay.hh. |
|
|
Definition at line 25 of file musrDecay.hh. |
1.4.6