test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
HcalSiPM Class Reference

A general implementation for the response of a SiPM. More...

#include <HcalSiPM.h>

Public Member Functions

double getCrossTalk () const
 
int getNCells () const
 
double getTau () const
 
double getTempDep () const
 
 HcalSiPM (int nCells=1, double tau=15.)
 
virtual int hitCells (CLHEP::HepRandomEngine *, unsigned int photons, unsigned int integral=0) const
 
virtual double hitCells (CLHEP::HepRandomEngine *, unsigned int pes, double tempDiff=0., double photonTime=0.)
 
void resetSiPM ()
 
void setCrossTalk (double xtalk)
 
void setNCells (int nCells)
 
void setTau (double tau)
 
void setTemperatureDependence (double tempDep)
 
virtual double totalCharge () const
 
virtual double totalCharge (double time) const
 
virtual ~HcalSiPM ()
 

Protected Member Functions

double cellCharge (double deltaTime) const
 

Protected Attributes

unsigned int theCellCount
 
double theCrossTalk
 
double theLastHitTime
 
std::vector< double > theSiPM
 
double theTauInv
 
double theTempDep
 

Detailed Description

A general implementation for the response of a SiPM.

Definition at line 20 of file HcalSiPM.h.

Constructor & Destructor Documentation

HcalSiPM::HcalSiPM ( int  nCells = 1,
double  tau = 15. 
)

Definition at line 12 of file HcalSiPM.cc.

References assert(), resetSiPM(), and theCellCount.

12  :
13  theCellCount(nCells), theSiPM(nCells,1.), theTauInv(1.0/tau),
14  theCrossTalk(0.), theTempDep(0.), theLastHitTime(-1.) {
15 
17  resetSiPM();
18 }
double theTempDep
Definition: HcalSiPM.h:56
double theTauInv
Definition: HcalSiPM.h:54
void resetSiPM()
Definition: HcalSiPM.h:26
assert(m_qm.get())
double theCrossTalk
Definition: HcalSiPM.h:55
std::vector< double > theSiPM
Definition: HcalSiPM.h:53
double theLastHitTime
Definition: HcalSiPM.h:57
unsigned int theCellCount
Definition: HcalSiPM.h:52
HcalSiPM::~HcalSiPM ( )
virtual

Definition at line 20 of file HcalSiPM.cc.

20  {
21 }

Member Function Documentation

double HcalSiPM::cellCharge ( double  deltaTime) const
protected

Definition at line 140 of file HcalSiPM.cc.

References create_public_lumi_plots::exp, mps_fire::result, and theTauInv.

Referenced by hitCells(), and totalCharge().

140  {
141  if (deltaTime <= 0.) return 0.;
142  if (deltaTime > 10./theTauInv) return 1.;
143  double result(1. - std::exp(-deltaTime*theTauInv));
144  return (result > 0.99) ? 1.0 : result;
145 }
double theTauInv
Definition: HcalSiPM.h:54
tuple result
Definition: mps_fire.py:83
double HcalSiPM::getCrossTalk ( ) const
inline

Definition at line 38 of file HcalSiPM.h.

References theCrossTalk.

38 { return theCrossTalk; }
double theCrossTalk
Definition: HcalSiPM.h:55
int HcalSiPM::getNCells ( ) const
inline

Definition at line 36 of file HcalSiPM.h.

References theCellCount.

36 { return theCellCount; }
unsigned int theCellCount
Definition: HcalSiPM.h:52
double HcalSiPM::getTau ( ) const
inline

Definition at line 37 of file HcalSiPM.h.

References theTauInv.

37 { return 1.0/theTauInv; }
double theTauInv
Definition: HcalSiPM.h:54
double HcalSiPM::getTempDep ( ) const
inline

Definition at line 39 of file HcalSiPM.h.

References theTempDep.

39 { return theTempDep; }
double theTempDep
Definition: HcalSiPM.h:56
int HcalSiPM::hitCells ( CLHEP::HepRandomEngine *  engine,
unsigned int  photons,
unsigned int  integral = 0 
) const
virtual

Definition at line 23 of file HcalSiPM.cc.

