ACTARSim
ACTAR TPC Simulation Reference Guide
ActarSimEventGenerator.cc
Go to the documentation of this file.
1 // - AUTHOR: B. Fernandez-Dominguez 10/2006
2 /******************************************************************
3  * Copyright (C) 2005-2016, Hector Alvarez-Pol *
4  * All rights reserved. *
5  * *
6  * License according to GNU LESSER GPL (see lgpl-3.0.txt). *
7  * For the list of contributors see CREDITS. *
8  ******************************************************************/
9 //////////////////////////////////////////////////////////////////
10 /// \class ActarSimEventGenerator
11 /// Event generator kinematics reader
12 /////////////////////////////////////////////////////////////////
13 
15 
16 using namespace std;
17 
18 //////////////////////////////////////////////////////////////////
19 /// Constructor, all job here
21 
22  // G4double a,b,c,d,e,f;
23  // G4double Integral = 0.;
24  int i;
25  // int nbins;
26  // const G4int MAX = 140;
27  // char buffer[MAX];
28 
29  //Initial values
30  for(i=0;i<1000;i++) {
31  LabAngle_scatt[i] = 0.;
32  LabEnergy_scatt[i] = 0.;
33  LabAngle_recoil[i] = 0.;
34  LabEnergy_recoil[i] = 0.;
35  }
36 
37  for(i=0;i<5000;i++) {
38  theta_xsec[i] = 0.;
39  CrossSection_t[i] = 0.;
40  Icross_section[i] = 0.;
41  }
42 
43  //Read Kinematics File
44  /*
45  ifstream infile("data/kine/kinematics_77nidp.dat");
46 
47  for(i=0;i<24;i++)
48  {
49  infile.getline(buffer, MAX);
50  //readout header
51  // G4cout << "i=" << i << G4endl;
52  }
53 
54  i = -1;
55  while( !infile.eof() )
56  {
57  i++;
58  infile >> LabAngle_scatt[i] >> a>> LabEnergy_scatt[i] >> b >> c >> d >>
59  LabAngle_recoil[i] >> LabEnergy_recoil[i] >> e >> f ;
60 
61  // G4cout<<"Lab_Angle="<<LabAngle_scatt[i]<<" Lab_Energy="<<LabEnergy_scatt[i]<<G4endl;
62 
63 
64  }
65 
66  */
67 
68  //Read cross section file
69 
70  /*
71 
72  ifstream infile_xsec("data/kine/xs_77ni_dp_0MeV_p.dat");
73 
74  i = -1;
75  while( !infile_xsec.eof() )
76  {
77  i++;
78  infile_xsec >> theta_xsec[i] >> CrossSection_t[i]; //readout of data
79  //G4cout << "i="<<i << " " << T_xsec[i] << " " << CrossSection_t[i] << G4endl;
80  nbins = i;
81  }
82 
83 
84  //Integral of cross section
85 
86  for(i=0;i<nbins;i++)
87  {
88  Integral += CrossSection_t[i];
89  //G4cout << " Integral " << Integral << G4endl;
90  }
91 
92  //Building the probability distribution (Integral of the xs between 0 and a given theta)
93 
94  for(i=0;i<nbins;i++)
95  {
96  if(i==0)
97  {
98  Icross_section[0] = CrossSection_t[0]/Integral;
99  // G4cout << "Cross_section[0] " << CrossSection_t[0] << G4endl;
100  //G4cout << "Icross_section[0] " << Icross_section[0] << G4endl;
101  }
102  if (i!=0)
103  {
104  Icross_section[i] = Icross_section[i-1] + CrossSection_t[i]/Integral;
105  //G4cout << "i" << i << "Icross_section[i]" << Icross_section[i] << G4endl;
106  }
107 
108  }
109 
110  */
111 
112 }
113 
114 //////////////////////////////////////////////////////////////////
115 /// Destructor
117 }
STL namespace.
ActarSimEventGenerator()
Constructor, all job here.