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 Attributes
DTDeadChannelTest Class Reference

#include <DTDeadChannelTest.h>

Inheritance diagram for DTDeadChannelTest:
edm::EDAnalyzer

Public Member Functions

 DTDeadChannelTest (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTDeadChannelTest ()
 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 (const DTLayerId &ch, int firstWire, int lastWire)
 book the new ME More...
 
void endJob ()
 Endjob. More...
 
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
 DQM Client Diagnostic. More...
 
std::string getMEName (std::string histoTag, const DTChamberId &chId)
 Get the ME name. More...
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Private Attributes

DQMStoredbe
 
edm::ESHandle< DTGeometrymuonGeom
 
int nevents
 
unsigned int nLumiSegs
 
std::map< std::string,
MonitorElement * > 
OccupancyDiffHistos
 
edm::ParameterSet parameters
 
int prescaleFactor
 
int run
 
edm::ESHandle< DTTtrigtTrigMap
 

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 43 of file DTDeadChannelTest.h.

Constructor & Destructor Documentation

DTDeadChannelTest::DTDeadChannelTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 39 of file DTDeadChannelTest.cc.

References cppFunctionSkipper::operator, Parameters::parameters, and dtDQMClient_cfg::prescaleFactor.

39  {
40 
41  edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: Constructor";
42 
43  parameters = ps;
44 
46 
47  prescaleFactor = parameters.getUntrackedParameter<int>("diagnosticPrescale", 1);
48 
49 }
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet parameters
DTDeadChannelTest::~DTDeadChannelTest ( )
virtual

Destructor.

Definition at line 51 of file DTDeadChannelTest.cc.

References nevents.

51  {
52 
53  edm::LogVerbatim ("deadChannel") << "DTDeadChannelTest: analyzed " << nevents << " events";
54 
55 }

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 87 of file DTDeadChannelTest.cc.

References nevents.

87  {
88 
89  nevents++;
90  edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: "<<nevents<<" events";
91 
92 }
void DTDeadChannelTest::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 58 of file DTDeadChannelTest.cc.

References nevents.

58  {
59 
60  edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: BeginJob";
61 
62  nevents = 0;
63 
64 }
void DTDeadChannelTest::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 76 of file DTDeadChannelTest.cc.

References edm::LuminosityBlockBase::run(), and DTTTrigCorrFirst::run.

76  {
77 
78  edm::LogVerbatim ("deadChannel") <<"[DTDeadChannelTest]: Begin of LS transition";
79 
80  // Get the run number
81  run = lumiSeg.run();
82 
83 }
void DTDeadChannelTest::beginRun ( edm::Run const &  run,
edm::EventSetup const &  context 
)
protectedvirtual

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 66 of file DTDeadChannelTest.cc.

References edm::EventSetup::get().

66  {
67 
68  edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: BeginRun";
69 
70  // Get the geometry
71  context.get<MuonGeometryRecord>().get(muonGeom);
72 
73 }
edm::ESHandle< DTGeometry > muonGeom
void DTDeadChannelTest::bookHistos ( const DTLayerId ch,
int  firstWire,
int  lastWire 
)
protected

book the new ME

Definition at line 240 of file DTDeadChannelTest.cc.

References DTLayerId::layer(), DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, DTSuperLayerId::superlayer(), DTLayerId::superlayerId(), and DTChamberId::wheel().

240  {
241 
242  stringstream wheel; wheel << lId.superlayerId().wheel();
243  stringstream station; station << lId.superlayerId().station();
244  stringstream sector; sector << lId.superlayerId().sector();
245  stringstream superLayer; superLayer << lId.superlayerId().superlayer();
246  stringstream layer; layer << lId.layer();
247 
248  string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str();
249  string OccupancyDiffHistoName = "OccupancyDiff_" + HistoName;
250 
251  dbe->setCurrentFolder("DT/Tests/DTDeadChannel/Wheel" + wheel.str() +
252  "/Station" + station.str() +
253  "/Sector" + sector.str());
254 
255  OccupancyDiffHistos[HistoName] = dbe->book1D(OccupancyDiffHistoName.c_str(),OccupancyDiffHistoName.c_str(),lastWire-firstWire+1, firstWire-0.5, lastWire+0.5);
256 
257 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
std::map< std::string, MonitorElement * > OccupancyDiffHistos
std::string HistoName
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
void DTDeadChannelTest::endJob ( void  )
protectedvirtual

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 209 of file DTDeadChannelTest.cc.

209  {
210 
211  edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest] endjob called!";
212 
213  dbe->rmdir("DT/Tests/DTDeadChannel");
214 
215 }
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2530
void DTDeadChannelTest::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
)
protectedvirtual

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 96 of file DTDeadChannelTest.cc.