References create_public_lumi_plots::exp, timingPdfMaker::mean, mathSSE::sqrt(), theCellCount, theCrossTalk, and x.

Referenced by HcalSiPMHitResponse::makeSiPMSignal().

23  {
24  //don't need to do zero or negative photons.
25  if (photons < 1) return 0;
26  if (integral >= theCellCount) return 0;
27 
28  //normalize by theCellCount to remove dependency on SiPM size and pixel density.
29  if ((theCrossTalk > 0.) && (theCrossTalk < 1.)) {
30  CLHEP::RandPoissonQ randPoissonQ(*engine, photons/(1.-theCrossTalk)-photons);
31  photons += randPoissonQ.fire();
32  }
33  double x(photons/double(theCellCount));
34  double prehit(integral/double(theCellCount));
35 
36  //calculate the width and mean of the distribution for a given x
37  double mean(1. - std::exp(-x));
38  double width2(std::exp(-x)*(1-(1+x)*std::exp(-x)));
39 
40  //you can't hit more than everything.
41  if (mean > 1.) mean = 1.;
42 
43  //convert back to absolute pixels
44  mean *= (1-prehit)*theCellCount;
45  width2 *= (1-prehit)*theCellCount;
46 
47  double npe;
48  while (true) {
49  npe = CLHEP::RandGaussQ::shoot(engine, mean, std::sqrt(width2 + (mean*prehit)));
50  if ((npe > -0.5) && (npe <= theCellCount-integral))
51  return int(npe + 0.5);
52  }
53 }
double theCrossTalk
Definition: HcalSiPM.h:55
T sqrt(T t)
Definition: SSEVec.h:18
Integral< F, X >::type integral(const F &f)
Definition: Integral.h:69
unsigned int theCellCount
Definition: HcalSiPM.h:52
double HcalSiPM::hitCells ( CLHEP::HepRandomEngine *  engine,
unsigned int  pes,
double  tempDiff = 0.,
double  photonTime = 0. 
)
virtual

Definition at line 55 of file HcalSiPM.cc.

References cellCharge(), theCellCount, theCrossTalk, theLastHitTime, theSiPM, and theTempDep.

56  {
57  // response to light impulse with pes input photons. The return is the number
58  // of micro-pixels hit. If a fraction other than 0. is supplied then the
59  // micro-pixel doesn't fully discharge. The tempDiff is the temperature
60  // difference from nominal and is used to modify the relative strength of a
61  // hit pixel. Pixels which are fractionally charged return a fractional
62  // number of hit pixels.
63 
64  if ((theCrossTalk > 0.) && (theCrossTalk < 1.)) {
65  CLHEP::RandPoissonQ randPoissonQ(*engine, pes/(1. - theCrossTalk) - pes);
66  pes += randPoissonQ.fire();
67  }
68 
69  unsigned int pixel;
70  double sum(0.), hit(0.);
71  for (unsigned int pe(0); pe < pes; ++pe) {
72  pixel = CLHEP::RandFlat::shootInt(engine, theCellCount);
73  hit = (theSiPM[pixel] < 0.) ? 1.0 :
74  (cellCharge(photonTime - theSiPM[pixel]));
75  sum += hit*(1 + (tempDiff*theTempDep));
76  theSiPM[pixel] = photonTime;
77  }
78 
79  theLastHitTime = photonTime;
80 
81  return sum;
82 }
double theTempDep
Definition: HcalSiPM.h:56
double cellCharge(double deltaTime) const
Definition: HcalSiPM.cc:140
double theCrossTalk
Definition: HcalSiPM.h:55
std::vector< double > theSiPM
Definition: HcalSiPM.h:53
double theLastHitTime
Definition: HcalSiPM.h:57
unsigned int theCellCount
Definition: HcalSiPM.h:52
void HcalSiPM::resetSiPM ( )
inline

Definition at line 26 of file HcalSiPM.h.

References lumiContext::fill, and theSiPM.

Referenced by HcalSiPM(), and setNCells().

