double ECHARM_simulation_integration_averaged::GetElectricalCharactericticPlanarAveragedOverOnePeriod(unsigned int vType) { ECHARM_threevector *vPositionStart = new ECHARM_threevector(); ECHARM_threevector *vMomentumStart = new ECHARM_threevector(); vPositionStart->CopyFrom(GetParticle()->GetPositionVector()); vMomentumStart->CopyFrom(GetParticle()->GetMomentumVector()); double vDensity = 0.0; do { UpdateStepLengthPlanar(); DoIntegrationStepPlanarVelocityVerlet(); vDensity += GetStrip()->GetCrystal()->GetPlanarElectricCharacteristic(GetParticle()->GetPositionVector()->GetX(),vType) * GetStepLength(); } while ( GetParticle()->GetPositionVector()->GetZ() < GetStrip()->GetDimension()->GetZ()); GetParticle()->GetPositionVector()->CopyFrom(vPositionStart); GetParticle()->GetMomentumVector()->CopyFrom(vMomentumStart); return vDensity; }
void ECHARM_simulation_integration_averaged::PreInitializeEnergyToDechannel() { double vTempEnergy; double vX; fPlanarEnergyToDechannel.clear(); double vPotentialBarrier = GetStrip()->GetCrystal()->GetPlanarElectricCharacteristic(0.0,0); #ifdef ROOT_ std::string vHistoName = "hEnergyToDechannel_prf" + GetStrip()->GetRadiusValueAsStringText() + "_" + GetStrip()->GetLengthValueAsStringText(); TH1F *hEnergyToDechannel = new TH1F( vHistoName.c_str(),"hEnergyToDechannel;Interplanar Distance [#AA]",GetIntegrationStepNumberPlanar(),0.,GetStrip()->GetCrystal()->GetDirectPeriodPlanar() ); #endif for(unsigned int i = 0; i < GetIntegrationStepNumberPlanar(); i++) { vX = double(i) / double(GetIntegrationStepNumberPlanar()) * GetStrip()->GetCrystal()->GetDirectPeriodPlanar(); vTempEnergy = GetStrip()->GetCrystal()->GetPlanarElectricCharacteristic( vX , 0); //std::cout << vTempEnergy << " "; if( StripIsBentX() ) vTempEnergy += ( GetParticle()->GetMomentumVector()->GetZ() * GetParticle()->GetBeta() * vX / GetStrip()->GetCurvatureRadius()->GetX() ); //std::cout << GetParticle()->GetMomentumVector()->GetZ() << " " << GetParticle()->GetBeta() << " " << GetStrip()->GetCurvatureRadius()->GetX() << " " << vX << " "; vTempEnergy -= vPotentialBarrier; vTempEnergy += ( GetParticle()->GetBeta() * fSquare(GetParticle()->GetMomentumVector()->GetX()) / GetParticle()->GetMomentumVector()->GetZ()); //std::cout << vTempEnergy << " "; if(vTempEnergy > 0.0) vTempEnergy = -0.; vTempEnergy *= (-1.); fPlanarEnergyToDechannel.push_back(vTempEnergy); //std::cout << vTempEnergy << std::endl; // DA TOGLIERE #ifdef ROOT_ hEnergyToDechannel->SetBinContent(i+1,vTempEnergy); #endif } }
bool ArmatureStrip::HasQuaternion(const std::string & name){ AnimationStrip * strip = GetStrip(name); return strip!= NULL && strip->HasQuaternion(); }
Math::Quat ArmatureStrip::GetQuaternion(const std::string & name, float t){ AnimationStrip * strip = GetStrip(name); if(strip!=NULL) return strip->GetQuaternion(t); return Math::Quat(); }
Math::Vec3 ArmatureStrip::GetEuler(const std::string & name, float t){ AnimationStrip * strip = GetStrip(name); if(strip!=NULL) return strip->GetEuler(t); return Math::Vec3(); }
void ECHARM_simulation_integration_averaged::PreInitializePlanarDensityOverOnePeriod() { fPlanarAtomicDensity.clear(); fPlanarElectronDensity.clear(); fPlanarOscillationPeriod.clear(); ECHARM_threevector *vPositionStart = new ECHARM_threevector(); ECHARM_threevector *vMomentumStart = new ECHARM_threevector(); vPositionStart->CopyFrom(GetParticle()->GetPositionVector()); vMomentumStart->CopyFrom(GetParticle()->GetMomentumVector()); #ifdef ROOT_ std::string vHistoNameELD = "hELD_prf" + GetStrip()->GetRadiusValueAsStringText() + "_" + GetStrip()->GetLengthValueAsStringText(); std::string vHistoNameATD = "hATD_prf" + GetStrip()->GetRadiusValueAsStringText() + "_" + GetStrip()->GetLengthValueAsStringText(); TH1F *hELD = new TH1F(vHistoNameELD.c_str(),"hVector;Interplanar Distance [#AA]",GetIntegrationStepNumberPlanar(),0.,GetStrip()->GetCrystal()->GetDirectPeriodPlanar()/AA); TH1F *hATD = new TH1F(vHistoNameATD.c_str(),"hVector;Interplanar Distance [#AA]",GetIntegrationStepNumberPlanar(),0.,GetStrip()->GetCrystal()->GetDirectPeriodPlanar()/AA); #endif double vAtomicDensity; double vElectronDensity; for(unsigned int i = 0; i < GetIntegrationStepNumberPlanar(); i++) { vAtomicDensity = 0.0; vElectronDensity = 0.0; GetParticle()->GetPositionVector()->Set( double(i) / double(GetIntegrationStepNumberPlanar()) * GetStrip()->GetCrystal()->GetDirectPeriodPlanar() ,0.,0.); GetParticle()->GetMomentumVector()->SetX(0.0); double vEndX = GetParticle()->GetPositionVector()->GetX(); bool bExitLoop = false; if(fPlanarEnergyToDechannel.at(i)>0.) { UpdateStepLengthPlanarMin(); do { DoIntegrationStepPlanarVelocityVerlet(); vAtomicDensity += GetStrip()->GetCrystal()->GetPlanarElectricCharacteristic(GetParticle()->GetPositionVector()->GetX(),1) * GetStepLength(); vElectronDensity += GetStrip()->GetCrystal()->GetPlanarElectricCharacteristic(GetParticle()->GetPositionVector()->GetX(),2) * GetStepLength(); if(fabs( GetParticle()->GetPositionVector()->GetX() - vEndX ) < GetTransverseVariationMin() * 0.5 ) bExitLoop = true; if(GetParticle()->GetPositionVector()->GetZ() > 2. * EvaluateOscillationPeriod() ) bExitLoop = true; if(GetParticle()->GetPositionVector()->GetZ() < 0.5 * EvaluateOscillationPeriod() ) bExitLoop = false; if(GetParticle()->GetPositionVector()->GetZ() > 1. * GetStrip()->GetDimension()->GetZ() ) bExitLoop = true; } while(!bExitLoop); vAtomicDensity /= GetParticle()->GetPositionVector()->GetZ(); vElectronDensity /= GetParticle()->GetPositionVector()->GetZ(); if(vAtomicDensity<0.0) vAtomicDensity = 0.0; if(vElectronDensity<0.0) vElectronDensity = 0.0; } else { vAtomicDensity = -1.; vElectronDensity = -1.; } fPlanarOscillationPeriod.push_back(GetParticle()->GetPositionVector()->GetZ()); fPlanarAtomicDensity.push_back(vAtomicDensity); fPlanarElectronDensity.push_back(vElectronDensity); #ifdef ROOT_ hELD->SetBinContent(i+1,fPlanarElectronDensity.at(i)); hATD->SetBinContent(i+1,fPlanarAtomicDensity.at(i)); #endif } GetParticle()->GetPositionVector()->CopyFrom(vPositionStart); GetParticle()->GetMomentumVector()->CopyFrom(vMomentumStart); }
double ECHARM_simulation_integration_averaged::GetAveragedDechannelingProbability() { double vDechannelingEnergy = 0.0; double vValueATD = 0.; double vValueELD = 0.; double vDechProb = 0.0; #ifdef ROOT_ std::string vHistoName = "hDechProb_prf" + GetStrip()->GetRadiusValueAsStringText() + "_" + GetStrip()->GetLengthValueAsStringText(); std::string vHistoNameATD = "hDechProbATD_prf" + GetStrip()->GetRadiusValueAsStringText() + "_" + GetStrip()->GetLengthValueAsStringText(); std::string vHistoNameELD = "hDechProbELD_prf" + GetStrip()->GetRadiusValueAsStringText() + "_" + GetStrip()->GetLengthValueAsStringText(); TH1F *hDechProb = new TH1F( vHistoName.c_str(),"hDechProb;Interplanar Distance [#AA]",GetIntegrationStepNumberPlanar(),0.,GetStrip()->GetCrystal()->GetDirectPeriodPlanar()/AA); TH1F *hDechProbATD = new TH1F( vHistoNameATD.c_str(),"hDechProb;Interplanar Distance [#AA]",GetIntegrationStepNumberPlanar(),0.,GetStrip()->GetCrystal()->GetDirectPeriodPlanar()/AA); TH1F *hDechProbELD = new TH1F( vHistoNameELD.c_str(),"hDechProb;Interplanar Distance [#AA]",GetIntegrationStepNumberPlanar(),0.,GetStrip()->GetCrystal()->GetDirectPeriodPlanar()/AA); #endif std::vector<double> vVectEff; vVectEff.clear(); for(unsigned int i = 0; i < GetIntegrationStepNumberPlanar(); i++) { if(fPlanarEnergyToDechannel.at(i)==0.){ vValueELD = 1.; vValueATD = 1.; } else{ if(fPlanarElectronDensity.at(i)!=0.0){ fMultipleScattering->SetCrossedMaterialLength( fPlanarElectronDensity.at(i) * GetStrip()->GetDimension()->GetZ() ); fMultipleScattering->UpdateElectronScatteringOutgoingDistribution(); vValueELD = (erfc(vDechannelingEnergy/(fSquareRoot(2.)*(fMultipleScattering->GetElectronScatteringOutgoingDistribution()->GetDistributionParameters().at(1))))); } if(fPlanarEnergyToDechannel.at(i)!=0.){ fMultipleScattering->SetCrossedMaterialLength( fPlanarAtomicDensity.at(i) * GetStrip()->GetDimension()->GetZ() ); fMultipleScattering->UpdateNuclearScatteringOutgoingDistribution(); vValueATD = (erfc(vDechannelingEnergy/(fSquareRoot(2.)*(fMultipleScattering->GetNuclearScatteringOutgoingDistribution()->GetDistributionParameters().at(1))))); } vDechannelingEnergy = fSquareRoot(2. * fPlanarEnergyToDechannel.at(i) * GetParticle()->GetMomentumVector()->GetZ() ); } vVectEff.push_back(fSquareRoot(fSquare(vValueATD)+fSquare(vValueELD)) / fSquareRoot(2.)); vDechProb += vVectEff.at(i); #ifdef ROOT_ hDechProbATD->SetBinContent(i+1,vValueATD); hDechProbELD->SetBinContent(i+1,vValueELD); hDechProb->SetBinContent(i+1,vVectEff.at(i)); #endif } // unsigned int vNumberOfResample = 3; // unsigned int iTot = GetIntegrationStepNumberPlanar() * vNumberOfResample; // // double vValue = 0.; // double x = 0.; // // for(unsigned int j = 0;j < iTot - 2 ;j++) // { // x = GetStrip()->GetDirectPeriodPlanar() / iTot * j; // vValue = fInterpolationFunction->FindInterpolate1D(vVectEff.at(j),vVectEff.at(j+1),vVectEff.at(j+2),vVectEff.at(j+3),x); // vDechProb += vValue; // } // // x = GetStrip()->GetDirectPeriodPlanar() / iTot * (iTot - 2); // vDechProb += fInterpolationFunction->FindInterpolate1D(vVectEff.at(iTot - 2),vVectEff.at(iTot - 1),vVectEff.at(iTot),vVectEff.at(0),x) // // x = GetStrip()->GetDirectPeriodPlanar() / iTot * (iTot - 1); // vDechProb += fInterpolationFunction->FindInterpolate1D(vVectEff.at(iTot - 1),vVectEff.at(iTot),vVectEff.at(0),vVectEff.at(1),x) vDechProb /= GetIntegrationStepNumberPlanar(); vDechProb -= 1.; vDechProb *= (-1); //std::cout << "ECHARM_simulation_integration_averaged: Efficiency = " << vDechProb*100 << " [%]" << std::endl; return vDechProb; }