1 #ifndef RecoParticleFlow_PFClusterProducer_PFHBHeRecHitCreatorMaxSample_h
2 #define RecoParticleFlow_PFClusterProducer_PFHBHeRecHitCreatorMaxSample_h
66 for(
const auto& erh : *recHitHandle ) {
74 const HcalCalibrations& calibrations = conditions->getHcalCalibrations(detid);
75 const HcalQIECoder* channelCoder = conditions->getHcalCoder(detid);
76 const HcalQIEShape* shape = conditions->getHcalShape(channelCoder);
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;
108 for (
int ii = 0;
ii < 8;
ii++) {
114 std::array<double,8> samples;
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)
166 int depth = detid.
depth();
189 <<
"warning detid "<<detid.
rawId()
190 <<
" not found in geometry"<<std::endl;
196 position.SetCoordinates (
point.x(),
203 position.x(), position.y(), position.z(),
210 assert( corners.
size() == 8 );
212 rh.setNECorner( corners[0].
x(), corners[0].
y(), corners[0].
z());
213 rh.setSECorner( corners[1].
x(), corners[1].
y(), corners[1].
z());
214 rh.setSWCorner( corners[2].
x(), corners[2].
y(), corners[2].
z());
215 rh.setNWCorner( corners[3].
x(), corners[3].
y(), corners[3].
z());
221 auto best_hit = std::min_element(hitTimes.begin(),hitTimes.end(),
224 return fabs(a) < fabs(
b);
228 rh.setTime(*best_hit);
229 rh.setEnergy(hitEnergies[std::distance(hitTimes.begin(),best_hit)]);
233 bool rcleaned =
false;
237 if (!qtest->test(rh,erh,rcleaned)) {
246 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
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 setPresamples(int ps)
void setSample(int i, const HcalQIESample &sam)
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const
~PFHBHERecHitCreatorMaxSample()
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)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
void importRecHits(std::auto_ptr< reco::PFRecHitCollection > &out, std::auto_ptr< reco::PFRecHitCollection > &cleaned, const edm::Event &iEvent, const edm::EventSetup &iSetup)
static int position[264][3]
const CornersVec & getCorners() const
Returns the corner points of this cell's volume.
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point