CMS 3D CMS Logo

Public Member Functions | Private Attributes

SiPixelDataQuality Class Reference

#include <SiPixelDataQuality.h>

List of all members.

Public Member Functions

void bookGlobalQualityFlag (DQMStore *bei, bool Tier0Flag, int nFEDs)
void computeGlobalQualityFlag (DQMStore *bei, bool init, int nFEDs, bool Tier0Flag)
void computeGlobalQualityFlagByLumi (DQMStore *bei, bool init, int nFEDs, bool Tier0Flag, int nEvents_lastLS_)
void fillGlobalQualityPlot (DQMStore *bei, bool init, edm::EventSetup const &eSetup, int nFEDs, bool Tier0Flag, int lumisec)
int getDetId (MonitorElement *mE)
 (Documentation under construction).
 SiPixelDataQuality (bool offlineXMLfile)
 Constructor of the SiPixelInformationExtractor class.
 ~SiPixelDataQuality ()
 Destructor of the SiPixelDataQuality class.

Private Attributes

int allMods_
TH2F * allmodsMap
TH1D * allmodsVec
float barrel_error_flag_
int barrelMods_
MonitorElementClusterChargeBarrel
MonitorElementClusterChargeEndcap
int clusterCounterBarrel
int clusterCounterEndcap
MonitorElementClusterSizeBarrel
MonitorElementClusterSizeEndcap
bool clusterStatsBarrel
bool clusterStatsEndcap
int count
int count1
int count2
int count3
int count4
int count5
int count6
MonitorElementDigiChargeBarrel
MonitorElementDigiChargeEndcap
int digiCounterBarrel
int digiCounterEndcap
bool digiStatsBarrel
bool digiStatsEndcap
bool DONE_
float endcap_error_flag_
int endcapMods_
bool endOfModules_
int errcount
TH2F * errmodsMap
TH1D * errmodsVec
int errorMods_
TH2F * goodmodsMap
TH1D * goodmodsVec
bool gotDigis
int lastLS_
int modCounter_
ofstream myfile_
int n_errors_barrel_
int n_errors_endcap_
int n_errors_pixel_
MonitorElementNClustersBarrel
MonitorElementNClustersEndcap
MonitorElementNDigisBarrel
MonitorElementNDigisEndcap
MonitorElementNErrorsBarrel
MonitorElementNErrorsEndcap
MonitorElementNErrorsFEDs
int nevents_
MonitorElementNPixelTracks
int objectCount_
bool offlineXMLfile_
float pixel_error_flag_
float qflag_
MonitorElementSummaryBarrel
MonitorElementSummaryEndcap
MonitorElementSummaryPixel
MonitorElementSummaryReportMap
edm::ESHandle
< SiPixelFedCablingMap
theCablingMap
int timeoutCounter_
int trackCounterBarrel
int trackCounterEndcap
bool trackStatsBarrel
bool trackStatsEndcap

Detailed Description

Definition at line 44 of file SiPixelDataQuality.h.


Constructor & Destructor Documentation

SiPixelDataQuality::SiPixelDataQuality ( bool  offlineXMLfile)

Constructor of the SiPixelInformationExtractor class.

Definition at line 69 of file SiPixelDataQuality.cc.

References allMods_, allmodsMap, allmodsVec, errmodsMap, errmodsVec, errorMods_, goodmodsMap, goodmodsVec, lastLS_, qflag_, and timeoutCounter_.

                                                          : offlineXMLfile_(offlineXMLfile) {
  edm::LogInfo("SiPixelDataQuality") << 
    " Creating SiPixelDataQuality " << "\n" ;
  
  allMods_=0;
  errorMods_=0;
  qflag_=1.;

  allmodsMap=0;
  errmodsMap=0;
  goodmodsMap=0;
  allmodsVec=0;
  errmodsVec=0;
  goodmodsVec=0;
  
  timeoutCounter_=0;
  lastLS_=-1;
}
SiPixelDataQuality::~SiPixelDataQuality ( )

Destructor of the SiPixelDataQuality class.

Definition at line 92 of file SiPixelDataQuality.cc.

References allmodsMap, allmodsVec, errmodsMap, errmodsVec, goodmodsMap, and goodmodsVec.

                                        {
  edm::LogInfo("SiPixelDataQuality") << 
    " Deleting SiPixelDataQuality " << "\n" ;
  if(allmodsMap) delete allmodsMap;
  if(errmodsMap) delete errmodsMap;
  if(goodmodsMap) delete goodmodsMap;
  if(allmodsVec) delete allmodsVec;
  if(errmodsVec) delete errmodsVec;
  if(goodmodsVec) delete goodmodsVec;
}

Member Function Documentation

void SiPixelDataQuality::bookGlobalQualityFlag ( DQMStore bei,
bool  Tier0Flag,
int  nFEDs 
)

Definition at line 136 of file SiPixelDataQuality.cc.

References allmodsMap, allmodsVec, DQMStore::book2D(), DQMStore::bookFloat(), DQMStore::bookInt(), DQMStore::cd(), ClusterChargeBarrel, ClusterChargeEndcap, ClusterSizeBarrel, ClusterSizeEndcap, DigiChargeBarrel, DigiChargeEndcap, errmodsMap, errmodsVec, MonitorElement::Fill(), DQMStore::get(), goodmodsMap, goodmodsVec, i, j, NClustersBarrel, NClustersEndcap, NDigisBarrel, NDigisEndcap, NErrorsBarrel, NErrorsEndcap, NErrorsFEDs, NPixelTracks, MonitorElement::setAxisTitle(), MonitorElement::setBinContent(), MonitorElement::setBinLabel(), DQMStore::setCurrentFolder(), SummaryBarrel, SummaryEndcap, SummaryPixel, and SummaryReportMap.

