CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes | Friends

HcalSimParameters Class Reference

#include <HcalSimParameters.h>

Inheritance diagram for HcalSimParameters:
CaloSimParameters

List of all members.

Public Member Functions

bool doTimeSmear () const
double fCtoGeV (const DetId &detId) const
 HcalSimParameters (const edm::ParameterSet &p)
 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)
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 ()

Private Member Functions

void defaultTimeSmearing ()

Private Attributes

bool doTimeSmear_
const HcalDbServicetheDbService
int theFirstRing
std::vector< double > thePE2fCByRing
int thePixels
std::vector< double > theSamplingFactors
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 
)
HcalSimParameters::HcalSimParameters ( const edm::ParameterSet p)

Definition at line 28 of file HcalSimParameters.cc.

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

:  CaloSimParameters(p),
   theDbService(0),
   theFirstRing( p.getParameter<int>("firstRing") ),
   theSamplingFactors( p.getParameter<std::vector<double> >("samplingFactors") ),
   thePE2fCByRing( p.getParameter<std::vector<double> >("photoelectronsToAnalog") ),
   thePixels(0),
   doTimeSmear_( p.getParameter<bool>("timeSmearing"))
{
  if(p.exists("pixels"))
  {
    thePixels = p.getParameter<int>("pixels");
  }
  defaultTimeSmearing();
}
virtual HcalSimParameters::~HcalSimParameters ( ) [inline, virtual]

Definition at line 20 of file HcalSimParameters.h.

{}

Member Function Documentation

void HcalSimParameters::defaultTimeSmearing ( ) [private]

Definition at line 94 of file HcalSimParameters.cc.

References GeV2fC, and theSmearSettings.

Referenced by HcalSimParameters().

                                            {
  // GeV->ampl (fC), time (ns)
  theSmearSettings.push_back(std::pair<double,double>(  4.00*GeV2fC, 4.050));
  theSmearSettings.push_back(std::pair<double,double>( 20.00*GeV2fC, 3.300));
  theSmearSettings.push_back(std::pair<double,double>( 25.00*GeV2fC, 2.925));
  theSmearSettings.push_back(std::pair<double,double>( 30.00*GeV2fC, 2.714));
  theSmearSettings.push_back(std::pair<double,double>( 37.00*GeV2fC, 2.496));
  theSmearSettings.push_back(std::pair<double,double>( 44.50*GeV2fC, 2.278));
  theSmearSettings.push_back(std::pair<double,double>( 56.00*GeV2fC, 2.138));
  theSmearSettings.push_back(std::pair<double,double>( 63.50*GeV2fC, 2.022));
  theSmearSettings.push_back(std::pair<double,double>( 81.00*GeV2fC, 1.788));
  theSmearSettings.push_back(std::pair<double,double>( 88.50*GeV2fC, 1.695));
  theSmearSettings.push_back(std::pair<double,double>(114.50*GeV2fC, 1.716));
  theSmearSettings.push_back(std::pair<double,double>(175.50*GeV2fC, 1.070));
  theSmearSettings.push_back(std::pair<double,double>(350.00*GeV2fC, 1.564));
  theSmearSettings.push_back(std::pair<double,double>(99999.00*GeV2fC, 1.564));
}
bool HcalSimParameters::doTimeSmear ( ) const [inline]

Definition at line 33 of file HcalSimParameters.h.

References doTimeSmear_.

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

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

