CMS 3D CMS Logo

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

#include <GlobalMuonMatchAnalyzer.h>

Inheritance diagram for GlobalMuonMatchAnalyzer:
DQMEDAnalyzer edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 GlobalMuonMatchAnalyzer (const edm::ParameterSet &)
 
 ~GlobalMuonMatchAnalyzer () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () 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)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void computeEfficiencyEta (MonitorElement *, MonitorElement *recoTH2, MonitorElement *simTH2)
 
void computeEfficiencyPt (MonitorElement *, MonitorElement *recoTH2, MonitorElement *simTH2)
 
void dqmEndRun (const edm::Run &, const edm::EventSetup &) override
 

Private Attributes

DQMStoredbe_
 
edm::InputTag glbName_
 
edm::EDGetTokenT< edm::View< reco::Track > > glbToken_
 
MonitorElementh_effic
 
MonitorElementh_efficPt
 
MonitorElementh_fake
 
MonitorElementh_fakeMatch
 
MonitorElementh_fakePt
 
MonitorElementh_goodMatch
 
MonitorElementh_goodMatchSim
 
MonitorElementh_shouldMatch
 
MonitorElementh_staOnlySim
 
MonitorElementh_tkOnlySim
 
MonitorElementh_totReco
 
edm::ParameterSet iConfig
 
const TrackAssociatorBase * muAssociator_
 
edm::InputTag muAssociatorName_
 
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociatormuAssociatorToken_
 
std::string out
 
edm::InputTag staName_
 
edm::EDGetTokenT< edm::View< reco::Track > > staToken_
 
std::string subsystemname_
 
const TrackAssociatorBase * tkAssociator_
 
edm::InputTag tkAssociatorName_
 
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociatortkAssociatorToken_
 
edm::InputTag tkName_
 
edm::EDGetTokenT< edm::View< reco::Track > > tkToken_
 
edm::InputTag tpName_
 
edm::EDGetTokenT< edm::View< reco::Track > > tpToken_
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- 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 Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Author
Adam Everett Purdue University

Definition at line 45 of file GlobalMuonMatchAnalyzer.h.

Constructor & Destructor Documentation

GlobalMuonMatchAnalyzer::GlobalMuonMatchAnalyzer ( const edm::ParameterSet ps)
explicit

Class: GlobalMuonMatchAnalyzer

Authors :

Author
Adam Everett - Purdue University

Definition at line 34 of file GlobalMuonMatchAnalyzer.cc.

References dbe_, edm::ParameterSet::getUntrackedParameter(), glbName_, glbToken_, iConfig, muAssociatorName_, muAssociatorToken_, Utilities::operator, out, staName_, staToken_, AlCaHLTBitMon_QueryRunRegistry::string, subsystemname_, tkAssociatorName_, tkAssociatorToken_, tkName_, tkToken_, tpName_, and tpToken_.

