CMS 3D CMS Logo

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

#include <DTTriggerEfficiencyTest.h>

Inheritance diagram for DTTriggerEfficiencyTest:
DTLocalTriggerBaseTest 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

 DTTriggerEfficiencyTest (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~DTTriggerEfficiencyTest () override
 Destructor. More...
 
- Public Member Functions inherited from DTLocalTriggerBaseTest
 DTLocalTriggerBaseTest ()
 Constructor. More...
 
 ~DTLocalTriggerBaseTest () 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 &r, const edm::EventSetup &c) override
 BeginRun. More...
 
void bookChambHistos (DQMStore::IBooker &ibooker, DTChamberId chambId, std::string htype, std::string folder="")
 Book the new MEs (for each chamber) More...
 
void bookHistos (DQMStore::IBooker &ibooker, std::string hTag, std::string folder)
 Book the new MEs (global) More...
 
void Bookings (DQMStore::IBooker &, DQMStore::IGetter &)
 
void bookWheelHistos (DQMStore::IBooker &ibooker, int wheel, std::string hTag, std::string folder)
 Book the new MEs (for each wheel) More...
 
std::string getMEName (std::string histoTag, std::string folder, int wh)
 Get the ME name (by wheel) More...
 
void makeEfficiencyME (TH2F *numerator, TH2F *denominator, MonitorElement *result2DWh, MonitorElement *result1DWh, MonitorElement *result1D)
 Compute 1D/2D efficiency plots. More...
 
void makeEfficiencyME (TH2F *numerator, TH2F *denominator, MonitorElement *result2DWh)
 Compute 2D efficiency plots. More...
 
void runClientDiagnostic (DQMStore::IBooker &, DQMStore::IGetter &) override
 DQM Client Diagnostic. More...
 
- Protected Member Functions inherited from DTLocalTriggerBaseTest
void beginRun (edm::Run const &run, edm::EventSetup const &context) override
 BeginRun. More...
 
void bookCmsHistos (DQMStore::IBooker &, std::string hTag, std::string folder="", bool isGlb=false)
 Book the new MEs (CMS summary) More...
 
void bookSectorHistos (DQMStore::IBooker &, int wheel, int sector, std::string hTag, std::string folder="")
 Book the new MEs (for each sector) More...
 
void bookWheelHistos (DQMStore::IBooker &, int wheel, std::string hTag, std::string folder="")
 Book the new MEs (for each wheel) More...
 
std::string category ()
 Get message logger name. More...
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
 Perform client diagnostic in online. More...
 
void endRun (edm::Run const &run, edm::EventSetup const &context) override
 Perform client diagnostic in offline. More...
 
std::string fullName (std::string htype)
 Create fullname from histo partial name. More...
 
template<class T >
TgetHisto (MonitorElement *me)
 Convert ME to Histogram fo type T. More...
 
std::string getMEName (std::string histoTag, std::string subfolder, const DTChamberId &chambid)
 Get the ME name (by chamber) More...
 
std::string getMEName (std::string histoTag, std::string subfolder, int wh)
 Get the ME name (by wheel) More...
 
std::pair< float, float > phiRange (const DTChamberId &id)
 Calculate phi range for histograms. More...
 
void setConfig (const edm::ParameterSet &ps, std::string name)
 Set configuration variables. More...
 
std::string & topFolder (bool isTM)
 Get top folder 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 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

bool bookingdone
 
std::map< uint32_t, std::map< std::string, MonitorElement * > > chambME
 
bool detailedPlots
 
std::map< int, std::map< std::string, MonitorElement * > > EffDistrPerWh
 
std::map< std::string, MonitorElement * > globalEffDistr
 
DTTrigGeomUtilstrigGeomUtils
 

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 DTLocalTriggerBaseTest
std::string baseFolderDDU
 
std::string baseFolderTM
 
std::map< std::string, MonitorElement * > cmsME
 
std::string hwSource
 
std::vector< std::string > hwSources
 
edm::ESHandle< DTGeometrymuonGeom
 
int nevents
 
unsigned int nLumiSegs
 
edm::ParameterSet parameters
 
int prescaleFactor
 
int run
 
bool runOnline
 
std::map< int, std::map< std::string, MonitorElement * > > secME
 
std::string sourceFolder
 
std::string testName
 
std::string trigSource
 
std::vector< std::string > trigSources
 
std::map< int, std::map< std::string, MonitorElement * > > whME
 
