27 : reco_(conf.getParameter<
bool>(
"correctForTimeslew"),
28 conf.getParameter<
bool>(
"correctForPhaseContainment"),
29 conf.getParameter<double>(
"correctionPhaseNS")),
31 inputLabel_(conf.getParameter<
edm::
InputTag>(
"digiLabel")),
32 correctTiming_(conf.getParameter<
bool>(
"correctTiming")),
33 setNoiseFlags_(conf.getParameter<
bool>(
"setNoiseFlags")),
34 setHSCPFlags_(conf.getParameter<
bool>(
"setHSCPFlags")),
35 setSaturationFlags_(conf.getParameter<
bool>(
"setSaturationFlags")),
36 setTimingTrustFlags_(conf.getParameter<
bool>(
"setTimingTrustFlags")),
37 setPulseShapeFlags_(conf.getParameter<
bool>(
"setPulseShapeFlags")),
38 setNegativeFlags_(
false),
39 dropZSmarkedPassed_(conf.getParameter<
bool>(
"dropZSmarkedPassed")),
40 firstAuxTS_(conf.getParameter<
int>(
"firstAuxTS")),
41 firstSample_(conf.getParameter<
int>(
"firstSample")),
42 samplesToAdd_(conf.getParameter<
int>(
"samplesToAdd")),
43 tsFromDB_(conf.getParameter<
bool>(
"tsFromDB")),
44 useLeakCorrection_(conf.getParameter<
bool>(
"useLeakCorrection")),
45 dataOOTCorrectionName_(
""),
46 dataOOTCorrectionCategory_(
"Data"),
47 mcOOTCorrectionName_(
""),
48 mcOOTCorrectionCategory_(
"MC"),
69 if (conf.
existsAs<
bool>(
"setNegativeFlags"))
86 if (!strcasecmp(subd.c_str(),
"HO")) {
90 produces<HORecHitCollection>();
91 }
else if (!strcasecmp(subd.c_str(),
"HF")) {
110 psS9S1.
getParameter<std::vector<double> >(
"shortEnergyParams"),
111 psS9S1.
getParameter<std::vector<double> >(
"shortETParams"),
112 psS9S1.
getParameter<std::vector<double> >(
"long_optimumSlope"),
113 psS9S1.
getParameter<std::vector<double> >(
"longEnergyParams"),
114 psS9S1.
getParameter<std::vector<double> >(
"longETParams"),
120 psS8S1.
getParameter<std::vector<double> >(
"shortEnergyParams"),
121 psS8S1.
getParameter<std::vector<double> >(
"shortETParams"),
122 psS8S1.
getParameter<std::vector<double> >(
"long_optimumSlope"),
123 psS8S1.
getParameter<std::vector<double> >(
"longEnergyParams"),
124 psS8S1.
getParameter<std::vector<double> >(
"longETParams"),
130 psPET.
getParameter<std::vector<double> >(
"shortEnergyParams"),
131 psPET.
getParameter<std::vector<double> >(
"shortETParams"),
133 psPET.
getParameter<std::vector<double> >(
"longEnergyParams"),
134 psPET.
getParameter<std::vector<double> >(
"longETParams"),
139 produces<HFRecHitCollection>();
140 }
else if (!strcasecmp(subd.c_str(),
"ZDC")) {
143 produces<ZDCRecHitCollection>();
144 }
else if (!strcasecmp(subd.c_str(),
"CALIB")) {
147 produces<HcalCalibRecHitCollection>();
149 edm::LogWarning(
"Configuration") <<
"HcalHitReconstructor is not associated with a specific subdetector!" 245 auto rec = std::make_unique<HORecHitCollection>();
246 rec->reserve(digi->
size());
251 int favorite_capid = 0;
253 long capid_votes[4] = {0, 0, 0, 0};
254 for (i = digi->
begin(); i != digi->
end(); i++) {
255 capid_votes[(*i)[0].capid()]++;
257 for (
int k = 0;
k < 4;
k++)
258 if (capid_votes[
k] > capid_votes[favorite_capid])
262 for (i = digi->
begin(); i != digi->
end(); i++) {
281 correctForTimeslew, correctForPhaseContainment,
useLeakCorrection_, pileupCleaningID, phaseNS);
288 if (first >= i->size() || first < 0)
290 <<
"HcalHitReconstructor: illegal firstSample" << first <<
" in subdet " <<
subdet_ << std::endl;
297 if (i->zsMarkAndPass())
312 for (
int xx = fTS;
xx < fTS + 4 &&
xx < i->size(); ++
xx)
313 auxflag += (i->sample(
xx).adc())
317 auxflag += ((i->sample(fTS).capid()) << 28);
318 (rec->back()).setAux(auxflag);
340 auto rec = std::make_unique<HFRecHitCollection>();
341 rec->reserve(digi->
size());
346 int favorite_capid = 0;
348 long capid_votes[4] = {0, 0, 0, 0};
349 for (i = digi->
begin(); i != digi->
end(); i++) {
350 capid_votes[(*i)[0].capid()]++;
352 for (
int k = 0;
k < 4;
k++)
353 if (capid_votes[
k] > capid_votes[favorite_capid])
357 for (i = digi->
begin(); i != digi->
end(); i++) {
376 correctForTimeslew, correctForPhaseContainment,
useLeakCorrection_, pileupCleaningID, phaseNS);
383 if (first >= i->size() || first < 0)
385 <<
"HcalHitReconstructor: illegal firstSample" << first <<
" in subdet " <<
subdet_ << std::endl;
392 if (i->zsMarkAndPass())
418 for (
int xx = fTS;
xx < fTS + 4 &&
xx < i->size(); ++
xx)
419 auxflag += (i->sample(
xx).adc())
423 auxflag += ((i->sample(fTS).capid()) << 28);
424 (rec->back()).setAux(auxflag);
452 int depth = i->id().depth();
453 int ieta = i->id().ieta();
455 if (depth == 2 ||
abs(ieta) == 29)
461 int depth = i->id().depth();
462 int ieta = i->id().ieta();
464 if (depth == 2 ||
abs(ieta) == 29)
470 int depth = i->id().depth();
471 int ieta = i->id().ieta();
473 if (depth == 1 &&
abs(ieta) != 29)
485 auto rec = std::make_unique<HcalCalibRecHitCollection>();
486 rec->reserve(digi->
size());
492 for (i = digi->
begin(); i != digi->
end(); i++) {
501 if (i->zsMarkAndPass())
T getParameter(std::string const &) const
void HFSetFlagFromS9S1(HFRecHit &hf, HFRecHitCollection &rec, const HcalChannelQuality *myqual, const HcalSeverityLevelComputer *mySeverity)
constexpr unsigned int samplesToAdd() const
std::string mcOOTCorrectionName_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void beginRun(edm::Run const &r, edm::EventSetup const &es) final
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
constexpr unsigned int pileupCleaningID() const
void setHFTimingTrustFlag(HFRecHit &rechit, const HFDataFrame &digi)
HcalADCSaturationFlag * saturationFlagSetter_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void produce(edm::Event &e, const edm::EventSetup &c) override
uint32_t HFdigiflagSamplesToAdd() const
void beginRun(edm::EventSetup const &es)
~HcalHitReconstructor() override
void hfSetFlagFromDigi(HFRecHit &hf, const HFDataFrame &digi, const HcalCoder &coder, const HcalCalibrations &calib)
constexpr uint32_t rawId() const
get the raw id
std::vector< T >::const_iterator const_iterator
const Item * getValues(DetId fId, bool throwOnFail=true) const
void resetParamsFromDB(int firstSample, int samplesToAdd, int expectedPeak, double minthreshold, const std::vector< double > &coef)
SetCorrectionFcn setPileupCorrection_
void HFSetFlagFromPET(HFRecHit &hf, HFRecHitCollection &rec, const HcalChannelQuality *myqual, const HcalSeverityLevelComputer *mySeverity)
std::string dataOOTCorrectionCategory_
constexpr float correctionPhaseNS() const
std::unique_ptr< HcalFlagHFDigiTimeParams > HFDigiTimeParams
edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_
Abs< T >::type abs(const T &t)
HcalHFStatusBitFromDigis * hfdigibit_
constexpr unsigned int firstAuxTS() const
bool dropChannel(const uint32_t &mystatus) const
uint32_t HFdigiflagExpectedPeak() const
constexpr bool correctTiming() const
HFRecHit reconstruct(const HFDataFrame &digi, int first, int toadd, const HcalCoder &coder, const HcalCalibrations &calibs) const
void setSaturationFlag(HBHERecHit &rechit, const HBHEDataFrame &digi)
constexpr bool useLeakCorrection() const
edm::EDGetTokenT< HODigiCollection > tok_ho_
HcalHitReconstructor(const edm::ParameterSet &ps)
std::vector< T >::iterator iterator
const_iterator end() const
std::vector< double > HFdigiflagCoefficients() const
HcalHF_PETalgorithm * hfPET_
constexpr bool correctForPhaseContainment() const
constexpr bool correctForTimeslew() const
HcalHF_S9S1algorithm * hfS9S1_
static const int SubdetectorId
void setRecoParams(bool correctForTimeslew, bool correctForPulse, bool setLeakCorrection, int pileupCleaningID, float phaseNS)
uint32_t HFdigiflagFirstSample() const
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
std::string dataOOTCorrectionName_
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
HcalHF_S9S1algorithm * hfS8S1_
HcalOtherSubdetector subdetOther_
static void Correct(HBHERecHit &rechit, const HBHEDataFrame &digi, int favorite_capid)
edm::InputTag inputLabel_
bool setTimingTrustFlags_
void endRun(edm::Run const &r, edm::EventSetup const &es) final
HFTimingTrustFlag * HFTimingTrustFlagSetter_
uint32_t getValue() const
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
std::string mcOOTCorrectionCategory_
edm::EDGetTokenT< HFDigiCollection > tok_hf_
T const * product() const
void setTopo(const HcalTopology *topo)
correctForPhaseContainment
constexpr unsigned int firstSample() const
const_iterator begin() const
double HFdigiflagMinEThreshold() const