Low-Energy Muon (LEM) Experiment
0.5.1
|
#include <vector>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include "midas.h"
#include "experim.h"
#include "nemu_experim.h"
#include <TROOT.h>
#include <TSystem.h>
#include <TMath.h>
#include <TH1F.h>
#include <TH2F.h>
#include <TTree.h>
#include <TDirectory.h>
#include <TFile.h>
#include <TMusrRunHeader.h>
Go to the source code of this file.
Macros | |
#define | HISTOGRAM_WRITE_PERIOD 300 |
#define | UPDATE_INFO_PERIOD 10 |
#define | UPDATE_INFO_PERIOD_INTEL 300 |
Functions | |
RATE_BANK_STR (rate_bank_str) | |
SRAT_BANK_STR (srat_bank_str) | |
POSI_BANK_STR (posi_bank_str) | |
static TObjArray | Slist (0) |
INT | write_histogram_file () |
void | get_sum_filename (char *filename) |
void | extract_summary_data () |
void | update_info () |
void | update_run_header () |
INT | beam_shutter_open (HNDLE hDB) |
float | energy_loss (float moderator_hv) |
float | get_magnetic_field (float current) |
void | get_t0 () |
void | get_t0L3RA () |
INT | read_intel_log (INTEL_LOG *info) |
INT | read_ipmi_log (IPMI_LOG *info) |
void | update_t0shift (INT dummy1, INT dummy2, void *dummy3) |
void | set_spin_rot_angle (INT hDB, INT hKey, void *dummy) |
void | disp_scaler (INT n) |
INT | analyzer_init () |
INT | analyzer_exit () |
INT | ana_begin_of_run (INT run_number, char *error) |
INT | ana_end_of_run (INT run_number, char *error) |
INT | ana_pause_run (INT run_number, char *error) |
INT | ana_resume_run (INT run_number, char *error) |
INT | analyzer_loop () |
#define HISTOGRAM_WRITE_PERIOD 300 |
Definition at line 126 of file analyzer.c.
Referenced by analyzer_loop().
#define UPDATE_INFO_PERIOD 10 |
Definition at line 127 of file analyzer.c.
Referenced by analyzer_loop().
#define UPDATE_INFO_PERIOD_INTEL 300 |
Definition at line 128 of file analyzer.c.
Referenced by read_intel_log(), and read_ipmi_log().
INT ana_begin_of_run | ( | INT | run_number, |
char * | error | ||
) |
Definition at line 589 of file analyzer.c.
References beam_shutter_open(), disp_scaler(), hDB, N_SCALER, runinfo, srat_bank, sum_count, update_info(), update_run_header(), versionCounter, and write_flag.
INT ana_end_of_run | ( | INT | run_number, |
char * | error | ||
) |
Definition at line 640 of file analyzer.c.
References EXP_PARAM::comment, disp_scaler(), exp_param, INFO::file_header_info, hDB, info, N_SCALER, INFO::proposal_number, runinfo, update_info(), and update_run_header().
INT ana_pause_run | ( | INT | run_number, |
char * | error | ||
) |
Definition at line 736 of file analyzer.c.
References disp_scaler(), N_SCALER, and runinfo.
INT ana_resume_run | ( | INT | run_number, |
char * | error | ||
) |
Definition at line 745 of file analyzer.c.
References beam_shutter_open(), disp_scaler(), hDB, N_SCALER, and runinfo.
INT analyzer_exit | ( | ) |
Definition at line 582 of file analyzer.c.
INT analyzer_init | ( | ) |
Definition at line 273 of file analyzer.c.
References analyzer_name, EXP_EDIT_STR, exp_param, EXP_PARAM_STR, gRunHeader, hDB, header, hKey, hv_event, info, INFO_STR, last_histogram_write, last_update_info_write, mean, MEAN_BANK_STR, rotation_angle, runinfo, runname, scaler_settings, SCALER_SETTINGS_STR, scs2001m_event, set_spin_rot_angle(), Slist(), srat_bank, sum_count, t0shift_param, T0SHIFT_PARAM_STR, tdsampletof_param, TDSAMPLETOF_PARAM_STR, trigger_settings, update_info(), update_t0shift(), and write_flag.
INT analyzer_loop | ( | ) |
Definition at line 763 of file analyzer.c.
References extract_summary_data(), HISTOGRAM_WRITE_PERIOD, last_histogram_write, last_update_info_write, runinfo, Slist(), sum_count, update_info(), UPDATE_INFO_PERIOD, update_run_header(), write_flag, and write_histogram_file().
INT beam_shutter_open | ( | HNDLE | hDB | ) |
check, if beam shutters KV61/KV62 are open at begin-of-run
return:
hDB | handle to the ODB. |
Definition at line 2633 of file analyzer.c.
Referenced by ana_begin_of_run(), and ana_resume_run().
void disp_scaler | ( | INT | n | ) |
Definition at line 288 of file scaler_rate_sum.c.
References hDB, hKey, line, SCALER_SETTINGS::names_scl0, rate, runinfo, and scaler.
Referenced by ana_begin_of_run(), ana_end_of_run(), ana_pause_run(), ana_resume_run(), and scaler_sum().
float energy_loss | ( | float | moderator_hv | ) |
calculate energy loss in C-foil; measured E-loss data were fitted by a 3rd order polynom. Above 20kV, assume constant energy loss (polynom gives wrong results). Also, below 7.5kV data to be verified.
return: deltaE
moderator_hv | moderator high voltage |
Definition at line 961 of file analyzer.c.
References INFO::energy_loss_parameter, info, INFO::p0, INFO::p1, INFO::p2, and INFO::p3.
Referenced by get_t0(), get_t0L3RA(), and update_info().
void extract_summary_data | ( | ) |
Definition at line 924 of file analyzer.c.
References get_sum_filename(), line, and Slist().
Referenced by analyzer_loop().
float get_magnetic_field | ( | float | current | ) |
Calculate magnetic field from zero flux current
return: B-field of either WEW or Bpar magnet
current | running through the magnet |
Definition at line 987 of file analyzer.c.
References INFO::bpar, INFO::helmholtz, info, INFO::lem_setup_parameter, INFO::magnet_parameter, and INFO::wew.
Referenced by sc_ana(), and update_info().
void get_sum_filename | ( | char * | filename | ) |
Create filename for run summary files of the Nemu experiment.
filename | pointer to the file name |
Definition at line 887 of file analyzer.c.
References runinfo.
Referenced by extract_summary_data().
void get_t0 | ( | ) |
Calculates t0's for LE-uSR decay histograms and write them to /Info/t0_Parameter/t0.
t0's of decay histograms are saved in /Info/t0_Parameter/t0Hist array. The t0s for energies XX are then calculated:
t0 = t0Hist + tof_XXkV
t0Hist = t_(e+ prompt peak) - (13.5ns+550mm/299.79mm/ns)/0.1953125 = 2062 - 79 = 1983
tof_XXkV is calculated using the "effective length" of the transport system from TD to sample:
tof_XXkV = l_eff/c*sqrt(mc**2/2)*1/sqrt(E), see http://lem00:8000/LEM_Experiment/1849.
Currently two effective lengths are given in ODB:
leff_RAon and leff_RAoff for "RA-On" and "RA-Off" settings.
Definition at line 1396 of file analyzer.c.
References HV_EVENT::demand, energy_loss(), hDB, hKey, hv_event, info, INFO::leff_RAoff, INFO::leff_RAon, INFO::lem_setup, INFO::magnetic_field, SCANAMODULE_PARAM::mod_hv_channel, N_DECAY_HISTS, sc_ana_param, INFO::t0_parameter, and INFO::t0Hist.
void get_t0L3RA | ( | ) |
Calculates t0's for LE-uSR decay histograms and write them to /Info/t0_Parameter/t0.
t0's of decay histograms are saved in /Info/t0_Parameter/t0Hist array. The t0s for moderator HV XX are then calculated:
t0 = t0Hist + tofXXkV
t0Hist = t_(e+ prompt peak) - (13.5ns+550mm/299.79mm/ns)/0.1953125 = 2062 - 79 = 1983
tofXXkV is calculated as a function of L3 and RA potential:
tofXXkV = dFree/sqrt(2E/m)/c + tof(L3) + tof(RA)
dFree = dTotal - dL3 -dRA, where dTotal = (544 + 0.4*ModHV)mm; the effective drift between TD and sample dL3 = 231 mm; effective drift length through L3, determined from a fit to measured TOF data dRA = 221 mm; effective drift length through RA, determined from a fit to measured TOF data dFree is the effective drift section without electric field
Assuming the following potential shape in the electrostatic elements:
U ^ | /\ | / \ | / \ ----—/ -----—> z
one can use
d = 0.5at**2 + vt ==> t = -v/a - sqrt[(v/a)**2 + 2d/a] with a = -e/m*U/d, where U = scalingFactor*LensPotential ("Lens" is either L3 or RA)
Using units keV and kV for m and U one gets
tof(Lens) = dLens/(scaleLens*ULens*c)*sqrt(2mE)*[1-sqrt(1-scaleLens*ULens/E)]
Experimentally, I found out that
scaleL3 = 0.71 + 0.004*ModHV scaleRA = 1.10
Use ODB paramters in /Analyzer/Parameters/TDSampleTOF:
dTotalP0 = 544 dTotalP1 = 0.400, so that dTotal = dTotalP0 + dTotalP1*ModHV dL3 = 231 dRA = 221 scaleL3P0 = 0.71 scaleL3P1 = 0.004, so that scaleL3 = scaleL3P0 + scaleL3P1*ModHV scaleRAP0 = 1.1 scaleRAP1 = 0. modHVchannel = 4 L3-channel = 10 RA-Lchannel = 11 RA-Rchannel = 12 RA-Tchannel = 13 RA-Bchannel = 14
Definition at line 1498 of file analyzer.c.
References HV_EVENT::demand, TDSAMPLETOF_PARAM::dl3, TDSAMPLETOF_PARAM::dra, TDSAMPLETOF_PARAM::dtotalp0, TDSAMPLETOF_PARAM::dtotalp1, energy_loss(), hDB, hKey, hv_event, info, TDSAMPLETOF_PARAM::l3_channel, TDSAMPLETOF_PARAM::moderator_channel, N_DECAY_HISTS, TDSAMPLETOF_PARAM::rab_channel, TDSAMPLETOF_PARAM::ral_channel, TDSAMPLETOF_PARAM::rar_channel, TDSAMPLETOF_PARAM::rat_channel, TDSAMPLETOF_PARAM::scalel3p0, TDSAMPLETOF_PARAM::scalel3p1, TDSAMPLETOF_PARAM::scalerap0, TDSAMPLETOF_PARAM::scalerap1, INFO::t0_parameter, INFO::t0Hist, and tdsampletof_param.
Referenced by update_info().
POSI_BANK_STR | ( | posi_bank_str | ) |
Referenced by tof_init().
RATE_BANK_STR | ( | rate_bank_str | ) |
int read_intel_log | ( | INTEL_LOG * | info | ) |
reads the lem01 system board intel log and feeds the info structure.
return: up to which line number the file you be read, or a negtive number in case of a failure.
info | pointer to the intel info structure to be filled. |
Definition at line 2090 of file analyzer.c.
References INTEL_LOG::baseboard_1_5v, INTEL_LOG::baseboard_3_3v, INTEL_LOG::baseboard_5_0v, INTEL_LOG::baseboard_m12_0v, INTEL_LOG::baseboard_p12_0v, INTEL_LOG::baseboard_temp, INTEL_LOG::bb_3_3v_aux, INTEL_LOG::button, INTEL_LOG::chassis_intru, INTEL_LOG::cpu1_12v, INTEL_LOG::cpu1_therm_ctrl, INTEL_LOG::cpu2_12v, INTEL_LOG::cpu2_therm_ctrl, INTEL_LOG::frontpanel_temp, INTEL_LOG::fsb_vtt, INTEL_LOG::gbit_core_1_2v, INTEL_LOG::id_button, INTEL_LOG::int_button, INTEL_LOG::lan_scrty, line, INTEL_LOG::mem_core_1_8v, INTEL_LOG::p1_thermal_trip, INTEL_LOG::p2_thermal_trip, INTEL_LOG::password, INTEL_LOG::pltfrm_evnt, INTEL_LOG::proc1_coretemp, INTEL_LOG::proc1_ierr, INTEL_LOG::proc1_vccp, INTEL_LOG::proc2_coretemp, INTEL_LOG::proc2_ierr, INTEL_LOG::proc2_vccp, INTEL_LOG::pwrgood, INTEL_LOG::sys_boot_init, INTEL_LOG::sys_evnt, INTEL_LOG::sys_fan1, INTEL_LOG::sys_fan2, INTEL_LOG::sys_fan3, INTEL_LOG::sys_fan4, UPDATE_INFO_PERIOD_INTEL, and INTEL_LOG::watchdog2.
int read_ipmi_log | ( | IPMI_LOG * | info | ) |
reads the lem00 system board ipmi log and feeds the info structure.
return: up to which line number the file could be read, or a negtive number in case of a failure.
info | pointer to the ipmi info structure to be filled. |
Definition at line 1628 of file analyzer.c.
References IPMI_LOG::chassis_intru, IPMI_LOG::cpu1_temp, IPMI_LOG::cpu1_vcore, IPMI_LOG::cpu2_temp, IPMI_LOG::cpu2_vcore, IPMI_LOG::fan1, IPMI_LOG::fan2, IPMI_LOG::fan3, IPMI_LOG::fan5, IPMI_LOG::fan6, line, IPMI_LOG::p12v, IPMI_LOG::p1_1v, IPMI_LOG::p1_5v, IPMI_LOG::p1_dimma1_temp, IPMI_LOG::p1_dimmb1_temp, IPMI_LOG::p2_dimme1_temp, IPMI_LOG::p2_dimmf1_temp, IPMI_LOG::p3_3v, IPMI_LOG::p3_3vsb, IPMI_LOG::p5v, IPMI_LOG::p5vsb, IPMI_LOG::pch_temp, IPMI_LOG::peripherial_temp, IPMI_LOG::ps1_status, IPMI_LOG::ps2_status, IPMI_LOG::system_temp, UPDATE_INFO_PERIOD_INTEL, IPMI_LOG::vbat, IPMI_LOG::vdimm_ab, IPMI_LOG::vdimm_cd, IPMI_LOG::vdimm_ef, IPMI_LOG::vdimm_gh, and IPMI_LOG::vtt.
Referenced by update_info().
void set_spin_rot_angle | ( | INT | hDB, |
INT | hKey, | ||
void * | dummy | ||
) |
set values for LEM spin rotator depending on angle and moderator energy.
Definition at line 2730 of file analyzer.c.
References INFO::a0, INFO::a1, INFO::a2, INFO::a3, INFO::a4, HV_EVENT::demand, hv_event, info, SCANAMODULE_PARAM::mod_hv_channel, rotation_angle, sc_ana_param, INFO::spinrot_parameter, and INFO::SRenable.
Referenced by analyzer_init().
|
static |
Referenced by analyzer_init(), analyzer_loop(), and extract_summary_data().
SRAT_BANK_STR | ( | srat_bank_str | ) |
void update_info | ( | ) |
update energy loss, implantation energy, B-field and t0's in /Info structure.
Definition at line 1014 of file analyzer.c.
References energy_loss(), get_magnetic_field(), get_t0L3RA(), hDB, hKey, hv_event, info, SCS2001M_EVENT::input, HV_EVENT::measured, SCANAMODULE_PARAM::mod_hv_channel, read_ipmi_log(), SCANAMODULE_PARAM::sample_hv_channel, SCANAMODULE_PARAM::sample_zeroflux_channel, sc_ana_param, scs2001m_event, and STR_SIZE.
Referenced by ana_begin_of_run(), ana_end_of_run(), analyzer_init(), and analyzer_loop().
void update_run_header | ( | ) |
Write TMusrRunHeader for root histogram file
Definition at line 1074 of file analyzer.c.
References INFO::beamline_settings, EXP_PARAM::comment, decay_ana_param, DECAYANAMODULE_PARAM::decaybin, DECAYANAMODULE_PARAM::decaytitles, exp_param, INFO::file_header_info, hDB, header, DECAYANAMODULE_PARAM::histobinning, DECAYANAMODULE_PARAM::histotitles, hKey, INFO::implantation_energy, info, INFO::lem_setup, INFO::main_proposer, mean, INFO::moderator, MEAN_BANK::moderator_hv, N_DECAY_HISTS, N_OFFSET_ONOFF_HISTOGRAMS, N_OFFSET_PPC_HISTOGRAMS, INFO::proposal_number, INFO::rotation_angle, runinfo, MEAN_BANK::sample_b, INFO::sample_cryo, MEAN_BANK::sample_hv, INFO::sample_name, MEAN_BANK::sample_t, INFO::spinrot_parameter, STR_SIZE, INFO::t0, INFO::t0_parameter, MEAN_BANK::var_moderator_hv, MEAN_BANK::var_sample_b, MEAN_BANK::var_sample_hv, and MEAN_BANK::var_sample_t.
Referenced by ana_begin_of_run(), ana_end_of_run(), and analyzer_loop().
void update_t0shift | ( | INT | dummy1, |
INT | dummy2, | ||
void * | dummy3 | ||
) |
update t0Shifts for LEM decay histograms when changing from Bpar to WEW setup.
dummy1 | unused dispatcher parameter |
dummy2 | unused dispatcher parameter |
dummy3 | unused dispatcher parameter |
Definition at line 2693 of file analyzer.c.
References analyzer_name, INFO::bpar, T0SHIFT_PARAM::delta_t0, hDB, hKey, info, INFO::lem_setup_parameter, N_DECAY_HISTS, T0SHIFT_PARAM::shift_delta_t0, and t0shift_param.
Referenced by analyzer_init().
INT write_histogram_file | ( | ) |
display scaler in analyzer window if running online; function defined in module scaler_rate_sum.c
Definition at line 806 of file analyzer.c.
References analyzer_name, gManaHistosFolder, gRunHeader, hDB, header, runinfo, and versionCounter.
Referenced by analyzer_loop().
ANALYZE_REQUEST analyze_request[] |
Definition at line 206 of file analyzer.c.
INT analyzer_loop_period = 1000 |
Definition at line 87 of file analyzer.c.
const char* analyzer_name = "Analyzer" |
Definition at line 84 of file analyzer.c.
Referenced by analyzer_init(), update_t0shift(), and write_histogram_file().
ANA_MODULE decay_ana_module |
Define analyser modules which are from external source code. ana_module tof_ana_module = tof_ana_module.c ana_module scaler_rate_sum = scaler_rate_sum.c
Definition at line 53 of file decay_ana_module.c.
DECAYANAMODULE_PARAM decay_ana_param |
Definition at line 44 of file decay_ana_module.c.
Referenced by update_run_header().
EXP_EDIT exp_edit |
Definition at line 96 of file analyzer.c.
EXP_PARAM exp_param |
Definition at line 97 of file analyzer.c.
Referenced by ana_end_of_run(), analyzer_init(), and update_run_header().
TFolder* gManaHistosFolder |
Referenced by sc_eor(), and write_histogram_file().
|
static |
Definition at line 119 of file analyzer.c.
Referenced by analyzer_init(), and write_histogram_file().
|
static |
Definition at line 121 of file analyzer.c.
Referenced by analyzer_init(), update_run_header(), and write_histogram_file().
HV_EVENT hv_event |
Definition at line 107 of file analyzer.c.
INFO info |
Definition at line 106 of file analyzer.c.
|
static |
Definition at line 124 of file analyzer.c.
Referenced by analyzer_init(), and analyzer_loop().
|
static |
Definition at line 125 of file analyzer.c.
Referenced by analyzer_init(), and analyzer_loop().
ANA_MODULE mcp1_ana_module |
Definition at line 51 of file mcp1_ana_module.c.
MEAN_BANK mean |
Definition at line 52 of file sc_ana_module.c.
Referenced by analyzer_init(), sc_ana(), and update_run_header().
INT odb_size = DEFAULT_ODB_SIZE |
Definition at line 90 of file analyzer.c.
ANA_MODULE pileup_ana_module |
Definition at line 50 of file pileup_ana_module.c.
POSI_BANK posi_bank |
Definition at line 103 of file analyzer.c.
RATE_BANK rate_bank |
Definition at line 99 of file analyzer.c.
|
static |
Definition at line 132 of file analyzer.c.
Referenced by analyzer_init(), and set_spin_rot_angle().
RUNINFO runinfo |
Required ODB structures.
/Runinfo ODB key, defined in from midas.h
Definition at line 95 of file analyzer.c.
char runname[256] |
Definition at line 92 of file analyzer.c.
Referenced by analyzer_init(), decay_bor(), decay_init(), mcp1_bor(), mcp1_init(), pileup_bor(), pileup_init(), sc_eor(), tof_bor(), and tof_init().
ANA_MODULE sc_ana_module |
Definition at line 64 of file sc_ana_module.c.
SCANAMODULE_PARAM sc_ana_param |
Definition at line 53 of file sc_ana_module.c.
Referenced by get_t0(), sc_ana(), sc_eor(), set_spin_rot_angle(), and update_info().
BANK_LIST sc_bank_list[] |
Definition at line 191 of file analyzer.c.
ANA_MODULE* sc_module[] |
Definition at line 158 of file analyzer.c.
BANK_LIST scaler_bank_list[] |
Definition at line 179 of file analyzer.c.
ANA_MODULE* scaler_module[] |
Definition at line 153 of file analyzer.c.
ANA_MODULE scaler_rate_sum |
Definition at line 41 of file scaler_rate_sum.c.
SCALER_SETTINGS scaler_settings |
/Equipment/Scaler/Settings/
Definition at line 98 of file analyzer.c.
SCS2001M_EVENT scs2001m_event |
Definition at line 109 of file analyzer.c.
SRAT_BANK srat_bank |
Definition at line 101 of file analyzer.c.
Referenced by ana_begin_of_run(), and analyzer_init().
|
static |
Definition at line 130 of file analyzer.c.
Referenced by ana_begin_of_run(), analyzer_init(), and analyzer_loop().
T0SHIFT_PARAM t0shift_param |
Definition at line 111 of file analyzer.c.
Referenced by analyzer_init(), and update_t0shift().
TDSAMPLETOF_PARAM tdsampletof_param |
Definition at line 112 of file analyzer.c.
Referenced by analyzer_init(), and get_t0L3RA().
ANA_MODULE tof_ana_module |
Definition at line 54 of file tof_ana_module.c.
BANK_LIST trigger_bank_list[] |
Define the list of MIDAS banks to be used. The analyser can either read MIDAS banks sent by other MIDAS clients (from the frontends, for example), or create new BANKS which can be used for subsequent analysis steps.
Definition at line 170 of file analyzer.c.
ANA_MODULE* trigger_module[] |
Definition at line 145 of file analyzer.c.
TRIGGER_SETTINGS trigger_settings |
/Equipment/Trigger/Settings
The following structures are defined in experim.h that is created by entering 'make' in ODBedit.
ODB record values can be easily accessed by db_open_record which creates a hot-link to the structure; structure_name.keyvalue
Definition at line 105 of file analyzer.c.
INT versionCounter |
Definition at line 93 of file analyzer.c.
Referenced by ana_begin_of_run(), and write_histogram_file().
|
static |
Definition at line 129 of file analyzer.c.
Referenced by ana_begin_of_run(), analyzer_init(), and analyzer_loop().