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 dropZSmarkedPassed_(conf.getParameter<bool>(
"dropZSmarkedPassed")),
37 firstAuxTS_(conf.getParameter<int>(
"firstAuxTS")),
38 firstSample_(conf.getParameter<int>(
"firstSample")),
39 samplesToAdd_(conf.getParameter<int>(
"samplesToAdd")),
40 tsFromDB_(conf.getParameter<bool>(
"tsFromDB")),
41 useLeakCorrection_(conf.getParameter<bool>(
"useLeakCorrection")),
42 dataOOTCorrectionName_(
""),
43 dataOOTCorrectionCategory_(
"Data"),
44 mcOOTCorrectionName_(
""),
45 mcOOTCorrectionCategory_(
"MC"),
46 setPileupCorrection_(0),
86 if (!strcasecmp(subd.c_str(),
"HBHE")) {
89 bool timingShapedCutsFlags = conf.
getParameter<
bool>(
"setTimingShapedCutsFlags");
90 if (timingShapedCutsFlags)
106 psdigi.
getParameter<std::vector<edm::ParameterSet> >(
"pulseShapeParameterSets")
128 psPulseShape.
getParameter<
double>(
"MinimumChargeThreshold"),
129 psPulseShape.
getParameter<
double>(
"TS4TS5ChargeThreshold"),
130 psPulseShape.
getParameter<
unsigned int>(
"TrianglePeakTS"),
131 psPulseShape.
getParameter<std::vector<double> >(
"LinearThreshold"),
132 psPulseShape.
getParameter<std::vector<double> >(
"LinearCut"),
133 psPulseShape.
getParameter<std::vector<double> >(
"RMS8MaxThreshold"),
134 psPulseShape.
getParameter<std::vector<double> >(
"RMS8MaxCut"),
135 psPulseShape.
getParameter<std::vector<double> >(
"LeftSlopeThreshold"),
136 psPulseShape.
getParameter<std::vector<double> >(
"LeftSlopeCut"),
137 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeThreshold"),
138 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeCut"),
139 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeSmallThreshold"),
140 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeSmallCut"),
141 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5LowerThreshold"),
142 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5LowerCut"),
143 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5UpperThreshold"),
144 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5UpperCut"),
149 produces<HBHERecHitCollection>();
150 }
else if (!strcasecmp(subd.c_str(),
"HO")) {
153 produces<HORecHitCollection>();
154 }
else if (!strcasecmp(subd.c_str(),
"HF")) {
174 psS9S1.
getParameter<std::vector<double> >(
"shortEnergyParams"),
175 psS9S1.
getParameter<std::vector<double> >(
"shortETParams"),
176 psS9S1.
getParameter<std::vector<double> >(
"long_optimumSlope"),
177 psS9S1.
getParameter<std::vector<double> >(
"longEnergyParams"),
178 psS9S1.
getParameter<std::vector<double> >(
"longETParams"),
185 psS8S1.
getParameter<std::vector<double> >(
"shortEnergyParams"),
186 psS8S1.
getParameter<std::vector<double> >(
"shortETParams"),
187 psS8S1.
getParameter<std::vector<double> >(
"long_optimumSlope"),
188 psS8S1.
getParameter<std::vector<double> >(
"longEnergyParams"),
189 psS8S1.
getParameter<std::vector<double> >(
"longETParams"),
196 psPET.
getParameter<std::vector<double> >(
"shortEnergyParams"),
197 psPET.
getParameter<std::vector<double> >(
"shortETParams"),
199 psPET.
getParameter<std::vector<double> >(
"longEnergyParams"),
200 psPET.
getParameter<std::vector<double> >(
"longETParams"),
206 produces<HFRecHitCollection>();
207 }
else if (!strcasecmp(subd.c_str(),
"ZDC")) {
210 produces<ZDCRecHitCollection>();
211 }
else if (!strcasecmp(subd.c_str(),
"CALIB")) {
214 produces<HcalCalibRecHitCollection>();
216 std::cout <<
"HcalHitReconstructor is not associated with a specific subdetector!" << std::endl;
323 if (!corrName.empty())
326 if (eventSetup.
find(edm::eventsetup::EventSetupRecordKey::makeKey<HcalOOTPileupCorrectionRcd>()))
348 rec->reserve(digi->size());
352 std::vector<HBHEDataFrame> HBDigis;
353 std::vector<int> RecHitIndex;
356 int favorite_capid = 0;
358 long capid_votes[4] = {0,0,0,0};
359 for (i=digi->begin(); i!=digi->end(); i++) {
360 capid_votes[(*i)[0].capid()]++;
362 for (
int k = 0;
k < 4;
k++)
363 if (capid_votes[
k] > capid_votes[favorite_capid])
367 for (i=digi->begin(); i!=digi->end(); i++) {
422 if (i->zsMarkAndPass())
continue;
425 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
426 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
432 unsigned int auxflag=0;
435 for (
int xx=fTS; xx<fTS+4 && xx<i->size();++xx) {
436 int adcv = i->sample(xx).adc();
437 auxflag+=((adcv&0x7F)<<(7*(xx-fTS)));
440 auxflag+=((i->sample(fTS).capid())<<28);
441 (rec->back()).setAux(auxflag);
446 for (
int xx = fTS2; xx < fTS2+4 && xx<i->size(); ++xx) {
447 int adcv = i->sample(xx).adc();
448 auxflag+=((adcv&0x7F)<<(7*(xx-fTS2)));
450 auxflag+=((i->sample(fTS2).capid())<<28);
451 (rec->back()).setAuxHBHE(auxflag);
453 (rec->back()).setFlags(0);
471 for(
int j=0;
j!=i->size(); DigiEnergy += i->sample(
j++).nominal_fC());
474 HBDigis.push_back(*i);
475 RecHitIndex.push_back(rec->size()-1);
494 rec->reserve(digi->size());
499 int favorite_capid = 0;
501 long capid_votes[4] = {0,0,0,0};
502 for (i=digi->begin(); i!=digi->end(); i++) {
503 capid_votes[(*i)[0].capid()]++;
505 for (
int k = 0;
k < 4;
k++)
506 if (capid_votes[
k] > capid_votes[favorite_capid])
510 for (i=digi->begin(); i!=digi->end(); i++) {
539 if (i->zsMarkAndPass())
continue;
542 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
543 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
552 for (
int xx=fTS; xx<fTS+4 && xx<i->size();++xx)
553 auxflag+=(i->sample(xx).adc())<<(7*(xx-fTS));
555 auxflag+=((i->sample(fTS).capid())<<28);
556 (rec->back()).setAux(auxflag);
558 (rec->back()).setFlags(0);
580 rec->reserve(digi->size());
585 int favorite_capid = 0;
587 long capid_votes[4] = {0,0,0,0};
588 for (i=digi->begin(); i!=digi->end(); i++) {
589 capid_votes[(*i)[0].capid()]++;
591 for (
int k = 0;
k < 4;
k++)
592 if (capid_votes[
k] > capid_votes[favorite_capid])
596 for (i=digi->begin(); i!=digi->end(); i++) {
625 if (i->zsMarkAndPass())
continue;
628 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
629 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
651 for (
int xx=fTS; xx<fTS+4 && xx<i->size();++xx)
652 auxflag+=(i->sample(xx).adc())<<(7*(xx-fTS));
654 auxflag+=((i->sample(fTS).capid())<<28);
655 (rec->back()).setAux(auxflag);
658 (rec->back()).setFlags(0);
685 int depth=i->id().depth();
686 int ieta=i->id().ieta();
688 if (depth==2 ||
abs(ieta)==29 )
695 int depth=i->id().depth();
696 int ieta=i->id().ieta();
698 if (depth==2 ||
abs(ieta)==29 )
705 int depth=i->id().depth();
706 int ieta=i->id().ieta();
708 if (depth==1 &&
abs(ieta)!=29 )
721 rec->reserve(digi->size());
727 for (i=digi->begin(); i!=digi->end(); i++) {
735 if (i->zsMarkAndPass())
continue;
738 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
739 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
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)
void setTopo(const HcalTopology *topo) const
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_
HcalTopology * theTopology
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
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_
virtual void produce(edm::Event &e, const edm::EventSetup &c)
HcalHitReconstructor(const edm::ParameterSet &ps)
float correctionPhaseNS() const
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_
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_
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 setHFPileupCorrection(boost::shared_ptr< AbsOOTPileupCorrection > corr)
const HcalFlagHFDigiTimeParams * HFDigiTimeParams
const HcalTopology * topo() const
double HFdigiflagMinEThreshold() const
bool useLeakCorrection() const