CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CastorHitCorrection.cc
Go to the documentation of this file.
9 
11 : theParameterMap(parameterMap)
12 {
13 }
14 
15 
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 }
31 
32 
34 {
35  for(int i = 0; i < 10; ++i)
36  {
37  theChargeSumsForTimeBin[i].clear();
38  }
39 }
40 
42 {
43  DetId detId(hit.id());
45  double simHitToCharge = parameters.simHitToPhotoelectrons()
46  * parameters.photoelectronsToAnalog();
47  return hit.energy() * simHitToCharge;
48 }
49 
50 double CastorHitCorrection::delay(const PCaloHit & hit) const
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 }
82 
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 }
87 
88 
90 {
92  double t = hit.time() - timeOfFlight(DetId(hit.id())) + parameters.timePhase();
93  return static_cast<int> (t / 25) + parameters.binOfMaximum() - 1;
94 }
95 
96 
97 double CastorHitCorrection::timeOfFlight(const DetId & detId) const
98 {
100  return 37.666;
101  else
102  throw cms::Exception("not HcalCastorDetId");
103 }
104 
#define LogDebug(id)
double timeOfFlight(const DetId &id) const
simple average approximation
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 void correct(PCaloHit &hit) const
applies the delay to the hit
int i
Definition: DBlmapReader.cc:9
dictionary parameters
Definition: Parameters.py:2
double time() const
Definition: PCaloHit.h:34
double energyEM() const
Definition: PCaloHit.h:30
int timeBin(const PCaloHit &hit) const
which time bin the peak of the signal will fall in
void fillChargeSums(MixCollection< PCaloHit > &hits)
double energy() const
Definition: PCaloHit.h:29
double delay(const PCaloHit &hit) const
how much delay this hit will get
double energyHad() const
Definition: PCaloHit.h:31
Main class for Parameters in different subdetectors.
iterator end()
double timePhase() const
the adjustment you need to apply to get the signal where you want it
int geantTrackId() const
Definition: PCaloHit.h:37
double simHitToPhotoelectrons() const
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
#define end
Definition: vmac.h:38
unsigned int id() const
Definition: PCaloHit.h:40
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
static const int SubdetectorId
CastorHitCorrection(const CaloVSimParameterMap *parameterMap)
Definition: DetId.h:20
iterator begin()
const CaloVSimParameterMap * theParameterMap
double charge(const PCaloHit &hit) const
how much charge we expect from this hit
ChargeSumsByChannel theChargeSumsForTimeBin[10]
Detector det() const
get the detector field from this detid
Definition: DetId.h:37
int binOfMaximum() const