36 {
37  iConfig = ps;
38  //now do what ever initialization is needed
41 
42  tkAssociatorToken_ = consumes<reco::TrackToTrackingParticleAssociator>(tkAssociatorName_);
43  muAssociatorToken_ = consumes<reco::TrackToTrackingParticleAssociator>(muAssociatorName_);
44 
45  subsystemname_ = iConfig.getUntrackedParameter<std::string>("subSystemFolder", "YourSubsystem");
50 
53 
54  tpToken_ = consumes<edm::View<reco::Track> >(tpName_);
55  tkToken_ = consumes<edm::View<reco::Track> >(tkName_);
56  staToken_ = consumes<edm::View<reco::Track> >(staName_);
57  glbToken_ = consumes<edm::View<reco::Track> >(glbName_);
58 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > muAssociatorToken_
edm::EDGetTokenT< edm::View< reco::Track > > glbToken_
edm::EDGetTokenT< edm::View< reco::Track > > staToken_
edm::EDGetTokenT< edm::View< reco::Track > > tpToken_
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > tkAssociatorToken_
edm::EDGetTokenT< edm::View< reco::Track > > tkToken_
GlobalMuonMatchAnalyzer::~GlobalMuonMatchAnalyzer ( )
override

Definition at line 60 of file GlobalMuonMatchAnalyzer.cc.

60  {
61  // do anything here that needs to be done at desctruction time
62  // (e.g. close files, deallocate resources etc.)
63 }

Member Function Documentation

void GlobalMuonMatchAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 70 of file GlobalMuonMatchAnalyzer.cc.

References reco::TrackToTrackingParticleAssociator::associateRecoToSim(), reco::TrackToTrackingParticleAssociator::associateSimToReco(), edm::AssociationMap< Tag >::end(), reco::TrackBase::eta(), dqm::impl::MonitorElement::Fill(), edm::AssociationMap< Tag >::find(), edm::Event::getByToken(), glbToken_, h_fakeMatch, h_goodMatch, h_goodMatchSim, h_shouldMatch, h_staOnlySim, h_tkOnlySim, h_totReco, mps_fire::i, electronStore::links, muAssociatorToken_, edm::Handle< T >::product(), reco::TrackBase::pt(), staToken_, tkAssociatorToken_, tkToken_, and tpToken_.

70  {
71  using namespace edm;
72  using namespace reco;
73 
75  iEvent.getByToken(tpToken_, tpHandle);
76  const TrackingParticleCollection tpColl = *(tpHandle.product());
77 
79  iEvent.getByToken(glbToken_, muHandle);
80  const reco::MuonTrackLinksCollection muColl = *(muHandle.product());
81 
82  Handle<View<Track> > staHandle;
83  iEvent.getByToken(staToken_, staHandle);
84 
85  Handle<View<Track> > glbHandle;
86  iEvent.getByToken(glbToken_, glbHandle);
87 
88  Handle<View<Track> > tkHandle;
89  iEvent.getByToken(tkToken_, tkHandle);
90 
92  iEvent.getByToken(tkAssociatorToken_, tkAssociator);
93 
94  // Mu Associator
96  iEvent.getByToken(muAssociatorToken_, muAssociator);
97 
98  reco::RecoToSimCollection tkrecoToSimCollection = tkAssociator->associateRecoToSim(tkHandle, tpHandle);
99  reco::SimToRecoCollection tksimToRecoCollection = tkAssociator->associateSimToReco(tkHandle, tpHandle);
100 
101  reco::RecoToSimCollection starecoToSimCollection = muAssociator->associateRecoToSim(staHandle, tpHandle);
102  reco::SimToRecoCollection stasimToRecoCollection = muAssociator->associateSimToReco(staHandle, tpHandle);
103 
104  reco::RecoToSimCollection glbrecoToSimCollection = muAssociator->associateRecoToSim(glbHandle, tpHandle);
105  reco::SimToRecoCollection glbsimToRecoCollection = muAssociator->associateSimToReco(glbHandle, tpHandle);
106 
107  for (TrackingParticleCollection::size_type i = 0; i < tpColl.size(); ++i) {
108  TrackingParticleRef tp(tpHandle, i);
109 
110  std::vector<std::pair<RefToBase<Track>, double> > rvGlb;
111  RefToBase<Track> rGlb;
112  if (glbsimToRecoCollection.find(tp) != glbsimToRecoCollection.end()) {
113  rvGlb = glbsimToRecoCollection[tp];
114  if (!rvGlb.empty()) {
115  rGlb = rvGlb.begin()->first;
116  }
117  }
118 
119  std::vector<std::pair<RefToBase<Track>, double> > rvSta;
120  RefToBase<Track> rSta;
121  if (stasimToRecoCollection.find(tp) != stasimToRecoCollection.end()) {
122  rvSta = stasimToRecoCollection[tp];
123  if (!rvSta.empty()) {
124  rSta = rvSta.begin()->first;
125  }
126  }
127 
128  std::vector<std::pair<RefToBase<Track>, double> > rvTk;
129  RefToBase<Track> rTk;
130  if (tksimToRecoCollection.find(tp) != tksimToRecoCollection.end()) {
131  rvTk = tksimToRecoCollection[tp];
132  if (!rvTk.empty()) {
133  rTk = rvTk.begin()->first;
134  }
135  }
136 
137  if (!rvSta.empty() && !rvTk.empty()) {
138  //should have matched
139  h_shouldMatch->Fill(rTk->eta(), rTk->pt());
140  }
141 
142  for (reco::MuonTrackLinksCollection::const_iterator links = muHandle->begin(); links != muHandle->end(); ++links) {
143  if (rGlb == RefToBase<Track>(links->globalTrack())) {
144  if (RefToBase<Track>(links->trackerTrack()) == rTk && RefToBase<Track>(links->standAloneTrack()) == rSta) {
145  //goodMatch
146  h_goodMatchSim->Fill(rGlb->eta(), rGlb->pt());
147  }
148  if (RefToBase<Track>(links->trackerTrack()) == rTk && RefToBase<Track>(links->standAloneTrack()) != rSta) {
149  //tkOnlyMatch
150  h_tkOnlySim->Fill(rGlb->eta(), rGlb->pt());
151  }
152  if (RefToBase<Track>(links->standAloneTrack()) == rSta && RefToBase<Track>(links->trackerTrack()) != rTk) {
153  //staOnlyMatch
154  h_staOnlySim->Fill(rGlb->eta(), rGlb->pt());
155  }
156  }
157  }
158  }
159 
161 
162  for (reco::MuonTrackLinksCollection::const_iterator links = muHandle->begin(); links != muHandle->end(); ++links) {
163  RefToBase<Track> glbRef = RefToBase<Track>(links->globalTrack());
164  RefToBase<Track> staRef = RefToBase<Track>(links->standAloneTrack());
165  RefToBase<Track> tkRef = RefToBase<Track>(links->trackerTrack());
166 
167  std::vector<std::pair<TrackingParticleRef, double> > tp1;
168  TrackingParticleRef tp1r;
169  if (glbrecoToSimCollection.find(glbRef) != glbrecoToSimCollection.end()) {
170  tp1 = glbrecoToSimCollection[glbRef];
171  if (!tp1.empty()) {
172  tp1r = tp1.begin()->first;
173  }
174  }
175 
176  std::vector<std::pair<TrackingParticleRef, double> > tp2;
177  TrackingParticleRef tp2r;
178  if (starecoToSimCollection.find(staRef) != starecoToSimCollection.end()) {
179  tp2 = starecoToSimCollection[staRef];
180  if (!tp2.empty()) {
181  tp2r = tp2.begin()->first;
182  }
183  }
184 
185  std::vector<std::pair<TrackingParticleRef, double> > tp3;
186  TrackingParticleRef tp3r;
187  if (tkrecoToSimCollection.find(tkRef) != tkrecoToSimCollection.end()) {
188  tp3 = tkrecoToSimCollection[tkRef];
189  if (!tp3.empty()) {
190  tp3r = tp3.begin()->first;
191  }
192  }
193 
194  if (!tp1.empty()) {
195  //was reconstructed
196  h_totReco->Fill(glbRef->eta(), glbRef->pt());
197  if (tp2r == tp3r) { // && tp1r == tp3r) {
198  //came from same TP
199  h_goodMatch->Fill(glbRef->eta(), glbRef->pt());
200  } else {
201  //mis-match
202  h_fakeMatch->Fill(glbRef->eta(), glbRef->pt());
203  }
204  }
205  }
206 }
reco::SimToRecoCollection associateSimToReco(const edm::Handle< edm::View< reco::Track >> &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > muAssociatorToken_
std::vector< TrackingParticle > TrackingParticleCollection
const_iterator end() const
last iterator over the map (read only)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
const_iterator find(const key_type &k) const
find element with specified reference key
uint16_t size_type
std::vector< MuonTrackLinks > MuonTrackLinksCollection
collection of MuonTrackLinks
Definition: MuonFwd.h:22
void Fill(long long x)
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:617
edm::EDGetTokenT< edm::View< reco::Track > > glbToken_
double pt() const
track transverse momentum
Definition: TrackBase.h:602
edm::EDGetTokenT< edm::View< reco::Track > > staToken_
reco::RecoToSimCollection associateRecoToSim(const edm::Handle< edm::View< reco::Track >> &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
T const * product() const
Definition: Handle.h:69
fixed size matrix
HLT enums.
edm::EDGetTokenT< edm::View< reco::Track > > tpToken_
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > tkAssociatorToken_
edm::EDGetTokenT< edm::View< reco::Track > > tkToken_
void GlobalMuonMatchAnalyzer::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprivatevirtual

Implements DQMEDAnalyzer.

Definition at line 222 of file GlobalMuonMatchAnalyzer.cc.

References dqm::dqmstoreimpl::DQMStore::IBooker::book1D(), dqm::dqmstoreimpl::DQMStore::IBooker::book2D(), dqm::dqmstoreimpl::DQMStore::IBooker::cd(), TrackerOfflineValidation_Dqm_cff::dirName, h_effic, h_efficPt, h_fake, h_fakeMatch, h_fakePt, h_goodMatch, h_goodMatchSim, h_shouldMatch, h_staOnlySim, h_tkOnlySim, h_totReco, dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

224  {
225  // Tk Associator
226 
227  ibooker.cd();
228  std::string dirName = "Matcher/";
229  // ibooker.setCurrentFolder("RecoMuonV/Matcher");
230  ibooker.setCurrentFolder(dirName);
231 
232  h_shouldMatch = ibooker.book2D("h_shouldMatch", "SIM associated to Tk and Sta", 50, -2.5, 2.5, 100, 0., 500.);
233  h_goodMatchSim = ibooker.book2D("h_goodMatchSim", "SIM associated to Glb Sta Tk", 50, -2.5, 2.5, 100, 0., 500.);
234  h_tkOnlySim = ibooker.book2D("h_tkOnlySim", "SIM associated to Glb Tk", 50, -2.5, 2.5, 100, 0., 500.);
235  h_staOnlySim = ibooker.book2D("h_staOnlySim", "SIM associated to Glb Sta", 50, -2.5, 2.5, 100, 0., 500.);
236 
237  h_totReco = ibooker.book2D("h_totReco", "Total Glb Reconstructed", 50, -2.5, 2.5, 100, 0., 500.);
238  h_goodMatch = ibooker.book2D("h_goodMatch", "Sta and Tk from same SIM", 50, -2.5, 2.5, 100, 0., 500.);
239  h_fakeMatch = ibooker.book2D("h_fakeMatch", "Sta and Tk not from same SIM", 50, -2.5, 2.5, 100, 0., 500.);
240 
241  h_effic = ibooker.book1D("h_effic", "Efficiency vs #eta", 50, -2.5, 2.5);
242  h_efficPt = ibooker.book1D("h_efficPt", "Efficiency vs p_{T}", 100, 0., 100.);
243 
244  h_fake = ibooker.book1D("h_fake", "Fake fraction vs #eta", 50, -2.5, 2.5);
245  h_fakePt = ibooker.book1D("h_fakePt", "Fake fraction vs p_{T}", 100, 0., 100.);
246 }
void GlobalMuonMatchAnalyzer::computeEfficiencyEta ( MonitorElement ,
MonitorElement recoTH2,
MonitorElement simTH2 
)
private

Definition at line 248 of file GlobalMuonMatchAnalyzer.cc.

References newFWLiteAna::bin, relativeConstraints::error, dqm::impl::MonitorElement::getTH2F(), hgcalTowerMapProducer_cfi::nBinsEta, dqm::impl::MonitorElement::setBinContent(), dqm::impl::MonitorElement::setBinError(), and mathSSE::sqrt().

Referenced by dqmEndRun().

250  {
251  TH2F *h1 = recoTH2->getTH2F();
252  TH1D *reco = h1->ProjectionX();
253 
254  TH2F *h2 = simTH2->getTH2F();
255  TH1D *sim = h2->ProjectionX();
256 
257  TH1F *hEff = (TH1F *)reco->Clone();
258 
259  hEff->Divide(sim);
260 
261  hEff->SetName("tmp_" + TString(reco->GetName()));
262 
263  // Set the error accordingly to binomial statistics
264  int nBinsEta = hEff->GetNbinsX();
265  for (int bin = 1; bin <= nBinsEta; bin++) {
266  float nSimHit = sim->GetBinContent(bin);
267  float eff = hEff->GetBinContent(bin);
268  float error = 0;
269  if (nSimHit != 0 && eff <= 1) {
270  error = sqrt(eff * (1 - eff) / nSimHit);
271  }
272  hEff->SetBinError(bin, error);
273  effHist->setBinContent(bin, eff);
274  effHist->setBinError(bin, error);
275  }
276 }
virtual TH2F * getTH2F() const
T sqrt(T t)
Definition: SSEVec.h:19
fixed size matrix
void GlobalMuonMatchAnalyzer::computeEfficiencyPt ( MonitorElement ,
MonitorElement recoTH2,
MonitorElement simTH2 
)
private

Definition at line 278 of file GlobalMuonMatchAnalyzer.cc.

References newFWLiteAna::bin, relativeConstraints::error, dqm::impl::MonitorElement::getTH2F(), dqm::impl::MonitorElement::setBinContent(), dqm::impl::MonitorElement::setBinError(), and mathSSE::sqrt().

Referenced by dqmEndRun().

280  {
281  TH2F *h1 = recoTH2->getTH2F();
282  TH1D *reco = h1->ProjectionY();
283 
284  TH2F *h2 = simTH2->getTH2F();
285  TH1D *sim = h2->ProjectionY();
286 
287  TH1F *hEff = (TH1F *)reco->Clone();
288 
289  hEff->Divide(sim);
290 
291  hEff->SetName("tmp_" + TString(reco->GetName()));
292 
293  // Set the error accordingly to binomial statistics
294  int nBinsPt = hEff->GetNbinsX();
295  for (int bin = 1; bin <= nBinsPt; bin++) {
296  float nSimHit = sim->GetBinContent(bin);
297  float eff = hEff->GetBinContent(bin);
298  float error = 0;
299  if (nSimHit != 0 && eff <= 1) {
300  error = sqrt(eff * (1 - eff) / nSimHit);
301  }
302  hEff->SetBinError(bin, error);
303  effHist->setBinContent(bin, eff);
304  effHist->setBinError(bin, error);
305  }
306 }
virtual TH2F * getTH2F() const
T sqrt(T t)
Definition: SSEVec.h:19
fixed size matrix
void GlobalMuonMatchAnalyzer::dqmEndRun ( const edm::Run ,
const edm::EventSetup  
)
overrideprivate

Definition at line 209 of file GlobalMuonMatchAnalyzer.cc.

References computeEfficiencyEta(), computeEfficiencyPt(), dbe_, h_effic, h_efficPt, h_fake, h_fakeMatch, h_fakePt, h_goodMatchSim, h_shouldMatch, h_totReco, out, and dqm::dqmstoreimpl::DQMStore::save().

209  {
212 
215 
216  if (!out.empty() && dbe_)
217  dbe_->save(out);
218 }
void computeEfficiencyPt(MonitorElement *, MonitorElement *recoTH2, MonitorElement *simTH2)
void computeEfficiencyEta(MonitorElement *, MonitorElement *recoTH2, MonitorElement *simTH2)
void save(std::string const &filename, std::string const &path="", std::string const &pattern="", std::string const &rewrite="", uint32_t run=0, uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, std::string const &fileupdate="RECREATE")
Definition: DQMStore.cc:2244

Member Data Documentation

DQMStore* GlobalMuonMatchAnalyzer::dbe_
private

Definition at line 60 of file GlobalMuonMatchAnalyzer.h.

Referenced by dqmEndRun(), and GlobalMuonMatchAnalyzer().

edm::InputTag GlobalMuonMatchAnalyzer::glbName_
private

Definition at line 70 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

edm::EDGetTokenT<edm::View<reco::Track> > GlobalMuonMatchAnalyzer::glbToken_
private

Definition at line 71 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and GlobalMuonMatchAnalyzer().

MonitorElement* GlobalMuonMatchAnalyzer::h_effic
private

Definition at line 65 of file GlobalMuonMatchAnalyzer.h.

Referenced by bookHistograms(), and dqmEndRun().

MonitorElement * GlobalMuonMatchAnalyzer::h_efficPt
private

Definition at line 65 of file GlobalMuonMatchAnalyzer.h.

Referenced by bookHistograms(), and dqmEndRun().

MonitorElement* GlobalMuonMatchAnalyzer::h_fake
private

Definition at line 66 of file GlobalMuonMatchAnalyzer.h.

Referenced by bookHistograms(), and dqmEndRun().

MonitorElement * GlobalMuonMatchAnalyzer::h_fakeMatch
private

Definition at line 64 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), bookHistograms(), and dqmEndRun().

MonitorElement * GlobalMuonMatchAnalyzer::h_fakePt
private

Definition at line 66 of file GlobalMuonMatchAnalyzer.h.

Referenced by bookHistograms(), and dqmEndRun().

MonitorElement * GlobalMuonMatchAnalyzer::h_goodMatch
private

Definition at line 64 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and bookHistograms().

MonitorElement * GlobalMuonMatchAnalyzer::h_goodMatchSim
private

Definition at line 63 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), bookHistograms(), and dqmEndRun().

MonitorElement* GlobalMuonMatchAnalyzer::h_shouldMatch
private

Definition at line 63 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), bookHistograms(), and dqmEndRun().

