// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // // $Id: test90Ne10CO2pai.cc,v 1.6 2008/12/18 13:01:40 gunter Exp $ // GEANT4 tag $Name: geant4-09-03-cand-01 $ // // // // // // Test routine for G4PAIxSection class code // // History: // // 11.04.08, V. Grichine test of PAI predictions for 90% Ne + 10% CO2 // ALICE TPC gas mixture #include "G4ios.hh" #include #include #include "globals.hh" #include "Randomize.hh" #include "G4Isotope.hh" #include "G4Element.hh" #include "G4Material.hh" #include "G4MaterialTable.hh" #include "G4SandiaTable.hh" // #include "G4PAIonisation.hh" #include "G4PAIxSection.hh" // Peter: // From the AliRoot code in $ALICE_ROOT/TPC/AliTPCv2.cxx: // const Float_t kprim = 14.35; // number of primary collisions per 1 cm // const Float_t kpoti = 20.77e-9; // first ionization potential for Ne/CO2 // const Float_t kwIon = 35.97e-9; // energy for the ion-electron pair creation // // kprim is the number of primary collisions per cm for a MIP! // kpoti = I. // kwIon = W. G4double FitALICE(G4double bg) { // // Bethe-Bloch energy loss formula from ALICE TPC TRD // const G4double kp1 = 0.76176e-1; const G4double kp2 = 10.632; const G4double kp3 = 0.13279e-4; const G4double kp4 = 1.8631; const G4double kp5 = 1.9479; const G4double dn1 = 14.35; G4double dbg = (G4double) bg; G4double beta = dbg/std::sqrt(1.+dbg*dbg); G4double aa = std::pow(beta,kp4); G4double bb = std::pow(1./dbg,kp5); bb = std::log(kp3 + bb); G4double result = ( kp2 - aa - bb)*kp1/aa; result *= dn1; return result; } G4double FitBichsel(G4double bg) { // // Primary ionisation from Hans Bichsel fit // const G4double kp1 = 0.686e-1; const G4double kp2 = 11.714; const G4double kp3 = 0.218e-4; const G4double kp4 = 1.997; const G4double kp5 = 2.133; const G4double dn1 = 13.32; G4double dbg = (G4double) bg; G4double beta = dbg/std::sqrt(1.+dbg*dbg); G4double aa = std::pow(beta,kp4); G4double bb = std::pow(1./dbg,kp5); bb=std::log(kp3 + bb); G4double result = ( kp2 - aa - bb)*kp1/aa; result *= dn1; return result; } //////////////////////////////////////////////////////////// G4double GetIonisation(G4double transfer) { G4double W = 34.75*eV; G4double I1 = 13.62*eV; // first ionisation potential in mixture I1 *= 0.9; G4double result = W; // result /= 1.-I1/transfer; return transfer/result; } ///////////////////////////////////////////////// int main() { std::ofstream outFile("90Ne10CO2pai.dat", std::ios::out ); outFile.setf( std::ios::scientific, std::ios::floatfield ); std::ofstream fileOut("PAICerPlasm90Ne10CO2.dat", std::ios::out ); fileOut.setf( std::ios::scientific, std::ios::floatfield ); // std::ifstream fileRead("exp.dat", std::ios::out ); // fileRead.setf( std::ios::scientific, std::ios::floatfield ); std::ofstream fileWrite("exp.dat", std::ios::out ); fileWrite.setf( std::ios::scientific, std::ios::floatfield ); std::ofstream fileWrite1("mprrpai.dat", std::ios::out ); fileWrite1.setf( std::ios::scientific, std::ios::floatfield ); // Create materials G4int iz , n, nel, ncomponents; G4double a, z, ez, density , temperature, pressure, fractionmass; G4State state; G4String name, symbol; a = 12.01*g/mole; G4Element* elC = new G4Element(name="Carbon",symbol="C", ez=6., a); a = 14.01*g/mole; G4Element* elN = new G4Element(name="Nitrogen", symbol="N", ez=7., a); a = 16.00*g/mole; G4Element* elO = new G4Element(name="Oxygen",symbol="O", ez=8., a); // Neon as detector gas, STP density = 0.900*mg/cm3; a = 20.179*g/mole; G4Material* Ne = new G4Material(name="Ne",z=10., a, density ); // Carbone dioxide, CO2 STP density = 1.977*mg/cm3; G4Material* CarbonDioxide = new G4Material(name="CO2", density, nel=2); CarbonDioxide->AddElement(elC,1); CarbonDioxide->AddElement(elO,2); // 90% Ne + 10% CO2, STP density = 1.0077*mg/cm3; G4Material* Ne10CO2 = new G4Material(name="Ne10CO2" , density, ncomponents=2); Ne10CO2->AddMaterial( Ne, fractionmass = 0.8038 ); Ne10CO2->AddMaterial( CarbonDioxide, fractionmass = 0.1962 ); density *= 273./293.; G4Material* Ne10CO2T293 = new G4Material(name="Ne10CO2T293" , density, ncomponents=2); Ne10CO2T293->AddMaterial( Ne, fractionmass = 0.8038 ); Ne10CO2T293->AddMaterial( CarbonDioxide, fractionmass = 0.1962 ); density = 1.25053*mg/cm3; // STP G4Material* Nitrogen = new G4Material(name="N2" , density, ncomponents=1); Nitrogen->AddElement(elN, 2); // 85.7% Ne + 9.5% CO2 +4.8% N2, STP density = 1.0191*mg/cm3; G4Material* Ne857CO295N2 = new G4Material(name="Ne857CO295N2" , density, ncomponents=3); Ne857CO295N2->AddMaterial( Ne, fractionmass = 0.7568 ); Ne857CO295N2->AddMaterial( CarbonDioxide, fractionmass = 0.1843 ); Ne857CO295N2->AddMaterial( Nitrogen, fractionmass = 0.0589 ); density *= 273./292.; density *= 0.966/1.01325; G4cout<<"density of Ne857CO295N2T292 = "<AddMaterial( Ne, fractionmass = 0.76065 ); Ne857CO295N2T292->AddMaterial( CarbonDioxide, fractionmass = 0.18140 ); Ne857CO295N2T292->AddMaterial( Nitrogen, fractionmass = 0.05795 ); G4int i, j, jMax, k, numOfMaterials, iSan, nbOfElements, sanIndex, row; G4double maxEnergyTransfer, kineticEnergy; G4double tau, gamma, bg2, bg, beta2, rateMass, Tmax, Tmin, Tkin; const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable(); numOfMaterials = theMaterialTable->size(); G4cout<<"Available materials under test : "<< G4endl<GetName() << G4endl; // outFile <GetName() << G4endl; } // G4String testName = "N2"; G4String testName = "Ne10CO2"; // G4String testName = "Ne10CO2T293"; // G4String testName = "Ne857CO295N2T292"; // G4cout<<"Enter material name for test : "<>testName; for( k = 0; k < numOfMaterials; k++ ) { if((*theMaterialTable)[k]->GetName() != testName) continue; // outFile << "Material : " <<(*theMaterialTable)[k]->GetName() << G4endl; G4cout << "Material : " <<(*theMaterialTable)[k]->GetName() << G4endl; nbOfElements = (*theMaterialTable)[k]->GetNumberOfElements(); G4cout<<"Sandia cof according old PAI stuff"< GetElement(iSan)->GetZ(); } G4SandiaTable sandia(k); sanIndex = sandia.SandiaIntervals(thisMaterialZ,nbOfElements); sanIndex = sandia.SandiaMixing( thisMaterialZ , (*theMaterialTable)[k]->GetFractionVector(), nbOfElements,sanIndex); for(row = 0; row < sanIndex-1; row++ ) { G4cout<GetDensity(); // outFile<<" "<GetDensity(); } G4cout<, 1/cm"<<"\t" << ", 1/cm"<<"\t" << ", 1/cm"<<"\t" // << ""<<"\t" <<", 1/cm"<, 1/cm"<<"\t" << ", 1/cm"<<"\t" <<""<<"\t" <<", 1/cm"<0) r2cer /= nCer; if(nRes >0) r2res /= nRes; if(nRuth >0) r2ruth /= nRuth; r2tot /= nTot; rSum /= nTot; G4cout<<"nCer = "<>confirm; if(confirm != "y" ) return 1; G4cout<GetName() << G4endl; } G4cout<<"Enter material name for dE/dx-distribution : "<>testName; G4cout<>nGamma; G4cout<GetName() != testName) continue; G4cout << "Material : " <<(*theMaterialTable)[k]->GetName() << G4endl<>gamma; G4cout<>step; G4cout<>Ebin; G4cout<>iStatMax; G4cout< Tmax) maxEnergyTransfer = Tmax; G4PAIxSection testPAIenergyLoss(k,maxEnergyTransfer,bg2); for( iLoss = 0; iLoss < 50; iLoss++ ) { energyLoss[iLoss] = Ebin*iLoss; spectrum[iLoss] = 0; } for(iStat=0;iStat>confirm; if(confirm != "y" ) break; G4cout<>numberOfExpPoints; G4cout<>deltaBin; G4cout<>delExp[i]>>distr[i]; delExp[i] *= keV; G4cout<>confirm; if(confirm != "y" ) return 1; G4cout<GetName() << G4endl; } G4cout<<"Enter material name for dE/dx-distribution : "<>testName; G4cout<GetName() != testName) continue; G4cout << "Material : " <<(*theMaterialTable)[k]->GetName() << G4endl<>nGamma; G4cout<>step; G4cout<>Ebin; G4cout<>tmRatio; G4cout<>iStatMax; G4cout< Tmax) maxEnergyTransfer = Tmax; G4PAIxSection testPAIenergyLoss(k,maxEnergyTransfer,bg2); for( iLoss = 0; iLoss < 50; iLoss++ ) { energyLoss[iLoss] = Ebin*iLoss; spectrum[iLoss] = 0; } for(iStat=0;iStat tmRatio*iStatMax ) break; } if(iLoss == 50) iLoss--; iMPLoss = iLoss; G4double meanLoss = 0.0; maxSpectrum = 0; for(iLoss=0;iLoss maxSpectrum ) { maxSpectrum = spectrum[iLoss] ; mpLoss = energyLoss[iLoss]; iMax = iLoss; } } mpSum = 0.; mpStat = 0; for(iLoss = iMax-5;iLoss<=iMax+5;iLoss++) { mpSum += energyLoss[iLoss]*spectrum[iLoss]; mpStat += spectrum[iLoss]; } mpLoss = mpSum/mpStat; mpLoss /= keV; meanLoss /= keV*sumStat; meanDelta[kGamma] = meanLoss; mpDelta[kGamma] = mpLoss; if(kGamma > 0) { rrMP[kGamma] = mpLoss/mpDelta[0]; G4cout<