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

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 ()
 

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
CurrentProcessingContext const * currentContext () const
 

Private Member Functions

std::string getMEName (const DTChamberId &chID)
 Get the ME name. More...
 
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
 

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)
 

Detailed Description

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.

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

Destructor.

Definition at line 55 of file DTNoiseAnalysisTest.cc.

References LogTrace, and nevents.

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

References LogTrace, and nevents.

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 60 of file DTNoiseAnalysisTest.cc.

References bookHistos(), LogTrace, and nevents.

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

References LogTrace.

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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 70 of file DTNoiseAnalysisTest.cc.

References edm::EventSetup::get().

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

book the summary histograms

Definition at line 222 of file DTNoiseAnalysisTest.cc.

222  {
223 
224  dbe->setCurrentFolder("DT/05-Noise");
225  string histoName;
226 
227  for(int wh=-2; wh<=2; wh++){
228  stringstream wheel; wheel << wh;
229  histoName = "NoiseRateSummary_W" + wheel.str();
230  noiseHistos[wh] = dbe->book1D(histoName.c_str(),histoName.c_str(),100,0,2000);
231  noiseHistos[wh]->setAxisTitle("rate (Hz)",1);
232  noiseHistos[wh]->setAxisTitle("entries",2);
233  }
234  histoName = "NoiseRateSummary";
235  noiseHistos[3] = dbe->book1D(histoName.c_str(),histoName.c_str(),100,0,2000);
236  noiseHistos[3]->setAxisTitle("rate (Hz)",1);
237  noiseHistos[3]->setAxisTitle("entries",2);
238 
239 
240  for(int wh=-2; wh<=2; wh++){
241  stringstream wheel; wheel << wh;
242  histoName = "NoiseSummary_W" + wheel.str();
243  noisyCellHistos[wh] = dbe->book2D(histoName.c_str(),"# of noisy channels",12,1,13,4,1,5);
244  noisyCellHistos[wh]->setBinLabel(1,"MB1",2);
245  noisyCellHistos[wh]->setBinLabel(2,"MB2",2);
246  noisyCellHistos[wh]->setBinLabel(3,"MB3",2);
247  noisyCellHistos[wh]->setBinLabel(4,"MB4",2);
248  noisyCellHistos[wh]->setAxisTitle("Sector",1);
249  }
250 
251  histoName = "NoiseSummary";
252  summaryNoiseHisto = dbe->book2D(histoName.c_str(),"# of noisy channels",12,1,13,5,-2,3);
253  summaryNoiseHisto->setAxisTitle("Sector",1);
254  summaryNoiseHisto->setAxisTitle("Wheel",2);
255 
256 
257  if(doSynchNoise) {
258  dbe->setCurrentFolder("DT/05-Noise/SynchNoise/");
259  histoName = "SynchNoiseSummary";
260  summarySynchNoiseHisto = dbe->book2D(histoName.c_str(),"Summary Synch. Noise",12,1,13,5,-2,3);
263  }
264 
265 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:514
std::map< int, MonitorElement * > noisyCellHistos
MonitorElement * summarySynchNoiseHisto
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:642
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:232
void DTNoiseAnalysisTest::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
)
protectedvirtual

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().

