CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
DTChamberEfficiencyClient Class Reference

#include <DTChamberEfficiencyClient.h>

Inheritance diagram for DTChamberEfficiencyClient:
DQMEDHarvester edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 DTChamberEfficiencyClient (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~DTChamberEfficiencyClient () override
 Destructor. More...
 
- Public Member Functions inherited from DQMEDHarvester
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 DQMEDHarvester ()
 
void endJob () final
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &, edm::EventSetup const &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void bookHistos (DQMStore::IBooker &)
 book the report summary More...
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

std::map< int, MonitorElement * > EffDistrPerWh
 
MonitorElementglobalEffDistr
 
MonitorElementglobalEffSummary
 
edm::ESHandle< DTGeometrymuonGeom
 
unsigned int nLumiSegs
 
int prescaleFactor
 
MonitorElementsummaryHistos [5][2]
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Attributes inherited from DQMEDHarvester
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 42 of file DTChamberEfficiencyClient.h.

Constructor & Destructor Documentation

DTChamberEfficiencyClient::DTChamberEfficiencyClient ( const edm::ParameterSet ps)

Constructor.

Definition at line 30 of file DTChamberEfficiencyClient.cc.

References edm::ParameterSet::getUntrackedParameter(), and nanoDQM_cff::prescaleFactor.

31 {
32 
33  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
34  << "DTChamberEfficiencyClient: Constructor called";
35 
36  prescaleFactor = pSet.getUntrackedParameter<int>("diagnosticPrescale", 1);
37 
38 }
DTChamberEfficiencyClient::~DTChamberEfficiencyClient ( )
override

Destructor.

Definition at line 40 of file DTChamberEfficiencyClient.cc.

41 {
42  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
43  << "DTChamberEfficiencyClient: Destructor called";
44 }

Member Function Documentation

void DTChamberEfficiencyClient::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
overrideprotected

Definition at line 46 of file DTChamberEfficiencyClient.cc.

References edm::EventSetup::get().

46  {
47 
48  // Get the DT Geometry
49  setup.get<MuonGeometryRecord>().get(muonGeom);
50 
51 }
T get() const
Definition: EventSetup.h:71
edm::ESHandle< DTGeometry > muonGeom
void DTChamberEfficiencyClient::bookHistos ( DQMStore::IBooker ibooker)
protected

book the report summary

Definition at line 192 of file DTChamberEfficiencyClient.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), MonitorElement::setAxisTitle(), DQMStore::IBooker::setCurrentFolder(), and makeMuonMisalignmentScenario::wheel.

193 {
194 
195  ibooker.setCurrentFolder("DT/05-ChamberEff");
196 
197  globalEffSummary = ibooker.book2D("EfficiencyGlbSummary","Efficiency Summary",12,1,13,5,-2,3);
198  globalEffSummary->setAxisTitle("sector",1);
199  globalEffSummary->setAxisTitle("wheel",2);
200 
201  globalEffDistr = ibooker.book1D("TotalEfficiency","Total efficiency",51,0.,1.02);
202  globalEffDistr -> setAxisTitle("Eff",1);
203 
204  for(int wh=-2; wh<=2; wh++){
205  stringstream wheel; wheel << wh;
206  string histoNameAll = "EfficiencyMap_All_W" + wheel.str();
207  string histoTitleAll = "Efficiency map for all segments for wheel " + wheel.str();
208 
209  string histoNameQual = "EfficiencyMap_Qual_W" + wheel.str();
210  string histoTitleQual = "Efficiency map for quality segments for wheel " + wheel.str();
211 
212  string histoNameEff = "Efficiency_W" + wheel.str();
213  string histoTitleEff = "Segment efficiency, wheel " + wheel.str();
214 
215  ibooker.setCurrentFolder("DT/05-ChamberEff");
216 
217  summaryHistos[wh+2][0] = ibooker.book2D(histoNameAll.c_str(),histoTitleAll.c_str(),14,1.,15.,4,1.,5.);
218  summaryHistos[wh+2][0]->setAxisTitle("Sector",1);
219  summaryHistos[wh+2][0]->setBinLabel(1,"MB1",2);
220  summaryHistos[wh+2][0]->setBinLabel(2,"MB2",2);
221  summaryHistos[wh+2][0]->setBinLabel(3,"MB3",2);
222  summaryHistos[wh+2][0]->setBinLabel(4,"MB4",2);
223 
224  EffDistrPerWh[wh+2] = ibooker.book1D(histoNameEff.c_str(),histoTitleEff.c_str(),51,0.,1.02);
225  EffDistrPerWh[wh+2] -> setAxisTitle("Eff",1);
226 
227  ibooker.setCurrentFolder("DT/05-ChamberEff/HighQual");
228 
229  summaryHistos[wh+2][1] = ibooker.book2D(histoNameQual.c_str(),histoTitleQual.c_str(),14,1.,15.,4,1.,5.);
230  summaryHistos[wh+2][1]->setAxisTitle("Sector",1);
231  summaryHistos[wh+2][1]->setBinLabel(1,"MB1",2);
232  summaryHistos[wh+2][1]->setBinLabel(2,"MB2",2);
233  summaryHistos[wh+2][1]->setBinLabel(3,"MB3",2);
234  summaryHistos[wh+2][1]->setBinLabel(4,"MB4",2);
235 
236  }
237 
238  return;
239 }
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
std::map< int, MonitorElement * > EffDistrPerWh
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
MonitorElement * summaryHistos[5][2]
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void DTChamberEfficiencyClient::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
overrideprotectedvirtual