MonitorElement * GlobalMuonMatchAnalyzer::h_staOnlySim
private

Definition at line 63 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and bookHistograms().

MonitorElement * GlobalMuonMatchAnalyzer::h_tkOnlySim
private

Definition at line 63 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GlobalMuonMatchAnalyzer::h_totReco
private

Definition at line 64 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), bookHistograms(), and dqmEndRun().

edm::ParameterSet GlobalMuonMatchAnalyzer::iConfig
private

Definition at line 61 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

const TrackAssociatorBase * GlobalMuonMatchAnalyzer::muAssociator_
private

Definition at line 68 of file GlobalMuonMatchAnalyzer.h.

edm::InputTag GlobalMuonMatchAnalyzer::muAssociatorName_
private

Definition at line 69 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

edm::EDGetTokenT<reco::TrackToTrackingParticleAssociator> GlobalMuonMatchAnalyzer::muAssociatorToken_
private

Definition at line 72 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and GlobalMuonMatchAnalyzer().

std::string GlobalMuonMatchAnalyzer::out
private

Definition at line 59 of file GlobalMuonMatchAnalyzer.h.

Referenced by dqmEndRun(), and GlobalMuonMatchAnalyzer().

edm::InputTag GlobalMuonMatchAnalyzer::staName_
private

