CMS 3D CMS Logo

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

#include <HcalHitCorrection.h>

Inheritance diagram for HcalHitCorrection:
CaloVHitCorrection

Public Types

typedef std::map< DetId, double > ChargeSumsByChannel
 

Public Member Functions

double charge (const PCaloHit &hit) const
 how much charge we expect from this hit More...
 
void clear ()
 
virtual void correct (PCaloHit &hit) const
 applies the delay to the hit More...
 
double delay (const PCaloHit &hit) const
 how much delay this hit will get More...
 
void fillChargeSums (MixCollection< PCaloHit > &hits)
 
 HcalHitCorrection (const CaloVSimParameterMap *parameterMap)
 
void setRandomEngine (CLHEP::HepRandomEngine &engine)
 
int timeBin (const PCaloHit &hit) const
 which time bin the peak of the signal will fall in More...
 
double timeOfFlight (const DetId &id) const
 simple average approximation More...
 
virtual ~HcalHitCorrection ()
 

Private Attributes

ChargeSumsByChannel theChargeSumsForTimeBin [10]
 
const CaloVSimParameterMaptheParameterMap
 
CLHEP::RandGaussQ * theRandGaussQ
 

Detailed Description

Applies a correction for time slewing Makes bigger signals come at a delayed time

Rick Wilkinson

Definition at line 18 of file HcalHitCorrection.h.

Member Typedef Documentation

typedef std::map<DetId, double> HcalHitCorrection::ChargeSumsByChannel

Definition at line 21 of file HcalHitCorrection.h.

Constructor & Destructor Documentation

HcalHitCorrection::HcalHitCorrection ( const CaloVSimParameterMap parameterMap)

Definition at line 11 of file HcalHitCorrection.cc.

12  : theParameterMap(parameterMap),theRandGaussQ(0)
13 {
14 }
CLHEP::RandGaussQ * theRandGaussQ
const CaloVSimParameterMap * theParameterMap
virtual HcalHitCorrection::~HcalHitCorrection ( )
inlinevirtual

Definition at line 24 of file HcalHitCorrection.h.

24 {}

Member Function Documentation

double HcalHitCorrection::charge ( const PCaloHit hit) const

how much charge we expect from this hit

Definition at line 42 of file HcalHitCorrection.cc.

References PCaloHit::energy(), PCaloHit::id(), Parameters::parameters, CaloSimParameters::simHitToPhotoelectrons(), CaloVSimParameterMap::simParameters(), and theParameterMap.

Referenced by delay(), and fillChargeSums().

43 {
44  HcalDetId detId(hit.id());
46  double simHitToCharge = parameters.simHitToPhotoelectrons(detId)
47  * parameters.photoelectronsToAnalog(detId);
48  return hit.energy() * simHitToCharge;
49 }
dictionary parameters
Definition: Parameters.py:2
double energy() const
Definition: PCaloHit.h:29
Main class for Parameters in different subdetectors.
double simHitToPhotoelectrons() const
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
unsigned int id() const
Definition: PCaloHit.h:40
const CaloVSimParameterMap * theParameterMap
void HcalHitCorrection::clear ( void  )
void HcalHitCorrection::correct ( PCaloHit hit) const
virtual

applies the delay to the hit

Implements CaloVHitCorrection.

Definition at line 100 of file HcalHitCorrection.cc.

References delay(), PCaloHit::energyEM(), PCaloHit::energyHad(), PCaloHit::geantTrackId(), PCaloHit::id(), and PCaloHit::time().

100  {
101  // replace the hit with a new one, with a time delay
102  hit = PCaloHit(hit.id(), hit.energyEM(), hit.energyHad(), hit.time()+delay(hit), hit.geantTrackId());
103 }
double time() const
Definition: PCaloHit.h:34
double energyEM() const
Definition: PCaloHit.h:30
double energyHad() const
Definition: PCaloHit.h:31
double delay(const PCaloHit &hit) const
how much delay this hit will get
int geantTrackId() const
Definition: PCaloHit.h:37
unsigned int id() const
Definition: PCaloHit.h:40
double HcalHitCorrection::delay ( const PCaloHit hit) const

how much delay this hit will get

