CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

DTChamberEfficiencyClient Class Reference

#include <DTChamberEfficiencyClient.h>

Inheritance diagram for DTChamberEfficiencyClient:
edm::EDAnalyzer

List of all members.

Public Member Functions

 DTChamberEfficiencyClient (const edm::ParameterSet &ps)
 Constructor.
virtual ~DTChamberEfficiencyClient ()
 Destructor.

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
void beginJob ()
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 DQM Client Diagnostic.
void beginRun (const edm::Run &run, const edm::EventSetup &setup)
void bookHistos ()
 book the report summary
void endJob ()
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
void endRun (edm::Run const &run, edm::EventSetup const &c)

Private Attributes

DQMStoredbe
MonitorElementglobalEffSummary
edm::ESHandle< DTGeometrymuonGeom
int nevents
unsigned int nLumiSegs
int prescaleFactor
MonitorElementsummaryHistos [5][2]

Detailed Description

* DQM Test Client

Date:
2010/01/22 15:32:04
Revision:
1.6
Author:
M. Pelliccioni - INFN Torino

Definition at line 39 of file DTChamberEfficiencyClient.h.


Constructor & Destructor Documentation

DTChamberEfficiencyClient::DTChamberEfficiencyClient ( const edm::ParameterSet ps)

Constructor.

Definition at line 29 of file DTChamberEfficiencyClient.cc.

References edm::ParameterSet::getUntrackedParameter(), cmsCodeRules::cppFunctionSkipper::operator, and ExpressReco_HICollisions_FallBack::prescaleFactor.

{

  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
    << "DTChamberEfficiencyClient: Constructor called";

  dbe = Service<DQMStore>().operator->();

  prescaleFactor = pSet.getUntrackedParameter<int>("diagnosticPrescale", 1);
}
DTChamberEfficiencyClient::~DTChamberEfficiencyClient ( ) [virtual]

Destructor.

Definition at line 40 of file DTChamberEfficiencyClient.cc.

{
   LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
     << "DTChamberEfficiencyClient: Destructor called";
}

Member Function Documentation

void DTChamberEfficiencyClient::analyze ( const edm::Event e,
const edm::EventSetup c 
) [protected, virtual]

Implements edm::EDAnalyzer.

Definition at line 77 of file DTChamberEfficiencyClient.cc.

References nevents.

{

  nevents++;
  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
    << "[DTChamberEfficiencyClient]: " << nevents << " events";
  return;
}
void DTChamberEfficiencyClient::beginJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 46 of file DTChamberEfficiencyClient.cc.

References bookHistos(), and nevents.

{
  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
    << "DTChamberEfficiencyClient: BeginJob";

  nevents = 0;

  bookHistos();

  return;
}
void DTChamberEfficiencyClient::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
) [protected, virtual]

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 58 of file DTChamberEfficiencyClient.cc.

