CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

DTTriggerEfficiencyTest Class Reference

#include <DTTriggerEfficiencyTest.h>

Inheritance diagram for DTTriggerEfficiencyTest:
DTLocalTriggerBaseTest edm::EDAnalyzer

List of all members.

Public Member Functions

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

Protected Member Functions

void beginJob ()
 BeginJob.
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 BeginRun.
void bookChambHistos (DTChamberId chambId, std::string htype, std::string folder="")
 Book the new MEs (for each chamber)
void makeEfficiencyME2D (TH2F *numerator, TH2F *denominator, MonitorElement *result)
 Compute 2D efficiency plots.
void runClientDiagnostic ()
 DQM Client Diagnostic.

Private Attributes

std::map< uint32_t, std::map
< std::string, MonitorElement * > > 
chambME
bool detailedPlots
DTTrigGeomUtilstrigGeomUtils

Detailed Description

* DQM Test Client

Date:
2010/01/05 10:15:46
Revision:
1.2
Author:
C. Battilana - CIEMAT

Definition at line 20 of file DTTriggerEfficiencyTest.h.


Constructor & Destructor Documentation

DTTriggerEfficiencyTest::DTTriggerEfficiencyTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 39 of file DTTriggerEfficiencyTest.cc.

References edm::ParameterSet::getUntrackedParameter().

                                                                         {

  setConfig(ps,"DTTriggerEfficiency");
  baseFolderDCC = "DT/03-LocalTrigger-DCC/";
  baseFolderDDU = "DT/04-LocalTrigger-DDU/";
  detailedPlots = ps.getUntrackedParameter<bool>("detailedAnalysis",true);

}
DTTriggerEfficiencyTest::~DTTriggerEfficiencyTest ( ) [virtual]

Destructor.

Definition at line 49 of file DTTriggerEfficiencyTest.cc.

                                                 {
  
}

Member Function Documentation

void DTTriggerEfficiencyTest::beginJob ( void  ) [protected, virtual]

BeginJob.

Reimplemented from DTLocalTriggerBaseTest.

Definition at line 54 of file DTTriggerEfficiencyTest.cc.

References bk::beginJob().

void DTTriggerEfficiencyTest::beginRun ( const edm::Run r,
const edm::EventSetup c 
) [protected, virtual]

BeginRun.

Reimplemented from DTLocalTriggerBaseTest.

Definition at line 61 of file DTTriggerEfficiencyTest.cc.

References DTLocalTriggerBaseTest::beginRun(), and Parameters::parameters.

                                                                            {
  
  DTLocalTriggerBaseTest::beginRun(r,c);
  trigGeomUtils = new DTTrigGeomUtils(muonGeom);

  vector<string>::const_iterator iTr   = trigSources.begin();
  vector<string>::const_iterator trEnd = trigSources.end();
  vector<string>::const_iterator iHw   = hwSources.begin();
  vector<string>::const_iterator hwEnd = hwSources.end();


  //Booking
  if(parameters.getUntrackedParameter<bool>("staticBooking", true)){
    for (; iTr != trEnd; ++iTr){
      trigSource = (*iTr);
      for (; iHw != hwEnd; ++iHw){
        hwSource = (*iHw);
        // Loop over the TriggerUnits
        for (int wh=-2; wh<=2; ++wh){
          if (detailedPlots) {
            for (int sect=1; sect<=12; ++sect){
              for (int stat=1; stat<=4; ++stat){
                DTChamberId chId(wh,stat,sect);
                bookChambHistos(chId,"TrigEffPosvsAnglePhi","Segment");
                bookChambHistos(chId,"TrigEffPosvsAngleCorrPhi","Segment");
              }
            }
          }
          bookWheelHistos(wh,"TrigEffPhi");  
          bookWheelHistos(wh,"TrigEffCorrPhi");  
        }
      }
    }
  }
  
}
void DTTriggerEfficiencyTest::bookChambHistos ( DTChamberId  chambId,
std::string  htype,
std::string  folder = "" 
) [protected]

Book the new MEs (for each chamber)

Definition at line 296 of file DTLocalTriggerEfficiencyTest.cc.