Definition at line 52 of file HcalHitCorrection.cc.

References DetId::Calo, charge(), HcalTimeSlew::delay(), HcalSimParameters::doTimeSmear(), end, edm::hlt::Exception, HcalBarrel, HcalEndcap, HcalOuter, PCaloHit::id(), LogDebug, HcalTimeSlew::Medium, plotscripts::rms(), CaloVSimParameterMap::simParameters(), HcalTimeSlew::Slow, HcalZDCDetId::SubdetectorId, theChargeSumsForTimeBin, theParameterMap, theRandGaussQ, timeBin(), and HcalSimParameters::timeSmearRMS().

Referenced by correct().

53 {
54  // HO goes slow, HF shouldn't be used at all
55  //ZDC not used for the moment
56 
57  DetId detId(hit.id());
58  if(detId.det()==DetId::Calo && detId.subdetId()==HcalZDCDetId::SubdetectorId) return 0;
59  HcalDetId hcalDetId(hit.id());
60  double delay = 0.;
61 
62  if(hcalDetId.subdet() == HcalBarrel || hcalDetId.subdet() == HcalEndcap || hcalDetId.subdet() == HcalOuter ) {
63 
64  HcalTimeSlew::BiasSetting biasSetting = (hcalDetId.subdet() == HcalOuter) ?
67 
68  int tbin = timeBin(hit);
69  double totalCharge=0;
70  if(tbin >= 0 && tbin < 10)
71  {
72  ChargeSumsByChannel::const_iterator totalChargeItr = theChargeSumsForTimeBin[tbin].find(detId);
73  if(totalChargeItr == theChargeSumsForTimeBin[tbin].end())
74  {
75  throw cms::Exception("HcalHitCorrection") << "Cannot find HCAL charge sum for hit " << hit;
76  }
77  totalCharge = totalChargeItr->second;
78  delay = HcalTimeSlew::delay(totalCharge, biasSetting);
79  LogDebug("HcalHitCorrection") << "TIMESLEWcharge " << charge(hit)
80  << " totalcharge " << totalCharge
81  << " olddelay " << HcalTimeSlew::delay(charge(hit), biasSetting)
82  << " newdelay " << delay;
83  }
84  // now, the smearing
85  const HcalSimParameters& params=static_cast<const HcalSimParameters&>(theParameterMap->simParameters(detId));
86  if (params.doTimeSmear() && theRandGaussQ!=0) {
87  double rms=params.timeSmearRMS(charge(hit));
88 
89  double smearns=theRandGaussQ->fire()*rms;
90 
91  LogDebug("HcalHitCorrection") << "TimeSmear charge " << charge(hit) << " rms " << rms << " delay " << delay << " smearns " << smearns;
92  delay+=smearns;
93  }
94  }
95 
96  return delay;
97 }
#define LogDebug(id)
CLHEP::RandGaussQ * theRandGaussQ
int timeBin(const PCaloHit &hit) const
which time bin the peak of the signal will fall in
double delay(const PCaloHit &hit) const
how much delay this hit will get
bool doTimeSmear() const
double timeSmearRMS(double ampl) const
ChargeSumsByChannel theChargeSumsForTimeBin[10]
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
#define end
Definition: vmac.h:38
unsigned int id() const
Definition: PCaloHit.h:40
Definition: DetId.h:20
static const int SubdetectorId
Definition: HcalZDCDetId.h:22
double charge(const PCaloHit &hit) const
how much charge we expect from this hit
static double delay(double fC, BiasSetting bias=Medium)
Returns the amount (ns) by which a pulse of the given number of fC will be delayed by the timeslew ef...
Definition: HcalTimeSlew.cc:8
const CaloVSimParameterMap * theParameterMap
void HcalHitCorrection::fillChargeSums ( MixCollection< PCaloHit > &  hits)

Definition at line 17 of file HcalHitCorrection.cc.

References MixCollection< T >::begin(), charge(), MixCollection< T >::end(), LogDebug, theChargeSumsForTimeBin, and timeBin().

Referenced by HcalTBDigiProducer::produce(), and HcalDigitizer::produce().

