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 11 of file HcalSiPM.cc.

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

11  :
12  theCellCount(nCells), theSiPM(nCells,1.), theTauInv(1.0/tau),
13  theCrossTalk(0.), theTempDep(0.), theLastHitTime(-1.) {
14 
16  resetSiPM();
17 }
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 19 of file HcalSiPM.cc.

19  {
20 }

Member Function Documentation

double HcalSiPM::cellCharge ( double  deltaTime) const
protected

Definition at line 139 of file HcalSiPM.cc.

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

Referenced by hitCells(), and totalCharge().

139  {
140  if (deltaTime <= 0.) return 0.;
141  if (deltaTime > 10./theTauInv) return 1.;
142  double result(1. - std::exp(-deltaTime*theTauInv));
143  return (result > 0.99) ? 1.0 : result;
144 }
double theTauInv
Definition: HcalSiPM.h:54
tuple result
Definition: mps_fire.py:95
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 22 of file HcalSiPM.cc.

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

Referenced by HcalSiPMHitResponse::makeSiPMSignal().

22  {
23  //don't need to do zero or negative photons.
24  if (photons < 1) return 0;
25  if (integral >= theCellCount) return 0;
26 
27  //normalize by theCellCount to remove dependency on SiPM size and pixel density.
28  if ((theCrossTalk > 0.) && (theCrossTalk < 1.)) {
29  CLHEP::RandPoissonQ randPoissonQ(*engine, photons/(1.-theCrossTalk)-photons);
30  photons += randPoissonQ.fire();
31  }
32  double x(photons/double(theCellCount));
33  double prehit(integral/double(theCellCount));
34 
35  //calculate the width and mean of the distribution for a given x
36  double mean(1. - std::exp(-x));
37  double width2(std::exp(-x)*(1-(1+x)*std::exp(-x)));
38 
39  //you can't hit more than everything.
40  if (mean > 1.) mean = 1.;
41 
42  //convert back to absolute pixels
43  mean *= (1-prehit)*theCellCount;
44  width2 *= (1-prehit)*theCellCount;
45 
46  double npe;
47  while (true) {
48  npe = CLHEP::RandGaussQ::shoot(engine, mean, std::sqrt(width2 + (mean*prehit)));
49  if ((npe > -0.5) && (npe <= theCellCount-integral))
50  return int(npe + 0.5);
51  }
52 }
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 54 of file HcalSiPM.cc.

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

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

References theCrossTalk.

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

Definition at line 104 of file HcalSiPM.cc.

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

Referenced by HcalSiPMHitResponse::makeSiPMSignal().

104  {
105  assert(nCells>0);
106  theCellCount = nCells;
107  theSiPM.resize(nCells);
108  resetSiPM();
109 }
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 122 of file HcalSiPM.cc.

References theTempDep.

122  {
123  // set the temperature dependence
124  theTempDep = dTemp;
125 }
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 83 of file HcalSiPM.cc.

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

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