{

Definition at line 58 of file HcalSimParameters.cc.

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

Referenced by simHitToPhotoelectrons().

{
  assert(theDbService != 0);
  HcalGenericDetId hcalGenDetId(detId);
  const HcalGain* gains = theDbService->getGain(hcalGenDetId);
  const HcalGainWidth* gwidths = theDbService->getGainWidth(hcalGenDetId);
  if (!gains || !gwidths )
  {
    edm::LogError("HcalAmplifier") << "Could not fetch HCAL conditions for channel " << hcalGenDetId;
  }
  // only one gain will be recorded per channel, so just use capID 0 for now
  double result = gains->getValue(0);
//  if(doNoise_)
//    result += CLHEP::RandGaussQ::shoot(0.,  gwidths->getValue(0));
//  }
  return result;
}
double HcalSimParameters::photoelectronsToAnalog ( const DetId detId) const [virtual]

Reimplemented from CaloSimParameters.

Definition at line 84 of file HcalSimParameters.cc.

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

{
  HcalDetId hcalDetId(detId);
  return thePE2fCByRing.at(hcalDetId.ietaAbs()-theFirstRing);
}
int HcalSimParameters::pixels ( ) const [inline]

Definition at line 37 of file HcalSimParameters.h.

References thePixels.

{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 77 of file HcalSimParameters.cc.

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

Referenced by simHitToPhotoelectrons().

{
  HcalDetId hcalDetId(detId);
  return theSamplingFactors.at(hcalDetId.ietaAbs()-theFirstRing);
}
void HcalSimParameters::setDbService ( const HcalDbService service) [inline]

Definition at line 22 of file HcalSimParameters.h.

References theDbService.

Referenced by HcalSimParameterMap::setDbService().

{theDbService = service;}
double HcalSimParameters::simHitToPhotoelectrons ( const DetId detId) const [virtual]

Reimplemented from CaloSimParameters.

Definition at line 44 of file HcalSimParameters.cc.

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

{
  // the gain is in units of GeV/fC.  We want a constant with pe/dGeV
  // pe/dGeV = (GeV/dGeV) / (GeV/fC) / (fC/pe) 
  double result = CaloSimParameters::simHitToPhotoelectrons(detId);
  if(HcalGenericDetId(detId).genericSubdet() != HcalGenericDetId::HcalGenForward
     || HcalGenericDetId(detId).genericSubdet() != HcalGenericDetId::HcalGenZDC)
    { 
      result = samplingFactor(detId) / fCtoGeV(detId) / photoelectronsToAnalog(detId);
    }
  return result;
}
double HcalSimParameters::timeSmearRMS ( double  ampl) const

Definition at line 112 of file HcalSimParameters.cc.

References first, i, and theSmearSettings.

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

                                                        {
  HcalTimeSmearSettings::size_type i;
  double smearsigma=0;

  for (i=0; i<theSmearSettings.size(); i++)
    if (theSmearSettings[i].first > ampl)
      break;

  // Smearing occurs only within the envelope definitions.
  if (i!=0 && (i < theSmearSettings.size())) {
    double energy1 = theSmearSettings[i-1].first;
    double sigma1  = theSmearSettings[i-1].second;
    double energy2 = theSmearSettings[i].first;
    double sigma2  = theSmearSettings[i].second;
    
    if (energy2 != energy1)
      smearsigma = sigma1 + ((sigma2-sigma1)*(ampl-energy1)/(energy2-energy1));
    else
      smearsigma = (sigma2+sigma1)/2.;    
  }

  return smearsigma;

}

Friends And Related Function Documentation

friend class HcalSimParameterMap [friend]

Definition at line 39 of file HcalSimParameters.h.


Member Data Documentation

Definition at line 48 of file HcalSimParameters.h.

Referenced by doTimeSmear().

Definition at line 43 of file HcalSimParameters.h.

Referenced by fCtoGeV(), and setDbService().

Definition at line 44 of file HcalSimParameters.h.

Referenced by photoelectronsToAnalog(), and samplingFactor().

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

Definition at line 46 of file HcalSimParameters.h.

Referenced by photoelectronsToAnalog().

std::vector<double> HcalSimParameters::theSamplingFactors [private]

Definition at line 45 of file HcalSimParameters.h.

Referenced by samplingFactor().

Definition at line 49 of file HcalSimParameters.h.

Referenced by defaultTimeSmearing(), and timeSmearRMS().