Referenced by SiPixelEDAClient::beginRun().

                                                                                        {
//std::cout<<"BOOK GLOBAL QUALITY FLAG MEs!"<<std::endl;
  bei->cd();
  
  bei->setCurrentFolder("Pixel/EventInfo");
  if(!Tier0Flag){
    /*SummaryReportMap = bei->book2D("reportSummaryMap","Pixel Summary Map",40,0.,40.,36,1.,37.);
    SummaryReportMap->setAxisTitle("Pixel FED #",1);
    SummaryReportMap->setAxisTitle("Pixel FED Channel #",2);
    allmodsMap = new TH2F("allmodsMap","allmodsMap",40,0.,40.,36,1.,37.);
    errmodsMap = new TH2F("errmodsMap","errmodsMap",40,0.,40.,36,1.,37.);
    goodmodsMap = new TH2F("goodmodsMap","goodmodsMap",40,0.,40.,36,1.,37.);
    */
    SummaryReportMap = bei->book2D("reportSummaryMap","Pixel Summary Map",2000,0.,2000.,40,0.,40.);
    SummaryReportMap->setAxisTitle("Lumi Section",1);
    SummaryReportMap->setAxisTitle("Pixel FED #",2);
    allmodsVec = new TH1D("allmodsVec","allmodsVec",40,0.,40.);
    errmodsVec = new TH1D("errmodsVec","errmodsVec",40,0.,40.);
    goodmodsVec = new TH1D("goodmodsVec","goodmodsVec",40,0.,40.);
  }else{
    SummaryReportMap = bei->book2D("reportSummaryMap","Pixel Summary Map",2,0.,2.,7,0.,7.);
    SummaryReportMap->setBinLabel(1,"Barrel",1);
    SummaryReportMap->setBinLabel(2,"Endcaps",1);
    SummaryReportMap->setBinLabel(1,"Errors",2);
    SummaryReportMap->setBinLabel(2,"NDigis",2);
    SummaryReportMap->setBinLabel(3,"DigiCharge",2);
    SummaryReportMap->setBinLabel(4,"ClusterSize",2);
    SummaryReportMap->setBinLabel(5,"NClusters",2);
    SummaryReportMap->setBinLabel(6,"ClusterCharge",2);
    SummaryReportMap->setBinLabel(7,"HitEff",2);
    allmodsMap = new TH2F("allmodsMap","allmodsMap",2,0.,2.,7,0.,7.);
    errmodsMap = new TH2F("errmodsMap","errmodsMap",2,0.,2.,7,0.,7.);
    goodmodsMap = new TH2F("goodmodsMap","goodmodsMap",2,0.,2.,7,0.,7.);
  }  
    SummaryPixel = bei->bookFloat("reportSummary");
  bei->setCurrentFolder("Pixel/EventInfo/reportSummaryContents");
    SummaryBarrel = bei->bookFloat("PixelBarrelFraction");
    SummaryEndcap = bei->bookFloat("PixelEndcapFraction");
  // book the data certification cuts:
  bei->setCurrentFolder("Pixel/AdditionalPixelErrors");
    NErrorsFEDs = bei->bookFloat("FEDsNErrorsCut");
  bei->setCurrentFolder("Pixel/Barrel");
    NErrorsBarrel = bei->bookFloat("BarrelNErrorsCut");
    NDigisBarrel = bei->bookInt("BarrelNDigisCut");
    DigiChargeBarrel = bei->bookInt("BarrelDigiChargeCut");
    ClusterSizeBarrel = bei->bookInt("BarrelClusterSizeCut");
    NClustersBarrel = bei->bookInt("BarrelNClustersCut");
    ClusterChargeBarrel = bei->bookInt("BarrelClusterChargeCut");
  bei->setCurrentFolder("Pixel/Endcap");
    NErrorsEndcap = bei->bookFloat("EndcapNErrorsCut");
    NDigisEndcap = bei->bookInt("EndcapNDigisCut");
    DigiChargeEndcap = bei->bookInt("EndcapDigiChargeCut");
    ClusterSizeEndcap = bei->bookInt("EndcapClusterSizeCut");
    NClustersEndcap = bei->bookInt("EndcapNClustersCut");
    ClusterChargeEndcap = bei->bookInt("EndcapClusterChargeCut");
  if(Tier0Flag){
    bei->setCurrentFolder("Pixel/Tracks");
      NPixelTracks = bei->bookInt("PixelTracksCut");
  }
    
    // Init MonitoringElements:
    if(nFEDs>0){
      SummaryPixel = bei->get("Pixel/EventInfo/reportSummary");
      if(SummaryPixel) SummaryPixel->Fill(1.);
      SummaryBarrel = bei->get("Pixel/EventInfo/reportSummaryContents/PixelBarrelFraction");
      if(SummaryBarrel) SummaryBarrel->Fill(1.);
      SummaryEndcap = bei->get("Pixel/EventInfo/reportSummaryContents/PixelEndcapFraction");
      if(SummaryEndcap) SummaryEndcap->Fill(1.);
    }else{
      SummaryPixel = bei->get("Pixel/EventInfo/reportSummary");
      if(SummaryPixel) SummaryPixel->Fill(-1.);
      SummaryBarrel = bei->get("Pixel/EventInfo/reportSummaryContents/PixelBarrelFraction");
      if(SummaryBarrel) SummaryBarrel->Fill(-1.);
      SummaryEndcap = bei->get("Pixel/EventInfo/reportSummaryContents/PixelEndcapFraction");
      if(SummaryEndcap) SummaryEndcap->Fill(-1.);
    }
    NErrorsBarrel = bei->get("Pixel/Barrel/BarrelNErrorsCut");
    if(NErrorsBarrel) NErrorsBarrel->Fill(1.);
    NErrorsEndcap = bei->get("Pixel/Endcap/EndcapNErrorsCut");
    if(NErrorsEndcap) NErrorsEndcap->Fill(1.);
    NErrorsFEDs = bei->get("Pixel/AdditionalPixelErrors/FEDsNErrorsCut");
    if(NErrorsFEDs) NErrorsFEDs->Fill(1.);
    NDigisBarrel = bei->get("Pixel/Barrel/BarrelNDigisCut");
    if(NDigisBarrel) NDigisBarrel->Fill(1);
    NDigisEndcap = bei->get("Pixel/Endcap/EndcapNDigisCut");
    if(NDigisEndcap) NDigisEndcap->Fill(1);
    DigiChargeBarrel = bei->get("Pixel/Barrel/BarrelDigiChargeCut");
    if(DigiChargeBarrel) DigiChargeBarrel->Fill(1);
    DigiChargeEndcap = bei->get("Pixel/Endcap/EndcapDigiChargeCut");
    if(DigiChargeEndcap) DigiChargeEndcap->Fill(1);
    ClusterSizeBarrel = bei->get("Pixel/Barrel/BarrelClusterSizeCut");
    if(ClusterSizeBarrel) ClusterSizeBarrel->Fill(1);
    ClusterSizeEndcap = bei->get("Pixel/Endcap/EndcapClusterSizeCut");
    if(ClusterSizeEndcap) ClusterSizeEndcap->Fill(1);
    ClusterChargeBarrel = bei->get("Pixel/Barrel/BarrelClusterChargeCut");
    if(ClusterChargeBarrel) ClusterChargeBarrel->Fill(1);
    ClusterChargeEndcap = bei->get("Pixel/Endcap/EndcapClusterChargeCut");
    if(ClusterChargeEndcap) ClusterChargeEndcap->Fill(1);
    NClustersBarrel = bei->get("Pixel/Barrel/BarrelNClustersCut");
    if(NClustersBarrel) NClustersBarrel->Fill(1);
    NClustersEndcap = bei->get("Pixel/Endcap/EndcapNClustersCut");
    if(NClustersEndcap) NClustersEndcap->Fill(1);
    if(Tier0Flag){
      NPixelTracks = bei->get("Pixel/Tracks/PixelTracksCut");
      if(NPixelTracks) NPixelTracks->Fill(1);
    }
   
    SummaryReportMap = bei->get("Pixel/EventInfo/reportSummaryMap");
    if(SummaryReportMap){
      if(!Tier0Flag) for(int i=1; i!=2001; i++) for(int j=1; j!=41; j++) SummaryReportMap->setBinContent(i,j,-1.);
      if(Tier0Flag) for(int i=1; i!=3; i++) for(int j=1; j!=8; j++) SummaryReportMap->setBinContent(i,j,-1.);
    }
    if(!Tier0Flag){
      for(int j=1; j!=41; j++){
        if(allmodsVec) allmodsVec->SetBinContent(j,0.);
        if(errmodsVec) errmodsVec->SetBinContent(j,0.);
        if(goodmodsVec) goodmodsVec->SetBinContent(j,0.);
      }
    }
    if(Tier0Flag){
      for(int i=1; i!=3; i++) for(int j=1; j!=8; j++){
        if(allmodsMap) allmodsMap->SetBinContent(i,j,0.);
        if(errmodsMap) errmodsMap->SetBinContent(i,j,0.);
        if(goodmodsMap) goodmodsMap->SetBinContent(i,j,0.);
      }
    }
    
  bei->cd();  
}
void SiPixelDataQuality::computeGlobalQualityFlag ( DQMStore bei,
bool  init,
int  nFEDs,
bool  Tier0Flag 
)

Definition at line 268 of file SiPixelDataQuality.cc.

References allMods_, barrel_error_flag_, barrelMods_, DQMStore::cd(), ClusterChargeBarrel, ClusterChargeEndcap, clusterCounterBarrel, clusterCounterEndcap, ClusterSizeBarrel, ClusterSizeEndcap, clusterStatsBarrel, clusterStatsEndcap, ExpressReco_HICollisions_FallBack::denominator, DigiChargeBarrel, DigiChargeEndcap, digiCounterBarrel, digiCounterEndcap, digiStatsBarrel, digiStatsEndcap, DONE_, endcap_error_flag_, endcapMods_, errorMods_, MonitorElement::Fill(), DQMStore::get(), MonitorElement::getBinContent(), MonitorElement::getEntries(), MonitorElement::getFloatValue(), MonitorElement::getIntValue(), DQMStore::getMEs(), DQMStore::getSubdirs(), DQMStore::goUp(), MonitorElement::hasError(), i, j, gen::k, n_errors_barrel_, n_errors_endcap_, n_errors_pixel_, NClustersBarrel, NClustersEndcap, NDigisBarrel, NDigisEndcap, NErrorsBarrel, NErrorsEndcap, NPixelTracks, objectCount_, pixel_error_flag_, DQMStore::pwd(), qflag_, SummaryBarrel, SummaryEndcap, SummaryPixel, trackCounterBarrel, trackCounterEndcap, trackStatsBarrel, and trackStatsEndcap.