26 { std::fill(theSiPM.begin(), theSiPM.end(), -999.); }
string fill
Definition: lumiContext.py:319
std::vector< double > theSiPM
Definition: HcalSiPM.h:53
void HcalSiPM::setCrossTalk ( double  xtalk)

Definition at line 112 of file HcalSiPM.cc.

References theCrossTalk.

112  {
113  // set the cross-talk probability
114 
115  if((xTalk < 0) || (xTalk >= 1)) {
116  theCrossTalk = 0.;
117  } else {
118  theCrossTalk = xTalk;
119  }
120 
121 }
double theCrossTalk
Definition: HcalSiPM.h:55
void HcalSiPM::setNCells ( int  nCells)

Definition at line 105 of file HcalSiPM.cc.

References assert(), resetSiPM(), theCellCount, and theSiPM.

Referenced by HcalSiPMHitResponse::makeSiPMSignal().

105  {
106  assert(nCells>0);
107  theCellCount = nCells;
108  theSiPM.resize(nCells);
109  resetSiPM();
110 }
void resetSiPM()
Definition: HcalSiPM.h:26
assert(m_qm.get())
std::vector< double > theSiPM
Definition: HcalSiPM.h:53
unsigned int theCellCount
Definition: HcalSiPM.h:52
void HcalSiPM::setTau ( double  tau)
inline

Definition at line 42 of file HcalSiPM.h.

References metsig::tau, and theTauInv.

Referenced by HcalSiPMHitResponse::makeSiPMSignal().

42 {theTauInv=1.0/tau;}
double theTauInv
Definition: HcalSiPM.h:54
void HcalSiPM::setTemperatureDependence ( double  tempDep)

Definition at line 123 of file HcalSiPM.cc.

References theTempDep.

123  {
124  // set the temperature dependence
125  theTempDep = dTemp;
126 }
double theTempDep
Definition: HcalSiPM.h:56
virtual double HcalSiPM::totalCharge ( ) const
inlinevirtual

Definition at line 32 of file HcalSiPM.h.

References theLastHitTime, and totalCharge().

Referenced by totalCharge().

32 { return totalCharge(theLastHitTime); }
virtual double totalCharge() const
Definition: HcalSiPM.h:32
double theLastHitTime
Definition: HcalSiPM.h:57
double HcalSiPM::totalCharge ( double  time) const
virtual

Definition at line 84 of file HcalSiPM.cc.

References cellCharge(), i, theCellCount, and theSiPM.

84  {
85  // sum of the micro-pixels. NP is a fully charged device.
86  // 0 is a fullly depleted device.
87  double tot(0.), hit(0.);
88  for(unsigned int i=0; i<theCellCount; ++i) {
89  hit = (theSiPM[i] < 0.) ? 1. : cellCharge(time - theSiPM[i]);
90  tot += hit;
91  }
92  return tot;
93 }
int i
Definition: DBlmapReader.cc:9
double cellCharge(double deltaTime) const
Definition: HcalSiPM.cc:140
std::vector< double > theSiPM
Definition: HcalSiPM.h:53
unsigned int theCellCount
Definition: HcalSiPM.h:52

Member Data Documentation

unsigned int HcalSiPM::theCellCount
protected

Definition at line 52 of file HcalSiPM.h.

Referenced by getNCells(), HcalSiPM(), hitCells(), setNCells(), and totalCharge().

double HcalSiPM::theCrossTalk
protected

Definition at line 55 of file HcalSiPM.h.

Referenced by getCrossTalk(), hitCells(), and setCrossTalk().

double HcalSiPM::theLastHitTime
protected

Definition at line 57 of file HcalSiPM.h.

Referenced by hitCells(), and totalCharge().

std::vector< double > HcalSiPM::theSiPM
protected

Definition at line 53 of file HcalSiPM.h.

Referenced by hitCells(), resetSiPM(), setNCells(), and totalCharge().

double HcalSiPM::theTauInv
protected

Definition at line 54 of file HcalSiPM.h.

Referenced by cellCharge(), getTau(), and setTau().

double HcalSiPM::theTempDep
protected

Definition at line 56 of file HcalSiPM.h.

Referenced by getTempDep(), hitCells(), and setTemperatureDependence().