N-tuple Derived Quantity Functions (DQFs)

A Derived Quantity Function (DQF) is a function used to extract data from the Event Data Structure and store it in an n-tuple The DQFs appear as part of the entries in an NTPR Titles Bank For example, in the following NTPR entry:- rfit magnitude FTTV+1; the DQF is MAGNITUDE.

In the notes that follow Pi (P1, P2, P3 ...) denotes the ith parameter. The following DQFs are currently available:-

AND - Logical AND.
BITS - Bit extraction
BITS_10 - Decimal bit extraction
CCC_INFO - Card/Crate/Channel information.
CONFIG_INFO - - Summary Crate/Card/Channel information
COPY - Copy n words.
DATA_SPLITTER - Assign event to data set.
DIFFERENCE - Difference for real parameters.
DIRSUN - Direction of Sun.
DISTANCE - Distance between points.
DIVIDE - Divide two numbers.
DMM - Data Mask Access.
DMM_GET_EMASK - Data Mask Retrieval.
DOT - Vector dot product.
EQ - Logical EQual.
EQUALS - Sums real parameters.
FLOAT_DIFFERENCE - Difference for integers.
FLOAT_EQUALS - Sums integer parameters.
FLT_TEST - Call FLT Hardwired Test.
FT_UNC - Fitter Uncertainties.
GE - Logical Greater than or Equal to.
GET_LINK - Record Data Structure Link.
GET_MCGN - Locate MCGN associated with MCTK
GT - Logical Greater Than.
HALF_WORDS - Use to preserve bits.
IMPACT_PARAMETER - Closest approach to origin.
IN_LIST - Logical Value in List.
IN_RANGE - Logical Between limits.
LE - Logical Less than or Equal to.
LT - Logical Less Than.
JUMP* - Jump to Another Part of the N-tuple.
MAGNITUDE - Magnitude of vector.
MAP_CCC_LCN - Map Card/Crate/Channel -> Logical Channel No.
MAP_TO_PANEL - Map point to panel.
MAP_TO_PMT - Map point to PMT.
MCVX_BACKTRACK - Backtrack up a MCVX/TK Chain.
MULTIPLY - Multiply two numbers.
N_ON_NCD - Did a neutron capture in a NCD?
NCD_SCOPE_PEAK - Find peak on NCD scope
NE - Logical Not Equal.
NEUTRON - Did a neutron occur?
NEXT_BOU - Boundary distance.
NOT - Logical NOT.
NTIME - N-tuple time
NTIME_DIFFERENCE - N-tuple time difference.
NZBANK - Count banks in linear chain.
OR - Logical OR.
PMT_XYZ - PMT coordinates.
RECORD_NUMBER - Record number on input stream.
REGION_SERIAL - Region serial.
REGION_TYPE - Region type.
RESERVED - Just reserves variable.
RUN_TIME - Time since start of run.
SINGLE_DIFFERENCE - Difference for double precision.
SINGLE_EQUALS - Sums double precision parameters.
THETA_PHI - Vector angles.
TIME_DIFFERENCE - Time difference.
TRACK_EXTRAP - XYZ extrapolation of a line segment.
UNPACK_INTERACT - Unpack interaction code.


RESERVED - Just reserves variable.

Number of parameters: 1

RESERVED is used to reserve a word in an n-tuple without assigning it a value. It is often used in conjuction with a DQF that returns multiple values, for example THETA_PHI:-

thetaf theta_phi FTTT+1; phif reserved; THETA_PHI returns two values, the second of which is stored in phif.

EQUALS - Sums real parameters.

Number of parameters: 1 or more

EQUALS take a variable number of parameters, and sums them. Normally only one parameter is supplied and then the n-tuple value is just equal to the word in the data structure (hence the DQF name). E.g.

xe equals MCVX+3;

FLOAT_EQUALS - Sums integer parameters.

Number of parameters: 1 or more

FLOAT_EQUALS take a variable number of parameters, all of which are integer, floats and then sums them. Normally only one parameter is supplied and then the n-tuple value is just equal to the floated word in the data structure (hence the DQF name). E.g.

vx_cls float_equals MCVX+1; Don't use FLOAT_EQUALS for large integers; floating only preserves about 7 decimal digits of precision. For large integers use some other DQF such BITS.

SINGLE_EQUALS - Sums double precision parameters.

Number of parameters: 1 or more

SINGLE_EQUALS works on double precision values in an analogous way to FLOAT_EQUALS
. Use SINGLE_EQUALS to sum one or more double precision values P1... should be the addresses of the first word of the two word pair e.g. for the MCVX bank it should be KMCVX_TIM.

