88 MEP hSimP_,
hSimPt_, hSimEta_, hSimPhi_, hSimDxy_, hSimDz_;
161 hNSim_ = dqm->
book1D(
"NSim" ,
"Number of particles per event", hDim.
nTrks, -0.5, hDim.
nTrks+0.5);
162 hNMuon_ = dqm->
book1D(
"NMuon",
"Number of muons per event" , hDim.
nTrks, -0.5, hDim.
nTrks+0.5);
165 hNTrks_ = dqm->
book1D(
"NTrks",
"Number of reco tracks per event", hDim.
nTrks, -0.5, hDim.
nTrks+0.5);
167 hNTrksPt_ = dqm->
book1D(
"NTrksPt",
"Number of reco tracks vs p_{T}", hDim.
nBinPt, hDim.
minPt, hDim.
maxPt);
191 hPFMomAssCorrectness = dqm->
book1D(
"hPFMomAssCorrectness",
"Corrected momentum assignement PF/RECO",2,0.5,2.5);
192 hPt_vs_PFMomAssCorrectness = dqm->
book2D(
"hPt_vs_PFMomAssCorrectness",
"Corrected momentum assignement PF/RECO", hDim.
nBinPt, hDim.
minPt, hDim.
maxP, 2, 0.5, 2.5);
199 hErrP_vs_Eta_ = dqm->
book2D(
"ErrP_vs_Eta",
"#Delta(p)/p vs #eta",
201 hErrPt_vs_Eta_ = dqm->
book2D(
"ErrPt_vs_Eta",
"#Delta(p_{T})/p_{T} vs #eta",
203 hErrQPt_vs_Eta_ = dqm->
book2D(
"ErrQPt_vs_Eta",
"#Delta(q/p_{T})/(q/p_{T}) vs #eta",
205 hErrEta_vs_Eta_ = dqm->
book2D(
"ErrEta_vs_Eta",
"#sigma(#eta) vs #eta",
209 hErrP_vs_P_ = dqm->
book2D(
"ErrP_vs_P",
"#Delta(p)/p vs p",
211 hErrPt_vs_Pt_ = dqm->
book2D(
"ErrPt_vs_Pt",
"#Delta(p_{T})/p_{T} vs p_{T}",
213 hErrQPt_vs_Pt_ = dqm->
book2D(
"ErrQPt_vs_Pt",
"#Delta(q/p_{T})/(q/p_{T}) vs p_{T}",
225 hPullPt_vs_Eta_ = dqm->
book2D(
"PullPt_vs_Eta",
"Pull(p_{T}) vs #eta",
227 hPullEta_vs_Eta_ = dqm->
book2D(
"PullEta_vs_Eta",
"Pull(#eta) vs #eta",
229 hPullPhi_vs_Eta_ = dqm->
book2D(
"PullPhi_vs_Eta",
"Pull(#phi) vs #eta",
233 hPullPt_vs_Pt_ = dqm->
book2D(
"PullPt_vs_Pt",
"Pull(p_{T}) vs p_{T}",
235 hPullEta_vs_Pt_ = dqm->
book2D(
"PullEta_vs_Pt",
"Pull(#eta) vs p_{T}",
239 const int nHits = 100;
240 hNHits_ = dqm->
book1D(
"NHits",
"Number of hits", nHits+1, -0.5, nHits+0.5);
241 hNHits_vs_Pt_ = dqm->
book2D(
"NHits_vs_Pt",
"Number of hits vs p_{T}",
243 hNHits_vs_Eta_ = dqm->
book2D(
"NHits_vs_Eta",
"Number of hits vs #eta",
245 hNSimHits_ = dqm->
book1D(
"NSimHits",
"Number of simHits", nHits+1, -0.5, nHits+0.5);
247 const int nLostHits = 5;
248 hNLostHits_ = dqm->
book1D(
"NLostHits",
"Number of Lost hits", nLostHits+1, -0.5, nLostHits+0.5);
249 hNLostHits_vs_Pt_ = dqm->
book2D(
"NLostHits_vs_Pt",
"Number of lost Hits vs p_{T}",
251 hNLostHits_vs_Eta_ = dqm->
book2D(
"NLostHits_vs_Eta",
"Number of lost Hits vs #eta",
254 const int nTrackerHits = 40;
255 hNTrackerHits_ = dqm->
book1D(
"NTrackerHits",
"Number of valid tracker hits", nTrackerHits+1, -0.5, nTrackerHits+0.5);
256 hNTrackerHits_vs_Pt_ = dqm->
book2D(
"NTrackerHits_vs_Pt",
"Number of valid traker hits vs p_{T}",
257 hDim.
nBinPt, hDim.
minPt, hDim.
maxPt, nTrackerHits/4+1, -0.25, nTrackerHits+0.25);
258 hNTrackerHits_vs_Eta_ = dqm->
book2D(
"NTrackerHits_vs_Eta",
"Number of valid tracker hits vs #eta",
261 const int nMuonHits = 60;
262 hNMuonHits_ = dqm->
book1D(
"NMuonHits",
"Number of valid muon hits", nMuonHits+1, -0.5, nMuonHits+0.5);
263 hNMuonHits_vs_Pt_ = dqm->
book2D(
"NMuonHits_vs_Pt",
"Number of valid muon hits vs p_{T}",
265 hNMuonHits_vs_Eta_ = dqm->
book2D(
"NMuonHits_vs_Eta",
"Number of valid muon hits vs #eta",
268 hNDof_ = dqm->
book1D(
"NDof",
"Number of DoF", hDim.
nDof+1, -0.5, hDim.
nDof+0.5);
269 hChi2_ = dqm->
book1D(
"Chi2",
"#Chi^{2}", hDim.
nBinErr, 0, 200);
270 hChi2Norm_ = dqm->
book1D(
"Chi2Norm",
"Normalized #Chi^{2}", hDim.
nBinErr, 0, 50);
271 hChi2Prob_ = dqm->
book1D(
"Chi2Prob",
"Prob(#Chi^{2})", hDim.
nBinErr, 0, 1);
273 hNDof_vs_Eta_ = dqm->
book2D(
"NDof_vs_Eta",
"Number of DoF vs #eta",
275 hChi2_vs_Eta_ = dqm->
book2D(
"Chi2_vs_Eta",
"#Chi^{2} vs #eta",
277 hChi2Norm_vs_Eta_ = dqm->
book2D(
"Chi2Norm_vs_Eta",
"Normalized #Chi^{2} vs #eta",
279 hChi2Prob_vs_Eta_ = dqm->
book2D(
"Chi2Prob_vs_Eta",
"Prob(#Chi^{2}) vs #eta",
282 hNSimToReco_ = dqm->
book1D(
"NSimToReco",
"Number of associated reco tracks", hDim.
nAssoc+1, -0.5, hDim.
nAssoc+0.5);
283 hNRecoToSim_ = dqm->
book1D(
"NRecoToSim",
"Number of associated sim TP's", hDim.
nAssoc+1, -0.5, hDim.
nAssoc+0.5);
293 const double simP = simRef->
p();
294 const double simPt = simRef->
pt();
295 const double simEta = doAbsEta_ ? fabs(simRef->
eta()) : simRef->
eta();
296 const double simPhi = simRef->
phi();
297 const double simQ = simRef->
charge();
298 const double simQPt = simQ/simPt;
302 const double simDxy = -simVtx.
x()*
sin(simPhi)+simVtx.y()*
cos(simPhi);
303 const double simDz = simVtx.z() - (simVtx.x()*simMom.x()+simVtx.y()*simMom.y())*simMom.z()/simMom.perp2();
305 const double recoQ = muonRef->
charge();
306 if ( simQ*recoQ < 0 ) {
307 hMisQPt_ ->Fill(simPt );
308 hMisQEta_->Fill(simEta);
311 double recoP, recoPt, recoEta, recoPhi, recoQPt;
314 const double origRecoPt = muonRef->
pt();
317 const double origRecoQPt = recoQ/origRecoPt;
318 recoP = muonRef->
pfP4().P();
319 recoPt = muonRef->
pfP4().Pt();
320 recoEta = muonRef->
pfP4().Eta();
321 recoPhi = muonRef->
pfP4().Phi();
322 recoQPt = recoQ/recoPt;
323 hErrPt_PF_->Fill((recoPt-origRecoPt)/origRecoPt);
324 hErrQPt_PF_->Fill((recoQPt-origRecoQPt)/origRecoQPt);
326 hdPt_vs_Eta_->Fill(recoEta,recoPt-origRecoPt);
327 hdPt_vs_Pt_->Fill(recoPt,recoPt-origRecoPt);
329 int theCorrectPFAss = (fabs(recoPt-simPt) < fabs(origRecoPt - simPt))? 1 : 2;
330 hPFMomAssCorrectness->Fill(theCorrectPFAss);
331 hPt_vs_PFMomAssCorrectness->Fill(simPt,theCorrectPFAss);
335 recoP = muonRef->
p();
336 recoPt = muonRef->
pt();
337 recoEta = muonRef->
eta();
338 recoPhi = muonRef->
phi();
339 recoQPt = recoQ/recoPt;
342 const double errP = (recoP-simP)/simP;
343 const double errPt = (recoPt-simPt)/simPt;
344 const double errEta = (recoEta-simEta)/simEta;
345 const double errPhi = (recoPhi-simPhi)/simPhi;
346 const double errQPt = (recoQPt-simQPt)/simQPt;
353 hErrP_ ->Fill(errP );
354 hErrPt_ ->Fill(errPt );
355 hErrEta_->Fill(errEta);
356 hErrPhi_->Fill(errPhi);
358 if(fabs(simEta) > 0. && fabs(simEta) < 0.8) {
359 hErrPBarrel_->Fill(errP);
360 hErrPtBarrel_->Fill(errPt);
361 }
else if (fabs(simEta) > 0.8 && fabs(simEta) < 1.2) {
362 hErrPOverlap_->Fill(errP);
363 hErrPtOverlap_->Fill(errPt);
364 }
else if (fabs(simEta) > 1.2 ){
365 hErrPEndcap_->Fill(errP);
366 hErrPtEndcap_->Fill(errPt);
369 hErrP_vs_Eta_ ->Fill(simEta, errP );
370 hErrPt_vs_Eta_ ->Fill(simEta, errPt );
371 hErrQPt_vs_Eta_->Fill(simEta, errQPt);
373 hErrP_vs_P_ ->Fill(simP , errP );
374 hErrPt_vs_Pt_ ->Fill(simPt , errPt );
375 hErrQPt_vs_Pt_->Fill(simQPt, errQPt);
377 hErrEta_vs_Eta_->Fill(simEta, errEta);
384 const int nRecoHits = recoRef->numberOfValidHits();
385 const int nLostHits = recoRef->numberOfLostHits();
387 hNHits_->Fill(nRecoHits);
388 hNHits_vs_Pt_ ->Fill(simPt , nRecoHits);
389 hNHits_vs_Eta_->Fill(simEta, nRecoHits);
391 hNLostHits_->Fill(nLostHits);
392 hNLostHits_vs_Pt_ ->Fill(simPt , nLostHits);
393 hNLostHits_vs_Eta_->Fill(simEta, nLostHits);
395 const double recoNDof = recoRef->ndof();
396 const double recoChi2 = recoRef->chi2();
397 const double recoChi2Norm = recoRef->normalizedChi2();
398 const double recoChi2Prob = TMath::Prob(recoRef->chi2(),
static_cast<int>(recoRef->ndof()));
400 hNDof_->Fill(recoNDof);
401 hChi2_->Fill(recoChi2);
402 hChi2Norm_->Fill(recoChi2Norm);
403 hChi2Prob_->Fill(recoChi2Prob);
405 hNDof_vs_Eta_->Fill(simEta, recoNDof);
406 hChi2_vs_Eta_->Fill(simEta, recoChi2);
407 hChi2Norm_vs_Eta_->Fill(simEta, recoChi2Norm);
408 hChi2Prob_vs_Eta_->Fill(simEta, recoChi2Prob);
410 const double recoDxy = recoRef->dxy();
411 const double recoDz = recoRef->dz();
413 const double errDxy = (recoDxy-simDxy)/simDxy;
414 const double errDz = (recoDz-simDz)/simDz;
415 hErrDxy_->Fill(errDxy);
416 hErrDz_ ->Fill(errDz );
418 const double pullPt = (recoPt-simPt)/recoRef->ptError();
419 const double pullQPt = (recoQPt-simQPt)/recoRef->qoverpError();
420 const double pullEta = (recoEta-simEta)/recoRef->etaError();
421 const double pullPhi = (recoPhi-simPhi)/recoRef->phiError();
422 const double pullDxy = (recoDxy-simDxy)/recoRef->dxyError();
423 const double pullDz = (recoDz-simDz)/recoRef->dzError();
425 hPullPt_ ->Fill(pullPt );
426 hPullEta_->Fill(pullEta);
427 hPullPhi_->Fill(pullPhi);
428 hPullQPt_->Fill(pullQPt);
429 hPullDxy_->Fill(pullDxy);
430 hPullDz_ ->Fill(pullDz );
432 hPullPt_vs_Eta_->Fill(simEta, pullPt);
433 hPullPt_vs_Pt_ ->Fill(simPt, pullPt);
435 hPullEta_vs_Eta_->Fill(simEta, pullEta);
436 hPullPhi_vs_Eta_->Fill(simEta, pullPhi);
438 hPullEta_vs_Pt_->Fill(simPt, pullEta);
461 MEP hMuonTrackP_,
hMuonTrackPt_, hMuonTrackEta_, hMuonTrackPhi_, hMuonTrackDxy_, hMuonTrackDz_;
470 selector_(pset.getParameter<std::
string>(
"selection"))
558 else throw cms::Exception(
"Configuration") <<
"Track type '" << trackType <<
"' not supported.\n";
584 LogError(
"RecoMuonValidator") <<
"DQMService not initialized\n";
601 const int nHits = 100;
662 if (assoByHits == 0)
throw cms::Exception(
"Configuration") <<
"The Track Associator with label '" <<
muAssocLabel_.
label() <<
"' is not a MuonAssociatorByHits.\n";
681 LogError(
"RecoMuonValidator") <<
"DQMService not initialized\n";
690 unsigned int theIndexOfThePrimaryVertex = 999.;
691 for (
unsigned int ind=0; ind<recVtxs->size(); ++ind) {
692 if ( (*recVtxs)[ind].isValid() && !((*recVtxs)[ind].isFake()) ) {
693 theIndexOfThePrimaryVertex = ind;
697 if (theIndexOfThePrimaryVertex<100) {
698 posVtx = ((*recVtxs)[theIndexOfThePrimaryVertex]).
position();
699 errVtx = ((*recVtxs)[theIndexOfThePrimaryVertex]).
error();
702 LogInfo(
"RecoMuonValidator") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
709 errVtx(2,2) = bs.
sigmaZ();
727 Muons = muonHandle->refVector();
730 for (
size_t i = 0;
i < nSim; ++
i) {
772 int glbNTrackerHits = 0;
int trkNTrackerHits = 0;
773 int glbNMuonHits = 0;
int staNMuonHits = 0;
774 int NTrackerHits = 0;
int NMuonHits = 0;
778 iMuon != muonColl.
end(); ++iMuon) {
780 double muonP, muonPt, muonEta, muonPhi;
782 muonP = iMuon->pfP4().P();
783 muonPt = iMuon->pfP4().Pt();
784 muonEta = iMuon->pfP4().Eta();
785 muonPhi = iMuon->pfP4().Phi();
789 muonPt = iMuon->pt();
790 muonEta = iMuon->eta();
791 muonPhi = iMuon->phi();
819 if (iMuon->isGlobalMuon()) {
820 Track = iMuon->combinedMuon();
823 }
else if (iMuon->isTrackerMuon()) {
824 Track = iMuon->track();
827 Track = iMuon->standAloneMuon();
851 if (iMuon->isGlobalMuon()) {
852 double gtHitPat = iMuon->globalTrack()->hitPattern().numberOfHits() - iMuon->globalTrack()->hitPattern().numberOfValidHits();
853 double itHitPat = iMuon->innerTrack()->hitPattern().numberOfHits() - iMuon->innerTrack()->hitPattern().numberOfValidHits();
854 double otHitPat = iMuon->outerTrack()->hitPattern().numberOfHits() - iMuon->outerTrack()->hitPattern().numberOfValidHits();
862 if (iMuon->isStandAloneMuon()) {
869 if (iMuon->isTrackerMuon()) {
885 const double simP = simRef->p();
886 const double simPt = simRef->pt();
887 const double simEta =
doAbsEta_ ? fabs(simRef->eta()) : simRef->eta();
888 const double simPhi = simRef->phi();
890 GlobalPoint simVtx(simRef->vertex().x(), simRef->vertex().y(), simRef->vertex().z());
891 GlobalVector simMom(simRef->momentum().x(), simRef->momentum().y(), simRef->momentum().z());
892 const double simDxy = -simVtx.
x()*
sin(simPhi)+simVtx.y()*
cos(simPhi);
893 const double simDz = simVtx.z() - (simVtx.x()*simMom.x()+simVtx.y()*simMom.y())*simMom.z()/simMom.perp2();
895 const unsigned int nSimHits = simRef->numberOfHits();
906 vector<pair<RefToBase<Muon>,
double> > MuRefV;
907 if ( simToMuonColl.find(simRef) != simToMuonColl.end() ) {
908 MuRefV = simToMuonColl[simRef];
910 if ( !MuRefV.empty()) {
912 const Muon*
Mu = MuRefV.begin()->first.get();
932 if((*hit)->isValid()) {
933 DetId recoid = (*hit)->geographicalId();
947 if((*hit)->isValid()) {
948 DetId recoid = (*hit)->geographicalId();
T getParameter(std::string const &) const
MEP hNInvalidHitsITHitPattern_
T getUntrackedParameter(std::string const &, T const &) const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
MEP hPt_vs_PFMomAssCorrectness
MEP hNTrackerHits_vs_Eta_
MEP hStaToGlbDiffNMuonHits_
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
std::vector< TrackingParticle > TrackingParticleCollection
virtual double p() const GCC11_FINAL
magnitude of momentum vector
void cd(void)
go to top directory (ie. root)
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
Point vertex() const
Parent vertex position.
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
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_
MEP hTrkToGlbDiffNTrackerHitsEta_
virtual int countTrackerHits(const reco::Track &track) const
reco::Candidate::LorentzVector pfP4() const
static int position[TOTALCHAMBERS][3]
MEP hTrkToGlbDiffNTrackerHits_
TrackingParticleSelector tpSelector_
bool isNonnull() const
Checks for non-null.
SingleObjectSelector< TrackingParticleCollection,::TrackingParticleSelector > TrackingParticleSelector
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
std::map< TrackingParticleRef, std::vector< std::pair< edm::RefToBase< reco::Muon >, double > > > SimToMuonCollection
virtual void analyze(const edm::Event &event, const edm::EventSetup &eventSetup)
MuonServiceProxy * theMuonService
edm::InputTag muAssocLabel_
Cos< T >::type cos(const T &t)
virtual int countMuonHits(const reco::Track &track) const
const MuonAssociatorByHits * assoByHits
std::string outputFileName_
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
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 beginRun(const edm::Run &, const edm::EventSetup &eventSetup)
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
MuonAssociatorByHits::MuonTrackType trackType_
std::vector< ConstRecHitPointer > ConstRecHitContainer
void fill(const TrackingParticle *simRef, const Muon *muonRef)
TrajectoryStateOnSurface TSOS
MEP hNDeltaInvalidHitsHitPattern_
virtual int charge() const GCC11_FINAL
electric charge
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_
T const * product() const
Vector momentum() const
spatial momentum vector
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.
const_iterator begin() const
int charge() const
Electric charge. Note this is taken from the first SimTrack only.
edm::InputTag primvertexLabel_
const Point & position() const
position
const_iterator end() const
void showDirStructure(void) const
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
T const * get() const
Returns C++ pointer to the item.
Detector det() const
get the detector field from this detid
virtual float pt() const GCC11_FINAL
transverse momentum
std::map< edm::RefToBase< reco::Muon >, std::vector< std::pair< TrackingParticleRef, double > >, RefToBaseSort > MuonToSimCollection
edm::Ref< TrackingParticleCollection > TrackingParticleRef
RecoMuonValidator(const edm::ParameterSet &pset)
void setCurrentFolder(const std::string &fullpath)
double phi() const
Momentum azimuthal angle. Note this is taken from the first SimTrack only.
void bookHistograms(DQMStore *dqm, const string &dirName, const HistoDimensions &hDim)
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.