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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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 beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 
void beginRun (edm::Run const &run, edm::EventSetup const &context)
 BeginRun. More...
 
void bookHistos (DQMStore::IBooker &, const DTLayerId &ch, int firstWire, int lastWire)
 book the new ME More...
 
void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 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

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 cmsHarvester::nevents, Parameters::parameters, and dtDQMClient_cfg::prescaleFactor.

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

Destructor.

Definition at line 48 of file DTDeadChannelTest.cc.

References cmsHarvester::nevents.

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

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 74 of file DTDeadChannelTest.cc.

References cmsHarvester::nevents.

74  {
75 
76  nevents++;
77  edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: "<<nevents<<" events";
78 
79 }
void DTDeadChannelTest::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 64 of file DTDeadChannelTest.cc.

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

64  {
65 
66  edm::LogVerbatim ("deadChannel") <<"[DTDeadChannelTest]: Begin of LS transition";
67 
68  // Get the run number
69  run = lumiSeg.run();
70 
71 }
void DTDeadChannelTest::beginRun ( edm::Run const &  run,
edm::EventSetup const &  context 
)
protectedvirtual

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 54 of file DTDeadChannelTest.cc.

References edm::EventSetup::get().

54  {
55 
56  edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: BeginRun";
57 
58  // Get the geometry
59  context.get<MuonGeometryRecord>().get(muonGeom);
60 
61 }
edm::ESHandle< DTGeometry > muonGeom
void DTDeadChannelTest::bookHistos ( DQMStore::IBooker ibooker,
const DTLayerId ch,
int  firstWire,
int  lastWire 
)
protected

book the new ME

Definition at line 209 of file DTDeadChannelTest.cc.

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

209  {
210 
211  stringstream wheel; wheel << lId.superlayerId().wheel();
212  stringstream station; station << lId.superlayerId().station();
213  stringstream sector; sector << lId.superlayerId().sector();
214  stringstream superLayer; superLayer << lId.superlayerId().superlayer();
215  stringstream layer; layer << lId.layer();
216 
217  string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str();
218  string OccupancyDiffHistoName = "OccupancyDiff_" + HistoName;
219 
220  ibooker.setCurrentFolder("DT/Tests/DTDeadChannel/Wheel" + wheel.str() +
221  "/Station" + station.str() +
222  "/Sector" + sector.str());
223 
224  OccupancyDiffHistos[HistoName] = ibooker.book1D(OccupancyDiffHistoName.c_str(),OccupancyDiffHistoName.c_str(),lastWire-firstWire+1, firstWire-0.5, lastWire+0.5);
225 
226 }
std::map< std::string, MonitorElement * > OccupancyDiffHistos
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
std::string HistoName
void DTDeadChannelTest::dqmEndLuminosityBlock ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protected

DQM Client Diagnostic.

Definition at line 82 of file DTDeadChannelTest.cc.

References newFWLiteAna::bin, bookHistos(), DTTimeUnits::counts, edm::EventSetup::get(), DQMStore::IGetter::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().