18 {
19  for(MixCollection<PCaloHit>::MixItr hitItr = hits.begin();
20  hitItr != hits.end(); ++hitItr)
21  {
22  LogDebug("HcalHitCorrection") << "HcalHitCorrection::Hit 0x" << std::hex
23  << hitItr->id() << std::dec;
24  int tbin = timeBin(*hitItr);
25  LogDebug("HcalHitCorrection") << "HcalHitCorrection::Hit tbin" << tbin;
26  if(tbin >= 0 && tbin < 10)
27  {
28  theChargeSumsForTimeBin[tbin][DetId(hitItr->id())] += charge(*hitItr);
29  }
30  }
31 }
#define LogDebug(id)
int timeBin(const PCaloHit &hit) const
which time bin the peak of the signal will fall in
iterator end()
ChargeSumsByChannel theChargeSumsForTimeBin[10]
Definition: DetId.h:20
iterator begin()
double charge(const PCaloHit &hit) const
how much charge we expect from this hit
void HcalHitCorrection::setRandomEngine ( CLHEP::HepRandomEngine &  engine)

Definition at line 140 of file HcalHitCorrection.cc.

References theRandGaussQ.

Referenced by HcalDigitizer::HcalDigitizer().

140  {
141  if (theRandGaussQ==0) {
142  theRandGaussQ=new CLHEP::RandGaussQ(engine);
143  }
144 }
CLHEP::RandGaussQ * theRandGaussQ
int HcalHitCorrection::timeBin ( const PCaloHit hit) const

which time bin the peak of the signal will fall in

Definition at line 106 of file HcalHitCorrection.cc.

References CaloSimParameters::binOfMaximum(), PCaloHit::id(), Parameters::parameters, CaloVSimParameterMap::simParameters(), matplotRender::t, theParameterMap, PCaloHit::time(), timeOfFlight(), and CaloSimParameters::timePhase().

Referenced by delay(), and fillChargeSums().

107 {
109  double t = hit.time() - timeOfFlight(DetId(hit.id())) + parameters.timePhase();
110  return static_cast<int> (t / 25) + parameters.binOfMaximum() - 1;
111 }
dictionary parameters
Definition: Parameters.py:2
double time() const
Definition: PCaloHit.h:34
Main class for Parameters in different subdetectors.
double timePhase() const
the adjustment you need to apply to get the signal where you want it
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
unsigned int id() const
Definition: PCaloHit.h:40
Definition: DetId.h:20
double timeOfFlight(const DetId &id) const
simple average approximation
int binOfMaximum() const
const CaloVSimParameterMap * theParameterMap
double HcalHitCorrection::timeOfFlight ( const DetId id) const

simple average approximation

Definition at line 114 of file HcalHitCorrection.cc.

References DetId::Calo, DetId::det(), edm::hlt::Exception, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalZDCDetId::SubdetectorId, and DetId::subdetId().

Referenced by timeBin().

115 {
116  if(detId.det()==DetId::Calo && detId.subdetId()==HcalZDCDetId::SubdetectorId)
117  return 37.666;
118  switch(detId.subdetId())
119  {
120  case HcalBarrel:
121  return 8.4;
122  break;
123  case HcalEndcap:
124  return 13.;
125  break;
126  case HcalOuter:
127  return 18.7;
128  break;
129  case HcalForward:
130  return 37.;
131  break;
132  default:
133  throw cms::Exception("HcalHitCorrection") << "Bad Hcal subdetector " << detId.subdetId();
134  break;
135  }
136 }
static const int SubdetectorId
Definition: HcalZDCDetId.h:22

Member Data Documentation

ChargeSumsByChannel HcalHitCorrection::theChargeSumsForTimeBin[10]
private

Definition at line 51 of file HcalHitCorrection.h.

Referenced by clear(), delay(), and fillChargeSums().

const CaloVSimParameterMap* HcalHitCorrection::theParameterMap
private

Definition at line 49 of file HcalHitCorrection.h.

Referenced by charge(), delay(), and timeBin().

CLHEP::RandGaussQ* HcalHitCorrection::theRandGaussQ
private

Definition at line 53 of file HcalHitCorrection.h.

Referenced by delay(), and setRandomEngine().