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 (const std::vector< PCaloHit > &hits)
 
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...
 
 ~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) {}

◆ ~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.

42  {
43  DetId detId(hit.id());
45  double simHitToCharge = parameters.simHitToPhotoelectrons() * parameters.photoelectronsToAnalog();
46  return hit.energy() * simHitToCharge;
47 }

References hit::id, CaloVSimParameterMap::simParameters(), and theParameterMap.

Referenced by delay(), and fillChargeSums().

◆ clear()

void CastorHitCorrection::clear ( void  )

Definition at line 36 of file CastorHitCorrection.cc.

36  {
37  for (int i = 0; i < 10; ++i) {
38  theChargeSumsForTimeBin[i].clear();
39  }
40 }

References mps_fire::i, and theChargeSumsForTimeBin.

◆ 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.

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 }

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

◆ fillChargeSums() [1/2]

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

Definition at line 24 of file CastorHitCorrection.cc.

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 }

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

◆ fillChargeSums() [2/2]

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

Definition at line 12 of file CastorHitCorrection.cc.

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 }

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

Referenced by CastorDigiProducer::accumulateCaloHits().

◆ 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.

79  {
81  double t = hit.time() - timeOfFlight(DetId(hit.id())) + parameters.timePhase();
82  return static_cast<int>(t / 25) + parameters.binOfMaximum() - 1;
83 }

References hit::id, CaloVSimParameterMap::simParameters(), submitPVValidationJobs::t, theParameterMap, and timeOfFlight().

Referenced by delay(), and fillChargeSums().

◆ timeOfFlight()

double CastorHitCorrection::timeOfFlight ( const DetId id) const

simple average approximation

Definition at line 85 of file CastorHitCorrection.cc.

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

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

Referenced by timeBin().

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().

BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:30
mps_fire.i
i
Definition: mps_fire.py:428
hit::id
unsigned int id
Definition: SiStripHitEffFromCalibTree.cc:92
CastorTimeSlew::delay
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: CastorTimeSlew.cc:9
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
HcalCastorDetId::SubdetectorId
static const int SubdetectorId
Definition: HcalCastorDetId.h:28
CastorHitCorrection::theParameterMap
const CaloVSimParameterMap * theParameterMap
Definition: CastorHitCorrection.h:47
CastorHitCorrection::timeOfFlight
double timeOfFlight(const DetId &id) const
simple average approximation
Definition: CastorHitCorrection.cc:85
DetId::Calo
Definition: DetId.h:29
MixCollection::MixItr
Definition: MixCollection.h:61
DetId
Definition: DetId.h:17
CastorHitCorrection::delay
double delay(const PCaloHit &hit, CLHEP::HepRandomEngine *) const override
how much delay this hit will get
Definition: CastorHitCorrection.cc:49
CastorHitCorrection::timeBin
int timeBin(const PCaloHit &hit) const
which time bin the peak of the signal will fall in
Definition: CastorHitCorrection.cc:79
mps_fire.end
end
Definition: mps_fire.py:242
CaloSimParameters
Main class for Parameters in different subdetectors.
Definition: CaloSimParameters.h:14
CaloVSimParameterMap::simParameters
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
HcalOuter
Definition: HcalAssistant.h:35
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
CastorTimeSlew::Medium
Definition: CastorTimeSlew.h:19
HcalDetId
Definition: HcalDetId.h:12
HcalForward
Definition: HcalAssistant.h:36
CastorHitCorrection::theChargeSumsForTimeBin
ChargeSumsByChannel theChargeSumsForTimeBin[10]
Definition: CastorHitCorrection.h:49
Exception
Definition: hltDiff.cc:245
CastorHitCorrection::charge
double charge(const PCaloHit &hit) const
how much charge we expect from this hit
Definition: CastorHitCorrection.cc:42
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
CastorTimeSlew::Slow
Definition: CastorTimeSlew.h:19
hit
Definition: SiStripHitEffFromCalibTree.cc:88
CastorTimeSlew::BiasSetting
BiasSetting
Definition: CastorTimeSlew.h:19