35 if(prefixME_.substr(prefixME_.size()-1,prefixME_.size())!=
"/")
36 prefixME_.append(
"/");
85 std::cout <<
"HcalNoiseMonitor::beginRun"<< std::endl;
107 std::cout <<
"<HcalNoiseMonitor::setup> Creating histograms" << std::endl;
133 50, -5, 5, 25, 0, 500);
138 50, -15, 5, 25, 0, 500);
143 "Triangle fit left distance vs. TS4", 50, 0, 10, 25, 0, 500);
148 "Triangle fit right distance vs. peak time slice", 50, 0, 10, 25, 0, 500);
165 "(TS4-TS5)/(TS4+TS5), total charge > 20 fC", 100, -1, 1);
169 "(TS4-TS5)/(TS4+TS5) vs. Charge", 25, 0, 400, 75, -1, 1);
230 std::cout <<
"HcalNoiseMonitor::processEvent DQMStore not instantiated!!!"<< std::endl;
238 const HcalCalibrations &Calibrations = hConditions->getHcalCalibrations(
id);
239 const HcalQIECoder *ChannelCoder = hConditions->getHcalCoder(
id);
243 Coder.
adc2fC(*iter, Tool);
249 double Charge[10] = {0};
250 for(
int i = 0;
i < iter->size();
i++)
251 Charge[
i] = Tool[
i] - Calibrations.
pedestal(iter->sample(
i).capid());
253 double TotalCharge = 0;
254 for(
int i = 0;
i < 10;
i++)
255 TotalCharge = TotalCharge + Charge[
i];
259 double NominalChi2 = 10000000;
266 double TS4LeftSlope = 100000;
267 double TS4RightSlope = 100000;
270 TS4LeftSlope = Charge[4] / fabs(TriangleResult.
LeftSlope);
272 TS4RightSlope = Charge[4] / fabs(TriangleResult.
RightSlope);
274 if(TS4LeftSlope < -1000 || TS4LeftSlope > 1000)
276 if(TS4RightSlope < -1000 || TS4RightSlope > 1000)
277 TS4RightSlope = 1000;
291 if(Charge[4] + Charge[5] > 1
e-5)
303 int ieta =
id.
ieta();
304 int iphi =
id.iphi();
305 int depth =
id.depth();
321 for(reco::HcalNoiseRBXCollection::const_iterator rbx = hRBXCollection->begin();
322 rbx != hRBXCollection->end(); rbx++)
331 std::vector<reco::HcalNoiseHPD> HPDs = RBX.
HPDs();
339 for(std::vector<reco::HcalNoiseHPD>::const_iterator hpd = HPDs.begin(); hpd != HPDs.end(); hpd++)
349 if(NumberRBXHits == 0 || RBXEnergy <= 10)
357 double HighestHPDEnergy = 0;
358 int HighestHPDHits = 0;
360 for(std::vector<reco::HcalNoiseHPD>::const_iterator hpd = HPDs.begin(); hpd != HPDs.end(); hpd++)
381 int NoiseCategory = 0;
382 bool IsRBXNoise =
false;
387 if(RBXEnergy > 1
e-5 && HighestHPDEnergy / RBXEnergy > 0.98)
391 if(HighestHPDHits >= 9)
409 if(RBXE2 / RBXE10 < 0.33)
411 else if(RBXE2 / RBXE10 < 0.8)
413 else if(RBXE2 / RBXE10 > 0.8 && NumberRBXHits > 10)
415 else if(RBXE2 / RBXE10 > 0.8 && NumberRBXHits < 10)
422 if(IsRBXNoise ==
true && RBXE10 > 1
e-5)
440 double MinimumChi2 = 100000;
457 for(
int j = 0;
j < DigiSize;
j++)
462 double Error2 = Charge[
j];
467 SumF2 += F * F / Error2;
468 SumTF += F * Charge[
j] / Error2;
469 SumT2 += Charge[
j] * Charge[
j] / Error2;
482 double Chi2 = SumT2 - SumTF * SumTF / SumF2;
484 if(Chi2 < MinimumChi2)
489 if(MinimumChi2 < 1
e-5)
505 double OverallMinimumChi2 = 1000000;
507 int AvailableDistance[] = {-100, -75, -50, 50, 75, 100};
510 for(
int k = 0;
k < 6;
k++)
512 double SingleMinimumChi2 = 1000000;
520 if(Chi2 < SingleMinimumChi2)
522 SingleMinimumChi2 = Chi2;
531 if(Chi2 < SingleMinimumChi2)
532 SingleMinimumChi2 = Chi2;
536 if(SingleMinimumChi2 < OverallMinimumChi2)
537 OverallMinimumChi2 = SingleMinimumChi2;
540 return OverallMinimumChi2;
562 static std::vector<double> F1;
563 static std::vector<double> F2;
576 for(
int j = 0;
j < DigiSize;
j++)
584 int OffsetTemp = Offset +
j * 25 + Distance;
589 if(OffsetTemp + 25 < (
int)CumulativeIdealPulse.size() && OffsetTemp + 25 >= 0)
590 C1 = CumulativeIdealPulse[OffsetTemp+25];
591 if(OffsetTemp + 25 >= (
int)CumulativeIdealPulse.size())
592 C1 = CumulativeIdealPulse[CumulativeIdealPulse.size()-1];
593 if(OffsetTemp < (
int)CumulativeIdealPulse.size() && OffsetTemp >= 0)
594 C2 = CumulativeIdealPulse[OffsetTemp];
595 if(OffsetTemp >= (
int)CumulativeIdealPulse.size())
596 C2 = CumulativeIdealPulse[CumulativeIdealPulse.size()-1];
603 SumF1F1 += F1[
j] * F1[
j] / Error;
604 SumF1F2 += F1[
j] * F2[
j] / Error;
605 SumF2F2 += F2[
j] * F2[
j] / Error;
606 SumTF1 += F1[
j] * Charge[
j] / Error;
607 SumTF2 += F2[
j] * Charge[
j] / Error;
610 double Height = (SumF1F2 * SumTF2 - SumF2F2 * SumTF1) / (SumF1F2 * SumF1F2 - SumF1F1 * SumF2F2);
611 double Height2 = (SumF1F2 * SumTF1 - SumF1F1 * SumTF2) / (SumF1F2 * SumF1F2 - SumF1F1 * SumF2F2);
614 for(
int j = 0;
j < DigiSize;
j++)
616 double Error = Charge[
j];
620 double Residual = Height * F1[
j] + Height2 * F2[
j] - Charge[
j];
621 Chi2 += Residual * Residual / Error;
643 double SumTS2OverTi = 0;
644 double SumTSOverTi = 0;
645 double SumOverTi = 0;
650 for(
int i = 0;
i < DigiSize;
i++)
656 SumTS2OverTi += 1.*
i *
i / Error2;
657 SumTSOverTi += 1.*
i / Error2;
658 SumOverTi += 1. / Error2;
659 SumTiTS += Charge[
i] *
i / Error2;
660 SumTi += Charge[
i] / Error2;
663 double CM1 = SumTS2OverTi;
664 double CM2 = SumTSOverTi;
665 double CD1 = SumTSOverTi;
666 double CD2 = SumOverTi;
670 double Slope = (C1 * CD2 - C2 * CD1) / (CM1 * CD2 - CM2 * CD1);
671 double Intercept = (C1 * CM2 - C2 * CM1) / (CD1 * CM2 - CD2 * CM1);
675 for(
int i = 0;
i < DigiSize;
i++)
677 double Deviation = Slope *
i + Intercept - Charge[
i];
678 double Error2 = Charge[
i];
681 Chi2 += Deviation * Deviation / Error2;
705 std::vector<double> TempCharge(Charge, Charge + 10);
708 sort(TempCharge.begin(), TempCharge.end());
712 for(
int i = 0;
i < DigiSize - 2;
i++)
714 Total = Total + TempCharge[
i];
715 Total2 = Total2 + TempCharge[
i] * TempCharge[
i];
724 double RMS =
sqrt(Total2 - Total * Total / (DigiSize - 2));
726 double RMS8Max = 99999;
727 if(TempCharge[DigiSize-1] > 1
e-5)
728 RMS8Max = RMS / TempCharge[DigiSize-1];
751 double MinimumRightChi2 = 1000000;
752 double Numerator = 0;
753 double Denominator = 0;
767 double BestSlope = Numerator / Denominator;
794 for(
int i = iTS;
i < DigiSize;
i++)
795 Chi2 += Charge[
i] * Charge[
i];
797 if(Chi2 < MinimumRightChi2)
799 MinimumRightChi2 = Chi2;
805 double MinimumLeftChi2 = 1000000;
818 double BestSlope = Numerator / Denominator;
838 for(
int i = 0;
i < iTS;
i++)
839 Chi2 += Charge[
i] * Charge[
i];
844 if(MinimumLeftChi2 > Chi2)
846 MinimumLeftChi2 = Chi2;
851 result.
Chi2 = MinimumLeftChi2 + MinimumRightChi2;
858 std::vector<double> PulseShape;
863 PulseShape.reserve(350);
864 for(
int i = 0;
i < 200;
i++)
865 PulseShape.push_back(HPDShape.
at(
i));
866 PulseShape.insert(PulseShape.begin(), 150, 0);
871 for(
unsigned int i = 1;
i < PulseShape.size();
i++)
int mMaxHPDNoOtherHitCount
MonitorElement * hBadCountHPD
MonitorElement * hE2OverE10Digi
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * hBadNoOtherCountHPD
MonitorElement * hTS4TS5RelativeDifferenceVsCharge
double PerformNominalFit(double Charge[10])
MonitorElement * hE2OverE10RBX
edm::InputTag noiseLabel_
float allChargeHighest2TS(unsigned int firstts=4) const
MonitorElement * hMaxZeros
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
float at(double time) const
#define DEFINE_FWK_MODULE(type)
std::vector< int > AllowedCalibTypes_
TriangleFitResult PerformTriangleFit(double Charge[10])
MonitorElement * hLambdaRMS8MaxVsTotalCharge
std::vector< T >::const_iterator const_iterator
double CalculateRMS8Max(double Charge[10])
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
int numRecHits(double threshold=1.5) const
MonitorElement * hHcalNoiseCategory
double pedestal(int fCapId) const
get pedestal for capid=0..3
double mTotalZeroMinEnergy
MonitorElement * hNominalChi2
EtaPhiHists hFailRMSMaxEtaPhi
MonitorElement * hTotalZeros
edm::InputTag hbheDigiLabel_
MonitorElement * hLinearChi2
MonitorElement * hLinearTestStatistics
edm::InputTag hltresultsLabel_
std::vector< MonitorElement * > depth
MonitorElement * hBadE2E10RBX
virtual void beginRun(const edm::Run &run, const edm::EventSetup &c)
void removeContents(void)
erase all monitoring elements in current directory (not including subfolders);
double recHitEnergy(double theshold=1.5) const
float allChargeTotal(void) const
EtaPhiHists hFailTriangleEtaPhi
float big5ChargeHighest2TS(unsigned int firstts=4) const
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const
int numRecHits(float threshold=1.5) const
MonitorElement * hBadZeroRBX
void beginRun(const edm::Run &run, const edm::EventSetup &c)
MonitorElement * hTriangleRightSlopeVsTS4
float bigChargeHighest2TS(unsigned int firstts=4) const
int ieta() const
get the cell ieta
MonitorElement * hRMS8OverMaxTestStatistics
MonitorElement * hTS4TS5RelativeDifference
double PerformDualNominalFit(double Charge[10])
float big5ChargeTotal(void) const
double DualNominalFitSingleTry(double Charge[10], int Offset, int Distance)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
MonitorElement * hRBXHitCount
MonitorElement * hE2OverE10Digi5
int totalZeros(void) const
MonitorElement * hRMS8OverMax
MonitorElement * hTriangleLeftSlopeVsTS4
const std::vector< HcalNoiseHPD > HPDs(void) const
void SetupEtaPhiHists(EtaPhiHists &hh, std::string Name, std::string Units)
std::vector< double > CumulativeIdealPulse
const Shape & hbShape() const
float recHitEnergy(float threshold=1.5) const
void analyze(edm::Event const &e, edm::EventSetup const &s)
MonitorElement * hHPDHitCount
EtaPhiHists hFailIsolationEtaPhi
std::vector< std::string > triggers_
edm::InputTag hbheRechitLabel_
edm::InputTag rawdataLabel_
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
HcalNoiseMonitor(const edm::ParameterSet &ps)
MonitorElement * hLambdaLinearVsTotalCharge
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
float bigChargeTotal(void) const
void setCurrentFolder(const std::string &fullpath)
double PerformLinearFit(double Charge[10])
EtaPhiHists hFailLinearEtaPhi