34 MEP hSimP_,
hSimPt_, hSimEta_, hSimPhi_, hSimDxy_, hSimDz_;
36 MEP hP_,
hPt_, hEta_, hPhi_;
71 MEP hPullPt_, hPullEta_, hPullPhi_,
hPullQPt_, hPullDxy_, hPullDz_;
72 MEP hPullPt_vs_Eta_,
hPullPt_vs_Pt_, hPullEta_vs_Eta_, hPullPhi_vs_Eta_, hPullEta_vs_Pt_;
75 MEP
hNDof_, hChi2_, hChi2Norm_, hChi2Prob_;
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";
544 if ( subDir_.empty() ) subDir_ =
"RecoMuonV";
545 if ( subDir_[subDir_.size()-1] ==
'/' ) subDir_.erase(subDir_.size()-1);
564 const int nHits = 100;
580 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);
639 unsigned int theIndexOfThePrimaryVertex = 999.;
640 for (
unsigned int ind=0; ind<recVtxs->size(); ++ind) {
641 if ( (*recVtxs)[ind].isValid() && !((*recVtxs)[ind].isFake()) ) {
642 theIndexOfThePrimaryVertex = ind;
646 if (theIndexOfThePrimaryVertex<100) {
647 posVtx = ((*recVtxs)[theIndexOfThePrimaryVertex]).
position();
648 errVtx = ((*recVtxs)[theIndexOfThePrimaryVertex]).
error();
651 LogInfo(
"RecoMuonValidator") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
658 errVtx(2,2) = bs.
sigmaZ();
677 assoByHits = associatorBase.
product();
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
virtual double pt() const final
transverse momentum
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
TrajectoryStateOnSurface TSOS
Vector momentum() const
spatial momentum vector
virtual double eta() const final
momentum pseudorapidity
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_
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_
virtual double phi() const final
momentum azimuthal angle
virtual int charge() const final
electric charge
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)
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_
virtual double p() const final
magnitude of momentum vector
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.
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)
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_
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
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
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.