CMS 3D CMS Logo

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

DTNoiseAnalysisTest Class Reference

#include <DTNoiseAnalysisTest.h>

Inheritance diagram for DTNoiseAnalysisTest:
edm::EDAnalyzer

List of all members.

Public Member Functions

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

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze.
void beginJob ()
 BeginJob.
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
void beginRun (edm::Run const &run, edm::EventSetup const &context)
 BeginRun.
void bookHistos ()
 book the summary histograms
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
 DQM Client Diagnostic.

Private Member Functions

std::string getMEName (const DTChamberId &chID)
 Get the ME name.
std::string getSynchNoiseMEName (int wheelId) const

Private Attributes

DQMStoredbe
bool doSynchNoise
double maxSynchNoiseRate
edm::ESHandle< DTGeometrymuonGeom
int nevents
std::map< int, MonitorElement * > noiseHistos
int noisyCellDef
std::map< int, MonitorElement * > noisyCellHistos
MonitorElementsummaryNoiseHisto
MonitorElementsummarySynchNoiseHisto

Detailed Description

* DQM Test Client

Date:
2010/01/05 10:15:46
Revision:
1.5
Author:
G. Mila - INFN Torino

Definition at line 34 of file DTNoiseAnalysisTest.h.


Constructor & Destructor Documentation

DTNoiseAnalysisTest::DTNoiseAnalysisTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 40 of file DTNoiseAnalysisTest.cc.

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

                                                                 {
  LogTrace("DTDQM|DTMonitorClient|DTNoiseAnalysisTest") << "[DTNoiseAnalysisTest]: Constructor";

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

  // get the cfi parameters
  noisyCellDef = ps.getUntrackedParameter<int>("noisyCellDef",500);

  // switch on/off the summaries for the Synchronous noise
  doSynchNoise = ps.getUntrackedParameter<bool>("doSynchNoise", false);
  maxSynchNoiseRate =  ps.getUntrackedParameter<double>("maxSynchNoiseRate", 0.001);

}
DTNoiseAnalysisTest::~DTNoiseAnalysisTest ( ) [virtual]

Destructor.

Definition at line 55 of file DTNoiseAnalysisTest.cc.

References LogTrace, and nevents.

                                         {
  LogTrace("DTDQM|DTMonitorClient|DTNoiseAnalysisTest") << "DTNoiseAnalysisTest: analyzed " << nevents << " events";
}

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 84 of file DTNoiseAnalysisTest.cc.

