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
CastorHitCorrection Class Reference

#include <CastorHitCorrection.h>

Inheritance diagram for CastorHitCorrection:
CaloVHitCorrection

Public Types

typedef std::map< DetId, double > ChargeSumsByChannel
 

Public Member Functions

 CastorHitCorrection (const CaloVSimParameterMap *parameterMap)
 
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)
 
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 ~CastorHitCorrection ()
 

Private Attributes

ChargeSumsByChannel theChargeSumsForTimeBin [10]
 
const CaloVSimParameterMaptheParameterMap
 

Detailed Description

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

Definition at line 16 of file CastorHitCorrection.h.

Member Typedef Documentation

Definition at line 19 of file CastorHitCorrection.h.

Constructor & Destructor Documentation

CastorHitCorrection::CastorHitCorrection ( const CaloVSimParameterMap parameterMap)

Definition at line 10 of file CastorHitCorrection.cc.

11 : theParameterMap(parameterMap)
12 {
13 }
const CaloVSimParameterMap * theParameterMap
virtual CastorHitCorrection::~CastorHitCorrection ( )
inlinevirtual

Definition at line 22 of file CastorHitCorrection.h.

22 {}

Member Function Documentation

double CastorHitCorrection::charge ( const PCaloHit hit) const

how much charge we expect from this hit

Definition at line 41 of file CastorHitCorrection.cc.

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

Referenced by delay(), and fillChargeSums().

42 {
43  DetId detId(hit.id());
45  double simHitToCharge = parameters.simHitToPhotoelectrons()
46  * parameters.photoelectronsToAnalog();
47  return hit.energy() * simHitToCharge;
48 }
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
Definition: DetId.h:20
const CaloVSimParameterMap * theParameterMap
void CastorHitCorrection::clear ( void  )

Definition at line 33 of file CastorHitCorrection.cc.

References i, and theChargeSumsForTimeBin.

34 {
35  for(int i = 0; i < 10; ++i)
36  {
37  theChargeSumsForTimeBin[i].clear();
38  }
39 }
int i
Definition: DBlmapReader.cc:9
ChargeSumsByChannel theChargeSumsForTimeBin[10]
void CastorHitCorrection::correct ( PCaloHit hit) const
virtual

applies the delay to the hit

Implements CaloVHitCorrection.

Definition at line 83 of file CastorHitCorrection.cc.

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

83  {
84  // replace the hit with a new one, with a time delay
85  hit = PCaloHit(hit.id(), hit.energyEM(), hit.energyHad(), hit.time(), hit.geantTrackId());
86 }
double time() const
Definition: PCaloHit.h:34
double energyEM() const
Definition: PCaloHit.h:30
double energyHad() const
Definition: PCaloHit.h:31
int geantTrackId() const
Definition: PCaloHit.h:37
unsigned int id() const
Definition: PCaloHit.h:40
double CastorHitCorrection::delay ( const PCaloHit hit) const

how much delay this hit will get

Definition at line 50 of file CastorHitCorrection.cc.

References DetId::Calo, charge(), CastorTimeSlew::delay(), end, edm::hlt::Exception, HcalForward, HcalOuter, PCaloHit::id(), LogDebug, CastorTimeSlew::Medium, CastorTimeSlew::Slow, HcalCastorDetId::SubdetectorId, theChargeSumsForTimeBin, and timeBin().

51 {
52  // HO goes slow, HF shouldn't be used at all
53  //Castor not used for the moment
54 
55  DetId detId(hit.id());
56  if(detId.det()==DetId::Calo && (detId.subdetId()==HcalCastorDetId::SubdetectorId)) return 0;
57 
58  HcalDetId hcalDetId(hit.id());
59  if(hcalDetId.subdet() == HcalForward) return 0;
60  CastorTimeSlew::BiasSetting biasSetting = (hcalDetId.subdet() == HcalOuter) ?
63  double delay = 0.;
64  int tbin = timeBin(hit);
65  if(tbin >= 0 && tbin < 10)
66  {
67  ChargeSumsByChannel::const_iterator totalChargeItr = theChargeSumsForTimeBin[tbin].find(detId);
68  if(totalChargeItr == theChargeSumsForTimeBin[tbin].end())
69  {
70  throw cms::Exception("CastorHitCorrection") << "Cannot find HCAL/CASTOR charge sum for hit " << hit;
71  }
72  double totalCharge = totalChargeItr->second;
73  delay = CastorTimeSlew::delay(totalCharge, biasSetting);
74  LogDebug("CastorHitCorrection") << "TIMESLEWcharge " << charge(hit)
75  << " totalcharge " << totalCharge
76  << " olddelay " << CastorTimeSlew::delay(charge(hit), biasSetting)
77  << " newdelay " << delay;
78  }
79 
80  return delay;
81 }
#define LogDebug(id)
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...
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
#define end
Definition: vmac.h:38
unsigned int id() const
Definition: PCaloHit.h:40
static const int SubdetectorId
Definition: DetId.h:20
double charge(const PCaloHit &hit) const
how much charge we expect from this hit
ChargeSumsByChannel theChargeSumsForTimeBin[10]
void CastorHitCorrection::fillChargeSums ( MixCollection< PCaloHit > &  hits)

Definition at line 16 of file CastorHitCorrection.cc.

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

Referenced by CastorDigiProducer::produce().

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

which time bin the peak of the signal will fall in

Definition at line 89 of file CastorHitCorrection.cc.

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

Referenced by delay(), and fillChargeSums().

90 {
92  double t = hit.time() - timeOfFlight(DetId(hit.id())) + parameters.timePhase();
93  return static_cast<int> (t / 25) + parameters.binOfMaximum() - 1;
94 }
double timeOfFlight(const DetId &id) const
simple average approximation
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
const CaloVSimParameterMap * theParameterMap
int binOfMaximum() const
double CastorHitCorrection::timeOfFlight ( const DetId id) const

simple average approximation

Definition at line 97 of file CastorHitCorrection.cc.

References DetId::Calo, DetId::det(), edm::hlt::Exception, HcalCastorDetId::SubdetectorId, and DetId::subdetId().

Referenced by timeBin().

98 {
99  if(detId.det()==DetId::Calo && detId.subdetId()==HcalCastorDetId::SubdetectorId)
100  return 37.666;
101  else
102  throw cms::Exception("not HcalCastorDetId");
103 }
static const int SubdetectorId

Member Data Documentation

ChargeSumsByChannel CastorHitCorrection::theChargeSumsForTimeBin[10]
private

Definition at line 47 of file CastorHitCorrection.h.

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

const CaloVSimParameterMap* CastorHitCorrection::theParameterMap
private

Definition at line 45 of file CastorHitCorrection.h.

Referenced by charge(), and timeBin().