CMS 3D CMS Logo

DTSegmentAnalysisTest Class Reference

* DQM Test Client More...

#include <DQM/DTMonitorClient/src/DTSegmentAnalysisTest.h>

Inheritance diagram for DTSegmentAnalysisTest:

edm::EDAnalyzer

List of all members.

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze.
void beginJob (const edm::EventSetup &c)
 BeginJob.
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
void bookHistos ()
 book the summary histograms
 DTSegmentAnalysisTest (const edm::ParameterSet &ps)
 Constructor.
void endJob (void)
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
 DQM Client Diagnostic.
void endRun (const edm::Run &run, const edm::EventSetup &eSetup)
std::string getMEName (const DTChamberId &chID, std::string histoTag)
 Get the ME name.
virtual ~DTSegmentAnalysisTest ()
 Destructor.

Private Attributes

std::map< std::pair< int, int >,
MonitorElement * > 
chi2Histos
DQMStoredbe
bool detailedAnalysis
edm::ESHandle< DTGeometrymuonGeom
int nevents
unsigned int nLumiSegs
bool normalizeHistoPlots
edm::ParameterSet parameters
std::map< std::pair< int, int >,
MonitorElement * > 
segmRecHitHistos
std::map< int, MonitorElement * > summaryHistos


Detailed Description

* DQM Test Client

Date
2008/11/28 11:11:48
Revision
1.6
Author:
G. Mila - INFN Torino

Definition at line 41 of file DTSegmentAnalysisTest.h.


Constructor & Destructor Documentation

DTSegmentAnalysisTest::DTSegmentAnalysisTest ( const edm::ParameterSet ps  ) 

Constructor.

Definition at line 45 of file DTSegmentAnalysisTest.cc.

References dbe, detailedAnalysis, edm::ParameterSet::getUntrackedParameter(), normalizeHistoPlots, and parameters.

00045                                                                      {
00046 
00047   edm::LogVerbatim ("DTDQM|DTMonitorClient|DTSegmentAnalysisTest") << "[DTSegmentAnalysisTest]: Constructor";
00048   parameters = ps;
00049 
00050   dbe = edm::Service<DQMStore>().operator->();
00051 
00052   // get the cfi parameters
00053   detailedAnalysis = parameters.getUntrackedParameter<bool>("detailedAnalysis","false");
00054   normalizeHistoPlots  = parameters.getUntrackedParameter<bool>("normalizeHistoPlots",false);
00055 }

DTSegmentAnalysisTest::~DTSegmentAnalysisTest (  )  [virtual]

Destructor.

Definition at line 58 of file DTSegmentAnalysisTest.cc.

References nevents.

00058                                              {
00059 
00060   edm::LogVerbatim ("DTDQM|DTMonitorClient|DTSegmentAnalysisTest") << "DTSegmentAnalysisTest: analyzed " << nevents << " events";
00061 }


Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 85 of file DTSegmentAnalysisTest.cc.

References nevents.

00085                                                                                   {
00086  
00087   nevents++;
00088   if(nevents%1000 == 0)
00089     LogVerbatim ("DTDQM|DTMonitorClient|DTSegmentAnalysisTest") << "[DTSegmentAnalysisTest]: "<<nevents<<" events";
00090 
00091 }

