42 #include "TPaveText.h" 43 #include "TImageDump.h" 45 #include "TStopwatch.h" 47 #include "TPaveLabel.h" 69 " Creating SiPixelDataQuality " <<
"\n" ;
81 for (
int i = 0;
i < 40; ++
i)
93 " Deleting SiPixelDataQuality " <<
"\n" ;
110 const string& mEName = mE->
getName() ;
114 if( mEName.find(
"_3") != string::npos )
116 string detIdString = mEName.substr((mEName.find_last_of(
"_"))+1,9);
117 std::istringstream isst;
118 isst.str(detIdString);
134 ClusterModAll = iBooker.
book1D(
"NClustertoChargeRatio_AllMod",
"Cluster Noise All Modules", 768, 0., 768.);
135 ClusterMod1 = iBooker.
book1D(
"NClustertoChargeRatio_NormMod1",
"Normalized N_{Clusters} to Charge Ratio per Module1", 192, 0., 192.);
136 ClusterMod2 = iBooker.
book1D(
"NClustertoChargeRatio_NormMod2",
"Normalized N_{Clusters} to Charge Ratio per Module2", 192, 0., 192.);
137 ClusterMod3 = iBooker.
book1D(
"NClustertoChargeRatio_NormMod3",
"Normalized N_{Clusters} to Charge Ratio per Module3", 192, 0., 192.);
138 ClusterMod4 = iBooker.
book1D(
"NClustertoChargeRatio_NormMod4",
"Normalized N_{Clusters} to Charge Ratio per Module4", 192, 0., 192.);
145 allmodsVec =
new TH1D(
"allmodsVec",
"allmodsVec",40,0.,40.);
146 errmodsVec =
new TH1D(
"errmodsVec",
"errmodsVec",40,0.,40.);
147 goodmodsVec =
new TH1D(
"goodmodsVec",
"goodmodsVec",40,0.,40.);
159 allmodsMap =
new TH2F(
"allmodsMap",
"allmodsMap",2,0.,2.,7,0.,7.);
160 errmodsMap =
new TH2F(
"errmodsMap",
"errmodsMap",2,0.,2.,7,0.,7.);
161 goodmodsMap =
new TH2F(
"goodmodsMap",
"goodmodsMap",2,0.,2.,7,0.,7.);
221 for(
int j=1; j!=41; j++){
228 for(
int i=1;
i!=3;
i++)
for(
int j=1; j!=8; j++){
263 string currDir = iBooker.
pwd();
264 string dname = currDir.substr(currDir.find_last_of(
"/")+1);
266 if((!Tier0Flag && dname.find(
"Module_")!=string::npos) ||
267 (Tier0Flag && (dname.find(
"Ladder_")!=string::npos || dname.find(
"Blade_")!=string::npos))){
271 if(currDir.find(
"Pixel")!=string::npos)
allMods_++;
272 if(currDir.find(
"Barrel")!=string::npos)
barrelMods_++;
273 if(currDir.find(
"Endcap")!=string::npos)
endcapMods_++;
274 vector<string> meVec = iGetter.
getMEs();
275 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
276 string full_path = currDir +
"/" + (*it);
277 if(full_path.find(
"ndigis_")!=string::npos){
284 }
else if(Tier0Flag && full_path.find(
"nclusters_OnTrack_")!=string::npos){
291 }
else if(!Tier0Flag && full_path.find(
"nclusters_")!=string::npos){
301 vector<string> subDirVec = iGetter.
getSubdirs();
302 for (vector<string>::const_iterator ic = subDirVec.begin();
303 ic != subDirVec.end(); ic++) {
319 if(
DONE_ && currDir==
"Pixel/EventInfo/reportSummaryContents"){
322 MonitorElement * me_err = iGetter.
get(
"Pixel/AdditionalPixelErrors/FedETypeNErr");
324 if(me_err && me_evt){
325 for(
int i=1;
i!=41;
i++)
for(
int j=1; j!=22; j++)
348 meName0 =
"Pixel/Barrel/SUMDIG_ndigis_Barrel";
352 meName0 =
"Pixel/Barrel/SUMOFF_ndigis_Barrel";
356 me = iGetter.
get(meName0);
364 if(!Tier0Flag) meName0 =
"Pixel/Endcap/SUMDIG_ndigis_Endcap";
365 else meName0 =
"Pixel/Endcap/SUMOFF_ndigis_Endcap";
366 me = iGetter.
get(meName0);
374 if(!Tier0Flag) meName0 =
"Pixel/Barrel/SUMDIG_adc_Barrel";
375 else meName0 =
"Pixel/Barrel/SUMOFF_adc_Barrel";
376 me = iGetter.
get(meName0);
384 if(!Tier0Flag) meName0 =
"Pixel/Endcap/SUMDIG_adc_Endcap";
385 else meName0 =
"Pixel/Endcap/SUMOFF_adc_Endcap";
386 me = iGetter.
get(meName0);
398 meName0 =
"Pixel/Barrel/SUMCLU_size_Barrel";
402 meName0 =
"Pixel/Barrel/SUMOFF_size_OnTrack_Barrel";
406 me = iGetter.
get(meName0);
414 if(!Tier0Flag) meName0 =
"Pixel/Endcap/SUMCLU_size_Endcap";
415 else meName0 =
"Pixel/Endcap/SUMOFF_size_OnTrack_Endcap";
416 me = iGetter.
get(meName0);
424 if(!Tier0Flag) meName0 =
"Pixel/Barrel/SUMCLU_charge_Barrel";
425 else meName0 =
"Pixel/Barrel/SUMOFF_charge_OnTrack_Barrel";
426 me = iGetter.
get(meName0);
434 if(!Tier0Flag) meName0 =
"Pixel/Endcap/SUMCLU_charge_Endcap";
435 else meName0 =
"Pixel/Endcap/SUMOFF_charge_OnTrack_Endcap";
436 me = iGetter.
get(meName0);
444 if(!Tier0Flag) meName0 =
"Pixel/Barrel/SUMCLU_nclusters_Barrel";
445 else meName0 =
"Pixel/Barrel/SUMOFF_nclusters_OnTrack_Barrel";
446 me = iGetter.
get(meName0);
454 if(!Tier0Flag) meName0 =
"Pixel/Endcap/SUMCLU_nclusters_Endcap";
455 else meName0 =
"Pixel/Endcap/SUMOFF_nclusters_OnTrack_Endcap";
456 me = iGetter.
get(meName0);
465 meName0 =
"Pixel/Tracks/ntracks_generalTracks";
466 me = iGetter.
get(meName0);
482 float pixelFlag = -1., barrelFlag = -1., endcapFlag = -1.;
483 float barrel_errors_temp[1]={-1.};
int barrel_cuts_temp[5]={5*-1};
484 float endcap_errors_temp[1]={-1.};
int endcap_cuts_temp[5]={5*-1};
485 int pixel_cuts_temp[1]={-1};
489 me = iGetter.
get(
"Pixel/Barrel/BarrelNErrorsCut");
491 me = iGetter.
get(
"Pixel/Barrel/BarrelNDigisCut");
493 me = iGetter.
get(
"Pixel/Barrel/BarrelDigiChargeCut");
495 me = iGetter.
get(
"Pixel/Barrel/BarrelClusterSizeCut");
497 me = iGetter.
get(
"Pixel/Barrel/BarrelNClustersCut");
499 me = iGetter.
get(
"Pixel/Barrel/BarrelClusterChargeCut");
501 for(
int k=0;
k!=5;
k++){
502 if(barrel_cuts_temp[
k]>=0){
503 numerator = numerator + barrel_cuts_temp[
k];
508 barrelFlag = barrel_errors_temp[0] * combinedCuts;
512 me = iGetter.
get(
"Pixel/Endcap/EndcapNErrorsCut");
514 me = iGetter.
get(
"Pixel/Endcap/EndcapNDigisCut");
516 me = iGetter.
get(
"Pixel/Endcap/EndcapDigiChargeCut");
518 me = iGetter.
get(
"Pixel/Endcap/EndcapClusterSizeCut");
520 me = iGetter.
get(
"Pixel/Endcap/EndcapNClustersCut");
522 me = iGetter.
get(
"Pixel/Endcap/EndcapClusterChargeCut");
524 for(
int k=0;
k!=5;
k++){
525 if(endcap_cuts_temp[
k]>=0){
526 numerator = numerator + endcap_cuts_temp[
k];
531 endcapFlag = endcap_errors_temp[0] * combinedCuts;
535 me = iGetter.
get(
"Pixel/Tracks/PixelTracksCut");
540 for(
int k=0;
k!=5;
k++){
541 if(barrel_cuts_temp[
k]>=0){
542 numerator = numerator + barrel_cuts_temp[
k];
545 if(endcap_cuts_temp[
k]>=0){
546 numerator = numerator + endcap_cuts_temp[
k];
549 if(
k<1 && pixel_cuts_temp[
k]>=0){
550 numerator = numerator + pixel_cuts_temp[
k];
560 SummaryBarrel = iGetter.
get(
"Pixel/EventInfo/reportSummaryContents/PixelBarrelFraction");
562 SummaryEndcap = iGetter.
get(
"Pixel/EventInfo/reportSummaryContents/PixelEndcapFraction");
574 int nErrorsBarrel_lastLS_,
575 int nErrorsEndcap_lastLS_){
579 float BarrelRate_LS = 1.;
580 float EndcapRate_LS = 1.;
581 float PixelRate_LS = 1.;
584 double nBarrelErrors_LS = me->
getBinContent(1) - nErrorsBarrel_lastLS_;
585 double nEndcapErrors_LS = me->
getBinContent(2) - nErrorsEndcap_lastLS_;
587 if(nBarrelErrors_LS/nEvents_LS>0.5) BarrelRate_LS=0.;
588 if(nEndcapErrors_LS/nEvents_LS>0.5) EndcapRate_LS=0.;
589 if((nBarrelErrors_LS + nEndcapErrors_LS)/nEvents_LS>0.5) PixelRate_LS=0.;
593 float BarrelClusterCharge = 1.;
594 float EndcapClusterCharge = 1.;
595 float PixelClusterCharge = 1.;
596 MonitorElement * me1 = iGetter.
get(
"Pixel/Clusters/OnTrack/charge_siPixelClusters_Barrel");
597 if(me1 && me1->
getMean()<12.) BarrelClusterCharge = 0.;
598 MonitorElement * me2 = iGetter.
get(
"Pixel/Clusters/OnTrack/charge_siPixelClusters_Endcap");
599 if(me2 && me2->
getMean()<12.) EndcapClusterCharge = 0.;
600 MonitorElement * me3 = iGetter.
get(
"Pixel/Clusters/OnTrack/charge_siPixelClusters");
601 if(me3 && me3->
getMean()<12.) PixelClusterCharge = 0.;
604 float BarrelOccupancy = 1.;
605 float EndcapOccupancy = 1.;
606 float PixelOccupancy = 1.;
609 double minBarrelOcc = 999999.;
610 double maxBarrelOcc = -1.;
611 double meanBarrelOcc = 0.;
612 double minEndcapOcc = 999999.;
613 double maxEndcapOcc = -1.;
614 double meanEndcapOcc = 0.;
615 for(
int i=1;
i!=41;
i++){
616 if(i<=32 && me4->getBinContent(
i)<minBarrelOcc) minBarrelOcc=me4->
getBinContent(
i);
617 if(i<=32 && me4->getBinContent(
i)>maxBarrelOcc) maxBarrelOcc=me4->
getBinContent(
i);
623 meanBarrelOcc = meanBarrelOcc/32.;
624 meanEndcapOcc = meanEndcapOcc/8.;
625 if(minBarrelOcc<0.1*meanBarrelOcc || maxBarrelOcc>2.5*meanBarrelOcc) BarrelOccupancy=0.;
626 if(minEndcapOcc<0.2*meanEndcapOcc || maxEndcapOcc>1.8*meanEndcapOcc) EndcapOccupancy=0.;
627 PixelOccupancy=BarrelOccupancy*EndcapOccupancy;
630 float pixelFlag = PixelRate_LS * PixelClusterCharge * PixelOccupancy;
631 float barrelFlag = BarrelRate_LS * BarrelClusterCharge * BarrelOccupancy;
632 float endcapFlag = EndcapRate_LS * EndcapClusterCharge * EndcapOccupancy;
635 SummaryBarrel = iGetter.
get(
"Pixel/EventInfo/reportSummaryContents/PixelBarrelFraction");
637 SummaryEndcap = iGetter.
get(
"Pixel/EventInfo/reportSummaryContents/PixelEndcapFraction");
661 for(
int j=1; j!=41; j++){
670 for(
int i=1;
i!=3;
i++)
for(
int j=1; j!=8; j++){
685 MonitorElement * meTmp = iGetter.
get(
"Pixel/Barrel/NClustertoChargeRatio_AllMod");
688 if(meTop && meBot && meTmp){
696 for (
int j = 0; j < 4; ++j){
697 static const char buf[] =
"Pixel/Barrel/NClustertoChargeRatio_NormMod%i";
698 char modplot[
sizeof(buf)+2];
699 sprintf(modplot,buf,j+1);
701 if(!meFinal)
continue;
702 for (
int i = 1;
i < 769; ++
i){
708 float SFLay[3], TotLay[3];
709 for (
int ll = 0; ll < 3; ++ll) TotLay[ll] = 0.0;
711 int layer =
int((
bin%48)/16);
714 float laynorm = TotLay[1]/64.;
715 for (
int ll = 0; ll < 3; ++ll){
716 SFLay[ll] = 0.0;
if (TotLay[ll] > 0.0 && TotLay[1] > 0.0) SFLay[ll] = TotLay[1]/TotLay[ll]*(1./laynorm);
721 int layer =
int((
bin%48)/16);
729 string currDir = iBooker.
pwd();
730 if(currDir.find(
"Reference")!=string::npos || currDir.find(
"Additional")!=string::npos)
return;
731 string dname = currDir.substr(currDir.find_last_of(
"/")+1);
732 if(dname.find(
"Module_")!=string::npos && currDir.find(
"Reference")==string::npos){
733 vector<string> meVec = iGetter.
getMEs();
734 int detId=-1;
int fedId=-1;
735 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++){
737 string full_path = currDir +
"/" + (*it);
738 if(detId==-1 && full_path.find(
"SUMOFF")==string::npos &&
739 (full_path.find(
"ndigis")!=string::npos && full_path.find(
"SUMDIG")==string::npos) &&
743 if((full_path.find(
"ndigis")!=string::npos)){
746 for(
int fedid=0; fedid!=40; ++fedid){
748 uint32_t newDetId = detId;
755 if(full_path.find(
"ndigis")!=string::npos) NDigis = me->
getEntries();
762 vector<string> subDirVec = iGetter.
getSubdirs();
763 for (vector<string>::const_iterator ic = subDirVec.begin();
764 ic != subDirVec.end(); ic++) {
773 iBooker.
cd(
"Pixel/EventInfo/reportSummaryContents");
774 iGetter.
cd(
"Pixel/EventInfo/reportSummaryContents");
775 if(iBooker.
pwd()==
"Pixel/EventInfo/reportSummaryContents"){
776 for(
int i=0;
i!=40;
i++){
777 static const char buf[] =
"Pixel/AdditionalPixelErrors/FED_%d/FedChNErr";
778 char fedplot[
sizeof(buf)+4];
780 for(
int j=0; j!=37; j++){
781 sprintf(fedplot,buf,
i);
786 if(NErrors>0){
errmodsVec->SetBinContent(
i+1,NErrors); }
791 for(
int i=1;
i!=41;
i++){
796 if ((mydigis + myerrs) > 0.){
797 contents = mydigis/(mydigis + myerrs);
809 float barrel_errors_temp[1]={-1.};
int barrel_cuts_temp[6]={6*-1};
810 float endcap_errors_temp[1]={-1.};
int endcap_cuts_temp[6]={6*-1};
811 int pixel_cuts_temp[1]={-1};
814 me = iGetter.
get(
"Pixel/Barrel/BarrelNErrorsCut");
816 me = iGetter.
get(
"Pixel/Endcap/EndcapNErrorsCut");
820 me = iGetter.
get(
"Pixel/Barrel/BarrelNDigisCut");
822 me = iGetter.
get(
"Pixel/Barrel/BarrelDigiChargeCut");
824 me = iGetter.
get(
"Pixel/Barrel/BarrelClusterSizeCut");
826 me = iGetter.
get(
"Pixel/Barrel/BarrelNClustersCut");
828 me = iGetter.
get(
"Pixel/Barrel/BarrelClusterChargeCut");
830 me = iGetter.
get(
"Pixel/Endcap/EndcapNDigisCut");
832 me = iGetter.
get(
"Pixel/Endcap/EndcapDigiChargeCut");
834 me = iGetter.
get(
"Pixel/Endcap/EndcapClusterSizeCut");
836 me = iGetter.
get(
"Pixel/Endcap/EndcapNClustersCut");
838 me = iGetter.
get(
"Pixel/Endcap/EndcapClusterChargeCut");
840 for(
int j=2; j!=7; j++){
844 me = iGetter.
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)
MonitorElement * ClusterChargeBarrel
MonitorElement * get(const std::string &path)
const std::string & pwd(void)
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(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).
MonitorElement * NPixelTracks
MonitorElement * NErrorsFEDs
MonitorElement * NDigisEndcap
MonitorElement * SummaryPixel
MonitorElement * NErrorsEndcap
MonitorElement * ClusterMod3
MonitorElement * ClusterMod1
MonitorElement * ClusterMod4
double getFloatValue(void) const
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)
std::vector< std::string > getMEs(void)
bin
set the eta bin as selection string.
MonitorElement * SummaryReportMap
void setCurrentFolder(const std::string &fullpath)
~SiPixelDataQuality()
Destructor of the SiPixelDataQuality class.
MonitorElement * book2D(Args &&...args)
int64_t getIntValue(void) const
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_)
std::vector< std::string > getSubdirs(void)
void setCurrentFolder(const std::string &fullpath)
double getBinContent(int binx) const
get content of bin (1-D)
int getNbinsX(void) const
get # of bins in X-axis
MonitorElement * NDigisBarrel
MonitorElement * bookFloat(Args &&...args)
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)