43 #include "TPaveText.h"
44 #include "TImageDump.h"
46 #include "TStopwatch.h"
48 #include "TPaveLabel.h"
70 " Creating SiPixelDataQuality " <<
"\n" ;
82 for (
int i = 0;
i < 40; ++
i)
94 " Deleting SiPixelDataQuality " <<
"\n" ;
111 string mEName = mE->
getName() ;
115 if( mEName.find(
"_3") != string::npos )
117 string detIdString = mEName.substr((mEName.find_last_of(
"_"))+1,9);
118 std::istringstream isst;
119 isst.str(detIdString);
142 ClusterModAll = bei->
book1D(
"NClustertoChargeRatio_AllMod",
"Cluster Noise All Modules", 768, 0., 768.);
143 ClusterMod1 = bei->
book1D(
"NClustertoChargeRatio_NormMod1",
"Normalized N_{Clusters} to Charge Ratio per Module1", 192, 0., 192.);
144 ClusterMod2 = bei->
book1D(
"NClustertoChargeRatio_NormMod2",
"Normalized N_{Clusters} to Charge Ratio per Module2", 192, 0., 192.);
145 ClusterMod3 = bei->
book1D(
"NClustertoChargeRatio_NormMod3",
"Normalized N_{Clusters} to Charge Ratio per Module3", 192, 0., 192.);
146 ClusterMod4 = bei->
book1D(
"NClustertoChargeRatio_NormMod4",
"Normalized N_{Clusters} to Charge Ratio per Module4", 192, 0., 192.);
160 allmodsVec =
new TH1D(
"allmodsVec",
"allmodsVec",40,0.,40.);
161 errmodsVec =
new TH1D(
"errmodsVec",
"errmodsVec",40,0.,40.);
162 goodmodsVec =
new TH1D(
"goodmodsVec",
"goodmodsVec",40,0.,40.);
174 allmodsMap =
new TH2F(
"allmodsMap",
"allmodsMap",2,0.,2.,7,0.,7.);
175 errmodsMap =
new TH2F(
"errmodsMap",
"errmodsMap",2,0.,2.,7,0.,7.);
176 goodmodsMap =
new TH2F(
"goodmodsMap",
"goodmodsMap",2,0.,2.,7,0.,7.);
208 SummaryBarrel = bei->
get(
"Pixel/EventInfo/reportSummaryContents/PixelBarrelFraction");
210 SummaryEndcap = bei->
get(
"Pixel/EventInfo/reportSummaryContents/PixelEndcapFraction");
215 SummaryBarrel = bei->
get(
"Pixel/EventInfo/reportSummaryContents/PixelBarrelFraction");
217 SummaryEndcap = bei->
get(
"Pixel/EventInfo/reportSummaryContents/PixelEndcapFraction");
224 NErrorsFEDs = bei->
get(
"Pixel/AdditionalPixelErrors/FEDsNErrorsCut");
257 for(
int j=1;
j!=41;
j++){
264 for(
int i=1;
i!=3;
i++)
for(
int j=1;
j!=8;
j++){
305 string currDir = bei->
pwd();
306 string dname = currDir.substr(currDir.find_last_of(
"/")+1);
309 if((!Tier0Flag && dname.find(
"Module_")!=string::npos) ||
310 (Tier0Flag && (dname.find(
"Ladder_")!=string::npos || dname.find(
"Blade_")!=string::npos))){
314 if(currDir.find(
"Pixel")!=string::npos)
allMods_++;
315 if(currDir.find(
"Barrel")!=string::npos)
barrelMods_++;
316 if(currDir.find(
"Endcap")!=string::npos)
endcapMods_++;
317 vector<string> meVec = bei->
getMEs();
318 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
319 string full_path = currDir +
"/" + (*it);
321 if(full_path.find(
"ndigis_")!=string::npos){
332 }
else if(Tier0Flag && full_path.find(
"nclusters_OnTrack_")!=string::npos){
339 }
else if(!Tier0Flag && full_path.find(
"nclusters_")!=string::npos){
350 for (vector<string>::const_iterator ic = subDirVec.begin();
351 ic != subDirVec.end(); ic++) {
365 if(
DONE_ && currDir==
"Pixel/EventInfo/reportSummaryContents"){
368 MonitorElement * me_err = bei->
get(
"Pixel/AdditionalPixelErrors/FedETypeNErrArray");
370 if(me_err && me_evt){
371 for(
int i=1;
i!=41;
i++)
for(
int j=1;
j!=22;
j++)
394 meName0 =
"Pixel/Barrel/SUMDIG_ndigis_Barrel";
399 meName0 =
"Pixel/Barrel/SUMOFF_ndigis_Barrel";
403 me = bei->
get(meName0);
412 if(!Tier0Flag) meName0 =
"Pixel/Endcap/SUMDIG_ndigis_Endcap";
413 else meName0 =
"Pixel/Endcap/SUMOFF_ndigis_Endcap";
414 me = bei->
get(meName0);
422 if(!Tier0Flag) meName0 =
"Pixel/Barrel/SUMDIG_adc_Barrel";
423 else meName0 =
"Pixel/Barrel/SUMOFF_adc_Barrel";
424 me = bei->
get(meName0);
432 if(!Tier0Flag) meName0 =
"Pixel/Endcap/SUMDIG_adc_Endcap";
433 else meName0 =
"Pixel/Endcap/SUMOFF_adc_Endcap";
434 me = bei->
get(meName0);
446 meName0 =
"Pixel/Barrel/SUMCLU_size_Barrel";
450 meName0 =
"Pixel/Barrel/SUMOFF_size_OnTrack_Barrel";
454 me = bei->
get(meName0);
462 if(!Tier0Flag) meName0 =
"Pixel/Endcap/SUMCLU_size_Endcap";
463 else meName0 =
"Pixel/Endcap/SUMOFF_size_OnTrack_Endcap";
464 me = bei->
get(meName0);
472 if(!Tier0Flag) meName0 =
"Pixel/Barrel/SUMCLU_charge_Barrel";
473 else meName0 =
"Pixel/Barrel/SUMOFF_charge_OnTrack_Barrel";
474 me = bei->
get(meName0);
482 if(!Tier0Flag) meName0 =
"Pixel/Endcap/SUMCLU_charge_Endcap";
483 else meName0 =
"Pixel/Endcap/SUMOFF_charge_OnTrack_Endcap";
484 me = bei->
get(meName0);
492 if(!Tier0Flag) meName0 =
"Pixel/Barrel/SUMCLU_nclusters_Barrel";
493 else meName0 =
"Pixel/Barrel/SUMOFF_nclusters_OnTrack_Barrel";
494 me = bei->
get(meName0);
502 if(!Tier0Flag) meName0 =
"Pixel/Endcap/SUMCLU_nclusters_Endcap";
503 else meName0 =
"Pixel/Endcap/SUMOFF_nclusters_OnTrack_Endcap";
504 me = bei->
get(meName0);
513 meName0 =
"Pixel/Tracks/ntracks_generalTracks";
514 me = bei->
get(meName0);
530 float pixelFlag = -1., barrelFlag = -1., endcapFlag = -1.;
531 float barrel_errors_temp[1]={-1.};
int barrel_cuts_temp[5]={5*-1};
532 float endcap_errors_temp[1]={-1.};
int endcap_cuts_temp[5]={5*-1};
533 int pixel_cuts_temp[1]={-1};
537 me = bei->
get(
"Pixel/Barrel/BarrelNErrorsCut");
539 me = bei->
get(
"Pixel/Barrel/BarrelNDigisCut");
541 me = bei->
get(
"Pixel/Barrel/BarrelDigiChargeCut");
543 me = bei->
get(
"Pixel/Barrel/BarrelClusterSizeCut");
545 me = bei->
get(
"Pixel/Barrel/BarrelNClustersCut");
547 me = bei->
get(
"Pixel/Barrel/BarrelClusterChargeCut");
549 for(
int k=0;
k!=5;
k++){
550 if(barrel_cuts_temp[
k]>=0){
551 numerator = numerator + barrel_cuts_temp[
k];
557 barrelFlag = barrel_errors_temp[0] * combinedCuts;
564 me = bei->
get(
"Pixel/Endcap/EndcapNErrorsCut");
566 me = bei->
get(
"Pixel/Endcap/EndcapNDigisCut");
568 me = bei->
get(
"Pixel/Endcap/EndcapDigiChargeCut");
570 me = bei->
get(
"Pixel/Endcap/EndcapClusterSizeCut");
572 me = bei->
get(
"Pixel/Endcap/EndcapNClustersCut");
574 me = bei->
get(
"Pixel/Endcap/EndcapClusterChargeCut");
576 for(
int k=0;
k!=5;
k++){
577 if(endcap_cuts_temp[
k]>=0){
578 numerator = numerator + endcap_cuts_temp[
k];
584 endcapFlag = endcap_errors_temp[0] * combinedCuts;
589 me = bei->
get(
"Pixel/Tracks/PixelTracksCut");
594 for(
int k=0;
k!=5;
k++){
595 if(barrel_cuts_temp[
k]>=0){
596 numerator = numerator + barrel_cuts_temp[
k];
600 if(endcap_cuts_temp[
k]>=0){
601 numerator = numerator + endcap_cuts_temp[
k];
604 if(
k<1 && pixel_cuts_temp[
k]>=0){
605 numerator = numerator + pixel_cuts_temp[
k];
617 SummaryBarrel = bei->
get(
"Pixel/EventInfo/reportSummaryContents/PixelBarrelFraction");
619 SummaryEndcap = bei->
get(
"Pixel/EventInfo/reportSummaryContents/PixelEndcapFraction");
631 int nErrorsBarrel_lastLS_,
632 int nErrorsEndcap_lastLS_){
643 float BarrelRate_LS = 1.;
644 float EndcapRate_LS = 1.;
645 float PixelRate_LS = 1.;
649 double nBarrelErrors_LS = me->
getBinContent(1) - nErrorsBarrel_lastLS_;
650 double nEndcapErrors_LS = me->
getBinContent(2) - nErrorsEndcap_lastLS_;
653 if(nBarrelErrors_LS/nEvents_LS>0.5) BarrelRate_LS=0.;
654 if(nEndcapErrors_LS/nEvents_LS>0.5) EndcapRate_LS=0.;
655 if((nBarrelErrors_LS + nEndcapErrors_LS)/nEvents_LS>0.5) PixelRate_LS=0.;
660 float BarrelClusterCharge = 1.;
661 float EndcapClusterCharge = 1.;
662 float PixelClusterCharge = 1.;
663 MonitorElement * me1 = bei->
get(
"Pixel/Clusters/OnTrack/charge_siPixelClusters_Barrel");
664 if(me1 && me1->
getMean()<12.) BarrelClusterCharge = 0.;
666 MonitorElement * me2 = bei->
get(
"Pixel/Clusters/OnTrack/charge_siPixelClusters_Endcap");
667 if(me2 && me2->
getMean()<12.) EndcapClusterCharge = 0.;
669 MonitorElement * me3 = bei->
get(
"Pixel/Clusters/OnTrack/charge_siPixelClusters");
670 if(me3 && me3->
getMean()<12.) PixelClusterCharge = 0.;
674 float BarrelOccupancy = 1.;
675 float EndcapOccupancy = 1.;
676 float PixelOccupancy = 1.;
679 double minBarrelOcc = 999999.;
680 double maxBarrelOcc = -1.;
681 double meanBarrelOcc = 0.;
682 double minEndcapOcc = 999999.;
683 double maxEndcapOcc = -1.;
684 double meanEndcapOcc = 0.;
685 for(
int i=1;
i!=41;
i++){
686 if(i<=32 && me4->getBinContent(
i)<minBarrelOcc) minBarrelOcc=me4->
getBinContent(
i);
687 if(i<=32 && me4->getBinContent(
i)>maxBarrelOcc) maxBarrelOcc=me4->
getBinContent(
i);
694 meanBarrelOcc = meanBarrelOcc/32.;
695 meanEndcapOcc = meanEndcapOcc/8.;
697 if(minBarrelOcc<0.1*meanBarrelOcc || maxBarrelOcc>2.5*meanBarrelOcc) BarrelOccupancy=0.;
698 if(minEndcapOcc<0.2*meanEndcapOcc || maxEndcapOcc>1.8*meanEndcapOcc) EndcapOccupancy=0.;
699 PixelOccupancy=BarrelOccupancy*EndcapOccupancy;
703 float pixelFlag = PixelRate_LS * PixelClusterCharge * PixelOccupancy;
704 float barrelFlag = BarrelRate_LS * BarrelClusterCharge * BarrelOccupancy;
705 float endcapFlag = EndcapRate_LS * EndcapClusterCharge * EndcapOccupancy;
709 SummaryBarrel = bei->
get(
"Pixel/EventInfo/reportSummaryContents/PixelBarrelFraction");
711 SummaryEndcap = bei->
get(
"Pixel/EventInfo/reportSummaryContents/PixelEndcapFraction");
738 for(
int j=1;
j!=41;
j++){
747 for(
int i=1;
i!=3;
i++)
for(
int j=1;
j!=8;
j++){
958 if(meTop && meBot && meTmp){
966 for (
int j = 0;
j < 4; ++
j){
967 static const char buf[] =
"Pixel/Barrel/NClustertoChargeRatio_NormMod%i";
968 char modplot[
sizeof(buf)+2];
969 sprintf(modplot,buf,
j+1);
971 if(!meFinal)
continue;
972 for (
int i = 1;
i < 769; ++
i){
978 float SFLay[3], TotLay[3];
979 for (
int ll = 0; ll < 3; ++ll) TotLay[ll] = 0.0;
981 int layer = int((
bin%48)/16);
984 float laynorm = TotLay[1]/64.;
985 for (
int ll = 0; ll < 3; ++ll){
986 SFLay[ll] = 0.0;
if (TotLay[ll] > 0.0 && TotLay[1] > 0.0) SFLay[ll] = TotLay[1]/TotLay[ll]*(1./laynorm);
991 int layer = int((
bin%48)/16);
1000 string currDir = bei->
pwd();
1001 if(currDir.find(
"Reference")!=string::npos || currDir.find(
"Additional")!=string::npos)
return;
1003 string dname = currDir.substr(currDir.find_last_of(
"/")+1);
1004 if(dname.find(
"Module_")!=string::npos && currDir.find(
"Reference")==string::npos){
1005 vector<string> meVec = bei->
getMEs();
1006 int detId=-1;
int fedId=-1;
1007 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++){
1009 string full_path = currDir +
"/" + (*it);
1010 if(detId==-1 && full_path.find(
"SUMOFF")==string::npos &&
1011 (full_path.find(
"ndigis")!=string::npos && full_path.find(
"SUMDIG")==string::npos) &&
1015 if((full_path.find(
"ndigis")!=string::npos)){
1018 for(
int fedid=0; fedid!=40; ++fedid){
1020 uint32_t newDetId = detId;
1021 if(converter.hasDetUnit(newDetId)){
1027 if(full_path.find(
"ndigis")!=string::npos) NDigis = me->
getEntries();
1040 vector<string> subDirVec = bei->
getSubdirs();
1041 for (vector<string>::const_iterator ic = subDirVec.begin();
1042 ic != subDirVec.end(); ic++) {
1050 bei->
cd(
"Pixel/EventInfo/reportSummaryContents");
1051 if(bei->
pwd()==
"Pixel/EventInfo/reportSummaryContents"){
1052 for(
int i=0;
i!=40;
i++){
1053 static const char buf[] =
"Pixel/AdditionalPixelErrors/FED_%d/FedChNErrArray_%d";
1054 char fedplot[
sizeof(buf)+4];
1056 for(
int j=0;
j!=37;
j++){
1057 sprintf(fedplot,buf,
i,
j);
1063 if(NErrors>0){
errmodsVec->SetBinContent(
i+1,NErrors); }
1068 for(
int i=1;
i!=41;
i++){
1073 if ((mydigis + myerrs) > 0.){
1074 contents = mydigis/(mydigis + myerrs);
1087 float barrel_errors_temp[1]={-1.};
int barrel_cuts_temp[6]={6*-1};
1088 float endcap_errors_temp[1]={-1.};
int endcap_cuts_temp[6]={6*-1};
1089 int pixel_cuts_temp[1]={-1};
1092 me = bei->
get(
"Pixel/Barrel/BarrelNErrorsCut");
1094 me = bei->
get(
"Pixel/Endcap/EndcapNErrorsCut");
1098 me = bei->
get(
"Pixel/Barrel/BarrelNDigisCut");
1100 me = bei->
get(
"Pixel/Barrel/BarrelDigiChargeCut");
1102 me = bei->
get(
"Pixel/Barrel/BarrelClusterSizeCut");
1104 me = bei->
get(
"Pixel/Barrel/BarrelNClustersCut");
1106 me = bei->
get(
"Pixel/Barrel/BarrelClusterChargeCut");
1108 me = bei->
get(
"Pixel/Endcap/EndcapNDigisCut");
1110 me = bei->
get(
"Pixel/Endcap/EndcapDigiChargeCut");
1112 me = bei->
get(
"Pixel/Endcap/EndcapClusterSizeCut");
1114 me = bei->
get(
"Pixel/Endcap/EndcapNClustersCut");
1116 me = bei->
get(
"Pixel/Endcap/EndcapClusterChargeCut");
1118 for(
int j=2;
j!=7;
j++){
1123 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