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<
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;
277 conf.
getParameter<std::vector<double> >(
"timeSlewPars"),
287 desc.
add<
int>(
"pedestalSubtractionType", 1);
288 desc.
add<
double>(
"pedestalUpperLimit", 2.7);
289 desc.
add<
int>(
"timeSlewParsType",3);
290 desc.
add<std::vector<double>>(
"timeSlewPars", { 12.2999, -2.19142, 0, 12.2999, -2.19142, 0, 12.2999, -2.19142, 0 });
291 desc.
add<
double>(
"respCorrM3", 0.95);
292 descriptions.
add(
"hltHbhereco",desc);
388 bool isMethod1Set =
false;
392 if (eventSetup.
find(edm::eventsetup::EventSetupRecordKey::makeKey<HcalOOTPileupCorrectionRcd>()))
399 if( testMethod1Ptr ) isMethod1Set =
true;
418 if( isMethod1Set )
LogTrace(
"HcalPUcorrMethod") <<
"Using Hcal OOTPU method 1" << std::endl;
419 else edm::LogWarning(
"HcalPUcorrMethod") <<
"puCorrMethod_ set to be 1 but method 1 is NOT activated (method 0 used instead)!\n"
420 <<
"Please check GlobalTag usage or method 1 separately disabled by dataOOTCorrectionName & mcOOTCorrectionName?" << std::endl;
422 LogTrace(
"HcalPUcorrMethod") <<
"Using Hcal Deterministic Fit Method!" << std::endl;
423 }
else LogTrace(
"HcalPUcorrMethod") <<
"Using Hcal OOTPU method 0" << std::endl;
441 rec->reserve(digi->size());
445 std::vector<HBHEDataFrame> HBDigis;
446 std::vector<int> RecHitIndex;
449 int favorite_capid = 0;
451 long capid_votes[4] = {0,0,0,0};
452 for (i=digi->begin(); i!=digi->end(); i++) {
453 capid_votes[(*i)[0].capid()]++;
455 for (
int k = 0;
k < 4;
k++)
456 if (capid_votes[
k] > capid_votes[favorite_capid])
460 for (i=digi->begin(); i!=digi->end(); i++) {
515 if (i->zsMarkAndPass())
continue;
518 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
519 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
525 unsigned int auxflag=0;
528 for (
int xx=fTS; xx<fTS+4 && xx<i->size();++xx) {
529 int adcv = i->sample(xx).adc();
530 auxflag+=((adcv&0x7F)<<(7*(xx-fTS)));
533 auxflag+=((i->sample(fTS).capid())<<28);
534 (rec->back()).setAux(auxflag);
539 for (
int xx = fTS2; xx < fTS2+4 && xx<i->size(); ++xx) {
540 int adcv = i->sample(xx).adc();
541 auxflag+=((adcv&0x7F)<<(7*(xx-fTS2)));
543 auxflag+=((i->sample(fTS2).capid())<<28);
544 (rec->back()).setAuxHBHE(auxflag);
546 (rec->back()).setFlags(0);
566 for(
int j=0;
j!=i->size(); DigiEnergy += i->sample(
j++).nominal_fC());
569 HBDigis.push_back(*i);
570 RecHitIndex.push_back(rec->size()-1);
589 rec->reserve(digi->size());
594 int favorite_capid = 0;
596 long capid_votes[4] = {0,0,0,0};
597 for (i=digi->begin(); i!=digi->end(); i++) {
598 capid_votes[(*i)[0].capid()]++;
600 for (
int k = 0;
k < 4;
k++)
601 if (capid_votes[
k] > capid_votes[favorite_capid])
605 for (i=digi->begin(); i!=digi->end(); i++) {
634 if (i->zsMarkAndPass())
continue;
637 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
638 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
647 for (
int xx=fTS; xx<fTS+4 && xx<i->size();++xx)
648 auxflag+=(i->sample(xx).adc())<<(7*(xx-fTS));
650 auxflag+=((i->sample(fTS).capid())<<28);
651 (rec->back()).setAux(auxflag);
652 (rec->back()).setFlags(0);
674 rec->reserve(digi->size());
679 int favorite_capid = 0;
681 long capid_votes[4] = {0,0,0,0};
682 for (i=digi->begin(); i!=digi->end(); i++) {
683 capid_votes[(*i)[0].capid()]++;
685 for (
int k = 0;
k < 4;
k++)
686 if (capid_votes[
k] > capid_votes[favorite_capid])
690 for (i=digi->begin(); i!=digi->end(); i++) {
719 if (i->zsMarkAndPass())
continue;
722 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
723 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
745 for (
int xx=fTS; xx<fTS+4 && xx<i->size();++xx)
746 auxflag+=(i->sample(xx).adc())<<(7*(xx-fTS));
748 auxflag+=((i->sample(fTS).capid())<<28);
749 (rec->back()).setAux(auxflag);
752 (rec->back()).setFlags(0);
779 int depth=i->id().depth();
780 int ieta=i->id().ieta();
782 if (depth==2 ||
abs(ieta)==29 )
789 int depth=i->id().depth();
790 int ieta=i->id().ieta();
792 if (depth==2 ||
abs(ieta)==29 )
799 int depth=i->id().depth();
800 int ieta=i->id().ieta();
802 if (depth==1 &&
abs(ieta)!=29 )
815 rec->reserve(digi->size());
821 for (i=digi->begin(); i!=digi->end(); i++) {
829 if (i->zsMarkAndPass())
continue;
832 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
833 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