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),
72 if (conf.
existsAs<
bool>(
"setNegativeFlags"))
95 if (!strcasecmp(subd.c_str(),
"HBHE")) {
102 bool timingShapedCutsFlags = conf.
getParameter<
bool>(
"setTimingShapedCutsFlags");
103 if (timingShapedCutsFlags)
119 psdigi.
getParameter<std::vector<edm::ParameterSet> >(
"pulseShapeParameterSets")
141 psPulseShape.
getParameter<
double>(
"MinimumChargeThreshold"),
142 psPulseShape.
getParameter<
double>(
"TS4TS5ChargeThreshold"),
143 psPulseShape.
getParameter<
unsigned int>(
"TrianglePeakTS"),
144 psPulseShape.
getParameter<std::vector<double> >(
"LinearThreshold"),
145 psPulseShape.
getParameter<std::vector<double> >(
"LinearCut"),
146 psPulseShape.
getParameter<std::vector<double> >(
"RMS8MaxThreshold"),
147 psPulseShape.
getParameter<std::vector<double> >(
"RMS8MaxCut"),
148 psPulseShape.
getParameter<std::vector<double> >(
"LeftSlopeThreshold"),
149 psPulseShape.
getParameter<std::vector<double> >(
"LeftSlopeCut"),
150 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeThreshold"),
151 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeCut"),
152 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeSmallThreshold"),
153 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeSmallCut"),
154 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5LowerThreshold"),
155 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5LowerCut"),
156 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5UpperThreshold"),
157 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5UpperCut"),
165 psNegative.
getParameter<
double>(
"MinimumChargeThreshold"),
166 psNegative.
getParameter<
double>(
"TS4TS5ChargeThreshold"),
169 psNegative.
getParameter<std::vector<double> >(
"Threshold"),
173 produces<HBHERecHitCollection>();
174 }
else if (!strcasecmp(subd.c_str(),
"HO")) {
178 produces<HORecHitCollection>();
179 }
else if (!strcasecmp(subd.c_str(),
"HF")) {
200 psS9S1.
getParameter<std::vector<double> >(
"shortEnergyParams"),
201 psS9S1.
getParameter<std::vector<double> >(
"shortETParams"),
202 psS9S1.
getParameter<std::vector<double> >(
"long_optimumSlope"),
203 psS9S1.
getParameter<std::vector<double> >(
"longEnergyParams"),
204 psS9S1.
getParameter<std::vector<double> >(
"longETParams"),
211 psS8S1.
getParameter<std::vector<double> >(
"shortEnergyParams"),
212 psS8S1.
getParameter<std::vector<double> >(
"shortETParams"),
213 psS8S1.
getParameter<std::vector<double> >(
"long_optimumSlope"),
214 psS8S1.
getParameter<std::vector<double> >(
"longEnergyParams"),
215 psS8S1.
getParameter<std::vector<double> >(
"longETParams"),
222 psPET.
getParameter<std::vector<double> >(
"shortEnergyParams"),
223 psPET.
getParameter<std::vector<double> >(
"shortETParams"),
225 psPET.
getParameter<std::vector<double> >(
"longEnergyParams"),
226 psPET.
getParameter<std::vector<double> >(
"longETParams"),
232 produces<HFRecHitCollection>();
233 }
else if (!strcasecmp(subd.c_str(),
"ZDC")) {
236 produces<ZDCRecHitCollection>();
237 }
else if (!strcasecmp(subd.c_str(),
"CALIB")) {
240 produces<HcalCalibRecHitCollection>();
242 edm::LogWarning(
"Configuration") <<
"HcalHitReconstructor is not associated with a specific subdetector!" << std::endl;
374 bool isMethod1Set =
false;
378 if (eventSetup.
find(edm::eventsetup::EventSetupRecordKey::makeKey<HcalOOTPileupCorrectionRcd>()))
385 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 seperately 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 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)
tuple correctForPhaseContainment
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