CMS 3D CMS Logo

Public Member Functions | Private Attributes

DTnoiseDBValidation Class Reference

#include <DTnoiseDBValidation.h>

Inheritance diagram for DTnoiseDBValidation:
edm::EDAnalyzer

List of all members.

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup)
void beginJob ()
 Operations.
void beginRun (const edm::Run &run, const edm::EventSetup &setup)
 DTnoiseDBValidation (const edm::ParameterSet &pset)
 Constructor.
void endJob ()
virtual ~DTnoiseDBValidation ()
 Destructor.

Private Attributes

DQMStoredbe
MonitorElementdiffHisto
edm::ESHandle< DTGeometrydtGeom
std::string labelDB
std::string labelDBRef
MonitorElementlayerHisto
std::string metname
const DTStatusFlagnoiseMap
const DTStatusFlagnoiseRefMap
int noisyCells_Ref
int noisyCells_toTest
std::string outputFileName
edm::ParameterSet parameters
MonitorElementsectorHisto
MonitorElementstationHisto
MonitorElementwheelHisto

Detailed Description

Plot the noise from the DB comparaison

Date:
2010/01/07 16:31:59
Revision:
1.2
Author:
G. Mila - INFN Torino

Definition at line 33 of file DTnoiseDBValidation.h.


Constructor & Destructor Documentation

DTnoiseDBValidation::DTnoiseDBValidation ( const edm::ParameterSet pset)

Constructor.

Definition at line 45 of file DTnoiseDBValidation.cc.

References gather_cfg::cout, edm::ParameterSet::getUntrackedParameter(), cmsCodeRules::cppFunctionSkipper::operator, and Parameters::parameters.

                                                                 {

  cout << "[DTnoiseDBValidation] Constructor called!" << endl;

  // Get the DQM needed services
  dbe = edm::Service<DQMStore>().operator->();
  dbe->setCurrentFolder("DT/noiseDBValidation");

  // Get dataBase label
  labelDBRef = pset.getUntrackedParameter<string>("labelDBRef");
  labelDB = pset.getUntrackedParameter<string>("labelDB");

  parameters = pset;
}
DTnoiseDBValidation::~DTnoiseDBValidation ( ) [virtual]

Destructor.

Definition at line 61 of file DTnoiseDBValidation.cc.

{}

Member Function Documentation

void DTnoiseDBValidation::analyze ( const edm::Event event,
const edm::EventSetup setup 
) [inline, virtual]

Implements edm::EDAnalyzer.

Definition at line 46 of file DTnoiseDBValidation.h.

{}
void DTnoiseDBValidation::beginJob ( void  ) [virtual]

Operations.

Reimplemented from edm::EDAnalyzer.

Definition at line 76 of file DTnoiseDBValidation.cc.

