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 double delay (const PCaloHit &hit, CLHEP::HepRandomEngine *) const
 how much delay this hit will get More...
 
void fillChargeSums (MixCollection< PCaloHit > &hits)
 
void fillChargeSums (std::vector< PCaloHit > &hits)
 
 HcalHitCorrection (const CaloVSimParameterMap *parameterMap)
 
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
 

Detailed Description

Definition at line 22 of file HcalHitCorrection.h.

Member Typedef Documentation

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

Definition at line 25 of file HcalHitCorrection.h.

Constructor & Destructor Documentation

HcalHitCorrection::HcalHitCorrection ( const CaloVSimParameterMap parameterMap)

Definition at line 13 of file HcalHitCorrection.cc.

14  : theParameterMap(parameterMap)
15 {
16 }
const CaloVSimParameterMap * theParameterMap
virtual HcalHitCorrection::~HcalHitCorrection ( )
inlinevirtual

Definition at line 28 of file HcalHitCorrection.h.

28 {}

Member Function Documentation

double HcalHitCorrection::charge ( const PCaloHit hit) const

how much charge we expect from this hit

Definition at line 69 of file HcalHitCorrection.cc.

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

Referenced by delay(), and fillChargeSums().

70 {
71  HcalDetId detId(hit.id());
73  double simHitToCharge = parameters.simHitToPhotoelectrons(detId)
74  * parameters.photoelectronsToAnalog(detId);
75  return hit.energy() * simHitToCharge;
76 }
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:43
const CaloVSimParameterMap * theParameterMap
void HcalHitCorrection::clear ( void  )

Definition at line 61 of file HcalHitCorrection.cc.

References i, and theChargeSumsForTimeBin.

Referenced by HcalDigitizer::finalizeEvent(), and HcalDigitizer::initializeEvent().

62 {
63  for(int i = 0; i < 10; ++i)
64  {
65  theChargeSumsForTimeBin[i].clear();
66  }
67 }
int i
Definition: DBlmapReader.cc:9
ChargeSumsByChannel theChargeSumsForTimeBin[10]
double HcalHitCorrection::delay ( const PCaloHit hit,
CLHEP::HepRandomEngine *  engine 
) const
virtual

how much delay this hit will get

Implements CaloVHitCorrection.

Definition at line 79 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, timeBin(), and HcalSimParameters::timeSmearRMS().

80 {
81  // HO goes slow, HF shouldn't be used at all
82  //ZDC not used for the moment
83 
84  DetId detId(hit.id());
85  if(detId.det()==DetId::Calo && detId.subdetId()==HcalZDCDetId::SubdetectorId) return 0.0;
86  HcalDetId hcalDetId(hit.id());
87  double delay = 0.;
88 
89  if(hcalDetId.subdet() == HcalBarrel || hcalDetId.subdet() == HcalEndcap || hcalDetId.subdet() == HcalOuter ) {
90 
91  HcalTimeSlew::BiasSetting biasSetting = (hcalDetId.subdet() == HcalOuter) ?
94 
95  int tbin = timeBin(hit);
96  double totalCharge=0;
97  if(tbin >= 0 && tbin < 10)
98  {
99  ChargeSumsByChannel::const_iterator totalChargeItr = theChargeSumsForTimeBin[tbin].find(detId);
100  if(totalChargeItr == theChargeSumsForTimeBin[tbin].end())
101  {
102  throw cms::Exception("HcalHitCorrection") << "Cannot find HCAL charge sum for hit " << hit;
103  }
104  totalCharge = totalChargeItr->second;
105  delay = HcalTimeSlew::delay(totalCharge, biasSetting);
106  LogDebug("HcalHitCorrection") << "TIMESLEWcharge " << charge(hit)
107  << " totalcharge " << totalCharge
108  << " olddelay " << HcalTimeSlew::delay(charge(hit), biasSetting)
109  << " newdelay " << delay;
110  }
111  // now, the smearing
112  const HcalSimParameters& params=static_cast<const HcalSimParameters&>(theParameterMap->simParameters(detId));
113  if (params.doTimeSmear()) {
114  double rms=params.timeSmearRMS(charge(hit));
115 
116  double smearns = CLHEP::RandGaussQ::shoot(engine) * rms;
117 
118  LogDebug("HcalHitCorrection") << "TimeSmear charge " << charge(hit) << " rms " << rms << " delay " << delay << " smearns " << smearns;
119  delay+=smearns;
120  }
121  }
122 
123  return delay;
124 }
#define LogDebug(id)
int timeBin(const PCaloHit &hit) const
which time bin the peak of the signal will fall in
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:37
unsigned int id() const
Definition: PCaloHit.h:43
Definition: DetId.h:18
static const int SubdetectorId
Definition: HcalZDCDetId.h:20
double charge(const PCaloHit &hit) const
how much charge we expect from this hit
virtual double delay(const PCaloHit &hit, CLHEP::HepRandomEngine *) const
how much delay this hit will get
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 19 of file HcalHitCorrection.cc.

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

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

