![]() |
![]() |
#include <SimCalorimetry/HcalSimAlgos/interface/HcalHitCorrection.h>
Public Types | |
typedef std::map< DetId, double > | ChargeSumsByChannel |
Public Member Functions | |
double | charge (const PCaloHit &hit) const |
how much charge we expect from this hit | |
void | clear () |
virtual void | correct (PCaloHit &hit) const |
applies the delay to the hit | |
double | delay (const PCaloHit &hit) const |
how much delay this hit will get | |
void | fillChargeSums (MixCollection< PCaloHit > &hits) |
HcalHitCorrection (const CaloVSimParameterMap *parameterMap) | |
int | timeBin (const PCaloHit &hit) const |
which time bin the peak of the signal will fall in | |
double | timeOfFlight (const DetId &id) const |
simple average approximation | |
virtual | ~HcalHitCorrection () |
Private Attributes | |
ChargeSumsByChannel | theChargeSumsForTimeBin [10] |
const CaloVSimParameterMap * | theParameterMap |
Rick Wilkinson
Definition at line 17 of file HcalHitCorrection.h.
typedef std::map<DetId, double> HcalHitCorrection::ChargeSumsByChannel |
Definition at line 20 of file HcalHitCorrection.h.
HcalHitCorrection::HcalHitCorrection | ( | const CaloVSimParameterMap * | parameterMap | ) |
Definition at line 10 of file HcalHitCorrection.cc.
00011 : theParameterMap(parameterMap) 00012 { 00013 }
virtual HcalHitCorrection::~HcalHitCorrection | ( | ) | [inline, virtual] |
double HcalHitCorrection::charge | ( | const PCaloHit & | hit | ) | const |
how much charge we expect from this hit
Definition at line 41 of file HcalHitCorrection.cc.
References detId, PCaloHit::energy(), PCaloHit::id(), python::trackProbabilityAnalysis_cff::parameters, CaloSimParameters::simHitToPhotoelectrons(), CaloVSimParameterMap::simParameters(), and theParameterMap.
Referenced by delay(), and fillChargeSums().
00042 { 00043 DetId detId(hit.id()); 00044 const CaloSimParameters & parameters = theParameterMap->simParameters(detId); 00045 double simHitToCharge = parameters.simHitToPhotoelectrons() 00046 * parameters.photoelectronsToAnalog(); 00047 return hit.energy() * simHitToCharge; 00048 }
Definition at line 33 of file HcalHitCorrection.cc.
References i, and theChargeSumsForTimeBin.
Referenced by HcalDigiProducer::produce().
00034 { 00035 for(int i = 0; i < 10; ++i) 00036 { 00037 theChargeSumsForTimeBin[i].clear(); 00038 } 00039 }
applies the delay to the hit
Implements CaloVHitCorrection.
Definition at line 84 of file HcalHitCorrection.cc.
References delay(), PCaloHit::energyEM(), PCaloHit::energyHad(), PCaloHit::geantTrackId(), PCaloHit::id(), and PCaloHit::time().
00084 { 00085 // replace the hit with a new one, with a time delay 00086 hit = PCaloHit(hit.id(), hit.energyEM(), hit.energyHad(), hit.time()+delay(hit), hit.geantTrackId()); 00087 }
double HcalHitCorrection::delay | ( | const PCaloHit & | hit | ) | const |
how much delay this hit will get
Definition at line 51 of file HcalHitCorrection.cc.
References DetId::Calo, charge(), HcalTimeSlew::delay(), DetId::det(), detId, end, Exception, HcalForward, HcalOuter, PCaloHit::id(), LogDebug, HcalTimeSlew::Medium, HcalTimeSlew::Slow, HcalZDCDetId::SubdetectorId, DetId::subdetId(), theChargeSumsForTimeBin, and timeBin().
Referenced by correct().
00052 { 00053 // HO goes slow, HF shouldn't be used at all 00054 //ZDC not used for the moment 00055 00056 DetId detId(hit.id()); 00057 if(detId.det()==DetId::Calo && detId.subdetId()==HcalZDCDetId::SubdetectorId) return 0; 00058 HcalDetId hcalDetId(hit.id()); 00059 if(hcalDetId.subdet() == HcalForward) return 0; 00060 HcalTimeSlew::BiasSetting biasSetting = (hcalDetId.subdet() == HcalOuter) ? 00061 HcalTimeSlew::Slow : 00062 HcalTimeSlew::Medium; 00063 double delay = 0.; 00064 int tbin = timeBin(hit); 00065 if(tbin >= 0 && tbin < 10) 00066 { 00067 ChargeSumsByChannel::const_iterator totalChargeItr = theChargeSumsForTimeBin[tbin].find(detId); 00068 if(totalChargeItr == theChargeSumsForTimeBin[tbin].end()) 00069 { 00070 throw cms::Exception("HcalHitCorrection") << "Cannot find HCAL charge sum for hit " << hit; 00071 } 00072 double totalCharge = totalChargeItr->second; 00073 delay = HcalTimeSlew::delay(totalCharge, biasSetting); 00074 LogDebug("HcalHitCorrection") << "TIMESLEWcharge " << charge(hit) 00075 << " totalcharge " << totalCharge 00076 << " olddelay " << HcalTimeSlew::delay(charge(hit), biasSetting) 00077 << " newdelay " << delay; 00078 } 00079 00080 return delay; 00081 }
void HcalHitCorrection::fillChargeSums | ( | MixCollection< PCaloHit > & | hits | ) |
Definition at line 16 of file HcalHitCorrection.cc.
References MixCollection< T >::begin(), charge(), MixCollection< T >::end(), LogDebug, theChargeSumsForTimeBin, and timeBin().
Referenced by HcalDigiProducer::produce(), and HcalTBDigiProducer::produce().
00017 { 00018 for(MixCollection<PCaloHit>::MixItr hitItr = hits.begin(); 00019 hitItr != hits.end(); ++hitItr) 00020 { 00021 LogDebug("HcalHitCorrection") << "HcalHitCorrection::Hit 0x" << std::hex 00022 << hitItr->id() << std::dec; 00023 int tbin = timeBin(*hitItr); 00024 LogDebug("HcalHitCorrection") << "HcalHitCorrection::Hit tbin" << tbin; 00025 if(tbin >= 0 && tbin < 10) 00026 { 00027 theChargeSumsForTimeBin[tbin][DetId(hitItr->id())] += charge(*hitItr); 00028 } 00029 } 00030 }
which time bin the peak of the signal will fall in
Definition at line 90 of file HcalHitCorrection.cc.
References CaloSimParameters::binOfMaximum(), PCaloHit::id(), python::trackProbabilityAnalysis_cff::parameters, CaloVSimParameterMap::simParameters(), t, theParameterMap, PCaloHit::time(), timeOfFlight(), and CaloSimParameters::timePhase().
Referenced by delay(), and fillChargeSums().
00091 { 00092 const CaloSimParameters & parameters = theParameterMap->simParameters(DetId(hit.id())); 00093 double t = hit.time() - timeOfFlight(DetId(hit.id())) + parameters.timePhase(); 00094 return static_cast<int> (t / 25) + parameters.binOfMaximum() - 1; 00095 }
double HcalHitCorrection::timeOfFlight | ( | const DetId & | id | ) | const |
simple average approximation
Definition at line 98 of file HcalHitCorrection.cc.
References DetId::Calo, DetId::det(), Exception, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalZDCDetId::SubdetectorId, and DetId::subdetId().
Referenced by timeBin().
00099 { 00100 if(detId.det()==DetId::Calo && detId.subdetId()==HcalZDCDetId::SubdetectorId) 00101 return 37.666; 00102 switch(detId.subdetId()) 00103 { 00104 case HcalBarrel: 00105 return 8.4; 00106 break; 00107 case HcalEndcap: 00108 return 13.; 00109 break; 00110 case HcalOuter: 00111 return 18.7; 00112 break; 00113 case HcalForward: 00114 return 37.; 00115 break; 00116 default: 00117 throw cms::Exception("HcalHitCorrection") << "Bad Hcal subdetector " << detId.subdetId(); 00118 break; 00119 } 00120 }
Definition at line 48 of file HcalHitCorrection.h.
Referenced by clear(), delay(), and fillChargeSums().
const CaloVSimParameterMap* HcalHitCorrection::theParameterMap [private] |