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
DTNoiseTest Class Reference

#include <DTNoiseTest.h>

Inheritance diagram for DTNoiseTest:
DQMEDHarvester edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 DTNoiseTest (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTNoiseTest ()
 Destructor. More...
 
- Public Member Functions inherited from DQMEDHarvester
virtual void analyze (edm::Event const &, edm::EventSetup const &) final
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDHarvester (void)
 
virtual void endJob () final
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- 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 bookHistos (DQMStore::IBooker &, const DTChamberId &ch, std::string folder, std::string histoTag)
 book the new ME More...
 
void bookHistos (DQMStore::IBooker &, const DTLayerId &ch, int nWire, std::string folder, std::string histoTag)
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 DQM Client Diagnostic. More...
 
std::string getMEName (const DTChamberId &ch)
 Get the ME name. More...
 
std::string getMEName (const DTLayerId &ly)
 
- Protected Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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

bool bookingdone
 
bool debug
 
std::map< std::string,
std::map< uint32_t,
MonitorElement * > > 
histos
 
edm::ESHandle< DTGeometrymuonGeom
 
unsigned int nLumiSegs
 
edm::ParameterSet parameters
 
int prescaleFactor
 
int run
 
std::vector< DTWireIdtheNoisyChannels
 
edm::ESHandle< DTTtrigtTrigMap
 
int updates
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Definition at line 55 of file DTNoiseTest.h.

Constructor & Destructor Documentation

DTNoiseTest::DTNoiseTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 39 of file DTNoiseTest.cc.

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

39  {
40 
41  edm::LogVerbatim ("noise") <<"[DTNoiseTest]: Constructor";
42 
43  parameters = ps;
44 
45  prescaleFactor = parameters.getUntrackedParameter<int>("diagnosticPrescale", 1);
46 
47  bookingdone = 0;
48 
49 }
T getUntrackedParameter(std::string const &, T const &) const
bool bookingdone
Definition: DTNoiseTest.h:90
int prescaleFactor
Definition: DTNoiseTest.h:87
edm::ParameterSet parameters
Definition: DTNoiseTest.h:92
DTNoiseTest::~DTNoiseTest ( )
virtual

Destructor.

Definition at line 53 of file DTNoiseTest.cc.

53  {
54 
55  edm::LogVerbatim ("noise") <<"DTNoiseTest: analyzed " << updates << " events";
56 
57 }

Member Function Documentation

void DTNoiseTest::bookHistos ( DQMStore::IBooker ,
const DTChamberId ch,
std::string  folder,
std::string  histoTag 
)
protected

book the new ME

void DTNoiseTest::bookHistos ( DQMStore::IBooker ,
const DTLayerId ch,
int  nWire,
std::string  folder,
std::string  histoTag 
)
protected
void DTNoiseTest::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
overrideprotectedvirtual

Implements DQMEDHarvester.

Definition at line 221 of file DTNoiseTest.cc.

221  {
222 
223  edm::LogVerbatim ("noise") <<"[DTNoiseTest] endjob called!";
224 }
void DTNoiseTest::dqmEndLuminosityBlock ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protectedvirtual

DQM Client Diagnostic.

Reimplemented from DQMEDHarvester.

Definition at line 59 of file DTNoiseTest.cc.

References PDRates::average, begin, bookHistos(), DTTimeUnits::counts, end, spr::find(), edm::EventSetup::get(), DQMStore::IGetter::get(), QReport::getBadChannels(), MonitorElement::getTH2F(), mergeVDriftHistosByStation::histos, edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), Mean, cmsHarvester::nevents, Parameters::parameters, dtDQMClient_cfg::prescaleFactor, edm::second(), DQMStore::IBooker::setCurrentFolder(), crabStatusFromReport::statusMap, AlCaHLTBitMon_QueryRunRegistry::string, DTSuperLayerId::superLayer(), and w.