tgen single_equals MCVX+6;

DIFFERENCE - Difference for real parameters.

Number of parameters: 2

Computes the difference P1 - P2 between 2 real parameters P1, P2.

xdev difference FTTV+1, MCVX+3;

FLOAT_DIFFERENCE - Difference for integers.

Number of parameters: 2

FLOAT_DIFFERENCE takes two integer parameters P1,P2, floats them and computes the difference P1 - P2.

unused float_difference EV+11,FTT+4

SINGLE_DIFFERENCE - Difference for double precision.

Number of parameters: 2

SINGLE_DIFFERENCE takes two double precision parameters P1,P2, converts them to single precision and computes the difference P1 - P2.

d_time single_difference MCVX+6,MCVX-1-1+6

MAGNITUDE - Magnitude of vector.

Number of parameters: 1

MAGNITUDE computes the magnitude of a real 3 vector. P1 must be the address of the first word of the vector.

v_pos magnitude MCVX+3;

DISTANCE - Distance between points.

Number of parameters: 2

DISTANCE computes the distance between teo real 3 vector. P1 and P2 must be the addresses of the first words of the vectors.

rdev distance FTTV+1, MCVX+3;

THETA_PHI - Vector angles.

Number of parameters: 1, 2 or 3

THETA_PHI returns 2 variables so must be followed by a variable using the RESERVED function. The angles are relative to the right handed coordinate system defined the vectors U, V and W. The first angle is THETA --- the polar angle relative to W, and the second value is PHI --- the azimuthal angle relative to the U of the vector projected into the U V plane. The function has one compulsory parameter P1 and two optional parameters P2 and P3 which define the coordinate system as follows.

  1. If neither P2 nor P3 are defined then:-
         W  =  Z axis
         V  =  Y axis
         U  =  X axis
    
    This version is useful for looking at the absolute orientation of a vector. theta theta_phi MCTK+2; phi reserved;
  2. If P2 is defined but not P3 then:-
         W  = P2
         V  =  W cross product with X axis
         U  =  V cross product with  W
    
    This version is useful for looking at the orientation of one vector relative to another e.g. a track scatter: P1 is the outgoing track and P2 the incident one. theta theta_phi MCVX-2+2, MCVX-1+2; phi reserved;
  3. If both P2 and P3 are defined then:-
         W  = P2
         V  =  W cross product with P3
         U  =  V cross product with  W
    
    This version is useful for looking at tracks as they cross boundaries: P1 is the outgoing track, P2 is the boundary normal and P3 the incident. theta theta_phi MCVX-1+2,MCVX+12,MCVX-2+2; phi reserved;

DOT - Vector dot product.

Number of parameters: 2

DOT is the dot product of a real 3 vector. P1 must be the address of the first word of the vector.

ctheta dot MCVX-1+2,MCVX-2+2;

REGION_TYPE - Region type.

Number of parameters: 1 or 2

REGION_TYPE is used to extract region type number from an integer region code. Region codes are 7 digits long and so cannot be stored in a floating point word without loss of accuracy.

In the single argument form, the first arg. is the region code word e.g.:-

reg_1 region_type MCVX+$KMCVX_RGN; The two argument form should only be used with boundary MCVX banks and can be used to select the region code of either the lower priority region (if second arg is zero) or higher priority region (if second arg is non-zero). In this case the first arg. is the vertex itself e.g.:- reg_lo region_type MCVX,0; reg_hi region_type MCVX,1;

REGION_SERIAL - Region serial.

Number of parameters: 1

REGION_SERIAL is used to extract region serial number from an integer region code. Region codes are 7 digits long and so cannot be stored in a floating point word without loss of accuracy.

In the single argument form, the first arg. is the region code word e.g.:-

ser_1 region_serial MCVX+8; The two argument form should only be used with boundary MCVX banks and can be used to select the region code of either the lower priority region (if second arg is zero) or higher priority region (if second arg is non-zero). In this case the first arg. is the vertex itself e.g.:- ser_lo region_serial MCVX,0; ser_hi region_serial MCVX,1;

UNPACK_INTERACT - Unpack interaction code.

Number of parameters: 1

UNPACK_INTERACT returns 3 variables: ppp,ttt,ccc in that order, corresponding to the three parts of the interaction code stored in the MCVX bank.

int_ttt unpack_interact MCVX+2; int_ppp reserved; int_ccc reserved;

PMT_XYZ - PMT coordinates.

Number of parameters: 1