83  {
84 
85  edm::LogVerbatim ("deadChannel") <<"[DTDeadChannelTest]: End of LS transition, performing the DQM client operation";
86 
87  // counts number of lumiSegs
88  nLumiSegs = lumiSeg.id().luminosityBlock();
89 
90  // prescale factor
91  if ( nLumiSegs%prescaleFactor != 0 ) return;
92 
93  edm::LogVerbatim ("deadChannel") <<"[DTDeadChannelTest]: "<<nLumiSegs<<" updates";
94 
95 
96  vector<const DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
97  vector<const DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
98 
99  edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: Occupancy tests results";
100 
101  // Loop over the chambers
102  for (; ch_it != ch_end; ++ch_it) {
103  DTChamberId chID = (*ch_it)->id();
104  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
105  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
106 
107  stringstream wheel; wheel << chID.wheel();
108  stringstream station; station << chID.station();
109  stringstream sector; sector << chID.sector();
110 
111  context.get<DTTtrigRcd>().get(tTrigMap);
112 
113  string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
114 
115  // Get the ME produced by DigiTask Source
116  MonitorElement * noise_histo = igetter.get(getMEName("OccupancyNoise_perCh", chID));
117  MonitorElement * hitInTime_histo = igetter.get(getMEName("OccupancyInTimeHits_perCh", chID));
118 
119  // ME -> TH2F
120  if(noise_histo && hitInTime_histo) {
121  TH2F * noise_histo_root = noise_histo->getTH2F();
122  TH2F * hitInTime_histo_root = hitInTime_histo->getTH2F();
123 
124  // Loop over the SuperLayers
125  for(; sl_it != sl_end; ++sl_it) {
126  DTSuperLayerId slID = (*sl_it)->id();
127  vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
128  vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
129 
130  // ttrig and rms are counts
131  float tTrig, tTrigRMS, kFactor;
132  tTrigMap->get(slID, tTrig, tTrigRMS, kFactor, DTTimeUnits::counts);
133 
134  // Loop over the layers
135  for(; l_it != l_end; ++l_it) {
136  DTLayerId lID = (*l_it)->id();
137 
138  //Parameters to fill histos
139  stringstream superLayer; superLayer << slID.superlayer();
140  stringstream layer; layer << lID.layer();
141  string HistoNameTest = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str()
142  + "_L" + layer.str();
143 
144  const int firstWire = muonGeom->layer(lID)->specificTopology().firstChannel();
145  const int lastWire = muonGeom->layer(lID)->specificTopology().lastChannel();
146 
147  int entry=-1;
148  if(slID.superlayer() == 1) entry=0;
149  if(slID.superlayer() == 2) entry=4;
150  if(slID.superlayer() == 3) entry=8;
151  int YBinNumber = entry+lID.layer();
152 
153 
154  // Loop over the TH2F bin and fill the ME to be used for the Quality Test
155  for(int bin=firstWire; bin <= lastWire; bin++) {
156  if (OccupancyDiffHistos.find(HistoNameTest) == OccupancyDiffHistos.end()) bookHistos(ibooker,lID, firstWire, lastWire);
157  // tMax default value
158  float tMax = 450.0;
159 
160  float difference = (hitInTime_histo_root->GetBinContent(bin, YBinNumber) / tMax)
161  - (noise_histo_root->GetBinContent(bin, YBinNumber) / tTrig);
162  OccupancyDiffHistos.find(HistoNameTest)->second->setBinContent(bin, difference);
163  }
164  } // loop on layers
165  } // loop on superlayers
166  }
167  } // loop on chambers
168 
169  // Occupancy Difference test
170  string OccupancyDiffCriterionName = parameters.getUntrackedParameter<string>("OccupancyDiffTestName","OccupancyDiffInRange");
171  for(map<string, MonitorElement*>::const_iterator hOccDiff = OccupancyDiffHistos.begin();
172  hOccDiff != OccupancyDiffHistos.end();
173  hOccDiff++) {
174  const QReport * theOccupancyDiffQReport = (*hOccDiff).second->getQReport(OccupancyDiffCriterionName);
175  if(theOccupancyDiffQReport) {
176  vector<dqm::me_util::Channel> badChannels = theOccupancyDiffQReport->getBadChannels();
177  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
178  channel != badChannels.end(); channel++) {
179  edm::LogError ("deadChannel") << "Layer : "<<(*hOccDiff).first<<" Bad occupancy difference channels: "<<(*channel).getBin()<<" Contents : "<<(*channel).getContents();
180  }
181  }
182  }
183 
184 }
T getUntrackedParameter(std::string const &, T const &) const
std::string getMEName(std::string histoTag, const DTChamberId &chId)
Get the ME name.
void bookHistos(DQMStore::IBooker &, const DTLayerId &ch, int firstWire, int lastWire)
book the new ME
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:302
int layer() const
Return the layer number.
Definition: DTLayerId.h:53
unsigned int nLumiSegs
std::map< std::string, MonitorElement * > OccupancyDiffHistos
edm::ParameterSet parameters
const std::vector< DQMChannel > & getBadChannels(void) const
Definition: QReport.h:33
int superlayer() const
Return the superlayer number (deprecated method name)
std::string HistoName
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 186 of file DTDeadChannelTest.cc.

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

186  {
187 
188  stringstream wheel; wheel << chId.wheel();
189  stringstream station; station << chId.station();
190  stringstream sector; sector << chId.sector();
191 
192  string folderRoot = parameters.getUntrackedParameter<string>("folderRoot", "Collector/FU0/");
193  string folderName =
194  folderRoot + "DT/DTDigiTask/Wheel" + wheel.str() +
195  "/Station" + station.str() +
196  "/Sector" + sector.str() +
197  "/Occupancies" + "/";
198 
199  string histoname = folderName + histoTag
200  + "_W" + wheel.str()
201  + "_St" + station.str()
202  + "_Sec" + sector.str();
203 
204  return histoname;
205 
206 }
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

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

Definition at line 79 of file DTDeadChannelTest.h.

int DTDeadChannelTest::nevents
private

Definition at line 73 of file DTDeadChannelTest.h.

unsigned int DTDeadChannelTest::nLumiSegs
private

Definition at line 74 of file DTDeadChannelTest.h.

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

Definition at line 82 of file DTDeadChannelTest.h.

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

Definition at line 75 of file DTDeadChannelTest.h.

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

Definition at line 80 of file DTDeadChannelTest.h.