void DTSegmentAnalysisTest::beginJob ( const edm::EventSetup c  )  [virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 64 of file DTSegmentAnalysisTest.cc.

References bookHistos(), edm::EventSetup::get(), muonGeom, and nevents.

00064                                                                 {
00065 
00066   edm::LogVerbatim ("DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<"[DTSegmentAnalysisTest]: BeginJob"; 
00067 
00068   nevents = 0;
00069   // Get the geometry
00070   context.get<MuonGeometryRecord>().get(muonGeom);
00071 
00072   // book the histos
00073   bookHistos();  
00074 
00075 }

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

Reimplemented from edm::EDAnalyzer.

Definition at line 78 of file DTSegmentAnalysisTest.cc.

00078                                                                                                           {
00079 
00080   edm::LogVerbatim ("DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<"[DTSegmentAnalysisTest]: Begin of LS transition";
00081 
00082 }

void DTSegmentAnalysisTest::bookHistos (  ) 

book the summary histograms

Definition at line 245 of file DTSegmentAnalysisTest.cc.

References DQMStore::book1D(), DQMStore::book2D(), chi2Histos, dbe, detailedAnalysis, segmRecHitHistos, DQMStore::setCurrentFolder(), and summaryHistos.

Referenced by beginJob().

00245                                        {
00246 
00247   for(int wh=-2; wh<=2; wh++){
00248       stringstream wheel; wheel << wh;
00249       string histoName =  "segmentSummary_W" + wheel.str();
00250       dbe->setCurrentFolder("DT/02-Segments");
00251       summaryHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),12,1,13,4,1,5);
00252       summaryHistos[wh]->setAxisTitle("Sector",1);
00253       summaryHistos[wh]->setBinLabel(1,"MB1",2);
00254       summaryHistos[wh]->setBinLabel(2,"MB2",2);
00255       summaryHistos[wh]->setBinLabel(3,"MB3",2);
00256       summaryHistos[wh]->setBinLabel(4,"MB4",2);
00257 
00258       if(detailedAnalysis){
00259         for(int sect=1; sect<=14; sect++){
00260           stringstream sector; sector << sect;
00261           string chi2HistoName =  "chi2BadSegmPercentual_W" + wheel.str() + "_Sec" + sector.str();
00262           dbe->setCurrentFolder("DT/02-Segments/Wheel" + wheel.str() + "/Tests");
00263           chi2Histos[make_pair(wh,sect)] = dbe->book1D(chi2HistoName.c_str(),chi2HistoName.c_str(),4,1,5);
00264           chi2Histos[make_pair(wh,sect)]->setBinLabel(1,"MB1");
00265           chi2Histos[make_pair(wh,sect)]->setBinLabel(2,"MB2");
00266           chi2Histos[make_pair(wh,sect)]->setBinLabel(3,"MB3");
00267           chi2Histos[make_pair(wh,sect)]->setBinLabel(4,"MB4");
00268           
00269           string segmHistoName =  "residualsOnSegmRecHitNumber_W" + wheel.str() + "_Sec" + sector.str();
00270           segmRecHitHistos[make_pair(wh,sect)] = dbe->book1D(segmHistoName.c_str(),segmHistoName.c_str(),4,1,5);
00271           segmRecHitHistos[make_pair(wh,sect)]->setBinLabel(1,"MB1");
00272           segmRecHitHistos[make_pair(wh,sect)]->setBinLabel(2,"MB2");
00273           segmRecHitHistos[make_pair(wh,sect)]->setBinLabel(3,"MB3");
00274           segmRecHitHistos[make_pair(wh,sect)]->setBinLabel(4,"MB4");
00275           
00276         }
00277       }
00278   }
00279   
00280   string histoName =  "segmentSummary";
00281   dbe->setCurrentFolder("DT/02-Segments");
00282   summaryHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),12,1,13,5,-2,3);
00283   summaryHistos[3]->setAxisTitle("Sector",1);
00284   summaryHistos[3]->setAxisTitle("Wheel",2); 
00285 
00286 }

void DTSegmentAnalysisTest::endJob ( void   )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 291 of file DTSegmentAnalysisTest.cc.

00291                                    {
00292 }

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

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 94 of file DTSegmentAnalysisTest.cc.

References funct::abs(), chi2Histos, dbe, detailedAnalysis, lat::endl(), DQMStore::get(), QReport::getBadChannels(), getMEName(), MonitorElement::getTH1F(), MonitorElement::getTH2F(), edm::ParameterSet::getUntrackedParameter(), histo, edm::LuminosityBlock::id(), int, edm::LuminosityBlockID::luminosityBlock(), muonGeom, nLumiSegs, parameters, DTChamberId::sector(), segmRecHitHistos, DTChamberId::station(), summaryHistos, dimuonsSequences_cff::threshold, and DTChamberId::wheel().