{
  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
    << "[DTChamberEfficiencyClient]: Begin of LS transition";

  return;
}
void DTChamberEfficiencyClient::beginRun ( const edm::Run run,
const edm::EventSetup setup 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 66 of file DTChamberEfficiencyClient.cc.

References edm::EventSetup::get().

{
  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
    << "DTChamberEfficiencyClient: beginRun";

  // Get the DT Geometry
  setup.get<MuonGeometryRecord>().get(muonGeom);

  return;
}
void DTChamberEfficiencyClient::bookHistos ( ) [protected]

book the report summary

Definition at line 222 of file DTChamberEfficiencyClient.cc.

{

  dbe->setCurrentFolder("DT/05-ChamberEff");
  globalEffSummary = dbe->book2D("EfficiencyGlbSummary","Efficiency Summary",12,1,13,5,-2,3);
  globalEffSummary->setAxisTitle("sector",1);
  globalEffSummary->setAxisTitle("wheel",2);



  for(int wh=-2; wh<=2; wh++){
    stringstream wheel; wheel << wh;
    string histoNameAll =  "EfficiencyMap_All_W" + wheel.str();
    string histoTitleAll =  "Efficiency map for all segments for wheel " + wheel.str();

    string histoNameQual =  "EfficiencyMap_Qual_W" + wheel.str();
    string histoTitleQual =  "Efficiency map for quality segments for wheel " + wheel.str();


    dbe->setCurrentFolder("DT/05-ChamberEff");

    summaryHistos[wh+2][0] = dbe->book2D(histoNameAll.c_str(),histoTitleAll.c_str(),14,1.,15.,4,1.,5.);
    summaryHistos[wh+2][0]->setAxisTitle("Sector",1);
    summaryHistos[wh+2][0]->setBinLabel(1,"MB1",2);
    summaryHistos[wh+2][0]->setBinLabel(2,"MB2",2);
    summaryHistos[wh+2][0]->setBinLabel(3,"MB3",2);
    summaryHistos[wh+2][0]->setBinLabel(4,"MB4",2);

    dbe->setCurrentFolder("DT/05-ChamberEff/HighQual");

    summaryHistos[wh+2][1] = dbe->book2D(histoNameQual.c_str(),histoTitleQual.c_str(),14,1.,15.,4,1.,5.);
    summaryHistos[wh+2][1]->setAxisTitle("Sector",1);
    summaryHistos[wh+2][1]->setBinLabel(1,"MB1",2);
    summaryHistos[wh+2][1]->setBinLabel(2,"MB2",2);
    summaryHistos[wh+2][1]->setBinLabel(3,"MB3",2);
    summaryHistos[wh+2][1]->setBinLabel(4,"MB4",2);
  }

  return;
}
void DTChamberEfficiencyClient::endJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 215 of file DTChamberEfficiencyClient.cc.

{
  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
    << "DTChamberEfficiencyClient: endJob";
  return;
}
void DTChamberEfficiencyClient::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 86 of file DTChamberEfficiencyClient.cc.

{
  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
    << "DTChamberEfficiencyClient: endluminosityBlock";
}  
void DTChamberEfficiencyClient::endRun ( edm::Run const &  run,
edm::EventSetup const &  c 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 93 of file DTChamberEfficiencyClient.cc.

References MonitorElement::getBinContent(), MonitorElement::getBinError(), MonitorElement::getTH2F(), j, gen::k, LogTrace, funct::pow(), mathSSE::sqrt(), and relativeConstraints::station.

{
  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
    << "DTChamberEfficiencyClient: endRun";
  // reset the global summary
  globalEffSummary->Reset();

  //Loop over the wheels
  for(int wheel=-2;wheel<=2;wheel++){
    stringstream wheel_str; wheel_str << wheel;

    // Get the ME produced by EfficiencyTask Source
    // All means no selection on segments, Qual means segments with at least 12 hits
    MonitorElement* MECountAll = dbe->get("DT/05-ChamberEff/Task/hCountSectVsChamb_All_W" + wheel_str.str());   
    MonitorElement* MECountQual = dbe->get("DT/05-ChamberEff/Task/hCountSectVsChamb_Qual_W" + wheel_str.str()); 
    MonitorElement* MEExtrap = dbe->get("DT/05-ChamberEff/Task/hExtrapSectVsChamb_W" + wheel_str.str());        

    //get the TH2F
    TH2F* hCountAll = MECountAll->getTH2F();
    TH2F* hCountQual = MECountQual->getTH2F();
    TH2F* hExtrap = MEExtrap->getTH2F();

    const int nBinX = summaryHistos[wheel+2][0]->getNbinsX();
    const int nBinY = summaryHistos[wheel+2][0]->getNbinsY();

    for(int j=1;j<=nBinX;j++){
      for(int k=1;k<=nBinY;k++){
        summaryHistos[wheel+2][0]->setBinContent(j,k,0.);
        summaryHistos[wheel+2][1]->setBinContent(j,k,0.);

        const float numerAll = hCountAll->GetBinContent(j,k);
        const float numerQual = hCountQual->GetBinContent(j,k);
        const float denom = hExtrap->GetBinContent(j,k);

        if(denom != 0.){
          const float effAll= numerAll/denom;
          const float eff_error_All = sqrt((effAll+effAll*effAll)/denom);

          const float effQual= numerQual/denom;
          const float eff_error_Qual = sqrt((effQual+effQual*effQual)/denom);

          //if(wheel == 2 && k == 2 && j == 2) cout << "Eff ch " << effAll << " " << lumiSeg.id() << endl;

          summaryHistos[wheel+2][0]->setBinContent(j,k,effAll);
          summaryHistos[wheel+2][0]->setBinError(j,k,eff_error_All);

          summaryHistos[wheel+2][1]->setBinContent(j,k,effQual);
          summaryHistos[wheel+2][1]->setBinError(j,k,eff_error_Qual);
        }
      }
    }
  }

  // fill the global eff. summary
  // problems at a granularity smaller than the chamber are ignored
  for(int wheel=-2; wheel<=2; wheel++) { // loop over wheels
    // retrieve the chamber efficiency summary
    MonitorElement * segmentWheelSummary = summaryHistos[wheel+2][0];
    if(segmentWheelSummary != 0) {

      for(int sector=1; sector<=12; sector++) { // loop over sectors
        float nFailingChambers = 0.;

        double meaneff = 0.;
        double errorsum = 0.;

        for(int station = 1; station != 5; ++station) { // loop over stations
          
          const double tmpefficiency = segmentWheelSummary->getBinContent(sector, station);
          const double tmpvariance = pow(segmentWheelSummary->getBinError(sector, station),2);

          //if(wheel == 2 && sector == 9) cout << "ch " << station << " " << tmpefficiency << " " << tmpvariance << " " << lumiSeg.id() << endl;
          
          if(tmpefficiency < 0.2 || tmpvariance == 0){
            nFailingChambers++;
            continue;
          }

          meaneff += tmpefficiency/tmpvariance;
          errorsum += 1./tmpvariance;

          LogTrace("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
            << "Wheel: " << wheel << " Stat: " << station
            << " Sect: " << sector << " status: " << meaneff/errorsum << endl;
        }

        if(sector == 4 || sector == 10) {
          int whichSector = (sector == 4) ? 13 : 14;

          const double tmpefficiency = segmentWheelSummary->getBinContent(whichSector, 4);
          const double tmpvariance = pow(segmentWheelSummary->getBinError(whichSector, 4),2);

          if(tmpefficiency > 0.2 && tmpvariance != 0) {
            meaneff += tmpefficiency/tmpvariance;
            errorsum += 1./tmpvariance;
          }
          else nFailingChambers++;

        }

        double eff_result = 0;
        if(errorsum != 0) eff_result = meaneff/errorsum;

        if(nFailingChambers != 0) {
          if(sector != 4 && sector != 10) eff_result = eff_result*(4.-nFailingChambers)/4.;
          else eff_result = eff_result*(5.-nFailingChambers)/5.;
        }

        if(eff_result > 0.7) globalEffSummary->Fill(sector,wheel,1.);
        else if(eff_result < 0.7 && eff_result > 0.5) globalEffSummary->Fill(sector,wheel,0.6);
        else if(eff_result < 0.5 && eff_result > 0.3) globalEffSummary->Fill(sector,wheel,0.4);
        else if(eff_result < 0.3 && eff_result > 0.) globalEffSummary->Fill(sector,wheel,0.15);

        //if(wheel == 2 && sector == 9) cout << "eff_result " << eff_result << endl;
        //if(wheel == 2 && sector == 9) cout << "nfail " << nFailingChambers++ << endl;

      }
    }
  }
  return;
}

Member Data Documentation

Definition at line 71 of file DTChamberEfficiencyClient.h.

Definition at line 77 of file DTChamberEfficiencyClient.h.

Definition at line 73 of file DTChamberEfficiencyClient.h.

Definition at line 67 of file DTChamberEfficiencyClient.h.

unsigned int DTChamberEfficiencyClient::nLumiSegs [private]

Definition at line 68 of file DTChamberEfficiencyClient.h.

Definition at line 69 of file DTChamberEfficiencyClient.h.

Definition at line 76 of file DTChamberEfficiencyClient.h.