CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
DTNoiseAnalysisTest Class Reference

#include <DTNoiseAnalysisTest.h>

Inheritance diagram for DTNoiseAnalysisTest:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 DTNoiseAnalysisTest (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTNoiseAnalysisTest ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze. More...
 
void beginJob ()
 BeginJob. More...
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 
void beginRun (edm::Run const &run, edm::EventSetup const &context)
 BeginRun. More...
 
void bookHistos ()
 book the summary histograms More...
 
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
 DQM Client Diagnostic. More...
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Member Functions

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

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 32 of file DTNoiseAnalysisTest.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 37 of file DTNoiseAnalysisTest.cc.

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

37  {
38  LogTrace("DTDQM|DTMonitorClient|DTNoiseAnalysisTest") << "[DTNoiseAnalysisTest]: Constructor";
39 
41 
42  // get the cfi parameters
43  noisyCellDef = ps.getUntrackedParameter<int>("noisyCellDef",500);
44 
45  // switch on/off the summaries for the Synchronous noise
46  doSynchNoise = ps.getUntrackedParameter<bool>("doSynchNoise", false);
47  detailedAnalysis = ps.getUntrackedParameter<bool>("detailedAnalysis",false);
48  maxSynchNoiseRate = ps.getUntrackedParameter<double>("maxSynchNoiseRate", 0.001);
49  nMinEvts = ps.getUntrackedParameter<int>("nEventsCert", 5000);
50 
51 }
T getUntrackedParameter(std::string const &, T const &) const
#define LogTrace(id)
DTNoiseAnalysisTest::~DTNoiseAnalysisTest ( )
virtual

Destructor.

Definition at line 54 of file DTNoiseAnalysisTest.cc.

References LogTrace, and nevents.

54  {
55  LogTrace("DTDQM|DTMonitorClient|DTNoiseAnalysisTest") << "DTNoiseAnalysisTest: analyzed " << nevents << " events";
56 }
#define LogTrace(id)

Member Function Documentation

void DTNoiseAnalysisTest::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

Analyze.

Implements edm::EDAnalyzer.

Definition at line 83 of file DTNoiseAnalysisTest.cc.

References LogTrace, and nevents.

83  {
84 
85  nevents++;
86  if(nevents%1000 == 0) LogTrace("DTDQM|DTMonitorClient|DTNoiseAnalysisTest")
87  << "[DTNoiseAnalysisTest]: "<<nevents<<" events";
88 
89 }
#define LogTrace(id)
void DTNoiseAnalysisTest::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 59 of file DTNoiseAnalysisTest.cc.

References bookHistos(), LogTrace, and nevents.

59  {
60  LogTrace("DTDQM|DTMonitorClient|DTNoiseAnalysisTest") <<"[DTNoiseAnalysisTest]: BeginJob";
61 
62  nevents = 0;
63 
64  // book the histos
65  bookHistos();
66 
67 }
void bookHistos()
book the summary histograms
#define LogTrace(id)
void DTNoiseAnalysisTest::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 77 of file DTNoiseAnalysisTest.cc.

References LogTrace.

77  {
78 
79  LogTrace("DTDQM|DTMonitorClient|DTNoiseAnalysisTest") <<"[DTNoiseAnalysisTest]: Begin of LS transition";
80 }
#define LogTrace(id)
void DTNoiseAnalysisTest::beginRun ( edm::Run const &  run,
edm::EventSetup const &  context 
)
protectedvirtual

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 69 of file DTNoiseAnalysisTest.cc.

References edm::EventSetup::get().

69  {
70 
71  // Get the geometry
72  context.get<MuonGeometryRecord>().get(muonGeom);
73 
74 }
edm::ESHandle< DTGeometry > muonGeom
void DTNoiseAnalysisTest::bookHistos ( )
protected

book the summary histograms

Definition at line 251 of file DTNoiseAnalysisTest.cc.

References hltbtagharvestinganalyzer_cfi::histoName.

251  {
252 
253  dbe->setCurrentFolder("DT/05-Noise");
254  string histoName;
255 
256  for(int wh=-2; wh<=2; wh++){
257  stringstream wheel; wheel << wh;
258  histoName = "NoiseRateSummary_W" + wheel.str();
259  noiseHistos[wh] = dbe->book1D(histoName.c_str(),histoName.c_str(),100,0,2000);
260  noiseHistos[wh]->setAxisTitle("rate (Hz)",1);
261  noiseHistos[wh]->setAxisTitle("entries",2);
262  }
263  histoName = "NoiseRateSummary";
264  noiseHistos[3] = dbe->book1D(histoName.c_str(),histoName.c_str(),100,0,2000);
265  noiseHistos[3]->setAxisTitle("rate (Hz)",1);
266  noiseHistos[3]->setAxisTitle("entries",2);
267 
268 
269  for(int wh=-2; wh<=2; wh++){
270  stringstream wheel; wheel << wh;
271  histoName = "NoiseSummary_W" + wheel.str();
272  noisyCellHistos[wh] = dbe->book2D(histoName.c_str(),"# of noisy channels",12,1,13,4,1,5);
273  noisyCellHistos[wh]->setBinLabel(1,"MB1",2);
274  noisyCellHistos[wh]->setBinLabel(2,"MB2",2);
275  noisyCellHistos[wh]->setBinLabel(3,"MB3",2);
276  noisyCellHistos[wh]->setBinLabel(4,"MB4",2);
277  noisyCellHistos[wh]->setAxisTitle("Sector",1);
278  }
279 
280  histoName = "NoiseSummary";
281  summaryNoiseHisto = dbe->book2D(histoName.c_str(),"# of noisy channels",12,1,13,5,-2,3);
282  summaryNoiseHisto->setAxisTitle("Sector",1);
283  summaryNoiseHisto->setAxisTitle("Wheel",2);
284 
285  if(detailedAnalysis) {
286  histoName = "NoisyChannels";
287  threshChannelsHisto = dbe->book1D(histoName.c_str(),"# of noisy channels vs threshold",15,500,2000);
288  threshChannelsHisto->setAxisTitle("threshold",1);
289  threshChannelsHisto->setAxisTitle("# noisy channels",2);
290  }
291 
292  if(doSynchNoise) {
293  dbe->setCurrentFolder("DT/05-Noise/SynchNoise/");
294  histoName = "SynchNoiseSummary";
295  summarySynchNoiseHisto = dbe->book2D(histoName.c_str(),"Summary Synch. Noise",12,1,13,5,-2,3);
298  histoName = "SynchNoiseGlbSummary";
299  glbSummarySynchNoiseHisto = dbe->book2D(histoName.c_str(),"Summary Synch. Noise",12,1,13,5,-2,3);
302  }
303 
304 }
MonitorElement * threshChannelsHisto
std::map< int, MonitorElement * > noisyCellHistos
MonitorElement * summarySynchNoiseHisto
MonitorElement * glbSummarySynchNoiseHisto
std::map< int, MonitorElement * > noiseHistos
MonitorElement * summaryNoiseHisto
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void DTNoiseAnalysisTest::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
)
protectedvirtual

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 91 of file DTNoiseAnalysisTest.cc.