60  {
61 
62  if (!bookingdone) {
63  ibooker.setCurrentFolder("DT/Tests/Noise");
64  updates = 0;
65  // Get the geometry
66  context.get<MuonGeometryRecord>().get(muonGeom);
67  }
68  bookingdone = 1;
69 
70  edm::LogVerbatim ("noise") <<"[DTNoiseTest]: End of LS transition, performing the DQM client operation";
71 
72  // counts number of lumiSegs
73  nLumiSegs = lumiSeg.id().luminosityBlock();
74 
75  // prescale factor
76  if ( nLumiSegs%prescaleFactor != 0 ) return;
77 
78  edm::LogVerbatim ("noise") <<"[DTNoiseTest]: "<<nLumiSegs<<" updates";
79 
81  context.get<DTStatusFlagRcd>().get(statusMap);
82 
83  context.get<DTTtrigRcd>().get(tTrigMap);
84  float tTrig, tTrigRMS, kFactor;
85 
86  string histoTag;
87  // loop over chambers
88  vector<const DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
89  vector<const DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
90 
91  for (; ch_it != ch_end; ++ch_it) {
92  DTChamberId ch = (*ch_it)->id();
93  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
94  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
95 
96  MonitorElement * noiseME = igetter.get(getMEName(ch));
97  if (noiseME) {
98  TH2F * noiseHisto = noiseME->getTH2F();
99 
100  // WARNING uncorrect normalization!! TO BE PROVIDED CENTRALLY
101  double nevents = (int) noiseHisto->GetEntries();
102 
103  double normalization =0;
104 
105  float average=0;
106  float nOfChannels=0;
107  float noiseStatistics=0;
108  int newNoiseChannels=0;
109 
110  for(; sl_it != sl_end; ++sl_it) {
111  const DTSuperLayerId & slID = (*sl_it)->id();
112 
113  // ttrig and rms are counts
114  tTrigMap->get(slID, tTrig, tTrigRMS, kFactor, DTTimeUnits::counts);
115  if (tTrig==0) tTrig=1;
116  const double ns_s = 1e9*(32/25);
117  normalization = ns_s/float(tTrig*nevents);
118 
119  noiseHisto->Scale(normalization);
120 
121  // loop over layers
122 
123  for (int binY=(slID.superLayer()-1)*4+1 ; binY <= (slID.superLayer()-1)*4+4; binY++) {
124 
125  int Y = binY - 4*(slID.superLayer()-1);
126 
127  // the layer
128 
129  const DTLayerId theLayer(slID,Y);
130 
131  // loop over channels
132  for (int binX=1; binX <= noiseHisto->GetNbinsX(); binX++) {
133 
134  if (noiseHisto->GetBinContent(binX,binY) > parameters.getUntrackedParameter<int>("HzThreshold", 300))
135  theNoisyChannels.push_back(DTWireId(theLayer, binX));
136 
137  // get rid of the dead channels
138  else {
139  average += noiseHisto->GetBinContent(binX,binY);
140  nOfChannels++;
141  }
142  }
143  }
144 
145  if (nOfChannels) noiseStatistics = average/nOfChannels;
146  histoTag = "NoiseAverage";
147 
148  if (histos[histoTag].find((*ch_it)->id().rawId()) == histos[histoTag].end()) bookHistos(ibooker,(*ch_it)->id(),string("NoiseAverage"), histoTag );
149  histos[histoTag].find((*ch_it)->id().rawId())->second->setBinContent(slID.superLayer(),noiseStatistics);
150 
151  for ( vector<DTWireId>::const_iterator nb_it = theNoisyChannels.begin();
152  nb_it != theNoisyChannels.end(); ++nb_it) {
153 
154  bool isNoisy = false;
155  bool isFEMasked = false;
156  bool isTDCMasked = false;
157  bool isTrigMask = false;
158  bool isDead = false;
159  bool isNohv = false;
160  statusMap->cellStatus((*nb_it), isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
161 
162  if (!isNoisy) newNoiseChannels++;
163  }
164  theNoisyChannels.clear();
165  histoTag = "NewNoisyChannels";
166 
167  if (histos[histoTag].find((*ch_it)->id().rawId()) == histos[histoTag].end())
168  bookHistos(ibooker,(*ch_it)->id(),string("NewNoisyChannels"), histoTag );
169  histos[histoTag].find((*ch_it)->id().rawId())->second->setBinContent(slID.superLayer(), newNoiseChannels);
170  }
171  }
172  //To compute the Noise Mean test
173  vector<const DTSuperLayer*>::const_iterator sl2_it = (*ch_it)->superLayers().begin();
174  vector<const DTSuperLayer*>::const_iterator sl2_end = (*ch_it)->superLayers().end();
175  for(; sl2_it != sl2_end; ++sl2_it) {
176  vector<const DTLayer*>::const_iterator l_it = (*sl2_it)->layers().begin();
177  vector<const DTLayer*>::const_iterator l_end = (*sl2_it)->layers().end();
178  for(; l_it != l_end; ++l_it) {
179 
180  DTLayerId lID = (*l_it)->id();
181  MonitorElement * noisePerEventME = igetter.get(getMEName(lID));
182 
183  if (noisePerEventME) {
184  TH2F * noiseHistoPerEvent = noisePerEventME->getTH2F();
185  int nWires = muonGeom->layer(lID)->specificTopology().channels();
186  double MeanNumerator=0, MeanDenominator=0;
187  histoTag = "MeanDigiPerEvent";
188  for (int w=1; w<=nWires; w++){
189  for(int numDigi=1; numDigi<=10; numDigi++){
190  MeanNumerator+=(noiseHistoPerEvent->GetBinContent(w,numDigi)*(numDigi-1));
191  MeanDenominator+=noiseHistoPerEvent->GetBinContent(w,numDigi);
192  }
193  double Mean=MeanNumerator/MeanDenominator;
194  if (histos[histoTag].find((*l_it)->id().rawId()) == histos[histoTag].end()) bookHistos(ibooker,(*l_it)->id(),nWires, string("MeanDigiPerEvent"), histoTag );
195  histos[histoTag].find((*l_it)->id().rawId())->second->setBinContent(w, Mean);
196  }
197  }
198  }
199  }
200  }
201 
202  // Noise Mean test
203  histoTag = "MeanDigiPerEvent";
204  string MeanCriterionName = parameters.getUntrackedParameter<string>("meanTestName","NoiseMeanInRange");
205  for(map<uint32_t, MonitorElement*>::const_iterator hMean = histos[histoTag].begin();
206  hMean != histos[histoTag].end();
207  hMean++) {
208  const QReport * theMeanQReport = (*hMean).second->getQReport(MeanCriterionName);
209  if(theMeanQReport) {
210  vector<dqm::me_util::Channel> badChannels = theMeanQReport->getBadChannels();
211  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
212  channel != badChannels.end(); channel++) {
213  LogVerbatim ("tTrigCalibration")<<"LayerId : "<<(*hMean).first<<" Bad mean channels: "
214  <<(*channel).getBin()<<" Contents : "<<(*channel).getContents();
215  }
216  }
217  }
218 
219 }
void bookHistos(DQMStore::IBooker &, const DTChamberId &ch, std::string folder, std::string histoTag)
book the new ME
T getUntrackedParameter(std::string const &, T const &) const
edm::ESHandle< DTGeometry > muonGeom
Definition: DTNoiseTest.h:93
const double w
Definition: UKUtility.cc:23
std::vector< DTWireId > theNoisyChannels
Definition: DTNoiseTest.h:97
unsigned int nLumiSegs
Definition: DTNoiseTest.h:86
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:302
bool bookingdone
Definition: DTNoiseTest.h:90
edm::ESHandle< DTTtrig > tTrigMap
Definition: DTNoiseTest.h:94
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
U second(std::pair< T, U > const &p)
int prescaleFactor
Definition: DTNoiseTest.h:87
int superLayer() const
Return the superlayer number.
#define end
Definition: vmac.h:37
const std::vector< DQMChannel > & getBadChannels(void) const
Definition: QReport.h:33
edm::ParameterSet parameters
Definition: DTNoiseTest.h:92
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
int average
Definition: PDRates.py:137
#define begin
Definition: vmac.h:30
std::string getMEName(const DTChamberId &ch)
Get the ME name.
Definition: DTNoiseTest.cc:227
std::map< std::string, std::map< uint32_t, MonitorElement * > > histos
Definition: DTNoiseTest.h:100
TH2F * getTH2F(void) const
string DTNoiseTest::getMEName ( const DTChamberId ch)
protected

