CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 ()
 
double delay (const PCaloHit &hit, CLHEP::HepRandomEngine *) const override
 how much delay this hit will get More...
 
void fillChargeSums (MixCollection< PCaloHit > &hits)
 
void fillChargeSums (const std::vector< 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...
 
 ~CastorHitCorrection () override
 
- Public Member Functions inherited from CaloVHitCorrection
virtual ~CaloVHitCorrection ()=default
 

Private Attributes

ChargeSumsByChannel theChargeSumsForTimeBin [10]
 
const CaloVSimParameterMaptheParameterMap
 

Detailed Description

Definition at line 21 of file CastorHitCorrection.h.

Member Typedef Documentation

Definition at line 23 of file CastorHitCorrection.h.

Constructor & Destructor Documentation

CastorHitCorrection::CastorHitCorrection ( const CaloVSimParameterMap parameterMap)

Definition at line 10 of file CastorHitCorrection.cc.

10 : theParameterMap(parameterMap) {}
const CaloVSimParameterMap * theParameterMap
CastorHitCorrection::~CastorHitCorrection ( )
inlineoverride

Definition at line 26 of file CastorHitCorrection.h.

26 {}

Member Function Documentation

double CastorHitCorrection::charge ( const PCaloHit hit) const

how much charge we expect from this hit

Definition at line 42 of file CastorHitCorrection.cc.

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

Referenced by delay(), and fillChargeSums().

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

Definition at line 36 of file CastorHitCorrection.cc.

References mps_fire::i, and theChargeSumsForTimeBin.

36  {
37  for (int i = 0; i < 10; ++i) {
38  theChargeSumsForTimeBin[i].clear();
39  }
40 }
ChargeSumsByChannel theChargeSumsForTimeBin[10]
double CastorHitCorrection::delay ( const PCaloHit hit,
CLHEP::HepRandomEngine *   
) const
overridevirtual

how much delay this hit will get

Implements CaloVHitCorrection.

Definition at line 49 of file CastorHitCorrection.cc.

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

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

Definition at line 12 of file CastorHitCorrection.cc.

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

Referenced by CastorDigiProducer::accumulateCaloHits().

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

Definition at line 24 of file CastorHitCorrection.cc.

References charge(), TauDecayModes::dec, LogDebug, theChargeSumsForTimeBin, and timeBin().

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

which time bin the peak of the signal will fall in

Definition at line 79 of file CastorHitCorrection.cc.

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

Referenced by delay(), and fillChargeSums().

79  {
81  double t = hit.time() - timeOfFlight(DetId(hit.id())) + parameters.timePhase();
82  return static_cast<int>(t / 25) + parameters.binOfMaximum() - 1;
83 }
double timeOfFlight(const DetId &id) const
simple average approximation
double time() const
Definition: PCaloHit.h:30
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:37
Definition: DetId.h:17
const CaloVSimParameterMap * theParameterMap
int binOfMaximum() const
double CastorHitCorrection::timeOfFlight ( const DetId id) const

simple average approximation

Definition at line 85 of file CastorHitCorrection.cc.

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

Referenced by timeBin().

85  {
86  if (detId.det() == DetId::Calo && detId.subdetId() == HcalCastorDetId::SubdetectorId)
87  return 37.666;
88  else
89  throw cms::Exception("not HcalCastorDetId");
90 }
static const int SubdetectorId

Member Data Documentation

ChargeSumsByChannel CastorHitCorrection::theChargeSumsForTimeBin[10]
private

Definition at line 49 of file CastorHitCorrection.h.

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

const CaloVSimParameterMap* CastorHitCorrection::theParameterMap
private

Definition at line 47 of file CastorHitCorrection.h.

Referenced by charge(), and timeBin().