CMS 3D CMS Logo

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

#include <HcalSimParameters.h>

Inheritance diagram for HcalSimParameters:
CaloSimParameters

Public Member Functions

bool doSiPMSmearing () const
 
bool doTimeSmear () const
 
double fCtoGeV (const DetId &detId) const
 
 HcalSimParameters (double simHitToPhotoelectrons, const std::vector< double > &photoelectronsToAnalog, double samplingFactor, double timePhase, int readoutFrameSize, int binOfMaximum, bool doPhotostatistics, bool syncPhase, int firstRing, const std::vector< double > &samplingFactors)
 
 HcalSimParameters (const edm::ParameterSet &p)
 
virtual double photoelectronsToAnalog (const DetId &detId) const
 
int pixels () const
 
virtual double samplingFactor (const DetId &detId) const
 
void setDbService (const HcalDbService *service)
 
virtual double simHitToPhotoelectrons (const DetId &detId) const
 
double timeSmearRMS (double ampl) const
 
virtual ~HcalSimParameters ()
 
- Public Member Functions inherited from CaloSimParameters
int binOfMaximum () const
 
 CaloSimParameters (double simHitToPhotoelectrons, double photoelectronsToAnalog, double samplingFactor, double timePhase, int readoutFrameSize, int binOfMaximum, bool doPhotostatistics, bool syncPhase=true)
 
 CaloSimParameters (const edm::ParameterSet &p)
 
bool doPhotostatistics () const
 whether or not to apply Poisson statistics to photoelectrons More...
 
double photoelectronsToAnalog () const
 the factor which goes from photoelectrons to whatever gets read by ADCs More...
 
int readoutFrameSize () const
 for now, the LinearFrames and trhe digis will be one-to-one. More...
 
void setBinOfMaximum (int binOfMax)
 
void setReadoutFrameSize (int frameSize)
 some datamixing apps need this to be set dynamically More...
 
double simHitToPhotoelectrons () const
 
bool syncPhase () const
 choice of the ADC time alignment (synchronous for LHC, asynchronous for test beams) More...
 
double timePhase () const
 the adjustment you need to apply to get the signal where you want it More...
 
virtual ~CaloSimParameters ()
 

Private Member Functions

void defaultTimeSmearing ()
 

Private Attributes

bool doTimeSmear_
 
const HcalDbServicetheDbService
 
int theFirstRing
 
std::vector< double > thePE2fCByRing
 
int thePixels
 
std::vector< double > theSamplingFactors
 
bool theSiPMSmearing
 
HcalTimeSmearSettings theSmearSettings
 

Friends

class HcalSimParameterMap
 

Detailed Description

Definition at line 10 of file HcalSimParameters.h.

Constructor & Destructor Documentation

HcalSimParameters::HcalSimParameters ( double  simHitToPhotoelectrons,
const std::vector< double > &  photoelectronsToAnalog,
double  samplingFactor,
double  timePhase,
int  readoutFrameSize,
int  binOfMaximum,
bool  doPhotostatistics,
bool  syncPhase,
int  firstRing,
const std::vector< double > &  samplingFactors 
)

Definition at line 11 of file HcalSimParameters.cc.

References defaultTimeSmearing().

18  theDbService(0),
19  theFirstRing(firstRing),
20  theSamplingFactors(samplingFactors),
22  thePixels(0),
23  theSiPMSmearing(false),
24  doTimeSmear_(true)
25 {
27 }
CaloSimParameters(double simHitToPhotoelectrons, double photoelectronsToAnalog, double samplingFactor, double timePhase, int readoutFrameSize, int binOfMaximum, bool doPhotostatistics, bool syncPhase=true)
bool doPhotostatistics() const
whether or not to apply Poisson statistics to photoelectrons
double timePhase() const
the adjustment you need to apply to get the signal where you want it
std::vector< double > thePE2fCByRing
double simHitToPhotoelectrons() const
std::vector< double > theSamplingFactors
virtual double samplingFactor(const DetId &detId) const
int readoutFrameSize() const
for now, the LinearFrames and trhe digis will be one-to-one.
const HcalDbService * theDbService
int binOfMaximum() const
double photoelectronsToAnalog() const
the factor which goes from photoelectrons to whatever gets read by ADCs
bool syncPhase() const
choice of the ADC time alignment (synchronous for LHC, asynchronous for test beams) ...
HcalSimParameters::HcalSimParameters ( const edm::ParameterSet p)

Definition at line 29 of file HcalSimParameters.cc.

References defaultTimeSmearing(), edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), thePixels, and theSiPMSmearing.