00094                                                                                                         {
00095 
00096   // counts number of lumiSegs 
00097   nLumiSegs = lumiSeg.id().luminosityBlock();
00098  
00099   edm::LogVerbatim ("DTDQM|DTMonitorClient|DTSegmentAnalysisTest")
00100     <<"[DTSegmentAnalysisTest]: End of LS " << nLumiSegs << ", perform DQM client operation";
00101 
00102   summaryHistos[3]->Reset();
00103   vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
00104   vector<DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
00105  
00106   for (; ch_it != ch_end; ++ch_it) {
00107     DTChamberId chID = (*ch_it)->id();
00108     
00109     MonitorElement * segm_histo = dbe->get(getMEName(chID, "h4DSegmNHits"));
00110     MonitorElement * summary_histo = dbe->get(getMEName(chID, "numberOfSegments"));
00111    
00112     if (segm_histo && summary_histo) {
00113       
00114       TH1F * segmHit_histo_root = segm_histo->getTH1F();
00115       TH2F * segm_histo_root = summary_histo->getTH2F();
00116       TH2F * summary_histo_root = summaryHistos[3]->getTH2F();
00117       
00118       int sector = chID.sector();
00119       if(sector == 13) sector=4;
00120       if(sector == 14) sector=10;
00121       
00122       
00123       if((chID.station()!=4 && segmHit_histo_root->GetMaximumBin() != 12)||
00124          (chID.station()==4 &&  segmHit_histo_root->GetMaximumBin() != 8)){
00125         summaryHistos[chID.wheel()]->setBinContent(sector, chID.station(),1);
00126         if(summary_histo_root->GetBinContent(sector, chID.wheel()+3)<1)
00127           summaryHistos[3]->setBinContent(sector, chID.wheel()+3,1);  
00128       }
00129       else
00130         summaryHistos[chID.wheel()]->setBinContent(sector, chID.station(),0);
00131     
00132       if(detailedAnalysis) {
00133         if(chID.station()!=4)
00134           segmRecHitHistos[make_pair(chID.wheel(),chID.sector())]->Fill(chID.station(),abs(12-segmHit_histo_root->GetMaximumBin()));
00135         else
00136            segmRecHitHistos[make_pair(chID.wheel(),chID.sector())]->Fill(chID.station(),abs(8-segmHit_histo_root->GetMaximumBin()));
00137       }
00138 
00139       TH2F * summary2_histo_root = summaryHistos[3]->getTH2F();
00140       
00141       if(segm_histo_root->GetBinContent(sector,chID.station())==0){
00142         summaryHistos[chID.wheel()]->setBinContent(sector, chID.station(),2);
00143         if(summary2_histo_root->GetBinContent(sector, chID.wheel()+3)<2)
00144           summaryHistos[3]->setBinContent(sector, chID.wheel()+3,2);
00145       }
00146       
00147     } else {
00148       LogVerbatim ("DTDQM|DTMonitorClient|DTSegmentAnalysisTest") << "[DTSegmentAnalysisTest]: histos not found!!"; // FIXME
00149     }
00150 
00151     if(detailedAnalysis){ // switch on detailed analysis
00152    
00153       //test on chi2 segment quality
00154       MonitorElement * chi2_histo = dbe->get(getMEName(chID, "h4DChi2"));
00155       if(chi2_histo) {
00156         TH1F * chi2_histo_root = chi2_histo->getTH1F();
00157         double threshold = parameters.getUntrackedParameter<double>("chi2Threshold", 5);
00158         double maximum = chi2_histo_root->GetXaxis()->GetXmax();
00159         double minimum = chi2_histo_root->GetXaxis()->GetXmin();
00160         int nbins = chi2_histo_root->GetXaxis()->GetNbins();
00161         int thresholdBin = int(threshold/((maximum-minimum)/nbins));
00162         
00163         double badSegments=0;
00164         for(int bin=thresholdBin; bin<=nbins; bin++){
00165           badSegments+=chi2_histo_root->GetBinContent(bin);
00166         }
00167       
00168         if(chi2_histo_root->GetEntries()!=0){
00169           double badSegmentsPercentual= badSegments/double(chi2_histo_root->GetEntries());
00170           chi2Histos[make_pair(chID.wheel(),chID.sector())]->Fill(chID.station(),badSegmentsPercentual);
00171         }
00172       } else {
00173         edm::LogVerbatim ("DTDQM|DTMonitorClient|DTSegmentAnalysisTest") <<"[DTSegmentAnalysisTest]: Histo: "
00174                                                                          << getMEName(chID, "h4DChi2") << " not found!" << endl;
00175       }
00176     } // end of switch for detailed analysis
00177     
00178   } //loop over all the chambers
00179   
00180 
00181   if(detailedAnalysis){
00182     
00183     string chi2CriterionName = parameters.getUntrackedParameter<string>("chi2TestName","chi2InRange");
00184     for(map<pair<int, int>, MonitorElement*> ::const_iterator histo = chi2Histos.begin();
00185         histo != chi2Histos.end();
00186         histo++) {
00187 
00188       const QReport * theChi2QReport = (*histo).second->getQReport(chi2CriterionName);
00189       if(theChi2QReport) {
00190         vector<dqm::me_util::Channel> badChannels = theChi2QReport->getBadChannels();
00191         for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); 
00192              channel != badChannels.end(); channel++) {
00193           edm::LogError ("DTDQM|DTMonitorClient|DTSegmentAnalysisTest") << "Wheel: "<<(*histo).first.first<< " Sector: "<<(*histo).first.second<< " Bad stations: "<<(*channel).getBin()<<"  Contents : "<<(*channel).getContents();
00194         }
00195       }
00196     }
00197     
00198     string segmRecHitCriterionName = parameters.getUntrackedParameter<string>("segmRecHitTestName","segmRecHitInRange");
00199     for(map<pair<int, int>, MonitorElement*> ::const_iterator histo = segmRecHitHistos.begin();
00200         histo != segmRecHitHistos.end();
00201         histo++) {
00202 
00203       const QReport * theSegmRecHitQReport = (*histo).second->getQReport(segmRecHitCriterionName);
00204       if(theSegmRecHitQReport) {
00205         vector<dqm::me_util::Channel> badChannels = theSegmRecHitQReport->getBadChannels();
00206         for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); 
00207              channel != badChannels.end(); channel++) {
00208           edm::LogError ("DTDQM|DTMonitorClient|DTSegmentAnalysisTest") << "Wheel: "<<(*histo).first.first<< " Sector: "<<(*histo).first.second<< " Bad stations on recHit number: "<<(*channel).getBin()<<"  Contents : "<<(*channel).getContents();
00209         }
00210       }
00211     }
00212 
00213   } // end of detailedAnalysis
00214 
00215 }

