CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

DTTriggerLutTest Class Reference

#include <DTTriggerLutTest.h>

Inheritance diagram for DTTriggerLutTest:
DTLocalTriggerBaseTest edm::EDAnalyzer

List of all members.

Public Member Functions

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

Protected Member Functions

void beginJob ()
 BeginJob.
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 BeginRun.
void runClientDiagnostic ()
 Run client analysis.

Private Member Functions

void bookCmsHistos1d (std::string hTag, std::string folder="")
void fillWhPlot (MonitorElement *plot, int sect, int stat, float value, bool lessIsBest=true)
 Fill summary plots managing double MB4 chambers.
int performLutTest (double perc, double threshold1, double threshold2)
 Perform Lut Test logical operations.

Private Attributes

bool detailedAnalysis
double thresholdErrPhi
double thresholdErrPhiB
double thresholdWarnPhi
double thresholdWarnPhiB
double validRange

Detailed Description

* DQM Test Client to monitor Local Trigger position / direction assignement

Date:
2011/06/10 13:50:12
Revision:
1.1
Author:
D.Fasanella - INFN Bologna

Definition at line 21 of file DTTriggerLutTest.h.


Constructor & Destructor Documentation

DTTriggerLutTest::DTTriggerLutTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 36 of file DTTriggerLutTest.cc.

References edm::ParameterSet::getUntrackedParameter().

                                                           {
        
  setConfig(ps,"DTTriggerLut");
  baseFolderDCC = "DT/03-LocalTrigger-DCC/";
  baseFolderDDU = "DT/04-LocalTrigger-DDU/";
  thresholdWarnPhi  = ps.getUntrackedParameter<double>("thresholdWarnPhi");
  thresholdErrPhi   = ps.getUntrackedParameter<double>("thresholdErrPhi");
  thresholdWarnPhiB = ps.getUntrackedParameter<double>("thresholdWarnPhiB");
  thresholdErrPhiB  = ps.getUntrackedParameter<double>("thresholdErrPhiB");
  validRange = ps.getUntrackedParameter<double>("validRange");
  detailedAnalysis = ps.getUntrackedParameter<bool>("detailedAnalysis");

}
DTTriggerLutTest::~DTTriggerLutTest ( ) [virtual]

Destructor.

Definition at line 51 of file DTTriggerLutTest.cc.

                                   {

}

Member Function Documentation

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

BeginJob.

Reimplemented from DTLocalTriggerBaseTest.

Definition at line 56 of file DTTriggerLutTest.cc.

References bk::beginJob(), and Parameters::parameters.

                               {
  
  DTLocalTriggerBaseTest::beginJob();
  
  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")){
    
    for (; iTr != trEnd; ++iTr){
      trigSource = (*iTr);
      for (; iHw != hwEnd; ++iHw){
        hwSource = (*iHw);
        // Loop over the TriggerUnits
        for (int wh=-2; wh<=2; ++wh){
          if (detailedAnalysis){
            bookWheelHistos(wh,"PhiResidualPercentage");  
            bookWheelHistos(wh,"PhibResidualPercentage"); 
          }

          bookWheelHistos(wh,"PhiLutSummary","Summaries");
          bookWheelHistos(wh,"PhibLutSummary","Summaries");      
          
          if (detailedAnalysis){
            bookWheelHistos(wh,"PhiResidualMean");  
            bookWheelHistos(wh,"PhiResidualRMS");
            bookWheelHistos(wh,"PhibResidualMean");  
            bookWheelHistos(wh,"PhibResidualRMS");
            bookWheelHistos(wh,"CorrelationFactorPhi");
            bookWheelHistos(wh,"CorrelationFactorPhib");
            bookWheelHistos(wh,"DoublePeakFlagPhib");
          }

        }

        bookCmsHistos("TrigLutSummary","",true);
        bookCmsHistos("PhiLutSummary");
        bookCmsHistos("PhibLutSummary");
        if (detailedAnalysis){
          bookCmsHistos1d("PhiPercentageSummary");
          bookCmsHistos1d("PhibPercentageSummary");
        }
      }
    }
  }     

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

BeginRun.

Reimplemented from DTLocalTriggerBaseTest.

Definition at line 108 of file DTTriggerLutTest.cc.

References DTLocalTriggerBaseTest::beginRun().

void DTTriggerLutTest::bookCmsHistos1d ( std::string  hTag,
std::string  folder = "" 
) [private]

Definition at line 361 of file DTTriggerLutTest.cc.

