  The focal plane of the NIRSpec instrument on board the James Webb Space
Telescope (JWST) is equipped with two Teledyne H2RG near-IR detectors,
state-of-the-art HgCdTe sensors with excellent noise performance. Once JWST is
in space, however, the noise level in NIRSpec exposures will be affected by the
cosmic ray (CR) fluence at the JWST orbit and our ability to detect CR hits and
to mitigate their effect. We have simulated the effect of CRs on NIRSpec
detectors by injecting realistic CR events onto dark exposures that were
recently acquired during the JWST cryo-vacuum test campaign undertaken at
Johnson Space Flight Center. Here we present the method we have implemented to
detect the hits in the exposure integration cubes, to reject the affected data
points within our ramp-to-slope processing pipeline (the prototype of the
NIRSpec official pipeline), and assess the performance of this method for
different choices of the algorithm parameters. Using the optimal parameter set
to reject CR hits from the data, we estimate that, for an exposure length of
1,000 s, the presence of CRs in space will lead to an increase of typically ~7%
in the detector noise level with respect to the on-ground performance, and the
corresponding decrease in the limiting sensitivity of the instrument, for the
medium and high-spectral resolution modes.
