27 : reco_(conf.getParameter<
bool>(
"correctForTimeslew"),
28 conf.getParameter<
bool>(
"correctForPhaseContainment"),
29 conf.getParameter<double>(
"correctionPhaseNS"),
32 inputLabel_(conf.getParameter<
edm::
InputTag>(
"digiLabel")),
33 correctTiming_(conf.getParameter<
bool>(
"correctTiming")),
34 setNoiseFlags_(conf.getParameter<
bool>(
"setNoiseFlags")),
35 setHSCPFlags_(conf.getParameter<
bool>(
"setHSCPFlags")),
36 setSaturationFlags_(conf.getParameter<
bool>(
"setSaturationFlags")),
37 setTimingTrustFlags_(conf.getParameter<
bool>(
"setTimingTrustFlags")),
38 setPulseShapeFlags_(conf.getParameter<
bool>(
"setPulseShapeFlags")),
39 setNegativeFlags_(
false),
40 dropZSmarkedPassed_(conf.getParameter<
bool>(
"dropZSmarkedPassed")),
41 firstAuxTS_(conf.getParameter<
int>(
"firstAuxTS")),
42 firstSample_(conf.getParameter<
int>(
"firstSample")),
43 samplesToAdd_(conf.getParameter<
int>(
"samplesToAdd")),
44 tsFromDB_(conf.getParameter<
bool>(
"tsFromDB")),
45 useLeakCorrection_(conf.getParameter<
bool>(
"useLeakCorrection")),
46 dataOOTCorrectionName_(
""),
47 dataOOTCorrectionCategory_(
"Data"),
48 mcOOTCorrectionName_(
""),
49 mcOOTCorrectionCategory_(
"MC"),
50 setPileupCorrection_(nullptr) {
67 if (conf.
existsAs<
bool>(
"setNegativeFlags"))
84 if (!strcasecmp(subd.c_str(),
"HO")) {
88 produces<HORecHitCollection>();
89 }
else if (!strcasecmp(subd.c_str(),
"HF")) {
108 psS9S1.
getParameter<std::vector<double> >(
"shortEnergyParams"),
109 psS9S1.
getParameter<std::vector<double> >(
"shortETParams"),
110 psS9S1.
getParameter<std::vector<double> >(
"long_optimumSlope"),
111 psS9S1.
getParameter<std::vector<double> >(
"longEnergyParams"),
112 psS9S1.
getParameter<std::vector<double> >(
"longETParams"),
118 psS8S1.
getParameter<std::vector<double> >(
"shortEnergyParams"),
119 psS8S1.
getParameter<std::vector<double> >(
"shortETParams"),
120 psS8S1.
getParameter<std::vector<double> >(
"long_optimumSlope"),
121 psS8S1.
getParameter<std::vector<double> >(
"longEnergyParams"),
122 psS8S1.
getParameter<std::vector<double> >(
"longETParams"),
128 psPET.
getParameter<std::vector<double> >(
"shortEnergyParams"),
129 psPET.
getParameter<std::vector<double> >(
"shortETParams"),
131 psPET.
getParameter<std::vector<double> >(
"longEnergyParams"),
132 psPET.
getParameter<std::vector<double> >(
"longETParams"),
137 produces<HFRecHitCollection>();
138 }
else if (!strcasecmp(subd.c_str(),
"ZDC")) {
141 produces<ZDCRecHitCollection>();
142 }
else if (!strcasecmp(subd.c_str(),
"CALIB")) {
145 produces<HcalCalibRecHitCollection>();
147 edm::LogWarning(
"Configuration") <<
"HcalHitReconstructor is not associated with a specific subdetector!" 165 htopoToken_ = esConsumes<HcalTopology, HcalRecNumberingRecord, edm::Transition::BeginRun>();
167 paramsToken_ = esConsumes<HcalRecoParams, HcalRecoParamsRcd, edm::Transition::BeginRun>();
169 digiTimeToken_ = esConsumes<HcalFlagHFDigiTimeParams, HcalFlagHFDigiTimeParamsRcd, edm::Transition::BeginRun>();
172 sevToken_ = esConsumes<HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd>();
190 paramTS_ = std::make_unique<HcalRecoParams>(
p);
229 auto rec = std::make_unique<HORecHitCollection>();
230 rec->reserve(digi->
size());
235 int favorite_capid = 0;
237 long capid_votes[4] = {0, 0, 0, 0};
239 capid_votes[(*i)[0].capid()]++;
241 for (
int k = 0;
k < 4;
k++)
242 if (capid_votes[
k] > capid_votes[favorite_capid])
274 <<
"HcalHitReconstructor: illegal firstSample" <<
first <<
" in subdet " <<
subdet_ << std::endl;
281 if (
i->zsMarkAndPass())
296 for (
int xx = fTS;
xx < fTS + 4 &&
xx <
i->size(); ++
xx)
297 auxflag += (
i->sample(
xx).adc())
301 auxflag += ((
i->sample(fTS).capid()) << 28);
302 (rec->back()).setAux(auxflag);
324 auto rec = std::make_unique<HFRecHitCollection>();
325 rec->reserve(digi->
size());
330 int favorite_capid = 0;
332 long capid_votes[4] = {0, 0, 0, 0};
334 capid_votes[(*i)[0].capid()]++;
336 for (
int k = 0;
k < 4;
k++)
337 if (capid_votes[
k] > capid_votes[favorite_capid])
369 <<
"HcalHitReconstructor: illegal firstSample" <<
first <<
" in subdet " <<
subdet_ << std::endl;
376 if (
i->zsMarkAndPass())
402 for (
int xx = fTS;
xx < fTS + 4 &&
xx <
i->size(); ++
xx)
403 auxflag += (
i->sample(
xx).adc())
407 auxflag += ((
i->sample(fTS).capid()) << 28);
408 (rec->back()).setAux(auxflag);
436 int depth =
i->id().depth();
437 int ieta =
i->id().ieta();
445 int depth =
i->id().depth();
446 int ieta =
i->id().ieta();
454 int depth =
i->id().depth();
455 int ieta =
i->id().ieta();
469 auto rec = std::make_unique<HcalCalibRecHitCollection>();
470 rec->reserve(digi->
size());
485 if (
i->zsMarkAndPass())
std::vector< double > HFdigiflagCoefficients() const
double HFdigiflagMinEThreshold() const
void HFSetFlagFromS9S1(HFRecHit &hf, HFRecHitCollection &rec, const HcalChannelQuality *myqual, const HcalSeverityLevelComputer *mySeverity)
T getParameter(std::string const &) const
std::string mcOOTCorrectionName_
void beginRun(edm::Run const &r, edm::EventSetup const &es) final
constexpr unsigned int firstAuxTS() const
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
void setHFTimingTrustFlag(HFRecHit &rechit, const HFDataFrame &digi)
HcalADCSaturationFlag * saturationFlagSetter_
void produce(edm::Event &e, const edm::EventSetup &c) override
void beginRun(edm::EventSetup const &es)
~HcalHitReconstructor() override
std::unique_ptr< HcalRecoParams > paramTS_
void hfSetFlagFromDigi(HFRecHit &hf, const HFDataFrame &digi, const HcalCoder &coder, const HcalCalibrations &calib)
constexpr unsigned int firstSample() const
std::vector< T >::const_iterator const_iterator
uint32_t HFdigiflagExpectedPeak() const
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
void resetParamsFromDB(int firstSample, int samplesToAdd, int expectedPeak, double minthreshold, const std::vector< double > &coef)
edm::ESGetToken< HcalDbService, HcalDbRecord > conditionsToken_
constexpr bool correctForPhaseContainment() const
SetCorrectionFcn setPileupCorrection_
const Item * getValues(DetId fId, bool throwOnFail=true) const
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > qualToken_
void HFSetFlagFromPET(HFRecHit &hf, HFRecHitCollection &rec, const HcalChannelQuality *myqual, const HcalSeverityLevelComputer *mySeverity)
edm::ESGetToken< HcalFlagHFDigiTimeParams, HcalFlagHFDigiTimeParamsRcd > digiTimeToken_
std::string dataOOTCorrectionCategory_
constexpr bool correctForTimeslew() const
std::unique_ptr< HcalFlagHFDigiTimeParams > hFDigiTimeParams_
edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_
constexpr bool correctTiming() const
Abs< T >::type abs(const T &t)
HcalHFStatusBitFromDigis * hfdigibit_
const_iterator begin() const
void setSaturationFlag(HBHERecHit &rechit, const HBHEDataFrame &digi)
constexpr float correctionPhaseNS() const
edm::EDGetTokenT< HODigiCollection > tok_ho_
HcalHitReconstructor(const edm::ParameterSet &ps)
uint32_t getValue() const
std::vector< T >::iterator iterator
const_iterator end() const
HcalHF_PETalgorithm * hfPET_
HcalHF_S9S1algorithm * hfS9S1_
edm::ESGetToken< HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd > sevToken_
static const int SubdetectorId
void setRecoParams(bool correctForTimeslew, bool correctForPulse, bool setLeakCorrection, int pileupCleaningID, float phaseNS)
constexpr bool useLeakCorrection() const
uint32_t HFdigiflagFirstSample() const
constexpr uint32_t rawId() const
get the raw id
constexpr unsigned int samplesToAdd() const
std::string dataOOTCorrectionName_
HcalHF_S9S1algorithm * hfS8S1_
HcalOtherSubdetector subdetOther_
static void Correct(HBHERecHit &rechit, const HBHEDataFrame &digi, int favorite_capid)
constexpr unsigned int pileupCleaningID() const
edm::InputTag inputLabel_
HFRecHit reconstruct(const HFDataFrame &digi, int first, int toadd, const HcalCoder &coder, const HcalCalibrations &calibs) const
bool setTimingTrustFlags_
void endRun(edm::Run const &r, edm::EventSetup const &es) final
Log< level::Warning, false > LogWarning
HFTimingTrustFlag * HFTimingTrustFlagSetter_
edm::ESGetToken< HcalRecoParams, HcalRecoParamsRcd > paramsToken_
std::string mcOOTCorrectionCategory_
edm::EDGetTokenT< HFDigiCollection > tok_hf_
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > htopoToken_
correctForPhaseContainment
uint32_t HFdigiflagSamplesToAdd() const
bool dropChannel(const uint32_t &mystatus) const