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:
DQMOneEDAnalyzer<> edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args... > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 GlobalMuonMatchAnalyzer (const edm::ParameterSet &)
 
 ~GlobalMuonMatchAnalyzer () override
 
- Public Member Functions inherited from DQMOneEDAnalyzer<>
void accumulate (edm::Event const &event, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
 DQMOneEDAnalyzer ()
 
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::Accumulator, Args... >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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 DQMOneEDAnalyzer<>
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
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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 DQMOneEDAnalyzer<>
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 
- Protected Attributes inherited from DQMOneEDAnalyzer<>
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Author
Adam Everett Purdue University

Definition at line 38 of file GlobalMuonMatchAnalyzer.h.

Constructor & Destructor Documentation

◆ GlobalMuonMatchAnalyzer()

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

Class: GlobalMuonMatchAnalyzer

Authors :

Author
Adam Everett - Purdue University

Definition at line 33 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_.

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

Definition at line 59 of file GlobalMuonMatchAnalyzer.cc.

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

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMOneEDAnalyzer<>.

Definition at line 69 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(), glbToken_, h_fakeMatch, h_goodMatch, h_goodMatchSim, h_shouldMatch, h_staOnlySim, h_tkOnlySim, h_totReco, mps_fire::i, iEvent, electronStore::links, muAssociatorToken_, edm::Handle< T >::product(), reco::TrackBase::pt(), staToken_, tkAssociatorToken_, tkToken_, cmsswSequenceInfo::tp, and tpToken_.

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

◆ bookHistograms()

void GlobalMuonMatchAnalyzer::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprivatevirtual

Implements DQMOneEDAnalyzer<>.

Definition at line 221 of file GlobalMuonMatchAnalyzer.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), dqm::implementation::NavigatorBase::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::implementation::NavigatorBase::setCurrentFolder(), dqm::implementation::IBooker::setScope(), and AlCaHLTBitMon_QueryRunRegistry::string.

