44 #include "TPaveText.h"
45 #include "TImageDump.h"
47 #include "TStopwatch.h"
49 #include "TPaveLabel.h"
71 " Creating SiPixelDataQuality " <<
"\n" ;
83 for (
int i = 0;
i < 40; ++
i)
95 " Deleting SiPixelDataQuality " <<
"\n" ;
112 string mEName = mE->
getName() ;
116 if( mEName.find(
"_3") != string::npos )
118 string detIdString = mEName.substr((mEName.find_last_of(
"_"))+1,9);
119 std::istringstream isst;
120 isst.str(detIdString);
143 ClusterModAll = bei->
book1D(
"NClustertoChargeRatio_AllMod",
"Cluster Noise All Modules", 768, 0., 768.);
144 ClusterMod1 = bei->
book1D(
"NClustertoChargeRatio_NormMod1",
"Normalized N_{Clusters} to Charge Ratio per Module1", 192, 0., 192.);
145 ClusterMod2 = bei->
book1D(
"NClustertoChargeRatio_NormMod2",
"Normalized N_{Clusters} to Charge Ratio per Module2", 192, 0., 192.);
146 ClusterMod3 = bei->
book1D(
"NClustertoChargeRatio_NormMod3",
"Normalized N_{Clusters} to Charge Ratio per Module3", 192, 0., 192.);
147 ClusterMod4 = bei->
book1D(
"NClustertoChargeRatio_NormMod4",
"Normalized N_{Clusters} to Charge Ratio per Module4", 192, 0., 192.);
161 allmodsVec =
new TH1D(
"allmodsVec",
"allmodsVec",40,0.,40.);
162 errmodsVec =
new TH1D(
"errmodsVec",
"errmodsVec",40,0.,40.);
163 goodmodsVec =
new TH1D(
"goodmodsVec",
"goodmodsVec",40,0.,40.);
175 allmodsMap =
new TH2F(
"allmodsMap",
"allmodsMap",2,0.,2.,7,0.,7.);
176 errmodsMap =
new TH2F(
"errmodsMap",
"errmodsMap",2,0.,2.,7,0.,7.);
177 goodmodsMap =
new TH2F(
"goodmodsMap",
"goodmodsMap",2,0.,2.,7,0.,7.);
209 SummaryBarrel = bei->
get(
"Pixel/EventInfo/reportSummaryContents/PixelBarrelFraction");
211 SummaryEndcap = bei->
get(
"Pixel/EventInfo/reportSummaryContents/PixelEndcapFraction");
216 SummaryBarrel = bei->
get(
"Pixel/EventInfo/reportSummaryContents/PixelBarrelFraction");
218 SummaryEndcap = bei->
get(
"Pixel/EventInfo/reportSummaryContents/PixelEndcapFraction");
225 NErrorsFEDs = bei->
get(
"Pixel/AdditionalPixelErrors/FEDsNErrorsCut");
258 for(
int j=1;
j!=41;
j++){
265 for(
int i=1;
i!=3;
i++)
for(
int j=1;
j!=8;
j++){
306 string currDir = bei->
pwd();
307 string dname = currDir.substr(currDir.find_last_of(
"/")+1);
310 if((!Tier0Flag && dname.find(
"Module_")!=string::npos) ||
311 (Tier0Flag && (dname.find(
"Ladder_")!=string::npos || dname.find(
"Blade_")!=string::npos))){
315 if(currDir.find(
"Pixel")!=string::npos)
allMods_++;
316 if(currDir.find(
"Barrel")!=string::npos)
barrelMods_++;
317 if(currDir.find(
"Endcap")!=string::npos)
endcapMods_++;
318 vector<string> meVec = bei->
getMEs();
319 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
320 string full_path = currDir +
"/" + (*it);
322 if(full_path.find(
"ndigis_")!=string::npos){
333 }
else if(Tier0Flag && full_path.find(
"nclusters_OnTrack_")!=string::npos){
340 }
else if(!Tier0Flag && full_path.find(
"nclusters_")!=string::npos){
351 for (vector<string>::const_iterator ic = subDirVec.begin();
352 ic != subDirVec.end(); ic++) {
366 if(
DONE_ && currDir==
"Pixel/EventInfo/reportSummaryContents"){
369 MonitorElement * me_err = bei->
get(
"Pixel/AdditionalPixelErrors/FedETypeNErrArray");
371 if(me_err && me_evt){
372 for(
int i=1;
i!=41;
i++)
for(
int j=1;
j!=22;
j++)
395 meName0 =
"Pixel/Barrel/SUMDIG_ndigis_Barrel";
400 meName0 =
"Pixel/Barrel/SUMOFF_ndigis_Barrel";
404 me = bei->
get(meName0);
413 if(!Tier0Flag) meName0 =
"Pixel/Endcap/SUMDIG_ndigis_Endcap";
414 else meName0 =
"Pixel/Endcap/SUMOFF_ndigis_Endcap";
415 me = bei->
get(meName0);
423 if(!Tier0Flag) meName0 =
"Pixel/Barrel/SUMDIG_adc_Barrel";
424 else meName0 =
"Pixel/Barrel/SUMOFF_adc_Barrel";
425 me = bei->
get(meName0);
433 if(!Tier0Flag) meName0 =
"Pixel/Endcap/SUMDIG_adc_Endcap";
434 else meName0 =
"Pixel/Endcap/SUMOFF_adc_Endcap";
435 me = bei->
get(meName0);
447 meName0 =
"Pixel/Barrel/SUMCLU_size_Barrel";
451 meName0 =
"Pixel/Barrel/SUMOFF_size_OnTrack_Barrel";
455 me = bei->
get(meName0);
463 if(!Tier0Flag) meName0 =
"Pixel/Endcap/SUMCLU_size_Endcap";
464 else meName0 =
"Pixel/Endcap/SUMOFF_size_OnTrack_Endcap";
465 me = bei->
get(meName0);
473 if(!Tier0Flag) meName0 =
"Pixel/Barrel/SUMCLU_charge_Barrel";
474 else meName0 =
"Pixel/Barrel/SUMOFF_charge_OnTrack_Barrel";
475 me = bei->
get(meName0);
483 if(!Tier0Flag) meName0 =
"Pixel/Endcap/SUMCLU_charge_Endcap";
484 else meName0 =
"Pixel/Endcap/SUMOFF_charge_OnTrack_Endcap";
485 me = bei->
get(meName0);
493 if(!Tier0Flag) meName0 =
"Pixel/Barrel/SUMCLU_nclusters_Barrel";
494 else meName0 =
"Pixel/Barrel/SUMOFF_nclusters_OnTrack_Barrel";
495 me = bei->
get(meName0);
503 if(!Tier0Flag) meName0 =
"Pixel/Endcap/SUMCLU_nclusters_Endcap";
504 else meName0 =
"Pixel/Endcap/SUMOFF_nclusters_OnTrack_Endcap";
505 me = bei->
get(meName0);
514 meName0 =
"Pixel/Tracks/ntracks_generalTracks";
515 me = bei->
get(meName0);
531 float pixelFlag = -1., barrelFlag = -1., endcapFlag = -1.;
532 float barrel_errors_temp[1]={-1.};
int barrel_cuts_temp[5]={5*-1};
533 float endcap_errors_temp[1]={-1.};
int endcap_cuts_temp[5]={5*-1};
534 int pixel_cuts_temp[1]={-1};
535 float combinedCuts = 1.;
int numerator = 0,
denominator = 0;
538 me = bei->
get(
"Pixel/Barrel/BarrelNErrorsCut");
540 me = bei->
get(
"Pixel/Barrel/BarrelNDigisCut");
542 me = bei->
get(
"Pixel/Barrel/BarrelDigiChargeCut");
544 me = bei->
get(
"Pixel/Barrel/BarrelClusterSizeCut");
546 me = bei->
get(
"Pixel/Barrel/BarrelNClustersCut");
548 me = bei->
get(
"Pixel/Barrel/BarrelClusterChargeCut");
550 for(
int k=0;
k!=5;
k++){
551 if(barrel_cuts_temp[
k]>=0){
552 numerator = numerator + barrel_cuts_temp[
k];
558 barrelFlag = barrel_errors_temp[0] * combinedCuts;
565 me = bei->
get(
"Pixel/Endcap/EndcapNErrorsCut");
567 me = bei->
get(
"Pixel/Endcap/EndcapNDigisCut");
569 me = bei->
get(
"Pixel/Endcap/EndcapDigiChargeCut");
571 me = bei->
get(
"Pixel/Endcap/EndcapClusterSizeCut");
573 me = bei->
get(
"Pixel/Endcap/EndcapNClustersCut");
575 me = bei->
get(
"Pixel/Endcap/EndcapClusterChargeCut");
577 for(
int k=0;
k!=5;
k++){
578 if(endcap_cuts_temp[
k]>=0){
579 numerator = numerator + endcap_cuts_temp[
k];
585 endcapFlag = endcap_errors_temp[0] * combinedCuts;
590 me = bei->
get(
"Pixel/Tracks/PixelTracksCut");
595 for(
int k=0;
k!=5;
k++){
596 if(barrel_cuts_temp[
k]>=0){
597 numerator = numerator + barrel_cuts_temp[
k];
601 if(endcap_cuts_temp[
k]>=0){
602 numerator = numerator + endcap_cuts_temp[
k];
605 if(
k<1 && pixel_cuts_temp[
k]>=0){
606 numerator = numerator + pixel_cuts_temp[
k];
618 SummaryBarrel = bei->
get(
"Pixel/EventInfo/reportSummaryContents/PixelBarrelFraction");
620 SummaryEndcap = bei->
get(
"Pixel/EventInfo/reportSummaryContents/PixelEndcapFraction");
632 int nErrorsBarrel_lastLS_,
633 int nErrorsEndcap_lastLS_){
644 float BarrelRate_LS = 1.;
645 float EndcapRate_LS = 1.;
646 float PixelRate_LS = 1.;
650 double nBarrelErrors_LS = me->
getBinContent(1) - nErrorsBarrel_lastLS_;
651 double nEndcapErrors_LS = me->
getBinContent(2) - nErrorsEndcap_lastLS_;
654 if(nBarrelErrors_LS/nEvents_LS>0.5) BarrelRate_LS=0.;
655 if(nEndcapErrors_LS/nEvents_LS>0.5) EndcapRate_LS=0.;
656 if((nBarrelErrors_LS + nEndcapErrors_LS)/nEvents_LS>0.5) PixelRate_LS=0.;
661 float BarrelClusterCharge = 1.;
662 float EndcapClusterCharge = 1.;
663 float PixelClusterCharge = 1.;
664 MonitorElement * me1 = bei->
get(
"Pixel/Clusters/OnTrack/charge_siPixelClusters_Barrel");
665 if(me1 && me1->
getMean()<12.) BarrelClusterCharge = 0.;
667 MonitorElement * me2 = bei->
get(
"Pixel/Clusters/OnTrack/charge_siPixelClusters_Endcap");
668 if(me2 && me2->
getMean()<12.) EndcapClusterCharge = 0.;
670 MonitorElement * me3 = bei->
get(
"Pixel/Clusters/OnTrack/charge_siPixelClusters");
671 if(me3 && me3->
getMean()<12.) PixelClusterCharge = 0.;
675 float BarrelOccupancy = 1.;
676 float EndcapOccupancy = 1.;
677 float PixelOccupancy = 1.;
680 double minBarrelOcc = 999999.;
681 double maxBarrelOcc = -1.;
682 double meanBarrelOcc = 0.;
683 double minEndcapOcc = 999999.;
684 double maxEndcapOcc = -1.;
685 double meanEndcapOcc = 0.;
686 for(
int i=1;
i!=41;
i++){
687 if(i<=32 && me4->getBinContent(
i)<minBarrelOcc) minBarrelOcc=me4->
getBinContent(
i);
688 if(i<=32 && me4->getBinContent(
i)>maxBarrelOcc) maxBarrelOcc=me4->
getBinContent(
i);
695 meanBarrelOcc = meanBarrelOcc/32.;
696 meanEndcapOcc = meanEndcapOcc/8.;
698 if(minBarrelOcc<0.1*meanBarrelOcc || maxBarrelOcc>2.5*meanBarrelOcc) BarrelOccupancy=0.;
699 if(minEndcapOcc<0.2*meanEndcapOcc || maxEndcapOcc>1.8*meanEndcapOcc) EndcapOccupancy=0.;
700 PixelOccupancy=BarrelOccupancy*EndcapOccupancy;
704 float pixelFlag = PixelRate_LS * PixelClusterCharge * PixelOccupancy;
705 float barrelFlag = BarrelRate_LS * BarrelClusterCharge * BarrelOccupancy;
706 float endcapFlag = EndcapRate_LS * EndcapClusterCharge * EndcapOccupancy;
710 SummaryBarrel = bei->
get(
"Pixel/EventInfo/reportSummaryContents/PixelBarrelFraction");
712 SummaryEndcap = bei->
get(
"Pixel/EventInfo/reportSummaryContents/PixelEndcapFraction");
739 for(
int j=1;
j!=41;
j++){
748 for(
int i=1;
i!=3;
i++)
for(
int j=1;
j!=8;
j++){
959 if(meTop && meBot && meTmp){
967 for (
int j = 0;
j < 4; ++
j){
968 static const char buf[] =
"Pixel/Barrel/NClustertoChargeRatio_NormMod%i";
969 char modplot[
sizeof(buf)+2];
970 sprintf(modplot,buf,
j+1);
972 if(!meFinal)
continue;
973 for (
int i = 1;
i < 769; ++
i){
979 float SFLay[3], TotLay[3];
980 for (
int ll = 0; ll < 3; ++ll) TotLay[ll] = 0.0;
982 int layer = int((
bin%48)/16);
985 float laynorm = TotLay[1]/64.;
986 for (
int ll = 0; ll < 3; ++ll){
987 SFLay[ll] = 0.0;
if (TotLay[ll] > 0.0 && TotLay[1] > 0.0) SFLay[ll] = TotLay[1]/TotLay[ll]*(1./laynorm);
992 int layer = int((
bin%48)/16);
1001 string currDir = bei->
pwd();
1002 if(currDir.find(
"Reference")!=string::npos || currDir.find(
"Additional")!=string::npos)
return;
1004 string dname = currDir.substr(currDir.find_last_of(
"/")+1);
1005 if(dname.find(
"Module_")!=string::npos && currDir.find(
"Reference")==string::npos){
1006 vector<string> meVec = bei->
getMEs();
1007 int detId=-1;
int fedId=-1;
1008 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++){
1010 string full_path = currDir +
"/" + (*it);
1011 if(detId==-1 && full_path.find(
"SUMOFF")==string::npos &&
1012 (full_path.find(
"ndigis")!=string::npos && full_path.find(
"SUMDIG")==string::npos) &&
1016 if((full_path.find(
"ndigis")!=string::npos)){
1019 for(
int fedid=0; fedid!=40; ++fedid){
1021 uint32_t newDetId = detId;
1022 if(converter.hasDetUnit(newDetId)){
1028 if(full_path.find(
"ndigis")!=string::npos) NDigis = me->
getEntries();
1041 vector<string> subDirVec = bei->
getSubdirs();
1042 for (vector<string>::const_iterator ic = subDirVec.begin();
1043 ic != subDirVec.end(); ic++) {
1051 bei->
cd(
"Pixel/EventInfo/reportSummaryContents");
1052 if(bei->
pwd()==
"Pixel/EventInfo/reportSummaryContents"){
1053 for(
int i=0;
i!=40;
i++){
1054 static const char buf[] =
"Pixel/AdditionalPixelErrors/FED_%d/FedChNErrArray_%d";
1055 char fedplot[
sizeof(buf)+4];
1057 for(
int j=0;
j!=37;
j++){
1058 sprintf(fedplot,buf,
i,
j);
1064 if(NErrors>0){
errmodsVec->SetBinContent(
i+1,NErrors); }
1069 for(
int i=1;
i!=41;
i++){
1074 if ((mydigis + myerrs) > 0.){
1075 contents = mydigis/(mydigis + myerrs);
1088 float barrel_errors_temp[1]={-1.};
int barrel_cuts_temp[6]={6*-1};
1089 float endcap_errors_temp[1]={-1.};
int endcap_cuts_temp[6]={6*-1};
1090 int pixel_cuts_temp[1]={-1};
1093 me = bei->
get(
"Pixel/Barrel/BarrelNErrorsCut");
1095 me = bei->
get(
"Pixel/Endcap/EndcapNErrorsCut");
1099 me = bei->
get(
"Pixel/Barrel/BarrelNDigisCut");
1101 me = bei->
get(
"Pixel/Barrel/BarrelDigiChargeCut");
1103 me = bei->
get(
"Pixel/Barrel/BarrelClusterSizeCut");
1105 me = bei->
get(
"Pixel/Barrel/BarrelNClustersCut");
1107 me = bei->
get(
"Pixel/Barrel/BarrelClusterChargeCut");
1109 me = bei->
get(
"Pixel/Endcap/EndcapNDigisCut");
1111 me = bei->
get(
"Pixel/Endcap/EndcapDigiChargeCut");
1113 me = bei->
get(
"Pixel/Endcap/EndcapClusterSizeCut");
1115 me = bei->
get(
"Pixel/Endcap/EndcapNClustersCut");
1117 me = bei->
get(
"Pixel/Endcap/EndcapClusterChargeCut");
1119 for(
int j=2;
j!=7;
j++){
1124 me = bei->
get(
"Pixel/Tracks/PixelTracksCut");
const std::string & getName(void) const
get name of ME
void setBinContent(int binx, double content)
set content of bin (1-D)
std::vector< std::string > getSubdirs(void) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
void fillGlobalQualityPlot(DQMStore *bei, bool init, edm::EventSetup const &eSetup, int nFEDs, bool Tier0Flag, int lumisec)
MonitorElement * ClusterChargeBarrel
void cd(void)
go to top directory (ie. root)
void computeGlobalQualityFlag(DQMStore *bei, bool init, int nFEDs, bool Tier0Flag)
MonitorElement * ClusterModAll
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(void) const
true if at least of one of the quality tests returned an error
MonitorElement * SummaryBarrel
MonitorElement * ClusterSizeEndcap
double getEntries(void) const
get # of entries
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).
void computeGlobalQualityFlagByLumi(DQMStore *bei, bool init, int nFEDs, bool Tier0Flag, int nEvents_lastLS_, int nErrorsBarrel_lastLS_, int nErrorsEndcap_lastLS_)
MonitorElement * NPixelTracks
MonitorElement * bookFloat(const char *name)
Book float.
MonitorElement * NErrorsFEDs
MonitorElement * NDigisEndcap
MonitorElement * SummaryPixel
MonitorElement * NErrorsEndcap
MonitorElement * ClusterMod3
MonitorElement * ClusterMod1
MonitorElement * ClusterMod4
double getFloatValue(void) const
MonitorElement * NErrorsBarrel
MonitorElement * ClusterMod2
MonitorElement * NClustersEndcap
void bookGlobalQualityFlag(DQMStore *bei, bool Tier0Flag, int nFEDs)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
MonitorElement * ClusterSizeBarrel
MonitorElement * SummaryReportMap
~SiPixelDataQuality()
Destructor of the SiPixelDataQuality class.
int64_t getIntValue(void) const
edm::ESHandle< SiPixelFedCablingMap > theCablingMap
MonitorElement * DigiChargeEndcap
MonitorElement * SummaryEndcap
T const * product() const
std::vector< std::string > getMEs(void) const
get list of (non-dir) MEs of current directory
double getBinContent(int binx) const
get content of bin (1-D)
int getNbinsX(void) const
get # of bins in X-axis
void goUp(void)
equivalent to "cd .."
MonitorElement * NDigisBarrel
MonitorElement * bookInt(const char *name)
Book int.
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
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
void setCurrentFolder(const std::string &fullpath)
SiPixelDataQuality(bool offlineXMLfile)
Constructor of the SiPixelInformationExtractor class.
const std::string & pwd(void) const