- Protected Attributes inherited from DQMEDHarvester
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 23 of file DTTriggerEfficiencyTest.h.

Constructor & Destructor Documentation

DTTriggerEfficiencyTest::DTTriggerEfficiencyTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 40 of file DTTriggerEfficiencyTest.cc.

References edm::ParameterSet::getUntrackedParameter().

40  {
41 
42  setConfig(ps,"DTTriggerEfficiency");
43  baseFolderTM = "DT/03-LocalTrigger-TM/";
44  baseFolderDDU = "DT/04-LocalTrigger-DDU/";
45  detailedPlots = ps.getUntrackedParameter<bool>("detailedAnalysis",true);
46 
47  bookingdone = false;
48 }
T getUntrackedParameter(std::string const &, T const &) const
void setConfig(const edm::ParameterSet &ps, std::string name)
Set configuration variables.
DTTriggerEfficiencyTest::~DTTriggerEfficiencyTest ( )
override

Destructor.

Definition at line 51 of file DTTriggerEfficiencyTest.cc.

51  {
52 
53 }

Member Function Documentation

void DTTriggerEfficiencyTest::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
overrideprotected

BeginRun.

Definition at line 56 of file DTTriggerEfficiencyTest.cc.

References DTLocalTriggerBaseTest::beginRun().

56  {
57 
60 
61 }
edm::ESHandle< DTGeometry > muonGeom
void beginRun(edm::Run const &run, edm::EventSetup const &context) override
BeginRun.
void DTTriggerEfficiencyTest::bookChambHistos ( DQMStore::IBooker ibooker,
DTChamberId  chambId,
std::string  htype,
std::string  folder = "" 
)
protected

Book the new MEs (for each chamber)

Definition at line 286 of file DTTriggerEfficiencyTest.cc.

References DQMStore::IBooker::book2D(), taus_updatedMVAIds_cff::category, LogTrace, edm::max(), edm::min(), pileupCalc::nbins, DetId::rawId(), DTChamberId::sector(), DQMStore::IBooker::setCurrentFolder(), DTChamberId::station(), relativeConstraints::station, DTChamberId::wheel(), and makeMuonMisalignmentScenario::wheel.

