34 MEP hSimP_,
hSimPt_, hSimEta_, hSimPhi_, hSimDxy_, hSimDz_;
71 MEP hPullPt_, hPullEta_, hPullPhi_,
hPullQPt_, hPullDxy_, hPullDz_;
108 hNSim_ = ibooker.
book1D(
"NSim" ,
"Number of particles per event", hDim.
nTrks, -0.5, hDim.
nTrks+0.5);
109 hNMuon_ = ibooker.
book1D(
"NMuon",
"Number of muons per event" , hDim.
nTrks, -0.5, hDim.
nTrks+0.5);
112 hNTrks_ = ibooker.
book1D(
"NTrks",
"Number of reco tracks per event", hDim.
nTrks, -0.5, hDim.
nTrks+0.5);
114 hNTrksPt_ = ibooker.
book1D(
"NTrksPt",
"Number of reco tracks vs p_{T}", hDim.
nBinPt, hDim.
minPt, hDim.
maxPt);
138 hPFMomAssCorrectness = ibooker.
book1D(
"hPFMomAssCorrectness",
"Corrected momentum assignement PF/RECO",2,0.5,2.5);
139 hPt_vs_PFMomAssCorrectness = ibooker.
book2D(
"hPt_vs_PFMomAssCorrectness",
"Corrected momentum assignement PF/RECO", hDim.
nBinPt, hDim.
minPt, hDim.
maxP, 2, 0.5, 2.5);
146 hErrP_vs_Eta_ = ibooker.
book2D(
"ErrP_vs_Eta",
"#Delta(p)/p vs #eta",
148 hErrPt_vs_Eta_ = ibooker.
book2D(
"ErrPt_vs_Eta",
"#Delta(p_{T})/p_{T} vs #eta",
150 hErrQPt_vs_Eta_ = ibooker.
book2D(
"ErrQPt_vs_Eta",
"#Delta(q/p_{T})/(q/p_{T}) vs #eta",
152 hErrEta_vs_Eta_ = ibooker.
book2D(
"ErrEta_vs_Eta",
"#sigma(#eta) vs #eta",
156 hErrP_vs_P_ = ibooker.
book2D(
"ErrP_vs_P",
"#Delta(p)/p vs p",
158 hErrPt_vs_Pt_ = ibooker.
book2D(
"ErrPt_vs_Pt",
"#Delta(p_{T})/p_{T} vs p_{T}",
160 hErrQPt_vs_Pt_ = ibooker.
book2D(
"ErrQPt_vs_Pt",
"#Delta(q/p_{T})/(q/p_{T}) vs p_{T}",
172 hPullPt_vs_Eta_ = ibooker.
book2D(
"PullPt_vs_Eta",
"Pull(p_{T}) vs #eta",
174 hPullEta_vs_Eta_ = ibooker.
book2D(
"PullEta_vs_Eta",
"Pull(#eta) vs #eta",
176 hPullPhi_vs_Eta_ = ibooker.
book2D(
"PullPhi_vs_Eta",
"Pull(#phi) vs #eta",
180 hPullPt_vs_Pt_ = ibooker.
book2D(
"PullPt_vs_Pt",
"Pull(p_{T}) vs p_{T}",
182 hPullEta_vs_Pt_ = ibooker.
book2D(
"PullEta_vs_Pt",
"Pull(#eta) vs p_{T}",
186 const int nHits = 100;
187 hNHits_ = ibooker.
book1D(
"NHits",
"Number of hits", nHits+1, -0.5, nHits+0.5);
188 hNHits_vs_Pt_ = ibooker.
book2D(
"NHits_vs_Pt",
"Number of hits vs p_{T}",
190 hNHits_vs_Eta_ = ibooker.
book2D(
"NHits_vs_Eta",
"Number of hits vs #eta",
192 hNSimHits_ = ibooker.
book1D(
"NSimHits",
"Number of simHits", nHits+1, -0.5, nHits+0.5);
194 const int nLostHits = 5;
195 hNLostHits_ = ibooker.
book1D(
"NLostHits",
"Number of Lost hits", nLostHits+1, -0.5, nLostHits+0.5);
196 hNLostHits_vs_Pt_ = ibooker.
book2D(
"NLostHits_vs_Pt",
"Number of lost Hits vs p_{T}",
198 hNLostHits_vs_Eta_ = ibooker.
book2D(
"NLostHits_vs_Eta",
"Number of lost Hits vs #eta",
201 const int nTrackerHits = 40;
202 hNTrackerHits_ = ibooker.
book1D(
"NTrackerHits",
"Number of valid tracker hits", nTrackerHits+1, -0.5, nTrackerHits+0.5);
203 hNTrackerHits_vs_Pt_ = ibooker.
book2D(
"NTrackerHits_vs_Pt",
"Number of valid traker hits vs p_{T}",
204 hDim.
nBinPt, hDim.
minPt, hDim.
maxPt, nTrackerHits/4+1, -0.25, nTrackerHits+0.25);
205 hNTrackerHits_vs_Eta_ = ibooker.
book2D(
"NTrackerHits_vs_Eta",
"Number of valid tracker hits vs #eta",
208 const int nMuonHits = 60;
209 hNMuonHits_ = ibooker.
book1D(
"NMuonHits",
"Number of valid muon hits", nMuonHits+1, -0.5, nMuonHits+0.5);
210 hNMuonHits_vs_Pt_ = ibooker.
book2D(
"NMuonHits_vs_Pt",
"Number of valid muon hits vs p_{T}",
212 hNMuonHits_vs_Eta_ = ibooker.
book2D(
"NMuonHits_vs_Eta",
"Number of valid muon hits vs #eta",
215 hNDof_ = ibooker.
book1D(
"NDof",
"Number of DoF", hDim.
nDof+1, -0.5, hDim.
nDof+0.5);
216 hChi2_ = ibooker.
book1D(
"Chi2",
"#Chi^{2}", hDim.
nBinErr, 0, 200);
217 hChi2Norm_ = ibooker.
book1D(
"Chi2Norm",
"Normalized #Chi^{2}", hDim.
nBinErr, 0, 50);
218 hChi2Prob_ = ibooker.
book1D(
"Chi2Prob",
"Prob(#Chi^{2})", hDim.
nBinErr, 0, 1);
220 hNDof_vs_Eta_ = ibooker.
book2D(
"NDof_vs_Eta",
"Number of DoF vs #eta",
222 hChi2_vs_Eta_ = ibooker.
book2D(
"Chi2_vs_Eta",
"#Chi^{2} vs #eta",
224 hChi2Norm_vs_Eta_ = ibooker.
book2D(
"Chi2Norm_vs_Eta",
"Normalized #Chi^{2} vs #eta",
226 hChi2Prob_vs_Eta_ = ibooker.
book2D(
"Chi2Prob_vs_Eta",
"Prob(#Chi^{2}) vs #eta",
229 hNSimToReco_ = ibooker.
book1D(
"NSimToReco",
"Number of associated reco tracks", hDim.
nAssoc+1, -0.5, hDim.
nAssoc+0.5);
230 hNRecoToSim_ = ibooker.
book1D(
"NRecoToSim",
"Number of associated sim TP's", hDim.
nAssoc+1, -0.5, hDim.
nAssoc+0.5);
240 const double simP = simRef->
p();
241 const double simPt = simRef->
pt();
242 const double simEta = doAbsEta_ ? fabs(simRef->
eta()) : simRef->
eta();
243 const double simPhi = simRef->
phi();
244 const double simQ = simRef->
charge();
245 const double simQPt = simQ/simPt;
249 const double simDxy = -simVtx.
x()*
sin(simPhi)+simVtx.y()*
cos(simPhi);
250 const double simDz = simVtx.z() - (simVtx.x()*simMom.x()+simVtx.y()*simMom.y())*simMom.z()/simMom.perp2();
252 const double recoQ = muonRef->
charge();
253 if ( simQ*recoQ < 0 ) {
254 hMisQPt_ ->Fill(simPt );
255 hMisQEta_->Fill(simEta);
258 double recoP, recoPt, recoEta, recoPhi, recoQPt;
261 const double origRecoPt = muonRef->
pt();
264 const double origRecoQPt = recoQ/origRecoPt;
265 recoP = muonRef->
pfP4().P();
266 recoPt = muonRef->
pfP4().Pt();
267 recoEta = muonRef->
pfP4().Eta();
268 recoPhi = muonRef->
pfP4().Phi();
269 recoQPt = recoQ/recoPt;
270 hErrPt_PF_->Fill((recoPt-origRecoPt)/origRecoPt);
271 hErrQPt_PF_->Fill((recoQPt-origRecoQPt)/origRecoQPt);
273 hdPt_vs_Eta_->Fill(recoEta,recoPt-origRecoPt);
274 hdPt_vs_Pt_->Fill(recoPt,recoPt-origRecoPt);
276 int theCorrectPFAss = (fabs(recoPt-simPt) < fabs(origRecoPt - simPt))? 1 : 2;
277 hPFMomAssCorrectness->Fill(theCorrectPFAss);
278 hPt_vs_PFMomAssCorrectness->Fill(simPt,theCorrectPFAss);
282 recoP = muonRef->
p();
283 recoPt = muonRef->
pt();
284 recoEta = muonRef->
eta();
285 recoPhi = muonRef->
phi();
286 recoQPt = recoQ/recoPt;
289 const double errP = (recoP-simP)/simP;
290 const double errPt = (recoPt-simPt)/simPt;
291 const double errEta = (recoEta-simEta)/simEta;
292 const double errPhi = (recoPhi-simPhi)/simPhi;
293 const double errQPt = (recoQPt-simQPt)/simQPt;
300 hErrP_ ->Fill(errP );
301 hErrPt_ ->Fill(errPt );
302 hErrEta_->Fill(errEta);
303 hErrPhi_->Fill(errPhi);
305 if(fabs(simEta) > 0. && fabs(simEta) < 0.8) {
306 hErrPBarrel_->Fill(errP);
307 hErrPtBarrel_->Fill(errPt);
308 }
else if (fabs(simEta) > 0.8 && fabs(simEta) < 1.2) {
309 hErrPOverlap_->Fill(errP);
310 hErrPtOverlap_->Fill(errPt);
311 }
else if (fabs(simEta) > 1.2 ){
312 hErrPEndcap_->Fill(errP);
313 hErrPtEndcap_->Fill(errPt);
316 hErrP_vs_Eta_ ->Fill(simEta, errP );
317 hErrPt_vs_Eta_ ->Fill(simEta, errPt );
318 hErrQPt_vs_Eta_->Fill(simEta, errQPt);
320 hErrP_vs_P_ ->Fill(simP , errP );
321 hErrPt_vs_Pt_ ->Fill(simPt , errPt );
322 hErrQPt_vs_Pt_->Fill(simQPt, errQPt);
324 hErrEta_vs_Eta_->Fill(simEta, errEta);
331 const int nRecoHits = recoRef->numberOfValidHits();
332 const int nLostHits = recoRef->numberOfLostHits();
334 hNHits_->Fill(nRecoHits);
335 hNHits_vs_Pt_ ->Fill(simPt , nRecoHits);
336 hNHits_vs_Eta_->Fill(simEta, nRecoHits);
338 hNLostHits_->Fill(nLostHits);
339 hNLostHits_vs_Pt_ ->Fill(simPt , nLostHits);
340 hNLostHits_vs_Eta_->Fill(simEta, nLostHits);
342 const double recoNDof = recoRef->ndof();
343 const double recoChi2 = recoRef->chi2();
344 const double recoChi2Norm = recoRef->normalizedChi2();
345 const double recoChi2Prob = TMath::Prob(recoRef->chi2(),
static_cast<int>(recoRef->ndof()));
347 hNDof_->Fill(recoNDof);
348 hChi2_->Fill(recoChi2);
349 hChi2Norm_->Fill(recoChi2Norm);
350 hChi2Prob_->Fill(recoChi2Prob);
352 hNDof_vs_Eta_->Fill(simEta, recoNDof);
353 hChi2_vs_Eta_->Fill(simEta, recoChi2);
354 hChi2Norm_vs_Eta_->Fill(simEta, recoChi2Norm);
355 hChi2Prob_vs_Eta_->Fill(simEta, recoChi2Prob);
357 const double recoDxy = recoRef->dxy();
358 const double recoDz = recoRef->dz();
360 const double errDxy = (recoDxy-simDxy)/simDxy;
361 const double errDz = (recoDz-simDz)/simDz;
362 hErrDxy_->Fill(errDxy);
363 hErrDz_ ->Fill(errDz );
365 const double pullPt = (recoPt-simPt)/recoRef->ptError();
366 const double pullQPt = (recoQPt-simQPt)/recoRef->qoverpError();
367 const double pullEta = (recoEta-simEta)/recoRef->etaError();
368 const double pullPhi = (recoPhi-simPhi)/recoRef->phiError();
369 const double pullDxy = (recoDxy-simDxy)/recoRef->dxyError();
370 const double pullDz = (recoDz-simDz)/recoRef->dzError();
372 hPullPt_ ->Fill(pullPt );
373 hPullEta_->Fill(pullEta);
374 hPullPhi_->Fill(pullPhi);
375 hPullQPt_->Fill(pullQPt);
376 hPullDxy_->Fill(pullDxy);
377 hPullDz_ ->Fill(pullDz );
379 hPullPt_vs_Eta_->Fill(simEta, pullPt);
380 hPullPt_vs_Pt_ ->Fill(simPt, pullPt);
382 hPullEta_vs_Eta_->Fill(simEta, pullEta);
383 hPullPhi_vs_Eta_->Fill(simEta, pullPhi);
385 hPullEta_vs_Pt_->Fill(simPt, pullEta);
408 MEP hMuonTrackP_,
hMuonTrackPt_, hMuonTrackEta_, hMuonTrackPhi_, hMuonTrackDxy_, hMuonTrackDz_;
417 selector_(pset.getParameter<std::
string>(
"selection"))
515 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);
638 unsigned int theIndexOfThePrimaryVertex = 999.;
639 for (
unsigned int ind=0; ind<recVtxs->size(); ++ind) {
640 if ( (*recVtxs)[ind].isValid() && !((*recVtxs)[ind].isFake()) ) {
641 theIndexOfThePrimaryVertex = ind;
645 if (theIndexOfThePrimaryVertex<100) {
646 posVtx = ((*recVtxs)[theIndexOfThePrimaryVertex]).
position();
647 errVtx = ((*recVtxs)[theIndexOfThePrimaryVertex]).
error();
650 LogInfo(
"RecoMuonValidator") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
657 errVtx(2,2) = bs.
sigmaZ();
676 assoByHits = associatorBase.
product();
682 for (
size_t i = 0;
i < muonHandle->size(); ++
i) {
687 for (
size_t i = 0;
i < nSim; ++
i) {
734 int glbNTrackerHits = 0;
int trkNTrackerHits = 0;
735 int glbNMuonHits = 0;
int staNMuonHits = 0;
736 int NTrackerHits = 0;
int NMuonHits = 0;
741 iMuon != muonColl.
end(); ++iMuon) {
745 muonP = iMuon->pfP4().P();
746 muonPt = iMuon->pfP4().Pt();
747 muonEta = iMuon->pfP4().Eta();
748 muonPhi = iMuon->pfP4().Phi();
752 muonPt = iMuon->pt();
753 muonEta = iMuon->eta();
754 muonPhi = iMuon->phi();
782 if (iMuon->isGlobalMuon()) {
783 Track = iMuon->combinedMuon();
786 }
else if (iMuon->isTrackerMuon()) {
787 Track = iMuon->track();
790 Track = iMuon->standAloneMuon();
814 if (iMuon->isGlobalMuon()) {
815 double gtHitPat = iMuon->globalTrack()->hitPattern().numberOfHits(HitPattern::TRACK_HITS)
816 - iMuon->globalTrack()->hitPattern().numberOfValidHits();
818 double itHitPat = iMuon->innerTrack()->hitPattern().numberOfHits(HitPattern::TRACK_HITS)
819 - iMuon->innerTrack()->hitPattern().numberOfValidHits();
821 double otHitPat = iMuon->outerTrack()->hitPattern().numberOfHits(HitPattern::TRACK_HITS)
822 - iMuon->outerTrack()->hitPattern().numberOfValidHits();
830 if (iMuon->isStandAloneMuon()) {
837 if (iMuon->isTrackerMuon()) {
854 const double simP = simRef->p();
855 const double simPt = simRef->pt();
856 const double simEta =
doAbsEta_ ? fabs(simRef->eta()) : simRef->eta();
857 const double simPhi = simRef->phi();
859 GlobalPoint simVtx(simRef->vertex().x(), simRef->vertex().y(), simRef->vertex().z());
860 GlobalVector simMom(simRef->momentum().x(), simRef->momentum().y(), simRef->momentum().z());
861 const double simDxy = -simVtx.
x()*
sin(simPhi)+simVtx.y()*
cos(simPhi);
862 const double simDz = simVtx.z() - (simVtx.x()*simMom.x()+simVtx.y()*simMom.y())*simMom.z()/simMom.perp2();
864 const unsigned int nSimHits = simRef->numberOfHits();
875 vector<pair<RefToBase<Muon>,
double> > MuRefV;
876 if ( simToMuonColl.find(simRef) != simToMuonColl.end() ) {
877 MuRefV = simToMuonColl[simRef];
879 if ( !MuRefV.empty()) {
881 const Muon*
Mu = MuRefV.begin()->first.get();
901 if((*hit)->isValid()) {
902 DetId recoid = (*hit)->geographicalId();
916 if((*hit)->isValid()) {
917 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_
std::map< edm::RefToBase< reco::Muon >, std::vector< std::pair< TrackingParticleRef, double > >, RefToBaseSort > MuonToSimCollection
bool isNonnull() const
Checks for non-null.
MEP hPt_vs_PFMomAssCorrectness
MEP hNTrackerHits_vs_Eta_
virtual void endRun(edm::Run const &, edm::EventSetup const &) override
MEP hStaToGlbDiffNMuonHits_
std::vector< TrackingParticle > TrackingParticleCollection
Vector momentum() const
spatial momentum vector
Sin< T >::type sin(const T &t)
virtual TrackRef track() const
reference to a Track
StringCutObjectSelector< reco::Muon > selector_
virtual double phi() const final
momentum azimuthal angle
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_
reco::MuonTrackType trackType_
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
std::map< TrackingParticleRef, std::vector< std::pair< edm::RefToBase< reco::Muon >, double > > > SimToMuonCollection
MEP hTrkToGlbDiffNTrackerHits_
TrackingParticleSelector tpSelector_
SingleObjectSelector< TrackingParticleCollection,::TrackingParticleSelector > TrackingParticleSelector
float charge() const
Electric charge. Note this is taken from the first SimTrack only.
const_iterator begin() const
MuonServiceProxy * theMuonService
edm::InputTag muAssocLabel_
Cos< T >::type cos(const T &t)
virtual int charge() const final
electric charge
void associateMuons(MuonToSimCollection &recoToSim, SimToMuonCollection &simToReco, const edm::RefToBaseVector< reco::Muon > &muons, MuonTrackType type, const edm::RefVector< TrackingParticleCollection > &tpColl) const
virtual int countMuonHits(const reco::Track &track) const
MonitorElement * book1D(Args &&...args)
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_
virtual void dqmBeginRun(const edm::Run &, const edm::EventSetup &eventSetup) override
std::vector< ConstRecHitPointer > ConstRecHitContainer
void fill(const TrackingParticle *simRef, const Muon *muonRef)
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
double BeamWidthY() const
beam width Y
double eta() const
Momentum pseudorapidity. Note this is taken from the first SimTrack only.
MEP hStaToGlbDiffNMuonHitsPt_
virtual double p() const final
magnitude of momentum vector
std::string subsystemname_
Point vertex() const
Parent vertex position.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
static int position[264][3]
void push_back(const RefToBase< T > &)
edm::EDGetTokenT< reco::MuonToTrackingParticleAssociator > muAssocToken_
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
virtual double eta() const final
momentum pseudorapidity
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
Detector det() const
get the detector field from this detid
virtual void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override
void bookHistos(DQMStore::IBooker &ibooker, const string &dirName, const HistoDimensions &hDim)
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
virtual double pt() const final
transverse momentum
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.