Referenced by SiPixelEDAClient::endRun().

                                                                          {
//cout<<"entering SiPixelDataQuality::ComputeGlobalQualityFlag"<<endl;
//   cout << ACRed << ACBold
//        << "[SiPixelDataQuality::ComputeGlobalQualityFlag]"
//        << ACPlain
//        << " Enter" 
//        << endl ;
  if(init){
//cout<<"Entering SiPixelDataQuality::computeGlobalQualityFlag for the first time"<<endl;
    allMods_=0; errorMods_=0; qflag_=0.; 
    barrelMods_=0; endcapMods_=0;
    objectCount_=0;
    DONE_ = false;
    
    //Error counters and flags:
    n_errors_barrel_=0; barrel_error_flag_=0.;
    n_errors_endcap_=0; endcap_error_flag_=0.;
    n_errors_pixel_=0; pixel_error_flag_=0.;
    digiStatsBarrel = false, clusterStatsBarrel = false, trackStatsBarrel = false;
    digiCounterBarrel = 0, clusterCounterBarrel = 0, trackCounterBarrel = 0;
    digiStatsEndcap = false, clusterStatsEndcap = false, trackStatsEndcap = false;
    digiCounterEndcap = 0, clusterCounterEndcap = 0, trackCounterEndcap = 0;
    init=false;
  }
  if(nFEDs==0) return;  
  
  string currDir = bei->pwd();
  string dname = currDir.substr(currDir.find_last_of("/")+1);
//cout<<"currDir="<<currDir<<endl;
  
  if((!Tier0Flag && dname.find("Module_")!=string::npos) || 
     (Tier0Flag && (dname.find("Ladder_")!=string::npos || dname.find("Blade_")!=string::npos))){

    objectCount_++;

    if(currDir.find("Pixel")!=string::npos) allMods_++;
    if(currDir.find("Barrel")!=string::npos) barrelMods_++;
    if(currDir.find("Endcap")!=string::npos) endcapMods_++;
    vector<string> meVec = bei->getMEs();
    for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
      string full_path = currDir + "/" + (*it);
      //cout<<"full_path:"<<full_path<<endl;
      if(full_path.find("ndigis_")!=string::npos){
      //cout<<"found an ndigi histo now"<<endl;
        MonitorElement * me = bei->get(full_path);
        if(!me) continue;
        //cout<<"got the histo now"<<endl;
        if(me->getEntries()>25){
        //cout<<"histo has more than 50 entries"<<endl;
          if(full_path.find("Barrel")!=string::npos) digiCounterBarrel++;
          if(full_path.find("Endcap")!=string::npos) digiCounterEndcap++;
          //cout<<"counter are now: "<<digiCounterBarrel<<","<<digiCounterBarrelL1<<endl;
        }
      }else if(Tier0Flag && full_path.find("nclusters_OnTrack_")!=string::npos){
        MonitorElement * me = bei->get(full_path);
        if(!me) continue;
        if(me->getEntries()>25){
          if(full_path.find("Barrel")!=string::npos) clusterCounterBarrel++;
          if(full_path.find("Endcap")!=string::npos) clusterCounterEndcap++;
        }
      }else if(!Tier0Flag && full_path.find("nclusters_")!=string::npos){
        MonitorElement * me = bei->get(full_path);
        if(!me) continue;
        if(me->getEntries()>25){
          if(full_path.find("Barrel")!=string::npos) clusterCounterBarrel++;
          if(full_path.find("Endcap")!=string::npos) clusterCounterEndcap++;
        }
      }
    }
  }
  vector<string> subDirVec = bei->getSubdirs();  
  for (vector<string>::const_iterator ic = subDirVec.begin();
       ic != subDirVec.end(); ic++) {
    bei->cd(*ic);
    init=false;
    computeGlobalQualityFlag(bei,init,nFEDs,Tier0Flag);
    bei->goUp();
  }
  
  // Make sure I have finished looping over all Modules/Ladders/Blades:
  if(!Tier0Flag){ // online case
    if(objectCount_ == 1440) DONE_ = true;
  }else{ // offline case
    if(objectCount_ == 288) DONE_ = true;
  } 
  
  if(DONE_ && currDir=="Pixel/EventInfo/reportSummaryContents"){ 

  // Evaluate error flag now, only stored in AdditionalPixelErrors:
  MonitorElement * me_err = bei->get("Pixel/AdditionalPixelErrors/FedETypeNErrArray");
  MonitorElement * me_evt = bei->get("Pixel/EventInfo/processedEvents");
  if(me_err && me_evt){
    for(int i=1; i!=41; i++)for(int j=1; j!=22; j++)
      if(me_err->getBinContent(i,j)>0){
        n_errors_pixel_=n_errors_pixel_+int(me_err->getBinContent(i,j));
        if(i<33) n_errors_barrel_=n_errors_barrel_+int(me_err->getBinContent(i,j));
        if(i>32) n_errors_endcap_=n_errors_endcap_+int(me_err->getBinContent(i,j));
      }
    int NProcEvts = me_evt->getIntValue();
    if(NProcEvts>0){
      barrel_error_flag_ = (float(NProcEvts)-float(n_errors_barrel_))/float(NProcEvts);
      endcap_error_flag_ = (float(NProcEvts)-float(n_errors_endcap_))/float(NProcEvts);
      pixel_error_flag_ = (float(NProcEvts)-float(n_errors_barrel_)-float(n_errors_endcap_))/float(NProcEvts);
    }
  }
  NErrorsBarrel = bei->get("Pixel/Barrel/BarrelNErrorsCut");
  if(NErrorsBarrel) NErrorsBarrel->Fill(barrel_error_flag_);
  NErrorsEndcap = bei->get("Pixel/Endcap/EndcapNErrorsCut");
  if(NErrorsEndcap)   NErrorsEndcap->Fill(endcap_error_flag_);
  
  string meName0;
  MonitorElement * me;
  
  // Fill the Digi flags:
  if(!Tier0Flag){
    meName0 = "Pixel/Barrel/SUMDIG_ndigis_Barrel";
    if(digiCounterBarrel/768 > 0.5) digiStatsBarrel = true;
    if(digiCounterEndcap/672 > 0.5) digiStatsEndcap = true;
    //cout<<"digiStatsBarrel="<<digiStatsBarrel<<" , digiStatsEndcap="<<digiStatsEndcap<<endl;
  }else{
    meName0 = "Pixel/Barrel/SUMOFF_ndigis_Barrel"; 
    if(digiCounterBarrel/192 > 0.5) digiStatsBarrel = true;
    if(digiCounterEndcap/96 > 0.5) digiStatsEndcap = true;
  }
  me = bei->get(meName0);
  if(me){
    NDigisBarrel = bei->get("Pixel/Barrel/BarrelNDigisCut");
   // cout<<"NDigis: "<<NDigisBarrel<<" , "<<digiStatsBarrel<<" , "<<me->hasError()<<endl;
    if(NDigisBarrel && digiStatsBarrel){
      if(me->hasError()) NDigisBarrel->Fill(0);
      else NDigisBarrel->Fill(1); 
    }
  }
  if(!Tier0Flag) meName0 = "Pixel/Endcap/SUMDIG_ndigis_Endcap";
  else meName0 = "Pixel/Endcap/SUMOFF_ndigis_Endcap"; 
  me = bei->get(meName0);
  if(me){
    NDigisEndcap = bei->get("Pixel/Endcap/EndcapNDigisCut");
    if(NDigisEndcap && digiStatsEndcap){
      if(me->hasError()) NDigisEndcap->Fill(0);
      else NDigisEndcap->Fill(1);
    }
  }
  if(!Tier0Flag) meName0 = "Pixel/Barrel/SUMDIG_adc_Barrel";
  else meName0 = "Pixel/Barrel/SUMOFF_adc_Barrel"; 
  me = bei->get(meName0);
  if(me){
    DigiChargeBarrel = bei->get("Pixel/Barrel/BarrelDigiChargeCut");
    if(DigiChargeBarrel && digiStatsBarrel){
      if(me->hasError()) DigiChargeBarrel->Fill(0);
      else DigiChargeBarrel->Fill(1);
    }
  }
  if(!Tier0Flag) meName0 = "Pixel/Endcap/SUMDIG_adc_Endcap";
  else meName0 = "Pixel/Endcap/SUMOFF_adc_Endcap"; 
  me = bei->get(meName0);
  if(me){
    DigiChargeEndcap = bei->get("Pixel/Endcap/EndcapDigiChargeCut");
    if(DigiChargeEndcap && digiStatsEndcap){
      if(me->hasError()) DigiChargeEndcap->Fill(0);
      else DigiChargeEndcap->Fill(1);
    }
  }
     
     
    // Fill the Cluster flags:
  if(!Tier0Flag){
    meName0 = "Pixel/Barrel/SUMCLU_size_Barrel";
    if(clusterCounterBarrel/768 > 0.5) clusterStatsBarrel = true;
    if(clusterCounterEndcap/672 > 0.5) clusterStatsEndcap = true;
  }else{
    meName0 = "Pixel/Barrel/SUMOFF_size_OnTrack_Barrel"; 
    if(clusterCounterBarrel/192 > 0.5) clusterStatsBarrel = true;
    if(clusterCounterEndcap/96 > 0.5) clusterStatsEndcap = true;
  }
  me = bei->get(meName0);
  if(me){
    ClusterSizeBarrel = bei->get("Pixel/Barrel/BarrelClusterSizeCut");
    if(ClusterSizeBarrel && clusterStatsBarrel){
      if(me->hasError()) ClusterSizeBarrel->Fill(0);
      else ClusterSizeBarrel->Fill(1);
    }
  }
  if(!Tier0Flag) meName0 = "Pixel/Endcap/SUMCLU_size_Endcap";
  else meName0 = "Pixel/Endcap/SUMOFF_size_OnTrack_Endcap"; 
  me = bei->get(meName0);
  if(me){
    ClusterSizeEndcap = bei->get("Pixel/Endcap/EndcapClusterSizeCut");
    if(ClusterSizeEndcap && clusterStatsEndcap){
      if(me->hasError()) ClusterSizeEndcap->Fill(0);
      else ClusterSizeEndcap->Fill(1);
    }
  }
  if(!Tier0Flag) meName0 = "Pixel/Barrel/SUMCLU_charge_Barrel";
  else meName0 = "Pixel/Barrel/SUMOFF_charge_OnTrack_Barrel"; 
  me = bei->get(meName0);
  if(me){
    ClusterChargeBarrel = bei->get("Pixel/Barrel/BarrelClusterChargeCut");
    if(ClusterChargeBarrel && clusterStatsBarrel){
      if(me->hasError()) ClusterChargeBarrel->Fill(0);
      else ClusterChargeBarrel->Fill(1);
    }
  }
  if(!Tier0Flag) meName0 = "Pixel/Endcap/SUMCLU_charge_Endcap";
  else meName0 = "Pixel/Endcap/SUMOFF_charge_OnTrack_Endcap"; 
  me = bei->get(meName0);
  if(me){
    ClusterChargeEndcap = bei->get("Pixel/Endcap/EndcapClusterChargeCut");
    if(ClusterChargeEndcap && clusterStatsEndcap){
      if(me->hasError()) ClusterChargeEndcap->Fill(0);
      else ClusterChargeEndcap->Fill(1);
    }
  }
  if(!Tier0Flag) meName0 = "Pixel/Barrel/SUMCLU_nclusters_Barrel";
  else meName0 = "Pixel/Barrel/SUMOFF_nclusters_OnTrack_Barrel"; 
  me = bei->get(meName0);
  if(me){
    NClustersBarrel = bei->get("Pixel/Barrel/BarrelNClustersCut");
    if(NClustersBarrel && clusterStatsBarrel){
      if(me->hasError()) NClustersBarrel->Fill(0);
      else NClustersBarrel->Fill(1);
    }
  }
  if(!Tier0Flag) meName0 = "Pixel/Endcap/SUMCLU_nclusters_Endcap";
  else meName0 = "Pixel/Endcap/SUMOFF_nclusters_OnTrack_Endcap"; 
  me = bei->get(meName0);
  if(me){
    NClustersEndcap = bei->get("Pixel/Endcap/EndcapNClustersCut");
    if(NClustersEndcap && clusterStatsEndcap){
      if(me->hasError()) NClustersEndcap->Fill(0);
      else NClustersEndcap->Fill(1);
    }
  }
  // Pixel Track multiplicity / Pixel hit efficiency
  meName0 = "Pixel/Tracks/ntracks_generalTracks";
  me = bei->get(meName0);
  if(me){
    NPixelTracks = bei->get("Pixel/Tracks/PixelTracksCut");
    if(NPixelTracks && me->getBinContent(1)>1000){
      if((float)me->getBinContent(2)/(float)me->getBinContent(1)<0.01){
        NPixelTracks->Fill(0);
      }else{ 
        NPixelTracks->Fill(1);
      }
    }
  }
  
  
//********************************************************************************************************  
  
  // Final combination of all Data Quality results:
  float pixelFlag = -1., barrelFlag = -1., endcapFlag = -1.;
  float barrel_errors_temp[1]={-1.}; int barrel_cuts_temp[5]={5*-1}; 
  float endcap_errors_temp[1]={-1.}; int endcap_cuts_temp[5]={5*-1}; 
  int pixel_cuts_temp[1]={-1};
  float combinedCuts = 1.; int numerator = 0, denominator = 0;

  // Barrel results:
  me = bei->get("Pixel/Barrel/BarrelNErrorsCut");
  if(me) barrel_errors_temp[0] = me->getFloatValue();
  me = bei->get("Pixel/Barrel/BarrelNDigisCut");
  if(me) barrel_cuts_temp[0] = me->getIntValue();
  me = bei->get("Pixel/Barrel/BarrelDigiChargeCut");
  if(me) barrel_cuts_temp[1] = me->getIntValue();
  me = bei->get("Pixel/Barrel/BarrelClusterSizeCut");
  if(me) barrel_cuts_temp[2] = me->getIntValue();
  me = bei->get("Pixel/Barrel/BarrelNClustersCut");
  if(me) barrel_cuts_temp[3] = me->getIntValue();
  me = bei->get("Pixel/Barrel/BarrelClusterChargeCut");
  if(me) barrel_cuts_temp[4] = me->getIntValue();
  for(int k=0; k!=5; k++){
    if(barrel_cuts_temp[k]>=0){
      numerator = numerator + barrel_cuts_temp[k];
      denominator++;
      //cout<<"cut flag, Barrel: "<<k<<","<<barrel_cuts_temp[k]<<","<<numerator<<","<<denominator<<endl;
    }
  } 
  if(denominator!=0) combinedCuts = float(numerator)/float(denominator);  
  barrelFlag = barrel_errors_temp[0] * combinedCuts;
  
  
  //cout<<" the resulting barrel flag is: "<<barrel_errors_temp[0]<<"*"<<combinedCuts<<"="<<barrelFlag<<endl;
  
  // Endcap results:
  combinedCuts = 1.; numerator = 0; denominator = 0;
  me = bei->get("Pixel/Endcap/EndcapNErrorsCut");
  if(me) endcap_errors_temp[0] = me->getFloatValue();
  me = bei->get("Pixel/Endcap/EndcapNDigisCut");
  if(me) endcap_cuts_temp[0] = me->getIntValue();
  me = bei->get("Pixel/Endcap/EndcapDigiChargeCut");
  if(me) endcap_cuts_temp[1] = me->getIntValue();
  me = bei->get("Pixel/Endcap/EndcapClusterSizeCut");
  if(me) endcap_cuts_temp[2] = me->getIntValue();
  me = bei->get("Pixel/Endcap/EndcapNClustersCut");
  if(me) endcap_cuts_temp[3] = me->getIntValue();
  me = bei->get("Pixel/Endcap/EndcapClusterChargeCut");
  if(me) endcap_cuts_temp[4] = me->getIntValue();
  for(int k=0; k!=5; k++){
    if(endcap_cuts_temp[k]>=0){
      numerator = numerator + endcap_cuts_temp[k];
      denominator++;
      //cout<<"cut flag, Endcap: "<<k<<","<<endcap_cuts_temp[k]<<","<<numerator<<","<<denominator<<endl;
    }
  } 
  if(denominator!=0) combinedCuts = float(numerator)/float(denominator);  
  endcapFlag = endcap_errors_temp[0] * combinedCuts;
  //cout<<" the resulting endcap flag is: "<<endcap_errors_temp[0]<<"*"<<combinedCuts<<"="<<endcapFlag<<endl;
  
  // Track results:
  combinedCuts = 1.; numerator = 0; denominator = 0;
  me = bei->get("Pixel/Tracks/PixelTracksCut");
  if(me) pixel_cuts_temp[0] = me->getIntValue();

  //Combination of all:
  combinedCuts = 1.; numerator = 0; denominator = 0;
  for(int k=0; k!=5; k++){
    if(barrel_cuts_temp[k]>=0){
      numerator = numerator + barrel_cuts_temp[k];
      denominator++;
    }
    //cout<<"after barrel: num="<<numerator<<" , den="<<denominator<<endl;
    if(endcap_cuts_temp[k]>=0){
      numerator = numerator + endcap_cuts_temp[k];
      denominator++;
    }
    if(k<1 && pixel_cuts_temp[k]>=0){
      numerator = numerator + pixel_cuts_temp[k];
      denominator++;
    }
    //cout<<"after both: num="<<numerator<<" , den="<<denominator<<endl;
  } 
  if(denominator!=0) combinedCuts = float(numerator)/float(denominator); 
  pixelFlag = float(pixel_error_flag_) * float(combinedCuts);
  
  
  //cout<<"barrel, endcap, pixel flags: "<<barrelFlag<<","<<endcapFlag<<","<<pixelFlag<<endl;
  SummaryPixel = bei->get("Pixel/EventInfo/reportSummary");
  if(SummaryPixel) SummaryPixel->Fill(pixelFlag);
  SummaryBarrel = bei->get("Pixel/EventInfo/reportSummaryContents/PixelBarrelFraction");
  if(SummaryBarrel) SummaryBarrel->Fill(barrelFlag);
  SummaryEndcap = bei->get("Pixel/EventInfo/reportSummaryContents/PixelEndcapFraction");
  if(SummaryEndcap)   SummaryEndcap->Fill(endcapFlag);
  }
}
void SiPixelDataQuality::computeGlobalQualityFlagByLumi ( DQMStore bei,
bool  init,
int  nFEDs,
bool  Tier0Flag,
int  nEvents_lastLS_ 
)