31  theDbService(0),
32  theFirstRing( p.getParameter<int>("firstRing") ),
33  theSamplingFactors( p.getParameter<std::vector<double> >("samplingFactors") ),
34  thePE2fCByRing( p.getParameter<std::vector<double> >("photoelectronsToAnalog") ),
35  thePixels(0), theSiPMSmearing(false),
36  doTimeSmear_( p.getParameter<bool>("timeSmearing"))
37 {
38  if(p.exists("pixels"))
39  {
40  thePixels = p.getParameter<int>("pixels");
41  }
42  if (p.exists("doSiPMSmearing"))
43  theSiPMSmearing = p.getParameter<bool>("doSiPMSmearing");
45 }
T getParameter(std::string const &) const
CaloSimParameters(double simHitToPhotoelectrons, double photoelectronsToAnalog, double samplingFactor, double timePhase, int readoutFrameSize, int binOfMaximum, bool doPhotostatistics, bool syncPhase=true)
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::vector< double > thePE2fCByRing
std::vector< double > theSamplingFactors
const HcalDbService * theDbService
virtual HcalSimParameters::~HcalSimParameters ( )
inlinevirtual

Definition at line 20 of file HcalSimParameters.h.

20 {}

Member Function Documentation

void HcalSimParameters::defaultTimeSmearing ( )
private

Definition at line 97 of file HcalSimParameters.cc.

References GeV2fC, and theSmearSettings.

Referenced by HcalSimParameters().

97  {
98  // GeV->ampl (fC), time (ns)
99  theSmearSettings.emplace_back( 4.00*GeV2fC, 4.050);
100  theSmearSettings.emplace_back( 20.00*GeV2fC, 3.300);
101  theSmearSettings.emplace_back( 25.00*GeV2fC, 2.925);
102  theSmearSettings.emplace_back( 30.00*GeV2fC, 2.714);
103  theSmearSettings.emplace_back( 37.00*GeV2fC, 2.496);
104  theSmearSettings.emplace_back( 44.50*GeV2fC, 2.278);
105  theSmearSettings.emplace_back( 56.00*GeV2fC, 2.138);
106  theSmearSettings.emplace_back( 63.50*GeV2fC, 2.022);
107  theSmearSettings.emplace_back( 81.00*GeV2fC, 1.788);
108  theSmearSettings.emplace_back( 88.50*GeV2fC, 1.695);
109  theSmearSettings.emplace_back(114.50*GeV2fC, 1.716);
110  theSmearSettings.emplace_back(175.50*GeV2fC, 1.070);
111  theSmearSettings.emplace_back(350.00*GeV2fC, 1.564);
112  theSmearSettings.emplace_back(99999.00*GeV2fC, 1.564);
113 }
static const double GeV2fC
HcalTimeSmearSettings theSmearSettings
bool HcalSimParameters::doSiPMSmearing ( ) const
inline

Definition at line 38 of file HcalSimParameters.h.

References theSiPMSmearing.

Referenced by HcalSiPMHitResponse::makeSiPMSignal().

38 { return theSiPMSmearing; }
bool HcalSimParameters::doTimeSmear ( ) const
inline

Definition at line 33 of file HcalSimParameters.h.

References doTimeSmear_.

Referenced by HcalTimeSlewSim::delay(), and HcalHitCorrection::delay().

33 { return doTimeSmear_; }
double HcalSimParameters::fCtoGeV ( const DetId detId) const

