37 MEP hSimP_,
hSimPt_, hSimEta_, hSimPhi_, hSimDxy_, hSimDz_;
74 MEP hPullPt_, hPullEta_, hPullPhi_,
hPullQPt_, hPullDxy_, hPullDz_;
111 hNSim_ = ibooker.
book1D(
"NSim" ,
"Number of particles per event", hDim.
nTrks, -0.5, hDim.
nTrks+0.5);
112 hNMuon_ = ibooker.
book1D(
"NMuon",
"Number of muons per event" , hDim.
nTrks, -0.5, hDim.
nTrks+0.5);
115 hNTrks_ = ibooker.
book1D(
"NTrks",
"Number of reco tracks per event", hDim.
nTrks, -0.5, hDim.
nTrks+0.5);
117 hNTrksPt_ = ibooker.
book1D(
"NTrksPt",
"Number of reco tracks vs p_{T}", hDim.
nBinPt, hDim.
minPt, hDim.
maxPt);
141 hPFMomAssCorrectness = ibooker.
book1D(
"hPFMomAssCorrectness",
"Corrected momentum assignement PF/RECO",2,0.5,2.5);
142 hPt_vs_PFMomAssCorrectness = ibooker.
book2D(
"hPt_vs_PFMomAssCorrectness",
"Corrected momentum assignement PF/RECO", hDim.
nBinPt, hDim.
minPt, hDim.
maxP, 2, 0.5, 2.5);
149 hErrP_vs_Eta_ = ibooker.
book2D(
"ErrP_vs_Eta",
"#Delta(p)/p vs #eta",
151 hErrPt_vs_Eta_ = ibooker.
book2D(
"ErrPt_vs_Eta",
"#Delta(p_{T})/p_{T} vs #eta",
153 hErrQPt_vs_Eta_ = ibooker.
book2D(
"ErrQPt_vs_Eta",
"#Delta(q/p_{T})/(q/p_{T}) vs #eta",
155 hErrEta_vs_Eta_ = ibooker.
book2D(
"ErrEta_vs_Eta",
"#sigma(#eta) vs #eta",
159 hErrP_vs_P_ = ibooker.
book2D(
"ErrP_vs_P",
"#Delta(p)/p vs p",
161 hErrPt_vs_Pt_ = ibooker.
book2D(
"ErrPt_vs_Pt",
"#Delta(p_{T})/p_{T} vs p_{T}",
163 hErrQPt_vs_Pt_ = ibooker.
book2D(
"ErrQPt_vs_Pt",
"#Delta(q/p_{T})/(q/p_{T}) vs p_{T}",
175 hPullPt_vs_Eta_ = ibooker.
book2D(
"PullPt_vs_Eta",
"Pull(p_{T}) vs #eta",
177 hPullEta_vs_Eta_ = ibooker.
book2D(
"PullEta_vs_Eta",
"Pull(#eta) vs #eta",
179 hPullPhi_vs_Eta_ = ibooker.
book2D(
"PullPhi_vs_Eta",
"Pull(#phi) vs #eta",
183 hPullPt_vs_Pt_ = ibooker.
book2D(
"PullPt_vs_Pt",
"Pull(p_{T}) vs p_{T}",
185 hPullEta_vs_Pt_ = ibooker.
book2D(
"PullEta_vs_Pt",
"Pull(#eta) vs p_{T}",
189 const int nHits = 100;
190 hNHits_ = ibooker.
book1D(
"NHits",
"Number of hits", nHits+1, -0.5, nHits+0.5);
191 hNHits_vs_Pt_ = ibooker.
book2D(
"NHits_vs_Pt",
"Number of hits vs p_{T}",
193 hNHits_vs_Eta_ = ibooker.
book2D(
"NHits_vs_Eta",
"Number of hits vs #eta",
195 hNSimHits_ = ibooker.
book1D(
"NSimHits",
"Number of simHits", nHits+1, -0.5, nHits+0.5);
197 const int nLostHits = 5;
198 hNLostHits_ = ibooker.
book1D(
"NLostHits",
"Number of Lost hits", nLostHits+1, -0.5, nLostHits+0.5);
199 hNLostHits_vs_Pt_ = ibooker.
book2D(
"NLostHits_vs_Pt",
"Number of lost Hits vs p_{T}",
201 hNLostHits_vs_Eta_ = ibooker.
book2D(
"NLostHits_vs_Eta",
"Number of lost Hits vs #eta",
204 const int nTrackerHits = 40;
205 hNTrackerHits_ = ibooker.
book1D(
"NTrackerHits",
"Number of valid tracker hits", nTrackerHits+1, -0.5, nTrackerHits+0.5);
206 hNTrackerHits_vs_Pt_ = ibooker.
book2D(
"NTrackerHits_vs_Pt",
"Number of valid traker hits vs p_{T}",
207 hDim.
nBinPt, hDim.
minPt, hDim.
maxPt, nTrackerHits/4+1, -0.25, nTrackerHits+0.25);
208 hNTrackerHits_vs_Eta_ = ibooker.
book2D(
"NTrackerHits_vs_Eta",
"Number of valid tracker hits vs #eta",
211 const int nMuonHits = 60;
212 hNMuonHits_ = ibooker.
book1D(
"NMuonHits",
"Number of valid muon hits", nMuonHits+1, -0.5, nMuonHits+0.5);
213 hNMuonHits_vs_Pt_ = ibooker.
book2D(
"NMuonHits_vs_Pt",
"Number of valid muon hits vs p_{T}",
215 hNMuonHits_vs_Eta_ = ibooker.
book2D(
"NMuonHits_vs_Eta",
"Number of valid muon hits vs #eta",
218 hNDof_ = ibooker.
book1D(
"NDof",
"Number of DoF", hDim.
nDof+1, -0.5, hDim.
nDof+0.5);
219 hChi2_ = ibooker.
book1D(
"Chi2",
"#Chi^{2}", hDim.
nBinErr, 0, 200);
220 hChi2Norm_ = ibooker.
book1D(
"Chi2Norm",
"Normalized #Chi^{2}", hDim.
nBinErr, 0, 50);
221 hChi2Prob_ = ibooker.
book1D(
"Chi2Prob",
"Prob(#Chi^{2})", hDim.
nBinErr, 0, 1);
223 hNDof_vs_Eta_ = ibooker.
book2D(
"NDof_vs_Eta",
"Number of DoF vs #eta",
225 hChi2_vs_Eta_ = ibooker.
book2D(
"Chi2_vs_Eta",
"#Chi^{2} vs #eta",
227 hChi2Norm_vs_Eta_ = ibooker.
book2D(
"Chi2Norm_vs_Eta",
"Normalized #Chi^{2} vs #eta",
229 hChi2Prob_vs_Eta_ = ibooker.
book2D(
"Chi2Prob_vs_Eta",
"Prob(#Chi^{2}) vs #eta",
232 hNSimToReco_ = ibooker.
book1D(
"NSimToReco",
"Number of associated reco tracks", hDim.
nAssoc+1, -0.5, hDim.
nAssoc+0.5);
233 hNRecoToSim_ = ibooker.
book1D(
"NRecoToSim",
"Number of associated sim TP's", hDim.
nAssoc+1, -0.5, hDim.
nAssoc+0.5);
243 const double simP = simRef->
p();
244 const double simPt = simRef->
pt();
245 const double simEta = doAbsEta_ ? fabs(simRef->
eta()) : simRef->
eta();
246 const double simPhi = simRef->
phi();
247 const double simQ = simRef->
charge();
248 const double simQPt = simQ/simPt;
252 const double simDxy = -simVtx.
x()*
sin(simPhi)+simVtx.y()*
cos(simPhi);
253 const double simDz = simVtx.z() - (simVtx.x()*simMom.x()+simVtx.y()*simMom.y())*simMom.z()/simMom.perp2();
255 const double recoQ = muonRef->
charge();
256 if ( simQ*recoQ < 0 ) {
257 hMisQPt_ ->Fill(simPt );
258 hMisQEta_->Fill(simEta);
261 double recoP, recoPt, recoEta, recoPhi, recoQPt;
264 const double origRecoPt = muonRef->
pt();
267 const double origRecoQPt = recoQ/origRecoPt;
268 recoP = muonRef->
pfP4().P();
269 recoPt = muonRef->
pfP4().Pt();
270 recoEta = muonRef->
pfP4().Eta();
271 recoPhi = muonRef->
pfP4().Phi();
272 recoQPt = recoQ/recoPt;
273 hErrPt_PF_->Fill((recoPt-origRecoPt)/origRecoPt);
274 hErrQPt_PF_->Fill((recoQPt-origRecoQPt)/origRecoQPt);
276 hdPt_vs_Eta_->Fill(recoEta,recoPt-origRecoPt);
277 hdPt_vs_Pt_->Fill(recoPt,recoPt-origRecoPt);
279 int theCorrectPFAss = (fabs(recoPt-simPt) < fabs(origRecoPt - simPt))? 1 : 2;
280 hPFMomAssCorrectness->Fill(theCorrectPFAss);
281 hPt_vs_PFMomAssCorrectness->Fill(simPt,theCorrectPFAss);
285 recoP = muonRef->
p();
286 recoPt = muonRef->
pt();
287 recoEta = muonRef->
eta();
288 recoPhi = muonRef->
phi();
289 recoQPt = recoQ/recoPt;
292 const double errP = (recoP-simP)/simP;
293 const double errPt = (recoPt-simPt)/simPt;
294 const double errEta = (recoEta-simEta)/simEta;
295 const double errPhi = (recoPhi-simPhi)/simPhi;
296 const double errQPt = (recoQPt-simQPt)/simQPt;
303 hErrP_ ->Fill(errP );
304 hErrPt_ ->Fill(errPt );
305 hErrEta_->Fill(errEta);
306 hErrPhi_->Fill(errPhi);
308 if(fabs(simEta) > 0. && fabs(simEta) < 0.8) {
309 hErrPBarrel_->Fill(errP);
310 hErrPtBarrel_->Fill(errPt);
311 }
else if (fabs(simEta) > 0.8 && fabs(simEta) < 1.2) {
312 hErrPOverlap_->Fill(errP);
313 hErrPtOverlap_->Fill(errPt);
314 }
else if (fabs(simEta) > 1.2 ){
315 hErrPEndcap_->Fill(errP);
316 hErrPtEndcap_->Fill(errPt);
319 hErrP_vs_Eta_ ->Fill(simEta, errP );
320 hErrPt_vs_Eta_ ->Fill(simEta, errPt );
321 hErrQPt_vs_Eta_->Fill(simEta, errQPt);
323 hErrP_vs_P_ ->Fill(simP , errP );
324 hErrPt_vs_Pt_ ->Fill(simPt , errPt );
325 hErrQPt_vs_Pt_->Fill(simQPt, errQPt);
327 hErrEta_vs_Eta_->Fill(simEta, errEta);
334 const int nRecoHits = recoRef->numberOfValidHits();
335 const int nLostHits = recoRef->numberOfLostHits();
337 hNHits_->Fill(nRecoHits);
338 hNHits_vs_Pt_ ->Fill(simPt , nRecoHits);
339 hNHits_vs_Eta_->Fill(simEta, nRecoHits);
341 hNLostHits_->Fill(nLostHits);
342 hNLostHits_vs_Pt_ ->Fill(simPt , nLostHits);
343 hNLostHits_vs_Eta_->Fill(simEta, nLostHits);
345 const double recoNDof = recoRef->ndof();
346 const double recoChi2 = recoRef->chi2();
347 const double recoChi2Norm = recoRef->normalizedChi2();
348 const double recoChi2Prob = TMath::Prob(recoRef->chi2(),
static_cast<int>(recoRef->ndof()));
350 hNDof_->Fill(recoNDof);
351 hChi2_->Fill(recoChi2);
352 hChi2Norm_->Fill(recoChi2Norm);
353 hChi2Prob_->Fill(recoChi2Prob);
355 hNDof_vs_Eta_->Fill(simEta, recoNDof);
356 hChi2_vs_Eta_->Fill(simEta, recoChi2);
357 hChi2Norm_vs_Eta_->Fill(simEta, recoChi2Norm);
358 hChi2Prob_vs_Eta_->Fill(simEta, recoChi2Prob);
360 const double recoDxy = recoRef->dxy();
361 const double recoDz = recoRef->dz();
363 const double errDxy = (recoDxy-simDxy)/simDxy;
364 const double errDz = (recoDz-simDz)/simDz;
365 hErrDxy_->Fill(errDxy);
366 hErrDz_ ->Fill(errDz );
368 const double pullPt = (recoPt-simPt)/recoRef->ptError();
369 const double pullQPt = (recoQPt-simQPt)/recoRef->qoverpError();
370 const double pullEta = (recoEta-simEta)/recoRef->etaError();
371 const double pullPhi = (recoPhi-simPhi)/recoRef->phiError();
372 const double pullDxy = (recoDxy-simDxy)/recoRef->dxyError();
373 const double pullDz = (recoDz-simDz)/recoRef->dzError();
375 hPullPt_ ->Fill(pullPt );
376 hPullEta_->Fill(pullEta);
377 hPullPhi_->Fill(pullPhi);
378 hPullQPt_->Fill(pullQPt);
379 hPullDxy_->Fill(pullDxy);
380 hPullDz_ ->Fill(pullDz );
382 hPullPt_vs_Eta_->Fill(simEta, pullPt);
383 hPullPt_vs_Pt_ ->Fill(simPt, pullPt);
385 hPullEta_vs_Eta_->Fill(simEta, pullEta);
386 hPullPhi_vs_Eta_->Fill(simEta, pullPhi);
388 hPullEta_vs_Pt_->Fill(simPt, pullEta);
411 MEP hMuonTrackP_,
hMuonTrackPt_, hMuonTrackEta_, hMuonTrackPhi_, hMuonTrackDxy_, hMuonTrackDz_;
420 selector_(pset.getParameter<std::
string>(
"selection"))
516 else throw cms::Exception(
"Configuration") <<
"Track type '" << trackType <<
"' not supported.\n";
543 if ( subDir_.empty() ) subDir_ =
"RecoMuonV";
544 if ( subDir_[subDir_.size()-1] ==
'/' ) subDir_.erase(subDir_.size()-1);
563 const int nHits = 100;
579 commonME_->
hNDeltaInvalidHitsHitPattern_ = ibooker.
book1D(
"hNDeltaInvalidHitsHitPattern",
"The discrepancy for Number of invalid hits on an global track and inner and outer tracks", 2*nHits+1, -nHits-0.5, nHits+0.5);
623 if (assoByHits == 0)
throw cms::Exception(
"Configuration") <<
"The Track Associator with label '" <<
muAssocLabel_.
label() <<
"' is not a MuonAssociatorByHits.\n";
646 unsigned int theIndexOfThePrimaryVertex = 999.;
647 for (
unsigned int ind=0; ind<recVtxs->size(); ++ind) {
648 if ( (*recVtxs)[ind].isValid() && !((*recVtxs)[ind].isFake()) ) {
649 theIndexOfThePrimaryVertex = ind;
653 if (theIndexOfThePrimaryVertex<100) {
654 posVtx = ((*recVtxs)[theIndexOfThePrimaryVertex]).
position();
655 errVtx = ((*recVtxs)[theIndexOfThePrimaryVertex]).
error();
658 LogInfo(
"RecoMuonValidator") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
665 errVtx(2,2) = bs.
sigmaZ();
683 for (
size_t i = 0;
i < muonHandle->size(); ++
i) {
688 for (
size_t i = 0;
i < nSim; ++
i) {
735 int glbNTrackerHits = 0;
int trkNTrackerHits = 0;
736 int glbNMuonHits = 0;
int staNMuonHits = 0;
737 int NTrackerHits = 0;
int NMuonHits = 0;
742 iMuon != muonColl.
end(); ++iMuon) {
746 muonP = iMuon->pfP4().P();
747 muonPt = iMuon->pfP4().Pt();
748 muonEta = iMuon->pfP4().Eta();
749 muonPhi = iMuon->pfP4().Phi();
753 muonPt = iMuon->pt();
754 muonEta = iMuon->eta();
755 muonPhi = iMuon->phi();
783 if (iMuon->isGlobalMuon()) {
784 Track = iMuon->combinedMuon();
787 }
else if (iMuon->isTrackerMuon()) {
788 Track = iMuon->track();
791 Track = iMuon->standAloneMuon();
815 if (iMuon->isGlobalMuon()) {
816 double gtHitPat = iMuon->globalTrack()->hitPattern().numberOfHits(HitPattern::TRACK_HITS)
817 - iMuon->globalTrack()->hitPattern().numberOfValidHits();
819 double itHitPat = iMuon->innerTrack()->hitPattern().numberOfHits(HitPattern::TRACK_HITS)
820 - iMuon->innerTrack()->hitPattern().numberOfValidHits();
822 double otHitPat = iMuon->outerTrack()->hitPattern().numberOfHits(HitPattern::TRACK_HITS)
823 - iMuon->outerTrack()->hitPattern().numberOfValidHits();
831 if (iMuon->isStandAloneMuon()) {
838 if (iMuon->isTrackerMuon()) {
855 const double simP = simRef->p();
856 const double simPt = simRef->pt();
857 const double simEta =
doAbsEta_ ? fabs(simRef->eta()) : simRef->eta();
858 const double simPhi = simRef->phi();
860 GlobalPoint simVtx(simRef->vertex().x(), simRef->vertex().y(), simRef->vertex().z());
861 GlobalVector simMom(simRef->momentum().x(), simRef->momentum().y(), simRef->momentum().z());
862 const double simDxy = -simVtx.
x()*
sin(simPhi)+simVtx.y()*
cos(simPhi);
863 const double simDz = simVtx.z() - (simVtx.x()*simMom.x()+simVtx.y()*simMom.y())*simMom.z()/simMom.perp2();
865 const unsigned int nSimHits = simRef->numberOfHits();
876 vector<pair<RefToBase<Muon>,
double> > MuRefV;
877 if ( simToMuonColl.find(simRef) != simToMuonColl.end() ) {
878 MuRefV = simToMuonColl[simRef];
880 if ( !MuRefV.empty()) {
882 const Muon*
Mu = MuRefV.begin()->first.get();
902 if((*hit)->isValid()) {
903 DetId recoid = (*hit)->geographicalId();
917 if((*hit)->isValid()) {
918 DetId recoid = (*hit)->geographicalId();
T getParameter(std::string const &) const
MEP hNInvalidHitsITHitPattern_
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
edm::EDGetTokenT< TrackingParticleCollection > simToken_
virtual double p() const
magnitude of momentum vector
bool isNonnull() const
Checks for non-null.
MEP hPt_vs_PFMomAssCorrectness
MEP hNTrackerHits_vs_Eta_
virtual float pt() const
transverse momentum
MEP hStaToGlbDiffNMuonHits_
std::vector< TrackingParticle > TrackingParticleCollection
void associateMuons(MuonToSimCollection &recoToSim, SimToMuonCollection &simToReco, const edm::RefToBaseVector< reco::Muon > &, MuonTrackType, const edm::RefVector< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
virtual float phi() const
momentum azimuthal angle
Sin< T >::type sin(const T &t)
virtual TrackRef track() const
reference to a Track
StringCutObjectSelector< reco::Muon > selector_
math::Error< dimension >::type Error
covariance error matrix (3x3)
double pt() const
Transverse momentum. Note this is taken from the first SimTrack only.
MEP hNInvalidHitsGTHitPattern_
MEP hNInvalidHitsOTHitPattern_
edm::EDGetTokenT< reco::VertexCollection > primvertexToken_
MEP hTrkToGlbDiffNTrackerHitsEta_
virtual int countTrackerHits(const reco::Track &track) const
reco::Candidate::LorentzVector pfP4() const
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MEP hTrkToGlbDiffNTrackerHits_
TrackingParticleSelector tpSelector_
SingleObjectSelector< TrackingParticleCollection,::TrackingParticleSelector > TrackingParticleSelector
float charge() const
Gives charge in unit of quark charge (should be 3 time the abaove)
std::map< TrackingParticleRef, std::vector< std::pair< edm::RefToBase< reco::Muon >, double > > > SimToMuonCollection
virtual void analyze(const edm::Event &event, const edm::EventSetup &eventSetup)
const_iterator begin() const
MuonServiceProxy * theMuonService
virtual float eta() const
momentum pseudorapidity
edm::InputTag muAssocLabel_
Cos< T >::type cos(const T &t)
virtual int countMuonHits(const reco::Track &track) const
virtual int charge() const
electric charge
MonitorElement * book1D(Args &&...args)
const MuonAssociatorByHits * assoByHits
std::string outputFileName_
edm::EDGetTokenT< reco::BeamSpot > beamspotToken_
double p() const
Magnitude of momentum vector. Note this is taken from the first SimTrack only.
math::XYZPoint Point
point in the space
double BeamWidthX() const
beam width X
T const * get() const
Returns C++ pointer to the item.
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
MEP hTrkToGlbDiffNTrackerHitsPt_
std::vector< ConstRecHitPointer > ConstRecHitContainer
MuonAssociatorByHits::MuonTrackType trackType_
void fill(const TrackingParticle *simRef, const Muon *muonRef)
virtual void dqmBeginRun(const edm::Run &, const edm::EventSetup &eventSetup)
TrajectoryStateOnSurface TSOS
MEP hNDeltaInvalidHitsHitPattern_
void setCurrentFolder(const std::string &fullpath)
T const * product() const
MonitorElement * book2D(Args &&...args)
MEP hStaToGlbDiffNMuonHitsEta_
double sigmaZ() const
sigma z
T const * product() const
double BeamWidthY() const
beam width Y
double eta() const
Momentum pseudorapidity. Note this is taken from the first SimTrack only.
MEP hStaToGlbDiffNMuonHitsPt_
std::string subsystemname_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
static int position[264][3]
Vector momentum() const
spatial momentum vector
void push_back(const RefToBase< T > &)
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
edm::InputTag beamspotLabel_
Monte Carlo truth information used for tracking validation.
edm::InputTag primvertexLabel_
const Point & position() const
position
const_iterator end() const
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
Detector det() const
get the detector field from this detid
void bookHistos(DQMStore::IBooker &ibooker, const string &dirName, const HistoDimensions &hDim)
std::map< edm::RefToBase< reco::Muon >, std::vector< std::pair< TrackingParticleRef, double > >, RefToBaseSort > MuonToSimCollection
edm::Ref< TrackingParticleCollection > TrackingParticleRef
RecoMuonValidator(const edm::ParameterSet &pset)
double phi() const
Momentum azimuthal angle. Note this is taken from the first SimTrack only.
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.