40 #include "TImageDump.h" 42 #include "TPaveLabel.h" 43 #include "TPaveText.h" 47 #include "TStopwatch.h" 68 edm::LogInfo(
"SiPixelDataQuality") <<
" Creating SiPixelDataQuality " 81 for (
int i = 0;
i < 40; ++
i) {
94 edm::LogInfo(
"SiPixelDataQuality") <<
" Deleting SiPixelDataQuality " 116 const string &mEName = mE->
getName();
120 if (mEName.find(
"_3") != string::npos) {
121 string detIdString = mEName.substr((mEName.find_last_of(
"_")) + 1, 9);
122 std::istringstream isst;
123 isst.str(detIdString);
138 ClusterModAll = iBooker.
book1D(
"NClustertoChargeRatio_AllMod",
"Cluster Noise All Modules", 768, 0., 768.);
140 "NClustertoChargeRatio_NormMod1",
"Normalized N_{Clusters} to Charge Ratio per Module1", 192, 0., 192.);
142 "NClustertoChargeRatio_NormMod2",
"Normalized N_{Clusters} to Charge Ratio per Module2", 192, 0., 192.);
144 "NClustertoChargeRatio_NormMod3",
"Normalized N_{Clusters} to Charge Ratio per Module3", 192, 0., 192.);
146 "NClustertoChargeRatio_NormMod4",
"Normalized N_{Clusters} to Charge Ratio per Module4", 192, 0., 192.);
153 allmodsVec =
new TH1D(
"allmodsVec",
"allmodsVec", 40, 0., 40.);
154 errmodsVec =
new TH1D(
"errmodsVec",
"errmodsVec", 40, 0., 40.);
155 goodmodsVec =
new TH1D(
"goodmodsVec",
"goodmodsVec", 40, 0., 40.);
167 allmodsMap =
new TH2F(
"allmodsMap",
"allmodsMap", 2, 0., 2., 7, 0., 7.);
168 errmodsMap =
new TH2F(
"errmodsMap",
"errmodsMap", 2, 0., 2., 7, 0., 7.);
169 goodmodsMap =
new TH2F(
"goodmodsMap",
"goodmodsMap", 2, 0., 2., 7, 0., 7.);
246 for (
int i = 1;
i != 3001;
i++)
247 for (
int j = 1; j != 41; j++)
250 for (
int i = 1;
i != 3;
i++)
251 for (
int j = 1; j != 8; j++)
255 for (
int j = 1; j != 41; j++) {
265 for (
int i = 1;
i != 3;
i++)
266 for (
int j = 1; j != 8; j++) {
308 string currDir = iBooker.
pwd();
309 string dname = currDir.substr(currDir.find_last_of(
"/") + 1);
311 if ((!Tier0Flag && dname.find(
"Module_") != string::npos) ||
312 (Tier0Flag && (dname.find(
"Ladder_") != string::npos || dname.find(
"Blade_") != string::npos))) {
315 if (currDir.find(
"Pixel") != string::npos)
317 if (currDir.find(
"Barrel") != string::npos)
319 if (currDir.find(
"Endcap") != string::npos)
321 vector<string> meVec = iGetter.
getMEs();
322 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
323 string full_path = currDir +
"/" + (*it);
324 if (full_path.find(
"ndigis_") != string::npos) {
329 if (full_path.find(
"Barrel") != string::npos)
331 if (full_path.find(
"Endcap") != string::npos)
334 }
else if (Tier0Flag && full_path.find(
"nclusters_OnTrack_") != string::npos) {
339 if (full_path.find(
"Barrel") != string::npos)
341 if (full_path.find(
"Endcap") != string::npos)
344 }
else if (!Tier0Flag && full_path.find(
"nclusters_") != string::npos) {
349 if (full_path.find(
"Barrel") != string::npos)
351 if (full_path.find(
"Endcap") != string::npos)
357 vector<string> subDirVec = iGetter.
getSubdirs();
358 for (vector<string>::const_iterator ic = subDirVec.begin(); ic != subDirVec.end(); ic++) {
376 if (
DONE_ && currDir ==
"Pixel/EventInfo/reportSummaryContents") {
378 MonitorElement *me_err = iGetter.
get(
"Pixel/AdditionalPixelErrors/FedETypeNErr");
380 if (me_err && me_evt) {
381 for (
int i = 1;
i != 41;
i++)
382 for (
int j = 1; j != 22; j++)
409 meName0 =
"Pixel/Barrel/SUMDIG_ndigis_Barrel";
415 meName0 =
"Pixel/Barrel/SUMOFF_ndigis_Barrel";
421 me = iGetter.
get(meName0);
432 meName0 =
"Pixel/Endcap/SUMDIG_ndigis_Endcap";
434 meName0 =
"Pixel/Endcap/SUMOFF_ndigis_Endcap";
435 me = iGetter.
get(meName0);
446 meName0 =
"Pixel/Barrel/SUMDIG_adc_Barrel";
448 meName0 =
"Pixel/Barrel/SUMOFF_adc_Barrel";
449 me = iGetter.
get(meName0);
460 meName0 =
"Pixel/Endcap/SUMDIG_adc_Endcap";
462 meName0 =
"Pixel/Endcap/SUMOFF_adc_Endcap";
463 me = iGetter.
get(meName0);
476 meName0 =
"Pixel/Barrel/SUMCLU_size_Barrel";
482 meName0 =
"Pixel/Barrel/SUMOFF_size_OnTrack_Barrel";
488 me = iGetter.
get(meName0);
499 meName0 =
"Pixel/Endcap/SUMCLU_size_Endcap";
501 meName0 =
"Pixel/Endcap/SUMOFF_size_OnTrack_Endcap";
502 me = iGetter.
get(meName0);
513 meName0 =
"Pixel/Barrel/SUMCLU_charge_Barrel";
515 meName0 =
"Pixel/Barrel/SUMOFF_charge_OnTrack_Barrel";
516 me = iGetter.
get(meName0);
527 meName0 =
"Pixel/Endcap/SUMCLU_charge_Endcap";
529 meName0 =
"Pixel/Endcap/SUMOFF_charge_OnTrack_Endcap";
530 me = iGetter.
get(meName0);
541 meName0 =
"Pixel/Barrel/SUMCLU_nclusters_Barrel";
543 meName0 =
"Pixel/Barrel/SUMOFF_nclusters_OnTrack_Barrel";
544 me = iGetter.
get(meName0);
555 meName0 =
"Pixel/Endcap/SUMCLU_nclusters_Endcap";
557 meName0 =
"Pixel/Endcap/SUMOFF_nclusters_OnTrack_Endcap";
558 me = iGetter.
get(meName0);
569 meName0 =
"Pixel/Tracks/ntracks_generalTracks";
570 me = iGetter.
get(meName0);
585 float pixelFlag = -1., barrelFlag = -1., endcapFlag = -1.;
586 float barrel_errors_temp[1] = {-1.};
587 int barrel_cuts_temp[5] = {5 * -1};
588 float endcap_errors_temp[1] = {-1.};
589 int endcap_cuts_temp[5] = {5 * -1};
590 int pixel_cuts_temp[1] = {-1};
591 float combinedCuts = 1.;
595 me = iGetter.
get(
"Pixel/Barrel/BarrelNErrorsCut");
598 me = iGetter.
get(
"Pixel/Barrel/BarrelNDigisCut");
601 me = iGetter.
get(
"Pixel/Barrel/BarrelDigiChargeCut");
604 me = iGetter.
get(
"Pixel/Barrel/BarrelClusterSizeCut");
607 me = iGetter.
get(
"Pixel/Barrel/BarrelNClustersCut");
610 me = iGetter.
get(
"Pixel/Barrel/BarrelClusterChargeCut");
613 for (
int k = 0;
k != 5;
k++) {
614 if (barrel_cuts_temp[
k] >= 0) {
615 numerator = numerator + barrel_cuts_temp[
k];
621 barrelFlag = barrel_errors_temp[0] * combinedCuts;
627 me = iGetter.
get(
"Pixel/Endcap/EndcapNErrorsCut");
630 me = iGetter.
get(
"Pixel/Endcap/EndcapNDigisCut");
633 me = iGetter.
get(
"Pixel/Endcap/EndcapDigiChargeCut");
636 me = iGetter.
get(
"Pixel/Endcap/EndcapClusterSizeCut");
639 me = iGetter.
get(
"Pixel/Endcap/EndcapNClustersCut");
642 me = iGetter.
get(
"Pixel/Endcap/EndcapClusterChargeCut");
645 for (
int k = 0;
k != 5;
k++) {
646 if (endcap_cuts_temp[
k] >= 0) {
647 numerator = numerator + endcap_cuts_temp[
k];
653 endcapFlag = endcap_errors_temp[0] * combinedCuts;
659 me = iGetter.
get(
"Pixel/Tracks/PixelTracksCut");
667 for (
int k = 0;
k != 5;
k++) {
668 if (barrel_cuts_temp[
k] >= 0) {
669 numerator = numerator + barrel_cuts_temp[
k];
672 if (endcap_cuts_temp[
k] >= 0) {
673 numerator = numerator + endcap_cuts_temp[
k];
676 if (
k < 1 && pixel_cuts_temp[
k] >= 0) {
677 numerator = numerator + pixel_cuts_temp[
k];
688 SummaryBarrel = iGetter.
get(
"Pixel/EventInfo/reportSummaryContents/PixelBarrelFraction");
691 SummaryEndcap = iGetter.
get(
"Pixel/EventInfo/reportSummaryContents/PixelEndcapFraction");
704 int nErrorsBarrel_lastLS_,
705 int nErrorsEndcap_lastLS_) {
710 float BarrelRate_LS = 1.;
711 float EndcapRate_LS = 1.;
712 float PixelRate_LS = 1.;
715 double nBarrelErrors_LS = me->
getBinContent(1) - nErrorsBarrel_lastLS_;
716 double nEndcapErrors_LS = me->
getBinContent(2) - nErrorsEndcap_lastLS_;
718 if (nBarrelErrors_LS / nEvents_LS > 0.5)
720 if (nEndcapErrors_LS / nEvents_LS > 0.5)
722 if ((nBarrelErrors_LS + nEndcapErrors_LS) / nEvents_LS > 0.5)
727 float BarrelClusterCharge = 1.;
728 float EndcapClusterCharge = 1.;
729 float PixelClusterCharge = 1.;
730 MonitorElement *me1 = iGetter.
get(
"Pixel/Clusters/OnTrack/charge_siPixelClusters_Barrel");
731 if (me1 && me1->
getMean() < 12.)
732 BarrelClusterCharge = 0.;
733 MonitorElement *me2 = iGetter.
get(
"Pixel/Clusters/OnTrack/charge_siPixelClusters_Endcap");
734 if (me2 && me2->
getMean() < 12.)
735 EndcapClusterCharge = 0.;
736 MonitorElement *me3 = iGetter.
get(
"Pixel/Clusters/OnTrack/charge_siPixelClusters");
737 if (me3 && me3->
getMean() < 12.)
738 PixelClusterCharge = 0.;
741 float BarrelOccupancy = 1.;
742 float EndcapOccupancy = 1.;
743 float PixelOccupancy = 1.;
746 double minBarrelOcc = 999999.;
747 double maxBarrelOcc = -1.;
748 double meanBarrelOcc = 0.;
749 double minEndcapOcc = 999999.;
750 double maxEndcapOcc = -1.;
751 double meanEndcapOcc = 0.;
752 for (
int i = 1;
i != 41;
i++) {
753 if (i <= 32 && me4->getBinContent(
i) < minBarrelOcc)
755 if (i <= 32 && me4->getBinContent(
i) > maxBarrelOcc)
766 meanBarrelOcc = meanBarrelOcc / 32.;
767 meanEndcapOcc = meanEndcapOcc / 8.;
768 if (minBarrelOcc < 0.1 * meanBarrelOcc || maxBarrelOcc > 2.5 * meanBarrelOcc)
769 BarrelOccupancy = 0.;
770 if (minEndcapOcc < 0.2 * meanEndcapOcc || maxEndcapOcc > 1.8 * meanEndcapOcc)
771 EndcapOccupancy = 0.;
772 PixelOccupancy = BarrelOccupancy * EndcapOccupancy;
775 float pixelFlag = PixelRate_LS * PixelClusterCharge * PixelOccupancy;
776 float barrelFlag = BarrelRate_LS * BarrelClusterCharge * BarrelOccupancy;
777 float endcapFlag = EndcapRate_LS * EndcapClusterCharge * EndcapOccupancy;
781 SummaryBarrel = iGetter.
get(
"Pixel/EventInfo/reportSummaryContents/PixelBarrelFraction");
784 SummaryEndcap = iGetter.
get(
"Pixel/EventInfo/reportSummaryContents/PixelEndcapFraction");
815 for (
int j = 1; j != 41; j++) {
829 for (
int i = 1;
i != 3;
i++)
830 for (
int j = 1; j != 8; j++) {
849 MonitorElement *meTmp = iGetter.
get(
"Pixel/Barrel/NClustertoChargeRatio_AllMod");
852 if (meTop && meBot && meTmp) {
860 for (
int j = 0; j < 4; ++j) {
861 static const char buf[] =
"Pixel/Barrel/NClustertoChargeRatio_NormMod%i";
862 char modplot[
sizeof(buf) + 2];
863 sprintf(modplot, buf, j + 1);
867 for (
int i = 1;
i < 769; ++
i) {
869 if (
int(
i + k) % 4 == 0)
873 float SFLay[3], TotLay[3];
874 for (
int ll = 0; ll < 3; ++ll)
877 int layer =
int((
bin % 48) / 16);
880 float laynorm = TotLay[1] / 64.;
881 for (
int ll = 0; ll < 3; ++ll) {
883 if (TotLay[ll] > 0.0 && TotLay[1] > 0.0)
884 SFLay[ll] = TotLay[1] / TotLay[ll] * (1. / laynorm);
889 int layer =
int((
bin % 48) / 16);
897 string currDir = iBooker.
pwd();
898 if (currDir.find(
"Reference") != string::npos || currDir.find(
"Additional") != string::npos)
900 string dname = currDir.substr(currDir.find_last_of(
"/") + 1);
901 if (dname.find(
"Module_") != string::npos && currDir.find(
"Reference") == string::npos) {
902 vector<string> meVec = iGetter.
getMEs();
905 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end();
909 string full_path = currDir +
"/" + (*it);
910 if (detId == -1 && full_path.find(
"SUMOFF") == string::npos &&
911 (full_path.find(
"ndigis") != string::npos && full_path.find(
"SUMDIG") == string::npos) &&
916 if ((full_path.find(
"ndigis") != string::npos)) {
919 for (
int fedid = 0; fedid != 40; ++fedid) {
921 uint32_t newDetId = detId;
928 if (full_path.find(
"ndigis") != string::npos)
936 vector<string> subDirVec = iGetter.
getSubdirs();
937 for (vector<string>::const_iterator ic = subDirVec.begin(); ic != subDirVec.end(); ic++) {
946 iBooker.
cd(
"Pixel/EventInfo/reportSummaryContents");
947 iGetter.
cd(
"Pixel/EventInfo/reportSummaryContents");
948 if (iBooker.
pwd() ==
"Pixel/EventInfo/reportSummaryContents") {
949 for (
int i = 0;
i != 40;
i++) {
950 static const char buf[] =
"Pixel/AdditionalPixelErrors/FED_%d/FedChNErr";
951 char fedplot[
sizeof(buf) + 4];
953 for (
int j = 0; j != 37; j++) {
954 sprintf(fedplot, buf,
i);
968 for (
int i = 1;
i != 41;
i++) {
973 if ((mydigis + myerrs) > 0.) {
974 contents = mydigis / (mydigis + myerrs);
986 float barrel_errors_temp[1] = {-1.};
987 int barrel_cuts_temp[6] = {6 * -1};
988 float endcap_errors_temp[1] = {-1.};
989 int endcap_cuts_temp[6] = {6 * -1};
990 int pixel_cuts_temp[1] = {-1};
993 me = iGetter.
get(
"Pixel/Barrel/BarrelNErrorsCut");
996 me = iGetter.
get(
"Pixel/Endcap/EndcapNErrorsCut");
1001 me = iGetter.
get(
"Pixel/Barrel/BarrelNDigisCut");
1004 me = iGetter.
get(
"Pixel/Barrel/BarrelDigiChargeCut");
1007 me = iGetter.
get(
"Pixel/Barrel/BarrelClusterSizeCut");
1010 me = iGetter.
get(
"Pixel/Barrel/BarrelNClustersCut");
1013 me = iGetter.
get(
"Pixel/Barrel/BarrelClusterChargeCut");
1016 me = iGetter.
get(
"Pixel/Endcap/EndcapNDigisCut");
1019 me = iGetter.
get(
"Pixel/Endcap/EndcapDigiChargeCut");
1022 me = iGetter.
get(
"Pixel/Endcap/EndcapClusterSizeCut");
1025 me = iGetter.
get(
"Pixel/Endcap/EndcapNClustersCut");
1028 me = iGetter.
get(
"Pixel/Endcap/EndcapClusterChargeCut");
1031 for (
int j = 2; j != 7; j++) {
1035 me = iGetter.
get(
"Pixel/Tracks/PixelTracksCut");
int64_t getIntValue() const
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * ClusterChargeBarrel
double getFloatValue() const
MonitorElement * ClusterModAll
MonitorElement * bookInt(Args &&...args)
void fillGlobalQualityPlot(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, bool init, edm::ESHandle< SiPixelFedCablingMap > theCablingMap, int nFEDs, bool Tier0Flag, int lumisec)
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)
bool hasError() const
true if at least of one of the quality tests returned an error
void setCurrentFolder(std::string const &fullpath)
const std::string & getName() const
get name of ME
MonitorElement * SummaryBarrel
MonitorElement * ClusterSizeEndcap
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
int getDetId(MonitorElement *mE)
(Documentation under construction).
MonitorElement * NPixelTracks
MonitorElement * NErrorsFEDs
MonitorElement * NDigisEndcap
MonitorElement * SummaryPixel
MonitorElement * NErrorsEndcap
MonitorElement * ClusterMod3
void setCurrentFolder(std::string const &fullpath)
MonitorElement * ClusterMod1
MonitorElement * ClusterMod4
MonitorElement * NErrorsBarrel
MonitorElement * book1D(Args &&...args)
MonitorElement * ClusterMod2
MonitorElement * NClustersEndcap
MonitorElement * ClusterSizeBarrel
void computeGlobalQualityFlag(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, bool init, int nFEDs, bool Tier0Flag)
MonitorElement * get(std::string const &path)
bin
set the eta bin as selection string.
MonitorElement * SummaryReportMap
double getEntries() const
get # of entries
~SiPixelDataQuality()
Destructor of the SiPixelDataQuality class.
MonitorElement * book2D(Args &&...args)
std::string const & pwd()
edm::ESHandle< SiPixelFedCablingMap > theCablingMap
MonitorElement * DigiChargeEndcap
MonitorElement * SummaryEndcap
void computeGlobalQualityFlagByLumi(DQMStore::IGetter &iGetter, bool init, int nFEDs, bool Tier0Flag, int nEvents_lastLS_, int nErrorsBarrel_lastLS_, int nErrorsEndcap_lastLS_)
double getBinContent(int binx) const
get content of bin (1-D)
std::vector< std::string > getSubdirs()
MonitorElement * NDigisBarrel
int getNbinsX() const
get # of bins in X-axis
MonitorElement * bookFloat(Args &&...args)
std::vector< std::string > getMEs()
MonitorElement * ClusterChargeEndcap
MonitorElement * DigiChargeBarrel
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
MonitorElement * NClustersBarrel
T const * product() const
SiPixelDataQuality(bool offlineXMLfile)
Constructor of the SiPixelInformationExtractor class.
void bookGlobalQualityFlag(DQMStore::IBooker &iBooker, bool Tier0Flag, int nFEDs)