287  {
288 
289  stringstream wheel; wheel << chambId.wheel();
290  stringstream station; station << chambId.station();
291  stringstream sector; sector << chambId.sector();
292 
293  string fullType = fullName(htype);
294  bool isTM = hwSource=="TM" ;
295  string HistoName = fullType + "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
296 
297  ibooker.setCurrentFolder(topFolder(isTM) +
298  "Wheel" + wheel.str() +
299  "/Sector" + sector.str() +
300  "/Station" + station.str() +
301  "/" + folder + "/");
302 
303  LogTrace(category()) << "[" << testName << "Test]: booking " + topFolder(isTM) + "Wheel" << wheel.str()
304  <<"/Sector" << sector.str() << "/Station" << station.str() << "/" + folder + "/" << HistoName;
305 
306 
307  uint32_t indexChId = chambId.rawId();
308  float min, max;
309  int nbins;
310  trigGeomUtils->phiRange(chambId,min,max,nbins,20);
311  if (htype.find("TrigEffPosvsAnglePhi") == 0 ){
312 
313  chambME[indexChId][fullType] = ibooker.book2D(HistoName.c_str(),"Trigger efficiency (any qual.) position vs angle (Phi)",12,-30.,30.,nbins,min,max);
314  return;
315  }
316  if (htype.find("TrigEffPosvsAngleCorrPhi") == 0 ){
317 
318  chambME[indexChId][fullType] = ibooker.book2D(HistoName.c_str(),"Trigger efficiency (correlated) pos vs angle (Phi)",12,-30.,30.,nbins,min,max);
319  return;
320  }
321 
322 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
std::map< uint32_t, std::map< std::string, MonitorElement * > > chambME
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
T min(T a, T b)
Definition: MathUtil.h:58
#define LogTrace(id)
std::string category()
Get message logger name.
void phiRange(const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
Compute phi range in local chamber coordinates.
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
std::string HistoName
std::string & topFolder(bool isTM)
Get top folder 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
std::string fullName(std::string htype)
Create fullname from histo partial name.
void DTTriggerEfficiencyTest::bookHistos ( DQMStore::IBooker ibooker,
std::string  hTag,
std::string  folder 
)
protected

Book the new MEs (global)

Definition at line 208 of file DTTriggerEfficiencyTest.cc.

References makeHippyCampaign::basedir, DQMStore::IBooker::book1D(), MonitorElement::setAxisTitle(), and DQMStore::IBooker::setCurrentFolder().

208  {
209 
210  string basedir;
211  bool isTM = hwSource=="TM" ;
212  basedir = topFolder(isTM); //Book summary histo outside Task directory
213 
214  if (folder != "") {
215  basedir += folder +"/" ;
216  }
217 
218  ibooker.setCurrentFolder(basedir);
219 
220  string fullTag = fullName(hTag);
221  string hname = fullTag + "_All";
222 
223  globalEffDistr[fullTag] = ibooker.book1D(hname.c_str(),hname.c_str(),51,0.,1.02);
224  globalEffDistr[fullTag] ->setAxisTitle("Trig Eff",1);
225 
226 }
std::map< std::string, MonitorElement * > globalEffDistr
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
std::string & topFolder(bool isTM)
Get top folder name.
std::string fullName(std::string htype)
Create fullname from histo partial name.
void DTTriggerEfficiencyTest::Bookings ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
protected

Definition at line 325 of file DTTriggerEfficiencyTest.cc.

References bookHistos(), and trackingPlots::stat.

325  {
326 
327 
328  vector<string>::const_iterator iTr = trigSources.begin();
329  vector<string>::const_iterator trEnd = trigSources.end();
330  vector<string>::const_iterator iHw = hwSources.begin();
331  vector<string>::const_iterator hwEnd = hwSources.end();
332 
333 
334  //Booking
335  if(parameters.getUntrackedParameter<bool>("staticBooking", true)){
336  for (; iTr != trEnd; ++iTr){
337  trigSource = (*iTr);
338  for (; iHw != hwEnd; ++iHw){
339  hwSource = (*iHw);
340  // Loop over the TriggerUnits
341 
342  bookHistos(ibooker,"TrigEffPhi","");
343  bookHistos(ibooker,"TrigEffCorrPhi","");
344  for (int wh=-2; wh<=2; ++wh){
345  if (detailedPlots) {
346  for (int sect=1; sect<=12; ++sect){
347  for (int stat=1; stat<=4; ++stat){
348  DTChamberId chId(wh,stat,sect);
349 
350  bookChambHistos(ibooker,chId,"TrigEffPosvsAnglePhi","Segment");
351  bookChambHistos(ibooker,chId,"TrigEffPosvsAngleCorrPhi","Segment");
352  }
353  }
354  }
355 
356  bookWheelHistos(ibooker,wh,"TrigEffPhi","");
357  bookWheelHistos(ibooker,wh,"TrigEffCorrPhi","");
358  }
359  }
360  }
361  }
362  bookingdone = true;
363 }
std::vector< std::string > trigSources
void bookWheelHistos(DQMStore::IBooker &ibooker, int wheel, std::string hTag, std::string folder)
Book the new MEs (for each wheel)
void bookChambHistos(DQMStore::IBooker &ibooker, DTChamberId chambId, std::string htype, std::string folder="")
Book the new MEs (for each chamber)
std::vector< std::string > hwSources
void bookHistos(DQMStore::IBooker &ibooker, std::string hTag, std::string folder)
Book the new MEs (global)
void DTTriggerEfficiencyTest::bookWheelHistos ( DQMStore::IBooker ibooker,
int  wheel,
std::string  hTag,
std::string  folder 
)
protected

Book the new MEs (for each wheel)

Definition at line 228 of file DTTriggerEfficiencyTest.cc.

References makeHippyCampaign::basedir, DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), taus_updatedMVAIds_cff::category, LogTrace, MonitorElement::setAxisTitle(), MonitorElement::setBinLabel(), DQMStore::IBooker::setCurrentFolder(), and makeMuonMisalignmentScenario::wheel.

228  {
229 
230  stringstream wh; wh << wheel;
231  string basedir;
232  bool isTM = hwSource=="TM" ;
233  if (hTag.find("Summary") != string::npos) {
234  basedir = topFolder(isTM); //Book summary histo outside wheel directories
235  } else {
236  basedir = topFolder(isTM) + "Wheel" + wh.str() + "/" ;
237 
238  }
239  if (folder != "") {
240  basedir += folder +"/" ;
241  }
242 
243  ibooker.setCurrentFolder(basedir);
244 
245  string fullTag = fullName(hTag);
246  string hname = fullTag+ "_W" + wh.str();
247 
248  string hnameAll = fullTag+ "_All_W" + wh.str();
249 
250  LogTrace(category()) << "[" << testName << "Test]: booking "<< basedir << hname;
251 
252  (EffDistrPerWh[wheel])[fullTag] = ibooker.book1D(hnameAll.c_str(),hnameAll.c_str(),51,0.,1.02);
253 
254  if (hTag.find("Phi")!= string::npos ||
255  hTag.find("Summary") != string::npos ){
256 
257  MonitorElement* me = ibooker.book2D(hname.c_str(),hname.c_str(),12,1,13,4,1,5);
258 
259  // setLabelPh(me);
260  me->setBinLabel(1,"MB1",2);
261  me->setBinLabel(2,"MB2",2);
262  me->setBinLabel(3,"MB3",2);
263  me->setBinLabel(4,"MB4",2);
264  me->setAxisTitle("Sector",1);
265 
266  whME[wheel][fullTag] = me;
267  return;
268  }
269 
270  if (hTag.find("Theta") != string::npos){
271 
272  MonitorElement* me =ibooker.book2D(hname.c_str(),hname.c_str(),12,1,13,3,1,4);
273 
274  // setLabelTh(me);
275  me->setBinLabel(1,"MB1",2);
276  me->setBinLabel(2,"MB2",2);
277  me->setBinLabel(3,"MB3",2);
278  me->setAxisTitle("Sector",1);
279 
280  whME[wheel][fullTag] = me;
281  return;
282  }
283 
284 }
std::map< int, std::map< std::string, MonitorElement * > > whME
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)
std::map< int, std::map< std::string, MonitorElement * > > EffDistrPerWh
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
#define LogTrace(id)
std::string category()
Get message logger name.
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
std::string & topFolder(bool isTM)
Get top folder name.
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
std::string fullName(std::string htype)
Create fullname from histo partial name.
string DTTriggerEfficiencyTest::getMEName ( std::string  histoTag,
std::string  folder,
int  wh 
)
protected