PMT_XYZ returns 3 variables; the X,Y and Z in detector space of a PMT whose number (which may be part of a region code) is P1

pmt_x pmt_xyz MCVX-3+1; pmt_y reserved; pmt_z reserved;

MAP_TO_PMT - Map point to PMT.

Number of parameters: 2

MAP_TO_PMT returns 3 variables; the X,Y and Z in PMT coordinate space space of a point whose detector space coordinates are P2. The number (which may be part of a region code) of the PMT being mapped to, is P1.

Note: The PMT coordinate system has the Z axis along the axis of symmetry pointing towards the front of the PMT. The origin is within the PMT, approximately 17cm below the front face of the concentrator.

x_l map_to_pmt MCVX-3+1, MCVX+3; y_l reserved; z_l reserved;

NEXT_BOU - Boundary distance.

Number of parameters: 1

NEXT_BOU is given the status word of an MCTK bank (i.e. MCTK+0 or MCVX-1+0 etc.). It uses the direction cosines from this MCTK bank and the position from the supporting MCVX bank to return the distance to the next boundary in the given direction. If status bit 1 of MCTK is set, i.e. the track does not come directly from its supporting vertex then NEXT\_BOU returns the undefined value.

dist next_bou MCTK+1;

HALF_WORDS - Use to preserve bits.

Number of parameters: 1

HALF_WORDS can be used as a way of transfering all bits intact to an ntuple e.g. if storing the seed. P1 is treated as a 32-bit unsigned bit pattern. The function returns 2 variables, the top half of P1 followed by the bottom half ofP2, both as 16-bit unsigned integers that have been converted to floating point.

top half_words MC+6; bottom reserved;

NZBANK - Count banks in linear chain.

Number of parameters: 1

NZBANK should be passed the address of a bank and will return the number of banks in the linear chain, including the starting bank.

num_mctk nzbank MCVX-1; Unlike other DQFs, if the address of the bank is 0, it will not be treated as an undefined parameter, so counting banks in an empty linear chain will give a zero.

MAP_TO_PANEL - Map point to panel.

Number of parameters: 2

MAP_TO_PANEL returns 3 variables; the X,Y and Z in panel coordinate space space of a point whose detector space coordinates are P2. The number (which may be part of a region code) of the panel being mapped to, is P1.

Note: The panel coordinate system is the local space as described in ge_panels.inc except that the origin is the panel centre, not the first hexagon.

reg_ser region_serial MCVX+$KMCVX_RGN: $PAN_ZONE$. $PAN_ZONE$.; x_l map_to_panel MCVX+$KMCVX_RGN, MCVX+$KMCVX_PSX; y_l reserved; z_l reserved;

TIME_DIFFERENCE - Time difference.

Number of parameters: 2

TIME_DIFFERENCE computes the time difference t1 - t2 between two absolute or relative times t1,t2. For example:-

d_tfit time_difference MCVX+$KMCVX_TIM,FTTV+$KFTXV_T; gives the time difference between the fitted time (from the time fitter) and a vertex time. This function passes its arguements as the first two arguments to the utility routine TIME_DIFFERENCE. Please consult that routine to see exactly what pairs of times can be compared and what assumptions are made when computing time differences.

AND - Logical AND.

Number of parameters: 1 or more

AND performs a logical AND of its parameters and returns true (1.) or false (0.).

_test_and and 0.,1.;

OR - Logical OR.

Number of parameters: 1 or more

OR performs a logical OR of its parameters and returns true (1.) or false (0.).

_test_or or 1.,0.;

NOT - Logical NOT.

Number of parameters: 1

NOT performs a logical NOT of its parameter and returns true (1.) or false (0.).

_test_not1 not _test1;

LT - Logical Less Than.

Number of parameters: 2

LT performs a logical Less Than and returns true (1.) if the first parameter is less than the second. Otherwise it returns false (0.).

_test_lt lt d_tfit,10.;

LE - Logical Less than or Equal to.

Number of parameters: 2

LE performs a logical Less than or Equal to and returns true (1.) if the first parameter is less than or equal to the second. Otherwise it returns false (0.).

_test_le le d_tfit,10.;

GT - Logical Greater Than.

Number of parameters: 2

GT performs a logical Greater Than and returns true (1.) if the first parameter is greater than the second. Otherwise it returns false (0.).

_test_gt gt d_tfit,10.;

GE - Logical Greater than or Equal to.

Number of parameters: 2

GE performs a logical Logical Greater than or Equal to and returns true (1.) if the first parameter is greater than or equal to the second. Otherwise it returns false (0.).