References DQMStore::book1D(), DQMStore::book2D(), DTLocalTriggerBaseTest::category(), DTLocalTriggerEfficiencyTest::chambME, DTLocalTriggerBaseTest::dbe, DTLocalTriggerBaseTest::fullName(), DTLocalTriggerBaseTest::hwSource, LogTrace, max(), min, RecoTauCommonJetSelections_cfi::nbins, DTTrigGeomUtils::phiRange(), DetId::rawId(), DTChamberId::sector(), DQMStore::setCurrentFolder(), relativeConstraints::station, DTChamberId::station(), DTLocalTriggerBaseTest::testName, DTTrigGeomUtils::thetaRange(), DTLocalTriggerBaseTest::topFolder(), DTLocalTriggerEfficiencyTest::trigGeomUtils, and DTChamberId::wheel().

                                                                                    {
  
  stringstream wheel; wheel << chambId.wheel();
  stringstream station; station << chambId.station();   
  stringstream sector; sector << chambId.sector();

  string fullType  = fullName(htype);
  bool isDCC = hwSource=="DCC" ;
  string HistoName = fullType + "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();

  dbe->setCurrentFolder(topFolder(isDCC) + "Wheel" + wheel.str() +
                        "/Sector" + sector.str() +
                        "/Station" + station.str() + "/Segment");

  LogTrace(category()) << "[" << testName << "Test]: booking " + topFolder(isDCC) + "Wheel" << wheel.str() 
                       <<"/Sector" << sector.str() << "/Station" << station.str() << "/Segment/" << HistoName;

  
  uint32_t indexChId = chambId.rawId();
  if (htype.find("TrigEffAnglePhi") == 0){
    chambME[indexChId][fullType] = dbe->book1D(HistoName.c_str(),"Trigger efficiency vs angle of incidence (Phi)",16,-40.,40.);
  }
  else if (htype.find("TrigEffAngleHHHLPhi") == 0){
    chambME[indexChId][fullType] = dbe->book1D(HistoName.c_str(),"Trigger efficiency (HH/HL) vs angle of incidence (Phi)",16,-40.,40.);
  }
  else if (htype.find("TrigEffAngleTheta") == 0){
    chambME[indexChId][fullType] = dbe->book1D(HistoName.c_str(),"Trigger efficiency vs angle of incidence (Theta)",16,-40.,40.);
  }
  else if (htype.find("TrigEffAngleHTheta") == 0){
    chambME[indexChId][fullType] = dbe->book1D(HistoName.c_str(),"Trigger efficiency (H) vs angle of incidence (Theta)",16,-40.,40.);
  }
  else if (htype.find("TrigEffPosPhi") == 0 ){
    float min,max;
    int nbins;
    trigGeomUtils->phiRange(chambId,min,max,nbins);
    chambME[indexChId][fullType] = dbe->book1D(HistoName.c_str(),"Trigger efficiency vs position (Phi)",nbins,min,max);
  }
  else if (htype.find("TrigEffPosvsAnglePhi") == 0 ){
    float min,max;
    int nbins;
    trigGeomUtils->phiRange(chambId,min,max,nbins);
    chambME[indexChId][fullType] = dbe->book2D(HistoName.c_str(),"Trigger efficiency position vs angle (Phi)",16,-40.,40.,nbins,min,max);
  }
  else if (htype.find("TrigEffPosvsAngleHHHLPhi") == 0 ){
    float min,max;
    int nbins;
    trigGeomUtils->phiRange(chambId,min,max,nbins);
    chambME[indexChId][fullType] = dbe->book2D(HistoName.c_str(),"Trigger efficiency (HH/HL) pos vs angle (Phi)",16,-40.,40.,nbins,min,max);
  }
  else if (htype.find("TrigEffPosHHHLPhi") == 0 ){
    float min,max;
    int nbins;
    trigGeomUtils->phiRange(chambId,min,max,nbins);
    chambME[indexChId][fullType] = dbe->book1D(HistoName.c_str(),"Trigger efficiency (HH/HL) vs position (Phi)",nbins,min,max);
  }
  else if (htype.find("TrigEffPosTheta") == 0){
    float min,max;
    int nbins;
    trigGeomUtils->thetaRange(chambId,min,max,nbins);
    chambME[indexChId][fullType] = dbe->book1D(HistoName.c_str(),"Trigger efficiency vs position (Theta)",nbins,min,max);
  }
  else if (htype.find("TrigEffPosHTheta") == 0){
    float min,max;
    int nbins;
    trigGeomUtils->thetaRange(chambId,min,max,nbins);
    chambME[indexChId][fullType] = dbe->book1D(HistoName.c_str(),"Trigger efficiency (H) vs position (Theta)",nbins,min,max);
  }
  else if (htype.find("TrigEffPosvsAngleTheta") == 0 ){
    float min,max;
    int nbins;
    trigGeomUtils->thetaRange(chambId,min,max,nbins);
    chambME[indexChId][fullType] = dbe->book2D(HistoName.c_str(),"Trigger efficiency pos vs angle (Theta)",16,-40.,40.,nbins,min,max);
  }
  else if (htype.find("TrigEffPosvsAngleHTheta") == 0 ){
    float min,max;
    int nbins;
    trigGeomUtils->thetaRange(chambId,min,max,nbins);
    chambME[indexChId][fullType] = dbe->book2D(HistoName.c_str(),"Trigger efficiency (H) pos vs angle (Theta)",16,-40.,40.,nbins,min,max);
  }

}
void DTTriggerEfficiencyTest::makeEfficiencyME2D ( TH2F *  numerator,
TH2F *  denominator,
MonitorElement result 
) [protected]