223  {
224  // Tk Associator
225 
226  ibooker.cd();
227  // Run histos only for dqmEndRun handling
228  ibooker.setScope(MonitorElementData::Scope::RUN);
229 
230  std::string dirName = "Matcher/";
231  // ibooker.setCurrentFolder("RecoMuonV/Matcher");
232  ibooker.setCurrentFolder(dirName);
233 
234  h_shouldMatch = ibooker.book2D("h_shouldMatch", "SIM associated to Tk and Sta", 50, -2.5, 2.5, 100, 0., 500.);
235  h_goodMatchSim = ibooker.book2D("h_goodMatchSim", "SIM associated to Glb Sta Tk", 50, -2.5, 2.5, 100, 0., 500.);
236  h_tkOnlySim = ibooker.book2D("h_tkOnlySim", "SIM associated to Glb Tk", 50, -2.5, 2.5, 100, 0., 500.);
237  h_staOnlySim = ibooker.book2D("h_staOnlySim", "SIM associated to Glb Sta", 50, -2.5, 2.5, 100, 0., 500.);
238 
239  h_totReco = ibooker.book2D("h_totReco", "Total Glb Reconstructed", 50, -2.5, 2.5, 100, 0., 500.);
240  h_goodMatch = ibooker.book2D("h_goodMatch", "Sta and Tk from same SIM", 50, -2.5, 2.5, 100, 0., 500.);
241  h_fakeMatch = ibooker.book2D("h_fakeMatch", "Sta and Tk not from same SIM", 50, -2.5, 2.5, 100, 0., 500.);
242 
243  h_effic = ibooker.book1D("h_effic", "Efficiency vs #eta", 50, -2.5, 2.5);
244  h_efficPt = ibooker.book1D("h_efficPt", "Efficiency vs p_{T}", 100, 0., 100.);
245 
246  h_fake = ibooker.book1D("h_fake", "Fake fraction vs #eta", 50, -2.5, 2.5);
247  h_fakePt = ibooker.book1D("h_fakePt", "Fake fraction vs p_{T}", 100, 0., 100.);
248 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
virtual MonitorElementData::Scope setScope(MonitorElementData::Scope newscope)
Definition: DQMStore.cc:50
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ computeEfficiencyEta()

void GlobalMuonMatchAnalyzer::computeEfficiencyEta ( MonitorElement effHist,
MonitorElement recoTH2,
MonitorElement simTH2 
)
private

Definition at line 250 of file GlobalMuonMatchAnalyzer.cc.

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

Referenced by dqmEndRun().

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

◆ computeEfficiencyPt()

void GlobalMuonMatchAnalyzer::computeEfficiencyPt ( MonitorElement effHist,
MonitorElement recoTH2,
MonitorElement simTH2 
)
private

Definition at line 280 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().

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

◆ dqmEndRun()

void GlobalMuonMatchAnalyzer::dqmEndRun ( const edm::Run ,
const edm::EventSetup  
)
overrideprivatevirtual

Reimplemented from DQMOneEDAnalyzer<>.

Definition at line 208 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::implementation::DQMStore::save().

208  {
211 
214 
215  if (!out.empty() && dbe_)
216  dbe_->save(out);
217 }
void computeEfficiencyPt(MonitorElement *, MonitorElement *recoTH2, MonitorElement *simTH2)
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
Definition: DQMStore.cc:808
void computeEfficiencyEta(MonitorElement *, MonitorElement *recoTH2, MonitorElement *simTH2)

Member Data Documentation

◆ dbe_

DQMStore* GlobalMuonMatchAnalyzer::dbe_
private

Definition at line 53 of file GlobalMuonMatchAnalyzer.h.

Referenced by dqmEndRun(), and GlobalMuonMatchAnalyzer().

◆ glbName_

edm::InputTag GlobalMuonMatchAnalyzer::glbName_
private

Definition at line 63 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

◆ glbToken_

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

Definition at line 64 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and GlobalMuonMatchAnalyzer().

◆ h_effic

MonitorElement* GlobalMuonMatchAnalyzer::h_effic
private

Definition at line 58 of file GlobalMuonMatchAnalyzer.h.

Referenced by bookHistograms(), and dqmEndRun().

◆ h_efficPt

MonitorElement * GlobalMuonMatchAnalyzer::h_efficPt
private

Definition at line 58 of file GlobalMuonMatchAnalyzer.h.

Referenced by bookHistograms(), and dqmEndRun().

◆ h_fake

MonitorElement* GlobalMuonMatchAnalyzer::h_fake
private

Definition at line 59 of file GlobalMuonMatchAnalyzer.h.

Referenced by bookHistograms(), and dqmEndRun().

◆ h_fakeMatch

MonitorElement * GlobalMuonMatchAnalyzer::h_fakeMatch
private

Definition at line 57 of file GlobalMuonMatchAnalyzer.h.

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

◆ h_fakePt

MonitorElement * GlobalMuonMatchAnalyzer::h_fakePt
private

Definition at line 59 of file GlobalMuonMatchAnalyzer.h.

Referenced by bookHistograms(), and dqmEndRun().

◆ h_goodMatch

MonitorElement * GlobalMuonMatchAnalyzer::h_goodMatch
private

Definition at line 57 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and bookHistograms().

◆ h_goodMatchSim

MonitorElement * GlobalMuonMatchAnalyzer::h_goodMatchSim
private

Definition at line 56 of file GlobalMuonMatchAnalyzer.h.

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

◆ h_shouldMatch

MonitorElement* GlobalMuonMatchAnalyzer::h_shouldMatch
private

Definition at line 56 of file GlobalMuonMatchAnalyzer.h.

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

◆ h_staOnlySim

MonitorElement * GlobalMuonMatchAnalyzer::h_staOnlySim
private

Definition at line 56 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and bookHistograms().

◆ h_tkOnlySim

MonitorElement * GlobalMuonMatchAnalyzer::h_tkOnlySim
private

Definition at line 56 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and bookHistograms().

◆ h_totReco

MonitorElement* GlobalMuonMatchAnalyzer::h_totReco
private

Definition at line 57 of file GlobalMuonMatchAnalyzer.h.

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

◆ iConfig

edm::ParameterSet GlobalMuonMatchAnalyzer::iConfig
private

Definition at line 54 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

◆ muAssociator_

const TrackAssociatorBase * GlobalMuonMatchAnalyzer::muAssociator_
private

Definition at line 61 of file GlobalMuonMatchAnalyzer.h.

◆ muAssociatorName_

edm::InputTag GlobalMuonMatchAnalyzer::muAssociatorName_
private

Definition at line 62 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

◆ muAssociatorToken_

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

Definition at line 65 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and GlobalMuonMatchAnalyzer().

◆ out

std::string GlobalMuonMatchAnalyzer::out
private

Definition at line 52 of file GlobalMuonMatchAnalyzer.h.

Referenced by dqmEndRun(), and GlobalMuonMatchAnalyzer().

◆ staName_

edm::InputTag GlobalMuonMatchAnalyzer::staName_
private

Definition at line 63 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

◆ staToken_

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

Definition at line 64 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and GlobalMuonMatchAnalyzer().

◆ subsystemname_

std::string GlobalMuonMatchAnalyzer::subsystemname_
private

Definition at line 55 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

◆ tkAssociator_

const TrackAssociatorBase* GlobalMuonMatchAnalyzer::tkAssociator_
private

Definition at line 61 of file GlobalMuonMatchAnalyzer.h.

◆ tkAssociatorName_

edm::InputTag GlobalMuonMatchAnalyzer::tkAssociatorName_
private

Definition at line 62 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

◆ tkAssociatorToken_

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

Definition at line 65 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and GlobalMuonMatchAnalyzer().

◆ tkName_

edm::InputTag GlobalMuonMatchAnalyzer::tkName_
private

Definition at line 63 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

◆ tkToken_

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

Definition at line 64 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and GlobalMuonMatchAnalyzer().

◆ tpName_

edm::InputTag GlobalMuonMatchAnalyzer::tpName_
private

Definition at line 63 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

◆ tpToken_

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

Definition at line 64 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and GlobalMuonMatchAnalyzer().