Implements DQMEDHarvester.

Definition at line 61 of file DTChamberEfficiencyClient.cc.

References bookHistos(), HcalObjRepresent::Fill(), DQMStore::IGetter::get(), MonitorElement::getBinContent(), MonitorElement::getBinError(), MonitorElement::getTH2F(), gen::k, LogTrace, anotherprimaryvertexanalyzer_cfi::nBinX, anotherprimaryvertexanalyzer_cfi::nBinY, funct::pow(), mathSSE::sqrt(), relativeConstraints::station, and makeMuonMisalignmentScenario::wheel.

62 {
63  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
64  << "DTChamberEfficiencyClient: endRun";
65 
66  bookHistos(ibooker);
67 
68  // reset the global summary
70 
71  //Loop over the wheels
72  for(int wheel=-2;wheel<=2;wheel++){
73  stringstream wheel_str; wheel_str << wheel;
74 
75  // Get the ME produced by EfficiencyTask Source
76  // All means no selection on segments, Qual means segments with at least 12 hits
77 
78  MonitorElement* MECountAll = igetter.get("DT/05-ChamberEff/Task/hCountSectVsChamb_All_W" + wheel_str.str());
79  MonitorElement* MECountQual = igetter.get("DT/05-ChamberEff/Task/hCountSectVsChamb_Qual_W" + wheel_str.str());
80  MonitorElement* MEExtrap = igetter.get("DT/05-ChamberEff/Task/hExtrapSectVsChamb_W" + wheel_str.str());
81 
82  //get the TH2F
83  if(!MECountAll || !(MECountAll->getTH2F())) {
84  edm::LogWarning("DTChamberEfficiencyClient") << "ME not available" << std::endl;
85  return;
86  }
87 
88  TH2F* hCountAll = MECountAll->getTH2F();
89  TH2F* hCountQual = MECountQual->getTH2F();
90  TH2F* hExtrap = MEExtrap->getTH2F();
91 
92 
93 
94  const int nBinX = summaryHistos[wheel+2][0]->getNbinsX();
95  const int nBinY = summaryHistos[wheel+2][0]->getNbinsY();
96 
97  for(int j=1;j<=nBinX;j++){
98  for(int k=1;k<=nBinY;k++){
99  summaryHistos[wheel+2][0]->setBinContent(j,k,0.);
100  summaryHistos[wheel+2][1]->setBinContent(j,k,0.);
101 
102  const float numerAll = hCountAll->GetBinContent(j,k);
103  const float numerQual = hCountQual->GetBinContent(j,k);
104  const float denom = hExtrap->GetBinContent(j,k);
105 
106  if(denom != 0.){
107  const float effAll= numerAll/denom;
108  const float eff_error_All = sqrt((effAll+effAll*effAll)/denom);
109 
110  const float effQual= numerQual/denom;
111  const float eff_error_Qual = sqrt((effQual+effQual*effQual)/denom);
112 
113  summaryHistos[wheel+2][0]->setBinContent(j,k,effAll);
114  summaryHistos[wheel+2][0]->setBinError(j,k,eff_error_All);
115 
116  summaryHistos[wheel+2][1]->setBinContent(j,k,effQual);
117  summaryHistos[wheel+2][1]->setBinError(j,k,eff_error_Qual);
118 
119  // Fill 1D eff distributions
120  globalEffDistr -> Fill(effAll);
121  EffDistrPerWh[wheel+2] -> Fill(effAll);
122 
123  }
124  }
125  }
126  }
127 
128  // fill the global eff. summary
129  // problems at a granularity smaller than the chamber are ignored
130  for(int wheel=-2; wheel<=2; wheel++) { // loop over wheels
131  // retrieve the chamber efficiency summary
132  MonitorElement * segmentWheelSummary = summaryHistos[wheel+2][0];
133  if(segmentWheelSummary != nullptr) {
134 
135  for(int sector=1; sector<=12; sector++) { // loop over sectors
136  float nFailingChambers = 0.;
137 
138  double meaneff = 0.;
139  double errorsum = 0.;
140 
141  for(int station = 1; station != 5; ++station) { // loop over stations
142 
143  const double tmpefficiency = segmentWheelSummary->getBinContent(sector, station);
144  const double tmpvariance = pow(segmentWheelSummary->getBinError(sector, station),2);
145 
146  if(tmpefficiency < 0.2 || tmpvariance == 0){
147  nFailingChambers++;
148  continue;
149  }
150 
151  meaneff += tmpefficiency/tmpvariance;
152  errorsum += 1./tmpvariance;
153 
154  LogTrace("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
155  << "Wheel: " << wheel << " Stat: " << station
156  << " Sect: " << sector << " status: " << meaneff/errorsum << endl;
157  }
158 
159  if(sector == 4 || sector == 10) {
160  int whichSector = (sector == 4) ? 13 : 14;
161 
162  const double tmpefficiency = segmentWheelSummary->getBinContent(whichSector, 4);
163  const double tmpvariance = pow(segmentWheelSummary->getBinError(whichSector, 4),2);
164 
165  if(tmpefficiency > 0.2 && tmpvariance != 0) {
166  meaneff += tmpefficiency/tmpvariance;
167  errorsum += 1./tmpvariance;
168  }
169  else nFailingChambers++;
170 
171  }
172 
173  double eff_result = 0;
174  if(errorsum != 0) eff_result = meaneff/errorsum;
175 
176  if(nFailingChambers != 0) {
177  if(sector != 4 && sector != 10) eff_result = eff_result*(4.-nFailingChambers)/4.;
178  else eff_result = eff_result*(5.-nFailingChambers)/5.;
179  }
180 
181  if(eff_result > 0.7) globalEffSummary->Fill(sector,wheel,1.);
182  else if(eff_result < 0.7 && eff_result > 0.5) globalEffSummary->Fill(sector,wheel,0.6);
183  else if(eff_result < 0.5 && eff_result > 0.3) globalEffSummary->Fill(sector,wheel,0.4);
184  else if(eff_result < 0.3 && eff_result > 0.) globalEffSummary->Fill(sector,wheel,0.15);
185  else globalEffSummary->Fill(sector,wheel,0.01);
186  }
187  }
188  }
189  return;
190 }
void setBinContent(int binx, double content)
set content of bin (1-D)
void Fill(long long x)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
T sqrt(T t)
Definition: SSEVec.h:18
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
void Reset()
reset ME (ie. contents, errors, etc)
#define LogTrace(id)
TH2F * getTH2F() const
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:303
int k[5][pyjets_maxn]
void bookHistos(DQMStore::IBooker &)
book the report summary
std::map< int, MonitorElement * > EffDistrPerWh
double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
MonitorElement * summaryHistos[5][2]
int getNbinsY() const
get # of bins in Y-axis
double getBinContent(int binx) const
get content of bin (1-D)
int getNbinsX() const
get # of bins in X-axis
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void DTChamberEfficiencyClient::dqmEndLuminosityBlock ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  setup 
)
overrideprotectedvirtual

Reimplemented from DQMEDHarvester.

Definition at line 54 of file DTChamberEfficiencyClient.cc.

56 {
57  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
58  << "DTChamberEfficiencyClient: endluminosityBlock";
59 }

Member Data Documentation

std::map<int, MonitorElement*> DTChamberEfficiencyClient::EffDistrPerWh
private

Definition at line 74 of file DTChamberEfficiencyClient.h.

MonitorElement* DTChamberEfficiencyClient::globalEffDistr
private

Definition at line 73 of file DTChamberEfficiencyClient.h.

MonitorElement* DTChamberEfficiencyClient::globalEffSummary
private

Definition at line 71 of file DTChamberEfficiencyClient.h.

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

Definition at line 67 of file DTChamberEfficiencyClient.h.

unsigned int DTChamberEfficiencyClient::nLumiSegs
private

Definition at line 64 of file DTChamberEfficiencyClient.h.

int DTChamberEfficiencyClient::prescaleFactor
private

Definition at line 65 of file DTChamberEfficiencyClient.h.

MonitorElement* DTChamberEfficiencyClient::summaryHistos[5][2]
private

Definition at line 70 of file DTChamberEfficiencyClient.h.