Next: Why should I change Up: In what consists the Previous: In what consists the Contents

## MYTHEN

Since the conversion between the threshold DAC units and energy depends on the gain and offset of the channels the energy calibration has to be done for all settings (high gain, standard and fast). For each setting follow this procedure:

- Select the setting in the Initialization tab.
- Enter in expert mode by clicking the Advanced radiobutton in the Global settings box in the Initialization tab.
- If the trimfiles are in the correct location and with the correct name, they should be loaded by default every time you select the corresponding settings in the global settings box in the initialization tab 3.1. If the trim files do not yet exist generate them as explained in section 3.4.1.
- Execute a threshold scan of the detector with at least three different energies. The more monochromatic are the X-rays, the better the calibration will be (i.e. scattered X-rays are better than the fluorescent emission).
  The scan should range from where all modules count 0 (estimate 850-20 energy(keV) DAcu) and where all modules start having a lot of noise (usually 800 DACu) with a step of 1 or 2 DACu. The acquisition time should be chosen so that there are at least 1000 counts per strip on the plateau.
- Open the file root/CalAllModules.C for editing. Change the value of the following global variables according to your needs:
  - nmod is the number of modules of your system.
  - nscan is the number of different threshold scans you acquired.
  - en is the array with the energies at which you acquired the scans, in keV.
  - een is the array with the errors on the energies at which you acquired the scans, in keV. It is usually small, but can be some hundreds eV in case of dirty fluorescent samples.
  - fn is the array containing the location and root file name of your data.
  - run is the array containing the run index of your data.
  - startscan is the array containing the threshold value at which you started the scans.
  - stopscan is the array containing the threshold value at which you finished the scans.
  - stepscan is the array containing the threshold step of the scans.
  - ave is the array containing the average number of counts per strip on the plateau (it must not be too precise).
  - sn is the array containing the list of the serial number of the modules to be calibrated. It is important that the list is in the right order, so that the optput calibration files have the extension .snxxx corresponding to the right module.
  - of is the location and root file name of the calibration file. The directory should already exist and the extension .snxxx will be attached to the output file.
- Launch root, which you should have already installed on your linux PC
- Execute the following commands in order to load the macros needed for the calibration:

      root$ .L root/NewMythenMacros.C++
      root$ .L root/CalAllModules.C++

  You should get a lot of warnings, but no errors.
- Execute the following command in order to run the calibration:

      root$ EnCalModules()
      root$

  Reading and analyzing the data takes some time, but, after a while, a canvas should open where the plots of the median of the counts of every module as a function of the threshold should be shown for each energy, fitted with a modified erf function in order to find the inflextion point. The last plot of the canvas should represent the inflexion points as a function of the energies, and by fitting it with a straight line it is possible to calculate the offset and gain for each module i.e. calibrate it as a function of the energy. Please check that this automated fitting procedure succeeds. In case you see many fitting errors you should try to check wether the variable you edited in root/CalAllModules.C are all correct or try to edit the fitting procedures in the two root macro files (sorry!).
- Copy the calibration file you obtained to calibration/settings.snxxx 3.2 By doing this the correct threshold for each module will be calculated every time you change the threhsold energy in the global settings box in the initialization tab, you have loaded some default settings and you are not in expert mode.

Next: Why should I change Up: In what consists the Previous: In what consists the Contents