// FTF test: Pbar+P interaction channels // // ******************************************************************** // * 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. * // ******************************************************************** // // // edition 29.08.2014 A.Galoyan // ------------------------------------------------------------------- // GEANT 4 class file --- Copyright CERN 1998 // CERN Geneva Switzerland // // // File name: Test30 // // Author: V.Ivanchenko // // Creation date: 12 March 2002 // // Modifications: // 14.11.03 Renamed to cascade // 09.05.06 Return back to test30 // ------------------------------------------------------------------- #include "globals.hh" #include "G4Version.hh" #include "G4ios.hh" #include #include #include "G4PhysicalConstants.hh" #include "G4SystemOfUnits.hh" #include "FTFtest1.icc" #include "G4ChipsComponentXS.hh" // Uzhi 29.01.13 #include "UZHI_diffraction.hh" #include #include #include #include #include "TROOT.h" #include "TFile.h" #include "TClonesArray.h" #include "TTree.h" #include "TStopwatch.h" #include "TParticle.h" int main(int argc, char** argv) { CLHEP::RanluxEngine defaultEngine( 1234567, 4 ); long seed = 0; if (argc > 2){ seed = atol(argv[2]); } else { seed = 1234567; } defaultEngine.setSeed(seed, 4); CLHEP::HepRandom::setTheEngine( &defaultEngine ); G4cout << "========================================================" << G4endl; G4cout << "====== FTF Test Start ========" << G4endl; G4cout << "========================================================" << G4endl; // ------------------------------------------------------------------- // Control on input if(argc < 2) { G4cout << "Input file is not specified! Exit" << G4endl; exit(1); } std::ifstream* fin = new std::ifstream(); G4String fname = argv[1]; fin->open(fname.c_str()); if( !fin->is_open()) { G4cout << "Input file <" << fname << "> does not exist! Exit" << G4endl; exit(1); } //----------------------------------------------------------------------- #include "FTFtest2.icc" // Initialization //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //G4double sigTot = 0; //[R.K. 01/2017] unused variables //G4double sigEl = 0; //[R.K. 01/2017] unused variables //G4double sigIn = 0; //[R.K. 01/2017] unused variables //int npart; //[R.K. 01/2017] unused variables // Root initialization TFile f1("FTF.root","RECREATE","ROOT_Tree"); Int_t activeCnt=0; TTree* fTree = new TTree("data","FTF Background"); TClonesArray* fEvt; fEvt=new TClonesArray("TParticle",100); fTree->Branch("Npart",&activeCnt,"Npart/I"); fTree->Branch("Particles",&fEvt, 32000,99); TLorentzVector Mom; TLorentzVector V(0,0,0,0); //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // -------- Loop over run G4String line, line1; G4bool end = true; for(G4int run=0; run<100; run++) { //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //-------------------------- Current histograms ------------------------- //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ do { #include "FTFtest3.icc" // -------- Read input file #include "FTFtest4.icc" // -------- Start run processing //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ G4cout << "cross(mb)in= " << cross_sec*1000./barn << G4endl << "cross(mb)el= " << cross_secel*1000./barn<GetTotalElementCrossSection(part,energy,Z,A-Z); chipsEl =CHIPSxsManager->GetElasticElementCrossSection(part,energy,Z,A-Z); chipsIn =CHIPSxsManager->GetInelasticElementCrossSection(part,energy,Z,A-Z); chipsTot/=millibarn; chipsEl/=millibarn; chipsIn/=millibarn; G4cout<<"CHIPS cross sections are used:----------------------"<GetPDGMass(); // Elab Proj // G4double SqrtS=std::sqrt(sqr(part->GetPDGMass())+sqr(938.)+2.*938.*E); // per Proj+N // G4double Ycms=0.5*std::log((E+Plab)/(E-Plab)); // Proj+N // -------- Event loop G4cout<<"Events start "< 0) G4cout<<"Start events loop***********************"<=1 || iter == modu*(iter/modu)) { G4cout << "### " << iter << "-th event start " < 0.0) e0 = G4RandGauss::shoot(energy,sigmae); } while (e0 < 0.0); dParticle.SetKineticEnergy(e0); gTrack->SetStep(step); gTrack->SetKineticEnergy(e0); G4double amass = phys->GetNucleusMass(); // note: check of 4-momentum balance for CHIPS is not guranteed due to // unknown isotope aChange = proc->PostStepDoIt(*gTrack,*step); G4double mass = part->GetPDGMass(); if ( ionParticle ) { e0/=ionA; G4double mass_N=938.*MeV; // Init 4-mom labv = G4LorentzVector(0.0, 0.0, std::sqrt(e0*(e0 + 2.*mass_N)), // NN e0 + mass_N + mass_N); } else { labv = G4LorentzVector(0.0, 0.0, std::sqrt(e0*(e0 + 2.*mass)), // hA e0 + mass + amass); } G4ThreeVector bst = labv.boostVector(); // To CMS NN in AA or hA //------------ G4LorentzVector labNN(0.0, 0.0, std::sqrt(e0*(e0 + 2.*mass)),e0 + mass + amass); G4ThreeVector boostNN = labNN.boostVector(); //------------ // take into account local energy deposit G4double de = aChange->GetLocalEnergyDeposit(); G4LorentzVector dee = G4LorentzVector(0.0, 0.0, 0.0, de); labv -= dee; G4int n = aChange->GetNumberOfSecondaries(); // Multiplicity of prod. part. //npart = n; //[R.K. 01/2017] unused variables fEvt->Clear(); Int_t cnt = 0; if(verbose>=1) G4cout<<" Uzhi ------------ N prod. part "< 0) && (n < 2)) {G4cout<<"Multiplicity of produced < 2!!!"<GetSecondary(i)->GetDynamicParticle(); pd = sec->GetDefinition(); G4String pname=pd->GetParticleName(); if(verbose>=1) G4cout<<" Part "<Get4Momentum()/GeV <Get4Momentum().mag()/GeV<Get4Momentum(); mom = sec->GetMomentum(); // G4double mas = pd->GetPDGMass(); // G4double p = mom.mag(); labv -= fm; // For checking energy-momentum conservation // electron can come only from internal conversion // its mass should be added to initial state if(pd == electron) { labv += G4LorentzVector(0.0,0.0,0.0,electron_mass_c2); } px = mom.x()/GeV; py = mom.y()/GeV; pz = mom.z()/GeV; //pt = std::sqrt(px*px +py*py)/GeV; //[R.K. 01/2017] unused variables e = fm.e()/GeV; // - m; theta = mom.theta(); if(std::abs(pd->GetBaryonNumber()) < 2) { int id = pd->GetPDGEncoding(); // choice of inelastic if( (n>2) || ((abs(id)!=2212)&&(n==2)) ) { Mom.SetPxPyPzE(px,py,pz,e); TParticle fparticle(id,1,0,0,0,0,Mom,V); new((*fEvt)[cnt++]) TParticle(fparticle); // } } theta=theta*180./pi; fm.boost(-bst); // G4double costcm = std::cos(fm.theta()); de += e; // delete sec; delete aChange->GetSecondary(i); } // end of the loop on particles activeCnt = cnt; fTree->Fill(); if(verbose > 0) G4cout << "Energy/Momentum balance= " << labv << G4endl; aChange->Clear(); if(verbose > 0) { G4cout << "End event =====================================" <> Uzhi_i; // Uzhi } // } // End of the event loop ------------------------------------ timer->Stop(); G4cout << " " << *timer << G4endl; delete timer; if(verbose > 0) { G4cout << "###### End of run # " << run << " ######" << G4endl; } //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Uzhi } while(end); } // End of job ---------------------------------------------- //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // delete pFrame; // delete lFrame; // delete sFrame; delete mate; delete fin; delete phys; partTable->DeleteAllParticles(); f1.Write(); G4cout << "###### End of test #####" << G4endl; }