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
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) 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::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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 34 of file DTNoiseAnalysisTest.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 39 of file DTNoiseAnalysisTest.cc.

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

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

Destructor.

Definition at line 56 of file DTNoiseAnalysisTest.cc.

References LogTrace, and nevents.

56  {
57  LogTrace("DTDQM|DTMonitorClient|DTNoiseAnalysisTest") << "DTNoiseAnalysisTest: analyzed " << nevents << " events";
58 }
#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 85 of file DTNoiseAnalysisTest.cc.

References LogTrace, and nevents.

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 61 of file DTNoiseAnalysisTest.cc.

References bookHistos(), LogTrace, and nevents.

61  {
62  LogTrace("DTDQM|DTMonitorClient|DTNoiseAnalysisTest") <<"[DTNoiseAnalysisTest]: BeginJob";
63 
64  nevents = 0;
65 
66  // book the histos
67  bookHistos();
68 
69 }
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 79 of file DTNoiseAnalysisTest.cc.

References LogTrace.

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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 71 of file DTNoiseAnalysisTest.cc.

References edm::EventSetup::get().

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

book the summary histograms

Definition at line 253 of file DTNoiseAnalysisTest.cc.

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

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 93 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().

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

Get the ME name.

Definition at line 232 of file DTNoiseAnalysisTest.cc.

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

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

Definition at line 310 of file DTNoiseAnalysisTest.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

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

Member Data Documentation

DQMStore* DTNoiseAnalysisTest::dbe
private

Definition at line 74 of file DTNoiseAnalysisTest.h.

bool DTNoiseAnalysisTest::detailedAnalysis
private

Definition at line 91 of file DTNoiseAnalysisTest.h.

bool DTNoiseAnalysisTest::doSynchNoise
private

Definition at line 90 of file DTNoiseAnalysisTest.h.

MonitorElement* DTNoiseAnalysisTest::glbSummarySynchNoiseHisto
private

Definition at line 88 of file DTNoiseAnalysisTest.h.

double DTNoiseAnalysisTest::maxSynchNoiseRate
private

Definition at line 92 of file DTNoiseAnalysisTest.h.

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

Definition at line 77 of file DTNoiseAnalysisTest.h.

int DTNoiseAnalysisTest::nevents
private

Definition at line 71 of file DTNoiseAnalysisTest.h.

int DTNoiseAnalysisTest::nMinEvts
private

Definition at line 72 of file DTNoiseAnalysisTest.h.

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

Definition at line 83 of file DTNoiseAnalysisTest.h.

int DTNoiseAnalysisTest::noisyCellDef
private

Definition at line 80 of file DTNoiseAnalysisTest.h.

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

Definition at line 84 of file DTNoiseAnalysisTest.h.

MonitorElement* DTNoiseAnalysisTest::summaryNoiseHisto
private

Definition at line 85 of file DTNoiseAnalysisTest.h.

MonitorElement* DTNoiseAnalysisTest::summarySynchNoiseHisto
private

Definition at line 87 of file DTNoiseAnalysisTest.h.

MonitorElement* DTNoiseAnalysisTest::threshChannelsHisto
private

Definition at line 86 of file DTNoiseAnalysisTest.h.