SiPMUtils.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file SiPMUtils.cxx
3 /// \brief Interface to algorithm class SiPM specific
4 ///
5 /// \author eldwan.brianne@desy.de
6 ////////////////////////////////////////////////////////////////////////
7 
8 #include "RecoAlg/SiPMUtils.h"
9 #include <cmath>
10 
11 namespace util {
12 
13  //----------------------------------------------------------------------
15  : fNeffPx(0)
16  {
17  }
18 
19  //----------------------------------------------------------------------
20  SiPMUtils::SiPMUtils(double NeffPx)
21  : fNeffPx(NeffPx)
22  {
23  }
24 
25  //----------------------------------------------------------------------
27  {
28  }
29 
30  //----------------------------------------------------------------------------
31  double SiPMUtils::Saturate(const double unsat_px)
32  {
33  /* protect against negative/zero input*/
34  if ( unsat_px <= 0 ) return unsat_px;
35 
36  /* calculate saturated signal using simple exponential formula */
37  double saturatedSignal = fNeffPx * ( 1. - std::exp( - unsat_px / fNeffPx ) );
38 
39  return saturatedSignal;
40  }
41 
42  //----------------------------------------------------------------------------
43  double SiPMUtils::DeSaturate(const double sat_px)
44  {
45  /* protect against negative/zero input*/
46  if ( sat_px <= 0 ) return sat_px;
47 
48  double ratio = 0.95;
49  if(sat_px < ratio * fNeffPx)
50  {
51  /* desaturate using inverse function */
52  float unSaturatedSignal = - fNeffPx * std::log(1 - sat_px / fNeffPx);
53  return unSaturatedSignal;
54  }
55  else
56  {
57  /* desaturate using linear continuation function for hits above linearisation threshold */
58  float unSaturatedSignal = 1/( 1 - ratio ) * (sat_px - ratio * fNeffPx) - fNeffPx * std::log( 1 - ratio );
59  return unSaturatedSignal;
60  }
61  }
62 
63 } // util
Namespace for general, non-LArSoft-specific utilities.
double Saturate(const double unsat_px)
Definition: SiPMUtils.cxx:31
double DeSaturate(const double sat_px)
Definition: SiPMUtils.cxx:43
Interface to SiPMReadoutSimAlg class for SiPM specific.
double fNeffPx
Definition: SiPMUtils.h:28