_test_ge d_tfit,10.;

EQ - Logical EQual.

Number of parameters: 2

EQ performs a logical EQual and returns true (1.) if the first parameter is equal to the second. Otherwise it returns false (0.).

_is_neutron eq MCVX-$KMCVX_MCTKI+$KMCTK_IDP, $neutron;

NE - Logical Not Equal.

Number of parameters: 2

NE performs a logical Not Equal and returns true (1.) if the first parameter is not equal to the second. Otherwise it returns false (0.).

_not_neutron ne MCVX-$KMCVX_MCTKI+$KMCTK_IDP, $neutron;

IN_RANGE - Logical Between limits.

Number of parameters: 3

IN_RANGE performs a logical between limits and returns true (1.) if the second parameter is greater than or equal to the first and less than or equal to the third. Otherwise it returns false (0.).

_test_in_acryl in_range 600.,rdev,605.;

BITS - Bit extraction

Number of parameters: 3

BITS extracts P3 bits, starting at bit P2, from the integer parameter P1. The bit numbering convention has bit 0 as the least significant bit. The resulting set of bits are treated as an integer and floated.

_is_creation bits MCVX+0,$KMCVX_CRE,1; In the above example, 1 bit, starting at bit KMCVX_CRE, of the status word of the MCVX is extracted.

NTIME - N-tuple time

Number of parameters: 1 or 2

NTIME returns 4 variable N-tuple time. If one parameter is supplied it should be the address of a Universal Date Stamp, for example:-

' time_jdy ntime EV+$KEV_JDY; ' ' time_sc reserved ; ' ' time_msc reserved ; ' ' time_nsc reserved ; ' and NTIME returns:- If two parameters are supplied the first should be the Global trigger time and the second parameter is a dummy (just used to signal that the 50MHz clock is being used). For example:- ' time_jdy ntime EV+$KEV_GTR,0; ' ' time_sc reserved ; ' ' time_msc reserved ; ' ' time_nsc reserved ; ' In this case NTIME returns:- This second form can be useful when analysing some of the early data, if the 10MHz clock was not running. The format can be recognised as the first word is negative. It is a minus the processed event number and can be used to provide protection against one rollover; assuming that events are processed in time order. NTIME_DIFFERENCE can accepts both formats, but they must not be mixed within a single call.

NTIME_DIFFERENCE - N-tuple time difference.

Number of parameters: 2

