24 reco_(conf.getParameter<bool>(
"correctForTimeslew"),
25 conf.getParameter<bool>(
"correctForPhaseContainment"),
26 conf.getParameter<double>(
"correctionPhaseNS")),
28 inputLabel_(conf.getParameter<edm::InputTag>(
"digiLabel")),
29 correctTiming_(conf.getParameter<bool>(
"correctTiming")),
30 setNoiseFlags_(conf.getParameter<bool>(
"setNoiseFlags")),
31 setHSCPFlags_(conf.getParameter<bool>(
"setHSCPFlags")),
32 setSaturationFlags_(conf.getParameter<bool>(
"setSaturationFlags")),
33 setTimingTrustFlags_(conf.getParameter<bool>(
"setTimingTrustFlags")),
34 setPulseShapeFlags_(conf.getParameter<bool>(
"setPulseShapeFlags")),
35 dropZSmarkedPassed_(conf.getParameter<bool>(
"dropZSmarkedPassed")),
36 firstAuxTS_(conf.getParameter<int>(
"firstAuxTS")),
37 firstSample_(conf.getParameter<int>(
"firstSample")),
38 samplesToAdd_(conf.getParameter<int>(
"samplesToAdd")),
39 tsFromDB_(conf.getParameter<bool>(
"tsFromDB")),
40 useLeakCorrection_(conf.getParameter<bool>(
"useLeakCorrection")),
41 dataOOTCorrectionName_(
""),
42 dataOOTCorrectionCategory_(
"Data"),
43 mcOOTCorrectionName_(
""),
44 mcOOTCorrectionCategory_(
"MC"),
45 setPileupCorrection_(0),
85 if (!strcasecmp(subd.c_str(),
"HBHE")) {
88 bool timingShapedCutsFlags = conf.
getParameter<
bool>(
"setTimingShapedCutsFlags");
89 if (timingShapedCutsFlags)
105 psdigi.
getParameter<std::vector<edm::ParameterSet> >(
"pulseShapeParameterSets")
127 psPulseShape.
getParameter<
double>(
"MinimumChargeThreshold"),
128 psPulseShape.
getParameter<
double>(
"TS4TS5ChargeThreshold"),
129 psPulseShape.
getParameter<
unsigned int>(
"TrianglePeakTS"),
130 psPulseShape.
getParameter<std::vector<double> >(
"LinearThreshold"),
131 psPulseShape.
getParameter<std::vector<double> >(
"LinearCut"),
132 psPulseShape.
getParameter<std::vector<double> >(
"RMS8MaxThreshold"),
133 psPulseShape.
getParameter<std::vector<double> >(
"RMS8MaxCut"),
134 psPulseShape.
getParameter<std::vector<double> >(
"LeftSlopeThreshold"),
135 psPulseShape.
getParameter<std::vector<double> >(
"LeftSlopeCut"),
136 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeThreshold"),
137 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeCut"),
138 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeSmallThreshold"),
139 psPulseShape.
getParameter<std::vector<double> >(
"RightSlopeSmallCut"),
140 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5LowerThreshold"),
141 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5LowerCut"),
142 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5UpperThreshold"),
143 psPulseShape.
getParameter<std::vector<double> >(
"TS4TS5UpperCut"),
148 produces<HBHERecHitCollection>();
149 }
else if (!strcasecmp(subd.c_str(),
"HO")) {
152 produces<HORecHitCollection>();
153 }
else if (!strcasecmp(subd.c_str(),
"HF")) {
173 psS9S1.
getParameter<std::vector<double> >(
"shortEnergyParams"),
174 psS9S1.
getParameter<std::vector<double> >(
"shortETParams"),
175 psS9S1.
getParameter<std::vector<double> >(
"long_optimumSlope"),
176 psS9S1.
getParameter<std::vector<double> >(
"longEnergyParams"),
177 psS9S1.
getParameter<std::vector<double> >(
"longETParams"),
184 psS8S1.
getParameter<std::vector<double> >(
"shortEnergyParams"),
185 psS8S1.
getParameter<std::vector<double> >(
"shortETParams"),
186 psS8S1.
getParameter<std::vector<double> >(
"long_optimumSlope"),
187 psS8S1.
getParameter<std::vector<double> >(
"longEnergyParams"),
188 psS8S1.
getParameter<std::vector<double> >(
"longETParams"),
195 psPET.
getParameter<std::vector<double> >(
"shortEnergyParams"),
196 psPET.
getParameter<std::vector<double> >(
"shortETParams"),
198 psPET.
getParameter<std::vector<double> >(
"longEnergyParams"),
199 psPET.
getParameter<std::vector<double> >(
"longETParams"),
205 produces<HFRecHitCollection>();
206 }
else if (!strcasecmp(subd.c_str(),
"ZDC")) {
209 produces<ZDCRecHitCollection>();
210 }
else if (!strcasecmp(subd.c_str(),
"CALIB")) {
213 produces<HcalCalibRecHitCollection>();
215 std::cout <<
"HcalHitReconstructor is not associated with a specific subdetector!" << std::endl;
322 if (!corrName.empty())
344 rec->reserve(digi->size());
348 std::vector<HBHEDataFrame> HBDigis;
349 std::vector<int> RecHitIndex;
352 int favorite_capid = 0;
354 long capid_votes[4] = {0,0,0,0};
355 for (i=digi->begin(); i!=digi->end(); i++) {
356 capid_votes[(*i)[0].capid()]++;
358 for (
int k = 0;
k < 4;
k++)
359 if (capid_votes[
k] > capid_votes[favorite_capid])
363 for (i=digi->begin(); i!=digi->end(); i++) {
418 if (i->zsMarkAndPass())
continue;
421 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
422 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
428 unsigned int auxflag=0;
431 for (
int xx=fTS; xx<fTS+4 && xx<i->size();++xx) {
432 int adcv = i->sample(xx).adc();
433 auxflag+=((adcv&0x7F)<<(7*(xx-fTS)));
436 auxflag+=((i->sample(fTS).capid())<<28);
437 (rec->back()).setAux(auxflag);
442 for (
int xx = fTS2; xx < fTS2+4 && xx<i->size(); ++xx) {
443 int adcv = i->sample(xx).adc();
444 auxflag+=((adcv&0x7F)<<(7*(xx-fTS2)));
446 auxflag+=((i->sample(fTS2).capid())<<28);
447 (rec->back()).setAuxHBHE(auxflag);
449 (rec->back()).setFlags(0);
467 for(
int j=0;
j!=i->size(); DigiEnergy += i->sample(
j++).nominal_fC());
470 HBDigis.push_back(*i);
471 RecHitIndex.push_back(rec->size()-1);
490 rec->reserve(digi->size());
495 int favorite_capid = 0;
497 long capid_votes[4] = {0,0,0,0};
498 for (i=digi->begin(); i!=digi->end(); i++) {
499 capid_votes[(*i)[0].capid()]++;
501 for (
int k = 0;
k < 4;
k++)
502 if (capid_votes[
k] > capid_votes[favorite_capid])
506 for (i=digi->begin(); i!=digi->end(); i++) {
535 if (i->zsMarkAndPass())
continue;
538 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
539 const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
548 for (
int xx=fTS; xx<fTS+4 && xx<i->size();++xx)
549 auxflag+=(i->sample(xx).adc())<<(7*(xx-fTS));
551 auxflag+=((i->sample(fTS).capid())<<28);
552 (rec->back()).setAux(auxflag);
554 (rec->back()).setFlags(0);
576 rec->reserve(digi->size());
581 int favorite_capid = 0;
583 long capid_votes[4] = {0,0,0,0};
584 for (i=digi->begin(); i!=digi->end(); i++) {
585 capid_votes[(*i)[0].capid()]++;
587 for (
int k = 0;
k < 4;
k++)
588 if (capid_votes[
k] > capid_votes[favorite_capid])
592 for (i=digi->begin(); i!=digi->end(); i++) {
621 if (i->zsMarkAndPass())
continue;
624 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
625 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);
654 (rec->back()).setFlags(0);
681 int depth=i->id().depth();
682 int ieta=i->id().ieta();
684 if (depth==2 ||
abs(ieta)==29 )
691 int depth=i->id().depth();
692 int ieta=i->id().ieta();
694 if (depth==2 ||
abs(ieta)==29 )
701 int depth=i->id().depth();
702 int ieta=i->id().ieta();
704 if (depth==1 &&
abs(ieta)!=29 )
717 rec->reserve(digi->size());
723 for (i=digi->begin(); i!=digi->end(); i++) {
731 if (i->zsMarkAndPass())
continue;
734 const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
735 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)
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.
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