35 if(prefixME_.substr(prefixME_.size()-1,prefixME_.size())!=
"/")
36 prefixME_.append(
"/");
84 std::cout <<
"HcalNoiseMonitor::beginRun"<< std::endl;
103 std::cout <<
"<HcalNoiseMonitor::setup> Creating histograms" << std::endl;
129 50, -5, 5, 25, 0, 500);
134 50, -15, 5, 25, 0, 500);
139 "Triangle fit left distance vs. TS4", 50, 0, 10, 25, 0, 500);
144 "Triangle fit right distance vs. peak time slice", 50, 0, 10, 25, 0, 500);
161 "(TS4-TS5)/(TS4+TS5), total charge > 20 fC", 100, -1, 1);
165 "(TS4-TS5)/(TS4+TS5) vs. Charge", 25, 0, 400, 75, -1, 1);
226 std::cout <<
"HcalNoiseMonitor::processEvent DQMStore not instantiated!!!"<< std::endl;
234 const HcalCalibrations &Calibrations = hConditions->getHcalCalibrations(
id);
235 const HcalQIECoder *ChannelCoder = hConditions->getHcalCoder(
id);
239 Coder.
adc2fC(*iter, Tool);
245 double Charge[10] = {0};
246 for(
int i = 0;
i < iter->size();
i++)
247 Charge[
i] = Tool[
i] - Calibrations.
pedestal(iter->sample(
i).capid());
249 double TotalCharge = 0;
250 for(
int i = 0;
i < 10;
i++)
251 TotalCharge = TotalCharge + Charge[
i];
255 double NominalChi2 = 10000000;
262 double TS4LeftSlope = 100000;
263 double TS4RightSlope = 100000;
266 TS4LeftSlope = Charge[4] / fabs(TriangleResult.
LeftSlope);
268 TS4RightSlope = Charge[4] / fabs(TriangleResult.
RightSlope);
270 if(TS4LeftSlope < -1000 || TS4LeftSlope > 1000)
272 if(TS4RightSlope < -1000 || TS4RightSlope > 1000)
273 TS4RightSlope = 1000;
287 if(Charge[4] + Charge[5] > 1
e-5)
299 int ieta =
id.
ieta();
300 int iphi =
id.iphi();
301 int depth =
id.depth();
317 for(reco::HcalNoiseRBXCollection::const_iterator rbx = hRBXCollection->begin();
318 rbx != hRBXCollection->end(); rbx++)
327 std::vector<reco::HcalNoiseHPD> HPDs = RBX.
HPDs();
335 for(std::vector<reco::HcalNoiseHPD>::const_iterator hpd = HPDs.begin(); hpd != HPDs.end(); hpd++)
345 if(NumberRBXHits == 0 || RBXEnergy <= 10)
353 double HighestHPDEnergy = 0;
354 int HighestHPDHits = 0;
356 for(std::vector<reco::HcalNoiseHPD>::const_iterator hpd = HPDs.begin(); hpd != HPDs.end(); hpd++)
377 int NoiseCategory = 0;
378 bool IsRBXNoise =
false;
383 if(RBXEnergy > 1
e-5 && HighestHPDEnergy / RBXEnergy > 0.98)
387 if(HighestHPDHits >= 9)
405 if(RBXE2 / RBXE10 < 0.33)
407 else if(RBXE2 / RBXE10 < 0.8)
409 else if(RBXE2 / RBXE10 > 0.8 && NumberRBXHits > 10)
411 else if(RBXE2 / RBXE10 > 0.8 && NumberRBXHits < 10)
418 if(IsRBXNoise ==
true && RBXE10 > 1
e-5)
436 double MinimumChi2 = 100000;
453 for(
int j = 0;
j < DigiSize;
j++)
458 double Error2 = Charge[
j];
463 SumF2 += F * F / Error2;
464 SumTF += F * Charge[
j] / Error2;
465 SumT2 += Charge[
j] * Charge[
j] / Error2;
478 double Chi2 = SumT2 - SumTF * SumTF / SumF2;
480 if(Chi2 < MinimumChi2)
485 if(MinimumChi2 < 1
e-5)
501 double OverallMinimumChi2 = 1000000;
503 int AvailableDistance[] = {-100, -75, -50, 50, 75, 100};
506 for(
int k = 0;
k < 6;
k++)
508 double SingleMinimumChi2 = 1000000;
516 if(Chi2 < SingleMinimumChi2)
518 SingleMinimumChi2 = Chi2;
527 if(Chi2 < SingleMinimumChi2)
528 SingleMinimumChi2 = Chi2;
532 if(SingleMinimumChi2 < OverallMinimumChi2)
533 OverallMinimumChi2 = SingleMinimumChi2;
536 return OverallMinimumChi2;
558 static std::vector<double> F1;
559 static std::vector<double> F2;
572 for(
int j = 0;
j < DigiSize;
j++)
580 int OffsetTemp = Offset +
j * 25 + Distance;
585 if(OffsetTemp + 25 < (
int)CumulativeIdealPulse.size() && OffsetTemp + 25 >= 0)
586 C1 = CumulativeIdealPulse[OffsetTemp+25];
587 if(OffsetTemp + 25 >= (
int)CumulativeIdealPulse.size())
588 C1 = CumulativeIdealPulse[CumulativeIdealPulse.size()-1];
589 if(OffsetTemp < (
int)CumulativeIdealPulse.size() && OffsetTemp >= 0)
590 C2 = CumulativeIdealPulse[OffsetTemp];
591 if(OffsetTemp >= (
int)CumulativeIdealPulse.size())
592 C2 = CumulativeIdealPulse[CumulativeIdealPulse.size()-1];
599 SumF1F1 += F1[
j] * F1[
j] / Error;
600 SumF1F2 += F1[
j] * F2[
j] / Error;
601 SumF2F2 += F2[
j] * F2[
j] / Error;
602 SumTF1 += F1[
j] * Charge[
j] / Error;
603 SumTF2 += F2[
j] * Charge[
j] / Error;
606 double Height = (SumF1F2 * SumTF2 - SumF2F2 * SumTF1) / (SumF1F2 * SumF1F2 - SumF1F1 * SumF2F2);
607 double Height2 = (SumF1F2 * SumTF1 - SumF1F1 * SumTF2) / (SumF1F2 * SumF1F2 - SumF1F1 * SumF2F2);
610 for(
int j = 0;
j < DigiSize;
j++)
612 double Error = Charge[
j];
616 double Residual = Height * F1[
j] + Height2 * F2[
j] - Charge[
j];
617 Chi2 += Residual * Residual / Error;
639 double SumTS2OverTi = 0;
640 double SumTSOverTi = 0;
641 double SumOverTi = 0;
646 for(
int i = 0;
i < DigiSize;
i++)
652 SumTS2OverTi += 1.*
i *
i / Error2;
653 SumTSOverTi += 1.*
i / Error2;
654 SumOverTi += 1. / Error2;
655 SumTiTS += Charge[
i] *
i / Error2;
656 SumTi += Charge[
i] / Error2;
659 double CM1 = SumTS2OverTi;
660 double CM2 = SumTSOverTi;
661 double CD1 = SumTSOverTi;
662 double CD2 = SumOverTi;
666 double Slope = (C1 * CD2 - C2 * CD1) / (CM1 * CD2 - CM2 * CD1);
667 double Intercept = (C1 * CM2 - C2 * CM1) / (CD1 * CM2 - CD2 * CM1);
671 for(
int i = 0;
i < DigiSize;
i++)
673 double Deviation = Slope *
i + Intercept - Charge[
i];
674 double Error2 = Charge[
i];
677 Chi2 += Deviation * Deviation / Error2;
701 std::vector<double> TempCharge(Charge, Charge + 10);
704 sort(TempCharge.begin(), TempCharge.end());
708 for(
int i = 0;
i < DigiSize - 2;
i++)
710 Total = Total + TempCharge[
i];
711 Total2 = Total2 + TempCharge[
i] * TempCharge[
i];
720 double RMS =
sqrt(Total2 - Total * Total / (DigiSize - 2));
722 double RMS8Max = 99999;
723 if(TempCharge[DigiSize-1] > 1
e-5)
724 RMS8Max = RMS / TempCharge[DigiSize-1];
747 double MinimumRightChi2 = 1000000;
748 double Numerator = 0;
749 double Denominator = 0;
763 double BestSlope = Numerator / Denominator;
790 for(
int i = iTS;
i < DigiSize;
i++)
791 Chi2 += Charge[
i] * Charge[
i];
793 if(Chi2 < MinimumRightChi2)
795 MinimumRightChi2 = Chi2;
801 double MinimumLeftChi2 = 1000000;
814 double BestSlope = Numerator / Denominator;
834 for(
int i = 0;
i < iTS;
i++)
835 Chi2 += Charge[
i] * Charge[
i];
840 if(MinimumLeftChi2 > Chi2)
842 MinimumLeftChi2 = Chi2;
847 result.
Chi2 = MinimumLeftChi2 + MinimumRightChi2;
854 std::vector<double> PulseShape;
859 PulseShape.reserve(350);
860 for(
int i = 0;
i < 200;
i++)
861 PulseShape.push_back(HPDShape.
at(
i));
862 PulseShape.insert(PulseShape.begin(), 150, 0);
867 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