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) const
 how much delay this hit will get More...
 
void fillChargeSums (MixCollection< PCaloHit > &hits)
 
void fillChargeSums (std::vector< 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 19 of file HcalHitCorrection.h.

Member Typedef Documentation

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

Definition at line 22 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 25 of file HcalHitCorrection.h.

25 {}

Member Function Documentation

double HcalHitCorrection::charge ( const PCaloHit hit) const

how much charge we expect from this hit

Definition at line 67 of file HcalHitCorrection.cc.

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

Referenced by delay(), and fillChargeSums().

68 {
69  HcalDetId detId(hit.id());
71  double simHitToCharge = parameters.simHitToPhotoelectrons(detId)
72  * parameters.photoelectronsToAnalog(detId);
73  return hit.energy() * simHitToCharge;
74 }
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 59 of file HcalHitCorrection.cc.

References i, and theChargeSumsForTimeBin.

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

60 {
61  for(int i = 0; i < 10; ++i)
62  {
63  theChargeSumsForTimeBin[i].clear();
64  }
65 }
int i
Definition: DBlmapReader.cc:9
ChargeSumsByChannel theChargeSumsForTimeBin[10]
double HcalHitCorrection::delay ( const PCaloHit hit) const
virtual

how much delay this hit will get

Implements CaloVHitCorrection.

Definition at line 77 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().

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

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

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

38  {
39 
40  for(std::vector<PCaloHit>::const_iterator hitItr = hits.begin();
41  hitItr != hits.end(); ++hitItr)
42  {
43  HcalDetId hcalDetId(hitItr->id());
44  if(hcalDetId.subdet() == HcalBarrel || hcalDetId.subdet() == HcalEndcap || hcalDetId.subdet() == HcalOuter )
45  {
46  LogDebug("HcalHitCorrection") << "HcalHitCorrection::Hit 0x" << std::hex
47  << hitItr->id() << std::dec;
48  int tbin = timeBin(*hitItr);
49  LogDebug("HcalHitCorrection") << "HcalHitCorrection::Hit tbin" << tbin;
50  if(tbin >= 0 && tbin < 10)
51  {
52  theChargeSumsForTimeBin[tbin][DetId(hitItr->id())] += charge(*hitItr);
53  }
54  }
55  }
56 }
#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
void HcalHitCorrection::setRandomEngine ( CLHEP::HepRandomEngine &  engine)

Definition at line 158 of file HcalHitCorrection.cc.

References theRandGaussQ.

Referenced by HcalDigitizer::HcalDigitizer().

158  {
159  if (theRandGaussQ==0) {
160  theRandGaussQ=new CLHEP::RandGaussQ(engine);
161  }
162 }
CLHEP::RandGaussQ * theRandGaussQ
int HcalHitCorrection::timeBin ( const PCaloHit hit) const

which time bin the peak of the signal will fall in

Definition at line 124 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().

125 {
127  double t = hit.time() - timeOfFlight(DetId(hit.id())) + parameters.timePhase();
128  return static_cast<int> (t / 25) + parameters.binOfMaximum() - 1;
129 }
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 132 of file HcalHitCorrection.cc.

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

Referenced by timeBin().

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

Member Data Documentation

ChargeSumsByChannel HcalHitCorrection::theChargeSumsForTimeBin[10]
private

Definition at line 50 of file HcalHitCorrection.h.

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

const CaloVSimParameterMap* HcalHitCorrection::theParameterMap
private

Definition at line 48 of file HcalHitCorrection.h.

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

CLHEP::RandGaussQ* HcalHitCorrection::theRandGaussQ
private

Definition at line 52 of file HcalHitCorrection.h.

Referenced by delay(), and setRandomEngine().