References python::rootplot::argparse::category, newFWLiteAna::fullName, LogTrace, and MonitorElement::setAxisTitle().

                                                                 {

  string basedir = topFolder(true);
  if (folder != "") {
    basedir += folder +"/" ;
  }
  dbe->setCurrentFolder(basedir);

  string hName = fullName(hTag);
  LogTrace(category()) << "[" << testName << "Test]: booking " << basedir << hName;


  MonitorElement* me = dbe->book1D(hName.c_str(),hName.c_str(),101,-0.005,1.005);
  me->setAxisTitle("Percentage",1);
  cmsME[hName] = me;

}
void DTTriggerLutTest::fillWhPlot ( MonitorElement plot,
int  sect,
int  stat,
float  value,
bool  lessIsBest = true 
) [private]

Fill summary plots managing double MB4 chambers.

Definition at line 379 of file DTTriggerLutTest.cc.

References MonitorElement::getBinContent(), and MonitorElement::setBinContent().

                                                                                                        {
  
  if (sect>12) {
    int scsect = sect==13 ? 4 : 10;
    if ((value>plot->getBinContent(scsect,stat)) == lessIsBest) {
      plot->setBinContent(scsect,stat,value);
    }
  }
  else {
    plot->setBinContent(sect,stat,value);
  }
  
  return;
  
}
int DTTriggerLutTest::performLutTest ( double  perc,
double  threshold1,
double  threshold2 
) [private]

Perform Lut Test logical operations.

Definition at line 350 of file DTTriggerLutTest.cc.