Get the ME name (by wheel)

Definition at line 195 of file DTTriggerEfficiencyTest.cc.

References makeMuonMisalignmentScenario::wheel.

195  {
196 
197  stringstream wheel; wheel << wh;
198 
199  string folderName = topFolder(hwSource=="TM") + folder + "/";
200 
201  string histoname = sourceFolder + folderName
202  + fullName(histoTag) + "_W" + wheel.str();
203 
204  return histoname;
205 
206 }
std::string & topFolder(bool isTM)
Get top folder name.
std::string fullName(std::string htype)
Create fullname from histo partial name.
void DTTriggerEfficiencyTest::makeEfficiencyME ( TH2F *  numerator,
TH2F *  denominator,
MonitorElement result2DWh,
MonitorElement result1DWh,
MonitorElement result1D 
)
protected

Compute 1D/2D efficiency plots.

Definition at line 140 of file DTTriggerEfficiencyTest.cc.

References PostProcessor_cff::efficiency, relativeConstraints::error, MonitorElement::Fill(), MonitorElement::getTH2F(), and mathSSE::sqrt().

140  {
141 
142  TH2F* efficiency = result2DWh->getTH2F();
143  efficiency->Divide(numerator,denominator,1,1,"");
144 
145  int nbinsx = efficiency->GetNbinsX();
146  int nbinsy = efficiency->GetNbinsY();
147  for (int binx=1; binx<=nbinsx; ++binx){
148  for (int biny=1; biny<=nbinsy; ++biny){
149  float error = 0;
150  float bineff = efficiency->GetBinContent(binx,biny);
151 
152  result1DWh->Fill(bineff);
153  result1D->Fill(bineff);
154 
155  if (denominator->GetBinContent(binx,biny)){
156  error = sqrt(bineff*(1-bineff)/denominator->GetBinContent(binx,biny));
157  }
158  else {
159  error = 1;
160  efficiency->SetBinContent(binx,biny,0.);
161  }
162 
163  efficiency->SetBinError(binx,biny,error);
164  }
165  }
166 
167 }
void Fill(long long x)
T sqrt(T t)
Definition: SSEVec.h:18
TH2F * getTH2F() const
void DTTriggerEfficiencyTest::makeEfficiencyME ( TH2F *  numerator,
TH2F *  denominator,
MonitorElement result2DWh 
)
protected