20 {
21  for(MixCollection<PCaloHit>::MixItr hitItr = hits.begin();
22  hitItr != hits.end(); ++hitItr)
23  {
24  HcalDetId hcalDetId(hitItr->id());
25  if(hcalDetId.subdet() == HcalBarrel || hcalDetId.subdet() == HcalEndcap || hcalDetId.subdet() == HcalOuter )
26  {
27  LogDebug("HcalHitCorrection") << "HcalHitCorrection::Hit 0x" << std::hex
28  << hitItr->id() << std::dec;
29  int tbin = timeBin(*hitItr);
30  LogDebug("HcalHitCorrection") << "HcalHitCorrection::Hit tbin" << tbin;
31  if(tbin >= 0 && tbin < 10)
32  {
33  theChargeSumsForTimeBin[tbin][DetId(hitItr->id())] += charge(*hitItr);
34  }
35  }
36  }
37 }
#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:18
iterator begin()
double charge(const PCaloHit &hit) const
how much charge we expect from this hit
void HcalHitCorrection::fillChargeSums ( std::vector< PCaloHit > &  hits)

Definition at line 40 of file HcalHitCorrection.cc.

References charge(), HcalBarrel, HcalEndcap, HcalOuter, LogDebug, theChargeSumsForTimeBin, and timeBin().

40  {
41 
42  for(std::vector<PCaloHit>::const_iterator hitItr = hits.begin();
43  hitItr != hits.end(); ++hitItr)
44  {
45  HcalDetId hcalDetId(hitItr->id());
46  if(hcalDetId.subdet() == HcalBarrel || hcalDetId.subdet() == HcalEndcap || hcalDetId.subdet() == HcalOuter )
47  {
48  LogDebug("HcalHitCorrection") << "HcalHitCorrection::Hit 0x" << std::hex
49  << hitItr->id() << std::dec;
50  int tbin = timeBin(*hitItr);
51  LogDebug("HcalHitCorrection") << "HcalHitCorrection::Hit tbin" << tbin;
52  if(tbin >= 0 && tbin < 10)
53  {
54  theChargeSumsForTimeBin[tbin][DetId(hitItr->id())] += charge(*hitItr);
55  }
56  }
57  }
58 }
#define LogDebug(id)
int timeBin(const PCaloHit &hit) const
which time bin the peak of the signal will fall in
ChargeSumsByChannel theChargeSumsForTimeBin[10]
Definition: DetId.h:18
double charge(const PCaloHit &hit) const
how much charge we expect from this hit
int HcalHitCorrection::timeBin ( const PCaloHit hit) const

which time bin the peak of the signal will fall in

Definition at line 126 of file HcalHitCorrection.cc.

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

Referenced by delay(), and fillChargeSums().

127 {
129  double t = hit.time() - timeOfFlight(DetId(hit.id())) + parameters.timePhase();
130  return static_cast<int> (t / 25) + parameters.binOfMaximum() - 1;
131 }
dictionary parameters
Definition: Parameters.py:2
double time() const
Definition: PCaloHit.h:36
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:43
Definition: DetId.h:18
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 134 of file HcalHitCorrection.cc.

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

Referenced by timeBin().

135 {
136  if(detId.det()==DetId::Calo && detId.subdetId()==HcalZDCDetId::SubdetectorId)
137  return 37.666;
138  switch(detId.subdetId())
139  {
140  case HcalBarrel:
141  return 8.4;
142  break;
143  case HcalEndcap:
144  return 13.;
145  break;
146  case HcalOuter:
147  return 18.7;
148  break;
149  case HcalForward:
150  return 37.;
151  break;
152  default:
153  throw cms::Exception("HcalHitCorrection") << "Bad Hcal subdetector " << detId.subdetId();
154  break;
155  }
156 }
static const int SubdetectorId
Definition: HcalZDCDetId.h:20

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().