References newFWLiteAna::bin, bookHistos(), DTTimeUnits::counts, edm::EventSetup::get(), QReport::getBadChannels(), MonitorElement::getTH2F(), edm::LuminosityBlockBase::id(), DTLayerId::layer(), edm::LuminosityBlockID::luminosityBlock(), Parameters::parameters, dtDQMClient_cfg::prescaleFactor, DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, DTSuperLayerId::superlayer(), and DTChamberId::wheel().

96  {
97 
98  // counts number of updats (online mode) or number of events (standalone mode)
99  //nevents++;
100  // if running in standalone perform diagnostic only after a reasonalbe amount of events
101  //if ( parameters.getUntrackedParameter<bool>("runningStandalone", false) &&
102  // nevents%parameters.getUntrackedParameter<int>("diagnosticPrescale", 1000) != 0 ) return;
103  //edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: "<<nevents<<" updates";
104 
105 
106  edm::LogVerbatim ("deadChannel") <<"[DTDeadChannelTest]: End of LS transition, performing the DQM client operation";
107 
108  // counts number of lumiSegs
109  nLumiSegs = lumiSeg.id().luminosityBlock();
110 
111  // prescale factor
112  if ( nLumiSegs%prescaleFactor != 0 ) return;
113 
114  edm::LogVerbatim ("deadChannel") <<"[DTDeadChannelTest]: "<<nLumiSegs<<" updates";
115 
116 
117  vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
118  vector<DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
119 
120  edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: Occupancy tests results";
121 
122  // Loop over the chambers
123  for (; ch_it != ch_end; ++ch_it) {
124  DTChamberId chID = (*ch_it)->id();
125  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
126  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
127 
128  stringstream wheel; wheel << chID.wheel();
129  stringstream station; station << chID.station();
130  stringstream sector; sector << chID.sector();
131 
132  context.get<DTTtrigRcd>().get(tTrigMap);
133 
134  string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
135 
136  // Get the ME produced by DigiTask Source
137  MonitorElement * noise_histo = dbe->get(getMEName("OccupancyNoise_perCh", chID));
138  MonitorElement * hitInTime_histo = dbe->get(getMEName("OccupancyInTimeHits_perCh", chID));
139 
140  // ME -> TH2F
141  if(noise_histo && hitInTime_histo) {
142  TH2F * noise_histo_root = noise_histo->getTH2F();
143  TH2F * hitInTime_histo_root = hitInTime_histo->getTH2F();
144 
145  // Loop over the SuperLayers
146  for(; sl_it != sl_end; ++sl_it) {
147  DTSuperLayerId slID = (*sl_it)->id();
148  vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
149  vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
150 
151  // ttrig and rms are counts
152  float tTrig, tTrigRMS, kFactor;
153  tTrigMap->get(slID, tTrig, tTrigRMS, kFactor, DTTimeUnits::counts);
154 
155  // Loop over the layers
156  for(; l_it != l_end; ++l_it) {
157  DTLayerId lID = (*l_it)->id();
158 
159  //Parameters to fill histos
160  stringstream superLayer; superLayer << slID.superlayer();
161  stringstream layer; layer << lID.layer();
162  string HistoNameTest = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str();
163 
164  const int firstWire = muonGeom->layer(lID)->specificTopology().firstChannel();
165  const int lastWire = muonGeom->layer(lID)->specificTopology().lastChannel();
166 
167  int entry=-1;
168  if(slID.superlayer() == 1) entry=0;
169  if(slID.superlayer() == 2) entry=4;
170  if(slID.superlayer() == 3) entry=8;
171  int YBinNumber = entry+lID.layer();
172 
173 
174  // Loop over the TH2F bin and fill the ME to be used for the Quality Test
175  for(int bin=firstWire; bin <= lastWire; bin++) {
176  if (OccupancyDiffHistos.find(HistoNameTest) == OccupancyDiffHistos.end()) bookHistos(lID, firstWire, lastWire);
177  // tMax default value
178  float tMax = 450.0;
179 
180  float difference = (hitInTime_histo_root->GetBinContent(bin, YBinNumber) / tMax)
181  - (noise_histo_root->GetBinContent(bin, YBinNumber) / tTrig);
182  OccupancyDiffHistos.find(HistoNameTest)->second->setBinContent(bin, difference);
183  }
184  } // loop on layers
185  } // loop on superlayers
186  }
187  } // loop on chambers
188 
189  // Occupancy Difference test
190  string OccupancyDiffCriterionName = parameters.getUntrackedParameter<string>("OccupancyDiffTestName","OccupancyDiffInRange");
191  for(map<string, MonitorElement*>::const_iterator hOccDiff = OccupancyDiffHistos.begin();
192  hOccDiff != OccupancyDiffHistos.end();
193  hOccDiff++) {
194  const QReport * theOccupancyDiffQReport = (*hOccDiff).second->getQReport(OccupancyDiffCriterionName);
195  if(theOccupancyDiffQReport) {
196  vector<dqm::me_util::Channel> badChannels = theOccupancyDiffQReport->getBadChannels();
197  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
198  channel != badChannels.end(); channel++) {
199  edm::LogError ("deadChannel") << "Layer : "<<(*hOccDiff).first<<" Bad occupancy difference channels: "<<(*channel).getBin()<<" Contents : "<<(*channel).getContents();
200  }
201  // FIXME: getMessage() sometimes returns and invalid string (null pointer inside QReport data member)
202  // edm::LogWarning("deadChannel")<< "-------- Layer : "<<(*hOccDiff).first<<" "<<theOccupancyDiffQReport->getMessage()<<" ------- "<<theOccupancyDiffQReport->getStatus();
203  }
204  }
205 
206 }
T getUntrackedParameter(std::string const &, T const &) const
std::string getMEName(std::string histoTag, const DTChamberId &chId)
Get the ME name.
int layer() const
Return the layer number.
Definition: DTLayerId.h:55
unsigned int nLumiSegs
std::map< std::string, MonitorElement * > OccupancyDiffHistos
edm::ParameterSet parameters
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
const std::vector< DQMChannel > & getBadChannels(void) const
Definition: QReport.h:33
int superlayer() const
Return the superlayer number (deprecated method name)
std::string HistoName
void bookHistos(const DTLayerId &ch, int firstWire, int lastWire)
book the new ME
int sector() const
Definition: DTChamberId.h:63
edm::ESHandle< DTTtrig > tTrigMap
edm::ESHandle< DTGeometry > muonGeom
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
string DTDeadChannelTest::getMEName ( std::string  histoTag,
const DTChamberId chId 
)
protected