void DTSegmentAnalysisTest::endRun ( const edm::Run run,
const edm::EventSetup eSetup 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 295 of file DTSegmentAnalysisTest.cc.

References dbe, lat::endl(), DQMStore::get(), normalizeHistoPlots, and DTTimeEvolutionHisto::normalizeTo().

00295                                                                            {
00296 
00297 
00298   if(normalizeHistoPlots) {
00299     LogVerbatim ("DTDQM|DTMonitorClient|DTSegmentAnalysisTest") << " Performing time-histo normalization" << endl;
00300     MonitorElement* hNevtPerLS = dbe->get("DT/EventInfo/NevtPerLS");
00301     if(hNevtPerLS != 0) {
00302       for(int wheel = -2; wheel != 3; ++wheel) { // loop over wheels
00303         for(int sector = 1; sector <= 12; ++sector) { // loop over sectors
00304           stringstream wheelstr; wheelstr << wheel;     
00305           stringstream sectorstr; sectorstr << sector;
00306           string sectorHistoName = "DT/02-Segments/Wheel" + wheelstr.str() +
00307             "/Sector" + sectorstr.str() +
00308             "/NSegmPerEvent_W" + wheelstr.str() +
00309             "_Sec" + sectorstr.str();
00310           DTTimeEvolutionHisto hNSegmPerLS(&(*dbe), sectorHistoName);
00311           hNSegmPerLS.normalizeTo(hNevtPerLS);
00312         }
00313       }
00314     } else {
00315       edm::LogError ("DTDQM|DTMonitorClient|DTSegmentAnalysisTest") << "Histo NevtPerLS not found!" << endl;
00316     }
00317   }
00318 }

std::string DTSegmentAnalysisTest::getMEName ( const DTChamberId chID,
std::string  histoTag 
)

Get the ME name.

Referenced by endLuminosityBlock().


Member Data Documentation

std::map< std::pair<int,int>, MonitorElement* > DTSegmentAnalysisTest::chi2Histos [private]

Definition at line 87 of file DTSegmentAnalysisTest.h.

Referenced by bookHistos(), and endLuminosityBlock().

DQMStore* DTSegmentAnalysisTest::dbe [private]

Definition at line 81 of file DTSegmentAnalysisTest.h.

Referenced by bookHistos(), DTSegmentAnalysisTest(), endLuminosityBlock(), and endRun().

bool DTSegmentAnalysisTest::detailedAnalysis [private]

Definition at line 79 of file DTSegmentAnalysisTest.h.

Referenced by bookHistos(), DTSegmentAnalysisTest(), and endLuminosityBlock().

edm::ESHandle<DTGeometry> DTSegmentAnalysisTest::muonGeom [private]

Definition at line 84 of file DTSegmentAnalysisTest.h.

Referenced by beginJob(), and endLuminosityBlock().

int DTSegmentAnalysisTest::nevents [private]

Definition at line 76 of file DTSegmentAnalysisTest.h.

Referenced by analyze(), beginJob(), and ~DTSegmentAnalysisTest().

unsigned int DTSegmentAnalysisTest::nLumiSegs [private]

Definition at line 77 of file DTSegmentAnalysisTest.h.

Referenced by endLuminosityBlock().

bool DTSegmentAnalysisTest::normalizeHistoPlots [private]

Definition at line 90 of file DTSegmentAnalysisTest.h.

Referenced by DTSegmentAnalysisTest(), and endRun().

edm::ParameterSet DTSegmentAnalysisTest::parameters [private]

Definition at line 83 of file DTSegmentAnalysisTest.h.

Referenced by DTSegmentAnalysisTest(), and endLuminosityBlock().

std::map< std::pair<int,int>, MonitorElement* > DTSegmentAnalysisTest::segmRecHitHistos [private]

Definition at line 88 of file DTSegmentAnalysisTest.h.

Referenced by bookHistos(), and endLuminosityBlock().

std::map< int, MonitorElement* > DTSegmentAnalysisTest::summaryHistos [private]

Definition at line 89 of file DTSegmentAnalysisTest.h.

Referenced by bookHistos(), and endLuminosityBlock().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:19:05 2009 for CMSSW by  doxygen 1.5.4