39 #include "TImageDump.h" 41 #include "TPaveLabel.h" 42 #include "TPaveText.h" 46 #include "TStopwatch.h" 67 edm::LogInfo(
"SiPixelDataQuality") <<
" Creating SiPixelDataQuality " 80 for (
int i = 0;
i < 40; ++
i) {
93 edm::LogInfo(
"SiPixelDataQuality") <<
" Deleting SiPixelDataQuality " 115 const string &mEName = mE->
getName();
119 if (mEName.find(
"_3") != string::npos) {
120 string detIdString = mEName.substr((mEName.find_last_of(
'_')) + 1, 9);
121 std::istringstream isst;
122 isst.str(detIdString);
137 ClusterModAll = iBooker.
book1D(
"NClustertoChargeRatio_AllMod",
"Cluster Noise All Modules", 768, 0., 768.);
139 "NClustertoChargeRatio_NormMod1",
"Normalized N_{Clusters} to Charge Ratio per Module1", 192, 0., 192.);
141 "NClustertoChargeRatio_NormMod2",
"Normalized N_{Clusters} to Charge Ratio per Module2", 192, 0., 192.);
143 "NClustertoChargeRatio_NormMod3",
"Normalized N_{Clusters} to Charge Ratio per Module3", 192, 0., 192.);
145 "NClustertoChargeRatio_NormMod4",
"Normalized N_{Clusters} to Charge Ratio per Module4", 192, 0., 192.);
152 allmodsVec =
new TH1D(
"allmodsVec",
"allmodsVec", 40, 0., 40.);
153 errmodsVec =
new TH1D(
"errmodsVec",
"errmodsVec", 40, 0., 40.);
154 goodmodsVec =
new TH1D(
"goodmodsVec",
"goodmodsVec", 40, 0., 40.);
166 allmodsMap =
new TH2F(
"allmodsMap",
"allmodsMap", 2, 0., 2., 7, 0., 7.);
167 errmodsMap =
new TH2F(
"errmodsMap",
"errmodsMap", 2, 0., 2., 7, 0., 7.);
168 goodmodsMap =
new TH2F(
"goodmodsMap",
"goodmodsMap", 2, 0., 2., 7, 0., 7.);
245 for (
int i = 1;
i != 3001;
i++)
246 for (
int j = 1;
j != 41;
j++)
249 for (
int i = 1;
i != 3;
i++)
250 for (
int j = 1;
j != 8;
j++)
254 for (
int j = 1;
j != 41;
j++) {
264 for (
int i = 1;
i != 3;
i++)
265 for (
int j = 1;
j != 8;
j++) {
307 string currDir = iBooker.
pwd();
308 string dname = currDir.substr(currDir.find_last_of(
'/') + 1);
311 (
Tier0Flag && (
dname.find(
"Ladder_") != string::npos ||
dname.find(
"Blade_") != string::npos))) {
314 if (currDir.find(
"Pixel") != string::npos)
316 if (currDir.find(
"Barrel") != string::npos)
318 if (currDir.find(
"Endcap") != string::npos)
320 vector<string> meVec = iGetter.
getMEs();
321 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
322 string full_path = currDir +
"/" + (*it);
323 if (full_path.find(
"ndigis_") != string::npos) {
327 if (
me->getEntries() > 25) {
328 if (full_path.find(
"Barrel") != string::npos)
330 if (full_path.find(
"Endcap") != string::npos)
333 }
else if (
Tier0Flag && full_path.find(
"nclusters_OnTrack_") != string::npos) {
337 if (
me->getEntries() > 25) {
338 if (full_path.find(
"Barrel") != string::npos)
340 if (full_path.find(
"Endcap") != string::npos)
343 }
else if (!
Tier0Flag && full_path.find(
"nclusters_") != string::npos) {
347 if (
me->getEntries() > 25) {
348 if (full_path.find(
"Barrel") != string::npos)
350 if (full_path.find(
"Endcap") != string::npos)
356 vector<string> subDirVec = iGetter.
getSubdirs();
357 for (vector<string>::const_iterator ic = subDirVec.begin(); ic != subDirVec.end(); ic++) {
375 if (
DONE_ && currDir ==
"Pixel/EventInfo/reportSummaryContents") {
377 MonitorElement *me_err = iGetter.
get(
"Pixel/AdditionalPixelErrors/FedETypeNErr");
379 if (me_err && me_evt) {
380 for (
int i = 1;
i != 41;
i++)
381 for (
int j = 1;
j != 22;
j++)
408 meName0 =
"Pixel/Barrel/SUMDIG_ndigis_Barrel";
414 meName0 =
"Pixel/Barrel/SUMOFF_ndigis_Barrel";
420 me = iGetter.
get(meName0);
431 meName0 =
"Pixel/Endcap/SUMDIG_ndigis_Endcap";
433 meName0 =
"Pixel/Endcap/SUMOFF_ndigis_Endcap";
434 me = iGetter.
get(meName0);
445 meName0 =
"Pixel/Barrel/SUMDIG_adc_Barrel";
447 meName0 =
"Pixel/Barrel/SUMOFF_adc_Barrel";
448 me = iGetter.
get(meName0);
459 meName0 =
"Pixel/Endcap/SUMDIG_adc_Endcap";
461 meName0 =
"Pixel/Endcap/SUMOFF_adc_Endcap";
462 me = iGetter.
get(meName0);
475 meName0 =
"Pixel/Barrel/SUMCLU_size_Barrel";
481 meName0 =
"Pixel/Barrel/SUMOFF_size_OnTrack_Barrel";
487 me = iGetter.
get(meName0);
498 meName0 =
"Pixel/Endcap/SUMCLU_size_Endcap";
500 meName0 =
"Pixel/Endcap/SUMOFF_size_OnTrack_Endcap";
501 me = iGetter.
get(meName0);
512 meName0 =
"Pixel/Barrel/SUMCLU_charge_Barrel";
514 meName0 =
"Pixel/Barrel/SUMOFF_charge_OnTrack_Barrel";
515 me = iGetter.
get(meName0);
526 meName0 =
"Pixel/Endcap/SUMCLU_charge_Endcap";
528 meName0 =
"Pixel/Endcap/SUMOFF_charge_OnTrack_Endcap";
529 me = iGetter.
get(meName0);
540 meName0 =
"Pixel/Barrel/SUMCLU_nclusters_Barrel";
542 meName0 =
"Pixel/Barrel/SUMOFF_nclusters_OnTrack_Barrel";
543 me = iGetter.
get(meName0);
554 meName0 =
"Pixel/Endcap/SUMCLU_nclusters_Endcap";
556 meName0 =
"Pixel/Endcap/SUMOFF_nclusters_OnTrack_Endcap";
557 me = iGetter.
get(meName0);
568 meName0 =
"Pixel/Tracks/ntracks_generalTracks";
569 me = iGetter.
get(meName0);
573 if ((
float)
me->getBinContent(2) / (
float)
me->getBinContent(1) < 0.01) {
584 float pixelFlag = -1., barrelFlag = -1., endcapFlag = -1.;
585 float barrel_errors_temp[1] = {-1.};
586 int barrel_cuts_temp[5] = {5 * -1};
587 float endcap_errors_temp[1] = {-1.};
588 int endcap_cuts_temp[5] = {5 * -1};
589 int pixel_cuts_temp[1] = {-1};
590 float combinedCuts = 1.;
594 me = iGetter.
get(
"Pixel/Barrel/BarrelNErrorsCut");
596 barrel_errors_temp[0] =
me->getFloatValue();
597 me = iGetter.
get(
"Pixel/Barrel/BarrelNDigisCut");
599 barrel_cuts_temp[0] =
me->getIntValue();
600 me = iGetter.
get(
"Pixel/Barrel/BarrelDigiChargeCut");
602 barrel_cuts_temp[1] =
me->getIntValue();
603 me = iGetter.
get(
"Pixel/Barrel/BarrelClusterSizeCut");
605 barrel_cuts_temp[2] =
me->getIntValue();
606 me = iGetter.
get(
"Pixel/Barrel/BarrelNClustersCut");
608 barrel_cuts_temp[3] =
me->getIntValue();
609 me = iGetter.
get(
"Pixel/Barrel/BarrelClusterChargeCut");
611 barrel_cuts_temp[4] =
me->getIntValue();
612 for (
int k = 0;
k != 5;
k++) {
613 if (barrel_cuts_temp[
k] >= 0) {
620 barrelFlag = barrel_errors_temp[0] * combinedCuts;
626 me = iGetter.
get(
"Pixel/Endcap/EndcapNErrorsCut");
628 endcap_errors_temp[0] =
me->getFloatValue();
629 me = iGetter.
get(
"Pixel/Endcap/EndcapNDigisCut");
631 endcap_cuts_temp[0] =
me->getIntValue();
632 me = iGetter.
get(
"Pixel/Endcap/EndcapDigiChargeCut");
634 endcap_cuts_temp[1] =
me->getIntValue();
635 me = iGetter.
get(
"Pixel/Endcap/EndcapClusterSizeCut");
637 endcap_cuts_temp[2] =
me->getIntValue();
638 me = iGetter.
get(
"Pixel/Endcap/EndcapNClustersCut");
640 endcap_cuts_temp[3] =
me->getIntValue();
641 me = iGetter.
get(
"Pixel/Endcap/EndcapClusterChargeCut");
643 endcap_cuts_temp[4] =
me->getIntValue();
644 for (
int k = 0;
k != 5;
k++) {
645 if (endcap_cuts_temp[
k] >= 0) {
652 endcapFlag = endcap_errors_temp[0] * combinedCuts;
658 me = iGetter.
get(
"Pixel/Tracks/PixelTracksCut");
660 pixel_cuts_temp[0] =
me->getIntValue();
666 for (
int k = 0;
k != 5;
k++) {
667 if (barrel_cuts_temp[
k] >= 0) {
671 if (endcap_cuts_temp[
k] >= 0) {
675 if (
k < 1 && pixel_cuts_temp[
k] >= 0) {
687 SummaryBarrel = iGetter.
get(
"Pixel/EventInfo/reportSummaryContents/PixelBarrelFraction");
690 SummaryEndcap = iGetter.
get(
"Pixel/EventInfo/reportSummaryContents/PixelEndcapFraction");
703 int nErrorsBarrel_lastLS_,
704 int nErrorsEndcap_lastLS_) {
709 float BarrelRate_LS = 1.;
710 float EndcapRate_LS = 1.;
711 float PixelRate_LS = 1.;
714 double nBarrelErrors_LS =
me->getBinContent(1) - nErrorsBarrel_lastLS_;
715 double nEndcapErrors_LS =
me->getBinContent(2) - nErrorsEndcap_lastLS_;
716 double nEvents_LS =
me->getBinContent(0) - nEvents_lastLS_;
717 if (nBarrelErrors_LS / nEvents_LS > 0.5)
719 if (nEndcapErrors_LS / nEvents_LS > 0.5)
721 if ((nBarrelErrors_LS + nEndcapErrors_LS) / nEvents_LS > 0.5)
726 float BarrelClusterCharge = 1.;
727 float EndcapClusterCharge = 1.;
728 float PixelClusterCharge = 1.;
730 if (
me1 &&
me1->getMean() < 12.)
731 BarrelClusterCharge = 0.;
733 if (
me2 &&
me2->getMean() < 12.)
734 EndcapClusterCharge = 0.;
735 MonitorElement *me3 = iGetter.
get(
"Pixel/Clusters/OnTrack/charge_siPixelClusters");
736 if (me3 && me3->
getMean() < 12.)
737 PixelClusterCharge = 0.;
740 float BarrelOccupancy = 1.;
741 float EndcapOccupancy = 1.;
742 float PixelOccupancy = 1.;
745 double minBarrelOcc = 999999.;
746 double maxBarrelOcc = -1.;
747 double meanBarrelOcc = 0.;
748 double minEndcapOcc = 999999.;
749 double maxEndcapOcc = -1.;
750 double meanEndcapOcc = 0.;
751 for (
int i = 1;
i != 41;
i++) {
752 if (i <= 32 && me4->getBinContent(
i) < minBarrelOcc)
754 if (i <= 32 && me4->getBinContent(
i) > maxBarrelOcc)
765 meanBarrelOcc = meanBarrelOcc / 32.;
766 meanEndcapOcc = meanEndcapOcc / 8.;
767 if (minBarrelOcc < 0.1 * meanBarrelOcc || maxBarrelOcc > 2.5 * meanBarrelOcc)
768 BarrelOccupancy = 0.;
769 if (minEndcapOcc < 0.2 * meanEndcapOcc || maxEndcapOcc > 1.8 * meanEndcapOcc)
770 EndcapOccupancy = 0.;
771 PixelOccupancy = BarrelOccupancy * EndcapOccupancy;
774 float pixelFlag = PixelRate_LS * PixelClusterCharge * PixelOccupancy;
775 float barrelFlag = BarrelRate_LS * BarrelClusterCharge * BarrelOccupancy;
776 float endcapFlag = EndcapRate_LS * EndcapClusterCharge * EndcapOccupancy;
780 SummaryBarrel = iGetter.
get(
"Pixel/EventInfo/reportSummaryContents/PixelBarrelFraction");
783 SummaryEndcap = iGetter.
get(
"Pixel/EventInfo/reportSummaryContents/PixelEndcapFraction");
814 for (
int j = 1;
j != 41;
j++) {
828 for (
int i = 1;
i != 3;
i++)
829 for (
int j = 1;
j != 8;
j++) {
848 MonitorElement *meTmp = iGetter.
get(
"Pixel/Barrel/NClustertoChargeRatio_AllMod");
851 if (meTop && meBot && meTmp) {
859 for (
int j = 0;
j < 4; ++
j) {
860 static const char buf[] =
"Pixel/Barrel/NClustertoChargeRatio_NormMod%i";
861 char modplot[
sizeof(
buf) + 16];
862 sprintf(modplot,
buf,
j + 1);
866 for (
int i = 1;
i < 769; ++
i) {
868 if (
int(
i +
k) % 4 == 0)
872 float SFLay[3], TotLay[3];
873 for (
int ll = 0; ll < 3; ++ll)
879 float laynorm = TotLay[1] / 64.;
880 for (
int ll = 0; ll < 3; ++ll) {
882 if (TotLay[ll] > 0.0 && TotLay[1] > 0.0)
883 SFLay[ll] = TotLay[1] / TotLay[ll] * (1. / laynorm);
896 string currDir = iBooker.
pwd();
897 if (currDir.find(
"Reference") != string::npos || currDir.find(
"Additional") != string::npos)
899 string dname = currDir.substr(currDir.find_last_of(
'/') + 1);
900 if (
dname.find(
"Module_") != string::npos && currDir.find(
"Reference") == string::npos) {
901 vector<string> meVec = iGetter.
getMEs();
904 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end();
908 string full_path = currDir +
"/" + (*it);
909 if (
detId == -1 && full_path.find(
"SUMOFF") == string::npos &&
910 (full_path.find(
"ndigis") != string::npos && full_path.find(
"SUMDIG") == string::npos) &&
915 if ((full_path.find(
"ndigis") != string::npos)) {
920 uint32_t newDetId =
detId;
927 if (full_path.find(
"ndigis") != string::npos)
928 NDigis =
me->getEntries();
935 vector<string> subDirVec = iGetter.
getSubdirs();
936 for (vector<string>::const_iterator ic = subDirVec.begin(); ic != subDirVec.end(); ic++) {
945 iBooker.
cd(
"Pixel/EventInfo/reportSummaryContents");
946 iGetter.
cd(
"Pixel/EventInfo/reportSummaryContents");
947 if (iBooker.
pwd() ==
"Pixel/EventInfo/reportSummaryContents") {
948 for (
int i = 0;
i != 40;
i++) {
949 static const char buf[] =
"Pixel/AdditionalPixelErrors/FED_%d/FedChNErr";
950 char fedplot[
sizeof(
buf) + 4];
952 for (
int j = 0;
j != 37;
j++) {
953 sprintf(fedplot,
buf,
i);
956 NErrors = NErrors +
me->getBinContent(
j + 1);
967 for (
int i = 1;
i != 41;
i++) {
972 if ((mydigis + myerrs) > 0.) {
973 contents = mydigis / (mydigis + myerrs);
985 float barrel_errors_temp[1] = {-1.};
986 int barrel_cuts_temp[6] = {6 * -1};
987 float endcap_errors_temp[1] = {-1.};
988 int endcap_cuts_temp[6] = {6 * -1};
989 int pixel_cuts_temp[1] = {-1};
992 me = iGetter.
get(
"Pixel/Barrel/BarrelNErrorsCut");
994 barrel_errors_temp[0] =
me->getFloatValue();
995 me = iGetter.
get(
"Pixel/Endcap/EndcapNErrorsCut");
997 endcap_errors_temp[0] =
me->getFloatValue();
1000 me = iGetter.
get(
"Pixel/Barrel/BarrelNDigisCut");
1002 barrel_cuts_temp[0] =
me->getIntValue();
1003 me = iGetter.
get(
"Pixel/Barrel/BarrelDigiChargeCut");
1005 barrel_cuts_temp[1] =
me->getIntValue();
1006 me = iGetter.
get(
"Pixel/Barrel/BarrelClusterSizeCut");
1008 barrel_cuts_temp[2] =
me->getIntValue();
1009 me = iGetter.
get(
"Pixel/Barrel/BarrelNClustersCut");
1011 barrel_cuts_temp[3] =
me->getIntValue();
1012 me = iGetter.
get(
"Pixel/Barrel/BarrelClusterChargeCut");
1014 barrel_cuts_temp[4] =
me->getIntValue();
1015 me = iGetter.
get(
"Pixel/Endcap/EndcapNDigisCut");
1017 endcap_cuts_temp[0] =
me->getIntValue();
1018 me = iGetter.
get(
"Pixel/Endcap/EndcapDigiChargeCut");
1020 endcap_cuts_temp[1] =
me->getIntValue();
1021 me = iGetter.
get(
"Pixel/Endcap/EndcapClusterSizeCut");
1023 endcap_cuts_temp[2] =
me->getIntValue();
1024 me = iGetter.
get(
"Pixel/Endcap/EndcapNClustersCut");
1026 endcap_cuts_temp[3] =
me->getIntValue();
1027 me = iGetter.
get(
"Pixel/Endcap/EndcapClusterChargeCut");
1029 endcap_cuts_temp[4] =
me->getIntValue();
1030 for (
int j = 2;
j != 7;
j++) {
1034 me = iGetter.
get(
"Pixel/Tracks/PixelTracksCut");
1036 pixel_cuts_temp[0] =
me->getIntValue();
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
virtual void setCurrentFolder(std::string const &fullpath)
MonitorElement * ClusterChargeBarrel
virtual std::vector< std::string > getMEs() const
virtual std::string pwd()
MonitorElement * ClusterModAll
MonitorElement * SummaryBarrel
MonitorElement * ClusterSizeEndcap
int getDetId(MonitorElement *mE)
(Documentation under construction).
MonitorElement * NPixelTracks
MonitorElement * NErrorsFEDs
MonitorElement * NDigisEndcap
MonitorElement * SummaryPixel
MonitorElement * NErrorsEndcap
MonitorElement * ClusterMod3
MonitorElement * ClusterMod1
MonitorElement * ClusterMod4
MonitorElement * NErrorsBarrel
MonitorElement * ClusterMod2
MonitorElement * NClustersEndcap
MonitorElement * ClusterSizeBarrel
virtual 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)
void computeGlobalQualityFlag(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, bool init, int nFEDs, bool Tier0Flag)
Log< level::Info, false > LogInfo
MonitorElement * SummaryReportMap
~SiPixelDataQuality()
Destructor of the SiPixelDataQuality class.
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * DigiChargeEndcap
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
MonitorElement * SummaryEndcap
MonitorElement * bookInt(TString const &name, FUNC onbooking=NOOP())
virtual MonitorElement * get(std::string const &fullpath) const
void computeGlobalQualityFlagByLumi(DQMStore::IGetter &iGetter, bool init, int nFEDs, bool Tier0Flag, int nEvents_lastLS_, int nErrorsBarrel_lastLS_, int nErrorsEndcap_lastLS_)
const std::string & getName() const
get name of ME
virtual double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * NDigisBarrel
virtual int getNbinsX() const
get # of bins in X-axis
void fillGlobalQualityPlot(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, bool init, const SiPixelFedCablingMap *theCablingMap, int nFEDs, bool Tier0Flag, int lumisec)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * ClusterChargeEndcap
MonitorElement * DigiChargeBarrel
MonitorElement * NClustersBarrel
SiPixelDataQuality(bool offlineXMLfile)
Constructor of the SiPixelInformationExtractor class.
virtual double getBinContent(int binx) const
get content of bin (1-D)
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
virtual int64_t getIntValue() const
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
void bookGlobalQualityFlag(DQMStore::IBooker &iBooker, bool Tier0Flag, int nFEDs)