92  {
93  LogVerbatim ("DTDQM|DTMonitorClient|DTNoiseAnalysisTest")
94  <<"[DTNoiseAnalysisTest]: End of LS transition, performing the DQM client operation";
95 
96  // Reset the summary plots
97  for(map<int, MonitorElement* >::iterator plot = noiseHistos.begin();
98  plot != noiseHistos.end(); ++plot) {
99  (*plot).second->Reset();
100  }
101 
102  for(map<int, MonitorElement* >::iterator plot = noisyCellHistos.begin();
103  plot != noisyCellHistos.end(); ++plot) {
104  (*plot).second->Reset();
105  }
106 
108 
109 
110 
111  vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
112  vector<DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
113 
114  LogTrace ("DTDQM|DTMonitorClient|DTNoiseAnalysisTest")
115  <<"[DTNoiseAnalysisTest]: Fill the summary histos";
116 
117  for (; ch_it != ch_end; ++ch_it) { // loop over chambers
118  DTChamberId chID = (*ch_it)->id();
119 
120  MonitorElement * histo = dbe->get(getMEName(chID));
121 
122  if(histo) { // check the pointer
123 
124  TH2F * histo_root = histo->getTH2F();
125 
126  for(int sl = 1; sl != 4; ++sl) { // loop over SLs
127  // skip theta SL in MB4 chambers
128  if(chID.station() == 4 && sl == 2) continue;
129 
130  int binYlow = ((sl-1)*4)+1;
131 
132  for(int layer = 1; layer <= 4; ++layer) { // loop over layers
133 
134  // Get the layer ID
135  DTLayerId layID(chID,sl,layer);
136 
137  int nWires = muonGeom->layer(layID)->specificTopology().channels();
138  int firstWire = muonGeom->layer(layID)->specificTopology().firstChannel();
139 
140  int binY = binYlow+(layer-1);
141 
142  for(int wire = firstWire; wire != (nWires+firstWire); wire++){ // loop over wires
143 
144  double noise = histo_root->GetBinContent(wire, binY);
145  // fill the histos
146  noiseHistos[chID.wheel()]->Fill(noise);
147  noiseHistos[3]->Fill(noise);
148  int sector = chID.sector();
149  if(noise>noisyCellDef) {
150  if(sector == 13) {
151  sector = 4;
152  } else if(sector == 14) {
153  sector = 10;
154  }
155  noisyCellHistos[chID.wheel()]->Fill(sector,chID.station());
156  summaryNoiseHisto->Fill(sector,chID.wheel());
157  }
158  }
159  }
160  }
161  }
162  }
163 
164 
165  // build the summary of synch noise
166 
167 
168  if(doSynchNoise) {
169  LogTrace("DTDQM|DTMonitorClient|DTNoiseAnalysisTest")
170  << "[DTNoiseAnalysisTest]: fill summaries for synch noise" << endl;
172  for(int wheel = -2; wheel != 3; ++wheel) {
173  // Get the histo produced by DTDigiTask
174  MonitorElement * histoNoiseSynch = dbe->get(getSynchNoiseMEName(wheel));
175  if(histoNoiseSynch != 0) {
176  for(int sect = 1; sect != 13; ++sect) { // loop over sectors
177  TH2F * histo = histoNoiseSynch->getTH2F();
178  for(int sta = 1; sta != 5; ++sta) {
179  LogTrace("DTDQM|DTMonitorClient|DTNoiseAnalysisTest")
180  << " Wheel: " << wheel << " sect: " << sect
181  << " station: " << sta
182  << " rate is: " << histo->GetBinContent(sect, sta)/(float)nevents << endl;
183  if(histo->GetBinContent(sect, sta)/(float)nevents > maxSynchNoiseRate) {
184  summarySynchNoiseHisto->Fill(sect,wheel,1);
185  } else {
186  summarySynchNoiseHisto->Fill(sect,wheel,0);
187  }
188  }
189  }
190  } else {
191  LogWarning("DTDQM|DTMonitorClient|DTNoiseAnalysisTest")
192  << " Histo: " << getSynchNoiseMEName(wheel) << " not found!" << endl;
193  }
194  }
195 
196  }
197 
198 }
std::map< int, MonitorElement * > noisyCellHistos
edm::ESHandle< DTGeometry > muonGeom
tuple histo
Definition: trackerHits.py:12
void Fill(long long x)
std::string getMEName(const DTChamberId &chID)
Get the ME name.
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1265
#define LogTrace(id)
MonitorElement * summarySynchNoiseHisto
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 201 of file DTNoiseAnalysisTest.cc.

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

201  {
202 
203  stringstream wheel; wheel << chID.wheel();
204  stringstream station; station << chID.station();
205  stringstream sector; sector << chID.sector();
206 
207  string folderName =
208  "DT/05-Noise/Wheel" + wheel.str() +
209 // "/Station" + station.str() +
210  "/Sector" + sector.str() + "/";
211 
212  string histoname = folderName + string("NoiseRate")
213  + "_W" + wheel.str()
214  + "_St" + station.str()
215  + "_Sec" + sector.str();
216 
217  return histoname;
218 
219 }
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 269 of file DTNoiseAnalysisTest.cc.

269  {
270 
271  stringstream wheel; wheel << wheelId;
272  string folderName =
273  "DT/05-Noise/SynchNoise/";
274  string histoname = folderName + string("SyncNoiseEvents")
275  + "_W" + wheel.str();
276 
277  return histoname;
278 
279 }

Member Data Documentation

DQMStore* DTNoiseAnalysisTest::dbe
private

Definition at line 73 of file DTNoiseAnalysisTest.h.

bool DTNoiseAnalysisTest::doSynchNoise
private

Definition at line 87 of file DTNoiseAnalysisTest.h.

double DTNoiseAnalysisTest::maxSynchNoiseRate
private

Definition at line 88 of file DTNoiseAnalysisTest.h.

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

Definition at line 76 of file DTNoiseAnalysisTest.h.

int DTNoiseAnalysisTest::nevents
private

Definition at line 71 of file DTNoiseAnalysisTest.h.

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

Definition at line 82 of file DTNoiseAnalysisTest.h.

int DTNoiseAnalysisTest::noisyCellDef
private

Definition at line 79 of file DTNoiseAnalysisTest.h.

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

Definition at line 83 of file DTNoiseAnalysisTest.h.

MonitorElement* DTNoiseAnalysisTest::summaryNoiseHisto
private

Definition at line 84 of file DTNoiseAnalysisTest.h.

MonitorElement* DTNoiseAnalysisTest::summarySynchNoiseHisto
private

Definition at line 85 of file DTNoiseAnalysisTest.h.