25 reco_(conf.getParameter<bool>(
"correctForTimeslew"),
26 conf.getParameter<bool>(
"correctForPhaseContainment"),
27 conf.getParameter<double>(
"correctionPhaseNS")),
29 inputLabel_(conf.getParameter<edm::InputTag>(
"digiLabel")),
30 correctTiming_(conf.getParameter<bool>(
"correctTiming")),
31 setNoiseFlags_(conf.getParameter<bool>(
"setNoiseFlags")),
32 setHSCPFlags_(conf.getParameter<bool>(
"setHSCPFlags")),
33 setSaturationFlags_(conf.getParameter<bool>(
"setSaturationFlags")),
34 setTimingTrustFlags_(conf.getParameter<bool>(
"setTimingTrustFlags")),
35 setPulseShapeFlags_(conf.getParameter<bool>(
"setPulseShapeFlags")),
36 setNegativeFlags_(
false),
37 dropZSmarkedPassed_(conf.getParameter<bool>(
"dropZSmarkedPassed")),
38 firstAuxTS_(conf.getParameter<int>(
"firstAuxTS")),
39 firstSample_(conf.getParameter<int>(
"firstSample")),
40 samplesToAdd_(conf.getParameter<int>(
"samplesToAdd")),
41 tsFromDB_(conf.getParameter<bool>(
"tsFromDB")),
42 useLeakCorrection_(conf.getParameter<bool>(
"useLeakCorrection")),
43 dataOOTCorrectionName_(
""),
44 dataOOTCorrectionCategory_(
"Data"),
45 mcOOTCorrectionName_(
""),
46 mcOOTCorrectionCategory_(
"MC"),
47 setPileupCorrection_(0),
48 setPileupCorrectionForNegative_(0),
50 puCorrMethod_(conf.existsAs<int>(
"puCorrMethod") ? conf.getParameter<int>(
"puCorrMethod") : 0),
70 if (conf.
existsAs<
bool>(
"setNegativeFlags"))
93 if (!strcasecmp(subd.c_str(),
"HBHE")) {
100 bool timingShapedCutsFlags = conf.
getParameter<
bool>(
"setTimingShapedCutsFlags");
101 if (timingShapedCutsFlags)
117 psdigi.
getParameter<std::vector<edm::ParameterSet> >(
"pulseShapeParameterSets")
139 psPulseShape.
getParameter<
double>(
"MinimumChargeThreshold"),
140 psPulseShape.
getParameter<
double>(
"TS4TS5ChargeThreshold"),
141 psPulseShape.
getParameter<
unsigned int>(
"TrianglePeakTS"),
142 psPulseShape.
getParameter<std::vector<double> >(
"LinearThreshold"),
143 psPulseShape.
getParameter<std::vector<double> >(
"LinearCut"),
144 psPulseShape.
getParameter<std::vector<double> >(
"RMS8MaxThreshold"),
145 psPulseShape.
getParameter<std::vector<double> >(
"RMS8MaxCut"),
146 psPulseShape.
getParameter<std::vector<double> >(
"LeftSlopeThreshold"),
147 psPulseShape.
getParameter<std::vector<double> >(
"LeftSlopeCut"),
148 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeThreshold"),
149 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeCut"),
150 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeSmallThreshold"),
151 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeSmallCut"),
152 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5LowerThreshold"),
153 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5LowerCut"),
154 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5UpperThreshold"),
155 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5UpperCut"),
163 psNegative.
getParameter<
double>(
"MinimumChargeThreshold"),
164 psNegative.
getParameter<
double>(
"TS4TS5ChargeThreshold"),
167 psNegative.
getParameter<std::vector<double> >(
"Threshold"),
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;
367 bool isMethod1Set =
false;
369 if (!corrName.empty())
372 if (eventSetup.
find(edm::eventsetup::EventSetupRecordKey::makeKey<HcalOOTPileupCorrectionRcd>()))
380 if( testMethod1Ptr ) isMethod1Set =
true;
393 if( isMethod1Set )
edm::LogWarning(
"HcalPUcorrMethod") <<
"Using Hcal OOTPU method 1" << std::endl;
394 else edm::LogWarning(
"HcalPUcorrMethod") <<
"puCorrMethod_ set to be 1 but method 1 is NOT activated (method 0 used instead)!\n"
395 <<
"Please check GlobalTag usage or method 1 seperately disabled by dataOOTCorrectionName & mcOOTCorrectionName?" << std::endl;
396 }
else edm::LogWarning(
"HcalPUcorrMethod") <<
"Using Hcal OOTPU method 0" << std::endl;
414 rec->reserve(digi->size());
418 std::vector<HBHEDataFrame> HBDigis;
419 std::vector<int> RecHitIndex;
422 int favorite_capid = 0;
424 long capid_votes[4] = {0,0,0,0};
425 for (i=digi->begin(); i!=digi->end(); i++) {
426 capid_votes[(*i)[0].capid()]++;
428 for (
int k = 0;
k < 4;
k++)
429 if (capid_votes[
k] > capid_votes[favorite_capid])
433 for (i=digi->begin(); i!=digi->end(); i++) {
488 if (i->zsMarkAndPass())
continue;
491 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
492 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
498 unsigned int auxflag=0;
501 for (
int xx=fTS; xx<fTS+4 && xx<i->size();++xx) {
502 int adcv = i->sample(xx).adc();
503 auxflag+=((adcv&0x7F)<<(7*(xx-fTS)));
506 auxflag+=((i->sample(fTS).capid())<<28);
507 (rec->back()).setAux(auxflag);
512 for (
int xx = fTS2; xx < fTS2+4 && xx<i->size(); ++xx) {
513 int adcv = i->sample(xx).adc();
514 auxflag+=((adcv&0x7F)<<(7*(xx-fTS2)));
516 auxflag+=((i->sample(fTS2).capid())<<28);
517 (rec->back()).setAuxHBHE(auxflag);
519 (rec->back()).setFlags(0);
539 for(
int j=0;
j!=i->size(); DigiEnergy += i->sample(
j++).nominal_fC());
542 HBDigis.push_back(*i);
543 RecHitIndex.push_back(rec->size()-1);
562 rec->reserve(digi->size());
567 int favorite_capid = 0;
569 long capid_votes[4] = {0,0,0,0};
570 for (i=digi->begin(); i!=digi->end(); i++) {
571 capid_votes[(*i)[0].capid()]++;
573 for (
int k = 0;
k < 4;
k++)
574 if (capid_votes[
k] > capid_votes[favorite_capid])
578 for (i=digi->begin(); i!=digi->end(); i++) {
607 if (i->zsMarkAndPass())
continue;
610 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
611 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
620 for (
int xx=fTS; xx<fTS+4 && xx<i->size();++xx)
621 auxflag+=(i->sample(xx).adc())<<(7*(xx-fTS));
623 auxflag+=((i->sample(fTS).capid())<<28);
624 (rec->back()).setAux(auxflag);
626 (rec->back()).setFlags(0);
648 rec->reserve(digi->size());
653 int favorite_capid = 0;
655 long capid_votes[4] = {0,0,0,0};
656 for (i=digi->begin(); i!=digi->end(); i++) {
657 capid_votes[(*i)[0].capid()]++;
659 for (
int k = 0;
k < 4;
k++)
660 if (capid_votes[
k] > capid_votes[favorite_capid])
664 for (i=digi->begin(); i!=digi->end(); i++) {
693 if (i->zsMarkAndPass())
continue;
696 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
697 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
719 for (
int xx=fTS; xx<fTS+4 && xx<i->size();++xx)
720 auxflag+=(i->sample(xx).adc())<<(7*(xx-fTS));
722 auxflag+=((i->sample(fTS).capid())<<28);
723 (rec->back()).setAux(auxflag);
726 (rec->back()).setFlags(0);
753 int depth=i->id().depth();
754 int ieta=i->id().ieta();
756 if (depth==2 ||
abs(ieta)==29 )
763 int depth=i->id().depth();
764 int ieta=i->id().ieta();
766 if (depth==2 ||
abs(ieta)==29 )
773 int depth=i->id().depth();
774 int ieta=i->id().ieta();
776 if (depth==1 &&
abs(ieta)!=29 )
789 rec->reserve(digi->size());
795 for (i=digi->begin(); i!=digi->end(); i++) {
803 if (i->zsMarkAndPass())
continue;
806 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
807 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 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
SetCorrectionFcnForNegative setPileupCorrectionForNegative_
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
std::vector< HFRecHit >::iterator iterator
void setHBHEPileupCorrection(boost::shared_ptr< AbsOOTPileupCorrection > corr)
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