66 for(
const auto& erh : *recHitHandle ) {
78 int auxwd1 = erh.auxHBHE();
79 int auxwd2 = erh.aux();
84 adc[0] = (auxwd1) & 0x7F;
85 adc[1] = (auxwd1 >> 7) & 0x7F;
86 adc[2] = (auxwd1 >> 14) & 0x7F;
87 adc[3] = (auxwd1 >> 21) & 0x7F;
89 capid[0] = (auxwd1 >> 28) & 0x3;
90 capid[1] = (capid[0] + 1 <= 3) ? capid[0] + 1 : 0;
91 capid[2] = (capid[1] + 1 <= 3) ? capid[1] + 1 : 0;
92 capid[3] = (capid[2] + 1 <= 3) ? capid[2] + 1 : 0;
94 adc[4] = (auxwd2) & 0x7F;
95 adc[5] = (auxwd2 >> 7) & 0x7F;
96 adc[6] = (auxwd2 >> 14) & 0x7F;
97 adc[7] = (auxwd2 >> 21) & 0x7F;
99 capid[4] = (auxwd2 >> 28) & 0x3;
100 capid[5] = (capid[4] + 1 <= 3) ? capid[4] + 1 : 0;
101 capid[6] = (capid[5] + 1 <= 3) ? capid[5] + 1 : 0;
102 capid[7] = (capid[6] + 1 <= 3) ? capid[6] + 1 : 0;
107 digi.setPresamples(4);
108 for (
int ii = 0;
ii < 8;
ii++) {
110 digi.setSample(
ii,
s);
112 coder.adc2fC(digi, tool);
118 for (
int ii = 0;
ii < 8;
ii++) {
120 (tool[
ii] - calibrations.
pedestal(capid[ii]));
122 samples[
ii] = sampleE;
134 std::vector<double> hitEnergies;
135 std::vector<double> hitTimes;
137 for (
int ii = 0; ii < 8; ii++) {
138 energy=energy+samples[
ii];
139 s2=samples[
ii]*samples[
ii];
140 time = time+(-100. + ii*25.0)*
s2;
144 if (samples[ii]<=samples[ii-1] && samples[ii]<samples[ii+1] && energy>0) {
145 hitEnergies.push_back(energy);
146 hitTimes.push_back(time/energy2);
153 else if (ii==7 && energy>0) {
154 hitEnergies.push_back(energy);
155 hitTimes.push_back(time/energy2);
163 if (hitEnergies.size()==0)
187 <<
"warning detid "<<detid.
rawId()
188 <<
" not found in geometry"<<std::endl;
205 auto best_hit = std::min_element(hitTimes.begin(),hitTimes.end(),
208 return fabs(a) < fabs(
b);
212 rh.setTime(*best_hit);
213 rh.setEnergy(hitEnergies[
std::distance(hitTimes.begin(),best_hit)]);
217 bool rcleaned =
false;
221 if (!qtest->test(rh,erh,rcleaned)) {
230 cleaned->push_back(rh);
int adc(sample_type sample)
get the ADC sample (12 bits)
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
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
edm::EDGetTokenT< edm::SortedCollection< HBHERecHit > > recHitToken_
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
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) ...
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const