{

Definition at line 61 of file HcalSimParameters.cc.

References assert(), HcalDbService::getGain(), HcalDbService::getGainWidth(), HcalGain::getValue(), mps_fire::result, and theDbService.

Referenced by simHitToPhotoelectrons().

62 {
63  assert(theDbService != 0);
64  HcalGenericDetId hcalGenDetId(detId);
65  const HcalGain* gains = theDbService->getGain(hcalGenDetId);
66  const HcalGainWidth* gwidths = theDbService->getGainWidth(hcalGenDetId);
67  if (!gains || !gwidths )
68  {
69  edm::LogError("HcalAmplifier") << "Could not fetch HCAL conditions for channel " << hcalGenDetId;
70  }
71  // only one gain will be recorded per channel, so just use capID 0 for now
72  double result = gains->getValue(0);
73 // if(doNoise_)
75 // result += CLHEP::RandGaussQ::shoot(0., gwidths->getValue(0));
76 // }
77  return result;
78 }
const HcalGainWidth * getGainWidth(const HcalGenericDetId &fId) const
assert(m_qm.get())
float getValue(int fCapId) const
get value for capId = 0..3
Definition: HcalGain.h:22
tuple result
Definition: mps_fire.py:83
const HcalGain * getGain(const HcalGenericDetId &fId) const
const HcalDbService * theDbService
double HcalSimParameters::photoelectronsToAnalog ( const DetId detId) const
virtual

Reimplemented from CaloSimParameters.

Definition at line 87 of file HcalSimParameters.cc.

References HcalDetId::ietaAbs(), theFirstRing, and thePE2fCByRing.

88 {
89  HcalDetId hcalDetId(detId);
90  return thePE2fCByRing.at(hcalDetId.ietaAbs()-theFirstRing);
91 }
std::vector< double > thePE2fCByRing
int HcalSimParameters::pixels ( ) const
inline

Definition at line 37 of file HcalSimParameters.h.

References thePixels.

Referenced by HcalSiPMHitResponse::makeSiPMSignal().

37 {return thePixels;}
double HcalSimParameters::samplingFactor ( const DetId detId) const
virtual

the ratio of actual incident energy to deposited energy in the SimHit

Definition at line 80 of file HcalSimParameters.cc.

References HcalDetId::ietaAbs(), theFirstRing, and theSamplingFactors.

Referenced by simHitToPhotoelectrons().

81 {
82  HcalDetId hcalDetId(detId);
83  return theSamplingFactors.at(hcalDetId.ietaAbs()-theFirstRing);
84 }
std::vector< double > theSamplingFactors
void HcalSimParameters::setDbService ( const HcalDbService service)
inline

Definition at line 22 of file HcalSimParameters.h.

References theDbService.

Referenced by HcalSimParameterMap::setDbService().

22 {theDbService = service;}
const HcalDbService * theDbService
double HcalSimParameters::simHitToPhotoelectrons ( const DetId detId) const
virtual

Reimplemented from CaloSimParameters.

Definition at line 47 of file HcalSimParameters.cc.

References fCtoGeV(), HcalGenericDetId::HcalGenForward, HcalGenericDetId::HcalGenZDC, CaloSimParameters::photoelectronsToAnalog(), mps_fire::result, samplingFactor(), and CaloSimParameters::simHitToPhotoelectrons().

48 {
49  // the gain is in units of GeV/fC. We want a constant with pe/dGeV
50  // pe/dGeV = (GeV/dGeV) / (GeV/fC) / (fC/pe)
52  if(HcalGenericDetId(detId).genericSubdet() != HcalGenericDetId::HcalGenForward
53  || HcalGenericDetId(detId).genericSubdet() != HcalGenericDetId::HcalGenZDC)
54  {
55  result = samplingFactor(detId) / fCtoGeV(detId) / photoelectronsToAnalog(detId);
56  }
57  return result;
58 }
double fCtoGeV(const DetId &detId) const
tuple result
Definition: mps_fire.py:83
double simHitToPhotoelectrons() const
virtual double samplingFactor(const DetId &detId) const
double photoelectronsToAnalog() const
the factor which goes from photoelectrons to whatever gets read by ADCs
double HcalSimParameters::timeSmearRMS ( double  ampl) const

Definition at line 115 of file HcalSimParameters.cc.

References plotBeamSpotDB::first, i, and theSmearSettings.

Referenced by HcalTimeSlewSim::delay(), and HcalHitCorrection::delay().

115  {
117  double smearsigma=0;
118 
119  for (i=0; i<theSmearSettings.size(); i++)
120  if (theSmearSettings[i].first > ampl)
121  break;
122 
123  // Smearing occurs only within the envelope definitions.
124  if (i!=0 && (i < theSmearSettings.size())) {
125  double energy1 = theSmearSettings[i-1].first;
126  double sigma1 = theSmearSettings[i-1].second;
127  double energy2 = theSmearSettings[i].first;
128  double sigma2 = theSmearSettings[i].second;
129 
130  if (energy2 != energy1)
131  smearsigma = sigma1 + ((sigma2-sigma1)*(ampl-energy1)/(energy2-energy1));
132  else
133  smearsigma = (sigma2+sigma1)/2.;
134  }
135 
136  return smearsigma;
137 
138 }
int i
Definition: DBlmapReader.cc:9
uint16_t size_type
HcalTimeSmearSettings theSmearSettings

Friends And Related Function Documentation

friend class HcalSimParameterMap
friend

Definition at line 40 of file HcalSimParameters.h.

Member Data Documentation

bool HcalSimParameters::doTimeSmear_
private

Definition at line 50 of file HcalSimParameters.h.

Referenced by doTimeSmear().

const HcalDbService* HcalSimParameters::theDbService
private

Definition at line 44 of file HcalSimParameters.h.

Referenced by fCtoGeV(), and setDbService().

int HcalSimParameters::theFirstRing
private

Definition at line 45 of file HcalSimParameters.h.

Referenced by photoelectronsToAnalog(), and samplingFactor().

std::vector<double> HcalSimParameters::thePE2fCByRing
private

Definition at line 47 of file HcalSimParameters.h.

Referenced by photoelectronsToAnalog().

int HcalSimParameters::thePixels
private
std::vector<double> HcalSimParameters::theSamplingFactors
private

Definition at line 46 of file HcalSimParameters.h.

Referenced by samplingFactor().

bool HcalSimParameters::theSiPMSmearing
private

Definition at line 49 of file HcalSimParameters.h.

Referenced by doSiPMSmearing(), and HcalSimParameters().

HcalTimeSmearSettings HcalSimParameters::theSmearSettings
private

Definition at line 51 of file HcalSimParameters.h.

Referenced by defaultTimeSmearing(), and timeSmearRMS().