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.existsAs<int>(
"puCorrMethod") ? conf.getParameter<int>(
"puCorrMethod") : 0),
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<
unsigned int>(
"TrianglePeakTS"),
143 psPulseShape.
getParameter<std::vector<double> >(
"LinearThreshold"),
144 psPulseShape.
getParameter<std::vector<double> >(
"LinearCut"),
145 psPulseShape.
getParameter<std::vector<double> >(
"RMS8MaxThreshold"),
146 psPulseShape.
getParameter<std::vector<double> >(
"RMS8MaxCut"),
147 psPulseShape.
getParameter<std::vector<double> >(
"LeftSlopeThreshold"),
148 psPulseShape.
getParameter<std::vector<double> >(
"LeftSlopeCut"),
149 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeThreshold"),
150 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeCut"),
151 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeSmallThreshold"),
152 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeSmallCut"),
153 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5LowerThreshold"),
154 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5LowerCut"),
155 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5UpperThreshold"),
156 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5UpperCut"),
163 produces<HBHERecHitCollection>();
164 }
else if (!strcasecmp(subd.c_str(),
"HO")) {
168 produces<HORecHitCollection>();
169 }
else if (!strcasecmp(subd.c_str(),
"HF")) {
190 psS9S1.
getParameter<std::vector<double> >(
"shortEnergyParams"),
191 psS9S1.
getParameter<std::vector<double> >(
"shortETParams"),
192 psS9S1.
getParameter<std::vector<double> >(
"long_optimumSlope"),
193 psS9S1.
getParameter<std::vector<double> >(
"longEnergyParams"),
194 psS9S1.
getParameter<std::vector<double> >(
"longETParams"),
201 psS8S1.
getParameter<std::vector<double> >(
"shortEnergyParams"),
202 psS8S1.
getParameter<std::vector<double> >(
"shortETParams"),
203 psS8S1.
getParameter<std::vector<double> >(
"long_optimumSlope"),
204 psS8S1.
getParameter<std::vector<double> >(
"longEnergyParams"),
205 psS8S1.
getParameter<std::vector<double> >(
"longETParams"),
212 psPET.
getParameter<std::vector<double> >(
"shortEnergyParams"),
213 psPET.
getParameter<std::vector<double> >(
"shortETParams"),
215 psPET.
getParameter<std::vector<double> >(
"longEnergyParams"),
216 psPET.
getParameter<std::vector<double> >(
"longETParams"),
222 produces<HFRecHitCollection>();
223 }
else if (!strcasecmp(subd.c_str(),
"ZDC")) {
226 produces<ZDCRecHitCollection>();
227 }
else if (!strcasecmp(subd.c_str(),
"CALIB")) {
230 produces<HcalCalibRecHitCollection>();
232 edm::LogWarning(
"Configuration") <<
"HcalHitReconstructor is not associated with a specific subdetector!" << std::endl;
278 conf.
getParameter<std::vector<double> >(
"timeSlewPars"),
288 desc.
add<
int>(
"pedestalSubtractionType", 1);
289 desc.
add<
double>(
"pedestalUpperLimit", 2.7);
290 desc.
add<
int>(
"timeSlewParsType",3);
291 desc.
add<std::vector<double>>(
"timeSlewPars", {15.5, -3.2, 32, 15.5, -3.2, 32, 15.5, -3.2, 32});
292 desc.
add<
double>(
"respCorrM3", 0.95);
293 descriptions.
add(
"hltHbhereco",desc);
389 bool isMethod1Set =
false;
393 if (eventSetup.
find(edm::eventsetup::EventSetupRecordKey::makeKey<HcalOOTPileupCorrectionRcd>()))
400 if( testMethod1Ptr ) isMethod1Set =
true;
419 if( isMethod1Set )
LogTrace(
"HcalPUcorrMethod") <<
"Using Hcal OOTPU method 1" << std::endl;
420 else edm::LogWarning(
"HcalPUcorrMethod") <<
"puCorrMethod_ set to be 1 but method 1 is NOT activated (method 0 used instead)!\n"
421 <<
"Please check GlobalTag usage or method 1 separately disabled by dataOOTCorrectionName & mcOOTCorrectionName?" << std::endl;
423 LogTrace(
"HcalPUcorrMethod") <<
"Using Hcal Deterministic Fit Method!" << std::endl;
424 }
else LogTrace(
"HcalPUcorrMethod") <<
"Using Hcal OOTPU method 0" << std::endl;
442 rec->reserve(digi->size());
446 std::vector<HBHEDataFrame> HBDigis;
447 std::vector<int> RecHitIndex;
450 int favorite_capid = 0;
452 long capid_votes[4] = {0,0,0,0};
453 for (i=digi->begin(); i!=digi->end(); i++) {
454 capid_votes[(*i)[0].capid()]++;
456 for (
int k = 0;
k < 4;
k++)
457 if (capid_votes[
k] > capid_votes[favorite_capid])
461 for (i=digi->begin(); i!=digi->end(); i++) {
516 if (i->zsMarkAndPass())
continue;
519 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
520 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
526 unsigned int auxflag=0;
529 for (
int xx=fTS; xx<fTS+4 && xx<i->size();++xx) {
530 int adcv = i->sample(xx).adc();
531 auxflag+=((adcv&0x7F)<<(7*(xx-fTS)));
534 auxflag+=((i->sample(fTS).capid())<<28);
535 (rec->back()).setAux(auxflag);
540 for (
int xx = fTS2; xx < fTS2+4 && xx<i->size(); ++xx) {
541 int adcv = i->sample(xx).adc();
542 auxflag+=((adcv&0x7F)<<(7*(xx-fTS2)));
544 auxflag+=((i->sample(fTS2).capid())<<28);
545 (rec->back()).setAuxHBHE(auxflag);
547 (rec->back()).setFlags(0);
567 for(
int j=0;
j!=i->size(); DigiEnergy += i->sample(
j++).nominal_fC());
570 HBDigis.push_back(*i);
571 RecHitIndex.push_back(rec->size()-1);
590 rec->reserve(digi->size());
595 int favorite_capid = 0;
597 long capid_votes[4] = {0,0,0,0};
598 for (i=digi->begin(); i!=digi->end(); i++) {
599 capid_votes[(*i)[0].capid()]++;
601 for (
int k = 0;
k < 4;
k++)
602 if (capid_votes[
k] > capid_votes[favorite_capid])
606 for (i=digi->begin(); i!=digi->end(); i++) {
635 if (i->zsMarkAndPass())
continue;
638 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
639 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
648 for (
int xx=fTS; xx<fTS+4 && xx<i->size();++xx)
649 auxflag+=(i->sample(xx).adc())<<(7*(xx-fTS));
651 auxflag+=((i->sample(fTS).capid())<<28);
652 (rec->back()).setAux(auxflag);
653 (rec->back()).setFlags(0);
675 rec->reserve(digi->size());
680 int favorite_capid = 0;
682 long capid_votes[4] = {0,0,0,0};
683 for (i=digi->begin(); i!=digi->end(); i++) {
684 capid_votes[(*i)[0].capid()]++;
686 for (
int k = 0;
k < 4;
k++)
687 if (capid_votes[
k] > capid_votes[favorite_capid])
691 for (i=digi->begin(); i!=digi->end(); i++) {
720 if (i->zsMarkAndPass())
continue;
723 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
724 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
746 for (
int xx=fTS; xx<fTS+4 && xx<i->size();++xx)
747 auxflag+=(i->sample(xx).adc())<<(7*(xx-fTS));
749 auxflag+=((i->sample(fTS).capid())<<28);
750 (rec->back()).setAux(auxflag);
753 (rec->back()).setFlags(0);
780 int depth=i->id().depth();
781 int ieta=i->id().ieta();
783 if (depth==2 ||
abs(ieta)==29 )
790 int depth=i->id().depth();
791 int ieta=i->id().ieta();
793 if (depth==2 ||
abs(ieta)==29 )
800 int depth=i->id().depth();
801 int ieta=i->id().ieta();
803 if (depth==1 &&
abs(ieta)!=29 )
816 rec->reserve(digi->size());
822 for (i=digi->begin(); i!=digi->end(); i++) {
830 if (i->zsMarkAndPass())
continue;
833 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
834 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
void setHOPileupCorrection(boost::shared_ptr< AbsOOTPileupCorrection > corr)
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 setHFPileupCorrection(boost::shared_ptr< AbsOOTPileupCorrection > corr)
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