A FLUKA simulation that records the energy deposited in a single layer of polysterene from an ion beam. HTCondor submission scripts are included.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

144 lines
5.0 KiB

#define eventdatroot_cxx
#include "eventdatroot.h"
#include <TH2.h>
#include <TStyle.h>
#include <TCanvas.h>
#include <TH1.h>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdlib>
#include <cmath>
#include <string.h>
#include <TLorentzVector.h>
#include <vector>
#include <TApplication.h>
//#include <TROOT.h>
#include <TF1.h>
#include <TAxis.h>
#include <stdio.h>
#include <stdlib.h>
#include <TFile.h>
#include <TTree.h>
using namespace std;
void eventdatroot::Loop(Float_t scale)
{
// In a ROOT session, you can do:
// root> .L eventdatroot.C
// root> eventdatroot t
// root> t.GetEntry(12); // Fill t data members with entry number 12
// root> t.Show(); // Show values of entry 12
// root> t.Show(16); // Read and show values of entry 16
// root> t.Loop(); // Loop on all entries
//
// This is the loop skeleton where:
// jentry is the global entry number in the chain
// ientry is the entry number in the current Tree
// Note that the argument to GetEntry must be:
// jentry for TChain::GetEntry
// ientry for TTree::GetEntry and TBranch::GetEntry
//
// To read only selected branches, Insert statements like:
// METHOD1:
// fChain->SetBranchStatus("*",0); // disable all branches
// fChain->SetBranchStatus("branchname",1); // activate branchname
// METHOD2: replace line
// fChain->GetEntry(jentry); //read all branches
//by b_branchname->GetEntry(ientry); //read only this branch
Float_t ratio_electron, ratio_primary, etotal, spratio;
// TF1 * f_sp_ps = new TF1("f_sp_ps","[0]*pow(x,[1])+[2]", 50, 250); //stopping power of protons in polystyrene [MeV cm2 /g]
// f_sp_ps->SetParameters(361.936, -0.892255, 1.19133); //protons between 50 and 220 MeV
// TF1 * f_c12sp_ps = new TF1("f_c12sp_ps","[0]*pow(x,[1])+[2]", 80, 480); //stopping power of carbon in polystyrene [MeV cm2 /g]
// f_c12sp_ps->SetParameters(14538.9, -0.922423,49.2859); //carbon between 80 and 480 MeV
TF1 * f_h2sp_ps = new TF1("f_h2sp_ps","[0]*pow(x,[1])+[2]", 50, 250); //stopping power of helium in polystyrene [MeV cm2 /g]
f_h2sp_ps->SetParameters(1387.08, -0.882686,4.60833); //heelium between 50 and 300 MeV
if (fChain == 0) return;
Long64_t nentries = fChain->GetEntriesFast();
Long64_t nbytes = 0, nb = 0;
for (Long64_t jentry=0; jentry<nentries;jentry++) {
Long64_t ientry = LoadTree(jentry);
if (ientry < 0) break;
nb = fChain->GetEntry(jentry); nbytes += nb;
// if (Cut(ientry) < 0) continue;
// cout << jentry << endl;
h_endist_0->Fill(ENDIST[0]); // edep by ionisation
h_endist_1->Fill(ENDIST[1]); // edep by pi0, e-, e+ and #gamma
h_endist_2->Fill(ENDIST[2]); // edep by nuclear recoils and heavy fragments
h_endist_3->Fill(ENDIST[3]); // edep by part. #lt threshold
h_endist_4->Fill(ENDIST[4]); // E leaving the syste
h_endist_5->Fill(ENDIST[5]); // E carried by discarded particles
h_endist_6->Fill(ENDIST[6]); // resid, excit. E after evap.
h_endist_7->Fill(ENDIST[7]); // edep by low-energy neutrons
h_endist_8->Fill(ENDIST[8]); // E of part. #gt time limit
h_endist_9->Fill(ENDIST[9]); // E lost in endothermic nuclear reactions
h_endist_10->Fill(ENDIST[10]); // E lost in endothermic low-E n-reaction
h_endist_11->Fill(ENDIST[11]); // missing E
etotal = 0.;
for (unsigned int i = 0; i<3; i++ ){
etotal += ENDIST[i];
}
ratio_electron = ENDIST[1] / etotal;
ratio_primary = ENDIST[0] / etotal;
h_ratio_e->Fill(ratio_electron);
h_ratio_p->Fill(ratio_primary);
h_sum_ep->Fill(ENDIST[1]+ENDIST[0]);
h_let_ep->Fill( (ENDIST[1]+ENDIST[0])/scale/4. ); //GeV/cm/Z^2
h_let_e->Fill( (ENDIST[1])/scale/4. );
h_let_p->Fill( (ENDIST[0])/scale/4. );
spratio = ( ( (ENDIST[0]+ENDIST[1])/scale*1000./1.06) / f_h2sp_ps->Eval( (DATA_ENERGY[0]+ENDIST[4])*1000./4. ) ); //ratio of deposited energy to MSTAR stopping power (MeV/cm/density) / MeVcm2/g
h_spratio->Fill(spratio);
// cout << ( (ENDIST[0]+ENDIST[1])/scale*1000/1.06) << " " << f_sp_ps->Eval( (DATA_ENERGY[0]+ENDIST[4])*1000 ) << " " << spratio << endl;
}
}
int main(int argc, const char* argv[])
{
Int_t thickkey = atoi(argv[2]);
// Float_t THICKNESS[6] = {0.025, 0.050, 0.075, 0.100, 0.0125, 0.150, 0.2500, 0.500}; //#cm
// Float_t THICKNESS[6] = {0.025, 0.050, 0.100, 0.150, 0.500, 0.125 }; //#cm
Float_t THICKNESS[7] = {0.025, 0.050, 0.100, 0.150, 0.500, 1.000, 0.035};// #cm
// Float_t THICKNESS[5] = {0.050, 0.100, 0.150, 1.000, 10.00}; //#cm
///open the input and output root files
char finname[50];
sprintf(finname, "%s.root",argv[1]);
TFile * f = new TFile(finname,"OPEN");
char foutname[50];
sprintf(foutname, "%s_out.root",argv[1]);
cout << foutname << endl;
TFile * fout = new TFile(foutname, "RECREATE");
//run the analysis loop above
eventdatroot t;
TTree * tree;
f->GetObject("EVENTDAT",tree);
t.Init(tree);
t.Loop( THICKNESS[thickkey] );
t.Closefile(fout);
return 1;
}