References MonitorElement::getFloatValue(), MonitorElement::getTH2F(), timingPdfMaker::histo, LogTrace, nevents, plotResiduals::plot(), DTChamberId::sector(), DTChamberId::station(), relval_parameters_module::step, and DTChamberId::wheel().

91  {
92  LogVerbatim ("DTDQM|DTMonitorClient|DTNoiseAnalysisTest")
93  <<"[DTNoiseAnalysisTest]: End of LS transition, performing the DQM client operation";
94 
95  // Reset the summary plots
96  for(map<int, MonitorElement* >::iterator plot = noiseHistos.begin();
97  plot != noiseHistos.end(); ++plot) {
98  (*plot).second->Reset();
99  }
100 
101  for(map<int, MonitorElement* >::iterator plot = noisyCellHistos.begin();
102  plot != noisyCellHistos.end(); ++plot) {
103  (*plot).second->Reset();
104  }
105 
107 
108 
109 
110  vector<const DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
111  vector<const DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
112 
113  LogTrace ("DTDQM|DTMonitorClient|DTNoiseAnalysisTest")
114  <<"[DTNoiseAnalysisTest]: Fill the summary histos";
115 
116  for (; ch_it != ch_end; ++ch_it) { // loop over chambers
117  DTChamberId chID = (*ch_it)->id();
118 
119  MonitorElement * histo = dbe->get(getMEName(chID));
120 
121  if(histo) { // check the pointer
122 
123  TH2F * histo_root = histo->getTH2F();
124 
125  for(int sl = 1; sl != 4; ++sl) { // loop over SLs
126  // skip theta SL in MB4 chambers
127  if(chID.station() == 4 && sl == 2) continue;
128 
129  int binYlow = ((sl-1)*4)+1;
130 
131  for(int layer = 1; layer <= 4; ++layer) { // loop over layers
132 
133  // Get the layer ID
134  DTLayerId layID(chID,sl,layer);
135 
136  int nWires = muonGeom->layer(layID)->specificTopology().channels();
137  int firstWire = muonGeom->layer(layID)->specificTopology().firstChannel();
138 
139  int binY = binYlow+(layer-1);
140 
141  for(int wire = firstWire; wire != (nWires+firstWire); wire++){ // loop over wires
142 
143  double noise = histo_root->GetBinContent(wire, binY);
144  // fill the histos
145  noiseHistos[chID.wheel()]->Fill(noise);
146  noiseHistos[3]->Fill(noise);
147  int sector = chID.sector();
148  if(noise>noisyCellDef) {
149  if(sector == 13) {
150  sector = 4;
151  } else if(sector == 14) {
152  sector = 10;
153  }
154  noisyCellHistos[chID.wheel()]->Fill(sector,chID.station());
155  summaryNoiseHisto->Fill(sector,chID.wheel());
156  }
157  }
158  }
159  }
160  }
161  }
162 
163  if(detailedAnalysis) {
165  TH1F * histo = noiseHistos[3]->getTH1F();
166  for(int step = 0; step != 15; step++) {
167  int threshBin = step + 1;
168  int minBin = 26 + step*5;
169  int nNoisyCh = histo->Integral(minBin,101);
170  threshChannelsHisto->setBinContent(threshBin,nNoisyCh);
171  }
172  }
173 
174  // build the summary of synch noise
175 
176 
177  if(doSynchNoise) {
178  LogTrace("DTDQM|DTMonitorClient|DTNoiseAnalysisTest")
179  << "[DTNoiseAnalysisTest]: fill summaries for synch noise" << endl;
182  for(int wheel = -2; wheel != 3; ++wheel) {
183  // Get the histo produced by DTDigiTask
184  MonitorElement * histoNoiseSynch = dbe->get(getSynchNoiseMEName(wheel));
185  if(histoNoiseSynch != 0) {
186  for(int sect = 1; sect != 13; ++sect) { // loop over sectors
187  TH2F * histo = histoNoiseSynch->getTH2F();
188  float maxSectRate = 0;
189  for(int sta = 1; sta != 5; ++sta) {
190  float chRate = histo->GetBinContent(sect, sta)/(float)nevents;
191  LogTrace("DTDQM|DTMonitorClient|DTNoiseAnalysisTest")
192  << " Wheel: " << wheel << " sect: " << sect
193  << " station: " << sta
194  << " rate is: " << chRate << endl;
195  if (chRate > maxSectRate)
196  maxSectRate = chRate;
197  }
198  summarySynchNoiseHisto->Fill(sect,wheel,
199  maxSectRate > maxSynchNoiseRate ? 1 : 0);
200  float glbBinValue = 1 - 0.15*maxSectRate/maxSynchNoiseRate;
201  glbSummarySynchNoiseHisto->Fill(sect,wheel,glbBinValue>0 ? glbBinValue : 0);
202 
203  }
204  } else {
205  LogWarning("DTDQM|DTMonitorClient|DTNoiseAnalysisTest")
206  << " Histo: " << getSynchNoiseMEName(wheel) << " not found!" << endl;
207  }
208  }
209 
210  }
211 
212  string nEvtsName = "DT/EventInfo/Counters/nProcessedEventsNoise";
213  MonitorElement * meProcEvts = dbe->get(nEvtsName);
214 
215  if (meProcEvts) {
216  int nProcEvts = meProcEvts->getFloatValue();
217  glbSummarySynchNoiseHisto->setEntries(nProcEvts < nMinEvts ? 10. : nProcEvts);
218  summarySynchNoiseHisto->setEntries(nProcEvts < nMinEvts ? 10. : nProcEvts);
219  } else {
222  LogVerbatim ("DTDQM|DTMonitorClient|DTnoiseAnalysisTest") << "[DTNoiseAnalysisTest] ME: "
223  << nEvtsName << " not found!" << endl;
224  }
225 
226 
227 }
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * threshChannelsHisto
std::map< int, MonitorElement * > noisyCellHistos
edm::ESHandle< DTGeometry > muonGeom
void Fill(long long x)
double getFloatValue(void) const
std::string getMEName(const DTChamberId &chID)
Get the ME name.
void setEntries(double nentries)
set # of entries
#define LogTrace(id)
MonitorElement * summarySynchNoiseHisto
MonitorElement * glbSummarySynchNoiseHisto
std::map< int, MonitorElement * > noiseHistos
int sector() const
Definition: DTChamberId.h:61
std::string getSynchNoiseMEName(int wheelId) const
MonitorElement * summaryNoiseHisto
int station() const
Return the station number.
Definition: DTChamberId.h:51
TH2F * getTH2F(void) const
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
void Reset(void)
reset ME (ie. contents, errors, etc)
string DTNoiseAnalysisTest::getMEName ( const DTChamberId chID)
private

