LAr.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------------------------------------------
2 // Formulas and numbers are based on
3 // arXiv:1502.04213
4 // and private communication with one of the authors Emily Grace:
5 // emilygrace.k@gmail.com
6 //
7 // to run the script from the root command line do:
8 // root [0] .L LAr.C++
9 // root [1] init(); // initialize
10 // to make some plots do:
11 // root [2] sellmeierLAr(); // plot refraction index between 110 and 700 nm
12 // root [3] sellmeierLAr(125.,130.); // plot refraction index between 125 and 130 nm
13 // root [4] rayleigh(); // plot rayleigh length between 110 and 400 nm
14 // root [5] rayleigh(125,130); // plot rayleigh length between 110 and 400 nm
15 //
16 // to print out table that can be cut and paste into the Geant4 gdml description:
17 // root [6] rindextable(); // refraction index between 110 and 700 nm in nsteps=100 for T=83.81 K
18 // root [7] rindextable(200,300,10,3); // refraction index between 200 and 300 nm in nsteps=10 for T=90 K
19 // root [8] rayleightable(); // rayleigh length between 110 and 700 nm in nsteps=100 for T=83.81 K
20 // root [9] rayleightable(200,300,10,3); // rayleigh length between 200 and 300 nm in nsteps=10 for T=90 K
21 //------------------------------------------------------------------------------------------------------------------
22 #include "math.h"
23 #include <iostream>
24 #include "TGraph.h"
25 #include "TCanvas.h"
26 #include "TLegend.h"
27 #include "TMultiGraph.h"
28 #include "TAxis.h"
29 #include "TF1.h"
30 using namespace std;
31 const double pi = 3.14159265358979323846;
32 const double p3times16 = 16.*pi*pi*pi;
33 const double kA = 6.02214129e23; // Avogadro constant
34 const double kb = 1.3806488e-16; // boltzmanm constant in cm2 g s-2 K-1
35 const double kT = 2.18e-10; // isothermal compressibility in cm^2dyne^-1 where 1 dyne = 1 g·cm/s2
36 const double aw = 39.948; // g/mol.
37 const double c = 299792458.; // speed of light in m/sec
38 const double h = 4.13566743E-15; // Planck constant in eVsec
39 const double lambdaUV = 106.6*1e-7; // LAr UV Resonance lambda (cm)
40 const double lambdaIR = 908.3*1e-7; // LAr IR Resonance lambda (cm)
41 const double alngth = 66.; // LAr attenuation length in cm at 128 nm
42  // from N. Ishida et al :
43  // Nuclear Instruments and Methods in Physics Research Section A: Accelerators,
44  // Spectrometers, Detectors and Associated Equipment 384 (23) (1997) 380 - 386.
45 // refractive index at triple point LAr from
46 // A. C. Sinnock, B. L. Smith, Refractive indices of the condensed inert gases, Phys. Rev. 181 (1969) 1297-1307.
47 const Int_t nr= 9;
48 const Double_t Lambda[nr]= {361.2,
49  365.0,
50  406.3,
51  435.8,
52  475.3,
53  508.6,
54  546.1,
55  578.0,
56  643.9
57 };
58 const Double_t R[nr]= {1.2395,
59  1.2392,
60  1.2372,
61  1.2361,
62  1.2349,
63  1.2341,
64  1.2334,
65  1.2328,
66  1.2321
67 };
68 // Liquid Argon
69 // sellmeier coefficient from arXiv:1502.04213
70 // for different temperatures T
71 //
72 
73 const double T[4] = {83.81 ,86. ,88. ,90.}; // K
74 const double a0[4] = {1.24262 ,1.23828 ,1.23358 ,1.26099};
75 const double aUV[4] = {0.268257 ,0.266635 ,0.266183 ,0.236486};
76 const double aIR[4] = {0.00047342,0.000848595,0.000846994,0.0022611};
77 const double rho[4] = {0.03549 ,0.03513 ,0.03481 ,0.03449}; // mol/cm3
78 double density[4];
79 double kbTrhokT[4];
80 void init()
81 {
82 for (int i=0;i<4;i++)
83  {
84  density[i] = rho[i] *aw; // g/cm3
85  kbTrhokT[i] = kb*T[i]*kT*density[i]*density[i];
86  }
87 }
88 double lambdatoe(double lambda)
89 {
90  // input photon wavelength in nm
91  // return energy in eV
92  double E = (h*c)/(lambda*1.e-9);
93  return E;
94 }
95 double etolambda(double E)
96 {
97  // input photon energy in eV
98  // return wavelength in nm
99  double lambda = (h*c)/(E*1.e-9);
100  return lambda;
101 }
102 double sellmeier_LAr(double * x,double *p)
103 {
104  double la0 = p[0];
105  double laUV = p[1];
106  double laIR = p[2];
107  double lambda =x[0]*1e-7; // convert from nm to cm
108  double nsquare = la0
109  +(laUV*lambda*lambda)/(lambda*lambda-lambdaUV*lambdaUV)
110  +(laIR*lambda*lambda)/(lambda*lambda-lambdaIR*lambdaIR);
111  return sqrt(nsquare);
112 }
113 double sellmeier_LAr(double lambda,int index)
114 {
115  lambda=lambda*1e-7;
116  double nsquare = a0[index]
117  +(aUV[index]*lambda*lambda)/(lambda*lambda-lambdaUV*lambdaUV)
118  +(aIR[index]*lambda*lambda)/(lambda*lambda-lambdaIR*lambdaIR);
119  return sqrt(nsquare);
120 }
121 double sellmeierpe_LAr(double * x,double *p)
122 {
123  double la0 = p[0];
124  double laUV = p[1];
125  double laIR = p[2];
126  double pe = x[0];
127  double lambda = etolambda(pe);
128  lambda =lambda*1e-7; // convert from nm to cm
129  double nsquare = la0
130  +(laUV*lambda*lambda)/(lambda*lambda-lambdaUV*lambdaUV)
131  +(laIR*lambda*lambda)/(lambda*lambda-lambdaIR*lambdaIR);
132  double nord = sqrt(nsquare);
133  return nord;
134 }
135 double sellmeierpe_LAr(double x,int index)
136 {
137  double lambda = etolambda(x);
138  lambda =lambda*1e-7; // convert from nm to cm
139  double nsquare = a0[index]
140  +(aUV[index]*lambda*lambda)/(lambda*lambda-lambdaUV*lambdaUV)
141  +(aIR[index]*lambda*lambda)/(lambda*lambda-lambdaIR*lambdaIR);
142  double nord = sqrt(nsquare);
143  return nord;
144 }
145 
146 // emin and emax in nm
147 void sellmeierLAr(double emin=110, double emax=700)
148 {
149  const double minlambda = 110;
150  const double maxlambda = 700;
151  if (emin<minlambda||emax>maxlambda)
152  {
153  cout <<" variables out of range: "<< minlambda<<" - "<< maxlambda<<endl;
154  return;
155  }
156  TCanvas *canvas2 = new TCanvas("canvas2", "refractive indices", 200, 10, 1000, 800);
157  TF1 *sm0 = new TF1("sm0", sellmeier_LAr,emin,emax,3);
158  sm0-> SetTitle("T=83.81 K");
159  sm0->SetParameters(a0[0],aUV[0],aIR[0]);
160  sm0->SetLineWidth(2);
161  sm0->SetLineColor(2);
162  sm0->GetXaxis()->SetTitle("#lambda [nm]");
163  sm0->GetYaxis()->SetTitle("Index of Refraction");
164  sm0->Draw();
165  TF1 *sm1 = new TF1("sm1", sellmeier_LAr,emin,emax,3);
166  sm1-> SetTitle("T=86. K");
167  sm1->SetParameters(a0[1],aUV[1],aIR[1]);
168  sm1->SetLineWidth(2);
169  sm1->SetLineColor(3);
170  sm1->Draw("SAME");
171  TF1 *sm2 = new TF1("sm2", sellmeier_LAr,emin,emax,3);
172  sm2-> SetTitle("T=88. K");
173  sm2->SetParameters(a0[2],aUV[2],aIR[2]);
174  sm2->SetLineWidth(2);
175  sm2->SetLineColor(4);
176  sm2->Draw("SAME");
177  TF1 *sm3 = new TF1("sm3", sellmeier_LAr,emin,emax,3);
178  sm3-> SetTitle("T=90. K");
179  sm3->SetParameters(a0[3],aUV[3],aIR[3]);
180  sm3->SetLineWidth(2);
181  sm3->SetLineColor(8);
182  sm3->Draw("SAME");
183  //
184  TGraph *ve = new TGraph(nr,Lambda,R);
185  ve-> SetTitle("Sinnock et al");
186  ve->SetLineColor(2);
187  ve->SetMarkerColor(2);
188  ve->SetMarkerStyle(22);
189  ve->SetMarkerSize(2);
190  ve->Draw("PL");
191  TLegend *leg = canvas2->BuildLegend(.7, .65, 0.85, .85);
192  leg->Draw();
193 }
194 
196 {
197  TF1 *sm = new TF1("npe", sellmeierpe_LAr,1.9,11.3,3);
198  sm->SetParameters(a0[0],aUV[0],aIR[0]);
199  sm->SetLineWidth(2);
200  sm->SetLineColor(2);
201  sm->GetXaxis()->SetTitle("photon energy [eV]");
202  sm->GetYaxis()->SetTitle("Index of Refraction");
203  sm->Draw();
204 }
205 
206 double lrayleigh(Double_t *x,Double_t *p)
207 {
208  double lambda = x[0];
209  int index=int(p[0]);
210  double n = sellmeier_LAr(lambda,index);
211  lambda = lambda*1.e-7; // convert from nm to cm
212  double l = p3times16/(6.*lambda*lambda*lambda*lambda);
213  double br = kbTrhokT[index] *(((n*n-1)*(n*n+2))/(3.*density[index])*(((n*n-1)*(n*n+2))/(3.*density[index])));
214  l=l*br;
215  l =1./l;
216  return l;
217 }
218 double lrayleigh(double lambda,int index)
219 {
220  double n = sellmeier_LAr(lambda,index);
221  lambda = lambda*1.e-7; // convert from nm to cm
222  double l = p3times16/(6.*lambda*lambda*lambda*lambda);
223  double br = kbTrhokT[index] *(((n*n-1)*(n*n+2))/(3.*density[index])*(((n*n-1)*(n*n+2))/(3.*density[index])));
224  l=l*br;
225  l =1./l;
226  return l;
227 }
228 // emin and emax in nm
229 // nsteps number of steps
230 void rayleigh(double emin=110, double emax=400)
231 {
232  const double minlambda = 110;
233  const double maxlambda = 400;
234  if (emin<minlambda||emax>maxlambda)
235  {
236  cout <<" variables out of range: "<< minlambda<<" - "<< maxlambda<<endl;
237  return;
238  }
239  TCanvas *canvas = new TCanvas("canvas", "rayleigh scattering length", 200, 10, 1000, 800);
240  TF1 *vp0 = new TF1("vp0",lrayleigh,emin,emax,1);
241  vp0->SetParameters(0.,0.);
242  vp0->SetLineWidth(2);
243  vp0->SetLineColor(2);
244  vp0->SetTitle("T=83.81K");
245  vp0->GetXaxis()->SetTitle("#lambda [nm]");
246  vp0->GetYaxis()->SetTitle("Rayleigh scattering length [cm]");
247  vp0->Draw();
248  TF1 *vp1 = new TF1("vp1",lrayleigh,emin,emax,1);
249  vp1->SetParameters(1.,0.);
250  vp1->SetLineWidth(2);
251  vp1->SetLineColor(3);
252  vp1->SetTitle("T=86.K");
253  vp1->Draw("SAME");
254  TF1 *vp2 = new TF1("vp2",lrayleigh,emin,emax,1);
255  vp2->SetParameters(2.,0.);
256  vp2->SetLineWidth(2);
257  vp2->SetLineColor(4);
258  vp2->SetTitle("T=88.K");
259  vp2->Draw("SAME");
260  TF1 *vp3 = new TF1("vp3",lrayleigh,emin,emax,1);
261  vp3->SetParameters(3.,0.);
262  vp3->SetLineWidth(2);
263  vp3->SetLineColor(8);
264  vp3->SetTitle("T=90.K");
265  vp3->Draw("SAME");
266  TLegend *leg = canvas->BuildLegend(.15, .75, 0.45, .85);
267  leg->Draw();
268 }
269 //----------------------------------------------------------------------
270 // function prints out the rayleigh length in the geant 4 gdml format
271 // emin and emax in nm
272 // nsteps number of steps
273 // index of Temperature Array
274 //----------------------------------------------------------------------
275 void rayleightable(double emin=110, double emax=700, int nsteps=100,int index=0)
276 {
277  const double minlambda = 110;
278  const double maxlambda = 700;
279  if (emin<minlambda||emax>maxlambda)
280  {
281  cout <<" variables out of range: "<< minlambda<<" - "<< maxlambda<<endl;
282  return;
283  }
284  double stepsize = (emax-emin)/nsteps;
285  double pe = emax;
286  double n = lrayleigh(pe,index);
287  double photone = lambdatoe(pe);
288  cout<<" <matrix name=\"RAYLEIGH\" coldim=\"2\" values=\"" << photone <<"*eV "<<n<<"*cm"<<endl;
289  for (int i=1;i<nsteps-1;i++)
290  {
291  pe = emax-i*stepsize;
292  n = lrayleigh(pe,index);
293  photone = lambdatoe(pe);
294  cout << photone <<"*eV "<<n<<"*cm"<<endl;
295  }
296  pe = emax-(nsteps-1)*stepsize;
297  n = lrayleigh(pe,index);
298  photone = lambdatoe(pe);
299  cout << photone <<"*eV "<<n<<"*cm\"/>"<<endl;
300 }
301 //----------------------------------------------------------------------
302 // function prints out the refraction index in the geant 4 gdml format
303 // emin and emax in nm
304 // nsteps number of steps
305 // index of Temperature Array
306 // --------------------------------------------------------------------
307 void rindextable(double emin=110, double emax=700, int nsteps=100,int index=0)
308 {
309  const double minlambda = 110;
310  const double maxlambda = 700;
311  if (emin<minlambda||emax>maxlambda)
312  {
313  cout <<" variables out of range: "<< minlambda<<" - "<< maxlambda<<endl;
314  return;
315  }
316  double stepsize= (emax-emin)/nsteps;
317  double pe = emax;
318  double n = sellmeier_LAr(pe,index);
319  double photone = lambdatoe(pe);
320  cout<<" <matrix name=\"RINDEX\" coldim=\"2\" values=\"" << photone <<"*eV "<<n<<endl;
321  for (int i=1;i<nsteps-1;i++)
322  {
323  pe = emax-i*stepsize;
324  n = sellmeier_LAr(pe,index);
325  photone = lambdatoe(pe);
326  cout <<photone <<"*eV "<<n<<endl;
327  }
328  pe = emax-(nsteps-1)*stepsize;
329  n = sellmeier_LAr(pe,index);
330  photone = lambdatoe(pe);
331  cout << photone <<"*eV "<<n<<"\"/>"<<endl;
332 }
const double aw
Definition: LAr.C:36
PYTHON x
Definition: diff.txt:3
const double c
Definition: LAr.C:37
const Int_t nr
Definition: LAr.C:47
double etolambda(double E)
Definition: LAr.C:95
double sellmeierpe_LAr(double *x, double *p)
Definition: LAr.C:121
const double h
Definition: LAr.C:38
const double a0[4]
Definition: LAr.C:74
const Double_t Lambda[nr]
Definition: LAr.C:48
size_t i(0)
const int nsteps
double sellmeier_LAr(double *x, double *p)
Definition: LAr.C:102
void rayleightable(double emin=110, double emax=700, int nsteps=100, int index=0)
Definition: LAr.C:275
const double pi
Definition: LAr.C:31
void rayleigh(double emin=110, double emax=400)
Definition: LAr.C:230
const double lambdaIR
Definition: LAr.C:40
STL namespace.
double lrayleigh(Double_t *x, Double_t *p)
Definition: LAr.C:206
double kbTrhokT[4]
Definition: LAr.C:79
double lambdatoe(double lambda)
Definition: LAr.C:88
the ParameterSet object passed in for the configuration of a destination should be the only source that can affect the behavior of that destination This is to eliminate the dependencies of configuring a destination from multiple mostly from the defaults It suppresses possible glitches about changing the configuration file somewhere outside of a destination segament might still affect the behavior of that destination In the previous configuration for a specific the value of a certain e may come from following and have been suppressed It the configuring ParameterSet object for each destination will be required to carry a parameter list as complete as possible If a parameter still cannot be found in the ParameterSet the configuration code will go look for a hardwired default directly The model is a great simplicity comparing with the previous especially when looking for default values Another great advantage is most of the parameters now have very limited places that allows to appear Usually they can only appear at one certain level in a configuration file For in the old configuring model or in a default ParameterSet object inside of a or in a category or in a severity object This layout of multiple sources for a single parameter brings great confusion in both writing a configuration and in processing the configuration file Under the new the only allowed place for the parameter limit to appear is inside of a category which is inside of a destination object Other improvements simplify the meaning of a destination name In the old a destination name has multiple folds of meanings the e cout and cerr have the special meaning of logging messages to standard output or standard error the name also serves as the output filename if the destination is a file these names are also references to look up for detailed configurations in configuring the MessageFacility The multi purpose of the destination name might cause some unwanted behavior in either writing or parsing the configuration file To amend in the new model the destination name is now merely a name for a which might represent the literal purpose of this or just an id All other meanings of the destinations names now go into the destination ParameterSet as individual such as the type parameter and filename parameter Following is the deatiled rule for the new configuring Everything that is related with MessageFacility configuration must be wrapped in a single ParameterSet object with the name MessageFacility The MessageFacility ParameterSet object contains a series of top level parameters These parameters can be chosen a vector of string listing the name of debug enabled models Or use *to enable debug messages in all modules a vector of string a vector of string a vector of string a ParameterSet object containing the list of all destinations The destinations ParameterSet object is a combination of ParameterSet objects for individual destinations There are two types of destinations that you can insert in the destinations ParameterSet ordinary including cout
double density[4]
Definition: LAr.C:78
const double emin
const double kb
Definition: LAr.C:34
const Double_t E[nknots]
Definition: testXsec.C:25
const double e
const double p3times16
Definition: LAr.C:32
const double emax
const double kA
Definition: LAr.C:33
const Double_t R[nr]
Definition: LAr.C:58
void sellmeierLAr(double emin=110, double emax=700)
Definition: LAr.C:147
const double alngth
Definition: LAr.C:41
void rindextable(double emin=110, double emax=700, int nsteps=100, int index=0)
Definition: LAr.C:307
const double T[4]
Definition: LAr.C:73
ParameterSet &ps const ParameterSet const * p
const double aUV[4]
Definition: LAr.C:75
const double aIR[4]
Definition: LAr.C:76
void sellmeierpeLAr()
Definition: LAr.C:195
const double rho[4]
Definition: LAr.C:77
const double lambdaUV
Definition: LAr.C:39
void init()
Definition: LAr.C:80
const double kT
Definition: LAr.C:35