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 double delay (const PCaloHit &hit, CLHEP::HepRandomEngine *) const
 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...
 
virtual ~CastorHitCorrection ()
 

Private Attributes

ChargeSumsByChannel theChargeSumsForTimeBin [10]
 
const CaloVSimParameterMaptheParameterMap
 

Detailed Description

Definition at line 22 of file CastorHitCorrection.h.

Member Typedef Documentation

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

28 {}

Member Function Documentation

double CastorHitCorrection::charge ( const PCaloHit hit) const

how much charge we expect from this hit

Definition at line 57 of file CastorHitCorrection.cc.

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

Referenced by delay(), and fillChargeSums().

58 {
59  DetId detId(hit.id());
61  double simHitToCharge = parameters.simHitToPhotoelectrons()
62  * parameters.photoelectronsToAnalog();
63  return hit.energy() * simHitToCharge;
64 }
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
Definition: DetId.h:18
const CaloVSimParameterMap * theParameterMap
void CastorHitCorrection::clear ( void  )

Definition at line 49 of file CastorHitCorrection.cc.

References i, and theChargeSumsForTimeBin.

50 {
51  for(int i = 0; i < 10; ++i)
52  {
53  theChargeSumsForTimeBin[i].clear();
54  }
55 }
int i
Definition: DBlmapReader.cc:9
ChargeSumsByChannel theChargeSumsForTimeBin[10]
double CastorHitCorrection::delay ( const PCaloHit hit,
CLHEP::HepRandomEngine *   
) const
virtual

how much delay this hit will get

Implements CaloVHitCorrection.

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

67 {
68  // HO goes slow, HF shouldn't be used at all
69  //Castor not used for the moment
70 
71  DetId detId(hit.id());
72  if(detId.det()==DetId::Calo && (detId.subdetId()==HcalCastorDetId::SubdetectorId)) return 0;
73 
74  HcalDetId hcalDetId(hit.id());
75  if(hcalDetId.subdet() == HcalForward) return 0;
76  CastorTimeSlew::BiasSetting biasSetting = (hcalDetId.subdet() == HcalOuter) ?
79  double delay = 0.;
80  int tbin = timeBin(hit);
81  if(tbin >= 0 && tbin < 10)
82  {
83  ChargeSumsByChannel::const_iterator totalChargeItr = theChargeSumsForTimeBin[tbin].find(detId);
84  if(totalChargeItr == theChargeSumsForTimeBin[tbin].end())
85  {
86  throw cms::Exception("CastorHitCorrection") << "Cannot find HCAL/CASTOR charge sum for hit " << hit;
87  }
88  double totalCharge = totalChargeItr->second;
89  delay = CastorTimeSlew::delay(totalCharge, biasSetting);
90  LogDebug("CastorHitCorrection") << "TIMESLEWcharge " << charge(hit)
91  << " totalcharge " << totalCharge
92  << " olddelay " << CastorTimeSlew::delay(charge(hit), biasSetting)
93  << " newdelay " << delay;
94  }
95 
96  return delay;
97 }
#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...
virtual double delay(const PCaloHit &hit, CLHEP::HepRandomEngine *) const
how much delay this hit will get
int timeBin(const PCaloHit &hit) const
which time bin the peak of the signal will fall in
#define end
Definition: vmac.h:37
unsigned int id() const
Definition: PCaloHit.h:43
static const int SubdetectorId
Definition: DetId.h:18
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::accumulateCaloHits().

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:18
iterator begin()
double charge(const PCaloHit &hit) const
how much charge we expect from this hit
ChargeSumsByChannel theChargeSumsForTimeBin[10]
void CastorHitCorrection::fillChargeSums ( const std::vector< PCaloHit > &  hits)

Definition at line 32 of file CastorHitCorrection.cc.

References charge(), LogDebug, theChargeSumsForTimeBin, and timeBin().

33 {
34  // clear();
35  for(std::vector<PCaloHit>::const_iterator hitItr = hits.begin();
36  hitItr != hits.end(); ++hitItr)
37  {
38  LogDebug("CastorHitCorrection") << "CastorHitCorrection::Hit 0x" << std::hex << hitItr->id() << std::dec;
39  int tbin = timeBin(*hitItr);
40  LogDebug("CastorHitCorrection") << "CastorHitCorrection::Hit tbin" << tbin;
41  if(tbin >= 0 && tbin < 10)
42  {
43  theChargeSumsForTimeBin[tbin][DetId(hitItr->id())] += charge(*hitItr);
44  }
45  }
46 }
#define LogDebug(id)
int timeBin(const PCaloHit &hit) const
which time bin the peak of the signal will fall in
Definition: DetId.h:18
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 100 of file CastorHitCorrection.cc.

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

Referenced by delay(), and fillChargeSums().

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

simple average approximation

Definition at line 108 of file CastorHitCorrection.cc.

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

Referenced by timeBin().

109 {
110  if(detId.det()==DetId::Calo && detId.subdetId()==HcalCastorDetId::SubdetectorId)
111  return 37.666;
112  else
113  throw cms::Exception("not HcalCastorDetId");
114 }
static const int SubdetectorId

Member Data Documentation

ChargeSumsByChannel CastorHitCorrection::theChargeSumsForTimeBin[10]
private

Definition at line 52 of file CastorHitCorrection.h.

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

const CaloVSimParameterMap* CastorHitCorrection::theParameterMap
private

Definition at line 50 of file CastorHitCorrection.h.

Referenced by charge(), and timeBin().