20 absolute_occupancy_(0),
21 OutFileName_(
"Occupancy.root"),
22 DQMOutfileName_(
"DQMOutput"),
23 UseInputDB_(iConfig.getUntrackedParameter<
bool>(
"UseInputDB",
false)),
29 LogTrace(
"SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy")
30 <<
"[SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::~" 31 "SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy] " 37 LogTrace(
"SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy")
38 <<
"[SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::extractBadAPVs] " << std::endl;
44 apvtree =
new TTree(
"moduleOccupancy",
"tree");
65 striptree =
new TTree(
"stripOccupancy",
"tree");
93 HistoMap::iterator it = DM.begin();
94 HistoMap::iterator itEnd = DM.end();
95 std::vector<unsigned int> badStripList;
97 for (; it != itEnd; ++it) {
100 for (
int apv = 0; apv < 6; apv++) {
101 APV.apvMedian[apv] = 0;
102 APV.apvabsoluteOccupancy[apv] = 0;
103 APV.NEntries[apv] = 0;
104 APV.NEmptyBins[apv] = 0;
117 APV.th1f[apv] =
new TH1F(
"tmp",
"tmp", 128, 0.5, 128.5);
118 int NumberEntriesPerAPV = 0;
122 (it->second.get())->GetBinContent((apv * 128) +
strip + 1);
124 APV.apvabsoluteOccupancy[apv] +=
125 (it->second.get())->GetBinContent((apv * 128) +
strip + 1);
126 APV.th1f[apv]->SetBinContent(
strip + 1, (it->second.get())->GetBinContent((apv * 128) +
strip + 1));
127 NumberEntriesPerAPV += (
int)(it->second.get())->GetBinContent((apv * 128) +
strip + 1);
130 APV.th1f[apv]->SetEntries(NumberEntriesPerAPV);
131 APV.NEntries[apv] = (
int)
APV.th1f[apv]->GetEntries();
142 LogTrace(
"SiStripBadAPV") <<
"Analyzing detid " << detid << std::endl;
262 std::cout <<
"### Detector does not belong to TIB, TID, TOB or TEC !? ###" << std::endl;
309 badStripList.
clear();
424 LogTrace(
"SiStripBadAPV") <<
ss.str() << std::endl;
428 std::pair<double, double>* MeanRMS,
429 int number_iterations) {
430 Double_t
tot[7], tot2[7];
433 Double_t
Mean[7] = {0};
434 Double_t Rms[7] = {1000, 1000, 1000, 1000, 1000, 1000, 1000};
438 for (
int i = 0;
i < number_iterations;
i++) {
439 for (
int j = 0;
j < 7;
j++) {
445 for (uint32_t it = 0; it <
a.size(); it++) {
446 Moduleposition = (
a[it].modulePosition) - 1;
448 for (
int apv = 0; apv <
a[it].numberApvs; apv++) {
450 if (
a[it].apvMedian[apv] < (
Mean[Moduleposition] - 3 * Rms[Moduleposition]) ||
451 (
a[it].apvMedian[apv] > (
Mean[Moduleposition] + 5 * Rms[Moduleposition]))) {
455 tot[Moduleposition] +=
a[it].apvMedian[apv];
456 tot2[Moduleposition] += (
a[it].apvMedian[apv]) * (
a[it].apvMedian[apv]);
461 for (
int j = 0;
j < 7;
j++) {
464 Rms[
j] = TMath::Sqrt(TMath::Abs(tot2[
j] /
n[
j] -
Mean[
j] *
Mean[
j]));
469 for (
int j = 0;
j < 7;
j++) {
470 MeanRMS[
j] = std::make_pair(
Mean[
j], Rms[
j]);
475 std::vector<Apv>& medianValues,
476 std::pair<double, double>* MeanAndRms,
477 std::vector<unsigned int>& BadStripList,
482 for (uint32_t it = 0; it < medianValues.size(); it++) {
483 Moduleposition = (medianValues[it].modulePosition) - 1;
484 Detid = medianValues[it].detrawId;
496 for (
int apv = 0; apv < medianValues[it].numberApvs; apv++) {
497 double logMedianOccupancy = -1;
498 double logAbsoluteOccupancy = -1;
500 for (
int i = 0;
i < 128;
i++) {
527 unsigned int layer = 0;
547 if (InSiStripQuality->
IsApvBad(Detid, apv)) {
589 std::cout <<
"ERROR! distance is never computed!!!\n";
600 if (medianValues[it].apvMedian[apv] >
minNevents_) {
601 if ((medianValues[it].apvMedian[apv] >
607 }
else if (medianValues[it].apvMedian[apv] <
609 (MeanAndRms[Moduleposition].first > 2 || medianValues[it].apvabsoluteOccupancy[apv] == 0)) {
658 std::cout <<
"ERROR! distance is never computed!!!\n";
667 if (BadStripList.begin() != BadStripList.end()) {
668 quality->compact(Detid, BadStripList);
672 BadStripList.clear();
677 std::vector<unsigned int>& vect,
682 size_t startingSize = vect.size();
686 size_t ibinStart = 1;
687 size_t ibinStop =
Nbins + 1;
688 int MaxEntry = (
int)
histo.th1f[apv]->GetMaximum();
690 std::vector<long double> vPoissonProbs(MaxEntry + 1, 0);
691 long double meanVal = 1. *
histo.NEntries[apv] / (1. *
Nbins -
histo.NEmptyBins[apv]);
695 unsigned int goodstripentries[128];
697 for (
size_t i = ibinStart;
i < ibinStop; ++
i) {
698 if (
ishot[(apv * 128) +
i - 1] == 0) {
699 goodstripentries[nGoodStrips] = (
unsigned int)
histo.th1f[apv]->GetBinContent(
i);
703 double median = TMath::Median(nGoodStrips, goodstripentries);
705 for (
size_t i = ibinStart;
i < ibinStop; ++
i) {
706 unsigned int entries = (
unsigned int)
histo.th1f[apv]->GetBinContent(
i);
719 if (
diff < vPoissonProbs[entries]) {
723 histo.th1f[apv]->SetBinContent(
i, 0.);
724 histo.NEntries[apv] -= entries;
725 histo.NEmptyBins[apv]++;
727 LogTrace(
"SiStripHotStrip") <<
" rejecting strip " << (apv * 128) +
i - 1 <<
" value " << entries <<
" diff " 728 <<
diff <<
" prob " << vPoissonProbs[entries] << std::endl;
733 LogTrace(
"SiStripHotStrip") <<
" [SiStripHotStripAlgorithmFromClusterOccupancy::iterativeSearch] Nbins=" <<
Nbins 734 <<
" MaxEntry=" << MaxEntry <<
" meanVal=" << meanVal
735 <<
" NEmptyBins=" <<
histo.NEmptyBins[apv] <<
" NEntries=" <<
histo.NEntries[apv]
736 <<
" thEntries " <<
histo.th1f[apv]->GetEntries() <<
" startingSize " << startingSize
737 <<
" vector.size " << vect.size() << std::endl;
739 if (vect.size() != startingSize)
744 long double& meanVal) {
745 for (
size_t i = 0;
i < vPoissonProbs.size(); ++
i) {
746 vPoissonProbs[
i] = (
i == 0) ? TMath::Poisson(
i, meanVal) : vPoissonProbs[
i - 1] + TMath::Poisson(
i, meanVal);
827 std::cout <<
"### Detector does not belong to TIB, TID, TOB or TEC !? ###" << std::endl;
828 std::cout <<
"### DetRawId: " << detid <<
" ###" << std::endl;
865 histoTitle =
"Distance between hot strips vs. strip number";
879 histoTitle =
"Number of hot strips vs. strip number";
888 histoTitle =
"Distribution of distance between hot strips";
898 histoTitle =
"Occupancy of strips vs. strip number";
912 histoTitle =
"Distribution of strip occupancy";
922 histoTitle =
"Occupancy of hot strips vs. strip number";
936 histoTitle =
"Distribution of hot strip occupancy";
946 histoTitle =
"Occupancy of good strips vs. strip number";
960 histoTitle =
"Distribution of good strip occupancy";
970 histoTitle =
"Poisson probability of strips vs. strip number";
984 histoTitle =
"Distribution of strip Poisson probability";
994 histoTitle =
"Poisson probability of hot strips vs. strip number";
1001 tmp_prof =
new TProfile(
histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
1008 histoTitle =
"Distribution of hot strip Poisson probability";
1018 histoTitle =
"Poisson probability of good strips vs. strip number";
1025 tmp_prof =
new TProfile(
histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
1032 histoTitle =
"Distribution of good strip Poisson probability";
1042 histoTitle =
"NHits in strips vs. strip number";
1049 tmp_prof =
new TProfile(
histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
1054 histoTitle =
"Cumulative nHits in strips vs. strip number";
1061 histoTitle =
"Distribution of nHits for all strips";
1071 histoTitle =
"NHits in hot strips vs. strip number";
1078 tmp_prof =
new TProfile(
histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
1083 histoTitle =
"Cumulative nHits in hot strips vs. strip number";
1090 histoTitle =
"Distribution of nHits for hot strips";
1100 histoTitle =
"NHits in good strips vs. strip number";
1107 tmp_prof =
new TProfile(
histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
1112 histoTitle =
"Cumulative nHits in good strips vs. strip number";
1119 histoTitle =
"Distribution of nHits for good strips";
1134 histoTitle =
"Median APV occupancy vs. absolute APV occupancy";
1152 histoTitle =
"Median APV occupancy";
1169 histoTitle =
"Absolute APV occupancy";
1184 double logStripOccupancy = -1;
1185 double logPoissonProb = -1;
std::vector< TH1F * > projXNHitsGoodStripsVsStripNumber
std::pair< double, double > MeanAndRms_TIB_Layer1[7]
unsigned int tecPetalNumber(const DetId &id) const
static constexpr auto TEC
std::vector< Apv > medianValues_TECMinus_Disc3
std::vector< Apv > medianValues_TECMinus_Disc4
std::pair< double, double > MeanAndRms_TECPlus_Disc6[7]
void setBasicTreeParameters(int detid)
unsigned int tobLayer(const DetId &id) const
std::pair< double, double > MeanAndRms_TECPlus_Disc1[7]
std::pair< double, double > MeanAndRms_TIDPlus_Disc1[7]
std::vector< TProfile * > pfxPoissonProbGoodStripsVsStripNumber
float strip_global_position_z
std::vector< std::string > subDetName
virtual TProfile * getTProfile() const
std::vector< Apv > medianValues_TECPlus_Disc8
bool IsApvBad(uint32_t detid, short apvNb) const
std::pair< double, double > MeanAndRms_TIB_Layer2[7]
unsigned short MinNumEntries_
std::vector< Apv > medianValues_TECPlus_Disc7
bool tobIsZMinusSide(const DetId &id) const
std::pair< double, double > MeanAndRms_TECMinus_Disc3[7]
std::pair< double, double > MeanAndRms_TECMinus_Disc9[7]
unsigned int tibModule(const DetId &id) const
std::vector< Apv > medianValues_TIDMinus_Disc2
std::vector< TH2F * > distanceVsStripNumber
std::pair< double, double > MeanAndRms_TECMinus_Disc4[7]
std::pair< double, double > MeanAndRms_TOB_Layer1[7]
const TrackerGeometry * TkGeom
bool tibIsExternalString(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
bool tibIsZMinusSide(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
void setCurrentFolder(std::string const &fullpath) override
bool tidIsBackRing(const DetId &id) const
std::vector< TH1F * > projXNHitsHotStripsVsStripNumber
std::vector< Apv > medianValues_TOB_Layer2
std::vector< TProfile * > pfxNHitsHotStripsVsStripNumber
std::vector< Apv > medianValues_TECPlus_Disc6
void extractBadAPVSandStrips(SiStripQuality *, HistoMap &, const SiStripQuality *)
std::pair< double, double > MeanAndRms_TECMinus_Disc5[7]
unsigned int tibString(const DetId &id) const
std::pair< double, double > MeanAndRms_TOB_Layer3[7]
std::vector< Apv > medianValues_TOB_Layer5
std::vector< TProfile * > pfxNHitsGoodStripsVsStripNumber
std::vector< Apv > medianValues_TECPlus_Disc1
std::pair< double, double > MeanAndRms_TIDPlus_Disc2[7]
bool tecIsZMinusSide(const DetId &id) const
std::pair< double, double > MeanAndRms_TOB_Layer6[7]
std::pair< double, double > MeanAndRms_TOB_Layer2[7]
std::vector< Apv > medianValues_TECPlus_Disc2
std::vector< TProfile * > pfxDistanceVsStripNumber
void CalculateMeanAndRMS(const std::vector< Apv > &, std::pair< double, double > *, int)
void initializeDQMHistograms()
unsigned int tecRing(const DetId &id) const
ring id
std::vector< TH1F * > projXNHitsVsStripNumber
std::pair< double, double > MeanAndRms_TECMinus_Disc6[7]
std::vector< Apv > medianValues_TIB_Layer2
std::vector< Apv > medianValues_TOB_Layer6
std::vector< TH2F * > poissonProbGoodStripsVsStripNumber
bool tibIsStereo(const DetId &id) const
std::pair< double, double > MeanAndRms_TECMinus_Disc1[7]
std::vector< unsigned int > nLayers
std::vector< Apv > medianValues_TECMinus_Disc1
long double absolute_occupancy_
bool tidIsZMinusSide(const DetId &id) const
double singleStripOccupancy
std::vector< TH1F * > projYOccupancyHotStripsVsStripNumber
std::vector< Apv > medianValues_TECMinus_Disc5
bool tobIsStereo(const DetId &id) const
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
U second(std::pair< T, U > const &p)
virtual TH2F * getTH2F() const
std::vector< TH1F * > projYPoissonProbGoodStripsVsStripNumber
std::vector< TH1F * > projYNHitsGoodStripsVsStripNumber
unsigned int tidModule(const DetId &id) const
unsigned int tecModule(const DetId &id) const
std::vector< Apv > medianValues_TIDMinus_Disc3
std::vector< TProfile * > pfxOccupancyGoodStripsVsStripNumber
std::vector< Apv > medianValues_TECPlus_Disc4
std::vector< std::string > layerName
std::pair< double, double > MeanAndRms_TECMinus_Disc8[7]
std::vector< TH1F * > projYOccupancyVsStripNumber
std::vector< Apv > medianValues_TIDMinus_Disc1
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
void fillStripDQMHistograms()
std::vector< Apv > medianValues_TECMinus_Disc6
std::pair< double, double > MeanAndRms_TIDMinus_Disc2[7]
std::vector< TProfile * > pfxPoissonProbHotStripsVsStripNumber
std::vector< TH1F * > projYOccupancyGoodStripsVsStripNumber
std::vector< TH2F * > poissonProbHotStripsVsStripNumber
std::vector< TH2F * > occupancyHotStripsVsStripNumber
std::vector< Apv > medianValues_TECMinus_Disc8
std::vector< Apv > medianValues_TECMinus_Disc7
std::vector< TH1F * > projXDistanceVsStripNumber
std::string DQMOutfileName_
std::pair< double, double > MeanAndRms_TECPlus_Disc3[7]
std::vector< Apv > medianValues_TECMinus_Disc2
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
std::vector< Apv > medianValues_TIDPlus_Disc3
void AnalyzeOccupancy(SiStripQuality *, std::vector< Apv > &, std::pair< double, double > *, std::vector< unsigned int > &, const SiStripQuality *)
double stripOccupancy[6][128]
std::pair< double, double > MeanAndRms_TIB_Layer3[7]
float strip_global_position_x
unsigned short MinNumEntriesPerStrip_
std::vector< Apv > medianValues_TIB_Layer4
std::pair< double, double > MeanAndRms_TECMinus_Disc7[7]
double stripWeight[6][128]
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
virtual ~SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy()
std::vector< Apv > medianValues_TIDPlus_Disc2
SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy(const edm::ParameterSet &, const TrackerTopology *)
static constexpr auto TOB
std::vector< TH1F * > projYNHitsHotStripsVsStripNumber
long double lowoccupancy_
SiStrip::QualityHistosMap HistoMap
std::vector< TH1F * > projYNHitsVsStripNumber
const TrackerGeomDet * idToDet(DetId) const override
std::pair< double, double > MeanAndRms_TECPlus_Disc8[7]
std::vector< Apv > medianValues_TOB_Layer1
std::vector< Apv > medianValues_TIDPlus_Disc1
bool tecIsBackPetal(const DetId &id) const
std::pair< double, double > MeanAndRms_TOB_Layer5[7]
std::vector< TProfile * > pfxPoissonProbVsStripNumber
std::vector< TH2F * > nHitsHotStripsVsStripNumber
std::vector< TH2F * > occupancyGoodStripsVsStripNumber
static constexpr auto TIB
std::pair< double, double > MeanAndRms_TECPlus_Disc2[7]
virtual TH1F * getTH1F() const
void iterativeSearch(Apv &, std::vector< unsigned int > &, int)
std::pair< double, double > MeanAndRms_TECPlus_Disc5[7]
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
std::pair< double, double > MeanAndRms_TOB_Layer4[7]
TH1F * medianOccupancy[5][10]
std::pair< double, double > MeanAndRms_TIDMinus_Disc3[7]
TH1F * absoluteOccupancy[5][10]
bool tecIsStereo(const DetId &id) const
std::vector< TH2F * > occupancyVsStripNumber
std::vector< TH1F * > projYPoissonProbHotStripsVsStripNumber
unsigned int tobRod(const DetId &id) const
const TrackerTopology * tTopo
bool tidIsStereo(const DetId &id) const
std::vector< TH1F * > projYPoissonProbVsStripNumber
std::vector< TProfile * > pfxNHitsVsStripNumber
TH2F * medianVsAbsoluteOccupancy[5][10]
std::pair< double, double > MeanAndRms_TECPlus_Disc9[7]
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
std::pair< double, double > MeanAndRms_TECPlus_Disc7[7]
long double highoccupancy_
SiStripQuality * pQuality
std::pair< ContainerIterator, ContainerIterator > Range
std::pair< double, double > MeanAndRms_TIDMinus_Disc1[7]
std::pair< double, double > MeanAndRms_TECPlus_Disc4[7]
unsigned int tidRing(const DetId &id) const
virtual LocalPoint localPosition(float strip) const =0
std::pair< double, double > MeanAndRms_TIB_Layer4[7]
std::pair< double, double > MeanAndRms_TECMinus_Disc2[7]
unsigned int tibLayer(const DetId &id) const
std::vector< Apv > medianValues_TIB_Layer3
double apvMedianOccupancy
unsigned int tobModule(const DetId &id) const
std::vector< Apv > medianValues_TECPlus_Disc3
std::vector< TH2F * > nHitsGoodStripsVsStripNumber
std::vector< TProfile * > pfxOccupancyVsStripNumber
std::vector< Apv > medianValues_TECPlus_Disc5
std::vector< unsigned int > vHotStripsInModule
std::vector< TH1F * > projYDistanceVsStripNumber
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
std::vector< TProfile * > pfxOccupancyHotStripsVsStripNumber
std::pair< double, double > MeanAndRms_TIDPlus_Disc3[7]
std::vector< Apv > medianValues_TECMinus_Disc9
std::vector< TH2F * > poissonProbVsStripNumber
std::vector< Apv > medianValues_TOB_Layer3
static constexpr auto TID
std::vector< Apv > medianValues_TIB_Layer1
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
void evaluatePoissonian(std::vector< long double > &, long double &meanVal)
std::vector< Apv > medianValues_TOB_Layer4
std::vector< TH2F * > nHitsVsStripNumber
float strip_global_position_y
std::vector< Apv > medianValues_TECPlus_Disc9
double stripoccupancy[128]