Compute 2D efficiency plots.

Definition at line 158 of file DTTriggerEfficiencyTest.cc.

References postValidation_cfi::efficiency, error, MonitorElement::getTH2F(), and mathSSE::sqrt().

                                                                                                          {
  
  TH2F* efficiency = result->getTH2F();
  efficiency->Divide(numerator,denominator,1,1,"");
  
  int nbinsx = efficiency->GetNbinsX();
  int nbinsy = efficiency->GetNbinsY();
  for (int binx=1; binx<=nbinsx; ++binx){
    for (int biny=1; biny<=nbinsy; ++biny){
      float error = 0;
      float bineff = efficiency->GetBinContent(binx,biny);

      if (denominator->GetBinContent(binx,biny)){
        error = sqrt(bineff*(1-bineff)/denominator->GetBinContent(binx,biny));
      }
      else {
        error = 1;
        efficiency->SetBinContent(binx,biny,0.);
      }
 
      efficiency->SetBinError(binx,biny,error);
    }
  }

}    
void DTTriggerEfficiencyTest::runClientDiagnostic ( ) [protected, virtual]

DQM Client Diagnostic.

Implements DTLocalTriggerBaseTest.

Definition at line 99 of file DTTriggerEfficiencyTest.cc.

References spr::find(), newFWLiteAna::fullName, and DetId::rawId().

                                                  {

  // Loop over Trig & Hw sources
  for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
    trigSource = (*iTr);
    for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
      hwSource = (*iHw);
      // Loop over the TriggerUnits
      for (int wh=-2; wh<=2; ++wh){
        
        TH2F * TrigEffDenum   = getHisto<TH2F>(dbe->get(getMEName("TrigEffDenum","",wh)));
        TH2F * TrigEffNum     = getHisto<TH2F>(dbe->get(getMEName("TrigEffNum","",wh)));
        TH2F * TrigEffCorrNum = getHisto<TH2F>(dbe->get(getMEName("TrigEffCorrNum","",wh)));
        
        if (TrigEffDenum && TrigEffNum && TrigEffCorrNum && TrigEffDenum->GetEntries()>1) {
          
          if( whME[wh].find(fullName("TrigEffPhi")) == whME[wh].end() ){
            bookWheelHistos(wh,"TrigEffPhi");  
            bookWheelHistos(wh,"TrigEffCorrPhi");  
          }
          std::map<std::string,MonitorElement*> *innerME = &(whME[wh]);
          makeEfficiencyME2D(TrigEffNum,TrigEffDenum,innerME->find(fullName("TrigEffPhi"))->second);
          makeEfficiencyME2D(TrigEffCorrNum,TrigEffDenum,innerME->find(fullName("TrigEffCorrPhi"))->second);
          
        }

        if (detailedPlots) {
          for (int stat=1; stat<=4; ++stat){
            for (int sect=1; sect<=12; ++sect){
              DTChamberId chId(wh,stat,sect);
              uint32_t indexCh = chId.rawId();
              
              // Perform Efficiency analysis (Phi+Segments 2D)
              TH2F * TrackPosvsAngle        = getHisto<TH2F>(dbe->get(getMEName("TrackPosvsAngle","Segment", chId)));
              TH2F * TrackPosvsAngleAnyQual = getHisto<TH2F>(dbe->get(getMEName("TrackPosvsAngleAnyQual","Segment", chId)));
              TH2F * TrackPosvsAngleCorr    = getHisto<TH2F>(dbe->get(getMEName("TrackPosvsAngleCorr","Segment", chId)));
            
              if (TrackPosvsAngle && TrackPosvsAngleAnyQual && TrackPosvsAngleCorr && TrackPosvsAngle->GetEntries()>1) {
              
                if( chambME[indexCh].find(fullName("TrigEffAnglePhi")) == chambME[indexCh].end()){
                  bookChambHistos(chId,"TrigEffPosvsAnglePhi","Segment");
                  bookChambHistos(chId,"TrigEffPosvsAngleCorrPhi","Segment");
                }
                
                std::map<std::string,MonitorElement*> *innerME = &(chambME[indexCh]);
                makeEfficiencyME2D(TrackPosvsAngleAnyQual,TrackPosvsAngle,innerME->find(fullName("TrigEffPosvsAnglePhi"))->second);
                makeEfficiencyME2D(TrackPosvsAngleCorr,TrackPosvsAngle,innerME->find(fullName("TrigEffPosvsAngleCorrPhi"))->second);
             
              }
            }
          }
        }
      }

    }
  }     

}

Member Data Documentation

std::map<uint32_t,std::map<std::string,MonitorElement*> > DTTriggerEfficiencyTest::chambME [private]

Definition at line 51 of file DTTriggerEfficiencyTest.h.

Definition at line 53 of file DTTriggerEfficiencyTest.h.

Definition at line 52 of file DTTriggerEfficiencyTest.h.