Definition at line 618 of file SiPixelDataQuality.cc.

References MonitorElement::Fill(), DQMStore::get(), MonitorElement::getBinContent(), SummaryBarrel, SummaryEndcap, and SummaryPixel.

Referenced by SiPixelEDAClient::endLuminosityBlock().

                                                                               {
//cout<<"entering SiPixelDataQuality::ComputeGlobalQualityFlagByLumi"<<endl;
//   cout << ACRed << ACBold
//        << "[SiPixelDataQuality::ComputeGlobalQualityFlag]"
//        << ACPlain
//        << " Enter" 
//        << endl ;

  if(nFEDs==0) return;  
  
  float BarrelRate_LS = 0.;
  float EndcapRate_LS = 0.;
  float PixelRate_LS = 0.;
  MonitorElement * me = bei->get("Pixel/AdditionalPixelErrors/byLumiErrors");
  if(me){
    double nEvents_LS = me->getBinContent(0) - nEvents_lastLS_;
    double nBarrelErrors_LS = me->getBinContent(1);
    double nEndcapErrors_LS = me->getBinContent(2);
    BarrelRate_LS = nBarrelErrors_LS / nEvents_LS / 32.; // normalize to nevents and nFEDchannels
    EndcapRate_LS = nEndcapErrors_LS / nEvents_LS / 8.;
    PixelRate_LS = (nBarrelErrors_LS + nEndcapErrors_LS) / nEvents_LS / 40.;
    //std::cout<<"nEvents_LS: "<<nEvents_LS<<" , nBarrelErrors_LS: "<<nBarrelErrors_LS<<" , nEndcapErrors_LS: "<<nEndcapErrors_LS<<" , BarrelRate_LS: "<<BarrelRate_LS<<" , EndcapRate_LS: "<<EndcapRate_LS<<" , PixelRate_LS: "<<PixelRate_LS<<std::endl;
  }
  
  float pixelFlag = 1.-PixelRate_LS;
  float barrelFlag = 1.-BarrelRate_LS;
  float endcapFlag = 1.-EndcapRate_LS;
  
  //cout<<"barrel, endcap, pixel flags: "<<barrelFlag<<","<<endcapFlag<<","<<pixelFlag<<endl;
  SummaryPixel = bei->get("Pixel/EventInfo/reportSummary");
  if(SummaryPixel) SummaryPixel->Fill(pixelFlag);
  SummaryBarrel = bei->get("Pixel/EventInfo/reportSummaryContents/PixelBarrelFraction");
  if(SummaryBarrel) SummaryBarrel->Fill(barrelFlag);
  SummaryEndcap = bei->get("Pixel/EventInfo/reportSummaryContents/PixelEndcapFraction");
  if(SummaryEndcap)   SummaryEndcap->Fill(endcapFlag);
  
}
void SiPixelDataQuality::fillGlobalQualityPlot ( DQMStore bei,
bool  init,
edm::EventSetup const &  eSetup,
int  nFEDs,
bool  Tier0Flag,
int  lumisec 
)

