1 #ifndef RecoParticleFlow_PFClusterProducer_PFHBHeRecHitCreatorMaxSample_h 2 #define RecoParticleFlow_PFClusterProducer_PFHBHeRecHitCreatorMaxSample_h 65 for(
const auto& erh : *recHitHandle ) {
77 int auxwd1 = erh.auxHBHE();
78 int auxwd2 = erh.aux();
83 adc[0] = (auxwd1) & 0x7F;
84 adc[1] = (auxwd1 >> 7) & 0x7F;
85 adc[2] = (auxwd1 >> 14) & 0x7F;
86 adc[3] = (auxwd1 >> 21) & 0x7F;
88 capid[0] = (auxwd1 >> 28) & 0x3;
89 capid[1] = (capid[0] + 1 <= 3) ? capid[0] + 1 : 0;
90 capid[2] = (capid[1] + 1 <= 3) ? capid[1] + 1 : 0;
91 capid[3] = (capid[2] + 1 <= 3) ? capid[2] + 1 : 0;
93 adc[4] = (auxwd2) & 0x7F;
94 adc[5] = (auxwd2 >> 7) & 0x7F;
95 adc[6] = (auxwd2 >> 14) & 0x7F;
96 adc[7] = (auxwd2 >> 21) & 0x7F;
98 capid[4] = (auxwd2 >> 28) & 0x3;
99 capid[5] = (capid[4] + 1 <= 3) ? capid[4] + 1 : 0;
100 capid[6] = (capid[5] + 1 <= 3) ? capid[5] + 1 : 0;
101 capid[7] = (capid[6] + 1 <= 3) ? capid[6] + 1 : 0;
107 for (
int ii = 0;
ii < 8;
ii++) {
117 for (
int ii = 0;
ii < 8;
ii++) {
119 (tool[
ii] - calibrations.
pedestal(capid[ii]));
121 samples[
ii] = sampleE;
133 std::vector<double> hitEnergies;
134 std::vector<double> hitTimes;
136 for (
int ii = 0;
ii < 8;
ii++) {
137 energy=energy+samples[
ii];
138 s2=samples[
ii]*samples[
ii];
139 time = time+(-100. +
ii*25.0)*
s2;
143 if (samples[
ii]<=samples[
ii-1] && samples[
ii]<samples[
ii+1] && energy>0) {
144 hitEnergies.push_back(energy);
145 hitTimes.push_back(time/energy2);
152 else if (
ii==7 && energy>0) {
153 hitEnergies.push_back(energy);
154 hitTimes.push_back(time/energy2);
162 if (hitEnergies.empty())
186 <<
"warning detid "<<detid.
rawId()
187 <<
" not found in geometry"<<std::endl;
204 auto best_hit = std::min_element(hitTimes.begin(),hitTimes.end(),
207 return fabs(a) < fabs(
b);
211 rh.setTime(*best_hit);
212 rh.setEnergy(hitEnergies[
std::distance(hitTimes.begin(),best_hit)]);
216 bool rcleaned =
false;
220 if (!qtest->test(rh,erh,rcleaned)) {
229 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
double respcorrgain(int fCapId) const
get response corrected gain for capid=0..3
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double pedestal(int fCapId) const
get pedestal for capid=0..3
~PFHBHERecHitCreatorMaxSample() override=default
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
uint32_t rawId() const
get the raw id
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
void beginEvent(const edm::Event &event, const edm::EventSetup &setup)
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
PFHBHERecHitCreatorMaxSample(const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const