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
std::map< int, MonitorElement * > EffDistrPerWh
MonitorElementglobalEffDistr
MonitorElementglobalEffSummary
edm::ESHandle< DTGeometrymuonGeom
int nevents
unsigned int nLumiSegs
int prescaleFactor
MonitorElementsummaryHistos [5][2]

Detailed Description

* DQM Test Client

Date:
2011/10/31 17:22:23
Revision:
1.7
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(), cppFunctionSkipper::operator, and dtDQMClient_cfg::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 231 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);

  globalEffDistr = dbe->book1D("TotalEfficiency","Total efficiency",51,0.,1.02);
  globalEffDistr -> setAxisTitle("Eff",1);

  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();

    string histoNameEff =  "Efficiency_W" + wheel.str();
    string histoTitleEff =  "Segment efficiency, 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);

    EffDistrPerWh[wh+2] = dbe -> book1D(histoNameEff.c_str(),histoTitleEff.c_str(),51,0.,1.02);
    EffDistrPerWh[wh+2] -> setAxisTitle("Eff",1);

    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 224 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 gather_cfg::cout, HcalObjRepresent::Fill(), 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
    if(!MECountAll) cout<<"fucking ME is null"<<endl;
    if(!(MECountAll->getTH2F())) cout<<"fucking puntator is null!"<<endl;
    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 1D eff distributions
        globalEffDistr -> Fill(effAll);
        EffDistrPerWh[wheel+2] -> Fill(effAll);

        }
      }
    }
  }

  // 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 80 of file DTChamberEfficiencyClient.h.

Definition at line 79 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.