Definition at line 662 of file SiPixelDataQuality.cc.

References allmodsMap, allmodsVec, DQMStore::cd(), cmsMakeMELists::contents, count, count1, count2, count3, count4, count5, count6, gather_cfg::cout, errcount, errmodsMap, errmodsVec, edm::EventSetup::get(), DQMStore::get(), getDetId(), MonitorElement::getEntries(), MonitorElement::getFloatValue(), MonitorElement::getIntValue(), DQMStore::getMEs(), DQMStore::getSubdirs(), goodmodsMap, goodmodsVec, DQMStore::goUp(), i, j, lastLS_, modCounter_, nevents, edm::ESHandle< T >::product(), DQMStore::pwd(), MonitorElement::setBinContent(), SummaryReportMap, theCablingMap, and CommonMethods::weight().

Referenced by SiPixelEDAClient::endLuminosityBlock(), and SiPixelEDAClient::endRun().

                                                                                                                                            {
//std::cout<<"Entering SiPixelDataQuality::fillGlobalQualityPlot: "<<nFEDs<<std::endl;
  //calculate eta and phi of the modules and fill a 2D plot:
  if(lastLS_<lumisec){ cout<<"lastLS_="<<lastLS_<<" ,lumisec="<<lumisec<<endl; lastLS_=lumisec; init=true; cout<<"init="<<init<<endl; }
  if(init){
    count=0; errcount=0;
    init=false;
    count1=0;
    count2=0;
    count3=0;
    count4=0;
    count5=0;
    count6=0;
    modCounter_=0;
  if(!Tier0Flag){
  cout<<"RESETS"<<endl;
    for(int j=1; j!=41; j++){
      if(allmodsVec) allmodsVec->SetBinContent(j,0.);
      if(errmodsVec) errmodsVec->SetBinContent(j,0.);
      if(goodmodsVec) goodmodsVec->SetBinContent(j,0.);
    }
  }
  if(Tier0Flag){
    for(int i=1; i!=3; i++) for(int j=1; j!=8; j++){
      if(allmodsMap) allmodsMap->SetBinContent(i,j,0.);
      if(errmodsMap) errmodsMap->SetBinContent(i,j,0.);
      if(goodmodsMap) goodmodsMap->SetBinContent(i,j,0.);
    }
  }
  }
  
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
// Fill Maps:
  // Online:    
  if(nFEDs==0) return;
/*  if(!Tier0Flag){
    eSetup.get<SiPixelFedCablingMapRcd>().get(theCablingMap);
    string currDir = bei->pwd();
    if(currDir.find("Reference")!=string::npos) return;
    //cout<<"currDir="<<currDir<<endl;
    string dname = currDir.substr(currDir.find_last_of("/")+1);
    // find a detId for Blades and Ladders (first of the contained Modules!):
    ifstream infile(edm::FileInPath("DQM/SiPixelMonitorClient/test/detId.dat").fullPath().c_str(),ios::in);
    string I_name[1440];
    int I_detId[1440];
    int I_fedId[1440];
    int I_linkId[1440];
    int nModsInFile=0;
    while(!infile.eof()) {
      infile >> I_name[nModsInFile] >> I_detId[nModsInFile] >> I_fedId[nModsInFile] >> I_linkId[nModsInFile] ;
      //cout<<I_name<<" "<<I_detId<<" "<<I_fedId<<" "<<I_linkId ;
      //getline(infile,dummys); //necessary to reach end of record
      infile.close();
      nModsInFile++;
    }
    if(dname.find("Module_")!=string::npos && currDir.find("Reference")==string::npos){
      vector<string> meVec = bei->getMEs();
      int detId=-1; int fedId=-1; int linkId=-1;
      for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
        //checking for any digis or FED errors to decide if this module is in DAQ:  
        string full_path = currDir + "/" + (*it);
        //cout<<"path: "<<full_path<<" , detId= "<<detId<<endl;
        if(detId==-1 && full_path.find("SUMOFF")==string::npos &&
           (full_path.find("ndigis")!=string::npos && full_path.find("SUMDIG")==string::npos) && 
           (getDetId(bei->get(full_path)) > 100)){
          //cout<<"Got into the first ndigis or NErrors histogram!"<<endl;
          MonitorElement * me = bei->get(full_path);
          if (!me) continue;
          if((full_path.find("ndigis")!=string::npos)){ 
            modCounter_++;
            detId = getDetId(me);
            for(int fedid=0; fedid!=40; ++fedid){
              SiPixelFrameConverter converter(theCablingMap.product(),fedid);
              uint32_t newDetId = detId;
              if(converter.hasDetUnit(newDetId)){
                fedId=fedid;
                break;   
              }
            }
            if(fedId==-1) continue; 
            sipixelobjects::ElectronicIndex cabling; 
            SiPixelFrameConverter formatter(theCablingMap.product(),fedId);
            sipixelobjects::DetectorIndex detector = {detId, 1, 1};      
            formatter.toCabling(cabling,detector);
            linkId = cabling.link;
            //cout<<"it has this FED ID and channel ID: "<<fedId<<" , "<<linkId<<endl;
            int NDigis = 0;
            if(full_path.find("ndigis")!=string::npos) NDigis = me->getEntries(); 
            float weight = (allmodsMap->GetBinContent(fedId+1,linkId))+NDigis;
            allmodsMap->Fill(fedId,linkId,weight);
            static const char buf[] = "Pixel/AdditionalPixelErrors/FED_%d/FedChNErrArray_%d";
            char fedplot[sizeof(buf)+4]; 
            sprintf(fedplot,buf,fedId,linkId);
            me = bei->get(fedplot);
            int NErrors = 0;
            if(me) NErrors = me->getIntValue();
            //if(fedId==37&&linkId==5) std::cout<<"THIS CHANNEL: "<<fedplot<<" , "<<NErrors<<" , "<<bei->pwd()<<std::endl;
            if(NErrors>0) {errmodsMap->Fill(fedId,linkId,NErrors);} //if(fedId==37&&linkId==5) std::cout<<"filling errmodsMap now : "<<errmodsMap->GetBinContent(fedId+1,linkId)<<" , and: "<<NErrors<<std::endl;}
          }
        }
      }//end loop over MEs
    }//end of module dir's
    vector<string> subDirVec = bei->getSubdirs();  
    for (vector<string>::const_iterator ic = subDirVec.begin();
         ic != subDirVec.end(); ic++) {
      bei->cd(*ic);
      init=false;
      fillGlobalQualityPlot(bei,init,eSetup,nFEDs,Tier0Flag);
      bei->goUp();
    }
    if(modCounter_==1440){
      bei->cd("Pixel/EventInfo/reportSummaryContents");
      //cout<<"B: Loop over all modules is done, now I am in    "<<bei->pwd()<<"     and currDir is    "<<currDir<<endl;
      if(bei->pwd()=="Pixel/EventInfo/reportSummaryContents"){
        SummaryReportMap = bei->get("Pixel/EventInfo/reportSummaryMap");
        if(SummaryReportMap){ 
          float contents=0.;
          for(int i=0; i!=40; i++)for(int j=1; j!=37; j++){
            //cout<<"bin: "<<i<<","<<j<<endl;
            if((allmodsMap->GetBinContent(i+1,j)) + (errmodsMap->GetBinContent(i+1,j)) > 0){
              contents = (allmodsMap->GetBinContent(i+1,j))/((allmodsMap->GetBinContent(i+1,j))+(errmodsMap->GetBinContent(i+1,j)));
            }else{
              contents = -1.;
            }
            //if(contents>=0.&&contents<0.8) std::cout<<"HERE: "<<i<<" , "<<j<<" , "<<allmodsMap->GetBinContent(i+1,j)<<" , "<<errmodsMap->GetBinContent(i+1,j)<<std::endl;
            if(i==13&&j==17&&contents>0) count1++;
            if(i==13&&j==18&&contents>0) count2++;
            if(i==15&&j==5&&contents>0) count3++;
            if(i==15&&j==6&&contents>0) count4++;
            //cout<<"\t\t MAP: "<<i<<","<<j<<","<<contents<<endl;
            if(((i==0||i==2||i==3||i==5||i==11||i==8)&&(j==1||j==8||j==13||j==17||j==20))||
               ((i==1||i==9||i==10||i==13)&&(j==1||j==5||j==8||j==20||j==22))||
               ((i==4||i==12)&&(j==5||j==10||j==13||j==17||j==22))||
               ((i==2||i==5||i==6||i==7||i==14)&&(j==5||j==10||j==22))||
               ((i==7||i==10)&&(j==13||j==17))||
               ((i==6||i==14)&&(j==1||j==20))||
               ((i==10||i==13)&&(j==10))||
               ((i==4||i==12)&&(j==2))||
               ((i==14)&&(j==15))){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j+1));
            }else if(((i==16||i==19||i==21||i==24||i==26||i==27||i==29)&&(j==2||j==9||j==14||j==18||j==21))||
               ((i==17||i==18||i==25)&&(j==2||j==6||j==9||j==21||j==23))||
               ((i==20||i==23||i==28||i==31)&&(j==6||j==11||j==14||j==18||j==23))||
               ((i==21||i==22||i==26||i==29||i==30)&&(j==6||j==11||j==23))||
               ((i==18)&&(j==14||j==18))||
               ((i==22||i==30)&&(j==2||j==21))||
               ((i==18)&&(j==11))||
               ((i==17||i==25)&&(j==16))||
               ((i==19||i==27)&&(j==5))){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j-1));
            }else if(i==6&&(j==14||j==15)){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j+2));
            }else if((i==14)&&j==14){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j+3));
            }else if((i==17||i==25)&&j==17){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j-3));
            }else if(((i==0||i==2||i==3||i==5||i==8||i==10||i==11||i==13)&&(j==3||j==15))||
                     ((i==1||i==9)&&j==3)||
                     ((i==7||i==12||i==15)&&j==15)){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j+4));
            }else if(((i==16||i==18||i==19||i==21||i==24||i==26||i==27||i==29)&&(j==7||j==19))||
                     ((i==17||i==25)&&j==7)||
                     ((i==20||i==23||i==28||i==31)&&j==19)){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j-4));
            }else if((i==6||i==14)&&(j==13||j==19)){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j+5));
            }else if((i==17||i==25)&&(j==18||j==24)){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j-5));
            }else if(((i==4||i==12)&&j==1)||
                     ((i==3||i==11)&&j==6)){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j+6));
            }else if((i==9||i==1)&&j==4){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j+8));
            }else if((i==17||i==25)&&j==12){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j-8));
            }else if(((i==20||i==28)&&j==20)||
                     ((i==19||i==27)&&j==22)){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j-11));
            }else if(((i==20||i==28)&&j==21)||
                     ((i==19||i==27)&&j==23)){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j-13));
            }else{
              SummaryReportMap->setBinContent(i+1,j,contents);
            }
          }//end for loop over summaryReportMap bins
          for(int i=0; i!=40; i++)for(int j=1; j!=37; j++){ // catch the last few holes...
            if(((i==2||i==4||i==5||i==6||i==7||i==10||i==12||i==13||i==14||i==15)&&j==12)||
               ((i==0||i==2||i==3||i==4||i==5||i==7||i==8||i==10||i==11||i==12||i==13||i==15)&&j==24)){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j-8));
            }else if(((i==18||i==20||i==21||i==22||i==23||i==26||i==28||i==29||i==30||i==31)&&j==4)||
               ((i==16||i==18||i==19||i==20||i==21||i==23||i==24||i==26||i==27||i==28||i==29||i==31)&&j==16)){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j+8));
            }else if(((i==6||i==14)&&j==9)||
                     ((i==3||i==11)&&j==5)||
                     ((i==1||i==9)&&(j==11||j==16))){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j-1));
            }else if(((i==17||i==25)&&j==10)||
                     ((i==22||i==30)&&(j==8||j==15))||
                     ((i==20||i==28)&&(j==2))){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j+1));
            }else if((i==1||i==9)&&j==17){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j-3));
            }else if((i==22||i==30)&&j==14){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j+3));
            }else if((i==6||i==14)&&j==7){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j-4));
            }else if((i==22||i==30)&&j==3){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j+4));
            }else if((i==1||i==9)&&(j==18||j==24)){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j-5));
            }else if((i==22||i==30)&&(j==13||j==19)){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j+5));
            }else if(((i==20||i==28)&&j==1)||
                     ((i==19||i==27)&&j==6)){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j+6));
            }else if(((i==4||i==12)&&j==20)||
                     ((i==3||i==11)&&j==22)){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j-11));
            }else if(((i==4||i==12)&&j==21)||
                     ((i==3||i==11)&&j==23)){
              SummaryReportMap->setBinContent(i+1,j,SummaryReportMap->getBinContent(i+1,j-13));
            }
          }//end of loop over bins
          //std::cout<<"COUNTERS: "<<count1<<" , "<<count2<<" , "<<count3<<" , "<<count4<<" , "<<count5<<" , "<<count6<<std::endl;
        }//end if reportSummaryMap ME exists
      }//end if in summary directory
    }//end if modCounter_  
*/
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
  if(!Tier0Flag){
    eSetup.get<SiPixelFedCablingMapRcd>().get(theCablingMap);
    string currDir = bei->pwd();
    if(currDir.find("Reference")!=string::npos || currDir.find("Additional")!=string::npos) return;
    //cout<<"currDir="<<currDir<<endl;
    string dname = currDir.substr(currDir.find_last_of("/")+1);
    if(dname.find("Module_")!=string::npos && currDir.find("Reference")==string::npos){
      vector<string> meVec = bei->getMEs();
      int detId=-1; int fedId=-1;
      for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++){//loop over all modules and fill ndigis into allmodsMap
        //checking for any digis or FED errors to decide if this module is in DAQ:  
        string full_path = currDir + "/" + (*it);
        if(detId==-1 && full_path.find("SUMOFF")==string::npos &&
           (full_path.find("ndigis")!=string::npos && full_path.find("SUMDIG")==string::npos) && 
           (getDetId(bei->get(full_path)) > 100)){
          MonitorElement * me = bei->get(full_path);
          if (!me) continue;
          if((full_path.find("ndigis")!=string::npos)){ 
            modCounter_++;
            detId = getDetId(me);
            for(int fedid=0; fedid!=40; ++fedid){
              SiPixelFrameConverter converter(theCablingMap.product(),fedid);
              uint32_t newDetId = detId;
              if(converter.hasDetUnit(newDetId)){
                fedId=fedid;
                break;   
              }
            }
            double NDigis = 0;
            if(full_path.find("ndigis")!=string::npos) NDigis = me->getEntries(); 
            float weight = (allmodsVec->GetBinContent(fedId+1))+NDigis;
            //cout<<"DIGIS: "<<currDir<<" , "<<fedId<<" , "<<weight<<" , "<<NDigis<<endl;
            allmodsVec->SetBinContent(fedId+1,weight);
            //cout<<"\t filled: "<<allmodsVec->GetBinContent(fedId+1,weight)<<endl;
          }
        }
      }//end loop over MEs
    }//end of module dir's
    //if(currDir.find("FED_")!=std::string::npos){
      //fillGlobalQualityPlot(bei,init,eSetup,nFEDs,Tier0Flag,lumisec);
      //bei->goUp();
    //}
    vector<string> subDirVec = bei->getSubdirs();  
    for (vector<string>::const_iterator ic = subDirVec.begin();
         ic != subDirVec.end(); ic++) {
      bei->cd(*ic);
      init=false;
      fillGlobalQualityPlot(bei,init,eSetup,nFEDs,Tier0Flag,lumisec);
      bei->goUp();
    }
    //cout<<"modCounter_: "<<modCounter_<<" , "<<bei->pwd()<<endl;
    if(modCounter_==1440){
      bei->cd("Pixel/EventInfo/reportSummaryContents");
      if(bei->pwd()=="Pixel/EventInfo/reportSummaryContents"){
        for(int i=0; i!=40; i++){//loop over FEDs to fetch the errors
          static const char buf[] = "Pixel/AdditionalPixelErrors/FED_%d/FedChNErrArray_%d";
          char fedplot[sizeof(buf)+4]; 
          int NErrors = 0;
          for(int j=0; j!=37; j++){//loop over FED channels within a FED
            sprintf(fedplot,buf,i,j);
            MonitorElement * me = bei->get(fedplot);
            if(me) NErrors = NErrors + me->getIntValue();
          }
          if(NErrors>0){ errmodsVec->Fill(i,NErrors); } 
        }
        SummaryReportMap = bei->get("Pixel/EventInfo/reportSummaryMap");
        if(SummaryReportMap){ 
          MonitorElement * me = bei->get("Pixel/EventInfo/processedEvents");
          int nevents = 0;
          if(me) nevents = me->getIntValue();
          float contents=0.;
          for(int i=1; i!=41; i++){
            if((allmodsVec->GetBinContent(i)) + (errmodsVec->GetBinContent(i)) > 0){
              contents = (allmodsVec->GetBinContent(i))/((allmodsVec->GetBinContent(i))+(errmodsVec->GetBinContent(i)));
              //cout<<"Fed: "<<i-1<<" , nevents: "<<nevents<<" , ndigis: "<<(allmodsVec->GetBinContent(i))<<" , nerrors: "<<errmodsVec->GetBinContent(i)<<endl;
            }else{
              contents = -1.;
            }
            SummaryReportMap->setBinContent(lumisec+1,i,contents);
          }//end for loop over summaryReportMap bins
        }//end if reportSummaryMap ME exists
      }//end if in summary directory
    }//end if modCounter_  
  }else{ // Offline
    float barrel_errors_temp[1]={-1.}; int barrel_cuts_temp[6]={6*-1}; 
    float endcap_errors_temp[1]={-1.}; int endcap_cuts_temp[6]={6*-1}; 
    int pixel_cuts_temp[1]={-1};
    // Barrel results:
    MonitorElement * me;
    me = bei->get("Pixel/Barrel/BarrelNErrorsCut");
    if(me) barrel_errors_temp[0] = me->getFloatValue();
    me = bei->get("Pixel/Endcap/EndcapNErrorsCut");
    if(me) endcap_errors_temp[0] = me->getFloatValue();
    SummaryReportMap->setBinContent(1,1,barrel_errors_temp[0]);
    SummaryReportMap->setBinContent(2,1,endcap_errors_temp[0]);
    me = bei->get("Pixel/Barrel/BarrelNDigisCut");
    if(me) barrel_cuts_temp[0] = me->getIntValue();
    me = bei->get("Pixel/Barrel/BarrelDigiChargeCut");
    if(me) barrel_cuts_temp[1] = me->getIntValue();
    me = bei->get("Pixel/Barrel/BarrelClusterSizeCut");
    if(me) barrel_cuts_temp[2] = me->getIntValue();
    me = bei->get("Pixel/Barrel/BarrelNClustersCut");
    if(me) barrel_cuts_temp[3] = me->getIntValue();
    me = bei->get("Pixel/Barrel/BarrelClusterChargeCut");
    if(me) barrel_cuts_temp[4] = me->getIntValue();  
    me = bei->get("Pixel/Endcap/EndcapNDigisCut");
    if(me) endcap_cuts_temp[0] = me->getIntValue();
    me = bei->get("Pixel/Endcap/EndcapDigiChargeCut");
    if(me) endcap_cuts_temp[1] = me->getIntValue();
    me = bei->get("Pixel/Endcap/EndcapClusterSizeCut");
    if(me) endcap_cuts_temp[2] = me->getIntValue();
    me = bei->get("Pixel/Endcap/EndcapNClustersCut");
    if(me) endcap_cuts_temp[3] = me->getIntValue();
    me = bei->get("Pixel/Endcap/EndcapClusterChargeCut");
    if(me) endcap_cuts_temp[4] = me->getIntValue();  
    for(int j=2; j!=7; j++){
      SummaryReportMap->setBinContent(1,j,barrel_cuts_temp[j-2]);
      SummaryReportMap->setBinContent(2,j,endcap_cuts_temp[j-2]);
      //cout<<"error cut values: "<<j<<" , "<<barrel_cuts_temp[j-2]<<" , "<<endcap_cuts_temp[j-2]<<endl;
    }
    me = bei->get("Pixel/Tracks/PixelTracksCut");
    if(me) pixel_cuts_temp[0] = me->getIntValue();  
    SummaryReportMap->setBinContent(1,7,pixel_cuts_temp[0]);
    SummaryReportMap->setBinContent(2,7,pixel_cuts_temp[0]);
  }//end of offline map
  if(allmodsMap) allmodsMap->Clear();
  if(goodmodsMap) goodmodsMap->Clear();
  if(errmodsMap) errmodsMap->Clear();
}
int SiPixelDataQuality::getDetId ( MonitorElement mE)