Get the ME name.

Definition at line 227 of file DTNoiseTest.cc.

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

227  {
228 
229  stringstream wheel; wheel << ch.wheel();
230  stringstream station; station << ch.station();
231  stringstream sector; sector << ch.sector();
232 
233  string folderRoot = parameters.getUntrackedParameter<string>("folderRoot", "Collector/FU0/");
234  string folderTag = parameters.getUntrackedParameter<string>("folderTag", "Occupancies");
235  string folderName =
236  folderRoot + "DT/DTDigiTask/Wheel" + wheel.str() +
237  "/Station" + station.str() +
238  "/Sector" + sector.str() + "/" + folderTag + "/";
239 
240  string histoTag = parameters.getUntrackedParameter<string>("histoTag", "OccupancyNoise_perCh");
241  string histoname = folderName + histoTag
242  + "_W" + wheel.str()
243  + "_St" + station.str()
244  + "_Sec" + sector.str();
245 
246 
247  return histoname;
248 
249 }
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet parameters
Definition: DTNoiseTest.h:92
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
string DTNoiseTest::getMEName ( const DTLayerId ly)
protected

Definition at line 251 of file DTNoiseTest.cc.

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

251  {
252 
253  stringstream wheel; wheel << ly.wheel();
254  stringstream station; station << ly.station();
255  stringstream sector; sector << ly.sector();
256  stringstream superLayer; superLayer << ly.superlayer();
257  stringstream layer; layer << ly.layer();
258 
259  string folderRoot = parameters.getUntrackedParameter<string>("folderRoot", "Collector/FU0/");
260  string folderTag = parameters.getUntrackedParameter<string>("folderTagForDigiPerEventTest", "DigiPerEvent");
261  string folderName =
262  folderRoot + "DT/DTDigiForNoiseTask/Wheel" + wheel.str() +
263  "/Station" + station.str() +
264  "/Sector" + sector.str() + "/" + folderTag + "/";
265 
266  string histoTag = parameters.getUntrackedParameter<string>("histoTagForDigiPerEventTest", "DigiPerEvent");
267  string histoname = folderName + histoTag
268  + "_W" + wheel.str()
269  + "_St" + station.str()
270  + "_Sec" + sector.str()
271  + "_SL" + superLayer.str()
272  + "_L" + layer.str();
273 
274 
275  return histoname;
276 
277 }
T getUntrackedParameter(std::string const &, T const &) const
int layer() const
Return the layer number.
Definition: DTLayerId.h:53
edm::ParameterSet parameters
Definition: DTNoiseTest.h:92
int superlayer() const
Return the superlayer number (deprecated method name)
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

bool DTNoiseTest::bookingdone
private

Definition at line 90 of file DTNoiseTest.h.

bool DTNoiseTest::debug
private
std::map<std::string, std::map<uint32_t, MonitorElement*> > DTNoiseTest::histos
private
edm::ESHandle<DTGeometry> DTNoiseTest::muonGeom
private

Definition at line 93 of file DTNoiseTest.h.

unsigned int DTNoiseTest::nLumiSegs
private

Definition at line 86 of file DTNoiseTest.h.

edm::ParameterSet DTNoiseTest::parameters
private
int DTNoiseTest::prescaleFactor
private

Definition at line 87 of file DTNoiseTest.h.

int DTNoiseTest::run
private
std::vector<DTWireId> DTNoiseTest::theNoisyChannels
private

Definition at line 97 of file DTNoiseTest.h.

edm::ESHandle<DTTtrig> DTNoiseTest::tTrigMap
private

Definition at line 94 of file DTNoiseTest.h.

int DTNoiseTest::updates
private

Definition at line 85 of file DTNoiseTest.h.