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 edm::EDConsumerBase

Public Member Functions

 DTDeadChannelTest (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTDeadChannelTest ()
 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
 
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 (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::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 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
 
- 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 41 of file DTDeadChannelTest.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 37 of file DTDeadChannelTest.cc.

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

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

Destructor.

Definition at line 49 of file DTDeadChannelTest.cc.

References nevents.

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

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 85 of file DTDeadChannelTest.cc.

References nevents.

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 56 of file DTDeadChannelTest.cc.

References nevents.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 74 of file DTDeadChannelTest.cc.

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

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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 64 of file DTDeadChannelTest.cc.

References edm::EventSetup::get().

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

book the new ME

Definition at line 238 of file DTDeadChannelTest.cc.

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

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

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 207 of file DTDeadChannelTest.cc.

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

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

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

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

Get the ME name.

Definition at line 215 of file DTDeadChannelTest.cc.

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

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

Member Data Documentation

DQMStore* DTDeadChannelTest::dbe
private

Definition at line 87 of file DTDeadChannelTest.h.

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

Definition at line 90 of file DTDeadChannelTest.h.

int DTDeadChannelTest::nevents
private

Definition at line 82 of file DTDeadChannelTest.h.

unsigned int DTDeadChannelTest::nLumiSegs
private

Definition at line 83 of file DTDeadChannelTest.h.

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

Definition at line 93 of file DTDeadChannelTest.h.

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

Definition at line 84 of file DTDeadChannelTest.h.

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

Definition at line 91 of file DTDeadChannelTest.h.