Get the ME name.

Definition at line 230 of file DTNoiseAnalysisTest.cc.

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

230  {
231 
232  stringstream wheel; wheel << chID.wheel();
233  stringstream station; station << chID.station();
234  stringstream sector; sector << chID.sector();
235 
236  string folderName =
237  "DT/05-Noise/Wheel" + wheel.str() +
238  // "/Station" + station.str() +
239  "/Sector" + sector.str() + "/";
240 
241  string histoname = folderName + string("NoiseRate")
242  + "_W" + wheel.str()
243  + "_St" + station.str()
244  + "_Sec" + sector.str();
245 
246  return histoname;
247 
248 }
int sector() const
Definition: DTChamberId.h:61
int station() const
Return the station number.
Definition: DTChamberId.h:51
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
string DTNoiseAnalysisTest::getSynchNoiseMEName ( int  wheelId) const
private

Definition at line 308 of file DTNoiseAnalysisTest.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

308  {
309 
310  stringstream wheel; wheel << wheelId;
311  string folderName =
312  "DT/05-Noise/SynchNoise/";
313  string histoname = folderName + string("SyncNoiseEvents")
314  + "_W" + wheel.str();
315 
316  return histoname;
317 
318 }

Member Data Documentation

DQMStore* DTNoiseAnalysisTest::dbe
private

