81 MEP hSimP_,
hSimPt_, hSimEta_, hSimPhi_, hSimDxy_, hSimDz_;
154 hNSim_ = dqm->
book1D(
"NSim" ,
"Number of particles per event", hDim.
nTrks, -0.5, hDim.
nTrks+0.5);
155 hNMuon_ = dqm->
book1D(
"NMuon",
"Number of muons per event" , hDim.
nTrks, -0.5, hDim.
nTrks+0.5);
158 hNTrks_ = dqm->
book1D(
"NTrks",
"Number of reco tracks per event", hDim.
nTrks, -0.5, hDim.
nTrks+0.5);
160 hNTrksPt_ = dqm->
book1D(
"NTrksPt",
"Number of reco tracks vs p_{T}", hDim.
nBinPt, hDim.
minPt, hDim.
maxPt);
184 hPFMomAssCorrectness = dqm->
book1D(
"hPFMomAssCorrectness",
"Corrected momentum assignement PF/RECO",2,0.5,2.5);
185 hPt_vs_PFMomAssCorrectness = dqm->
book2D(
"hPt_vs_PFMomAssCorrectness",
"Corrected momentum assignement PF/RECO", hDim.
nBinPt, hDim.
minPt, hDim.
maxP, 2, 0.5, 2.5);
192 hErrP_vs_Eta_ = dqm->
book2D(
"ErrP_vs_Eta",
"#Delta(p)/p vs #eta",
194 hErrPt_vs_Eta_ = dqm->
book2D(
"ErrPt_vs_Eta",
"#Delta(p_{T})/p_{T} vs #eta",
196 hErrQPt_vs_Eta_ = dqm->
book2D(
"ErrQPt_vs_Eta",
"#Delta(q/p_{T})/(q/p_{T}) vs #eta",
198 hErrEta_vs_Eta_ = dqm->
book2D(
"ErrEta_vs_Eta",
"#sigma(#eta) vs #eta",
202 hErrP_vs_P_ = dqm->
book2D(
"ErrP_vs_P",
"#Delta(p)/p vs p",
204 hErrPt_vs_Pt_ = dqm->
book2D(
"ErrPt_vs_Pt",
"#Delta(p_{T})/p_{T} vs p_{T}",
206 hErrQPt_vs_Pt_ = dqm->
book2D(
"ErrQPt_vs_Pt",
"#Delta(q/p_{T})/(q/p_{T}) vs p_{T}",
218 hPullPt_vs_Eta_ = dqm->
book2D(
"PullPt_vs_Eta",
"Pull(p_{T}) vs #eta",
220 hPullEta_vs_Eta_ = dqm->
book2D(
"PullEta_vs_Eta",
"Pull(#eta) vs #eta",
222 hPullPhi_vs_Eta_ = dqm->
book2D(
"PullPhi_vs_Eta",
"Pull(#phi) vs #eta",
226 hPullPt_vs_Pt_ = dqm->
book2D(
"PullPt_vs_Pt",
"Pull(p_{T}) vs p_{T}",
228 hPullEta_vs_Pt_ = dqm->
book2D(
"PullEta_vs_Pt",
"Pull(#eta) vs p_{T}",
232 const int nHits = 100;
233 hNHits_ = dqm->
book1D(
"NHits",
"Number of hits", nHits+1, -0.5, nHits+0.5);
234 hNHits_vs_Pt_ = dqm->
book2D(
"NHits_vs_Pt",
"Number of hits vs p_{T}",
236 hNHits_vs_Eta_ = dqm->
book2D(
"NHits_vs_Eta",
"Number of hits vs #eta",
238 hNSimHits_ = dqm->
book1D(
"NSimHits",
"Number of simHits", nHits+1, -0.5, nHits+0.5);
240 const int nLostHits = 5;
241 hNLostHits_ = dqm->
book1D(
"NLostHits",
"Number of Lost hits", nLostHits+1, -0.5, nLostHits+0.5);
242 hNLostHits_vs_Pt_ = dqm->
book2D(
"NLostHits_vs_Pt",
"Number of lost Hits vs p_{T}",
244 hNLostHits_vs_Eta_ = dqm->
book2D(
"NLostHits_vs_Eta",
"Number of lost Hits vs #eta",
247 const int nTrackerHits = 40;
248 hNTrackerHits_ = dqm->
book1D(
"NTrackerHits",
"Number of valid tracker hits", nTrackerHits+1, -0.5, nTrackerHits+0.5);
249 hNTrackerHits_vs_Pt_ = dqm->
book2D(
"NTrackerHits_vs_Pt",
"Number of valid traker hits vs p_{T}",
250 hDim.
nBinPt, hDim.
minPt, hDim.
maxPt, nTrackerHits/4+1, -0.25, nTrackerHits+0.25);
251 hNTrackerHits_vs_Eta_ = dqm->
book2D(
"NTrackerHits_vs_Eta",
"Number of valid tracker hits vs #eta",
254 const int nMuonHits = 60;
255 hNMuonHits_ = dqm->
book1D(
"NMuonHits",
"Number of valid muon hits", nMuonHits+1, -0.5, nMuonHits+0.5);
256 hNMuonHits_vs_Pt_ = dqm->
book2D(
"NMuonHits_vs_Pt",
"Number of valid muon hits vs p_{T}",
258 hNMuonHits_vs_Eta_ = dqm->
book2D(
"NMuonHits_vs_Eta",
"Number of valid muon hits vs #eta",
261 hNDof_ = dqm->
book1D(
"NDof",
"Number of DoF", hDim.
nDof+1, -0.5, hDim.
nDof+0.5);
262 hChi2_ = dqm->
book1D(
"Chi2",
"#Chi^{2}", hDim.
nBinErr, 0, 200);
263 hChi2Norm_ = dqm->
book1D(
"Chi2Norm",
"Normalized #Chi^{2}", hDim.
nBinErr, 0, 50);
264 hChi2Prob_ = dqm->
book1D(
"Chi2Prob",
"Prob(#Chi^{2})", hDim.
nBinErr, 0, 1);
266 hNDof_vs_Eta_ = dqm->
book2D(
"NDof_vs_Eta",
"Number of DoF vs #eta",
268 hChi2_vs_Eta_ = dqm->
book2D(
"Chi2_vs_Eta",
"#Chi^{2} vs #eta",
270 hChi2Norm_vs_Eta_ = dqm->
book2D(
"Chi2Norm_vs_Eta",
"Normalized #Chi^{2} vs #eta",
272 hChi2Prob_vs_Eta_ = dqm->
book2D(
"Chi2Prob_vs_Eta",
"Prob(#Chi^{2}) vs #eta",
275 hNSimToReco_ = dqm->
book1D(
"NSimToReco",
"Number of associated reco tracks", hDim.
nAssoc+1, -0.5, hDim.
nAssoc+0.5);
276 hNRecoToSim_ = dqm->
book1D(
"NRecoToSim",
"Number of associated sim TP's", hDim.
nAssoc+1, -0.5, hDim.
nAssoc+0.5);
286 const double simP = simRef->
p();
287 const double simPt = simRef->
pt();
288 const double simEta = doAbsEta_ ? fabs(simRef->
eta()) : simRef->
eta();
289 const double simPhi = simRef->
phi();
290 const double simQ = simRef->
charge();
291 const double simQPt = simQ/simPt;
295 const double simDxy = -simVtx.
x()*
sin(simPhi)+simVtx.y()*
cos(simPhi);
296 const double simDz = simVtx.z() - (simVtx.x()*simMom.x()+simVtx.y()*simMom.y())*simMom.z()/simMom.perp2();
298 const double recoQ = muonRef->
charge();
299 if ( simQ*recoQ < 0 ) {
300 hMisQPt_ ->Fill(simPt );
301 hMisQEta_->Fill(simEta);
304 double recoP, recoPt, recoEta, recoPhi, recoQPt;
307 const double origRecoPt = muonRef->
pt();
310 const double origRecoQPt = recoQ/origRecoPt;
311 recoP = muonRef->
pfP4().P();
312 recoPt = muonRef->
pfP4().Pt();
313 recoEta = muonRef->
pfP4().Eta();
314 recoPhi = muonRef->
pfP4().Phi();
315 recoQPt = recoQ/recoPt;
316 hErrPt_PF_->Fill((recoPt-origRecoPt)/origRecoPt);
317 hErrQPt_PF_->Fill((recoQPt-origRecoQPt)/origRecoQPt);
319 hdPt_vs_Eta_->Fill(recoEta,recoPt-origRecoPt);
320 hdPt_vs_Pt_->Fill(recoPt,recoPt-origRecoPt);
322 int theCorrectPFAss = (fabs(recoPt-simPt) < fabs(origRecoPt - simPt))? 1 : 2;
323 hPFMomAssCorrectness->Fill(theCorrectPFAss);
324 hPt_vs_PFMomAssCorrectness->Fill(simPt,theCorrectPFAss);
328 recoP = muonRef->
p();
329 recoPt = muonRef->
pt();
330 recoEta = muonRef->
eta();
331 recoPhi = muonRef->
phi();
332 recoQPt = recoQ/recoPt;
335 const double errP = (recoP-simP)/simP;
336 const double errPt = (recoPt-simPt)/simPt;
337 const double errEta = (recoEta-simEta)/simEta;
338 const double errPhi = (recoPhi-simPhi)/simPhi;
339 const double errQPt = (recoQPt-simQPt)/simQPt;
346 hErrP_ ->Fill(errP );
347 hErrPt_ ->Fill(errPt );
348 hErrEta_->Fill(errEta);
349 hErrPhi_->Fill(errPhi);
351 if(fabs(simEta) > 0. && fabs(simEta) < 0.8) {
352 hErrPBarrel_->Fill(errP);
353 hErrPtBarrel_->Fill(errPt);
354 }
else if (fabs(simEta) > 0.8 && fabs(simEta) < 1.2) {
355 hErrPOverlap_->Fill(errP);
356 hErrPtOverlap_->Fill(errPt);
357 }
else if (fabs(simEta) > 1.2 ){
358 hErrPEndcap_->Fill(errP);
359 hErrPtEndcap_->Fill(errPt);
362 hErrP_vs_Eta_ ->Fill(simEta, errP );
363 hErrPt_vs_Eta_ ->Fill(simEta, errPt );
364 hErrQPt_vs_Eta_->Fill(simEta, errQPt);
366 hErrP_vs_P_ ->Fill(simP , errP );
367 hErrPt_vs_Pt_ ->Fill(simPt , errPt );
368 hErrQPt_vs_Pt_->Fill(simQPt, errQPt);
370 hErrEta_vs_Eta_->Fill(simEta, errEta);
377 const int nRecoHits = recoRef->numberOfValidHits();
378 const int nLostHits = recoRef->numberOfLostHits();
380 hNHits_->Fill(nRecoHits);
381 hNHits_vs_Pt_ ->Fill(simPt , nRecoHits);
382 hNHits_vs_Eta_->Fill(simEta, nRecoHits);
384 hNLostHits_->Fill(nLostHits);
385 hNLostHits_vs_Pt_ ->Fill(simPt , nLostHits);
386 hNLostHits_vs_Eta_->Fill(simEta, nLostHits);
388 const double recoNDof = recoRef->ndof();
389 const double recoChi2 = recoRef->chi2();
390 const double recoChi2Norm = recoRef->normalizedChi2();
391 const double recoChi2Prob = TMath::Prob(recoRef->chi2(),
static_cast<int>(recoRef->ndof()));
393 hNDof_->Fill(recoNDof);
394 hChi2_->Fill(recoChi2);
395 hChi2Norm_->Fill(recoChi2Norm);
396 hChi2Prob_->Fill(recoChi2Prob);
398 hNDof_vs_Eta_->Fill(simEta, recoNDof);
399 hChi2_vs_Eta_->Fill(simEta, recoChi2);
400 hChi2Norm_vs_Eta_->Fill(simEta, recoChi2Norm);
401 hChi2Prob_vs_Eta_->Fill(simEta, recoChi2Prob);
403 const double recoDxy = recoRef->dxy();
404 const double recoDz = recoRef->dz();
406 const double errDxy = (recoDxy-simDxy)/simDxy;
407 const double errDz = (recoDz-simDz)/simDz;
408 hErrDxy_->Fill(errDxy);
409 hErrDz_ ->Fill(errDz );
411 const double pullPt = (recoPt-simPt)/recoRef->ptError();
412 const double pullQPt = (recoQPt-simQPt)/recoRef->qoverpError();
413 const double pullEta = (recoEta-simEta)/recoRef->etaError();
414 const double pullPhi = (recoPhi-simPhi)/recoRef->phiError();
415 const double pullDxy = (recoDxy-simDxy)/recoRef->dxyError();
416 const double pullDz = (recoDz-simDz)/recoRef->dzError();
418 hPullPt_ ->Fill(pullPt );
419 hPullEta_->Fill(pullEta);
420 hPullPhi_->Fill(pullPhi);
421 hPullQPt_->Fill(pullQPt);
422 hPullDxy_->Fill(pullDxy);
423 hPullDz_ ->Fill(pullDz );
425 hPullPt_vs_Eta_->Fill(simEta, pullPt);
426 hPullPt_vs_Pt_ ->Fill(simPt, pullPt);
428 hPullEta_vs_Eta_->Fill(simEta, pullEta);
429 hPullPhi_vs_Eta_->Fill(simEta, pullPhi);
431 hPullEta_vs_Pt_->Fill(simPt, pullEta);
454 MEP hMuonTrackP_,
hMuonTrackPt_, hMuonTrackEta_, hMuonTrackPhi_, hMuonTrackDxy_, hMuonTrackDz_;
463 selector_(pset.getParameter<std::
string>(
"selection"))
559 else throw cms::Exception(
"Configuration") <<
"Track type '" << trackType <<
"' not supported.\n";
586 LogError(
"RecoMuonValidator") <<
"DQMService not initialized\n";
603 const int nHits = 100;
666 if (assoByHits == 0)
throw cms::Exception(
"Configuration") <<
"The Track Associator with label '" <<
muAssocLabel_.
label() <<
"' is not a MuonAssociatorByHits.\n";
685 LogError(
"RecoMuonValidator") <<
"DQMService not initialized\n";
694 unsigned int theIndexOfThePrimaryVertex = 999.;
695 for (
unsigned int ind=0; ind<recVtxs->size(); ++ind) {
696 if ( (*recVtxs)[ind].isValid() && !((*recVtxs)[ind].isFake()) ) {
697 theIndexOfThePrimaryVertex = ind;
701 if (theIndexOfThePrimaryVertex<100) {
702 posVtx = ((*recVtxs)[theIndexOfThePrimaryVertex]).
position();
703 errVtx = ((*recVtxs)[theIndexOfThePrimaryVertex]).
error();
706 LogInfo(
"RecoMuonValidator") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
713 errVtx(2,2) = bs.
sigmaZ();
731 Muons = muonHandle->refVector();
734 for (
size_t i = 0;
i < nSim; ++
i) {
781 int glbNTrackerHits = 0;
int trkNTrackerHits = 0;
782 int glbNMuonHits = 0;
int staNMuonHits = 0;
783 int NTrackerHits = 0;
int NMuonHits = 0;
788 iMuon != muonColl.
end(); ++iMuon) {
792 muonP = iMuon->pfP4().P();
793 muonPt = iMuon->pfP4().Pt();
794 muonEta = iMuon->pfP4().Eta();
795 muonPhi = iMuon->pfP4().Phi();
799 muonPt = iMuon->pt();
800 muonEta = iMuon->eta();
801 muonPhi = iMuon->phi();
829 if (iMuon->isGlobalMuon()) {
830 Track = iMuon->combinedMuon();
833 }
else if (iMuon->isTrackerMuon()) {
834 Track = iMuon->track();
837 Track = iMuon->standAloneMuon();
861 if (iMuon->isGlobalMuon()) {
862 double gtHitPat = iMuon->globalTrack()->hitPattern().numberOfHits() - iMuon->globalTrack()->hitPattern().numberOfValidHits();
863 double itHitPat = iMuon->innerTrack()->hitPattern().numberOfHits() - iMuon->innerTrack()->hitPattern().numberOfValidHits();
864 double otHitPat = iMuon->outerTrack()->hitPattern().numberOfHits() - iMuon->outerTrack()->hitPattern().numberOfValidHits();
872 if (iMuon->isStandAloneMuon()) {
879 if (iMuon->isTrackerMuon()) {
896 const double simP = simRef->p();
897 const double simPt = simRef->pt();
898 const double simEta =
doAbsEta_ ? fabs(simRef->eta()) : simRef->eta();
899 const double simPhi = simRef->phi();
901 GlobalPoint simVtx(simRef->vertex().x(), simRef->vertex().y(), simRef->vertex().z());
902 GlobalVector simMom(simRef->momentum().x(), simRef->momentum().y(), simRef->momentum().z());
903 const double simDxy = -simVtx.
x()*
sin(simPhi)+simVtx.y()*
cos(simPhi);
904 const double simDz = simVtx.z() - (simVtx.x()*simMom.x()+simVtx.y()*simMom.y())*simMom.z()/simMom.perp2();
906 const unsigned int nSimHits = simRef->numberOfHits();
917 vector<pair<RefToBase<Muon>,
double> > MuRefV;
918 if ( simToMuonColl.find(simRef) != simToMuonColl.end() ) {
919 MuRefV = simToMuonColl[simRef];
921 if ( !MuRefV.empty()) {
923 const Muon*
Mu = MuRefV.begin()->first.get();
943 if((*hit)->isValid()) {
944 DetId recoid = (*hit)->geographicalId();
958 if((*hit)->isValid()) {
959 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_
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.
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
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_
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
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
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.