NPOL Analysis Program for E93-038
Version 2.4
Purpose:
Our version of the Hall C engine analyzes HMS data and
produces an ntuple containing analyzed HMS variables plus raw NPOL
variables. The program npol_calculations.exe analyzes the NPOL data and
performs kinematic calculations, producing an expanded ntuple. This
document provides brief instructions for using the program and some sample
results. A more formal report describing the calculations in more detail
will be provided later.
Event Classification
Kinematic calculations depend upon reconstruction of
tracks for the events of interest. Although the simplest events contain a
single hit in the front and rear arrays, most events are more complicated.
The steps of the reconstruction process are summarized below.
- The first step in the procedure is to evaluate mean pulse
height, mean time, and position for every hit comprising an event. A
filtering procedure then discards hits which fall below software pulse-height
thresholds, or reconstruct to positions significantly outside physical
detectors, or fall outside time windows suitable for quasifree knockout and
subsequent flight through the polarimeter.
- During the filtering process we
attempt to ascertain which hit produced the trigger, even if that hit fails one
of the selection criteria.
- The next step is to group the remaining hits
into recognizable patterns. A cluster in the front array is defined as a set of hits
that are close in both time and position and which contain no missing layers. We
assume that the first nuclear interaction occurs within the layer closest to the
target containing hits. If that layer contains several hits, we assign the
nuclear interaction either to the top or the bottom hit by determining
whether the nucleon scatters upward or downward. An error condition is
set if the first layer contains a noncontiguous set of detectors because
such gaps may indicate an accidental spoils the reconstruction.
- If there is a second cluster in the front array, we determine whether the
nucleon scatters upward or downward using hits in the rear array. We
then decide whether the first scattering was upward or downward by
comparison with the first cluster. Note, however, that is difficult to
analyze multiple scattering of the projectile within the front array and
there is considerable room for improvement of this algorithm.
Fortunately, the frequency of such events is small enough that they can be
discarded without significant loss of statistics.
- We then look for a
hit in the rear tagger along the chosen track; if one is present within a specified
distance the particle detected in the rear is assigned positive charge. If
both top and bottom rear subarrays contain filtered hits and it is not
possible to choose the most probable track unambiguously, an error condition
is set.
The following table summarizes the track
reconstruction error conditions.
|
p_error |
explanation |
| 0 |
no reconstruction errors |
| 1 |
no hits remain after filtering |
| 2 |
no hits remain in the front array after filtering |
| 3 |
no hits remain in the rear array after filtering |
| 4 |
gap in first layer of first cluster in front array |
| 5 |
gap in first layer of second cluster in front array |
| 6 |
gaps within both first layers |
| 7 |
ambiguity in selecting rear hit |
| 8 |
unphysical kinematics |
| 9 |
inconsistent detector numbers or multiplicities |
| 10 |
incident charged particle with a missing layer in front
array |
The following table describes the tracking information contained in the
output ntuple.
| variable |
explanation |
| p_error |
an error code for the track reconstruction |
| p_gfr |
number of hits in front array after filtering |
| p_gtop |
number of hits in top rear array after filtering |
| p_gbot |
number of hits in bottom rear array after filtering |
| p_gvt |
number of hits in front tagger after filtering |
| p_gtg |
number of hits in rear tagger after filtering |
| p_idtrig |
detector ID with hit causing trigger |
| p_ncl1 |
number of hits within the first cluster in the front array |
| p_ncl2 |
number of hits within the second cluster in the front array |
| p_idfront |
detector ID for primary neutron scattering |
| p_idlast |
detector ID for second neutron scattering in front array |
| p_zfr |
charge for the incident particle (0 or 1) |
| p_zre |
charge for the track chosen in the rear array |
| p_idrear |
detector hit for hit track selected in rear array |
| p_rveto |
distance (cm) between track and nearest filtered hit in
front tagger |
| p_rtag |
distance (cm) between track and nearest filtered hit in rear
tagger |
Instructions
Requirements:
The program is presently installed in the directory /u/group/e93038/Analyzer2.4/KinematicCalculation/npol_calculations.exe.
The following environment variables must be established by the script that runs
the program.
| environment variable |
sample file |
explanation |
| detector_geometry |
pgeom_detector.dat |
parameter file specifying the physical locations of each detector |
| ph_calibration |
phcalib.dat |
parameter file containing pulse-height calibration data |
| time_calibration |
|
parameter file containing time calibration data |
| tracking_cuts |
tracking_cuts_kin1.dat |
describes the cuts used for classifying events |
| pass1_directory |
/w/work406/e93038/ntuple |
directory containing ntuple files produced by engine |
| pass2_directory |
/w/work304/e93038b/ntuple2.4 |
directory containing ntuple files produced by engine |
| output_directory |
/w/work304/e93038b/ntuple2.4 |
directory for output files |
| run_number |
$1 |
5-digit run number |
| target |
$2 |
deuteron or proton for LD2 or LH2
targets |
| calibration_number |
$3 |
5-digit run number for calibration file |
A sample script, do_npol_calculations, has been provided. It
uses the sample files and directory names listed above. The program
assumes that data are stored in ntuples with names of the form polraw#####_n.rzdat
where ##### denotes the 5-digit run_number and n is an
index for members of an ntuple chain belonging to a particular run. Output ntuples are written to
files named pol#####_n.paw. In addition, a journal file, pol#####.log,
is produced.
Instructions:
- Use source setup_analyzer to establish and verify the required
environment variables.
- Examine the raw data and adjust the tracking cuts as needed.
- The program is launched by the command: do_npol_calculations
run_number target calibration_number where you must supply the
appropriate run number and target (deuteron or proton) values. Time
calibration parameters are read from a file named time_#####.dat
where ##### is a 5-digit calibration_number for a nearby run
used for calibration.
- Examine the output ntuple. The auxiliary program basic_histograms
produces an hbook file containing various diagnostic and physics
histograms. The auxiliary program check_detectors produces a
more extensive set of diagnostic histograms useful for evaluating the
performance of each detector. PAW kumacs for displaying these results
are available.
Limitations:
- Kinematic calculations do not account for the energy loss suffered by
protons passing through the lead sheets or the detector elements.
- The analysis does not account for bending of proton trajectories in
Charybdis.
- Compatibility with earlier versions requires that events be limited to 62
hits even though there are 70 detectors, but this limitation is benign
because such high multiplicities should never be seen if the data
acquisition is working properly.
Auxiliary programs
A couple of simple programs for producing useful
histograms from the output ntuple have been provided, together with sample
kumacs for display purposes.
basic_histograms
The program basic_histograms found in subdirectory BasicHistograms
produces an hbook file containing many histograms that are useful for evaluating
the quality of the data. The program is launched by the command make_histograms
run_number. The paw kumac basic_histograms.kumac can then be
used to display the histograms. The file histo_38295.ps
contains a set of figures based upon run 38295. Below we provide a brief description of the pages.
- Mean pulse height spectra for front, rear, front tagger, and rear
tagger arrays. No cuts were applied. Calibrations of the front
and rear arrays were used to convert ADC channels to MeVee. The
spectrum for the rear array includes a structure beyond 60 MeVee arising
from ADC overflow.
- The position spectra for the front and rear arrays show sharp edges
defined by the sizes of these detectors. Constant-fraction
discrimination gives these detectors have relatively good position
resolution. Positions in the taggers were calibrated by comparing
tracks with the nearest hit in the front array, but the resolution with
leading-edge discrimination is relatively poor giving these spectra a more
Gaussian appearance. The width of these spectra is significantly less
than the size of the detectors, which are not completely illuminated.
- The mean-time spectum for the front array shows a dominant peak
produced by the primary scattering event centered at zero, followed by
secondary peaks arising from multiple scattering of the recoil proton,
superimposed upon an uncorrelated background. Although no cuts were
applied to this spectrum, it is clear that track reconstruction can safely
disregard hits outside a (-5,+10) ns window. The peak in the rear array
corresponds to quasielastic scattering between the front and rear arrays. Early hits can be
eliminated using a window (-10, 25) ns. The
front tagger also displays a quasifree proton peak superimposed upon an
uncorrelated background. Offsets were chosen to place the proton peak
in the rear array at zero also. Thus, initial and final protons can be
eliminated using a (-12 ns, +5 ns) cut.
- The trigger time spectrum shows a 0.5 ns resolution for
reconstruction of the trigger time. The error spectrum shows
that the most common tracking problem is exclusion of all rear hits, usually
because the rear hit occurs too early to arise from a valid track.
- The rveto spectrum of distances between the incoming track and the
nearest hit in the front tagger contains a relatively narrow distribution
superimposed upon a flatter distribution, with a significant change in slope
at about 30 cm which is related to the position resolution for the tagger
array. Therefore, we identify tracks with front tagger hits within 30
cm and within the time window as charged particles and disregard front
tagger hits at larger distance or inappropriate time. The rtag
spectrum is essentially featureless because recoil protons are widely
distributed in angle and originate anywhere along the track.
Nevertheless, we use the same proximity conditions to identify a charged
track from front to rear, arguing that similar position resolution is
expected.
- Hit frequencies are shown by detector number and by array.
- Filtered hits shows multiplicities after application of filtering
conditions.
- The raw tof spectrum is simply ph_start converted to
ns. The upper right spectrum shows the path-length correction to the
electron time of flight. The tof spectrum includes offset and
trigger-delay corrections for the neutron arm. The ctof
spectrum subtracts the calculated flight time for a d(e,e'n) reaction
and, hence, should be centered at zero. This spectrum selects neutrons
without track reconstruction errors and includes HMS particle-identification
cuts (see item 10). We then obtain FWHM about 2 ns. The tail on the right
side might include neutrons from the d(e,e'p)(p,n), which are
expected to be late because of proton energy loss in various materials.
- The front-to-rear velocity spectra require neutrals in front and rear, HMS
particle identification, and include a ±2 ns cut on ctof.. The velocity ratio
compares the measured velocity to that for the p(n,n)p reaction at
the same scattering angle and shows a strong quasifree peak.
- Electron particle identification (PID) spectra include the Cerenkov signal
converted to number of photo-electrons (npe), total energy in the show
detector, velocity, and chi-square for track reconstruction. Spectra
here that include electron PID require >2 photo-electrons, >1 GeV in
the shower detector, and 0.7<beta<1.3.
- HMS focal-plane variables. Some neutron spectra include a cut on
|delta|<4.
- Target variables reconstructed using HMS optics. Some neutron
spectra include a |z|<7 cm cut on the vertex position.
- Momentum transfer variables.
- Electron scattering angles, invariant mass, and virtuality.
- theta_nq and phi_nq are neutron polar and azimuthal angles
relative to the momentum transfer, while theta_sc and phi_sc are
polar and azimuthal scattering angles. These spectra require neutrals
in front and rear, electron PID and delta cuts, and a tight ctof cut.
- Components of missing momentum, total missing momentum energy, and mass.
Note that the missing mass is sharp because the neutron momentum is computed
from the electron scattering kinematics and neutron angle; this calculation
does not use the time of flight.
check_detectors
The program check_detectors, found in subdirectory CheckDetectors,
produces an hbook file containing many histograms useful for evaluating the
performance of each detector. Sample scripts for running the program and
displaying the histograms using PAW may be found in the Samples subdirectory.
Sample output is contained in check_38295.ps.
The program reads parameters for event selection from a
file, identified as check_detectors.cuts in the sample script. The
sample input file includes comments identifying these cuts. The table
below lists the available cuts, the parameters chosen by the sample file for Q2=1.5
(GeV/c)2, and the histograms affected by those
cuts. Some cuts are defined by either a minimum or maximum value, but most
cuts require both. All histograms are subject to electron PID cuts.
Spectra for the front array array require p_zfr=0; spectra for the rear
array require p_zfr=0.and.p_zre=0; spectra for the front and rear tagger
arrays require p_nvt>1. These choices of charge are hardwired
and were chosen to emphasize the performance for (n,n') events of
greatest interest to GEn.
| quantity |
variable |
minimum |
maximum |
affected histograms |
| number of Cerenkov photoelectrons |
h_cer_npe |
2.0 |
|
all |
| energy in shower detector (GeV) |
hs_track_et |
1.6 |
|
all |
| HMS chisquare |
hs_chi2 |
|
50.0 |
all |
| HMS delta (%) |
hms_delta |
-3.0 |
10.0 |
all |
| electron beta |
hs_beta |
0.7 |
1.3 |
all |
| target position (cm) |
hs_zbeam |
-7.0 |
7.0 |
all |
| coincidence time (ns) |
p_ctof |
-2.0 |
2.0 |
rear array, dtof, rtof |
Some additional cuts are inherited from the filtering
performed by npol_calculations. Only events with p_error=0
are histogrammed by check_detectors. Therefore, there must be at
least one hit in both front array and rear arrays satisfying the position and
time filters. The tracking algorithms in npol_calculations attempt
to identify the hit in the front array representing the primary neutron
scattering event, called idfront, and the hit in the rear array, called idrear,
representing detection of the scattered neutron. Spectra for individual
detectors in the front or rear arrays are sorted by either idfront or idrear,
discarding secondary hits due to recoil protons or rescattering.
Self-timing peaks are sorted by idtrig, which is the hit believed to be
responsible for the trigger, which need not be the same as idfront.
Therefore, these spectra retain multiple-hit events while testing the tracking
algorithms.
A brief description of some of the output pages follows.
- Position spectra for each array include all hits subject only to the
charge selection and electron PID cuts above.
- Mean-time spectra for each array include all hits subject to charge
selection and electron PID cuts. The restriction on the front
mean-time is a result of filtering.
- The dtof spectra for the top and bottom rear arrays include a ctof
cut that emphasizes the quasifree neutron scattering events.
- Position spectra for the primary neutron scattering event in the front
array are all very similar, with sharply defined edges at the borders of the
physical detectors. Some affect of attenuation is apparent in deeper
layers.
- Position spectra in the rear arrays follow a fairly simple pattern.
The outer detecters in each layer have more strength because they are
wider. The positive slopes arise from the forward-peaked angular
distribution for neutron scattering (positive x is toward the back of
the detector). This slope is smaller for inner than for outer
layers. The requirement on ctof and (n,n') limit the
statistics in these spectra.
- Position spectra for the front tagger are all very similar. Position
spectra for the rear tagger are also similar to each other, with outer
detectors being a little weaker.
- Mean-time spectra for the front array shoul show a single narrow peak
centered at zero, but shoulders on the late side for detectors 4 and 14
might indicate occasional errors in identifying idfront.
- Mean-time spectra for the rear array should show a neutron scattering peak
superimposed upon an uncorrelated background. The offsets are chosen
to center these peaks at zero. The relative intensities
generally follow the pattern expected from geometry, except that detectors
22 and 36 are somewhat too weak. Both of these detectors also had poor
position and pulse-height spectra throughout the January run.
- Mean-time spectra for the tagger arrays should contain a dominant peak at
zero produced by quasifree protons passing through all elements of the
tagger and front array, with secondary features attributed to recoil
protons, superimposed upon an uncorrelated background. All spectra for
the front tagger are very similar. Outer elements of the rear tagger
are somewhat weaker and have flatter background.
- All self-timing peaks are centered at zero and contained within about ±1
ns. These p_tc are cut off on the positive side because idtrig
is identified as the detector with the smallest value of p_tc.
- The ctof spectra all centered at zero with similar widths and
strengths. The uncorrelated background appears to decrease slightly
with depth.
- The dtof spectra are very similar to the mean-time spectra for the
rear array.
- Pulse-height spectra for the front array are all very similar to each
other, with minor variations in threshold and leakage through the
discriminators.
- Pulse-height spectra for the rear array sometimes show ADC overflow within
the plotted range, which is represented by a spike at the end of the left or
right spectra and an associated ridge in the mean pulse height. The
droop in phR22 is probably related to the anomalous position spectrum in
detector 22. Similarly, the steeper than average slope in phL36 and
droop in phR36 are probably responsible for its unusual position
spectrum. The thresholds are clearly visible in these spectra, but
these discriminators are fairly leaky.
- The pulse-height spectra for most tagger elements look fine, but the
thresholds and gains for both 45R and 46R are too small, producing unusual
structure on the low side.
Summary of recent changes
Version 2.4
- A new variable, p_rtof, is defined as the difference between the
measured and predicted time of flight from front to rear. The measured
time, p_dtof, already includes the time offsets for all
detectors. The predicted time is based upon free NN kinematics using
the incident momentum calculated from electron kinematics and the hit
positions in front and rear arrays. This quantity was available in
earlier versions of the time calibration program, but for for historical
reasons (largely compatibility with the earlier ntuple definitions) was not
available in the second-pass ntuple. It has the advantages of better
resolution and being centered upon zero for all kinematics.
- The definition of p_td has been changed for the rear array so that
quasielastic events should appear near zero. Hence, the filtering of
hits in the rear array can now use a narrower window, typically (-10, 25)
ns.
- The identification of the charge detected in the front and rear arrays has
been changed. The previous versions tried to identify a neutron and
basically said that if it's not a neutron then it must be a proton.
The new logic requires a more definite identification of a proton. An
incident proton (more precisely, charged particle) must have hits in both
front tagger arrays consistent in both time and space with the front
hit. Similarly, when both rear tagger arrays are available, both must
agree with the charge identification. If the conditions for a proton
are only partially satisfied, the charge is classified as ambiguous.
Therefore, the charge variables are now interpreted as -1:ambiguous,
0:neutron, or 1:proton. A significant number of incident particles
(about 15% for Q2 = 1) are now in the ambiguous category, most because there
is one hit in the front tagger within the appropriate time window.
Such events may reflect tagger inefficiency or noise, but can alo be caused
by (p,n) reactions in the lead that are accompanied by a photon or a
low-energy secondary that fires just one tagger element in
coincidence. Whatever their origin, we cannot then uniquely determine
the charge of the primary track.
- The algorithm for selecting the hit for protons that represents a
large-angle nuclear scattering event has been improved also. Instead
of always choosing a hit in the first layer, code provided by Brad Plaster
looks for a deviation from a straight trajectory and uses the appropriate
hit in the preceding layer. If no deviation is found, the final hit is
chosen. The analyzing power can be improved by using a cut on
scattering angle to eliminate the events with only Coulomb multiple
scattering and no large-angle nuclear scattering.
- Times for hits in the front and rear array relative to the scattering time
in the target, reconstructed from the HMS optics and the trigger time, are
stored in the ntuple within the array p_t.
- For convenience, hs_q2 was added to the npol block of the ntuple.
Although logically it belongs to the first block, consistency with the
present version of engine precludes that placement.
Version 2.3
- The makefiles have been substantially rewritten for use with the gmake
utility and will produce executables for either Linux or Sun
computers. The script setup_analyzer establishes pointers to
the executables for the current platform and environment variables for the
files containing parameters and cuts for the desired kinematical
conditions. Although these scripts were written specifically for the
JLab environment, modification for use at other institutions should be
straightforward. Details may be found at installation
notes.
- The kumacs have been modified to produce postscript output quickly without
the HIGZ screen. Use pawps kumac_name [run_number]. This
procedure is much faster than before and is suitable for batch processing
also.
- Numerous small changes were made for compatibility with g77,
including the addition of trigonometric functions with arguments in degrees.
- Tests for unphysical kinematics in the calculation of neutron time of
flight expected for the d(e,e'n)p reaction have been improved, which
eliminates some runtime errors but increases the frequency of p_error=8.
- The consistency of detector numbers and multiplicities are tested.
Inconsistent events are tagged with p_error=9.
- Scattering calculations are skipped if there were any track reconstruction
errors.
Version 2.2
- Installed in /u/group/e93038/Analyzer2.2.
- A new program check_detectors.f produces an hbook file suitable for
evaluating the performance of each detector and the PAW script check_detectors.kumac
produces a postscript file with plots organized in a convenient
arrangement.
- The basic_histograms program reads cuts from an input file.
Version 2.0
- Installed in /u/group/e93038/Analyzer2.0.
- Data for the new fourth tagger layer is included, but the programs will
still work for runs replayed with earlier versions of engine before
implementation of the fourth tagger. Note that if any rear tagger hit
is found within the specified time and distance from the front-rear track,
the particle detected in the rear is tagged as charged. We do not
require hits in both rear tagger layers or consistency between hits in the
two layers.
Version 1.6
- Installed in /u/group/e93038/Analyzer1.6.
- We returned to the use of velocity calculated from electron kinematics and
npol angle for calculations of missing energy, momentum, and mass; the
change to measured flight time in Version 1.5 turned out to be a bad idea
and has been reversed. The problem is that this experiment provides no
independent measurement of momentum for comparison with time of flight, so
that cuts upon missing mass or momentum are correlated with ctof.
- Filtering for hits in the rear array has been modified. If there are
hits that satisfy the selection criteria, only those are retained. If
no such hits are present, all hits are retained. Thus, dtof and
vratio can be calculated for every event with an acceptable hit in
the front whether or not valid hits are present in the rear. This
method allows more stringent time filtering for the rear array while
retaining early dtof events for evaluation of accidentals.
Version 1.5
- Calculations of missing momentum, energy, and mass now use the measured
time of flight instead of that predicted from electron kinematics and hadron
angle. Although this approach sacrifices some resolution, it should
help to exclude events from other reactions, such as pion production.
Note, however, that these quantities can be calculated only when the flight
time gives a velocity less than lightspeed. Furthermore, accidental
coincidences on the late side of the coincidence peak tend to accumulate
within an artificial missing mass peak which resembles, but does not
correspond to, nucleon resonances.
- Bugs in the reconstruction algorithm for multiple-hit events in the front
array that led to some spurious error conditions in earlier versions have been corrected.
The fraction of events that can be reconstructed completely has increased.
- A third block has been added to the ntuple containing track
reconstruction diagnostics. The p_ntype variable is now longer used,
having been superceded by the more detailed information in the tracking
block.
- Walk corrections for the tagger times are included.
- Event initialization problems have been corrected.
Version 1.4
- File names are now based upon environment variables, which facilitates use
of the program in batch mode for production processing. A sample
script is provided as do_npol_calculations.
- A new time-of-flight variable, p_tof, includes the timing offsets and
trigger correction, giving better resolution than the raw tof variable,
ph_start.
- The definition of the coincidence time of flight, p_ctof, is now ctof
= tof - ntof
where tof is the corrected time of flight and ntof is predicted from the
electron kinematics and nucleon angle. The result should be zero,
within resolution, if the event arises from the d(e,e'n)p reaction.
- RF information is no longer used in the ctof algorithm.
- Ntuple chains are now processed, producing a corresponding output chain.
Maintained by: James J. Kelly
Last revised: January 3, 2002