1 #ifndef RecoParticleFlow_PFClusterProducer_PFHBHeRecHitCreatorMaxSample_h 2 #define RecoParticleFlow_PFClusterProducer_PFHBHeRecHitCreatorMaxSample_h 63 for(
const auto& erh : *recHitHandle ) {
75 int auxwd1 = erh.auxHBHE();
76 int auxwd2 = erh.aux();
81 adc[0] = (auxwd1) & 0x7F;
82 adc[1] = (auxwd1 >> 7) & 0x7F;
83 adc[2] = (auxwd1 >> 14) & 0x7F;
84 adc[3] = (auxwd1 >> 21) & 0x7F;
86 capid[0] = (auxwd1 >> 28) & 0x3;
87 capid[1] = (capid[0] + 1 <= 3) ? capid[0] + 1 : 0;
88 capid[2] = (capid[1] + 1 <= 3) ? capid[1] + 1 : 0;
89 capid[3] = (capid[2] + 1 <= 3) ? capid[2] + 1 : 0;
91 adc[4] = (auxwd2) & 0x7F;
92 adc[5] = (auxwd2 >> 7) & 0x7F;
93 adc[6] = (auxwd2 >> 14) & 0x7F;
94 adc[7] = (auxwd2 >> 21) & 0x7F;
96 capid[4] = (auxwd2 >> 28) & 0x3;
97 capid[5] = (capid[4] + 1 <= 3) ? capid[4] + 1 : 0;
98 capid[6] = (capid[5] + 1 <= 3) ? capid[5] + 1 : 0;
99 capid[7] = (capid[6] + 1 <= 3) ? capid[6] + 1 : 0;
105 for (
int ii = 0;
ii < 8;
ii++) {
115 for (
int ii = 0;
ii < 8;
ii++) {
117 (tool[
ii] - calibrations.
pedestal(capid[ii]));
119 samples[
ii] = sampleE;
131 std::vector<double> hitEnergies;
132 std::vector<double> hitTimes;
134 for (
int ii = 0;
ii < 8;
ii++) {
135 energy=energy+samples[
ii];
136 s2=samples[
ii]*samples[
ii];
137 time = time+(-100. +
ii*25.0)*
s2;
141 if (samples[
ii]<=samples[
ii-1] && samples[
ii]<samples[
ii+1] && energy>0) {
142 hitEnergies.push_back(energy);
143 hitTimes.push_back(time/energy2);
150 else if (
ii==7 && energy>0) {
151 hitEnergies.push_back(energy);
152 hitTimes.push_back(time/energy2);
160 if (hitEnergies.empty())
165 std::shared_ptr<const CaloCellGeometry> thisCell =
nullptr;
184 <<
"warning detid "<<detid.
rawId()
185 <<
" not found in geometry"<<std::endl;
202 auto best_hit = std::min_element(hitTimes.begin(),hitTimes.end(),
205 return fabs(a) < fabs(
b);
209 rh.setTime(*best_hit);
210 rh.setEnergy(hitEnergies[
std::distance(hitTimes.begin(),best_hit)]);
214 bool rcleaned =
false;
218 if (!qtest->test(rh,erh,rcleaned)) {
227 cleaned->push_back(rh);
int adc(sample_type sample)
get the ADC sample (12 bits)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
constexpr uint32_t rawId() const
get the raw id
~PFHBHERecHitCreatorMaxSample() override=default
int depth() const
get the tower depth
void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const override
edm::EDGetTokenT< edm::SortedCollection< HBHERecHit > > recHitToken_
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
void setPresamples(int ps)
void setSample(int i, const HcalQIESample &sam)
void importRecHits(std::unique_ptr< reco::PFRecHitCollection > &out, std::unique_ptr< reco::PFRecHitCollection > &cleaned, const edm::Event &iEvent, const edm::EventSetup &iSetup) override
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
void beginEvent(const edm::Event &event, const edm::EventSetup &setup)
constexpr double pedestal(int fCapId) const
get pedestal for capid=0..3
PFHBHERecHitCreatorMaxSample(const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
constexpr double respcorrgain(int fCapId) const
get response corrected gain for capid=0..3