(Documentation under construction).

Given a pointer to ME returns the associated detId

Definition at line 109 of file SiPixelDataQuality.cc.

References MonitorElement::getName().

Referenced by fillGlobalQualityPlot().

{
 string mEName = mE->getName() ;

 int detId = 0;
 
 if( mEName.find("_3") != string::npos )
 {
  string detIdString = mEName.substr((mEName.find_last_of("_"))+1,9);
  std::istringstream isst;
  isst.str(detIdString);
  isst>>detId;
// } else {
//  cout << ACYellow << ACBold
//       << "[SiPixelInformationExtractor::getDetId()] "
//       << ACPlain
//       << "Could not extract detId from "
//       << mEName
//       << endl ;
 }
      
  return detId ;
  
}

Member Data Documentation

Definition at line 105 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag(), and SiPixelDataQuality().

Definition at line 112 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

Definition at line 105 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

Definition at line 128 of file SiPixelDataQuality.h.

Referenced by bookGlobalQualityFlag(), and computeGlobalQualityFlag().

Definition at line 129 of file SiPixelDataQuality.h.

Referenced by bookGlobalQualityFlag(), and computeGlobalQualityFlag().

Definition at line 115 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

Definition at line 117 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

Definition at line 126 of file SiPixelDataQuality.h.

