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;
368 bool isMethod1Set =
false;
372 if (eventSetup.
find(edm::eventsetup::EventSetupRecordKey::makeKey<HcalOOTPileupCorrectionRcd>()))
379 if( testMethod1Ptr ) isMethod1Set =
true;
398 if( isMethod1Set )
LogTrace(
"HcalPUcorrMethod") <<
"Using Hcal OOTPU method 1" << std::endl;
399 else edm::LogWarning(
"HcalPUcorrMethod") <<
"puCorrMethod_ set to be 1 but method 1 is NOT activated (method 0 used instead)!\n"
400 <<
"Please check GlobalTag usage or method 1 separately disabled by dataOOTCorrectionName & mcOOTCorrectionName?" << std::endl;
402 LogTrace(
"HcalPUcorrMethod") <<
"Using Hcal Deterministic Fit Method!" << std::endl;
403 }
else LogTrace(
"HcalPUcorrMethod") <<
"Using Hcal OOTPU method 0" << std::endl;
421 rec->reserve(digi->size());
425 std::vector<HBHEDataFrame> HBDigis;
426 std::vector<int> RecHitIndex;
429 int favorite_capid = 0;
431 long capid_votes[4] = {0,0,0,0};
432 for (i=digi->begin(); i!=digi->end(); i++) {
433 capid_votes[(*i)[0].capid()]++;
435 for (
int k = 0;
k < 4;
k++)
436 if (capid_votes[
k] > capid_votes[favorite_capid])
440 for (i=digi->begin(); i!=digi->end(); i++) {
495 if (i->zsMarkAndPass())
continue;
498 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
499 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
505 unsigned int auxflag=0;
508 for (
int xx=fTS; xx<fTS+4 && xx<i->size();++xx) {
509 int adcv = i->sample(xx).adc();
510 auxflag+=((adcv&0x7F)<<(7*(xx-fTS)));
513 auxflag+=((i->sample(fTS).capid())<<28);
514 (rec->back()).setAux(auxflag);
519 for (
int xx = fTS2; xx < fTS2+4 && xx<i->size(); ++xx) {
520 int adcv = i->sample(xx).adc();
521 auxflag+=((adcv&0x7F)<<(7*(xx-fTS2)));
523 auxflag+=((i->sample(fTS2).capid())<<28);
524 (rec->back()).setAuxHBHE(auxflag);
526 (rec->back()).setFlags(0);
546 for(
int j=0;
j!=i->size(); DigiEnergy += i->sample(
j++).nominal_fC());
549 HBDigis.push_back(*i);
550 RecHitIndex.push_back(rec->size()-1);
569 rec->reserve(digi->size());
574 int favorite_capid = 0;
576 long capid_votes[4] = {0,0,0,0};
577 for (i=digi->begin(); i!=digi->end(); i++) {
578 capid_votes[(*i)[0].capid()]++;
580 for (
int k = 0;
k < 4;
k++)
581 if (capid_votes[
k] > capid_votes[favorite_capid])
585 for (i=digi->begin(); i!=digi->end(); i++) {
614 if (i->zsMarkAndPass())
continue;
617 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
618 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
627 for (
int xx=fTS; xx<fTS+4 && xx<i->size();++xx)
628 auxflag+=(i->sample(xx).adc())<<(7*(xx-fTS));
630 auxflag+=((i->sample(fTS).capid())<<28);
631 (rec->back()).setAux(auxflag);
632 (rec->back()).setFlags(0);
654 rec->reserve(digi->size());
659 int favorite_capid = 0;
661 long capid_votes[4] = {0,0,0,0};
662 for (i=digi->begin(); i!=digi->end(); i++) {
663 capid_votes[(*i)[0].capid()]++;
665 for (
int k = 0;
k < 4;
k++)
666 if (capid_votes[
k] > capid_votes[favorite_capid])
670 for (i=digi->begin(); i!=digi->end(); i++) {
699 if (i->zsMarkAndPass())
continue;
702 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
703 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
725 for (
int xx=fTS; xx<fTS+4 && xx<i->size();++xx)
726 auxflag+=(i->sample(xx).adc())<<(7*(xx-fTS));
728 auxflag+=((i->sample(fTS).capid())<<28);
729 (rec->back()).setAux(auxflag);
732 (rec->back()).setFlags(0);
759 int depth=i->id().depth();
760 int ieta=i->id().ieta();
762 if (depth==2 ||
abs(ieta)==29 )
769 int depth=i->id().depth();
770 int ieta=i->id().ieta();
772 if (depth==2 ||
abs(ieta)==29 )
779 int depth=i->id().depth();
780 int ieta=i->id().ieta();
782 if (depth==1 &&
abs(ieta)!=29 )
795 rec->reserve(digi->size());
801 for (i=digi->begin(); i!=digi->end(); i++) {
809 if (i->zsMarkAndPass())
continue;
812 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
813 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
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
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)
unsigned int samplesToAdd() const
edm::EDGetTokenT< HODigiCollection > tok_ho_
HcalHitReconstructor(const edm::ParameterSet &ps)
float correctionPhaseNS() const
tuple correctForPhaseContainment
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
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