28 reco_(conf.getParameter<bool>(
"correctForTimeslew"),
29 conf.getParameter<bool>(
"correctForPhaseContainment"),
30 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_(0),
52 puCorrMethod_(conf.getParameter<
int>(
"puCorrMethod")),
74 if (conf.
existsAs<
bool>(
"setNegativeFlags"))
97 if (!strcasecmp(subd.c_str(),
"HBHE")) {
103 bool timingShapedCutsFlags = conf.
getParameter<
bool>(
"setTimingShapedCutsFlags");
104 if (timingShapedCutsFlags)
120 psdigi.
getParameter<std::vector<edm::ParameterSet> >(
"pulseShapeParameterSets")
142 psPulseShape.
getParameter<
double>(
"MinimumChargeThreshold"),
143 psPulseShape.
getParameter<
double>(
"TS4TS5ChargeThreshold"),
144 psPulseShape.
getParameter<
double>(
"TS3TS4ChargeThreshold"),
145 psPulseShape.
getParameter<
double>(
"TS3TS4UpperChargeThreshold"),
146 psPulseShape.
getParameter<
double>(
"TS5TS6ChargeThreshold"),
147 psPulseShape.
getParameter<
double>(
"TS5TS6UpperChargeThreshold"),
150 psPulseShape.
getParameter<
unsigned int>(
"TrianglePeakTS"),
151 psPulseShape.
getParameter<std::vector<double> >(
"LinearThreshold"),
152 psPulseShape.
getParameter<std::vector<double> >(
"LinearCut"),
153 psPulseShape.
getParameter<std::vector<double> >(
"RMS8MaxThreshold"),
154 psPulseShape.
getParameter<std::vector<double> >(
"RMS8MaxCut"),
155 psPulseShape.
getParameter<std::vector<double> >(
"LeftSlopeThreshold"),
156 psPulseShape.
getParameter<std::vector<double> >(
"LeftSlopeCut"),
157 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeThreshold"),
158 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeCut"),
159 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeSmallThreshold"),
160 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeSmallCut"),
161 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5LowerThreshold"),
162 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5LowerCut"),
163 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5UpperThreshold"),
164 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5UpperCut"),
171 produces<HBHERecHitCollection>();
172 }
else if (!strcasecmp(subd.c_str(),
"HO")) {
176 produces<HORecHitCollection>();
177 }
else if (!strcasecmp(subd.c_str(),
"HF")) {
198 psS9S1.
getParameter<std::vector<double> >(
"shortEnergyParams"),
199 psS9S1.
getParameter<std::vector<double> >(
"shortETParams"),
200 psS9S1.
getParameter<std::vector<double> >(
"long_optimumSlope"),
201 psS9S1.
getParameter<std::vector<double> >(
"longEnergyParams"),
202 psS9S1.
getParameter<std::vector<double> >(
"longETParams"),
209 psS8S1.
getParameter<std::vector<double> >(
"shortEnergyParams"),
210 psS8S1.
getParameter<std::vector<double> >(
"shortETParams"),
211 psS8S1.
getParameter<std::vector<double> >(
"long_optimumSlope"),
212 psS8S1.
getParameter<std::vector<double> >(
"longEnergyParams"),
213 psS8S1.
getParameter<std::vector<double> >(
"longETParams"),
220 psPET.
getParameter<std::vector<double> >(
"shortEnergyParams"),
221 psPET.
getParameter<std::vector<double> >(
"shortETParams"),
223 psPET.
getParameter<std::vector<double> >(
"longEnergyParams"),
224 psPET.
getParameter<std::vector<double> >(
"longETParams"),
230 produces<HFRecHitCollection>();
231 }
else if (!strcasecmp(subd.c_str(),
"ZDC")) {
234 produces<ZDCRecHitCollection>();
235 }
else if (!strcasecmp(subd.c_str(),
"CALIB")) {
238 produces<HcalCalibRecHitCollection>();
240 edm::LogWarning(
"Configuration") <<
"HcalHitReconstructor is not associated with a specific subdetector!" << std::endl;
284 conf.
getParameter<std::vector<double> >(
"timeSlewPars"),
294 desc.
add<
bool>(
"applyTimeSlewM3",
true);
295 desc.
add<
double>(
"pedestalUpperLimit", 2.7);
296 desc.
add<
int>(
"timeSlewParsType",3);
297 desc.
add<std::vector<double>>(
"timeSlewPars", { 12.2999, -2.19142, 0, 12.2999, -2.19142, 0, 12.2999, -2.19142, 0 });
298 desc.
add<
double>(
"respCorrM3", 1.0);
299 descriptions.
add(
"hltHbhereco",desc);
353 edm::LogWarning(
"Configuration") <<
"HcalHitReconstructor cannot get HcalFrontEndMap!" << std::endl;
401 bool isMethod1Set =
false;
405 if (eventSetup.
find(edm::eventsetup::EventSetupRecordKey::makeKey<HcalOOTPileupCorrectionRcd>()))
412 if( testMethod1Ptr ) isMethod1Set =
true;
431 if( isMethod1Set )
LogTrace(
"HcalPUcorrMethod") <<
"Using Hcal OOTPU method 1" << std::endl;
432 else edm::LogWarning(
"HcalPUcorrMethod") <<
"puCorrMethod_ set to be 1 but method 1 is NOT activated (method 0 used instead)!\n" 433 <<
"Please check GlobalTag usage or method 1 separately disabled by dataOOTCorrectionName & mcOOTCorrectionName?" << std::endl;
435 LogTrace(
"HcalPUcorrMethod") <<
"Using Hcal Deterministic Fit Method!" << std::endl;
436 }
else LogTrace(
"HcalPUcorrMethod") <<
"Using Hcal OOTPU method 0" << std::endl;
453 auto rec = std::make_unique<HBHERecHitCollection>();
454 rec->reserve(digi->
size());
458 std::vector<HBHEDataFrame> HBDigis;
459 std::vector<int> RecHitIndex;
462 int favorite_capid = 0;
464 long capid_votes[4] = {0,0,0,0};
465 for (i=digi->
begin(); i!=digi->
end(); i++) {
466 capid_votes[(*i)[0].capid()]++;
468 for (
int k = 0;
k < 4;
k++)
469 if (capid_votes[
k] > capid_votes[favorite_capid])
473 for (i=digi->
begin(); i!=digi->
end(); i++) {
528 if (i->zsMarkAndPass())
continue;
538 unsigned int auxflag=0;
541 for (
int xx=fTS;
xx<fTS+4 &&
xx<i->size();++
xx) {
542 int adcv = i->sample(
xx).adc();
543 auxflag+=((adcv&0x7F)<<(7*(
xx-fTS)));
546 auxflag+=((i->sample(fTS).capid())<<28);
547 (rec->back()).setAux(auxflag);
552 for (
int xx = fTS2;
xx < fTS2+4 &&
xx<i->size(); ++
xx) {
553 int adcv = i->sample(
xx).adc();
554 auxflag+=((adcv&0x7F)<<(7*(
xx-fTS2)));
556 auxflag+=((i->sample(fTS2).capid())<<28);
557 (rec->back()).setAuxHBHE(auxflag);
580 for(
int j=0; j!=i->size(); DigiEnergy += i->sample(j++).nominal_fC());
583 HBDigis.push_back(*i);
584 RecHitIndex.push_back(rec->size()-1);
602 auto rec = std::make_unique<HORecHitCollection>();
603 rec->reserve(digi->
size());
608 int favorite_capid = 0;
610 long capid_votes[4] = {0,0,0,0};
611 for (i=digi->
begin(); i!=digi->
end(); i++) {
612 capid_votes[(*i)[0].capid()]++;
614 for (
int k = 0;
k < 4;
k++)
615 if (capid_votes[
k] > capid_votes[favorite_capid])
619 for (i=digi->
begin(); i!=digi->
end(); i++) {
648 if (i->zsMarkAndPass())
continue;
661 for (
int xx=fTS;
xx<fTS+4 &&
xx<i->size();++
xx)
662 auxflag+=(i->sample(
xx).adc())<<(7*(
xx-fTS));
664 auxflag+=((i->sample(fTS).capid())<<28);
665 (rec->back()).setAux(auxflag);
688 auto rec = std::make_unique<HFRecHitCollection>();
689 rec->reserve(digi->
size());
694 int favorite_capid = 0;
696 long capid_votes[4] = {0,0,0,0};
697 for (i=digi->
begin(); i!=digi->
end(); i++) {
698 capid_votes[(*i)[0].capid()]++;
700 for (
int k = 0;
k < 4;
k++)
701 if (capid_votes[
k] > capid_votes[favorite_capid])
705 for (i=digi->
begin(); i!=digi->
end(); i++) {
734 if (i->zsMarkAndPass())
continue;
760 for (
int xx=fTS;
xx<fTS+4 &&
xx<i->size();++
xx)
761 auxflag+=(i->sample(
xx).adc())<<(7*(
xx-fTS));
763 auxflag+=((i->sample(fTS).capid())<<28);
764 (rec->back()).setAux(auxflag);
794 int depth=i->id().depth();
795 int ieta=i->id().ieta();
797 if (depth==2 ||
abs(ieta)==29 )
804 int depth=i->id().depth();
805 int ieta=i->id().ieta();
807 if (depth==2 ||
abs(ieta)==29 )
814 int depth=i->id().depth();
815 int ieta=i->id().ieta();
817 if (depth==1 &&
abs(ieta)!=29 )
829 auto rec = std::make_unique<HcalCalibRecHitCollection>();
830 rec->reserve(digi->
size());
836 for (i=digi->
begin(); i!=digi->
end(); i++) {
844 if (i->zsMarkAndPass())
continue;
unsigned int firstSample() const
T getParameter(std::string const &) const
void HFSetFlagFromS9S1(HFRecHit &hf, HFRecHitCollection &rec, const HcalChannelQuality *myqual, const HcalSeverityLevelComputer *mySeverity)
std::string mcOOTCorrectionName_
boost::shared_ptr< AbsOOTPileupCorrection > get(const std::string &name, const std::string &category) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
HBHERecHit reconstruct(const HBHEDataFrame &digi, int first, int toadd, const HcalCoder &coder, const HcalCalibrations &calibs) const
void setMeth3Params(bool iApplyTimeSlew, float iPedSubThreshold, int iTimeSlewParsType, std::vector< double > iTimeSlewPars, double irespCorrM3)
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
void configFilter(const HBHENegativeEFilter *f)
void setHFTimingTrustFlag(HFRecHit &rechit, const HFDataFrame &digi)
unsigned int pileupCleaningID() const
void setpuCorrParams(bool iPedestalConstraint, bool iTimeConstraint, bool iAddPulseJitter, bool iApplyTimeSlew, double iTS4Min, const std::vector< double > &iTS4Max, double iPulseJitter, double iTimeMean, double iTimeSig, double iTimeSigSiPM, double iPedMean, double iPedSig, double iPedSigSiPM, double iNoise, double iNoiseSiPM, double iTMin, double iTMax, const std::vector< double > &its4Chi2, int iFitTimes)
HcalADCSaturationFlag * saturationFlagSetter_
void SetPulseShapeFlags(HBHERecHit &hbhe, const Dataframe &digi, const HcalCoder &coder, const HcalCalibrations &calib)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void setAllowAnything()
allow any parameter label/value pairs
virtual void produce(edm::Event &e, const edm::EventSetup &c) override
uint32_t HFdigiflagSamplesToAdd() const
void beginRun(edm::EventSetup const &es)
bool correctForPhaseContainment() const
void hfSetFlagFromDigi(HFRecHit &hf, const HFDataFrame &digi, const HcalCoder &coder, const HcalCalibrations &calib)
virtual ~HcalHitReconstructor()
std::vector< HBHEDataFrame >::const_iterator const_iterator
virtual void beginRun(edm::Run const &r, edm::EventSetup const &es) override final
const Item * getValues(DetId fId, bool throwOnFail=true) const
void resetParamsFromDB(int firstSample, int samplesToAdd, int expectedPeak, double minthreshold, const std::vector< double > &coef)
void SetFrontEndMap(const HcalFrontEndMap *m)
SetCorrectionFcn setPileupCorrection_
void HFSetFlagFromPET(HFRecHit &hf, HFRecHitCollection &rec, const HcalChannelQuality *myqual, const HcalSeverityLevelComputer *mySeverity)
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
uint32_t rawId() const
get the raw id
std::string dataOOTCorrectionCategory_
HBHENegativeFlagSetter * hbheNegativeFlagSetter_
std::unique_ptr< HcalFlagHFDigiTimeParams > HFDigiTimeParams
void get(HolderT &iHolder) const
bool correctForTimeslew() const
edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_
bool correctTiming() const
Abs< T >::type abs(const T &t)
HcalHFStatusBitFromDigis * hfdigibit_
virtual void endRun(edm::Run const &r, edm::EventSetup const &es) override final
bool dropChannel(const uint32_t &mystatus) const
uint32_t HFdigiflagExpectedPeak() const
void hbheSetTimeFlagsFromDigi(HBHERecHitCollection *, const std::vector< HBHEDataFrame > &, const std::vector< int > &)
void setSaturationFlag(HBHERecHit &rechit, const HBHEDataFrame &digi)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
unsigned int samplesToAdd() const
edm::EDGetTokenT< HODigiCollection > tok_ho_
HcalHitReconstructor(const edm::ParameterSet &ps)
float correctionPhaseNS() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< HFRecHit >::iterator iterator
const_iterator end() const
std::vector< double > HFdigiflagCoefficients() const
HcalHF_PETalgorithm * hfPET_
HcalHF_S9S1algorithm * hfS9S1_
HBHEPulseShapeFlagSetter * hbhePulseShapeFlagSetter_
static const int SubdetectorId
void setRecoParams(bool correctForTimeslew, bool correctForPulse, bool setLeakCorrection, int pileupCleaningID, float phaseNS)
void SetTimingShapedFlags(HBHERecHit &hbhe)
uint32_t HFdigiflagFirstSample() const
correctForPhaseContainment
void setHBHEPileupCorrection(boost::shared_ptr< AbsOOTPileupCorrection > corr)
void setForData(int runnum)
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::string dataOOTCorrectionName_
HBHEStatusBitSetter * hbheFlagSetter_
HBHETimeProfileStatusBitSetter * hbheHSCPFlagSetter_
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
void SetFlagsFromDigi(HBHERecHit &hbhe, const HBHEDataFrame &digi, const HcalCoder &coder, const HcalCalibrations &calib)
HBHETimingShapedFlagSetter * hbheTimingShapedFlagSetter_
void setPulseShapeFlags(HBHERecHit &hbhe, const HBHEDataFrame &digi, const HcalCoder &coder, const HcalCalibrations &calib)
void setpuCorrMethod(int method)
HcalHF_S9S1algorithm * hfS8S1_
HcalOtherSubdetector subdetOther_
static void Correct(HBHERecHit &rechit, const HBHEDataFrame &digi, int favorite_capid)
edm::InputTag inputLabel_
unsigned int firstAuxTS() const
bool setTimingTrustFlags_
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)
void SetFlagsFromRecHits(HBHERecHitCollection &rec)
const_iterator begin() const
double HFdigiflagMinEThreshold() const
bool useLeakCorrection() const