Inter-/Extrapolate the high-voltage value corresponding to the target gain value.
205 if (g1->GetN() < 2 || !
checkGain(gainTarget)) {
214 for (Int_t
k = 1;
k < g1->GetN(); ++
k) {
216 const double dGain_i = fabs(g1->GetPointY(i) - gainTarget);
217 const double dGain_j = fabs(g1->GetPointY(j) - gainTarget);
218 const double dGain_k = fabs(g1->GetPointY(
k) - gainTarget);
220 if (dGain_k < dGain_i) {
225 }
else if ((dGain_k < dGain_j || !
areValid(i, j)) &&
235 const double logHV0 =
log(fabs(g1->GetPointX(i)));
236 const double logHV1 =
log(fabs(g1->GetPointX(j)));
238 const double logG0 =
log(g1->GetPointY(i));
239 const double logG1 =
log(g1->GetPointY(j));
240 const double elogG0 = g1->GetErrorY(i) / g1->GetPointY(i);
241 const double elogG1 = g1->GetErrorY(j) / g1->GetPointY(j);
243 const double dlogG0 =
log(gainTarget) - logG0;
244 const double dlogG1 =
log(gainTarget) - logG1;
246 const double slope = (logG1 - logG0) / (logHV1 - logHV0);
248 const double HVnom =
exp(dlogG0 / slope + logHV0);
249 const double eHVnom = HVnom * sqrt(dlogG1 * dlogG1 * elogG0 * elogG0 +
250 dlogG0 * dlogG0 * elogG1 * elogG1) / fabs(slope * (logG1 - logG0));
252 const double distance = fabs((
log(HVnom) - logHV0) / (logHV0 - logHV1));
253 static const double maxDist = 2.0;
255 if (
checkHV(-HVnom) && distance < maxDist) {
259 g0->SetPoint (0, HVnom, gainTarget);
260 g0->SetPointError(0, eHVnom, 0.0);
then fatal No hydrophone data file $HYDROPHONE_TXT fi sort gr k
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
const bool checkHV(const double HV) const
Checks whether high-voltage is within range.
TGraphErrors * getData() const
Get graph with the input data for the interpolation.
const bool checkGain(const double gain) const
Checks if gain is within range.
then cat $TRIPOD_INITIAL<< EOF1 256877.5 4743716.7-2438.42 256815.5 4743395.0-2435.53 257096.2 4743636.0-2439.5EOFfiif[[!-f $DETECTOR]];then JEditDetector-a $DETECTOR_INITIAL-s"-1 addz -6.9"-o $DETECTOR--!eval`JPrintDetector-a $DETECTOR-O SUMMARY`for STRING in ${STRINGS[*]};do set_variable MODULE`getModule-a $DETECTOR-L"$STRING 0"`JEditDetector-a $DETECTOR-M"$MODULE setz -2.9"-o $DETECTOR--!donefiif[[!-f $TRIPOD]];then cp-p $TRIPOD_INITIAL $TRIPODfiJAcoustics.sh $DETECTOR_IDcat > acoustics_trigger_parameters txt<< EOFQ=0.0;TMax_s=0.020;quantile=0.9;numberOfHits=90;EOFJAcousticsEventBuilder.sh $DETECTOR $RUNS[*]INPUT_FILES=(`ls KM3NeT_ ${(l:8::0::0:) DETECTOR_ID}_0 *${^RUNS}_event.root`) cd $WORKDIRif[!$HOMEDIR-ef $WORKDIR];then cp-p $HOMEDIR/$DETECTOR $WORKDIR cp-p $HOMEDIR/$TRIPOD $WORKDIR cp-p $HOMEDIR/${^INPUT_FILES}$WORKDIR cp-p $HOMEDIR/{acoustics_fit_parameters, acoustics_trigger_parameters, disable, hydrophone, mechanics, sound_velocity, tripod, waveform}.txt $WORKDIRfisource $JPP_DIR/examples/JAcoustics/acoustics-fit-toolkit.shJConvertDetectorFormat-a $DETECTOR-o $HOMEDIR/detector_backup.datxJDetachPMTs-a $DETECTOR-o $DETECTORtimer_startinitialise stage_1B 0.002 0.1 0 > &stage log
const bool areValid(const Int_t i, const Int_t j) const
Checks whether two points are valid for inter-/extrapolation.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable STRING $argv[2] set_array QUANTILES set_variable FORMULA *[0] exp(-0.5 *(x-[1])*(x-[1])/([2]*[2]))" set_variable MODULE `getModule -a $DETECTOR -L "$STRING 0"` source JAcousticsToolkit.sh typeset -A TRIPODS get_tripods $WORKDIR/tripod.txt TRIPODS XMEAN
TGraphErrors * getResult() const
Get graph with the interpolation result.
Double_t g1(const Double_t x)
Function.