#include <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) | |
void | setRandomEngine (CLHEP::HepRandomEngine &engine) |
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 |
CLHEP::RandGaussQ * | theRandGaussQ |
Applies a correction for time slewing Makes bigger signals come at a delayed time
Rick Wilkinson
Definition at line 18 of file HcalHitCorrection.h.
typedef std::map<DetId, double> HcalHitCorrection::ChargeSumsByChannel |
Definition at line 21 of file HcalHitCorrection.h.
HcalHitCorrection::HcalHitCorrection | ( | const CaloVSimParameterMap * | parameterMap | ) |
Definition at line 11 of file HcalHitCorrection.cc.
: theParameterMap(parameterMap),theRandGaussQ(0) { }
virtual HcalHitCorrection::~HcalHitCorrection | ( | ) | [inline, virtual] |
Definition at line 24 of file HcalHitCorrection.h.
{}
double HcalHitCorrection::charge | ( | const PCaloHit & | hit | ) | const |
how much charge we expect from this hit
Definition at line 46 of file HcalHitCorrection.cc.
References PCaloHit::energy(), PCaloHit::id(), Parameters::parameters, CaloSimParameters::simHitToPhotoelectrons(), CaloVSimParameterMap::simParameters(), and theParameterMap.
Referenced by delay(), and fillChargeSums().
{ HcalDetId detId(hit.id()); const CaloSimParameters & parameters = theParameterMap->simParameters(detId); double simHitToCharge = parameters.simHitToPhotoelectrons(detId) * parameters.photoelectronsToAnalog(detId); return hit.energy() * simHitToCharge; }
void HcalHitCorrection::clear | ( | void | ) |
Definition at line 38 of file HcalHitCorrection.cc.
References i, and theChargeSumsForTimeBin.
Referenced by HcalDigitizer::produce().
{ for(int i = 0; i < 10; ++i) { theChargeSumsForTimeBin[i].clear(); } }
void HcalHitCorrection::correct | ( | PCaloHit & | hit | ) | const [virtual] |
applies the delay to the hit
Implements CaloVHitCorrection.
Definition at line 104 of file HcalHitCorrection.cc.
References delay(), PCaloHit::energyEM(), PCaloHit::energyHad(), PCaloHit::geantTrackId(), PCaloHit::id(), and PCaloHit::time().
double HcalHitCorrection::delay | ( | const PCaloHit & | hit | ) | const |
how much delay this hit will get
Definition at line 56 of file HcalHitCorrection.cc.
References DetId::Calo, charge(), HcalSimParameters::doTimeSmear(), end, Exception, HcalBarrel, HcalEndcap, HcalOuter, PCaloHit::id(), LogDebug, HcalTimeSlew::Medium, plotscripts::rms(), CaloVSimParameterMap::simParameters(), HcalTimeSlew::Slow, HcalZDCDetId::SubdetectorId, theChargeSumsForTimeBin, theParameterMap, theRandGaussQ, timeBin(), and HcalSimParameters::timeSmearRMS().
Referenced by correct().
{ // HO goes slow, HF shouldn't be used at all //ZDC not used for the moment DetId detId(hit.id()); if(detId.det()==DetId::Calo && detId.subdetId()==HcalZDCDetId::SubdetectorId) return 0; HcalDetId hcalDetId(hit.id()); double delay = 0.; if(hcalDetId.subdet() == HcalBarrel || hcalDetId.subdet() == HcalEndcap || hcalDetId.subdet() == HcalOuter ) { HcalTimeSlew::BiasSetting biasSetting = (hcalDetId.subdet() == HcalOuter) ? HcalTimeSlew::Slow : HcalTimeSlew::Medium; int tbin = timeBin(hit); double totalCharge=0; if(tbin >= 0 && tbin < 10) { ChargeSumsByChannel::const_iterator totalChargeItr = theChargeSumsForTimeBin[tbin].find(detId); if(totalChargeItr == theChargeSumsForTimeBin[tbin].end()) { throw cms::Exception("HcalHitCorrection") << "Cannot find HCAL charge sum for hit " << hit; } totalCharge = totalChargeItr->second; delay = HcalTimeSlew::delay(totalCharge, biasSetting); LogDebug("HcalHitCorrection") << "TIMESLEWcharge " << charge(hit) << " totalcharge " << totalCharge << " olddelay " << HcalTimeSlew::delay(charge(hit), biasSetting) << " newdelay " << delay; } // now, the smearing const HcalSimParameters& params=static_cast<const HcalSimParameters&>(theParameterMap->simParameters(detId)); if (params.doTimeSmear() && theRandGaussQ!=0) { double rms=params.timeSmearRMS(charge(hit)); double smearns=theRandGaussQ->fire()*rms; LogDebug("HcalHitCorrection") << "TimeSmear charge " << charge(hit) << " rms " << rms << " delay " << delay << " smearns " << smearns; delay+=smearns; } } return delay; }
void HcalHitCorrection::fillChargeSums | ( | MixCollection< PCaloHit > & | hits | ) |
Definition at line 17 of file HcalHitCorrection.cc.
References MixCollection< T >::begin(), charge(), MixCollection< T >::end(), HcalBarrel, HcalEndcap, HcalOuter, LogDebug, theChargeSumsForTimeBin, and timeBin().
Referenced by HcalDigitizer::produce(), and HcalTBDigiProducer::produce().
{ for(MixCollection<PCaloHit>::MixItr hitItr = hits.begin(); hitItr != hits.end(); ++hitItr) { HcalDetId hcalDetId(hitItr->id()); if(hcalDetId.subdet() == HcalBarrel || hcalDetId.subdet() == HcalEndcap || hcalDetId.subdet() == HcalOuter ) { LogDebug("HcalHitCorrection") << "HcalHitCorrection::Hit 0x" << std::hex << hitItr->id() << std::dec; int tbin = timeBin(*hitItr); LogDebug("HcalHitCorrection") << "HcalHitCorrection::Hit tbin" << tbin; if(tbin >= 0 && tbin < 10) { theChargeSumsForTimeBin[tbin][DetId(hitItr->id())] += charge(*hitItr); } } } }
void HcalHitCorrection::setRandomEngine | ( | CLHEP::HepRandomEngine & | engine | ) |
Definition at line 144 of file HcalHitCorrection.cc.
References theRandGaussQ.
Referenced by HcalDigitizer::HcalDigitizer().
{ if (theRandGaussQ==0) { theRandGaussQ=new CLHEP::RandGaussQ(engine); } }
int HcalHitCorrection::timeBin | ( | const PCaloHit & | hit | ) | const |
which time bin the peak of the signal will fall in
Definition at line 110 of file HcalHitCorrection.cc.
References CaloSimParameters::binOfMaximum(), PCaloHit::id(), Parameters::parameters, CaloVSimParameterMap::simParameters(), lumiQTWidget::t, theParameterMap, PCaloHit::time(), timeOfFlight(), and CaloSimParameters::timePhase().
Referenced by delay(), and fillChargeSums().
{ const CaloSimParameters & parameters = theParameterMap->simParameters(DetId(hit.id())); double t = hit.time() - timeOfFlight(DetId(hit.id())) + parameters.timePhase(); return static_cast<int> (t / 25) + parameters.binOfMaximum() - 1; }
double HcalHitCorrection::timeOfFlight | ( | const DetId & | id | ) | const |
simple average approximation
Definition at line 118 of file HcalHitCorrection.cc.
References DetId::Calo, DetId::det(), Exception, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalZDCDetId::SubdetectorId, and DetId::subdetId().
Referenced by timeBin().
{ if(detId.det()==DetId::Calo && detId.subdetId()==HcalZDCDetId::SubdetectorId) return 37.666; switch(detId.subdetId()) { case HcalBarrel: return 8.4; break; case HcalEndcap: return 13.; break; case HcalOuter: return 18.7; break; case HcalForward: return 37.; break; default: throw cms::Exception("HcalHitCorrection") << "Bad Hcal subdetector " << detId.subdetId(); break; } }
Definition at line 51 of file HcalHitCorrection.h.
Referenced by clear(), delay(), and fillChargeSums().
const CaloVSimParameterMap* HcalHitCorrection::theParameterMap [private] |
Definition at line 49 of file HcalHitCorrection.h.
CLHEP::RandGaussQ* HcalHitCorrection::theRandGaussQ [private] |
Definition at line 53 of file HcalHitCorrection.h.
Referenced by delay(), and setRandomEngine().