References query::result.

                                                                                          {
        
  bool isInWarn = perc<thresholdWarn;  
  bool isInErr  = perc<thresholdErr;

  int result= isInErr ? 2 : isInWarn ? 3 : 0;

  return result;

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

Run client analysis.

Implements DTLocalTriggerBaseTest.

Definition at line 115 of file DTTriggerLutTest.cc.

References corr, newFWLiteAna::fullName, edm::max(), Mean, plotscripts::rms(), and DTChamberId::wheel().

                                           {

  // Reset lut percentage 1D summaries
  if (detailedAnalysis){
    cmsME.find(fullName("PhiPercentageSummary"))->second->Reset();
    cmsME.find(fullName("PhibPercentageSummary"))->second->Reset();
  }

  // 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);
      vector<DTChamber*>::const_iterator chIt  = muonGeom->chambers().begin();
      vector<DTChamber*>::const_iterator chEnd = muonGeom->chambers().end();
      for (; chIt != chEnd; ++chIt) {

        DTChamberId chId((*chIt)->id());
        int wh   = chId.wheel();
        int sect = chId.sector();
        int stat = chId.station();
        
        std::map<std::string,MonitorElement*> &innerME = whME[wh];
          
        // Make Phi Residual Summary
        TH1F * PhiResidual = getHisto<TH1F>(dbe->get(getMEName("PhiResidual","Segment", chId)));
        int phiSummary = 1;
        if (PhiResidual && PhiResidual->GetEntries()>10) {

          if( innerME.find(fullName("PhiResidualPercentage")) == innerME.end() ){
            bookWheelHistos(wh,"PhiResidualPercentage");  
          }
          
          float rangeBin = validRange/(PhiResidual->GetBinWidth(1));
          float center   = (PhiResidual->GetNbinsX())/2.;
          float perc     = (PhiResidual->Integral(floor(center-rangeBin),ceil(center+rangeBin)))/(PhiResidual->Integral());
          fillWhPlot(innerME.find(fullName("PhiResidualPercentage"))->second,sect,stat,perc,false);
          phiSummary = performLutTest(perc,thresholdWarnPhi,thresholdErrPhi);
          if (detailedAnalysis) cmsME.find(fullName("PhiPercentageSummary"))->second->Fill(perc);

        }

        fillWhPlot(innerME.find(fullName("PhiLutSummary"))->second,sect,stat,phiSummary);
        
        if (detailedAnalysis){

//        if ((phiSummary ==0)&& (PhiResidual->GetEntries()>100)) {  //Precision Peak test

//          Float_t *source = new float[31];
//          Float_t *dest   = new float[31];
//          //TSpectrum *g = new TSpectrum(5);
//          float media  = PhiResidual->GetMean();
//          int   center = PhiResidual->GetXaxis()->FindBin(media);
//          for (int i = 0; i < 30; i++) {
//            source[i]=PhiResidual->GetBinContent(center+i-15);}
//          int nFound = g->SearchHighRes(source, dest, 30, 1, 6, kFALSE, 5, kTRUE,2);
//          /if (nFound>1) { // has more than 1 peak
//            if( innerME.find(fullName("DoublePeakFlagPhi")) == innerME.end() ){
//              bookWheelHistos(wh,"DoublePeakFlagPhi");
//            }
//          }

//          fillWhPlot(innerME.find(fullName("DoublePeakFlagPhi"))->second,sect,stat,1,false);      
//        }

          if ((phiSummary==0)||(phiSummary==3)){ //Information on the Peak

            if( innerME.find(fullName("PhiResidualMean")) == innerME.end() ){
              bookWheelHistos(wh,"PhiResidualMean");  
              bookWheelHistos(wh,"PhiResidualRMS");  
            }

            float center   = (PhiResidual->GetNbinsX())/2.;                   
            float rangeBin = validRange/(PhiResidual->GetBinWidth(1));
            PhiResidual->GetXaxis()->SetRange(floor(center-rangeBin),ceil(center+rangeBin));
            float max     = PhiResidual->GetMaximumBin();
            float maxBin  = PhiResidual->GetXaxis()->FindBin(max);
            float nBinMax = 0.5/(PhiResidual->GetBinWidth(1));
            PhiResidual->GetXaxis()->SetRange(floor(maxBin-nBinMax),ceil(maxBin+nBinMax));
            float Mean = PhiResidual->GetMean();
            float rms  = PhiResidual->GetRMS();     

            fillWhPlot(innerME.find(fullName("PhiResidualMean"))->second,sect,stat,Mean);
            fillWhPlot(innerME.find(fullName("PhiResidualRMS"))->second,sect,stat,rms);
            
          }
          
          TH2F * TrackPhitkvsPhitrig   = getHisto<TH2F>(dbe->get(getMEName("PhitkvsPhitrig","Segment", chId)));

          if (TrackPhitkvsPhitrig && TrackPhitkvsPhitrig->GetEntries()>100) {
            float corr = TrackPhitkvsPhitrig->GetCorrelationFactor();
            if( innerME.find(fullName("CorrelationFactorPhi")) == innerME.end() ){
              bookWheelHistos(wh,"CorrelationFactorPhi");
            }
            fillWhPlot(innerME.find(fullName("CorrelationFactorPhi"))->second,sect,stat,corr,false);
          }
          
        }
        
                                
        // Make Phib Residual Summary
        TH1F * PhibResidual = getHisto<TH1F>(dbe->get(getMEName("PhibResidual","Segment", chId)));
        int phibSummary = stat==3 ? -1 : 1; // station 3 has no meaningful MB3 phi bending information
        
        if (stat != 3 && PhibResidual && PhibResidual->GetEntries()>10) {// station 3 has no meaningful MB3 phi bending information

          if( innerME.find(fullName("PhibResidualPercentage")) == innerME.end() ){
            bookWheelHistos(wh,"PhibResidualPercentage");  
          }
          
          float rangeBin = validRange/(PhibResidual->GetBinWidth(1));
          float center   = (PhibResidual->GetNbinsX())/2.;
          float perc     = (PhibResidual->Integral(floor(center-rangeBin),ceil(center+rangeBin)))/(PhibResidual->Integral());

          fillWhPlot(innerME.find(fullName("PhibResidualPercentage"))->second,sect,stat,perc,false);
          phibSummary = performLutTest(perc,thresholdWarnPhiB,thresholdErrPhiB);
          if (detailedAnalysis) cmsME.find(fullName("PhibPercentageSummary"))->second->Fill(perc);

        }

        fillWhPlot(innerME.find(fullName("PhibLutSummary"))->second,sect,stat,phibSummary);
        
        if (detailedAnalysis){

//        if ((phibSummary ==0)&& (PhibResidual->GetEntries()>100)) {  //Precision Peak test 
//          Float_t * source = new float[31];
//          Float_t * dest = new float[31];
//          TSpectrum *spec = new TSpectrum(5);
//          float media = PhibResidual->GetMean();
//          int center= PhibResidual->GetXaxis()->FindBin(media);
//          for (int i = 0; i < 30; i++) {
//            source[i]=PhibResidual->GetBinContent(center+i-15);
//          }
//          int nFound = spec->SearchHighRes(source,dest,30,1,6,kFALSE,5,kTRUE,2);
//          if (nFound>1) { // has more than 1 peak
//            if( innerME.find(fullName("DoublePeakFlagPhib")) == innerME.end() ){
//              bookWheelHistos(wh,"DoublePeakFlagPhib");
//            }
//            fillWhPlot(innerME.find(fullName("DoublePeakFlagPhib"))->second,sect,stat,1,false);
//          }
//        }       
          
          if ((phibSummary==0)||(phibSummary==3)){

            if( innerME.find(fullName("PhibResidualMean")) == innerME.end() ){
              bookWheelHistos(wh,"PhibResidualMean");  
              bookWheelHistos(wh,"PhibResidualRMS");  
            }

            float center   = (PhibResidual->GetNbinsX())/2.;
            float rangeBin =  validRange/(PhibResidual->GetBinWidth(1));
            PhibResidual->GetXaxis()->SetRange(floor(center-rangeBin),ceil(center+rangeBin));
            float max     = PhibResidual->GetMaximumBin();
            float maxBin  = PhibResidual->GetXaxis()->FindBin(max);
            float nBinMax = 0.5/(PhibResidual->GetBinWidth(1));
            PhibResidual->GetXaxis()->SetRange(floor(maxBin-nBinMax),ceil(maxBin+nBinMax));
            float Mean = PhibResidual->GetMean();
            float rms = PhibResidual->GetRMS();
            
            fillWhPlot(innerME.find(fullName("PhibResidualMean"))->second,sect,stat,Mean);
            fillWhPlot(innerME.find(fullName("PhibResidualRMS"))->second,sect,stat,rms);
          }

          TH2F * TrackPhibtkvsPhibtrig   = getHisto<TH2F>(dbe->get(getMEName("PhibtkvsPhibtrig","Segment", chId)));
          if (TrackPhibtkvsPhibtrig && TrackPhibtkvsPhibtrig->GetEntries()>100) {

            float corr = TrackPhibtkvsPhibtrig->GetCorrelationFactor();
            if( innerME.find(fullName("CorrelationFactorPhib")) == innerME.end() ){
              bookWheelHistos(wh,"CorrelationFactorPhib");
            }

            fillWhPlot(innerME.find(fullName("CorrelationFactorPhib"))->second,sect,stat,corr,false);

          }       
          
        }                                               
      }
    }
  }
        
  // Barrel Summary Plots
  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);  
      for (int wh=-2; wh<=2; ++wh){

        std::map<std::string,MonitorElement*> *innerME = &(whME[wh]);
        
        TH2F* phiWhSummary   = getHisto<TH2F>(innerME->find(fullName("PhiLutSummary"))->second);
        TH2F* phibWhSummary  = getHisto<TH2F>(innerME->find(fullName("PhibLutSummary"))->second);

        for (int sect=1; sect<=12; ++sect){

          int phiSectorTotal  = 0;   // CB dai 1 occhio a questo
          int phibSectorTotal = 0;
          int nullphi  = 0;
          int nullphib = 0;
          int phiStatus  = 5;
          int phibStatus = 5;
          int glbStatus  = 0;

          for (int stat=1; stat<=4; ++stat){
            if (phiWhSummary->GetBinContent(sect,stat)==2){
              phiSectorTotal +=1;
              glbStatus += 1;
            }
            if (phiWhSummary->GetBinContent(sect,stat)==1)
              nullphi+=1;
            if (phibWhSummary->GetBinContent(sect,stat)==2) {
              phibSectorTotal+=1;
              glbStatus += 1;
            }
            if (phibWhSummary->GetBinContent(sect,stat)==1)
              nullphib+=1;
          }
          if (nullphi!=4)
            phiStatus=phiSectorTotal;
          else 
            phiStatus=5;
          if (nullphib!=3)
            phibStatus=phibSectorTotal;
          else 
            phibStatus=5;
          
          cmsME.find("TrigLutSummary")->second->setBinContent(sect,wh+3,glbStatus);
          cmsME.find(fullName("PhiLutSummary"))->second->setBinContent(sect,wh+3,phiStatus);
          cmsME.find(fullName("PhibLutSummary"))->second->setBinContent(sect,wh+3,phibStatus);
        }
      }
    }
  }

}

Member Data Documentation

Definition at line 55 of file DTTriggerLutTest.h.

Definition at line 52 of file DTTriggerLutTest.h.

Definition at line 53 of file DTTriggerLutTest.h.

Definition at line 52 of file DTTriggerLutTest.h.

Definition at line 53 of file DTTriggerLutTest.h.

double DTTriggerLutTest::validRange [private]

Definition at line 54 of file DTTriggerLutTest.h.