#include <CastorHitCorrection.h>
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 | |
void | clear () |
virtual double | delay (const PCaloHit &hit) const |
how much delay this hit will get | |
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 | |
double | timeOfFlight (const DetId &id) const |
simple average approximation | |
virtual | ~CastorHitCorrection () |
Private Attributes | |
ChargeSumsByChannel | theChargeSumsForTimeBin [10] |
const CaloVSimParameterMap * | theParameterMap |
Applies a correction for time slewing Makes bigger signals come at a delayed time
Definition at line 17 of file CastorHitCorrection.h.
typedef std::map<DetId, double> CastorHitCorrection::ChargeSumsByChannel |
Definition at line 20 of file CastorHitCorrection.h.
CastorHitCorrection::CastorHitCorrection | ( | const CaloVSimParameterMap * | parameterMap | ) |
Definition at line 10 of file CastorHitCorrection.cc.
: theParameterMap(parameterMap) { }
virtual CastorHitCorrection::~CastorHitCorrection | ( | ) | [inline, virtual] |
Definition at line 23 of file CastorHitCorrection.h.
{}
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().
{ DetId detId(hit.id()); const CaloSimParameters & parameters = theParameterMap->simParameters(detId); double simHitToCharge = parameters.simHitToPhotoelectrons() * parameters.photoelectronsToAnalog(); return hit.energy() * simHitToCharge; }
void CastorHitCorrection::clear | ( | void | ) |
Definition at line 49 of file CastorHitCorrection.cc.
References i, and theChargeSumsForTimeBin.
{ for(int i = 0; i < 10; ++i) { theChargeSumsForTimeBin[i].clear(); } }
double CastorHitCorrection::delay | ( | const PCaloHit & | hit | ) | const [virtual] |
how much delay this hit will get
Implements CaloVHitCorrection.
Definition at line 66 of file CastorHitCorrection.cc.
References DetId::Calo, charge(), end, Exception, HcalForward, HcalOuter, PCaloHit::id(), LogDebug, CastorTimeSlew::Medium, CastorTimeSlew::Slow, HcalCastorDetId::SubdetectorId, theChargeSumsForTimeBin, and timeBin().
{ // HO goes slow, HF shouldn't be used at all //Castor not used for the moment DetId detId(hit.id()); if(detId.det()==DetId::Calo && (detId.subdetId()==HcalCastorDetId::SubdetectorId)) return 0; HcalDetId hcalDetId(hit.id()); if(hcalDetId.subdet() == HcalForward) return 0; CastorTimeSlew::BiasSetting biasSetting = (hcalDetId.subdet() == HcalOuter) ? CastorTimeSlew::Slow : CastorTimeSlew::Medium; double delay = 0.; int tbin = timeBin(hit); if(tbin >= 0 && tbin < 10) { ChargeSumsByChannel::const_iterator totalChargeItr = theChargeSumsForTimeBin[tbin].find(detId); if(totalChargeItr == theChargeSumsForTimeBin[tbin].end()) { throw cms::Exception("CastorHitCorrection") << "Cannot find HCAL/CASTOR charge sum for hit " << hit; } double totalCharge = totalChargeItr->second; delay = CastorTimeSlew::delay(totalCharge, biasSetting); LogDebug("CastorHitCorrection") << "TIMESLEWcharge " << charge(hit) << " totalcharge " << totalCharge << " olddelay " << CastorTimeSlew::delay(charge(hit), biasSetting) << " newdelay " << delay; } return delay; }
void CastorHitCorrection::fillChargeSums | ( | const std::vector< PCaloHit > & | hits | ) |
Definition at line 32 of file CastorHitCorrection.cc.
References charge(), LogDebug, theChargeSumsForTimeBin, and timeBin().
{ // clear(); for(std::vector<PCaloHit>::const_iterator hitItr = hits.begin(); hitItr != hits.end(); ++hitItr) { LogDebug("CastorHitCorrection") << "CastorHitCorrection::Hit 0x" << std::hex << hitItr->id() << std::dec; int tbin = timeBin(*hitItr); LogDebug("CastorHitCorrection") << "CastorHitCorrection::Hit tbin" << tbin; if(tbin >= 0 && tbin < 10) { theChargeSumsForTimeBin[tbin][DetId(hitItr->id())] += charge(*hitItr); } } }
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().
{ // clear(); for(MixCollection<PCaloHit>::MixItr hitItr = hits.begin(); hitItr != hits.end(); ++hitItr) { LogDebug("CastorHitCorrection") << "CastorHitCorrection::Hit 0x" << std::hex << hitItr->id() << std::dec; int tbin = timeBin(*hitItr); LogDebug("CastorHitCorrection") << "CastorHitCorrection::Hit tbin" << tbin; if(tbin >= 0 && tbin < 10) { theChargeSumsForTimeBin[tbin][DetId(hitItr->id())] += charge(*hitItr); } } }
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(), 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 CastorHitCorrection::timeOfFlight | ( | const DetId & | id | ) | const |
simple average approximation
Definition at line 108 of file CastorHitCorrection.cc.
References DetId::Calo, DetId::det(), Exception, HcalCastorDetId::SubdetectorId, and DetId::subdetId().
Referenced by timeBin().
{ if(detId.det()==DetId::Calo && detId.subdetId()==HcalCastorDetId::SubdetectorId) return 37.666; else throw cms::Exception("not HcalCastorDetId"); }
Definition at line 47 of file CastorHitCorrection.h.
Referenced by clear(), delay(), and fillChargeSums().
const CaloVSimParameterMap* CastorHitCorrection::theParameterMap [private] |
Definition at line 45 of file CastorHitCorrection.h.