Get the ME name.

Definition at line 217 of file DTDeadChannelTest.cc.

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

217  {
218 
219  stringstream wheel; wheel << chId.wheel();
220  stringstream station; station << chId.station();
221  stringstream sector; sector << chId.sector();
222 
223  string folderRoot = parameters.getUntrackedParameter<string>("folderRoot", "Collector/FU0/");
224  string folderName =
225  folderRoot + "DT/DTDigiTask/Wheel" + wheel.str() +
226  "/Station" + station.str() +
227  "/Sector" + sector.str() +
228  "/Occupancies" + "/";
229 
230  string histoname = folderName + histoTag
231  + "_W" + wheel.str()
232  + "_St" + station.str()
233  + "_Sec" + sector.str();
234 
235  return histoname;
236 
237 }
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet parameters
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

Member Data Documentation

DQMStore* DTDeadChannelTest::dbe
private

Definition at line 89 of file DTDeadChannelTest.h.

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

Definition at line 92 of file DTDeadChannelTest.h.

int DTDeadChannelTest::nevents
private

Definition at line 84 of file DTDeadChannelTest.h.

unsigned int DTDeadChannelTest::nLumiSegs
private

Definition at line 85 of file DTDeadChannelTest.h.

std::map< std::string , MonitorElement* > DTDeadChannelTest::OccupancyDiffHistos
private

Definition at line 95 of file DTDeadChannelTest.h.

edm::ParameterSet DTDeadChannelTest::parameters
private
int DTDeadChannelTest::prescaleFactor
private

Definition at line 86 of file DTDeadChannelTest.h.

int DTDeadChannelTest::run
private
edm::ESHandle<DTTtrig> DTDeadChannelTest::tTrigMap
private

Definition at line 93 of file DTDeadChannelTest.h.