Compute 2D efficiency plots.

Definition at line 169 of file DTTriggerEfficiencyTest.cc.

References PostProcessor_cff::efficiency, relativeConstraints::error, MonitorElement::getTH2F(), and mathSSE::sqrt().

169  {
170 
171  TH2F* efficiency = result2DWh->getTH2F();
172  efficiency->Divide(numerator,denominator,1,1,"");
173 
174  int nbinsx = efficiency->GetNbinsX();
175  int nbinsy = efficiency->GetNbinsY();
176  for (int binx=1; binx<=nbinsx; ++binx){
177  for (int biny=1; biny<=nbinsy; ++biny){
178  float error = 0;
179  float bineff = efficiency->GetBinContent(binx,biny);
180 
181  if (denominator->GetBinContent(binx,biny)){
182  error = sqrt(bineff*(1-bineff)/denominator->GetBinContent(binx,biny));
183  }
184  else {
185  error = 1;
186  efficiency->SetBinContent(binx,biny,0.);
187  }
188 
189  efficiency->SetBinError(binx,biny,error);
190  }
191  }
192 
193 }
T sqrt(T t)
Definition: SSEVec.h:18
TH2F * getTH2F() const
void DTTriggerEfficiencyTest::runClientDiagnostic ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
overrideprotectedvirtual

DQM Client Diagnostic.

Implements DTLocalTriggerBaseTest.

Definition at line 63 of file DTTriggerEfficiencyTest.cc.

References bookHistos(), spr::find(), DQMStore::IGetter::get(), DetId::rawId(), edm::second(), and trackingPlots::stat.

