26 reco_(conf.getParameter<bool>(
"correctForTimeslew"),
27 conf.getParameter<bool>(
"correctForPhaseContainment"),
28 conf.getParameter<double>(
"correctionPhaseNS")),
30 inputLabel_(conf.getParameter<edm::
InputTag>(
"digiLabel")),
31 correctTiming_(conf.getParameter<bool>(
"correctTiming")),
32 setNoiseFlags_(conf.getParameter<bool>(
"setNoiseFlags")),
33 setHSCPFlags_(conf.getParameter<bool>(
"setHSCPFlags")),
34 setSaturationFlags_(conf.getParameter<bool>(
"setSaturationFlags")),
35 setTimingTrustFlags_(conf.getParameter<bool>(
"setTimingTrustFlags")),
36 setPulseShapeFlags_(conf.getParameter<bool>(
"setPulseShapeFlags")),
37 setNegativeFlags_(
false),
38 dropZSmarkedPassed_(conf.getParameter<bool>(
"dropZSmarkedPassed")),
39 firstAuxTS_(conf.getParameter<int>(
"firstAuxTS")),
40 firstSample_(conf.getParameter<int>(
"firstSample")),
41 samplesToAdd_(conf.getParameter<int>(
"samplesToAdd")),
42 tsFromDB_(conf.getParameter<bool>(
"tsFromDB")),
43 useLeakCorrection_(conf.getParameter<bool>(
"useLeakCorrection")),
44 dataOOTCorrectionName_(
""),
45 dataOOTCorrectionCategory_(
"Data"),
46 mcOOTCorrectionName_(
""),
47 mcOOTCorrectionCategory_(
"MC"),
48 setPileupCorrection_(0),
50 puCorrMethod_(conf.getParameter<int>(
"puCorrMethod")),
72 if (conf.
existsAs<
bool>(
"setNegativeFlags"))
95 if (!strcasecmp(subd.c_str(),
"HBHE")) {
101 bool timingShapedCutsFlags = conf.
getParameter<
bool>(
"setTimingShapedCutsFlags");
102 if (timingShapedCutsFlags)
118 psdigi.
getParameter<std::vector<edm::ParameterSet> >(
"pulseShapeParameterSets")
140 psPulseShape.
getParameter<
double>(
"MinimumChargeThreshold"),
141 psPulseShape.
getParameter<
double>(
"TS4TS5ChargeThreshold"),
142 psPulseShape.
getParameter<
double>(
"TS3TS4ChargeThreshold"),
143 psPulseShape.
getParameter<
double>(
"TS3TS4UpperChargeThreshold"),
144 psPulseShape.
getParameter<
double>(
"TS5TS6ChargeThreshold"),
145 psPulseShape.
getParameter<
double>(
"TS5TS6UpperChargeThreshold"),
148 psPulseShape.
getParameter<
unsigned int>(
"TrianglePeakTS"),
149 psPulseShape.
getParameter<std::vector<double> >(
"LinearThreshold"),
150 psPulseShape.
getParameter<std::vector<double> >(
"LinearCut"),
151 psPulseShape.
getParameter<std::vector<double> >(
"RMS8MaxThreshold"),
152 psPulseShape.
getParameter<std::vector<double> >(
"RMS8MaxCut"),
153 psPulseShape.
getParameter<std::vector<double> >(
"LeftSlopeThreshold"),
154 psPulseShape.
getParameter<std::vector<double> >(
"LeftSlopeCut"),
155 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeThreshold"),
156 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeCut"),
157 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeSmallThreshold"),
158 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeSmallCut"),
159 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5LowerThreshold"),
160 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5LowerCut"),
161 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5UpperThreshold"),
162 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5UpperCut"),
169 produces<HBHERecHitCollection>();
170 }
else if (!strcasecmp(subd.c_str(),
"HO")) {
174 produces<HORecHitCollection>();
175 }
else if (!strcasecmp(subd.c_str(),
"HF")) {
196 psS9S1.
getParameter<std::vector<double> >(
"shortEnergyParams"),
197 psS9S1.
getParameter<std::vector<double> >(
"shortETParams"),
198 psS9S1.
getParameter<std::vector<double> >(
"long_optimumSlope"),
199 psS9S1.
getParameter<std::vector<double> >(
"longEnergyParams"),
200 psS9S1.
getParameter<std::vector<double> >(
"longETParams"),
207 psS8S1.
getParameter<std::vector<double> >(
"shortEnergyParams"),
208 psS8S1.
getParameter<std::vector<double> >(
"shortETParams"),
209 psS8S1.
getParameter<std::vector<double> >(
"long_optimumSlope"),
210 psS8S1.
getParameter<std::vector<double> >(
"longEnergyParams"),
211 psS8S1.
getParameter<std::vector<double> >(
"longETParams"),
218 psPET.
getParameter<std::vector<double> >(
"shortEnergyParams"),
219 psPET.
getParameter<std::vector<double> >(
"shortETParams"),
221 psPET.
getParameter<std::vector<double> >(
"longEnergyParams"),
222 psPET.
getParameter<std::vector<double> >(
"longETParams"),
228 produces<HFRecHitCollection>();
229 }
else if (!strcasecmp(subd.c_str(),
"ZDC")) {
232 produces<ZDCRecHitCollection>();
233 }
else if (!strcasecmp(subd.c_str(),
"CALIB")) {
236 produces<HcalCalibRecHitCollection>();
238 edm::LogWarning(
"Configuration") <<
"HcalHitReconstructor is not associated with a specific subdetector!" << std::endl;
283 conf.
getParameter<std::vector<double> >(
"timeSlewPars"),
293 desc.
add<
int>(
"pedestalSubtractionType", 1);
294 desc.
add<
double>(
"pedestalUpperLimit", 2.7);
295 desc.
add<
int>(
"timeSlewParsType",3);
296 desc.
add<std::vector<double>>(
"timeSlewPars", { 12.2999, -2.19142, 0, 12.2999, -2.19142, 0, 12.2999, -2.19142, 0 });
297 desc.
add<
double>(
"respCorrM3", 0.95);
298 descriptions.
add(
"hltHbhereco",desc);
394 bool isMethod1Set =
false;
398 if (eventSetup.
find(edm::eventsetup::EventSetupRecordKey::makeKey<HcalOOTPileupCorrectionRcd>()))
405 if( testMethod1Ptr ) isMethod1Set =
true;
424 if( isMethod1Set )
LogTrace(
"HcalPUcorrMethod") <<
"Using Hcal OOTPU method 1" << std::endl;
425 else edm::LogWarning(
"HcalPUcorrMethod") <<
"puCorrMethod_ set to be 1 but method 1 is NOT activated (method 0 used instead)!\n"
426 <<
"Please check GlobalTag usage or method 1 separately disabled by dataOOTCorrectionName & mcOOTCorrectionName?" << std::endl;
428 LogTrace(
"HcalPUcorrMethod") <<
"Using Hcal Deterministic Fit Method!" << std::endl;
429 }
else LogTrace(
"HcalPUcorrMethod") <<
"Using Hcal OOTPU method 0" << std::endl;
447 rec->reserve(digi->size());
451 std::vector<HBHEDataFrame> HBDigis;
452 std::vector<int> RecHitIndex;
455 int favorite_capid = 0;
457 long capid_votes[4] = {0,0,0,0};
458 for (i=digi->begin(); i!=digi->end(); i++) {
459 capid_votes[(*i)[0].capid()]++;
461 for (
int k = 0;
k < 4;
k++)
462 if (capid_votes[
k] > capid_votes[favorite_capid])
466 for (i=digi->begin(); i!=digi->end(); i++) {
521 if (i->zsMarkAndPass())
continue;
524 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
525 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
531 unsigned int auxflag=0;
534 for (
int xx=fTS; xx<fTS+4 && xx<i->size();++xx) {
535 int adcv = i->sample(xx).adc();
536 auxflag+=((adcv&0x7F)<<(7*(xx-fTS)));
539 auxflag+=((i->sample(fTS).capid())<<28);
540 (rec->back()).setAux(auxflag);
545 for (
int xx = fTS2; xx < fTS2+4 && xx<i->size(); ++xx) {
546 int adcv = i->sample(xx).adc();
547 auxflag+=((adcv&0x7F)<<(7*(xx-fTS2)));
549 auxflag+=((i->sample(fTS2).capid())<<28);
550 (rec->back()).setAuxHBHE(auxflag);
552 (rec->back()).setFlags(0);
572 for(
int j=0;
j!=i->size(); DigiEnergy += i->sample(
j++).nominal_fC());
575 HBDigis.push_back(*i);
576 RecHitIndex.push_back(rec->size()-1);
595 rec->reserve(digi->size());
600 int favorite_capid = 0;
602 long capid_votes[4] = {0,0,0,0};
603 for (i=digi->begin(); i!=digi->end(); i++) {
604 capid_votes[(*i)[0].capid()]++;
606 for (
int k = 0;
k < 4;
k++)
607 if (capid_votes[
k] > capid_votes[favorite_capid])
611 for (i=digi->begin(); i!=digi->end(); i++) {
640 if (i->zsMarkAndPass())
continue;
643 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
644 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
653 for (
int xx=fTS; xx<fTS+4 && xx<i->size();++xx)
654 auxflag+=(i->sample(xx).adc())<<(7*(xx-fTS));
656 auxflag+=((i->sample(fTS).capid())<<28);
657 (rec->back()).setAux(auxflag);
658 (rec->back()).setFlags(0);
680 rec->reserve(digi->size());
685 int favorite_capid = 0;
687 long capid_votes[4] = {0,0,0,0};
688 for (i=digi->begin(); i!=digi->end(); i++) {
689 capid_votes[(*i)[0].capid()]++;
691 for (
int k = 0;
k < 4;
k++)
692 if (capid_votes[
k] > capid_votes[favorite_capid])
696 for (i=digi->begin(); i!=digi->end(); i++) {
725 if (i->zsMarkAndPass())
continue;
728 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
729 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
751 for (
int xx=fTS; xx<fTS+4 && xx<i->size();++xx)
752 auxflag+=(i->sample(xx).adc())<<(7*(xx-fTS));
754 auxflag+=((i->sample(fTS).capid())<<28);
755 (rec->back()).setAux(auxflag);
758 (rec->back()).setFlags(0);
785 int depth=i->id().depth();
786 int ieta=i->id().ieta();
788 if (depth==2 ||
abs(ieta)==29 )
795 int depth=i->id().depth();
796 int ieta=i->id().ieta();
798 if (depth==2 ||
abs(ieta)==29 )
805 int depth=i->id().depth();
806 int ieta=i->id().ieta();
808 if (depth==1 &&
abs(ieta)!=29 )
821 rec->reserve(digi->size());
827 for (i=digi->begin(); i!=digi->end(); i++) {
835 if (i->zsMarkAndPass())
continue;
838 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
839 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
void setMeth3Params(int iPedSubMethod, float iPedSubThreshold, int iTimeSlewParsType, std::vector< double > iTimeSlewPars, double irespCorrM3)
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_
HBHERecHit reconstruct(const HBHEDataFrame &digi, int first, int toadd, const HcalCoder &coder, const HcalCalibrations &calibs) const
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
HcalADCSaturationFlag * saturationFlagSetter_
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
const Item * getValues(DetId fId, bool throwOnFail=true) const
void resetParamsFromDB(int firstSample, int samplesToAdd, int expectedPeak, double minthreshold, const std::vector< double > &coef)
virtual void endRun(edm::Run const &r, edm::EventSetup const &es) overridefinal
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_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
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_
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
tuple correctForPhaseContainment
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< HFRecHit >::iterator iterator
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)
virtual void beginRun(edm::Run const &r, edm::EventSetup const &es) overridefinal
void SetTimingShapedFlags(HBHERecHit &hbhe)
uint32_t HFdigiflagFirstSample() const
void setHBHEPileupCorrection(boost::shared_ptr< AbsOOTPileupCorrection > corr)
void setForData(int runnum)
T const * product() const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::string dataOOTCorrectionName_
HBHEStatusBitSetter * hbheFlagSetter_
HBHETimeProfileStatusBitSetter * hbheHSCPFlagSetter_
HBHETimingShapedFlagSetter * hbheTimingShapedFlagSetter_
void setPulseShapeFlags(HBHERecHit &hbhe, const HBHEDataFrame &digi, const HcalCoder &coder, const HcalCalibrations &calib)
void setpuCorrMethod(int method)
HcalHF_S9S1algorithm * hfS8S1_
void SetFlagsFromRecHits(const HcalTopology *topo, HBHERecHitCollection &rec)
HcalOtherSubdetector subdetOther_
static void Correct(HBHERecHit &rechit, const HBHEDataFrame &digi, int favorite_capid)
void SetPulseShapeFlags(HBHERecHit &hbhe, const HBHEDataFrame &digi, const HcalCoder &coder, const HcalCalibrations &calib)
edm::InputTag inputLabel_
unsigned int firstAuxTS() const
bool setTimingTrustFlags_
volatile std::atomic< bool > shutdown_flag false
HFTimingTrustFlag * HFTimingTrustFlagSetter_
uint32_t getValue() const
void SetFlagsFromDigi(const HcalTopology *topo, HBHERecHit &hbhe, const HBHEDataFrame &digi, const HcalCoder &coder, const HcalCalibrations &calib, int firstSample=3, int samplesToAdd=4)
std::string mcOOTCorrectionCategory_
edm::EDGetTokenT< HFDigiCollection > tok_hf_
void setTopo(const HcalTopology *topo)
void setpuCorrParams(bool iPedestalConstraint, bool iTimeConstraint, bool iAddPulseJitter, bool iUnConstrainedFit, bool iApplyTimeSlew, double iTS4Min, double iTS4Max, double iPulseJitter, double iTimeMean, double iTimeSig, double iPedMean, double iPedSig, double iNoise, double iTMin, double iTMax, double its3Chi2, double its4Chi2, double its345Chi2, double iChargeThreshold, int iFitTimes)
double HFdigiflagMinEThreshold() const
bool useLeakCorrection() const