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::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 GlobalMuonMatchAnalyzer (const edm::ParameterSet &)
 
 ~GlobalMuonMatchAnalyzer ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob ()
 
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)
 
virtual void endJob ()
 
virtual void endRun (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 edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr< dqmDetails::NoCacheglobalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr< dqmDetails::NoCacheglobalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Author
Adam Everett Purdue University

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

39 {
40  iConfig = ps;
41  //now do what ever initialization is needed
44 
45  tkAssociatorToken_ = consumes<reco::TrackToTrackingParticleAssociator>(tkAssociatorName_);
46  muAssociatorToken_ = consumes<reco::TrackToTrackingParticleAssociator>(muAssociatorName_);
47 
48 subsystemname_ = iConfig.getUntrackedParameter<std::string>("subSystemFolder", "YourSubsystem") ;
53 
56 
57  tpToken_ = consumes<edm::View<reco::Track> >(tpName_);
58  tkToken_ = consumes<edm::View<reco::Track> >(tkName_);
59  staToken_ = consumes<edm::View<reco::Track> >(staName_);
60  glbToken_ = consumes<edm::View<reco::Track> >(glbName_);
61 }
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 ( )

Definition at line 64 of file GlobalMuonMatchAnalyzer.cc.

65 {
66 
67  // do anything here that needs to be done at desctruction time
68  // (e.g. close files, deallocate resources etc.)
69 
70 }

Member Function Documentation

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

Definition at line 79 of file GlobalMuonMatchAnalyzer.cc.

References reco::TrackToTrackingParticleAssociator::associateRecoToSim(), reco::TrackToTrackingParticleAssociator::associateSimToReco(), edm::AssociationMap< Tag >::end(), reco::TrackBase::eta(), 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, muAssociatorToken_, edm::Handle< T >::product(), reco::TrackBase::pt(), staToken_, tkAssociatorToken_, tkToken_, and tpToken_.

80 {
81  using namespace edm;
82  using namespace reco;
83 
85  iEvent.getByToken(tpToken_,tpHandle);
86  const TrackingParticleCollection tpColl = *(tpHandle.product());
87 
89  iEvent.getByToken(glbToken_,muHandle);
90  const reco::MuonTrackLinksCollection muColl = *(muHandle.product());
91 
92  Handle<View<Track> > staHandle;
93  iEvent.getByToken(staToken_,staHandle);
94 
95  Handle<View<Track> > glbHandle;
96  iEvent.getByToken(glbToken_,glbHandle);
97 
98  Handle<View<Track> > tkHandle;
99  iEvent.getByToken(tkToken_,tkHandle);
100 
102  iEvent.getByToken(tkAssociatorToken_,tkAssociator);
103 
104  // Mu Associator
106  iEvent.getByToken(muAssociatorToken_,muAssociator);
107 
108 
109  reco::RecoToSimCollection tkrecoToSimCollection = tkAssociator->associateRecoToSim(tkHandle,tpHandle);
110  reco::SimToRecoCollection tksimToRecoCollection = tkAssociator->associateSimToReco(tkHandle,tpHandle);
111 
112  reco::RecoToSimCollection starecoToSimCollection = muAssociator->associateRecoToSim(staHandle,tpHandle);
113  reco::SimToRecoCollection stasimToRecoCollection = muAssociator->associateSimToReco(staHandle,tpHandle);
114 
115  reco::RecoToSimCollection glbrecoToSimCollection = muAssociator->associateRecoToSim(glbHandle,tpHandle);
116  reco::SimToRecoCollection glbsimToRecoCollection = muAssociator->associateSimToReco(glbHandle,tpHandle);
117 
118 
119  for (TrackingParticleCollection::size_type i=0; i<tpColl.size(); ++i){
120  TrackingParticleRef tp(tpHandle,i);
121 
122  std::vector<std::pair<RefToBase<Track>, double> > rvGlb;
123  RefToBase<Track> rGlb;
124  if(glbsimToRecoCollection.find(tp) != glbsimToRecoCollection.end()){
125  rvGlb = glbsimToRecoCollection[tp];
126  if(rvGlb.size() != 0) {
127  rGlb = rvGlb.begin()->first;
128  }
129  }
130 
131  std::vector<std::pair<RefToBase<Track>, double> > rvSta;
132  RefToBase<Track> rSta;
133  if(stasimToRecoCollection.find(tp) != stasimToRecoCollection.end()){
134  rvSta = stasimToRecoCollection[tp];
135  if(rvSta.size() != 0) {
136  rSta = rvSta.begin()->first;
137  }
138  }
139 
140  std::vector<std::pair<RefToBase<Track>, double> > rvTk;
141  RefToBase<Track> rTk;
142  if(tksimToRecoCollection.find(tp) != tksimToRecoCollection.end()){
143  rvTk = tksimToRecoCollection[tp];
144  if(rvTk.size() != 0) {
145  rTk = rvTk.begin()->first;
146  }
147  }
148 
149  if( rvSta.size() != 0 && rvTk.size() != 0 ){
150  //should have matched
151  h_shouldMatch->Fill(rTk->eta(),rTk->pt());
152  }
153 
154  for ( reco::MuonTrackLinksCollection::const_iterator links = muHandle->begin(); links != muHandle->end(); ++links ) {
155  if( rGlb == RefToBase<Track>(links->globalTrack() ) ) {
156  if( RefToBase<Track>(links->trackerTrack() ) == rTk &&
157  RefToBase<Track>(links->standAloneTrack() ) == rSta ) {
158  //goodMatch
159  h_goodMatchSim->Fill(rGlb->eta(),rGlb->pt());
160  }
161  if ( RefToBase<Track>(links->trackerTrack() ) == rTk &&
162  RefToBase<Track>(links->standAloneTrack() ) != rSta ) {
163  //tkOnlyMatch
164  h_tkOnlySim->Fill(rGlb->eta(),rGlb->pt());
165  }
166  if ( RefToBase<Track>(links->standAloneTrack() ) == rSta &&
167  RefToBase<Track>(links->trackerTrack() ) != rTk ) {
168  //staOnlyMatch
169  h_staOnlySim->Fill(rGlb->eta(),rGlb->pt());
170  }
171  }
172  }
173 
174  }
175 
177 
178  for ( reco::MuonTrackLinksCollection::const_iterator links = muHandle->begin(); links != muHandle->end(); ++links ) {
179  RefToBase<Track> glbRef = RefToBase<Track>(links->globalTrack() );
180  RefToBase<Track> staRef = RefToBase<Track>(links->standAloneTrack() );
181  RefToBase<Track> tkRef = RefToBase<Track>(links->trackerTrack() );
182 
183  std::vector<std::pair<TrackingParticleRef, double> > tp1;
184  TrackingParticleRef tp1r;
185  if(glbrecoToSimCollection.find(glbRef) != glbrecoToSimCollection.end()){
186  tp1 = glbrecoToSimCollection[glbRef];
187  if(tp1.size() != 0) {
188  tp1r = tp1.begin()->first;
189  }
190  }
191 
192  std::vector<std::pair<TrackingParticleRef, double> > tp2;
193  TrackingParticleRef tp2r;
194  if(starecoToSimCollection.find(staRef) != starecoToSimCollection.end()){
195  tp2 = starecoToSimCollection[staRef];
196  if(tp2.size() != 0) {
197  tp2r = tp2.begin()->first;
198  }
199  }
200 
201  std::vector<std::pair<TrackingParticleRef, double> > tp3;
202  TrackingParticleRef tp3r;
203  if(tkrecoToSimCollection.find(tkRef) != tkrecoToSimCollection.end()){
204  tp3 = tkrecoToSimCollection[tkRef];
205  if(tp3.size() != 0) {
206  tp3r = tp3.begin()->first;
207  }
208  }
209 
210 
211  if(tp1.size() != 0) {
212  //was reconstructed
213  h_totReco->Fill(glbRef->eta(),glbRef->pt());
214  if(tp2r == tp3r) { // && tp1r == tp3r) {
215  //came from same TP
216  h_goodMatch->Fill(glbRef->eta(),glbRef->pt());
217  } else {
218  //mis-match
219  h_fakeMatch->Fill(glbRef->eta(),glbRef->pt());
220  }
221  }
222 
223  }
224 
225 
226 }
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:460
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:646
edm::EDGetTokenT< edm::View< reco::Track > > glbToken_
double pt() const
track transverse momentum
Definition: TrackBase.h:616
edm::EDGetTokenT< edm::View< reco::Track > > staToken_
T const * product() const
Definition: Handle.h:81
reco::RecoToSimCollection associateRecoToSim(const edm::Handle< edm::View< reco::Track > > &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
fixed size matrix
HLT enums.
edm::EDGetTokenT< edm::View< reco::Track > > tpToken_
reco::SimToRecoCollection associateSimToReco(const edm::Handle< edm::View< reco::Track > > &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > tkAssociatorToken_
edm::EDGetTokenT< edm::View< reco::Track > > tkToken_
void GlobalMuonMatchAnalyzer::beginJob ( void  )
privatevirtual

Definition at line 231 of file GlobalMuonMatchAnalyzer.cc.

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

Implements DQMEDAnalyzer.

Definition at line 248 of file GlobalMuonMatchAnalyzer.cc.

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

251 {
252  // Tk Associator
253 
254  ibooker.cd();
255  std::string dirName="Matcher/";
256  // ibooker.setCurrentFolder("RecoMuonV/Matcher");
257  ibooker.setCurrentFolder(dirName.c_str()) ;
258 
259  h_shouldMatch = ibooker.book2D("h_shouldMatch","SIM associated to Tk and Sta",50,-2.5,2.5,100,0.,500.);
260  h_goodMatchSim = ibooker.book2D("h_goodMatchSim","SIM associated to Glb Sta Tk",50,-2.5,2.5,100,0.,500.);
261  h_tkOnlySim = ibooker.book2D("h_tkOnlySim","SIM associated to Glb Tk",50,-2.5,2.5,100,0.,500.);
262  h_staOnlySim = ibooker.book2D("h_staOnlySim","SIM associated to Glb Sta",50,-2.5,2.5,100,0.,500.);
263 
264  h_totReco = ibooker.book2D("h_totReco","Total Glb Reconstructed",50,-2.5,2.5,100,0.,500.);
265  h_goodMatch = ibooker.book2D("h_goodMatch","Sta and Tk from same SIM",50,-2.5,2.5,100, 0., 500.);
266  h_fakeMatch = ibooker.book2D("h_fakeMatch","Sta and Tk not from same SIM",50,-2.5,2.5,100,0.,500.);
267 
268  h_effic = ibooker.book1D("h_effic","Efficiency vs #eta",50,-2.5,2.5);
269  h_efficPt = ibooker.book1D("h_efficPt","Efficiency vs p_{T}",100,0.,100.);
270 
271  h_fake = ibooker.book1D("h_fake","Fake fraction vs #eta",50,-2.5,2.5);
272  h_fakePt = ibooker.book1D("h_fakePt","Fake fraction vs p_{T}",100,0.,100.);
273 
274 }
void cd(void)
Definition: DQMStore.cc:269
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
void GlobalMuonMatchAnalyzer::computeEfficiencyEta ( MonitorElement effHist,
MonitorElement recoTH2,
MonitorElement simTH2 
)
private

Definition at line 278 of file GlobalMuonMatchAnalyzer.cc.

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

Referenced by endRun().

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

Definition at line 308 of file GlobalMuonMatchAnalyzer.cc.

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

Referenced by endRun().

308  {
309  TH2F * h1 = recoTH2->getTH2F();
310  TH1D* reco = h1->ProjectionY();
311 
312  TH2F * h2 = simTH2->getTH2F();
313  TH1D* sim = h2 ->ProjectionY();
314 
315 
316  TH1F *hEff = (TH1F*) reco->Clone();
317 
318  hEff->Divide(sim);
319 
320  hEff->SetName("tmp_"+TString(reco->GetName()));
321 
322  // Set the error accordingly to binomial statistics
323  int nBinsPt = hEff->GetNbinsX();
324  for(int bin = 1; bin <= nBinsPt; bin++) {
325  float nSimHit = sim->GetBinContent(bin);
326  float eff = hEff->GetBinContent(bin);
327  float error = 0;
328  if(nSimHit != 0 && eff <= 1) {
329  error = sqrt(eff*(1-eff)/nSimHit);
330  }
331  hEff->SetBinError(bin, error);
332  effHist->setBinContent(bin,eff);
333  effHist->setBinError(bin,error);
334  }
335 
336 }
void setBinContent(int binx, double content)
set content of bin (1-D)
T sqrt(T t)
Definition: SSEVec.h:18
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
Definition: RunManager.h:32
bin
set the eta bin as selection string.
fixed size matrix
TH2F * getTH2F(void) const
void GlobalMuonMatchAnalyzer::endJob ( void  )
privatevirtual

Definition at line 234 of file GlobalMuonMatchAnalyzer.cc.

234 {}
void GlobalMuonMatchAnalyzer::endRun ( const edm::Run ,
const edm::EventSetup  
)
overrideprivatevirtual

Definition at line 236 of file GlobalMuonMatchAnalyzer.cc.

References computeEfficiencyEta(), computeEfficiencyPt(), dbe_, h_effic, h_efficPt, h_fake, h_fakeMatch, h_fakePt, h_goodMatchSim, h_shouldMatch, h_totReco, and out.

236  {
239 
242 
243  if( out.size() != 0 && dbe_ ) dbe_->save(out);
244 }
void computeEfficiencyPt(MonitorElement *, MonitorElement *recoTH2, MonitorElement *simTH2)
void computeEfficiencyEta(MonitorElement *, MonitorElement *recoTH2, MonitorElement *simTH2)

Member Data Documentation

DQMStore* GlobalMuonMatchAnalyzer::dbe_
private

Definition at line 64 of file GlobalMuonMatchAnalyzer.h.

Referenced by endRun(), and GlobalMuonMatchAnalyzer().

edm::InputTag GlobalMuonMatchAnalyzer::glbName_
private

Definition at line 74 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

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

Definition at line 75 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and GlobalMuonMatchAnalyzer().

MonitorElement* GlobalMuonMatchAnalyzer::h_effic
private

Definition at line 69 of file GlobalMuonMatchAnalyzer.h.

Referenced by bookHistograms(), and endRun().

MonitorElement * GlobalMuonMatchAnalyzer::h_efficPt
private

Definition at line 69 of file GlobalMuonMatchAnalyzer.h.

Referenced by bookHistograms(), and endRun().

MonitorElement* GlobalMuonMatchAnalyzer::h_fake
private

Definition at line 70 of file GlobalMuonMatchAnalyzer.h.

Referenced by bookHistograms(), and endRun().

MonitorElement * GlobalMuonMatchAnalyzer::h_fakeMatch
private

Definition at line 68 of file GlobalMuonMatchAnalyzer.h.

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

MonitorElement * GlobalMuonMatchAnalyzer::h_fakePt
private

Definition at line 70 of file GlobalMuonMatchAnalyzer.h.

Referenced by bookHistograms(), and endRun().

MonitorElement * GlobalMuonMatchAnalyzer::h_goodMatch
private

Definition at line 68 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and bookHistograms().

MonitorElement * GlobalMuonMatchAnalyzer::h_goodMatchSim
private

Definition at line 67 of file GlobalMuonMatchAnalyzer.h.

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

MonitorElement* GlobalMuonMatchAnalyzer::h_shouldMatch
private

Definition at line 67 of file GlobalMuonMatchAnalyzer.h.

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

MonitorElement * GlobalMuonMatchAnalyzer::h_staOnlySim
private

Definition at line 67 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and bookHistograms().

MonitorElement * GlobalMuonMatchAnalyzer::h_tkOnlySim
private

Definition at line 67 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GlobalMuonMatchAnalyzer::h_totReco
private

Definition at line 68 of file GlobalMuonMatchAnalyzer.h.

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

edm::ParameterSet GlobalMuonMatchAnalyzer::iConfig
private

Definition at line 65 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

const TrackAssociatorBase * GlobalMuonMatchAnalyzer::muAssociator_
private

Definition at line 72 of file GlobalMuonMatchAnalyzer.h.

edm::InputTag GlobalMuonMatchAnalyzer::muAssociatorName_
private

Definition at line 73 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

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

Definition at line 76 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and GlobalMuonMatchAnalyzer().

std::string GlobalMuonMatchAnalyzer::out
private

Definition at line 63 of file GlobalMuonMatchAnalyzer.h.

Referenced by endRun(), and GlobalMuonMatchAnalyzer().

edm::InputTag GlobalMuonMatchAnalyzer::staName_
private

Definition at line 74 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

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

Definition at line 75 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and GlobalMuonMatchAnalyzer().

std::string GlobalMuonMatchAnalyzer::subsystemname_
private

Definition at line 66 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

const TrackAssociatorBase* GlobalMuonMatchAnalyzer::tkAssociator_
private

Definition at line 72 of file GlobalMuonMatchAnalyzer.h.

edm::InputTag GlobalMuonMatchAnalyzer::tkAssociatorName_
private

Definition at line 73 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

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

Definition at line 76 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and GlobalMuonMatchAnalyzer().

edm::InputTag GlobalMuonMatchAnalyzer::tkName_
private

Definition at line 74 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

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

Definition at line 75 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and GlobalMuonMatchAnalyzer().

edm::InputTag GlobalMuonMatchAnalyzer::tpName_
private

Definition at line 74 of file GlobalMuonMatchAnalyzer.h.

Referenced by GlobalMuonMatchAnalyzer().

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

Definition at line 75 of file GlobalMuonMatchAnalyzer.h.

Referenced by analyze(), and GlobalMuonMatchAnalyzer().