Definition at line 70 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

edm::EDGetTokenT<edm::View<reco::Track> > GlobalMuonMatchAnalyzer::staToken_
private

Definition at line 71 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and GlobalMuonMatchAnalyzer().

std::string GlobalMuonMatchAnalyzer::subsystemname_
private

Definition at line 62 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

const TrackAssociatorBase* GlobalMuonMatchAnalyzer::tkAssociator_
private

Definition at line 68 of file GlobalMuonMatchAnalyzer.h.

edm::InputTag GlobalMuonMatchAnalyzer::tkAssociatorName_
private

Definition at line 69 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

edm::EDGetTokenT<reco::TrackToTrackingParticleAssociator> GlobalMuonMatchAnalyzer::tkAssociatorToken_
private

Definition at line 72 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and GlobalMuonMatchAnalyzer().

edm::InputTag GlobalMuonMatchAnalyzer::tkName_
private

Definition at line 70 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

edm::EDGetTokenT<edm::View<reco::Track> > GlobalMuonMatchAnalyzer::tkToken_
private

Definition at line 71 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and GlobalMuonMatchAnalyzer().

edm::InputTag GlobalMuonMatchAnalyzer::tpName_
private

Definition at line 70 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

edm::EDGetTokenT<edm::View<reco::Track> > GlobalMuonMatchAnalyzer::tpToken_
private

Definition at line 71 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and GlobalMuonMatchAnalyzer().