Preface
Useful addresses Useful references
CONTENTS
Useful e-mail adresses and phone numbers Acknowledgments
Introduction
1 Characteristics of the Charged Particle Detector (CPD) 2 Conversion of counting rates into fluxes
2.1 General procedure . . . . 2.2 Description of functions and procedures 2.3 Fortran MINUIT vs IDL CURVEFIT 2.4 Uncertainty on electron fluxes . 2.5 Uncertainty on proton fluxes 2.6 Chi-squared analysis . 2. 7 Sample results . . .
iii
iv
V
vi vii 1
25 5 7 11 12 12 14
15
I '
3 Conclusion 18
A IDL source code 19
A.l cpdflux.pro .
19
A.2 cpdcurvefit.pro .
47
List of Figures
55
List of Tables
56
Preface
The main objectives of the 0RSTED mission is to survey the geomagnetic field with unprecedented accuracy.
However, when the Belgian Institute of Space Aeronomy signed cooperation agreements with the Danish Meteorological Institute, it was mainly due to the common interests of both intitutes in the energetic particle data expected from the Charged Particle Detector {CPD) aboard 0RSTED. Acquired data from the CPD would be used for several studies including but not limited to: correlation of low altitude charged particle fluxes and relative ionosphere opacity, link between solar wind parameters and the dynamic of low altitude charged particle fluxes, development of models {physical and empirical) of charged particle fluxes in the auroral and SAA regions, monitoring radiation damages induced by high-energy charged particles into satellite or space vehicle components. The energy interval covered by the CPD (-;::;;
0.010-10Me V electrons, -;::;;
0.2- 300Me V protons and -;::;;>
0.3Me V alpha-particles) spanned over a sufficient energy range to allow studies of several interaction mechanisms between charged particles, electromagnetic field and upper atmosphere.
The CPD characterisation and data analysis tasks were assigned to the Center for Space Radiation at UCL.
The results of the CPD evaluation were published in the Technical Report A entitled "The Charged Particle Detector {CPD) on the 0RSTED satellite: description and evaluation", dated September 1997 {1}. The CPD data analysis methodology was described in the Technical Note B entitled "The Charged Particle Detector {CPD): Electron and Proton spectra", dated January
2001{2}.
The present Technical Note was written to be used within the frame of the Radiation Environment Research
from Multiple Monitors project. It contains the characteristics of the CPD and a description of the IDL codethat converts counting rates into electron and proton fluxes. The IDL source code is distributed on CD-ROM
joined to this documents.
Useful addresses
Office National d'Etude et de Recherche Aerospatiales (ONERA) Space Environment Department (DESP)
BP 4025 - 2, avenue Edouard Belin
F-31055 TOULOUSE CEDEX FAX: +33 - 5 62 25 25 69 TEL: 33 - 5 62 25 25 66 Danish Meteorological Institute
Solar- Terrestrial Physics Division Lyngbyvej 100,
DK-2100 Copenhagen, Denmark
FAX: 45 39 27 10 80 TEL: 45 39 15 75 00 Center for Space Radiation
Universite Catholique de louvain 2, chemin du Cyclotron,
B-1348 Louvain-La-Neuve, Belgium FAX: 32 10 45 2183 TEL: 32 10 47 3273 Belgian Institute for Space Aeronomy 3 avenue Circulaire, B-1180 Brussels, Belgium FAX: 32 2 374 8423 TEL: 32 2 374 8121 ESA/ESTEC - PRODEX
PO. Box 299
Keplerlaan 1, 2200 AG Noordwijk, The Netherlands FAX: 31 71 565 4693 TEL: 31 71 565 4350 SSTC
Rue de la Science, 8 1000 Brussels, Belgium
FAX: 32 2 230 59 12 TEL: 32 2 238 34 11
Useful references
Item Reference Page
CPD mechanichal assembly Technical Report A page 2 Technical Note B page2 Monte-Carlo simulation {GEANT) Technical Report A page 5 Technical Note B page 11 Onground calibration Technical Report A page 15 Energy range and Technical Note B page 11 Contamination
( see efficiency)
Geometrical factor Technical Note B page 4
Saturation Technical Report A page 32
Background Technical Report A page 36
Useful e-mail addresses and phone numbers
Sebastien Bourdarie TEL: 33 5 62 25 27 56 Sebastien. Bourdarie@onecert.fr Daniel Boscher TEL: 33 5 62 25 27 53 Daniel. Boscher@onecert.fr Petteri Nieminen TEL: 31 71 565 50 05 Petteri. Nieminen@esa.int Hugh Evans TEL: 31 71 565 51 09 Hugh.Evans@esa.int Eamonn Daly TEL: 31 71 565 37 87 eamonn.daly@esa.int Torsten Neubert TEL: 45 39 15 75 00 neubert@dmi.min.dk Peter Stauning TEL: 45 39 15 74 73 pst@dmi.dk
Mathias Cyamukungu TEL: 32 10 47 3402 cyam@fynu.ucl.ac.be Ghislain Gregoire TEL: 32 10 47 3216 gregoi re@fynu. ucl. ac. be
Joseph Lemaire TEL: 32 2 373 0407 joseph. lema i re@bi ra-iasb. oma. be Daniel Heynderickx TEL: 32 2 373 0417 da n iel. heynderickx@bi ra-iasb. oma. be Norma Crosby TEL: 32 2 373 0406 norma.crosby@bira-iasb.oma.be Michel Kruglanski TEL: 32 2 373 0417 michel.kruglanski@bira-iasb.oma.be Bart Quaghebeur TEL: 32 2 373 0417 B. Quaghebeur@oma.be
Paul Buehler TEL: 49 351 470 0328 pa ul. bueh ler@psi. eh H. Olthof (PRODEX) TEL: 31 71 565 46 93
J. W. Bernard (SSTC) TEL: 32 2 238 35 83 M.
C.
Limbourg (SSTC) TEL: 32 2 238 34 11Acknowledgments
The authors are thankful to Dr. Sylvie BENCK (CSR) and Dr. Juan CABRERA (BIRA) for their valuable contribution to the processing of this document.
Dr.
M.Cyamukungu is grateful to the PRODEX-ESA-SSTC management team for the funds allowed to the (l)ERSTED/CPD project at the Center for Space Radiation and to the UCL for all kinds of support provided.
Of course, the authors endorse solely the responsibility for the contents of this report.
Introduction
The Technical Note B entitled "The Charged Particle Detector (CPD): Electron and Proton spectra" was issued in January 2001 (http://www.fynu.ucl.ac.be/themes/he/radiations/oersted/tnb/tnb.pdf}. It contains a comprehensive presentation of the CPD characteristics, the raw data acquired using the CPD aboard the Oersted satellite, along with a detailed description of the flux extraction process.
The availability of tools to simulate the interaction of particles and satellite or detector components allowed the CSR team to develop and apply the so called intrinsic detection efficiency method to characterise the CPD detector aboard the Oersted satellite. This method has been successfully applied to analyse the data from the Proton Switch detector aboard the CRRES satellite {3}. One of its main features is that no particle is considered to be a contaminant in a channel in which it is detected.
Chapter 1 of the present Technical Note contains the efficiencies of six of the CPD channels for electrons and
protons. In Chapter 2, the algorithm to convert counting rates into fluxes are presented, along with ancillary
codes to read raw data files.
CHAPTER 1
Characteristics of the Charged Particle Detector (CPD)
The characteristics assigned to the CPD at design time are presented in Table 1.1. All those characteristics may be folded into the intrinsic detection efficiency of the channels defined in terms of the energy intervals listed at the bottom of Table 1.1. Moreover, intrinsic detection efficiencies contain detailed information on the interaction of particles with the detector components.
It had been initially devised to deduce angular distributions of protons and electrons detected by the CPD. However, the lack of Oersted attitude data, following the blinding of the Star lmager by charged particles upon passages in the South Atlantic Anomaly made unusable the angular dependent detection efficiencies. Therefore, only energy dependent efficiencies have been used for extraction of fluxes from counting rates assuming an isotropic angular distribution of incident particle momentum.
Finally, due to the width in energy of some of the CPD channels, a selection
was initiated and only channels detecting particles on a significantly large
energy range were kept. Those channels are channel 1, 2 and 3 of detector P3
and the same channels in detector P4. They are named P31, P32, P33, P41,
P42 and P43, hereafter. Their detection efficiencies are shown in Figure 1.1.
Property DETECTOR
Pl and P2 P3 P4 El and E2
Sight angle {degree) 90 0 90 90 90
o
F.O. V half angle {degree) 20.5 33.5 33.5 20.5
Aperture ( cm 2 ) 0.196 0.283 0.283 0.196
Geometric factor (crri2 sr) 0.053 0.25 0.25 0.053 Entrance window (µm/compound) 1.25/Ni 1000/AI 1000/Cu 1.25/Ni
Detector type A A A B
THRESHOLD ENERGIES (MeV)
a: .51 51.9 89.9 .51
p: .23 12.9 22.3 .23
e-.- .02 .68 1.75 .02
PEAK (PENETRATION) ENERGY:
a 24. 59. 95. 48.
p 6. 15. 24. 12.
e - .37 1.00 2.1 .88
MEAN ENERGY LOST IN Si at PEAK (PENETRATION) ENERGY:
a 22.8 22.8 22.8 48.
p 5.6 5.6 5.6 12.
e - .3 .3 .3 .8
ENERGY BIN LIMITS {keV):
1 423 417 209 212 47
2 639 629 741 752 72
3 989 974 2183 2146 111
4 1500 1478 7742 7611 168
5 2146 2146 237
6 3241 3241 358
7 5015 5015 553
8 7611 7611 840
Table 1.1: Properties of the CPD array. A - type detector: TU-011-050-300; B - type detector: TU-016- 050-1000
4 4
3 Bin 1 of P3 3 Bin 1 of P4
g g
>-
I
>-V 2 V 2
C
j
C" "
i] ·.:;
I
I
I
;;::I
w
/ Iw
i II I
;
II
II f
I I I
I
I I
/ ./
0 0
0.1 1.0 10.0 100.0 0.1 1.0 10.0 100.0
Energy (MeV) Energy (MeV)
4 4
I\
l\3 Bin 2 of P3 3 Bin 2 of P4 ! \
g g r \
I \
I>- >-
I
V 2 V 2
C C
" I "
] I ]
w
Iw
I
I I
I I
.____/ /
0 0
0.1 1.0 10.0 100.0 0.1 1.0 10.0 100.0
Energy (MeV) Energy (MeV)
4 4
3 Bin 3 of P3 3 Bin 3 of P4
g g
>- >-
V 2 V 2
C C
" "
]
w
]w /\
I \\
I \...
I
0 0 \._;
0.1 1.0 10.0 100.0 0.1 1.0 10.0 100.0
Energy (MeV) Energy (MeV)
Figure 1.1: Intrinsic detection efficiencies of electrons and protons in channel P31, P32, P33, P41, P42 and P43.
CHAPTER 2
Conversion of counting rates into fluxes
2.1 General procedure
The main procedure of the flux extraction code is called cpdF/ux. It initializes global variables, reads the efficiencies and raw data files and calls the main counts to flux conversion procedure cpdCURVEFIT. Results from the counting rate file CPDyyddd.hh are written in the file CPDyyddd.hh.res. The flow chart of the flux extraction program is shown in Figure 2.1.
The procedure called cpdCURVEFIT is nothing else than the CURVEFIT subroutine available in the IDL editor's library, in which an "error flag" has been added. It has been noticed that the convergence of this function minimisation procedure depends much on the initial guess values of parameters to fit. This observation lead us to check several methods to determine these parameters:
findlnitSeek and findlnitAmoeba are the counterparts of the MINUIT {4]
command SEEK and SIMPLEX, respectively.
Finally, the most efficient method to converge to the optimal fit parameters was found to be by setting the power law indices of protons and electrons to unity. The spectrum amplitude is then given by the equation:
Jo=
CR
(21}CF coEo(InEmax -lnEth) ·
where Jo is the amplitude of the power law spectrum,
CR
is the count- ing rate of P31 (electrons) or P32 (protons), CF is the geometrical factor2.1 General procedure
START
Initialize global parameters Read efficiency files
Define time limit of data files
Read next count rate file
Perform Chi-squared fit of all (non-zero) read data and write results
Figure 2.1: Main phases of the flux calculation process.
YES
END
2.2 Description of functions and procedures
of the aperture,
t:0 :::::: 0.03 is an order of magnitude for the intrinsic de-tection efficiency for electrons (channel P31} and protons (channel P32}, E
0=
1 Me V and60.M e V for electrons and protons respectively, Et1, and
Emax
are the limits of energy intervals covered by the CPD for electrons and protons. Not only this method to initialize the fit parameters always converges, but also was found to be very fast when compared to procedures based on
find/nitSeekand
findlnitAmoeba.Initially, constraints were set on the fit parameters to avoid un-physical results like negative counting rate values. However, at run time, no such situation was observed and the constraints were removed. The use of unconstrained parameters makes easy the
interpretationof uncertainties and will probably allow an easy monitoring of the fit quality for low values of counting rates or abnormal values that may result from corrupted raw data files.
2.2 Description of functions and procedures
The counting rates recorded by the six CPD channels mentionned above were used in a Chi-square fit resulting in the best parameters of proton and electron spectra.
The function cpdCURVEF/T based on the IDL function CURVEFIT was used to minimize the Chi-square. All the other procedures and functions of the code are described herea~er:
Name: readEffi
Description:
reads the efficiency files.
Input:
NONE
Output:
loads the global vectors of proton and electron efficiencies for the
six channels used for flux evaluations.
2.2 Description of functions and procedures
Name: readRawDataFile Description:
Input: year, day of year and hour when data were acquired.
Output: loads the global vectors of counting rates and time tags for the six channels used for flux evaluations and for four other addition- nal channels.
Name: getNewDataFileName
Description: composes the name of a data file to be processed Input: year, day of year and hour when data were acquired.
Output: a counting rate data file name.
Name: theoCount
Description: evaluates the counting rate based on a model of particle spectra.
Input: (dummy) six dimension vector of floats, spectrum parameters.
Output: vector of counting rates of six channels.
Name: findlnitAmoeba
Description: performs the initial search of Chi-square values of parameters by the SIMPLEX minimisation algorythm.
Input: guess value of the parameters in a four dimension vector and six-dimension vector of counting rates.
Output: guess parameter vector.
Name: findlnitSeek
Description: performs the initial search of Chi-square values of parameters by the Monte-Carlo minimisation procedure.
Input: the six-dimension vector of counting rates, the lower limit and the upper limit values of the search hyper-volume.
Output: guess parameter vector.
2.2 Description of functions and procedures
Name: residue
Description:
evaluates the Chi-square corresponding to a given vector of count- ing rates and a vector of parameter values (only channels P32,Input:
Output:
P33, P42 and P43 are taken into account).
vector of counting rates and vector of spectrum parameters.
Chi-square value.
Name: residuevsPar
Description: evaluates the Chi-square corresponding to a given vector of count- ing rates and a vector of parameter values.
Input:
four-dimension vector of spectrum parameters.Output:
Chi-square value.Name: crpKL T
Description:
(where K=3 or 4 is the detector index, L=l, 2 or 3 is the channel number and T=
e or p denotes the type of particle): evaluates the contribution of particles of type T to the counting rate of channel L of detector K.Input:
amplitude and index of a power law spectrum for particles of type T.Output:
counting rate.Name: convoluProdpKL T
Description:
evaluates the product of the efficiency function and the spectrum for particle type P in channel L of detector K.Input:
particle energyOutput:
product valueName: feffipKL T
Description:
evaluates the intrinsic detection efficiency for particles of type T, in channel L of detector K, by interpolation in the efficiency vs energy table.Input:
particle energy.Output:
intrinsic detection efficiency.2.2 Description of functions and procedures Name: specPro
Description: evaluates the differential flux of protons as a function of energy, given two spectrum parameters.
Input: proton energy.
Output: differential flux of protons at a given energy.
Name: specEle
Description: evaluates the differential flux of electrons as a function of energy, given two spectrum parameters.
Input: electron energy.
Output: differential flux of electrons at a given energy.
Name: dfluxDiffT
Description: evaluates the uncertainty {68% confidence level) on the differen- tial flux of particles of type T.
Input: particle energy.
Output: uncertainty on differential flux.
Name: fluxlnt T
Description: evaluates the integral flux of particle type T.
Input: Lower limit and upper limit of the energy interval.
Output: Integral flux.
Name: dfluxlnt T
Description: evaluates the uncertainty on the integral flux of particle type T.
Input: Lower limit and upper limit of the energy interval.
Output: Integral flux.
Name: effiPlot
Description: plots the efficiencies as a function of energy.
Input: NONE
Output: plots of the efficiencies of six CPD channels.
2.3 Fortran MINUIT vs IDL CURVEFIT
2.3 Fortran MINUIT vs IDL CURVEFIT
The comparison of results obtained using the MINUIT code and CURVEFIT is summarized in Table 2.1.
Day since 1 Jan. 1999:
Latitude:
Longitude:
Altitude:
P31 observed counting rate:
P31 model counting rate:
P32 observed counting rate:
P32 model counting rate:
P33 observed counting rate:
P33 model counting rate:
P41 observed counting rate:
P41 model counting rate:
P42 observed counting rate:
P42 model counting rate:
P43 observed counting rate:
P43 model counting rate:
Proton diff. flux at E
=
59 Me V:Power law index (proton spectrum):
AP8-MAX omni. flux of60
< E <
300 MeV protons (SPENVIS):AP8-MAX uni. flux of 60
< E <
300 Me V protons (SPENVIS ):CPD integral flux of 60
< E <
300 Me V protons:CPD lower limit integral flux of 60
< E <
300 Me V protons Equation 2.1:100.6300 -17.59 -18.86 824.49
MINUIT cpdCURVEF/T 1344
1568 1574
744
806 822
177
173 172
1288
805 808
740
732 716
162
145 138
14.5 14.0{6)
0.2 0.21(5)
167 656 2843 2387
Table 2.1: CPD results and comparison with model predictions. All the integral fluxes are expressed in cm-2 sec1 sr-1. No statisticaly significant difference is noticed between MINUIT and CURVEFIT spectrum parameters.
2.4 Uncertainty on electron fluxes
2.4 Uncertainty on electron fluxes
As far as electrons are concerned, the CPD channels contain only information on electrons having energies E 2:~ IM e V. This information is significantly drawn from channels P31 and P41. However, there are situations where electron spectra are so soft that the counting rate in P41 is very low: in fact it's electron detection threshold is E >~ 2MeV, as can be seen on the efficiency function. In such cases, parameters of electron spectra are based only on counting rates acquired in channel P31. The resulting electron fluxes are usually evaluated with uncertanties as high as 30%. A typical contour plot of the fit Chi-squared function is shown in Figure 2.2. It corresponds to the results summarized in Table 2.1. With fixed parameters of the proton spectrum, the Chi-squared function is plotted as a function of the electron spectrum parameters. It can be seen that the optimal parameter region is elliptically shaped around an axis having a positive slope in the <Amplitude - Power law index> plane. This is conform to expectation since the Chi-squared minimisation algorithm reaches close values of the function when the amplitude is increased while the power law index is decreased. However, the most important feature of this Chi-squared function is that its minimum is found at a power law index value very close to zero. Such power law index values will be encountered for samples with low counting rates in channel P41. In such cases, the set of six CPD channels must be seen as containing information on the integral flux of electrons, but the deduced spectrum parameters, especially, the power law index are just those which lead to the correct value of the integral flux (or counting rate) measured by channel P31 and should not be used for any physical purpose: the error bars on such values are very high.
2.5 Uncertainty on proton fluxes
Information on proton fluxes are contained in channels P32, P33, P42 and P43. The uncertainties on deduced fluxes are usually lower than 10%. The Chi-squared function is shown in Figure 2.3. Similarly to the electron Chi- squared, the best fit parameters for protons are close to a line of positive slope in the <Amplitude - Power law index> plane. However, the region of
"optimal" power law indices clearly excludes values close to zero. The four
2.5 Uncertainty on proton fluxes
X Q)
-0
0.6
C
:i:
0
I...
Q)
:i:
0.4
0 Q_,
600 800 1000 1200 1400
Figure 2.2: Typical contour plot of the Chi-squared as a function of parameters of electron spectrum.
channels sensitive to protons bring in the necessary information to define a
power law spectrum of protons. This is also reflected in the low uncertainty
values.
2.6 Chi-squared analysis
X Cl)
""CJ
C 0.6
3
0
I....
Cl)
3 0.4
0 Q_
5 10 15
20 25
Figure 2.3: Typical contour plot of the Chi-squared as a function of parameters of proton spectrum.
2. 6 Chi-squared analysis
Despite the
factthat sometimes the counting rates are too low to be considered as "normally" distributed, most of the fitting Chi-squared test result in a non-
rejection of the power-law spectrum model. It should be noticed however
that even in cases where abnormally high Chi-squared values are obtained,
departure from an isotropic distribution assumed in this analysis may enter
2. 7 Sample results
into consideration to explain the results. Since this misfit between model and data will be reflected in the error bars on evaluated fluxes, we recommend that the uncertainties be always quoted with results from CPD flux evaluation.
2. 7 Sample results
Figures 2.4 and 2.5 show fluxes of protons and electrons obtained by running the cpdFlux.pro code. Error bars are also shown as a precision indicator. As mentionned in the previous section, we recall that these evaluated uncertanties should be taken into account whenever the CPD fluxes are compared to results
from other measurements.
The result file CPD99101.15.res may be accessed in the (l)RSTED directory at the RERMRM project web site.
2. 7 Sample results
,,--....
N
E
(.) L en
(.) (j)
en '---.._,_
.___,,
,,--....
>
(j)2 0 lO
w
I\.___,,
7
10000
1000
100
10
1 100.625
Proton flux
100.630 100.635 Day since 1 January 1999 at 0:00 UT
Figure 2.4: Proton flux along the 0RTSED orbit on April 11, 1999 around 15:00 VT.
2. 7 Sample results
Electron flux
10000
,,---...._
"'
E
() L (/)
()
1000
(I) (/)
"-
~
,,---...._
>
(I)2 ..-
I\
100
~
w
J
◊
10~~~~-~~~~-~~~
100. 625 100.630 100.635
Day since 1 January 1999 at 0:00 UT
Figure 2.5: Electron flux along the (Z)RTSED orbit on April 11, 1999 around 15:00 VT.
CHAPTER 3 Conclusion
The data analysis code presented in this document was designed on the basis of the "intrinsic detection efficiency" method. This method was successfully tested on several other instruments and was found very accurate.
It's IDL implementation was found to be reliant on the quality (speed, ro- bustness) of the Chi-squared minimisation subroutine. It has been noticed throughout this code development that a good choice of the initial model parameters may help getting out of non-convergence problems.
Finally, the methodology described in this document may be applied to any
other detector when intrinsic detection efficiencies of all channels are known.
APPENDIX A IDL source code
A.1 cpdflux.pro
PRO cpdFlux
common EFFICTP, ENVECP,EFFIP31P,EFFIP32P,EFFIP33P,EFFIP41P,EFFIP42P,EFFIP43P common EFFICTE, ENVECE,EFFIP31E,EFFIP32E,EFFIP33E,EFFIP41E,EFFIP42E,EFFIP43E common COUNTR, YP31, YP32, YP33, YP41, YP42, YP43
common RAWCNT, CRP11, CRP18, CRP21, CRP28, CRP31, CRP32, CRP33, CRP41,CRP42, CRP43 common SPECPAR, AMPLIP, GAMMAP, AMPLIE, GAMMAE
common DSPECPAR, DAMPLIP, DGAMMAP, DAMPLIE, DGAMMAE common ENEROI, EMINP, EMAXP, EMINE, EMAXE, EOP, EOE common COUNTVAR, COUNTER
common TIMETAG, ye, mo, day, hours, minutes, sees, decdoy common FILENAME, Name
common QSIMPPREC, eps common ERROR, ERROR_FLAG_SET common CONVINFO, NOTATMIN
common RANDOM, RNDVEC, RNDCNT, RNDIDX common GFACTOR, GF
common INITPAR, BGammae, BAmplie, BGammap, BAmplip
FORWARD_FUNCTION findinit, fluxintp, fluxinte, dfluxintp, dfluxinte NVEC = 1000
CNTMAX = 3600
RNDVEC = RANDOMU(47,1000)
A.1 cpdflux.pro RNDIDX=O
ENVECP=fltarr(NVEC) &EFFIP31P=fltarr(NVEC) & EFFIP32P=fltarr(NVEC) & EFFIP33P=fltarr(NVEC) EFFIP41P=fltarr(NVEC)
&
EFFIP42P=fltarr(NVEC)&
EFFIP43P=fltarr(NVEC)ENVECE=fltarr(NVEC)
&
EFFIP31E=fltarr(NVEC)&
EFFIP32E=fltarr(NVEC)&
EFFIP33E=fltarr(NVEC) EFFIP41E=fltarr(NVEC)&
EFFIP42E=fltarr(NVEC)&
EFFIP43E=fltarr(NVEC)CRP31 = fltarr(CNTMAX)
&
CRP32=fltarr(CNTMAX) & CRP33=fltarr(CNTMAX)&
CRP41=
fltarr(CNTMAX) CRP42=fltarr(CNTMAX) & CRP43=
fltarr(CNTMAX)CRP11
=
fltarr(CNTMAX)&
CRP18=fltarr(CNTMAX)&
CRP21=
fltarr(CNTMAX) & CRP28=
fltarr(CNTMAX) ye= fltarr(CNTMAX) & mo= fltarr(CNTMAX)&
day= fltarr(CNTMAX)&
hours= fltarr(CNTMAX)minutes= fltarr(CNTMAX) & sees= fltarr(CNTMAX) & decdoy= fltarr(CNTMAX) EMINP = 5. & EMAXP = 300. & EMINE = 0.8 & EMAXE = 10.
EOP
=
60.EDE = 1.0 EPS
=
0.025D readeffi FIRSTYEAR=99 LASTYEAR=99 FIRSTDAY=
101 LASTDAY = 101 FIRSTHOUR=
15 LASTHOUR=
15 counter=0L one=
1.D RADIUS= 0.95DAREAP3 =!PI* RADius-w P3GF
=
!PI*AREAP3header1
=
'DayAftJan1999 AOp dAOp gammap dgammap AOe dAOe header2= ' INT60 DINT60 EINTE01 DEINTE01'format='(f11.6,B(f8.3,1x),4(f7.0,1x))' header3
=
header1 + header2for year=FIRSTYEAR, LASTYEAR do begin
for dayofyear = FIRSTDAY, LASTDAY do begin for hour= FIRSTHOUR, LASTHOUR do begin
ReadRawDataFile,year,dayofyear,hour GET_LUN,resflux
OPENW,resflux, Name+'.res' printf,resflux,header3 counter=n_elements(CRP31) for i=OL,counter-1 do begin
yp31=double(CRP31[i]) yp32=double(CRP32[i]) yp33=double(CRP33[i])
gammae dgammae'
A.l
cpdflux.proyp41=double(CRP41[i]) yp42=double(CRP42[i]) yp43=double(CRP43[i])
if (yp31*yp32*yp33*yp41*yp42*yp43 gt 1. ) then begin Y = [yp31,yp32,yp33,yp41,yp42,yp43]
X = [1.D,2.D,3.D,4.D,5.D,6.D]
lowlim = [0.D,O.D,O.D,O.D]
uplim = [100.D,10.D,1000.D,10.D]
inita =double( [0.,1.,10.,1.]) NOTATMIN =1
count= 5
while ((NOTATMIN GT 0) AND (count GT 0)) do begin print,Name,yp31,yp32,yp33,yp41,yp42,yp43 ERROR_FLAG_SET = 0
BGammae = 1.D
BAmplie = yp31/(0.03D*EOE*alog(EMAXE)*P3GF) BGammap = 1 . D
BAmplip = yp32/(0.03D*EOP*(alog(EMAXP)-alog(EMINP))*P3GF A= [BAmplip,BGammap,BAmplie,BGammae]
; alternative methods to estimate the
; starting point (make count=S guesses at most)
;A =double(findinitseek(y,lowlim,uplim))
;A =double(findinitamoeba(inita,y)) weights = 1. D/y
yfit = cpdCURVEFIT(X, Y, weights, A,SIGMA,$
FUNCTION_NAME='theocount ', /NODERIVATIVE, TOL=O. 025) count= count-1
endwhile
if (NOTATMIN EQ 0) then begin
endif endif
AMPLIP=A [OJ & GAMMAP=A [1] & AMPLIE=A [2] & GAMMAE=A [3]
DAMPLIP=SIGMA[O]
&
DGAMMAP=SIGMA[1]&
DAMPLIE=SIGMA[2]DGAMMAE = SIGMA[3]
intp60 = fluxintp(60.D,EMAXP) dintp60 = dfluxintp(60.D,EMAXP) inte01 = fluxinte(1.D,EMAXE) dinte01 = dfluxinte(1.D,EMAXE)
printf,resflux,decdoy[i],AMPLIP,DAMPLIP,GAMMAP,DGAMMAP, AMPLIE, DAMPLIE,GAMMAE, DGAMMAE,intp60, dintp60, $ inte01, dinte01,FORMAT=format
A.1 cpdflux.pro
_endfor end
endfor
endfor
endfor CLOSE, resfl ux FREE_LUN,resflux
;******************Reading Counting rates pro ReadRawDataFile,year,dayofyear,hour common RAWCNT
common COUNTVAR common TIMETAG
FORWARD_FUNCTION GetNewDataFileName tdata=fltarr(10)
cp1=fltarr(B) & ce1=fltarr(B) & cp4=fltarr(4) & cp3=fltarr(4) & cp2=fltarr(B) &ce2=fltarr(B) GET_LUN,rawcr
OPENR,rawcr, GetNewDataFileName(year, dayofyear, hour) counter= OL
while (NOT(EOF(rawcr))) do begin readf,rawcr, tdata readf,rawcr, cp1 readf,rawcr, ce1 readf,rawcr, cp4 readf,rawcr, cp3 readf,rawcr, cp2 readf,rawcr, ce2 sec=tdata(9)/1000.
CRP11 [counter]= cp1 [OJ/sec CRP18[counter]= cp1 [7]/sec CRP31[counter]= cp3[0]/sec CRP32[counter]= cp3[1]/sec CRP33[counter]= cp3[2]/sec CRP41[counter]= cp4[0]/sec CRP42[counter]= cp4[1]/sec CRP43[counter]= cp4[2]/sec CRP21[counter]= cp2[0]/sec CRP28[counter]= cp2[7]/sec ye[counter] tdata[0]+1900 mo[counter] tdata(1) day[counter] = tdata(2) hours[counter] = tdata(3)
A.l cpdflux.pro
minutes [counter]
=
tdata(4) secs[counter] tdata(S)decdoy[counter]=dayofyear-1.+hours[counter]/24.+minutes[counter]/1440.+secs[counter]/86400.
counter=counter+1 endwhile
CLOSE,rawcr FREE_LUN,rawcr end
;
****************
Reading efficiency files*************pro readeffi common EFFICTP common EFFICTE
;*********************Reading P3 efficiencies********************
;****Electrons record=''
finame
=
'eneffip3.elec' Get_LUN, datainOPENR, datain, finame
readf, datain, format='(A)',record record= STRTRIM(record,1)
fields= STR_SEP(record,' ') lv
=
n_elements(fields) vec=
fltarr(lv) nrecords=OLwhile (not EOF(datain)) do begin readf,datain,vec
envece [nrecords] =vec [OJ effip31e [nrecords] =vec [1]
effip32e[nrecords]=vec[2]
effip33e [nrecords] =vec [3]
nrecords
=
nrecords+1 endwhileenvece
=
envece[O:nrecords-1]effip31e effip31e[O:nrecords-1]
effip32e = effip32e[O:nrecords-1]
effip33e = effip33e[O:nrecords-1]
CLOSE, datain Free_LUN, datain
read header
start loop
close data file
Free logical unit number
A.l cpdflux.pro
;****Protons
tiname = 'enettip3.prot' Get_LUN, datain
OPENR, datain, tiname
readt, datain, tormat='(A)',record record= STRTRIM(record,1)
fields= STR_SEP(record,' ') lv
=
n_elements(tields) vec = tltarr(lv) nrecords=OLwhile (not EOF(datain)) do begin readf,datain,vec
envecp [nrecords] =vec [OJ ettip31p [nrecords] =vec [1]
ettip32p [nrecords] =vec [2]
ettip33p [nrecords] =vec [3]
nrecords = nrecords+1 endwhile
envecp
=
envecp[O:nrecords-1]effip31p ettip31p[O:nrecords-1]
effip32p
=
ettip32p[O:nrecords-1]ettip33p = ettip33p[O:nrecords-1]
CLOSE, datain Free_LUN, datain
read header
start loop
close data tile
Free logical unit number·
;*********************Reading P4 efficiencies********************
;*******Electrons ; vector envece and envec already up to date******
tiname
=
'enettip4.elec' Get_LUN, datainOPENR, datain, tiname
readt, datain, tormat='(A)',record record= STRTRIM(record,1)
fields= STR_SEP(record, ' ') lv = n_elements(tields) vec
=
fltarr(lv)nrecords=OL
while (not EOF(datain)) do begin readt,datain,vec
ettip41e [nrecords] =vec [1]
ettip42e [nrecords] =vec [2]
ettip43e [nrecords] =vec [3]
nrecords = nrecords+1
read header
start loop
A.1 cpdflux.pro endwhile
effip41e effip41e[O:nrecords-1]
effip42e effip42e[O:nrecords-1]
effip43e effip43e[O:nrecords-1]
CLOSE, datain Free_LUN, datain
;****Protons
finame = 'eneffip4.prot' Get_LUN, datain
OPENR, datain, finame
readf, datain, format='(A)',record record= STRTRIM(record,1)
fields= STR_SEP(record,' ') lv = n_elements(fields) vec
=
fltarr(lv)nrecords=OL
while (not EOF(datain)) do begin readf,datain,vec
effip41p [nrecords] =vec [1]
effip42p[nrecords]=vec[2]
effip43p[nrecords]=vec[3]
nrecords = nrecords+1 endwhile
effip41p effip41p[O:nrecords-1]
effip42p effip42p[O:nrecords-1]
effip43p effip43p[O:nrecords-1]
CLOSE, datain Free_LUN, datain end
close data file
Free logical unit number
read header
start loop
close data file
Free logical unit number
;************************** Get New Data File Name***********
function GetNewDataFileName,Year, DayOfYear, Hour common FILENAME
fYear = STRING(Year, FORMAT='(I2) ') strdoy=''
if (DayOfYear lt 10) then strdoy = '00'
if ((DayOfYear ge 10) and (DayOfYear lt 100)) then strdoy = '0' fDayOfYear = strdoy + STRTRIM(STRING(DayOfYear,FORMAT='(I3)'),1) strhour=''
if (Hour lt 10) then strhour = '0'
fHour = strhour + STRTRIM(STRING(Hour, FORMAT='(I2)'),1) Name='cpddata/CPD'+ fYear+fDayOfYear+'. '+fHour
A.1 cpdflux.pro return, Name end
;**************************Residue function*******************
pro theoCount, CHANNEL, FITPAR, THEOVAL common COUNTR
common ENEROI common SPECPAR common DSPECPAR common ERROR
FORWARD_FUNCTION crp31p,crp31e,crp32p, crp32e,crp33p,crp33e,crp41p, $ crp41e,crp42p,crp42e,crp43p,crp43e
!EXCEPT=O
Amplip =FITPAR[O]
Gammap = FITPAR[1]
Amplie = FITPAR[2]
Gammae = FITPAR[3]
minusone=-1.D zero= OD
theoval=Replicate(zero,6) if (ERROR_FLAG_SET) then begin
theoval=Replicate(minusone, 6) endif else begin
endelse
print, 'THEOCOUNT ',Amplip, Amplie
F1=double(crp31p(amplip,gammap)) + double(crp31e(amplie,gammae)) F2=double(crp32p(amplip,gammap)) + double(crp32e(amplie,gammae)) F3=doubl e ( crp33p ( ampli p, gammap)) + double ( crp33e ( ampli e, gammae)) F4=double(crp41p(amplip,gammap)) + double(crp41e(amplie,gammae)) F5=double(crp42p(amplip,gammap)) + double(crp42e(amplie,gammae)) F6=double(crp43p(amplip,gammap)) + double(crp43e(amplie,gammae)) theoval = [F1,F2,F3,F4,F5,F6]
finiteResult=finite(theoval)
if (NOT(finiteResult[O] AND finiteResult[1] AND finiteResult[2] AND finiteResult[3] $ AND finiteResult[4] AND finiteResult[5])) then begin
theoval=Replicate(minusone,6) ERROR_FLAG_SET = 1
endif else begin
theoval = [F1, F2, F3, F4, F5, F6]
endelse print, theoval
print,YP31,YP32,YP33,YP41,YP42,YP43 end
A.1 cpdflux.pro
;********************Find initial values of parameters using the SIMPLEX algorithm*****
function findinitAmoeba,a, y common ERROR
common COUNTR
!EXCEPT=O minusone=-1
minusonevec =Replicate(minusone,6) if ERROR_FLAG_SET then return,minusonevec
YP31=y[O] & YP32=y[1] &YP33=y[2] & YP41=y[3] & YP42=y[4] & YP43=y[S]
ftol
=
0.05sc=[S00.,10.,1000.,10.]
res = AMOEBA(ftol, FUNCTION_NAME='residuevspar',PO=a ,SCALE=sc, NCALLS = iter) finiteResult
=
finite(res).if (NOT(finiteResult[O] AND finiteResult[1] AND finiteResult[2] and finiteResult[3])) then begin ERROR_FLAG_SET=1
return,minusonevec endif else begin
return, res endelse
end
;**************************Find initial values of parameters by Monte-Carlo seek method*****
function findinitSeek,expval,lowlim,uplim common ERROR
common RANDOM common INITPAR
FORWARD_FUNCTION residue
!EXCEPT=O minusone=-1
minusonevec =Replicate(minusone,6)
if ERROR_FLAG_SET then return,minusonevec nsamp=30L
amppinit=dblarr(nsamp) gampinit=dblarr(nsamp) ampeinit=dblarr(nsamp) gameinit=dblarr(nsamp) res = dblarr(nsamp)
if RNDIDX eq 9999 then RNDIDX=O
amppinit
=
lowlim[O]+RNDVEC[RNDIDX: RNDIDX+nsamp-1J•(uplim[O] -lowlim[O]) gampinit=
lowlim[1]+RNDVEC[RNDIDX: RNDIDX+nsamp-1]*(uplim[1] -lowlim[1]) ampeinit = lowlim[2]+RNDVEC[RNDIDX: RNDIDX+nsamp-1]*(uplim[2] -lowlim[2]) gameinit=
lowlim[3]+RNDVEC[RNDIDX: RNDIDX+nsamp-1J•(uplim[3] -lowlim[3]) RNDIDX = RNDIDX+nsampA.1 cpdflux.pro
amppinit[nsamp-1J=BAmplip gampinit[nsamp-1J=BGammap ampeinit[nsamp-1J=BAmplie gameinit[nsamp-1J=BGammae for i=OL,nsamp-1L do begin
res [iJ=residue(expval, [amppinit [iJ ,gampinit [iJ, ampeinit [iJ ,gameinit [i]]) endfor
result= min(res, idx)
aini t = [amppini t [idxJ, gampini t [idxJ, ampeini t [idxJ, gameinit [idx]]
finiteResult
=
finite(ainit)i f (NOT(fini teResul t [OJ AND finiteResult [1J AND fini teResul t [2J and fini teResul t [3J)) then begin ERROR_FLAG_SET=1
return,[-1,-1,-1,-1J endif else begin
return, ainit endelse
end
;**************************Residue function*******************
function residue, expcount,fitpar common ENEROI
common SPECPAR common DSPECPAR common ERROR
FORWARD_FUNCTION crp32p, crp32e,crp33p,crp33e,crp42p,crp42e,crp43p,crp43e
!EXCEPT=O
if (ERROR_FLAG_SET) Amplip =FITPAR[OJ Gammap
=
FITPAR[1J Amplie=
FITPAR[2J Gammae=
FITPAR[3J yp31 expcount [OJ yp32 expcount[1J yp33 = expcount [2J yp41 expcount[3J yp42 expcount[4J yp43 expcount[SJthen return,-1
; uncomment F1 and F4 estimation to add electron contribution
;F1=(crp31p(amplip,gammap) + crp31e(amplie,gammae)-YP31)-2/YP31 F2=( crp32p(amplip,gammap) + crp32e (amplie,gammae)-YP32) ~2/YP32 F3=(crp33p(amplip,gammap) + crp33e(amplie,gammae)-YP33)-2/YP33
;F4=(crp41p(amplip,gammap) + crp41e(amplie,gammae)-YP41)-2/YP41 F5=(crp42p(amplip,gammap) + crp42e(amplie,gammae)-YP42)-2/YP42
A.l cpdflux.pro
F6=(crp43p(amplip,gammap) + crp43e(amplie,gammae)-YP43)-2/YP43 resval = [F2, F3, FS, F6]
finiteResult
=
finite(total(resval)) if (NOT finiteResult[O]) then beginERROR_FLAG_SET=l return,-1 endif else begin endelse
end
return, total(resval)
;**************************Residue function*******************
function residuevsPar, fitpar common ENEROI
common SPECPAR common ERROR common COUNTR
FORWARD_FUNCTION crp32p, crp32e,crp33p,crp33e,crp42p,crp42e,crp43p,crp43e
!EXCEPT=O
if (ERROR_FLAG_SET) then return,-1 Amplip =FITPAR[O]
Gammap
=
FITPAR[1]Amplie
=
FITPAR[2]Gammae
=
FITPAR[3]F1=(crp31p(amplip,gammap) + crp31e(amplie,gammae)-YP31)-2/YP31 F2=(crp32p(amplip,gammap) + crp32e(amplie,gammae)-YP32)-2/YP32 F3=(crp33p(amplip,gammap) + crp33e(amplie,gammae)-YP33)-2/YP33 F4=(crp41p(amplip,gammap) + crp41e(amplie,gammae)-YP41)-2/YP41 FS=(crp42p(amplip,gammap) + crp42e(amplie,gammae)-YP42)-2/YP42 F6=(crp43p(amplip,gammap) + crp43e(amplie,gammae)-YP43)-2/YP43 resval
=
[F1,F2,F3,F4,FS,F6]finiteResult
=
finite(total(resval)) if (NOT finiteResult[O]) then beginERROR_FLAG_SET=1 return,-1 endif else begin
return, total(resval) endelse
end
;**********************
Counting rate calculation***************************;---Electron contribution---
A.1 cpdflux.pro
function crp31e, ampli,gamma common ENEROI
common SPECPAR common DSPECPAR common QSIMPPREC common ERROR
!EXCEPT=O
it (ERROR_FLAG_SET EQ 1) then return,-1 Amplie = ampli
Gammae = gamma RADIUS = 0. 95D
AREAP3 =!PI* RADius-2D
a =QSIMP('convoluprodp31e', EMINE,EMAXE,/DOUBLE,EPS=eps) er= !PI*AREAP3*a
tiniteResult = tinite(cr)
it (NOT finiteResult[O]) then begin ERROR_FLAG_SET=1
return,-1 endif else begin
return, er endelse
end
function crp32e, ampli,gamma common ENEROI
common SPECPAR common DSPECPAR common QSIMPPREC common ERROR
!EXCEPT=O
it (ERROR_FLAG_SET EQ 1) then return,-1 Amplie = ampli
Gammae = gamma RADIUS = 0. 95
AREAP3 =!PI* RADius-2
a =QSIMP('convoluProdp32e', EMINE,EMAXE,/DOUBLE,EPS=eps) er= !PI*AREAP3*a
tiniteResult = tinite(cr)
it (NOT tiniteResult[O]) then begin ERROR_FLAG~SET=1
return,-1 endit else begin
return, er
A.1 cpdflux.pro endelse
end
function crp33e, ampli,gamma
common ENEROI
common SPECPAR
common DSPECPAR
common QSIMPPREC
common ERROR
!EXCEPT=O
if (ERROR_FLAG_SET EQ 1) then return,-1 Amplie
=
ampliGammae
=
gamma RADIUS=
0. 95AREAP3 =!PI* RADius-2
a =QSIMP('convoluProdp33e', EMINE,EMAXE,/DOUBLE,EPS=eps) er= !PI•AREAP3•a
finiteResult
=
finite(cr)if (NOT fini teResul t [OJ) then begin ERROR_FLAG_SET=1
return,-1 endif else begin
return, er endelse
end
function crp41e, ampli,gamma
common ENEROI
common SPECPAR
common DSPECPAR
common QSIMPPREC
common ERROR
!EXCEPT=O
if (ERROR_FLAG_SET EQ 1) then return,-1 Amplie
=
ampliGammae
=
gamma RADIUS=
0. 95AREAP3 =!PI* RADius-2
a =QSIMP('convoluProdp41e', EMINE,EMAXE,/DOUBLE,EPS=eps) er= !PI•AREAP3•a
finiteResult
=
finite(cr)if (NOT finiteResult[O]) then begin
A.1 cpdflux.pro
ERROR_FLAG_SET=1 return,-1 endif else begin
return, er endelse
end
function crp42e, ampli,gamma common ENEROI
common SPECPAR common DSPECPAR common QSIMPPREC common ERROR
!EXCEPT=O
if (ERROR_FLAG_SET EQ 1) then return,-1 Amplie = ampli
Gammae
=
gamma RADIUS 0.95AREAP3 =!PI* RADius-2
a =QSIMP ( 'convoluProdp42e ', EMINE, EMAXE, /DOUBLE, EPS=eps) er= !PI*AREAP3*a
finiteResult
=
finite(cr)if (NOT finiteResult[O]) then begin ERROR_FLAG_SET=1
return,-1 endif else begin
return, er endelse
end
function crp43e, ampli,gamma common ENEROI
common SPECPAR common DSPECPAR common QSIMPPREC common ERROR
!EXCEPT=O
if (ERROR_FLAG_SET EQ 1) then return,-1 Amplie = ampli
Gammae
=
gamma RADIUS 0.95AREAP3
=
! PI*
RADius-2A.l cpdflux.pro
a =QSIMP('convoluProdp43e', EMINE,EMAXE,/DOUBLE,EPS=eps) er= !PI*AREAP3*a
finiteResult
=
tinite(cr)if (NOT finiteResult[O]) then begin ERROR_FLAG_SET=1
return,-1 endit else begin
return, er endelse
end
;---Proton contribution--- function crp31p, ampli,gamma
common ENEROI common SPECPAR common DSPECPAR common QSIMPPREC common ERROR
!EXCEPT=O
it (ERROR_FLAG_SET EQ 1) then re'turn, -1 Amplip
=
ampliGammap
=
gamma RADIUS= 0.95AREAP3 =!PI* RADius-2
a =QSIMP('convoluProdp31p', EMINP,EMAXP,/DOUBLE, EPS=eps) er= !PI*AREAP3*a
tiniteResult
=
tinite(cr)it (NOT tiniteResult[O]) then begin ERROR_FLAG_SET=1
return,-1 endif else begin
return, er endelse
end
;***************Proton contribution to Counting rate in P32*********
function crp32p, ampli,gamma common ENEROI
common SPECPAR common DSPECPAR common QSIMPPREC common ERROR
!EXCEPT=O
A.I cpdf/ux.pro
if (ERROR_FLAG_SET EQ 1) then return,-1 Amplip
=
ampliGammap = gamma RADIUS
=
0. 95AREAP3 =!PI* RADius-2
a =QSIMP('convoluProdp32p', EMINP,EMAXP,IDOUBLE, EPS=eps) er= !PI*AREAP3*a
finiteResult
=
finite(cr)i f (NOT finiteResult[O]) then begin ERROR_FLAG_SET=1
return,-1 endif else begin
return, er endelse
return, er end
function crp33p, ampli,gamma common ENEROI
common SPECPAR common DSPECPAR common QSIMPPREC common ERROR
!EXCEPT=O
if (ERROR_FLAG_SET EQ 1) then return,-1 Amplip = ampli
Gammap
=
gamma RADIUS= 0.95AREAP3 =!PI* RADius-2
a =QSIMP('convoluProdp33p', EMINP,EMAXP,/DOUBLE, EPS=eps) er= !PI*AREAP3*a
finiteResult = finite(cr)
if (NOT finiteResult[O]) then begin ERROR~FLAG_SET=1
return,-1 endif else begin
return, er endelse
return, er end
function crp41p, ampli,gamma common ENEROI
A.l cpdflux.pro common SPECPAR common DSPECPAR common QSIMPPREC common ERROR
!EXCEPT=O
if (ERROR_FLAG_SET EQ 1) then return,-1 Amplip
=
ampliGammap
=
gamma RADIUS= 0.95AREAP3
=
! PI*
RADius-2a =QSIMP('convoluProdp41p', EMINP,EMAXP,/DOUBLE, EPS=eps) er= !PI*AREAP3*a
finiteResult
=
finite(cr)if (NOT finiteResult[O]) then begin ERROR_FLAG_SET=1
return,-1 endif else begin
return, er endelse
return, er end
function crp42p, ampli,gamma common ENEROI
common SPECPAR common DSPECPAR common QSIMPPREC common ERROR
!EXCEPT=O
if (ERROR_FLAG_SET EQ 1) then return,-1 Amplip
=
ampliGammap
=
gamma RADIUS= 0.95AREAP3 =!PI* RADius-2
a =QSIMP('convoluProdp42p', EMINP,EMAXP,/DOUBLE, EPS=eps) er= !PI*AREAP3*a
finiteResult
=
finite(cr)if (NOT finiteResult[O]) then begin ERROR_FLAG_SET=1
return,-1 endif else begin
return, er endelse
A.1 cpdflux.pro
return, er
endfunction crp43p, ampli,gamma common ENEROI
common SPECPAR common DSPECPAR common QSIMPPREC common ERROR
!EXCEPT=O
if (ERROR_FLAG_SET EQ 1) then return,-1 Amplip
=
ampliGammap
=
gamma RADIUS=
0. 95AREAP3 =!PI* RADius-2
a =QSIMP ('con vol uProdp43p ' , EMINP, EMAXP, /DOUBLE, EPS=eps)
er=
!PI*AREAP3*afiniteResult = finite(cr)
if (NOT finiteResult[O]) then begin ERROR_FLAG_SET=1
return,
-1 endif else beginreturn, er
endelseend
;*********************
Convolutionproducts*******************************
;---electrons
function convoluProdp31e, energy common ERROR
FORWARD_FUNCTION feffip31e, specEle
!EXCEPT= 0
if (ERROR_FLAG_SET EQ 1) then return,-1
a= double(feffip31e(energy))*double(specEle(energy)) finiteResult
=
finite(a)if (NOT finiteResult[O]) then begin ERROR_FLAG_SET=1
return,
-1D endif else beginreturn, a
endelseend
A.1 cpdf/ux.pro
function convoluProdp32e, energy common ERROR
FORWARD_FUNCTION feffip32e, specEle
!EXCEPT= 0
if (ERROR_FLAG_SET EQ 1) then return,-1
a= double(feffip32e(energy))*double(specEle(energy)) finiteResult = finite(a)
if (NOT finiteResult[O]) then begin ERROR_FLAG_SET=1
return, -1 endif else begin
return, a endelse
end
function convoluProdp33e, energy
common ERROR
FORWARD_FUNCTION feffip33e, specEle
!EXCEPT = 0
if (ERROR_FLAG_SET EQ 1) then return,-1
a=double(feffip33e(energy))*double(specEle(energy)) finiteResult = finite(a)
if (NOT finiteResult[O]) then begin ERROR_FLAG_SET=1
return,-1 endif else begin
return, a endelse
end
function convoluProdp41e, energy
common ERROR
FORWARD_FUNCTION feffip41e, specEle
!EXCEPT = 0
if (ERROR_FLAG_SET EQ 1) then return,-1
a= double(feffip41e(energy))*double(specEle(energy)) finiteResult = finite(a)
if (NOT finiteResult[O]) then begin ERROR_FLAG_SET=1
return, -1 endif else begin
return, a