63  {
64 
65  if (!bookingdone) Bookings(ibooker,igetter);
66 
67  // Loop over Trig & Hw sources
68  for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
69  trigSource = (*iTr);
70  for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
71  hwSource = (*iHw);
72  // Loop over the TriggerUnits
73  if( globalEffDistr.find(fullName("TrigEffPhi")) == globalEffDistr.end() ){
74 
75  bookHistos(ibooker,"TrigEffPhi","");
76  bookHistos(ibooker,"TrigEffCorrPhi","");
77  }
78  for (int wh=-2; wh<=2; ++wh){
79 
80  TH2F * TrigEffDenum = getHisto<TH2F>(igetter.get(getMEName("TrigEffDenum","Task",wh)));
81  TH2F * TrigEffNum = getHisto<TH2F>(igetter.get(getMEName("TrigEffNum","Task",wh)));
82  TH2F * TrigEffCorrNum = getHisto<TH2F>(igetter.get(getMEName("TrigEffCorrNum","Task",wh)));
83 
84  if (TrigEffDenum && TrigEffNum && TrigEffCorrNum && TrigEffDenum->GetEntries()>1) {
85 
86  if( whME[wh].find(fullName("TrigEffPhi")) == whME[wh].end() ){
87 
88  bookWheelHistos(ibooker,wh,"TrigEffPhi","");
89  bookWheelHistos(ibooker,wh,"TrigEffCorrPhi","");
90  }
91 
92  MonitorElement* Eff1DAll_TrigEffPhi = (&globalEffDistr)->find(fullName("TrigEffPhi"))->second;
93  MonitorElement* Eff1DAll_TrigEffCorrPhi = (&globalEffDistr)->find(fullName("TrigEffCorrPhi"))->second;
94 
95  MonitorElement* Eff1DWh_TrigEffPhi = (&(EffDistrPerWh[wh]))->find(fullName("TrigEffPhi"))->second;
96  MonitorElement* Eff1DWh_TrigEffCorrPhi = (&(EffDistrPerWh[wh]))->find(fullName("TrigEffCorrPhi"))->second;
97 
98  MonitorElement* Eff2DWh_TrigEffPhi = (&(whME[wh]))->find(fullName("TrigEffPhi"))->second;
99  MonitorElement* Eff2DWh_TrigEffCorrPhi = (&(whME[wh]))->find(fullName("TrigEffCorrPhi"))->second;
100 
101  makeEfficiencyME(TrigEffNum,TrigEffDenum,Eff2DWh_TrigEffPhi,Eff1DWh_TrigEffPhi,Eff1DAll_TrigEffPhi);
102  makeEfficiencyME(TrigEffCorrNum,TrigEffDenum,Eff2DWh_TrigEffCorrPhi,Eff1DWh_TrigEffCorrPhi,Eff1DAll_TrigEffCorrPhi);
103 
104  }
105 
106  if (detailedPlots) {
107  for (int stat=1; stat<=4; ++stat){
108  for (int sect=1; sect<=12; ++sect){
109  DTChamberId chId(wh,stat,sect);
110  uint32_t indexCh = chId.rawId();
111 
112  // Perform Efficiency analysis (Phi+Segments 2D)
113 
114  TH2F * TrackPosvsAngle = getHisto<TH2F>(igetter.get(getMEName("TrackPosvsAngle","Segment", chId)));
115  TH2F * TrackPosvsAngleAnyQual = getHisto<TH2F>(igetter.get(getMEName("TrackPosvsAngleAnyQual","Segment", chId)));
116  TH2F * TrackPosvsAngleCorr = getHisto<TH2F>(igetter.get(getMEName("TrackPosvsAngleCorr","Segment", chId)));
117 
118  if (TrackPosvsAngle && TrackPosvsAngleAnyQual && TrackPosvsAngleCorr && TrackPosvsAngle->GetEntries()>1) {
119 
120  if( chambME[indexCh].find(fullName("TrigEffAnglePhi")) == chambME[indexCh].end()){
121  bookChambHistos(ibooker,chId,"TrigEffPosvsAnglePhi","Segment");
122  bookChambHistos(ibooker,chId,"TrigEffPosvsAngleCorrPhi","Segment");
123  }
124 
125  std::map<std::string,MonitorElement*> *innerME = &(chambME[indexCh]);
126  makeEfficiencyME(TrackPosvsAngleAnyQual,TrackPosvsAngle,innerME->find(fullName("TrigEffPosvsAnglePhi"))->second);
127  makeEfficiencyME(TrackPosvsAngleCorr,TrackPosvsAngle,innerME->find(fullName("TrigEffPosvsAngleCorrPhi"))->second);
128 
129  }
130  }
131  }
132  }
133  }
134 
135  }
136  }
137 
138 }
void makeEfficiencyME(TH2F *numerator, TH2F *denominator, MonitorElement *result2DWh, MonitorElement *result1DWh, MonitorElement *result1D)
Compute 1D/2D efficiency plots.
std::vector< std::string > trigSources
std::map< int, std::map< std::string, MonitorElement * > > whME
std::map< int, std::map< std::string, MonitorElement * > > EffDistrPerWh
void bookWheelHistos(DQMStore::IBooker &ibooker, int wheel, std::string hTag, std::string folder)
Book the new MEs (for each wheel)
std::map< std::string, MonitorElement * > globalEffDistr
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
std::map< uint32_t, std::map< std::string, MonitorElement * > > chambME
U second(std::pair< T, U > const &p)
void bookChambHistos(DQMStore::IBooker &ibooker, DTChamberId chambId, std::string htype, std::string folder="")
Book the new MEs (for each chamber)
std::string getMEName(std::string histoTag, std::string folder, int wh)
Get the ME name (by wheel)
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:303
std::vector< std::string > hwSources
void Bookings(DQMStore::IBooker &, DQMStore::IGetter &)
std::string fullName(std::string htype)
Create fullname from histo partial name.
void bookHistos(DQMStore::IBooker &ibooker, std::string hTag, std::string folder)
Book the new MEs (global)

Member Data Documentation

bool DTTriggerEfficiencyTest::bookingdone
private

Definition at line 68 of file DTTriggerEfficiencyTest.h.

std::map<uint32_t,std::map<std::string,MonitorElement*> > DTTriggerEfficiencyTest::chambME
private

Definition at line 64 of file DTTriggerEfficiencyTest.h.

bool DTTriggerEfficiencyTest::detailedPlots
private

Definition at line 66 of file DTTriggerEfficiencyTest.h.

std::map<int,std::map<std::string,MonitorElement*> > DTTriggerEfficiencyTest::EffDistrPerWh
private

Definition at line 63 of file DTTriggerEfficiencyTest.h.

std::map<std::string, MonitorElement*> DTTriggerEfficiencyTest::globalEffDistr
private

Definition at line 62 of file DTTriggerEfficiencyTest.h.

DTTrigGeomUtils* DTTriggerEfficiencyTest::trigGeomUtils
private

Definition at line 65 of file DTTriggerEfficiencyTest.h.