Referenced by bookGlobalQualityFlag(), and computeGlobalQualityFlag().

Definition at line 127 of file SiPixelDataQuality.h.

Referenced by bookGlobalQualityFlag(), and computeGlobalQualityFlag().

Definition at line 114 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

Definition at line 116 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

Definition at line 86 of file SiPixelDataQuality.h.

Referenced by fillGlobalQualityPlot().

Definition at line 136 of file SiPixelDataQuality.h.

Referenced by fillGlobalQualityPlot().

Definition at line 137 of file SiPixelDataQuality.h.

Referenced by fillGlobalQualityPlot().

Definition at line 138 of file SiPixelDataQuality.h.

Referenced by fillGlobalQualityPlot().

Definition at line 139 of file SiPixelDataQuality.h.

Referenced by fillGlobalQualityPlot().

Definition at line 140 of file SiPixelDataQuality.h.

Referenced by fillGlobalQualityPlot().

Definition at line 141 of file SiPixelDataQuality.h.

Referenced by fillGlobalQualityPlot().

Definition at line 122 of file SiPixelDataQuality.h.

Referenced by bookGlobalQualityFlag(), and computeGlobalQualityFlag().

Definition at line 123 of file SiPixelDataQuality.h.

Referenced by bookGlobalQualityFlag(), and computeGlobalQualityFlag().

