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 46 of file HcalHitCorrection.cc.

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

Referenced by delay(), and fillChargeSums().

47 {
48  HcalDetId detId(hit.id());
50  double simHitToCharge = parameters.simHitToPhotoelectrons(detId)
51  * parameters.photoelectronsToAnalog(detId);
52  return hit.energy() * simHitToCharge;
53 }
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  )

Definition at line 38 of file HcalHitCorrection.cc.

References i, and theChargeSumsForTimeBin.

Referenced by HcalDigitizer::produce().

39 {
40  for(int i = 0; i < 10; ++i)
41  {
42  theChargeSumsForTimeBin[i].clear();
43  }
44 }
int i
Definition: DBlmapReader.cc:9
ChargeSumsByChannel theChargeSumsForTimeBin[10]
void HcalHitCorrection::correct ( PCaloHit hit) const
virtual

applies the delay to the hit

Implements CaloVHitCorrection.

Definition at line 104 of file HcalHitCorrection.cc.

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

104  {
105  // replace the hit with a new one, with a time delay
106  hit = PCaloHit(hit.id(), hit.energyEM(), hit.energyHad(), hit.time()+delay(hit), hit.geantTrackId());
107 }
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 56 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().

57 {
58  // HO goes slow, HF shouldn't be used at all
59  //ZDC not used for the moment
60 
61  DetId detId(hit.id());
62  if(detId.det()==DetId::Calo && detId.subdetId()==HcalZDCDetId::SubdetectorId) return 0;
63  HcalDetId hcalDetId(hit.id());
64  double delay = 0.;
65 
66  if(hcalDetId.subdet() == HcalBarrel || hcalDetId.subdet() == HcalEndcap || hcalDetId.subdet() == HcalOuter ) {
67 
68  HcalTimeSlew::BiasSetting biasSetting = (hcalDetId.subdet() == HcalOuter) ?
71 
72  int tbin = timeBin(hit);
73  double totalCharge=0;
74  if(tbin >= 0 && tbin < 10)
75  {
76  ChargeSumsByChannel::const_iterator totalChargeItr = theChargeSumsForTimeBin[tbin].find(detId);
77  if(totalChargeItr == theChargeSumsForTimeBin[tbin].end())
78  {
79  throw cms::Exception("HcalHitCorrection") << "Cannot find HCAL charge sum for hit " << hit;
80  }
81  totalCharge = totalChargeItr->second;
82  delay = HcalTimeSlew::delay(totalCharge, biasSetting);
83  LogDebug("HcalHitCorrection") << "TIMESLEWcharge " << charge(hit)
84  << " totalcharge " << totalCharge
85  << " olddelay " << HcalTimeSlew::delay(charge(hit), biasSetting)
86  << " newdelay " << delay;
87  }
88  // now, the smearing
89  const HcalSimParameters& params=static_cast<const HcalSimParameters&>(theParameterMap->simParameters(detId));
90  if (params.doTimeSmear() && theRandGaussQ!=0) {
91  double rms=params.timeSmearRMS(charge(hit));
92 
93  double smearns=theRandGaussQ->fire()*rms;
94 
95  LogDebug("HcalHitCorrection") << "TimeSmear charge " << charge(hit) << " rms " << rms << " delay " << delay << " smearns " << smearns;
96  delay+=smearns;
97  }
98  }
99 
100  return delay;
101 }
#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(), HcalBarrel, HcalEndcap, HcalOuter, 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  HcalDetId hcalDetId(hitItr->id());
23  if(hcalDetId.subdet() == HcalBarrel || hcalDetId.subdet() == HcalEndcap || hcalDetId.subdet() == HcalOuter )
24  {
25  LogDebug("HcalHitCorrection") << "HcalHitCorrection::Hit 0x" << std::hex
26  << hitItr->id() << std::dec;
27  int tbin = timeBin(*hitItr);
28  LogDebug("HcalHitCorrection") << "HcalHitCorrection::Hit tbin" << tbin;
29  if(tbin >= 0 && tbin < 10)
30  {
31  theChargeSumsForTimeBin[tbin][DetId(hitItr->id())] += charge(*hitItr);
32  }
33  }
34  }
35 }
#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 144 of file HcalHitCorrection.cc.

References theRandGaussQ.

Referenced by HcalDigitizer::HcalDigitizer().

144  {
145  if (theRandGaussQ==0) {
146  theRandGaussQ=new CLHEP::RandGaussQ(engine);
147  }
148 }
CLHEP::RandGaussQ * theRandGaussQ
int HcalHitCorrection::timeBin ( const PCaloHit hit) const

which time bin the peak of the signal will fall in

Definition at line 110 of file HcalHitCorrection.cc.

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

Referenced by delay(), and fillChargeSums().

111 {
113  double t = hit.time() - timeOfFlight(DetId(hit.id())) + parameters.timePhase();
114  return static_cast<int> (t / 25) + parameters.binOfMaximum() - 1;
115 }
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 118 of file HcalHitCorrection.cc.

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

Referenced by timeBin().

119 {
120  if(detId.det()==DetId::Calo && detId.subdetId()==HcalZDCDetId::SubdetectorId)
121  return 37.666;
122  switch(detId.subdetId())
123  {
124  case HcalBarrel:
125  return 8.4;
126  break;
127  case HcalEndcap:
128  return 13.;
129  break;
130  case HcalOuter:
131  return 18.7;
132  break;
133  case HcalForward:
134  return 37.;
135  break;
136  default:
137  throw cms::Exception("HcalHitCorrection") << "Bad Hcal subdetector " << detId.subdetId();
138  break;
139  }
140 }
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().