CMS 3D CMS Logo

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

◆ ChargeSumsByChannel

Definition at line 23 of file CastorHitCorrection.h.

Constructor & Destructor Documentation

◆ CastorHitCorrection()

CastorHitCorrection::CastorHitCorrection ( const CaloVSimParameterMap parameterMap)

Definition at line 10 of file CastorHitCorrection.cc.

10 : theParameterMap(parameterMap) {}
const CaloVSimParameterMap * theParameterMap

◆ ~CastorHitCorrection()

CastorHitCorrection::~CastorHitCorrection ( )
inlineoverride

Definition at line 26 of file CastorHitCorrection.h.

26 {}

Member Function Documentation

◆ charge()

double CastorHitCorrection::charge ( const PCaloHit hit) const

how much charge we expect from this hit

Definition at line 42 of file CastorHitCorrection.cc.

References hit::id, 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 }
Main class for Parameters in different subdetectors.
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
unsigned int id
Definition: DetId.h:17
const CaloVSimParameterMap * theParameterMap

◆ clear()

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]

◆ delay()

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(), mps_fire::end, Exception, HcalForward, HcalOuter, hit::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 }
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...
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
static const int SubdetectorId
unsigned int id
Definition: DetId.h:17
ChargeSumsByChannel theChargeSumsForTimeBin[10]
#define LogDebug(id)

◆ fillChargeSums() [1/2]

void CastorHitCorrection::fillChargeSums ( MixCollection< PCaloHit > &  hits)

Definition at line 12 of file CastorHitCorrection.cc.

References charge(), TauDecayModes::dec, hfClusterShapes_cfi::hits, 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 }
double charge(const PCaloHit &hit) const
how much charge we expect from this hit
int timeBin(const PCaloHit &hit) const
which time bin the peak of the signal will fall in
Definition: DetId.h:17
ChargeSumsByChannel theChargeSumsForTimeBin[10]
#define LogDebug(id)

◆ fillChargeSums() [2/2]

void CastorHitCorrection::fillChargeSums ( const std::vector< PCaloHit > &  hits)

Definition at line 24 of file CastorHitCorrection.cc.

References charge(), TauDecayModes::dec, hfClusterShapes_cfi::hits, 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 }
double charge(const PCaloHit &hit) const
how much charge we expect from this hit
int timeBin(const PCaloHit &hit) const
which time bin the peak of the signal will fall in
Definition: DetId.h:17
ChargeSumsByChannel theChargeSumsForTimeBin[10]
#define LogDebug(id)

◆ timeBin()

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 hit::id, CaloVSimParameterMap::simParameters(), submitPVValidationJobs::t, theParameterMap, and timeOfFlight().

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 }
Main class for Parameters in different subdetectors.
double timeOfFlight(const DetId &id) const
simple average approximation
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
unsigned int id
Definition: DetId.h:17
const CaloVSimParameterMap * theParameterMap

◆ timeOfFlight()

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

◆ theChargeSumsForTimeBin

ChargeSumsByChannel CastorHitCorrection::theChargeSumsForTimeBin[10]
private

Definition at line 49 of file CastorHitCorrection.h.

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

◆ theParameterMap

const CaloVSimParameterMap* CastorHitCorrection::theParameterMap
private

Definition at line 47 of file CastorHitCorrection.h.

Referenced by charge(), and timeBin().