References abs, gather_cfg::cout, DTTopology::lastChannel(), DTWireId::layerId(), LogTrace, metname, dumpDBToFile_GT_ttrig_cfg::outputFileName, Parameters::parameters, and relativeConstraints::station.

                                   {


  metname = "noiseDbValidation";
  LogTrace(metname)<<"[DTnoiseDBValidation] Parameters initialization";
 
  outputFileName = parameters.getUntrackedParameter<std::string>("OutputFileName");

  noisyCells_Ref=0;
  noisyCells_toTest=0;

  // histo booking
  diffHisto = dbe->book1D("noisyCellDiff", "percentual (wrt the previous db) total number of noisy cells",1, 0.5, 1.5);
  diffHisto->setBinLabel(1,"diff");
  wheelHisto = dbe->book1D("wheelOccupancy", "percentual noisy cells occupancy per wheel",5, -2.5, 2.5);
  wheelHisto->setBinLabel(1,"wh-2");
  wheelHisto->setBinLabel(2,"wh-1");
  wheelHisto->setBinLabel(3,"wh0");
  wheelHisto->setBinLabel(4,"wh1");
  wheelHisto->setBinLabel(5,"wh2");
  stationHisto = dbe->book1D("stationOccupancy", "percentual noisy cells occupancy per station",4, 0.5, 4.5);
  stationHisto->setBinLabel(1,"st1");
  stationHisto->setBinLabel(2,"st2");
  stationHisto->setBinLabel(3,"st3");
  stationHisto->setBinLabel(4,"st4");
  sectorHisto = dbe->book1D("sectorOccupancy", "percentual noisy cells occupancy per sector",12, 0.5, 12.5);
  sectorHisto->setBinLabel(1,"sect1");
  sectorHisto->setBinLabel(2,"sect2");
  sectorHisto->setBinLabel(3,"sect3");
  sectorHisto->setBinLabel(4,"sect4");
  sectorHisto->setBinLabel(5,"sect5");
  sectorHisto->setBinLabel(6,"sect6");
  sectorHisto->setBinLabel(7,"sect7");
  sectorHisto->setBinLabel(8,"sect8");
  sectorHisto->setBinLabel(9,"sect9");
  sectorHisto->setBinLabel(10,"sect10");
  sectorHisto->setBinLabel(11,"sect11");
  sectorHisto->setBinLabel(12,"sect12");
  layerHisto = dbe->book1D("layerOccupancy", "percentual noisy cells occupancy per layer",3, 0.5, 3.5);
  layerHisto->setBinLabel(1,"first 10 bins");
  layerHisto->setBinLabel(2,"middle bins");
  layerHisto->setBinLabel(3,"last 10 bins");

  // map initialization
  map<int, int> whMap;
  whMap.clear();
  map<int, int> stMap;
  stMap.clear();
  map<int, int> sectMap;
  sectMap.clear();
  map<int, int> layerMap;
  layerMap.clear();

  // Loop over Ref DB entries
  for(DTStatusFlag::const_iterator noise = noiseRefMap->begin();
      noise != noiseRefMap->end(); noise++) {
    DTWireId wireId((*noise).first.wheelId,
                    (*noise).first.stationId,
                    (*noise).first.sectorId,
                    (*noise).first.slId,
                    (*noise).first.layerId,
                    (*noise).first.cellId);
    cout<< "Ref Wire: " <<  wireId<<endl;
    noisyCells_Ref++;
  }

  // Loop over Ref DB entries
  for(DTStatusFlag::const_iterator noise = noiseMap->begin();
      noise != noiseMap->end(); noise++) {
    DTWireId wireId((*noise).first.wheelId,
                    (*noise).first.stationId,
                    (*noise).first.sectorId,
                    (*noise).first.slId,
                    (*noise).first.layerId,
                    (*noise).first.cellId);
    cout<< "toTest Wire: " <<  wireId<<endl;
    noisyCells_toTest++;

    whMap[(*noise).first.wheelId]++;
    stMap[(*noise).first.stationId]++;
    sectMap[(*noise).first.sectorId]++;
    
    const DTTopology& dtTopo = dtGeom->layer(wireId.layerId())->specificTopology();
    const int lastWire = dtTopo.lastChannel();
    if((*noise).first.cellId<=10)
      layerMap[1]++;
    if((*noise).first.cellId>10 && (*noise).first.cellId<(lastWire-10))
      layerMap[2]++;
    if((*noise).first.cellId>=(lastWire-10))
      layerMap[3]++;
                                         
  }

  //histo filling
  double scale = 1/double(noisyCells_Ref);
  diffHisto->Fill(1,abs(noisyCells_Ref-noisyCells_toTest)*scale);

  scale = 1/double(noisyCells_toTest);
  for(map<int, int >::const_iterator wheel = whMap.begin();
        wheel != whMap.end();
        wheel++) {
    wheelHisto->Fill((*wheel).first, ((*wheel).second)*scale);
  }
  for(map<int, int >::const_iterator station = stMap.begin();
        station != stMap.end();
        station++) {
    stationHisto->Fill((*station).first, ((*station).second)*scale);
  }
  for(map<int, int >::const_iterator sector = sectMap.begin();
        sector != sectMap.end();
        sector++) {
    sectorHisto->Fill((*sector).first, ((*sector).second)*scale);
  }
  for(map<int, int >::const_iterator layer = layerMap.begin();
        layer != layerMap.end();
        layer++) {
    layerHisto->Fill((*layer).first, ((*layer).second)*scale);
  }

}
void DTnoiseDBValidation::beginRun ( const edm::Run run,
const edm::EventSetup setup 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 63 of file DTnoiseDBValidation.cc.

References edm::EventSetup::get().

                                                                             {
  ESHandle<DTStatusFlag> noise_Ref;
  setup.get<DTStatusFlagRcd>().get(labelDBRef, noise_Ref);
  noiseRefMap = &*noise_Ref;
 
  ESHandle<DTStatusFlag> noise_toTest;
  setup.get<DTStatusFlagRcd>().get(labelDB, noise_toTest);
  noiseMap = &*noise_toTest;

  // Get the geometry
  setup.get<MuonGeometryRecord>().get(dtGeom);
}
void DTnoiseDBValidation::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 197 of file DTnoiseDBValidation.cc.

References gather_cfg::cout, QReport::getBadChannels(), dumpDBToFile_GT_ttrig_cfg::outputFileName, and Parameters::parameters.

                                 {

  // test on difference histo
  string testCriterionName = parameters.getUntrackedParameter<string>("diffTestName","noiseDifferenceInRange");
  const QReport * theDiffQReport = diffHisto->getQReport(testCriterionName);
  if(theDiffQReport) {
      vector<dqm::me_util::Channel> badChannels = theDiffQReport->getBadChannels();
      for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); 
           channel != badChannels.end(); channel++) {
        cout << " Bad partial difference of noisy channels! Contents : "<<(*channel).getContents()<<endl;
      }
  }
  testCriterionName = parameters.getUntrackedParameter<string>("wheelTestName","noiseWheelOccInRange");
  const QReport * theDiffQReport2 = wheelHisto->getQReport(testCriterionName);
  if(theDiffQReport2) {
      vector<dqm::me_util::Channel> badChannels = theDiffQReport2->getBadChannels();
      for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); 
           channel != badChannels.end(); channel++) {
        int wheel = (*channel).getBin()-3;
        cout << " Bad percentual occupancy for wheel : "<<wheel<<"  Contents : "<<(*channel).getContents()<<endl;
      }
  }
  testCriterionName = parameters.getUntrackedParameter<string>("stationTestName","noiseStationOccInRange");
  const QReport * theDiffQReport3 = stationHisto->getQReport(testCriterionName);
  if(theDiffQReport3) {
      vector<dqm::me_util::Channel> badChannels = theDiffQReport3->getBadChannels();
      for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); 
           channel != badChannels.end(); channel++) {
        cout << " Bad percentual occupancy for station : "<<(*channel).getBin()<<"  Contents : "<<(*channel).getContents()<<endl;
      }
  }
  testCriterionName = parameters.getUntrackedParameter<string>("sectorTestName","noiseSectorOccInRange");
  const QReport * theDiffQReport4 = sectorHisto->getQReport(testCriterionName);
  if(theDiffQReport4) {
      vector<dqm::me_util::Channel> badChannels = theDiffQReport4->getBadChannels();
      for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); 
           channel != badChannels.end(); channel++) {
        cout << " Bad percentual occupancy for sector : "<<(*channel).getBin()<<"  Contents : "<<(*channel).getContents()<<endl;
      }
  }
  testCriterionName = parameters.getUntrackedParameter<string>("layerTestName","noiseLayerOccInRange");
  const QReport * theDiffQReport5 = layerHisto->getQReport(testCriterionName);
  if(theDiffQReport5) {
      vector<dqm::me_util::Channel> badChannels = theDiffQReport5->getBadChannels();
      for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); 
           channel != badChannels.end(); channel++) {
        if((*channel).getBin()==1)
          cout << " Bad percentual occupancy for the first 10 wires! Contents : "<<(*channel).getContents()<<endl;
        if((*channel).getBin()==2)
          cout << " Bad percentual occupancy for the middle wires! Contents : "<<(*channel).getContents()<<endl;
        if((*channel).getBin()==3)
          cout << " Bad percentual occupancy for the last 10 wires! Contents : "<<(*channel).getContents()<<endl;
      }
  }

  // write the histos on a file
  dbe->save(outputFileName);

}

Member Data Documentation

Definition at line 54 of file DTnoiseDBValidation.h.

Definition at line 75 of file DTnoiseDBValidation.h.

Definition at line 65 of file DTnoiseDBValidation.h.

std::string DTnoiseDBValidation::labelDB [private]

Definition at line 60 of file DTnoiseDBValidation.h.

std::string DTnoiseDBValidation::labelDBRef [private]

Definition at line 59 of file DTnoiseDBValidation.h.

Definition at line 79 of file DTnoiseDBValidation.h.

std::string DTnoiseDBValidation::metname [private]

Definition at line 57 of file DTnoiseDBValidation.h.

Definition at line 68 of file DTnoiseDBValidation.h.

Definition at line 69 of file DTnoiseDBValidation.h.

Definition at line 72 of file DTnoiseDBValidation.h.

Definition at line 73 of file DTnoiseDBValidation.h.

std::string DTnoiseDBValidation::outputFileName [private]

Definition at line 62 of file DTnoiseDBValidation.h.

Definition at line 55 of file DTnoiseDBValidation.h.

Definition at line 78 of file DTnoiseDBValidation.h.

Definition at line 77 of file DTnoiseDBValidation.h.

Definition at line 76 of file DTnoiseDBValidation.h.