NTIME_DIFFERENCE computes the nsec time difference between 2 n-tuple times (see NTIME. For example:-

' dtime ntime_difference time_jdy_1, time_jdy_2; '

DIRSUN - Direction of Sun.

Number of parameters: 1

DIRSUN returns the direction of the Sun in detector coordinates ( x=East, y=North, z=zenith ) at a given time. For example:-

' drxsun dirsun EV+$KEV_JDY; ' ' drysun reserved; ' ' drzsun reserved; '

COPY - Copy n words.

Number of parameters: 1, 2 or 3

COPY transfer a set of words directly into another part of the DQF. The general form is:-

' _ copy _my_data, ' ' source, ' ' num_words; ' where COPY simply copies words from the specified source; it does not know the type of this data, so cannot convert from integer to floating point; it is your responsibility not to end up with integers in the n-tuple. However literal parameters are converted when the command is compiled so, for example:- ' _ copy _my_data, 1; ' will store 1.0 in _my_data. As all DQF's have to return values, COPY dutifully returns 1.0, which you unlikely to want; its the side effect of updating its first parameter that is of interest. Note the COPY won't operate if any of its parameters are undefined, and this includes its first parameter.

It can also be used to form simple counters, exploiting the fact that the EQUALS DQF sums its parameters if more than one:-

' counter equals 0. ' #. #. #. ' _ equals counter, 1.; ' ' _ copy counter; ' The first line clears the counter to zero. Later, counter plus 1. are summed and stored in an unnamed entry. The following COPY has only a single parameter so takes as its source the previous word and copies it into counter.

GET_LINK - Record Data Structure Link.

Number of parameters: 1 or 2

GET_LINK stores a data structure link. For example:-

' _my_vx get_link mcpm-$KMCPM_MCVX; ' GET_LINK takes an argument that is the link which you want to save. GET_LINK does not return the data the link points to but instead returns the link itself. As this won't be useful once the n-tuple is output, it is treated as a temporary variable, even if you don't use an underscore as the first character of it name. Although you really don't want to know, GET_LINK actually saves the link in a special link area, so that it is protected against memory relocation, and in fact only stores a 1. in the value. The only reason to use this DQF is to access the link subsequently, for example:- ' revent magnitude _my_vx+$KMCVX_PSX; ' This results in the link being retrieved and used as if _my_vx was the scanned point. The GET_LINK DQF can also update a link word if it is supplied as the second, optional argument. For example, if _my_pmt is a link to a PMT bank, then:- ' _ get_link _my_pmt-0, _my_pmt; ' will follow the 0 link (i.e. next PMT) and store it back in _my_pmt. When using GET_LINK like this you probably won't want its primary output, so the dummy name _ comes in handy.

The primary use of GET_LINK is to prepare a link for MCVX_BACKTRACK


GET_MCGN - Locate MCGN associated with MCTK

Number of parameters: 1

GET_MCGN attemps to locate the MCGN associated with a given MCTK:-

' _my_mcgn get_mcgn mctk; ' GET_MCGN takes an argument that is the link to the MCTK whose associated MCGN you want to find. Like GET_LINK, GET_MCGN does not return the data the link points to but instead returns the link itself. If there is no associated MCGN, the link is set to the undefined value.

For example, to get the MC radiative corrections for an electron:-

' _my_mcgn get_mcgn mctk; ' ' rc_tot equals _my_mcgn+KMCGN_RADCOR_XTOT; ' ' rc_dif equals _my_mcgn+KMCGN_RADCOR_XDIF; '

MCVX_BACKTRACK - Backtrack up a MCVX/TK Chain.

Number of parameters: 2 or more.

The MCVX_BACKTRACK DQF is used to backtrack from an MCVX through its incident track link to an MCTK and hence to the MCVX that produced it. Here it applies a test, which if failed, causes the backtrack to repeat. In this way the track producing the initial MCVX can, if required, be backtracked to its source. The DQF is used as follows:-

' _my_tk mcvx_backtrack _my_vx, ' ' vertex_class, ' ' test_type, ' ' test_args; ' where:-

A Word of Caution

When backtracking there may be more than one starting MCVX that leads back to the same required point. This could lead to double counting if you scan the data structure and start the backtrack search from every MCVX. One way to reduce the risk is to place a cut on scanning and only select sink vertices; that way you know you are starting with a different track each time. Of course, even that won't prevent double counting if you backtrack far enough. If you backtrack all the way back to the source vertex then every track that it produced directly or indirectly, will lead back to it! So think carefully about what you want to do.

JUMP* - Jump to Another Part of the N-tuple.

Number of parameters: 1 or 2.

There are 4: JUMP, JUMP_TRUE, JUMP_FALSE and JUMP_UNDEFINED. JUMP jumps uncoditionally, the remainder are supplied with a test and if the test condition is satisfied, jump. After jumping to another part of the n-tuple entry, filling continues from there. They are used as follows:-

' _ dqf_name relative_offset, ' ' test_value; ' where:- ' _ gt ev, $KEV_NPM,60; ' ' - jump_true _big_event; ' It is recommended that, when using entries as labels for jumps they be reserved just for the purpose i.e. not used to store data. The following construction:- ' _my_label: ' is treated as shorthand for:- ' _my_label reserved; ' and helps to make labels stand out.

The primary use of the JUMP DQFs is to allow fine tuning of the DQF MCVX_BACKTRACK For example, suppose you wish to backtrack from a scanned point MCVX to the first upstream interaction vertex which has its creation bit (KMCVX_CRE) set. This could be done as follows:-

' _my_vx get_link MCVX; ' ' _my_tk mcvx_backtrack _my_vx, $KMCVX_INT; ' ' _is_creation bits _my_vx, $KMCVX_CRE, 1; ' ' _ jump_false _my_tk, _is_creation; ' The first two lines define the link _my_vx to be equal to the scan point MCVX and then passes it to MCVX_BACKTRACK requiring that it backtracks to the first interaction that it encounters. On return _my_vx now points to the MCVX it has found. Next the BITS DQF is used to pull out the creation bit setting from its status word. Finally the JUMP_FALSE DQF is called using the setting of this bit. If it is zero i.e. false, the test succeeds, and the jump back to the _my_tk entry occurs. So MCVX_BACKTRACK is now called again and starts by stepping back one vertex, before resuming backtracking.

CCC_INFO - Card/Crate/Channel info.

Number of parameters: 2 or 3

This is an interface to the CCC_INFO function in SNOMAN and is used to retrieve information on a particular CCC DAQ Circuit Number. The first argument specifies the type of information required:-

Mnemonic Data returned 1 $CCC_THRESH 8-bit discriminator setting 5 $CCC_THRESH_ZERO 8-bit discriminator zero 3 $CCC_STATUS 4 byte status. See ccc_info.for. 6 $CCC_HV 8-bit high voltage. 7 $CCC_TUBE_ON_LINE = 0 if PMT offline, = 1 if on-line 8 $CCC_CHAN_ON_LINE = 0 if channel offline, = 1 if on-line The second argument is the CCC number. The undefined value is returned if the information is not available.

Example:-

' thresh ccc_info $CCC_THRESH, pmt+$KPMT_PIN; ' ' thresh_z ccc_info $CCC_THRESH_ZERO, pmt+$KPMT_PIN; ' ' status ccc_info $CCC_STATUS, pmt+$KPMT_PIN; ' ' hv ccc_info $CCC_HV, pmt+$KPMT_PIN; ' ' tube_ok ccc_info $CCC_TUBE_ON_LINE, pmt+$KPMT_PIN; ' ' chan_ok ccc_info $CCC_CHAN_ON_LINE, pmt+$KPMT_PIN; ' The full status returned by CCC_STATUS is 4 bytes long and hence cannot be converted to floating without precision loss, so only one byte is returned. By default this is byte 0, the crate byte, although others can be selected by supplying a third parameter. Example:- ' cra_stat ccc_info $CCC_STATUS, pmt+$KPMT_PIN, 0; ' ' car_stat ccc_info $CCC_STATUS, pmt+$KPMT_PIN, 1; ' ' cha_stat ccc_info $CCC_STATUS, pmt+$KPMT_PIN, 2; ' ' pmt_stat ccc_info $CCC_STATUS, pmt+$KPMT_PIN, 3; '

IN_LIST - Logical Value in List.

Number of parameters: 2 or 3.

This function will return a '1.' if the value given by the first parameter is contained in a list pointed to by the second. If only 2 parameters are given, then the second should be a link to a titles bank that contains the list:-

' pmt_sel in_list PMT+$KPMT_PIN, USER.1; ' or ' ev_sel in_list EV+$KEV_GTR_ID, USER.1; ' The length of the list will be inferred from the bank size. You can invent any new titles bank to contain your list - the NTP processor will automatically request management for it. You just need to create a titles file containing the bank (including database header) and load it in with the titles command. If the first parameter is an integer then the titles bank should also contain integers, and likewise for floating point numbers.

The usage with 3 parameters is more general. The second parameter points to the first word of the list, and the third gives the length (it should be floating point). Eg:-

' pmt_sel in_list PMT+$KPMT_PIN, USER.1+10, USER.1+1; ' where in this example, the first word of the USER bank contains the length of the list starting at word 10.

RECORD_NUMBER - Record number on input stream.

Number of parameters: 0

RECORD_NUMBER returns the total number of records from all files (in parallel or concatenated) that have been returned by the input processor so far. It can be useful when tracking down problems in the data. Once the record number is known, the SKIP option on the FILE command can be used to quickly retrieve the event. E.g.:-

' rec_no record_number ; '
Go Back to the Snoman Companion Top Page


FLT_TEST - Call FLT Hardwired Test.

Number of parameters: 1

FLT_TEST performs the Event Filter (FLT) hardwired test supplied as parameter 1 See the Event Filter section of the Iser Manual. Note: all hardwired tests are negative.


MULTIPLY - Multiply two numbers.

Number of parameters: 2

MULTIPLY simply multiples its two parameters. For example:-

' six multiply 2., 3.; '

NCD_SCOPE_PEAK - Find peak on NCD scope

Number of parameters: 1

Given a link to an NEMS bank, NCD_SCOPE_PEAK finds the widest negative peak "above" background. It does a very simplistic estimate of the height, width and centre as well as computing the background height and RMS. If no peak is found, the peak parameters are set to zero. Example:-

' pk_ht ncd_scope_peak NEMS; ' ' pk_wid reserved; ' ' pk_cen reserved; ' ' bg_ht reserved; ' ' bg_rms reserved; '

RUN_TIME - Time since start of run.

Number of parameters: 0 or 1

RUN_TIME returns the time since the start of the run in seconds. It uses the routine RUN_TIME

' run_time run_time; ' By default is stores the number in single precision, but supplying a parameter, whose value is immaterial, it produces a double precision result:- ' run_time run_time, 1; ' ' Run_tim2 reserved; ' This is not generally useful in an n-tuple, as PAW only knows about single precision floating point numbers in row-wise n-tuples, but is used by the Random Access Analyser RAA.

MAP_CCC_LCN - Map Card/Crate/Channel -> Logical Channel No.

Number of parameters: 1

MAP_CCC_LCN returns the Logical Channel Number (LCN = Crate/Card/Channel) for a given CCC (Card/Crate/Channel). E.g.:-

' lcn map_ccc_lcn PMT+$KPMT_PIN; '
Go Back to the Snoman Companion Top Page


IMPACT_PARAMETER - Closest approach to origin.

Number of parameters: 2

IMPACT_PARAMETER returns the radius of the point on a line closest to the origin. The first parameter must be a point X,Y,Z and the second parameter must be a vector U,V,W of direction cosines. E.g.:-

' impct_p impact_parameter MCVX+$KMCVX_PSX, MCTK+$KMCTK_DRX; ' For this example, this will give a measure of the asymettry of the Cherenkov cone for the particle given in the MCVX bank. A large impact parameter means the cone is skewed; a small impact parameter means the hit pattern should be circular. This is useful number for things like muon tracks, where the impact parameter is the only parameter that can break spherical symmetry.

TRACK_EXTRAP - XYZ extrapolation of a line segment.

Number of parameters: 2 or 3

TRACK_EXTRAP extrapolates a vertex and track direction to give the XYZ components of the line segment at a given radius from the origin. The first parameter must be a point X,Y,Z and the second parameter must be a vector U,V,W of direction cosines. The third parameter is optional; if left unspecified, the point is at the minimum radius (the impact parameter). E.g.:-

' shell_x track_extrap MCVX+$KMCVX_PSX, MCTK+$KMCTK_DRX 900; ' ' shell_y reserved; ' ' shell_z reserved; ' This will give the X,Y,Z coordinates of a point along the track direction with a distance 900 cm from the origin. This is useful for finding things like the position a high-energy muon leaves a spherical region (assuming a straight track), given only it's intial vertex.

DMM - Data Mask Access.

Number of parameters: 1, 2 or 3

DMM gives access to DAMN and DARN data masks. P1 is always the mask number and uses the following convention:-

mask number = 0 => DAMN mask 0 mask number = i > 0 => DARN mask i mask number = j < 0 => DAMN mask -j One two or three parameters can be used:-
  1. DMM P1

    Return 1.0 if any bit in mask P1 is on. For example:- 'test dmm 2; ' Return 1.0 if any bit on the DARN bank 2 mask is set.

  2. DMM P1,P2

    Return 1.0 if any of bits set in P2 is set for the mask P1. For example:- 'test dmm 0,7; ' Return 1.0 if any of bits 0, 1 or 2 of the DAMN bank 0 is set.

  3. DMM P1,P2,P3

    Perform the operation defined by P3 on mask P1 using the bits selected in P2 operation = action*100 + value action = 0 OR test of selected bits against value = 1 AND test of selected bits against value = 2 SET selected bits to value value = 0 0 (false) = 1 1 (true) = 2 (undefined) = 10 not 0 (not allowed for SET) = 11 not 1 ( " " " " ) = 12 not 2 ( " " " " ) Examples:- 'test dmm 0,12,111; ' Return 1. if bits 2 and 3 of DAMN bank 0 are both not 1 (either 0 or undefined). 'test dmm 3,5,201; ' Set bits 0 and 2 of DARN 3 mask to 1. Return 1. When DMM is used to set bits it always returns 1.


DMM_GET_EMASK - Data Mask Retrieval.

Number of parameters: 1

DMM_GET_EMASK retrieves the full 32 bits of a DAMN or DARN data mask. P1 is always the mask number and uses the following convention:-

mask number = 0 => DAMN mask 0 mask number = i > 0 => DARN mask i mask number = j < 0 => DAMN mask -j The function returns a pair of masks:- As n-tuples cannot hold full 32-bit precision integers, the function splits each mask into two in the same way as HALF_WORDS. For example:- ' app_top dmm_get_emask 0; ' ' app_bot reserved; ' ' res_top reserved; ' ' res_bit reserved; ' retrieves the DAMN mask 0.

DIVIDE - Divide two numbers.

Number of parameters: 2

DIVIDE simply divides its first parameter by its second. For example:-

' two divide 6., 3.; ' If the absolute value of the result exceeds 1.e+30 the result is set undefined.

FT_UNC - Fitter Uncertainties.

Number of parameters: 1

FT_UNC takes the fitter vertex bank as the argument. The fitter vertex bank contains 10 variables which define the covariance matrix. This dqf finds the track supported by the fit vertex and evaluates the uncertainty in the fit along the direction of the fit. The second variable returned is a crude average perpendicular to the fit direction. (The value of sigma squared in two orthogaonal but arbitrary directions perpendicular to the fit are averaged. Then the square root is taken.) Please keep in mind that the parallel uncertainty is very well defined but the perpendicular isn't. For example:-

par ft_unc fttv; perp reserved

If there is no fit direction (ie no ftxt) then the dqf will return undefined, so it will not bomb the code if used with the quad fitter for example. If the covariance matrix is not defined by the fitter, then the result will be unpredicatble. (It will not be zero unless the ftxv bank is lifted with initialization to zero of bank contents; it is up to fitter authors to define this.)

Currently only FTT supports this option, although it would be straight-foward to add to any time-based fitter.


DATA_SPLITTER - Assign Event to a Data Set.

Number of parameters: 0 or 1

DATA_SPLITTER takes as an argument the number of sets the user wishes the data split into (with no argument this number defaults to 3). Therefore

' data_set data_splitter 3; ' is equivalent to ' data_set data_splitter; ' The DQF returns an integer indicating to which data set the current event belongs. For example a user defined filter that splits the data into 3 sets and only allows events in data set 1 to pass would look like this:- $enable_test 1 $define_test 1 $no_scan $define_test 1 $line_1 'data_set data_splitter 3; ' $define_test 1 $line_2 'test eq data_set,1.; ' Assuming that the user (or default) has specified that the data should be split into 3 sets then the code works in the following way:-

First the code grabs the time stamp of the current event, then, using the start and end times of the current run, it splits the runs into 3 consecutive time bins and works out which time bin the current event sits in. There then follows a mapping from time bin to data set. Currently the algorithm for doing this is to add the run number to the time bin and call the result "shifted bin" and then to calculate 1 + MOD(shifted_bin, 3). The result of this is the data set to which the current event has been assigned.

The time bins do get pseudorandomly rearranged into data sets, but in such a way that consecutive run numbers just have their time bins cyclically permuted by one step relative to each other. This could be changed in future if it is not considered sufficiently random. The important point is that the mapping is deterministic - an event assigned to data set 2 by a SNOMAN run will always be assigned to data set 2 by any other SNOMAN job.


BITS_10 - Decimal bit extraction

Number of parameters: 3

BITS_10 extracts P3 decimal "bits" (i.e. digits), starting at digit P2, from the integer parameter P1. The numbering convention has digit 0 as the least significant digit. The resulting set of digits are treated as an integer and floated.

' year bits_10 EV+$KEV_DTE,4,4; ' ' month bits_10 EV+$KEV_DTE,2,2; ' ' day bits_10 EV+$KEV_DTE,0,2; ' In the above example the year, month and day are extracted from EV's local date stamp.

CONFIG_INFO - Summary Crate/Card/Channel information

Number of parameters: 0

This function returns summary information on the detector configuration from the DQXX banks. The information is returned as an 6-element array of real values:

Element Description 1 # of crates operational (operational == present, receiving GTs, online, and HV .ne. 0) 2 # of slots operational (operational == crate, MB, PMTICs, DCs all present, eCPU readout enabled, relays all on) 3 # of relays on 4 # of channels with 100ns trigger enabled 5 # of channels with sequencer enabled 6 # of channels with HV on (HV on == PMTIC channel resistor present and relay on and crate HV .ne. 0) Example of use as part of an ntuple definition: #. Variable Function Parameter(s) #. Name #. ' ncrates config_info; ' ' nslots reserved;' ' nrelays reserved;' ' n100ns reserved;' ' nseq reserved;' ' nch_hvon reserved;' ' END_OF_NTUPLE; ' #. This marks the end of the ntuple. Note, if number of crates operational is zero, the rest of the values default to zero. A likely cause of this condition is if the correct DQXX bank is not found in the database.

NEUTRON - Did a Neutron Occur?

Number of parameters: 0

This function returns 1 if a neutron was created during event generation and 0 otherwise. This is particularly useful for low energy background analyses and appears in the standard ntuples.

Note this function only operates on Monte Carlo data and will not unfortunately tell you if a real event contains a neutron or not.


N_ON_NCD - Did a neutron capture in a NCD?

Number of parameters: 0

This function returns 1 if a neutron captured within NCD and 0 otherwise. More specifically, it loops through all vertices and checks whether within a live volume an (n,p) process (328) occured.

Note this function only operates on Monte Carlo data and will not unfortunately tell you if a real neutron capture on an NCD or not.


Go Back to the Snoman Companion Top Page