References LogTrace, and nevents.

                                                                                {

  nevents++;
  if(nevents%1000 == 0) LogTrace("DTDQM|DTMonitorClient|DTNoiseAnalysisTest")
    << "[DTNoiseAnalysisTest]: "<<nevents<<" events";

}
void DTNoiseAnalysisTest::beginJob ( void  ) [protected, virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 60 of file DTNoiseAnalysisTest.cc.

References bookHistos(), LogTrace, and nevents.

                                  {
  LogTrace("DTDQM|DTMonitorClient|DTNoiseAnalysisTest") <<"[DTNoiseAnalysisTest]: BeginJob"; 

  nevents = 0;

  // book the histos
  bookHistos();

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

Reimplemented from edm::EDAnalyzer.

Definition at line 78 of file DTNoiseAnalysisTest.cc.

References LogTrace.

                                                                                                        {

  LogTrace("DTDQM|DTMonitorClient|DTNoiseAnalysisTest") <<"[DTNoiseAnalysisTest]: Begin of LS transition";
}
void DTNoiseAnalysisTest::beginRun ( edm::Run const &  run,
edm::EventSetup const &  context 
) [protected, virtual]

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 70 of file DTNoiseAnalysisTest.cc.

References edm::EventSetup::get().

                                                                            {

  // Get the geometry
  context.get<MuonGeometryRecord>().get(muonGeom);

}
void DTNoiseAnalysisTest::bookHistos ( ) [protected]

book the summary histograms

Definition at line 222 of file DTNoiseAnalysisTest.cc.

                                     {
  
  dbe->setCurrentFolder("DT/05-Noise");
  string histoName;

  for(int wh=-2; wh<=2; wh++){
      stringstream wheel; wheel << wh;
      histoName =  "NoiseRateSummary_W" + wheel.str();
      noiseHistos[wh] = dbe->book1D(histoName.c_str(),histoName.c_str(),100,0,2000);
      noiseHistos[wh]->setAxisTitle("rate (Hz)",1);
      noiseHistos[wh]->setAxisTitle("entries",2);
  }
  histoName =  "NoiseRateSummary";
  noiseHistos[3] = dbe->book1D(histoName.c_str(),histoName.c_str(),100,0,2000);
  noiseHistos[3]->setAxisTitle("rate (Hz)",1);
  noiseHistos[3]->setAxisTitle("entries",2);

  
  for(int wh=-2; wh<=2; wh++){
    stringstream wheel; wheel << wh;
    histoName =  "NoiseSummary_W" + wheel.str();
    noisyCellHistos[wh] = dbe->book2D(histoName.c_str(),"# of noisy channels",12,1,13,4,1,5);
    noisyCellHistos[wh]->setBinLabel(1,"MB1",2);
    noisyCellHistos[wh]->setBinLabel(2,"MB2",2);
    noisyCellHistos[wh]->setBinLabel(3,"MB3",2);
    noisyCellHistos[wh]->setBinLabel(4,"MB4",2);  
    noisyCellHistos[wh]->setAxisTitle("Sector",1);
  }

  histoName =  "NoiseSummary";
  summaryNoiseHisto =  dbe->book2D(histoName.c_str(),"# of noisy channels",12,1,13,5,-2,3);
  summaryNoiseHisto->setAxisTitle("Sector",1);
  summaryNoiseHisto->setAxisTitle("Wheel",2);


  if(doSynchNoise) {
    dbe->setCurrentFolder("DT/05-Noise/SynchNoise/");
    histoName =  "SynchNoiseSummary";
    summarySynchNoiseHisto = dbe->book2D(histoName.c_str(),"Summary Synch. Noise",12,1,13,5,-2,3);
    summarySynchNoiseHisto->setAxisTitle("Sector",1);
    summarySynchNoiseHisto->setAxisTitle("Wheel",2);
  }

}
void DTNoiseAnalysisTest::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
) [protected, virtual]

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 92 of file DTNoiseAnalysisTest.cc.

References MonitorElement::getTH2F(), trackerHits::histo, LogTrace, nevents, EcalCondTools::plot(), DTChamberId::sector(), DTChamberId::station(), and DTChamberId::wheel().

                                                                                                      {
  LogVerbatim ("DTDQM|DTMonitorClient|DTNoiseAnalysisTest")
    <<"[DTNoiseAnalysisTest]: End of LS transition, performing the DQM client operation";

  // Reset the summary plots
  for(map<int, MonitorElement* >::iterator plot =  noiseHistos.begin();
      plot != noiseHistos.end(); ++plot) {
    (*plot).second->Reset();
  }
  
  for(map<int,  MonitorElement* >::iterator plot = noisyCellHistos.begin();
      plot != noisyCellHistos.end(); ++plot) {
    (*plot).second->Reset();
  }

  summaryNoiseHisto->Reset();



  vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
  vector<DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
  
  LogTrace ("DTDQM|DTMonitorClient|DTNoiseAnalysisTest")
    <<"[DTNoiseAnalysisTest]: Fill the summary histos";

  for (; ch_it != ch_end; ++ch_it) { // loop over chambers
    DTChamberId chID = (*ch_it)->id();
    
    MonitorElement * histo = dbe->get(getMEName(chID));
    
    if(histo) { // check the pointer
      
      TH2F * histo_root = histo->getTH2F();
      
      for(int sl = 1; sl != 4; ++sl) { // loop over SLs
        // skip theta SL in MB4 chambers
        if(chID.station() == 4 && sl == 2) continue;

        int binYlow = ((sl-1)*4)+1;

        for(int layer = 1; layer <= 4; ++layer) { // loop over layers
          
          // Get the layer ID
          DTLayerId layID(chID,sl,layer);

          int nWires = muonGeom->layer(layID)->specificTopology().channels();
          int firstWire = muonGeom->layer(layID)->specificTopology().firstChannel();

          int binY = binYlow+(layer-1);

          for(int wire = firstWire; wire != (nWires+firstWire); wire++){ // loop over wires

            double noise = histo_root->GetBinContent(wire, binY);
            // fill the histos
            noiseHistos[chID.wheel()]->Fill(noise);
            noiseHistos[3]->Fill(noise);
            int sector = chID.sector();
            if(noise>noisyCellDef) {
              if(sector == 13) {
                sector = 4;
              } else if(sector == 14) {
                sector = 10;
              }
              noisyCellHistos[chID.wheel()]->Fill(sector,chID.station());
              summaryNoiseHisto->Fill(sector,chID.wheel());
            }
          }
        }
      }
    }
  }


  // build the summary of synch noise
  

  if(doSynchNoise) {
    LogTrace("DTDQM|DTMonitorClient|DTNoiseAnalysisTest")
      << "[DTNoiseAnalysisTest]: fill summaries for synch noise" << endl;
    summarySynchNoiseHisto->Reset();
    for(int wheel = -2; wheel != 3; ++wheel) {
      // Get the histo produced by DTDigiTask
      MonitorElement * histoNoiseSynch = dbe->get(getSynchNoiseMEName(wheel));
      if(histoNoiseSynch != 0) {
        for(int sect = 1; sect != 13; ++sect) { // loop over sectors
          TH2F * histo = histoNoiseSynch->getTH2F();
          for(int sta = 1; sta != 5; ++sta) {
            LogTrace("DTDQM|DTMonitorClient|DTNoiseAnalysisTest")
              << "   Wheel: " << wheel << " sect: " << sect
              << " station: " << sta
              << " rate is: " << histo->GetBinContent(sect, sta)/(float)nevents << endl;
            if(histo->GetBinContent(sect, sta)/(float)nevents > maxSynchNoiseRate) {
              summarySynchNoiseHisto->Fill(sect,wheel,1);
            } else {
                summarySynchNoiseHisto->Fill(sect,wheel,0);
            }
          }
        }
      } else {
        LogWarning("DTDQM|DTMonitorClient|DTNoiseAnalysisTest")
          << "   Histo: " << getSynchNoiseMEName(wheel) << " not found!" << endl;
      }
    }

  }

}              
string DTNoiseAnalysisTest::getMEName ( const DTChamberId chID) [private]

Get the ME name.

Definition at line 201 of file DTNoiseAnalysisTest.cc.

References DTChamberId::sector(), relativeConstraints::station, DTChamberId::station(), and DTChamberId::wheel().

                                                              {
  
  stringstream wheel; wheel << chID.wheel();    
  stringstream station; station << chID.station();      
  stringstream sector; sector << chID.sector(); 
  
  string folderName = 
    "DT/05-Noise/Wheel" +  wheel.str() +
//     "/Station" + station.str() +
    "/Sector" + sector.str() + "/";

  string histoname = folderName + string("NoiseRate")  
    + "_W" + wheel.str() 
    + "_St" + station.str() 
    + "_Sec" + sector.str();
  
  return histoname;
  
}
string DTNoiseAnalysisTest::getSynchNoiseMEName ( int  wheelId) const [private]

Definition at line 269 of file DTNoiseAnalysisTest.cc.

                                                                 {
  
  stringstream wheel; wheel << wheelId; 
  string folderName = 
    "DT/05-Noise/SynchNoise/";
  string histoname = folderName + string("SyncNoiseEvents")  
    + "_W" + wheel.str();

  return histoname;
  
}

Member Data Documentation

Definition at line 73 of file DTNoiseAnalysisTest.h.

Definition at line 87 of file DTNoiseAnalysisTest.h.

Definition at line 88 of file DTNoiseAnalysisTest.h.

Definition at line 76 of file DTNoiseAnalysisTest.h.

Definition at line 71 of file DTNoiseAnalysisTest.h.

std::map< int, MonitorElement* > DTNoiseAnalysisTest::noiseHistos [private]

Definition at line 82 of file DTNoiseAnalysisTest.h.

Definition at line 79 of file DTNoiseAnalysisTest.h.

Definition at line 83 of file DTNoiseAnalysisTest.h.

Definition at line 84 of file DTNoiseAnalysisTest.h.

Definition at line 85 of file DTNoiseAnalysisTest.h.