Definition at line 115 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

Definition at line 117 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

Definition at line 114 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

Definition at line 116 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

bool SiPixelDataQuality::DONE_ [private]

Definition at line 91 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

Definition at line 112 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

Definition at line 105 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

Definition at line 96 of file SiPixelDataQuality.h.

Definition at line 87 of file SiPixelDataQuality.h.

Referenced by fillGlobalQualityPlot().

Definition at line 105 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag(), and SiPixelDataQuality().

Definition at line 88 of file SiPixelDataQuality.h.

Definition at line 145 of file SiPixelDataQuality.h.

Referenced by fillGlobalQualityPlot(), and SiPixelDataQuality().

Definition at line 144 of file SiPixelDataQuality.h.

Referenced by fillGlobalQualityPlot().

ofstream SiPixelDataQuality::myfile_ [private]

Definition at line 94 of file SiPixelDataQuality.h.

Definition at line 111 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

Definition at line 111 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

Definition at line 111 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

Definition at line 130 of file SiPixelDataQuality.h.

Referenced by bookGlobalQualityFlag(), and computeGlobalQualityFlag().

Definition at line 131 of file SiPixelDataQuality.h.

Referenced by bookGlobalQualityFlag(), and computeGlobalQualityFlag().

Definition at line 120 of file SiPixelDataQuality.h.

Referenced by bookGlobalQualityFlag(), and computeGlobalQualityFlag().

Definition at line 121 of file SiPixelDataQuality.h.

Referenced by bookGlobalQualityFlag(), and computeGlobalQualityFlag().

Definition at line 108 of file SiPixelDataQuality.h.

Referenced by bookGlobalQualityFlag(), and computeGlobalQualityFlag().

Definition at line 109 of file SiPixelDataQuality.h.

Referenced by bookGlobalQualityFlag(), and computeGlobalQualityFlag().

Definition at line 110 of file SiPixelDataQuality.h.

Referenced by bookGlobalQualityFlag().

Definition at line 95 of file SiPixelDataQuality.h.

Definition at line 134 of file SiPixelDataQuality.h.

Referenced by bookGlobalQualityFlag(), and computeGlobalQualityFlag().

Definition at line 90 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

Definition at line 77 of file SiPixelDataQuality.h.

Definition at line 112 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

float SiPixelDataQuality::qflag_ [private]

Definition at line 104 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag(), and SiPixelDataQuality().

Definition at line 100 of file SiPixelDataQuality.h.

Referenced by bookGlobalQualityFlag(), and fillGlobalQualityPlot().

Definition at line 97 of file SiPixelDataQuality.h.

Referenced by fillGlobalQualityPlot().

Definition at line 143 of file SiPixelDataQuality.h.

Referenced by SiPixelDataQuality().

Definition at line 115 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

Definition at line 117 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

Definition at line 114 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().

Definition at line 116 of file SiPixelDataQuality.h.

Referenced by computeGlobalQualityFlag().