Definition at line 72 of file DTNoiseAnalysisTest.h.

bool DTNoiseAnalysisTest::detailedAnalysis
private

Definition at line 89 of file DTNoiseAnalysisTest.h.

bool DTNoiseAnalysisTest::doSynchNoise
private

Definition at line 88 of file DTNoiseAnalysisTest.h.

MonitorElement* DTNoiseAnalysisTest::glbSummarySynchNoiseHisto
private

Definition at line 86 of file DTNoiseAnalysisTest.h.

double DTNoiseAnalysisTest::maxSynchNoiseRate
private

Definition at line 90 of file DTNoiseAnalysisTest.h.

edm::ESHandle<DTGeometry> DTNoiseAnalysisTest::muonGeom
private

Definition at line 75 of file DTNoiseAnalysisTest.h.

int DTNoiseAnalysisTest::nevents
private

Definition at line 69 of file DTNoiseAnalysisTest.h.

int DTNoiseAnalysisTest::nMinEvts
private

Definition at line 70 of file DTNoiseAnalysisTest.h.

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

Definition at line 81 of file DTNoiseAnalysisTest.h.

int DTNoiseAnalysisTest::noisyCellDef
private

Definition at line 78 of file DTNoiseAnalysisTest.h.

std::map< int, MonitorElement* > DTNoiseAnalysisTest::noisyCellHistos
private

Definition at line 82 of file DTNoiseAnalysisTest.h.

MonitorElement* DTNoiseAnalysisTest::summaryNoiseHisto
private

Definition at line 83 of file DTNoiseAnalysisTest.h.

MonitorElement* DTNoiseAnalysisTest::summarySynchNoiseHisto
private

Definition at line 85 of file DTNoiseAnalysisTest.h.

MonitorElement* DTNoiseAnalysisTest::threshChannelsHisto
private

Definition at line 84 of file DTNoiseAnalysisTest.h.