31 for (
unsigned int www=0;www<
label.size();www++){
39 dirName+=algo.
label();
42 if (dirName.find(
"Tracks")<dirName.length()){
43 dirName.replace(dirName.find(
"Tracks"),6,
"Trks");
45 if (dirName.find(
"UpdatedAtVtx")<dirName.length()){
46 dirName.replace(dirName.find(
"UpdatedAtVtx"),12,
"UpdAtVtx");
49 if (assoc.find(
"tpToTkmuTrackAssociation")<assoc.length()){
58 string subDirName = dirName +
"/simulation";
60 h_ptSIM.push_back( ibooker.
book1D(
"ptSIM",
"generated p_{t}", 5500, 0, 110 ) );
61 h_etaSIM.push_back( ibooker.
book1D(
"etaSIM",
"generated pseudorapidity", 500, -2.5, 2.5 ) );
62 h_tracksSIM.push_back( ibooker.
book1D(
"tracksSIM",
"number of simulated tracks",200,-0.5,99.5) );
63 h_vertposSIM.push_back( ibooker.
book1D(
"vertposSIM",
"Transverse position of sim vertices",100,0.,120.) );
67 h_tracks.push_back( ibooker.
book1D(
"tracks",
"number of reconstructed tracks",200,-0.5,19.5) );
68 h_fakes.push_back( ibooker.
book1D(
"fakes",
"number of fake reco tracks",20,-0.5,19.5) );
69 h_charge.push_back( ibooker.
book1D(
"charge",
"charge",3,-1.5,1.5) );
72 h_nchi2.push_back( ibooker.
book1D(
"chi2",
"normalized #chi^{2}", 200, 0, 20 ) );
73 h_nchi2_prob.push_back( ibooker.
book1D(
"chi2_prob",
"normalized #chi^{2} probability",100,0,1));
76 h_recoeta.push_back( ibooker.
book1D(
"num_reco_eta",
"N of reco track vs eta",
nint,
min,
max) );
77 h_assoceta.push_back( ibooker.
book1D(
"num_assoc(simToReco)_eta",
"N of associated tracks (simToReco) vs eta",
nint,
min,
max) );
78 h_assoc2eta.push_back( ibooker.
book1D(
"num_assoc(recoToSim)_eta",
"N of associated (recoToSim) tracks vs eta",
nint,
min,
max) );
79 h_simuleta.push_back( ibooker.
book1D(
"num_simul_eta",
"N of simulated tracks vs eta",
nint,
min,
max) );
81 h_assocpT.push_back( ibooker.
book1D(
"num_assoc(simToReco)_pT",
"N of associated tracks (simToReco) vs pT",
nintpT,
minpT,
maxpT) );
82 h_assoc2pT.push_back( ibooker.
book1D(
"num_assoc(recoToSim)_pT",
"N of associated (recoToSim) tracks vs pT",
nintpT,
minpT,
maxpT) );
86 h_assochit.push_back( ibooker.
book1D(
"num_assoc(simToReco)_hit",
"N of associated tracks (simToReco) vs hit",
nintHit,
minHit,
maxHit) );
87 h_assoc2hit.push_back( ibooker.
book1D(
"num_assoc(recoToSim)_hit",
"N of associated (recoToSim) tracks vs hit",
nintHit,
minHit,
maxHit) );
91 h_assocphi.push_back( ibooker.
book1D(
"num_assoc(simToReco)_phi",
"N of associated tracks (simToReco) vs phi",
nintPhi,
minPhi,
maxPhi) );
92 h_assoc2phi.push_back( ibooker.
book1D(
"num_assoc(recoToSim)_phi",
"N of associated (recoToSim) tracks vs phi",
nintPhi,
minPhi,
maxPhi) );
96 h_assocdxy.push_back( ibooker.
book1D(
"num_assoc(simToReco)_dxy",
"N of associated tracks (simToReco) vs dxy",
nintDxy,
minDxy,
maxDxy) );
97 h_assoc2dxy.push_back( ibooker.
book1D(
"num_assoc(recoToSim)_dxy",
"N of associated (recoToSim) tracks vs dxy",
nintDxy,
minDxy,
maxDxy) );
101 h_assocdz.push_back( ibooker.
book1D(
"num_assoc(simToReco)_dz",
"N of associated tracks (simToReco) vs dz",
nintDz,
minDz,
maxDz) );
102 h_assoc2dz.push_back( ibooker.
book1D(
"num_assoc(recoToSim)_dz",
"N of associated (recoToSim) tracks vs dz",
nintDz,
minDz,
maxDz) );
108 h_assoczpos.push_back( ibooker.
book1D(
"num_assoc(simToReco)_zpos",
"N of associated tracks (simToReco) vs z vert position",
nintZpos,
minZpos,
maxZpos) );
113 h_eta.push_back( ibooker.
book1D(
"eta",
"pseudorapidity residue", 1000, -0.1, 0.1 ) );
114 h_pt.push_back( ibooker.
book1D(
"pullPt",
"pull of p_{t}", 100, -10, 10 ) );
115 h_pullTheta.push_back( ibooker.
book1D(
"pullTheta",
"pull of #theta parameter",250,-25,25) );
116 h_pullPhi.push_back( ibooker.
book1D(
"pullPhi",
"pull of #phi parameter",250,-25,25) );
117 h_pullDxy.push_back( ibooker.
book1D(
"pullDxy",
"pull of dxy parameter",250,-25,25) );
118 h_pullDz.push_back( ibooker.
book1D(
"pullDz",
"pull of dz parameter",250,-25,25) );
119 h_pullQoverp.push_back( ibooker.
book1D(
"pullQoverp",
"pull of qoverp parameter",250,-25,25) );
122 h_assochi2.push_back( ibooker.
book1D(
"assocChi2",
"track association #chi^{2}",1000000,0,100000) );
123 h_assochi2_prob.push_back(ibooker.
book1D(
"assocChi2_prob",
"probability of association #chi^{2}",100,0,1));
124 }
else if (
associators[ww]==
"trackAssociatorByHits"){
125 h_assocFraction.push_back( ibooker.
book1D(
"assocFraction",
"fraction of shared hits",200,0,2) );
126 h_assocSharedHit.push_back(ibooker.
book1D(
"assocSharedHit",
"number of shared hits",20,0,20));
129 chi2_vs_nhits.push_back( ibooker.
book2D(
"chi2_vs_nhits",
"#chi^{2} vs nhits",25,0,25,100,0,10) );
130 h_chi2meanhitsh.push_back( ibooker.
bookProfile(
"chi2mean_vs_nhits",
"mean #chi^{2} vs nhits",25,0,25,100,0,10) );
132 etares_vs_eta.push_back( ibooker.
book2D(
"etares_vs_eta",
"etaresidue vs eta",
nint,
min,
max,200,-0.1,0.1) );
133 nrec_vs_nsim.push_back( ibooker.
book2D(
"nrec_vs_nsim",
"nrec vs nsim",20,-0.5,19.5,20,-0.5,19.5) );
135 chi2_vs_eta.push_back( ibooker.
book2D(
"chi2_vs_eta",
"chi2_vs_eta",
nint,
min,
max, 200, 0, 20 ));
136 h_chi2meanh.push_back( ibooker.
bookProfile(
"chi2mean",
"mean #chi^{2} vs #eta",
nint,
min,
max, 200, 0, 20) );
177 ptmean_vs_eta_phi.push_back(ibooker.
bookProfile2D(
"ptmean_vs_eta_phi",
"mean p_{t} vs #eta and #phi",
nintPhi,
minPhi,
maxPhi,
nint,
min,
max,1000,0,1000));
178 phimean_vs_eta_phi.push_back(ibooker.
bookProfile2D(
"phimean_vs_eta_phi",
"mean #phi vs #eta and #phi",
nintPhi,
minPhi,
maxPhi,
nint,
min,
max,
nintPhi,
minPhi,
maxPhi));
181 dxypull_vs_eta.push_back(ibooker.
book2D(
"dxypull_vs_eta",
"dxypull_vs_eta",
nint,
min,
max,100,-10,10));
182 ptpull_vs_eta.push_back(ibooker.
book2D(
"ptpull_vs_eta",
"ptpull_vs_eta",
nint,
min,
max,100,-10,10));
183 dzpull_vs_eta.push_back(ibooker.
book2D(
"dzpull_vs_eta",
"dzpull_vs_eta",
nint,
min,
max,100,-10,10));
184 phipull_vs_eta.push_back(ibooker.
book2D(
"phipull_vs_eta",
"phipull_vs_eta",
nint,
min,
max,100,-10,10));
185 thetapull_vs_eta.push_back(ibooker.
book2D(
"thetapull_vs_eta",
"thetapull_vs_eta",
nint,
min,
max,100,-10,10));
196 h_PurityVsQuality.push_back
197 (ibooker.
book2D(
"PurityVsQuality",
"Purity vs Quality (MABH)",20,0.01,1.01,20,0.01,1.01) );
198 h_assoceta_Quality05.push_back
199 (ibooker.
book1D(
"num_assoc(simToReco)_eta_Q05",
"N of associated tracks (simToReco) vs eta (Quality>0.5)",
nint,
min,
max) );
200 h_assoceta_Quality075.push_back
201 (ibooker.
book1D(
"num_assoc(simToReco)_eta_Q075",
"N of associated tracks (simToReco) vs eta (Quality>0.75)",
nint,
min,
max) );
202 h_assocpT_Quality05.push_back
203 (ibooker.
book1D(
"num_assoc(simToReco)_pT_Q05",
"N of associated tracks (simToReco) vs pT (Quality>0.5)",
nintpT,
minpT,
maxpT) );
204 h_assocpT_Quality075.push_back
205 (ibooker.
book1D(
"num_assoc(simToReco)_pT_Q075",
"N of associated tracks (simToReco) vs pT (Quality>0.75)",
nintpT,
minpT,
maxpT) );
206 h_assocphi_Quality05.push_back
207 (ibooker.
book1D(
"num_assoc(simToReco)_phi_Q05",
"N of associated tracks (simToReco) vs phi (Quality>0.5)",
nintPhi,
minPhi,
maxPhi) );
208 h_assocphi_Quality075.push_back
209 (ibooker.
book1D(
"num_assoc(simToReco)_phi_Q075",
"N of associated tracks (simToReco) vs phi (Quality>0.75)",
nintPhi,
minPhi,
maxPhi) );
213 BinLogX(dzres_vs_pt[j]->getTH2F());
214 BinLogX(dxyres_vs_pt[j]->getTH2F());
215 BinLogX(phires_vs_pt[j]->getTH2F());
216 BinLogX(cotThetares_vs_pt[j]->getTH2F());
217 BinLogX(ptres_vs_pt[j]->getTH2F());
218 BinLogX(h_recopT[j]->getTH1F());
219 BinLogX(h_assocpT[j]->getTH1F());
220 BinLogX(h_assoc2pT[j]->getTH1F());
221 BinLogX(h_simulpT[j]->getTH1F());
223 BinLogX(h_assocpT_Quality05[j]->getTH1F());
224 BinLogX(h_assocpT_Quality075[j]->getTH1F());
234 using namespace reco;
236 edm::LogInfo(
"MuonTrackValidator") <<
"\n====================================================" <<
"\n" 237 <<
"Analyzing new event" <<
"\n" 238 <<
"====================================================\n" <<
"\n";
241 std::unique_ptr<ParametersDefinerForTP> Cosmic_parametersDefinerTP;
251 Cosmic_parametersDefinerTP = _Cosmic_parametersDefinerTP->
clone();
255 event.getByToken(_simHitTpMapTag,simHitsTPAssoc);
256 Cosmic_parametersDefinerTP->initEvent(simHitsTPAssoc);
257 cosmictpSelector.initEvent(simHitsTPAssoc);
265 event.getByToken(tp_effic_Token,TPCollectionHeff);
269 event.getByToken(tp_fake_Token,TPCollectionHfake);
272 event.getByToken(bsSrc_Token,recoBeamSpotHandle);
275 std::vector<const reco::TrackToTrackingParticleAssociator*>
associator;
280 associator.push_back( theAssociator.
product() );
285 for (
unsigned int ww=0;ww<
associators.size();ww++){
286 for (
unsigned int www=0;www<
label.size();www++){
294 unsigned int trackCollectionSize = 0;
296 if(!event.
getByToken(track_Collection_Token[www], trackCollection)&&ignoremissingtkcollection_) {
305 trackCollectionSize = trackCollection->size();
310 <<
label[www].process()<<
":" 311 <<
label[www].label()<<
":" 312 <<
label[www].instance()<<
" with " 315 LogTrace(
"MuonTrackValidator") <<
"Calling associateRecoToSim method" <<
"\n";
316 recSimColl=associator[ww]->associateRecoToSim(trackCollection,
318 LogTrace(
"MuonTrackValidator") <<
"Calling associateSimToReco method" <<
"\n";
319 simRecColl=associator[ww]->associateSimToReco(trackCollection,
324 <<
label[www].process()<<
":" 325 <<
label[www].label()<<
":" 326 <<
label[www].instance()<<
" with " 332 event.getByToken(simToRecoCollection_Token,simtorecoCollectionH);
333 simRecColl= *(simtorecoCollectionH.
product());
336 event.getByToken(recoToSimCollection_Token,recotosimCollectionH);
337 recSimColl= *(recotosimCollectionH.
product());
346 edm::LogVerbatim(
"MuonTrackValidator") <<
"\n# of TrackingParticles: " << tPCeff.size() <<
"\n";
350 bool TP_is_matched =
false;
352 bool Quality05 =
false;
353 bool Quality075 =
false;
367 LogTrace(
"MuonTrackValidator") <<
"TrackingParticle "<<
i;
380 if(! cosmictpSelector(tpr,&bs,event,setup))
continue;
381 momentumTP = Cosmic_parametersDefinerTP->momentum(event,setup,tpr);
382 vertexTP = Cosmic_parametersDefinerTP->vertex(event,setup,tpr);
386 edm::LogVerbatim(
"MuonTrackValidator") <<
"--------------------Selected TrackingParticle #"<<tpr.
key();
387 edm::LogVerbatim(
"MuonTrackValidator") <<
"momentumTP: pt = "<<
sqrt(momentumTP.perp2())<<
", pz = "<<momentumTP.z()
388 <<
", \t vertexTP: radius = "<<
sqrt(vertexTP.perp2())<<
", z = "<<vertexTP.z() <<
"\n";
391 h_ptSIM[
w]->Fill(
sqrt(momentumTP.perp2()));
392 h_etaSIM[
w]->Fill(momentumTP.eta());
393 h_vertposSIM[
w]->Fill(
sqrt(vertexTP.perp2()));
395 std::vector<std::pair<RefToBase<Track>,
double> > rt;
396 if(simRecColl.
find(tpr) != simRecColl.
end()){
397 rt = (std::vector<std::pair<RefToBase<Track>,
double> >) simRecColl[tpr];
400 edm::LogVerbatim(
"MuonTrackValidator")<<
"-----------------------------associated Track #"<<assoc_recoTrack.
key();
401 TP_is_matched =
true;
403 quality = rt.begin()->second;
405 <<
" with pt=" <<
sqrt(momentumTP.perp2())
406 <<
" associated with quality:" << quality <<
"\n";
408 if (quality > 0.75) {
412 else if (quality > 0.5) {
419 <<
"TrackingParticle #" << tpr.
key()
420 <<
" with pt,eta,phi: " 421 <<
sqrt(momentumTP.perp2()) <<
" , " 422 << momentumTP.eta() <<
" , " 423 << momentumTP.phi() <<
" , " 424 <<
" NOT associated to any reco::Track" <<
"\n";
427 for (
unsigned int f=0;
f<etaintervals[
w].size()-1;
f++){
428 if (getEta(momentumTP.eta())>etaintervals[w][
f]&&
429 getEta(momentumTP.eta())<etaintervals[w][
f+1]) {
436 totASSeta_Quality075[
w][
f]++;
437 totASSeta_Quality05[
w][
f]++;
439 else if (Quality05) {
440 totASSeta_Quality05[
w][
f]++;
447 for (
unsigned int f=0;
f<phiintervals[
w].size()-1;
f++){
448 if (momentumTP.phi() > phiintervals[
w][
f]&&
449 momentumTP.phi() <phiintervals[
w][
f+1]) {
456 totASS_phi_Quality075[
w][
f]++;
457 totASS_phi_Quality05[
w][
f]++;
459 else if (Quality05) {
460 totASS_phi_Quality05[
w][
f]++;
467 for (
unsigned int f=0;
f<pTintervals[
w].size()-1;
f++){
468 if (getPt(
sqrt(momentumTP.perp2()))>pTintervals[
w][
f]&&
469 getPt(
sqrt(momentumTP.perp2()))<pTintervals[
w][
f+1]) {
476 totASSpT_Quality075[
w][
f]++;
477 totASSpT_Quality05[
w][
f]++;
479 else if (Quality05) {
480 totASSpT_Quality05[
w][
f]++;
487 for (
unsigned int f=0;
f<dxyintervals[
w].size()-1;
f++){
488 if (dxySim>dxyintervals[w][
f]&&
489 dxySim<dxyintervals[w][
f+1]) {
497 for (
unsigned int f=0;
f<dzintervals[
w].size()-1;
f++){
498 if (dzSim>dzintervals[w][
f]&&
499 dzSim<dzintervals[w][
f+1]) {
507 for (
unsigned int f=0;
f<vertposintervals[
w].size()-1;
f++){
508 if (
sqrt(vertexTP.perp2())>vertposintervals[w][
f]&&
509 sqrt(vertexTP.perp2())<vertposintervals[w][
f+1]) {
510 totSIM_vertpos[
w][
f]++;
512 totASS_vertpos[
w][
f]++;
517 for (
unsigned int f=0;
f<zposintervals[
w].size()-1;
f++){
518 if (vertexTP.z()>zposintervals[
w][
f]&&
519 vertexTP.z()<zposintervals[
w][
f+1]) {
529 nSimHits= tpr.
get()->numberOfHits();
532 nSimHits= tpr.
get()->numberOfHits() - tpr.
get()->numberOfTrackerHits();
535 nSimHits=tpr.
get()->numberOfTrackerHits();
539 edm::LogVerbatim(
"MuonTrackValidator") <<
"\t N simhits = "<< nSimHits<<
"\n";
541 totSIM_hit[
w][
tmp]++;
542 if (TP_is_matched) totASS_hit[
w][
tmp]++;
550 if (st!=0) h_tracksSIM[
w]->Fill(st);
556 <<
label[www].process()<<
":" 557 <<
label[www].label()<<
":" 558 <<
label[www].instance()
559 <<
": " << trackCollectionSize <<
"\n";
563 bool Track_is_matched =
false;
567 std::vector<std::pair<TrackingParticleRef, double> > tp;
572 edm::LogVerbatim(
"MuonTrackValidator")<<
"----------------------------------------Track #"<< track.
key();
574 if(recSimColl.
find(track) != recSimColl.
end()) {
575 tp = recSimColl[
track];
576 if (tp.size() != 0) {
577 tpr = tp.begin()->first;
579 if(simRecColl.
find(tpr) != simRecColl.
end()) {
580 std::vector<std::pair<RefToBase<Track>,
double> > track_checkback = simRecColl[tpr];
582 assoc_track_checkback = track_checkback.begin()->first;
584 if ( assoc_track_checkback.
key() == track.
key() ) {
585 edm::LogVerbatim(
"MuonTrackValidator")<<
"------------------associated TrackingParticle #"<<tpr.
key();
586 Track_is_matched =
true;
588 double Purity = tp.begin()->second;
589 double Quality = track_checkback.begin()->second;
590 edm::LogVerbatim(
"MuonTrackValidator") <<
"reco::Track #" << track.
key() <<
" with pt=" << track->
pt()
591 <<
" associated with quality:" << Purity <<
"\n";
592 if (
MABH) h_PurityVsQuality[
w]->Fill(Quality,Purity);
598 if (!Track_is_matched)
600 <<
"reco::Track #" << track.
key() <<
" with pt=" << track->
pt() <<
" NOT associated to any TrackingParticle" <<
"\n";
604 if(recSimColl.
find(track) != recSimColl.
end()){
605 tp = recSimColl[
track];
607 Track_is_matched =
true;
608 tpr = tp.begin()->first;
610 edm::LogVerbatim(
"MuonTrackValidator") <<
"reco::Track #" << track.
key() <<
" with pt=" << track->
pt()
611 <<
" associated with quality:" << tp.begin()->second <<
"\n";
614 edm::LogVerbatim(
"MuonTrackValidator") <<
"reco::Track #" << track.
key() <<
" with pt=" << track->
pt()
615 <<
" NOT associated to any TrackingParticle" <<
"\n";
620 for (
unsigned int f=0;
f<etaintervals[
w].size()-1;
f++){
621 if (getEta(track->
momentum().eta())>etaintervals[w][
f]&&
622 getEta(track->
momentum().eta())<etaintervals[w][
f+1]) {
624 if (Track_is_matched) {
630 for (
unsigned int f=0;
f<phiintervals[
w].size()-1;
f++){
631 if (track->
momentum().phi()>phiintervals[
w][
f]&&
632 track->
momentum().phi()<phiintervals[
w][
f+1]) {
634 if (Track_is_matched) {
640 for (
unsigned int f=0;
f<pTintervals[
w].size()-1;
f++){
644 if (Track_is_matched) {
650 for (
unsigned int f=0;
f<dxyintervals[
w].size()-1;
f++){
654 if (Track_is_matched) {
660 for (
unsigned int f=0;
f<dzintervals[
w].size()-1;
f++){
664 if (Track_is_matched) {
671 totREC_hit[
w][
tmp]++;
672 if (Track_is_matched) totASS2_hit[
w][
tmp]++;
684 if (! (Track_is_matched &&
tpSelector(*tpp)) )
continue;
686 momentumTP = Lhc_parametersDefinerTP->
momentum(event,setup,tpr) ;
687 vertexTP = Lhc_parametersDefinerTP->
vertex(event,setup,tpr);
692 if (! (Track_is_matched && cosmictpSelector(tpr,&bs,event,setup)) )
continue;
694 momentumTP = Cosmic_parametersDefinerTP->momentum(event,setup,tpr) ;
695 vertexTP = Cosmic_parametersDefinerTP->vertex(event,setup,tpr);
701 double assocChi2 = -tp.begin()->second;
702 h_assochi2[www]->Fill(assocChi2);
703 h_assochi2_prob[www]->Fill(TMath::Prob((assocChi2)*5,5));
705 else if (
associators[ww]==
"trackAssociatorByHits"){
706 double fraction = tp.begin()->second;
707 h_assocFraction[www]->Fill(fraction);
713 h_nchi2_prob[
w]->Fill(TMath::Prob(track->
chi2(),(
int)track->
ndof()));
717 h_charge[
w]->Fill( track->
charge() );
719 double ptSim =
sqrt(momentumTP.perp2());
720 double qoverpSim = tpr->charge()/
sqrt(momentumTP.x()*momentumTP.x()+momentumTP.y()*momentumTP.y()+momentumTP.z()*momentumTP.z());
721 double thetaSim = momentumTP.theta();
722 double lambdaSim =
M_PI/2-momentumTP.theta();
723 double phiSim = momentumTP.phi();
731 double qoverpErrorRec(0);
733 double ptErrorRec(0);
735 double lambdaErrorRec(0);
737 double phiErrorRec(0);
742 gsfTrack =
dynamic_cast<const GsfTrack*
>(&(*track));
743 if (gsfTrack==0)
edm::LogInfo(
"MuonTrackValidator") <<
"Trying to access mode for a non-GsfTrack";
748 getRecoMomentum(*gsfTrack, ptRec, ptErrorRec, qoverpRec, qoverpErrorRec,
749 lambdaRec,lambdaErrorRec, phiRec, phiErrorRec);
754 getRecoMomentum(*track, ptRec, ptErrorRec, qoverpRec, qoverpErrorRec,
755 lambdaRec,lambdaErrorRec, phiRec, phiErrorRec);
758 double thetaRec = track->
theta();
759 double ptError = ptErrorRec;
760 double ptres = ptRec - ptSim;
761 double etares = track->
eta()-momentumTP.Eta();
765 double qoverpPull=(qoverpRec-qoverpSim)/qoverpErrorRec;
766 double thetaPull=(lambdaRec-lambdaSim)/lambdaErrorRec;
767 double phiDiff = phiRec - phiSim;
769 if (phiDiff >0.) phiDiff = phiDiff - 2.*
M_PI;
770 else phiDiff = phiDiff + 2.*
M_PI;
772 double phiPull=phiDiff/phiErrorRec;
773 double dxyPull=(dxyRec-dxySim)/track->
dxyError();
774 double dzPull=(dzRec-dzSim)/track->
dzError();
776 double contrib_Qoverp = ((qoverpRec-qoverpSim)/qoverpErrorRec)*((qoverpRec-qoverpSim)/qoverpErrorRec)/5;
777 double contrib_dxy = ((dxyRec-dxySim)/track->
dxyError())*((dxyRec-dxySim)/track->
dxyError())/5;
778 double contrib_dz = ((dzRec-dzSim)/track->
dzError())*((dzRec-dzSim)/track->
dzError())/5;
779 double contrib_theta = ((lambdaRec-lambdaSim)/lambdaErrorRec)*((lambdaRec-lambdaSim)/lambdaErrorRec)/5;
780 double contrib_phi = (phiDiff/phiErrorRec)*(phiDiff/phiErrorRec)/5;
782 edm::LogVerbatim(
"MuonTrackValidator") <<
"assocChi2=" << tp.begin()->second <<
"\n" 784 <<
"ptREC=" << ptRec <<
"\n" 785 <<
"etaREC=" << track->
eta() <<
"\n" 786 <<
"qoverpREC=" << qoverpRec <<
"\n" 787 <<
"dxyREC=" << dxyRec <<
"\n" 788 <<
"dzREC=" << dzRec <<
"\n" 789 <<
"thetaREC=" << track->
theta() <<
"\n" 790 <<
"phiREC=" << phiRec <<
"\n" 792 <<
"qoverpError()=" << qoverpErrorRec <<
"\n" 793 <<
"dxyError()=" << track->
dxyError() <<
"\n" 794 <<
"dzError()=" << track->
dzError() <<
"\n" 795 <<
"thetaError()=" << lambdaErrorRec <<
"\n" 796 <<
"phiError()=" << phiErrorRec <<
"\n" 798 <<
"ptSIM=" << ptSim <<
"\n" 799 <<
"etaSIM=" << momentumTP.Eta() <<
"\n" 800 <<
"qoverpSIM=" << qoverpSim <<
"\n" 801 <<
"dxySIM=" << dxySim <<
"\n" 802 <<
"dzSIM=" << dzSim <<
"\n" 803 <<
"thetaSIM=" <<
M_PI/2-lambdaSim <<
"\n" 804 <<
"phiSIM=" << phiSim <<
"\n" 806 <<
"contrib_Qoverp=" << contrib_Qoverp <<
"\n" 807 <<
"contrib_dxy=" << contrib_dxy <<
"\n" 808 <<
"contrib_dz=" << contrib_dz <<
"\n" 809 <<
"contrib_theta=" << contrib_theta <<
"\n" 810 <<
"contrib_phi=" << contrib_phi <<
"\n" 812 <<
"chi2PULL="<<contrib_Qoverp+contrib_dxy+contrib_dz+contrib_theta+contrib_phi<<
"\n";
814 h_pullQoverp[
w]->Fill(qoverpPull);
815 h_pullTheta[
w]->Fill(thetaPull);
816 h_pullPhi[
w]->Fill(phiPull);
817 h_pullDxy[
w]->Fill(dxyPull);
818 h_pullDz[
w]->Fill(dzPull);
820 h_pt[
w]->Fill(ptres/ptError);
821 h_eta[
w]->Fill(etares);
822 etares_vs_eta[
w]->Fill(getEta(track->
eta()),etares);
835 dxyres_vs_eta[
w]->Fill(getEta(track->
eta()),dxyRec-dxySim);
836 ptres_vs_eta[
w]->Fill(getEta(track->
eta()),(ptRec-ptSim)/ptRec);
837 dzres_vs_eta[
w]->Fill(getEta(track->
eta()),dzRec-dzSim);
838 phires_vs_eta[
w]->Fill(getEta(track->
eta()),phiDiff);
839 cotThetares_vs_eta[
w]->Fill(getEta(track->
eta()),
cos(thetaRec)/
sin(thetaRec) -
cos(thetaSim)/
sin(thetaSim));
842 dxyres_vs_pt[
w]->Fill(getPt(ptRec),dxyRec-dxySim);
843 ptres_vs_pt[
w]->Fill(getPt(ptRec),(ptRec-ptSim)/ptRec);
844 dzres_vs_pt[
w]->Fill(getPt(ptRec),dzRec-dzSim);
845 phires_vs_pt[
w]->Fill(getPt(ptRec),phiDiff);
846 cotThetares_vs_pt[
w]->Fill(getPt(ptRec),
cos(thetaRec)/
sin(thetaRec) -
cos(thetaSim)/
sin(thetaSim));
849 dxypull_vs_eta[
w]->Fill(getEta(track->
eta()),dxyPull);
850 ptpull_vs_eta[
w]->Fill(getEta(track->
eta()),ptres/ptError);
851 dzpull_vs_eta[
w]->Fill(getEta(track->
eta()),dzPull);
852 phipull_vs_eta[
w]->Fill(getEta(track->
eta()),phiPull);
853 thetapull_vs_eta[
w]->Fill(getEta(track->
eta()),thetaPull);
858 ptmean_vs_eta_phi[
w]->Fill(phiRec,getEta(track->
eta()),ptRec);
859 phimean_vs_eta_phi[
w]->Fill(phiRec,getEta(track->
eta()),phiRec);
860 ptres_vs_phi[
w]->Fill(phiRec,(ptRec-ptSim)/ptRec);
861 phires_vs_phi[
w]->Fill(phiRec,phiDiff);
862 ptpull_vs_phi[
w]->Fill(phiRec,ptres/ptError);
863 phipull_vs_phi[
w]->Fill(phiRec,phiPull);
864 thetapull_vs_phi[
w]->Fill(phiRec,thetaPull);
868 nSimHits= tpr.
get()->numberOfHits();
871 nSimHits= tpr.
get()->numberOfHits() - tpr.
get()->numberOfTrackerHits();
874 nSimHits=tpr.
get()->numberOfTrackerHits();
881 if (at!=0) h_tracks[
w]->Fill(at);
882 h_fakes[
w]->Fill(rT-at);
884 <<
"Total Associated (simToReco): " << ats <<
"\n" 885 <<
"Total Reconstructed: " << rT <<
"\n" 886 <<
"Total Associated (recoToSim): " << at <<
"\n" 887 <<
"Total Fakes: " << rT-at <<
"\n";
888 nrec_vs_nsim[
w]->Fill(rT,st);
897 for (
unsigned int ww=0;ww<
associators.size();ww++){
898 for (
unsigned int www=0;www<
label.size();www++){
901 doProfileX(chi2_vs_eta[w],h_chi2meanh[w]);
902 doProfileX(nhits_vs_eta[w],h_hits_eta[w]);
903 doProfileX(nDThits_vs_eta[w],h_DThits_eta[w]);
904 doProfileX(nCSChits_vs_eta[w],h_CSChits_eta[w]);
905 doProfileX(nRPChits_vs_eta[w],h_RPChits_eta[w]);
906 if (useGEMs_) doProfileX(nGEMhits_vs_eta[w],h_GEMhits_eta[w]);
907 if (useME0_) doProfileX(nME0hits_vs_eta[w],h_ME0hits_eta[w]);
909 doProfileX(nlosthits_vs_eta[w],h_losthits_eta[w]);
911 doProfileX(chi2_vs_nhits[w],h_chi2meanhitsh[w]);
912 doProfileX(chi2_vs_phi[w],h_chi2mean_vs_phi[w]);
913 doProfileX(nhits_vs_phi[w],h_hits_phi[w]);
915 fillPlotFromVector(h_recoeta[w],totRECeta[w]);
916 fillPlotFromVector(h_simuleta[w],totSIMeta[w]);
917 fillPlotFromVector(h_assoceta[w],totASSeta[w]);
918 fillPlotFromVector(h_assoc2eta[w],totASS2eta[w]);
920 fillPlotFromVector(h_recopT[w],totRECpT[w]);
921 fillPlotFromVector(h_simulpT[w],totSIMpT[w]);
922 fillPlotFromVector(h_assocpT[w],totASSpT[w]);
923 fillPlotFromVector(h_assoc2pT[w],totASS2pT[w]);
925 fillPlotFromVector(h_recohit[w],totREC_hit[w]);
926 fillPlotFromVector(h_simulhit[w],totSIM_hit[w]);
927 fillPlotFromVector(h_assochit[w],totASS_hit[w]);
928 fillPlotFromVector(h_assoc2hit[w],totASS2_hit[w]);
930 fillPlotFromVector(h_recophi[w],totREC_phi[w]);
931 fillPlotFromVector(h_simulphi[w],totSIM_phi[w]);
932 fillPlotFromVector(h_assocphi[w],totASS_phi[w]);
933 fillPlotFromVector(h_assoc2phi[w],totASS2_phi[w]);
935 fillPlotFromVector(h_recodxy[w],totREC_dxy[w]);
936 fillPlotFromVector(h_simuldxy[w],totSIM_dxy[w]);
937 fillPlotFromVector(h_assocdxy[w],totASS_dxy[w]);
938 fillPlotFromVector(h_assoc2dxy[w],totASS2_dxy[w]);
940 fillPlotFromVector(h_recodz[w],totREC_dz[w]);
941 fillPlotFromVector(h_simuldz[w],totSIM_dz[w]);
942 fillPlotFromVector(h_assocdz[w],totASS_dz[w]);
943 fillPlotFromVector(h_assoc2dz[w],totASS2_dz[w]);
945 fillPlotFromVector(h_simulvertpos[w],totSIM_vertpos[w]);
946 fillPlotFromVector(h_assocvertpos[w],totASS_vertpos[w]);
948 fillPlotFromVector(h_simulzpos[w],totSIM_zpos[w]);
949 fillPlotFromVector(h_assoczpos[w],totASS_zpos[w]);
952 fillPlotFromVector(h_assoceta_Quality05[w] ,totASSeta_Quality05[w]);
953 fillPlotFromVector(h_assoceta_Quality075[w],totASSeta_Quality075[w]);
954 fillPlotFromVector(h_assocpT_Quality05[w] ,totASSpT_Quality05[w]);
955 fillPlotFromVector(h_assocpT_Quality075[w],totASSpT_Quality075[w]);
956 fillPlotFromVector(h_assocphi_Quality05[w] ,totASS_phi_Quality05[w]);
957 fillPlotFromVector(h_assocphi_Quality075[w],totASS_phi_Quality075[w]);
968 double&
pt,
double& ptError,
double& qoverp,
double& qoverpError,
969 double& lambda,
double& lambdaError,
double& phi,
double&
phiError )
const {
981 double&
pt,
double& ptError,
double& qoverp,
double& qoverpError,
982 double& lambda,
double& lambdaError,
double& phi,
double&
phiError )
const {
double qoverp() const
q / p
double phiModeError() const
error on phi from mode
std::vector< TrackingParticle > TrackingParticleCollection
double lambdaMode() const
Lambda angle from mode.
Vector momentum() const
spatial momentum vector
const_iterator end() const
last iterator over the map (read only)
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
MonitorElement * bookProfile(Args &&...args)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double theta() const
polar angle
double dxyError() const
error on dxy
Sin< T >::type sin(const T &t)
const_iterator find(const key_type &k) const
find element with specified reference key
def replace(string, replacements)
def setup(process, global_tag, zero_tesla=False)
double phi() const
azimuthal angle of momentum vector
unsigned short numberOfLostHits() const
number of cases where track crossed a layer without getting a hit.
key_type key() const
Accessor for product key.
const Vector & momentum() const
track momentum vector
void getRecoMomentum(const reco::Track &track, double &pt, double &ptError, double &qoverp, double &qoverpError, double &lambda, double &lambdaError, double &phi, double &phiError) const
retrieval of reconstructed momentum components from reco::Track (== mean values for GSF) ...
int numberOfValidMuonCSCHits() const
double qoverpMode() const
q/p from mode
int numberOfValidMuonRPCHits() const
double ptModeError() const
error on Pt (set to 1000 TeV if charge==0 for safety) from mode
math::XYZPointD Point
point in the space
BiDirectional_RecoToSim_association
double eta() const
pseudorapidity of momentum vector
double chi2() const
chi-squared of the fit
MonitorElement * bookProfile2D(Args &&...args)
auto dz(const T_Vertex &vertex, const T_Momentum &momentum, const T_Point &point)
void post_insert()
post insert action
double ndof() const
number of degrees of freedom of the fit
double pt() const
track transverse momentum
Cos< T >::type cos(const T &t)
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
double phiError() const
error on phi
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
virtual TrackingParticle::Vector momentum(const edm::Event &iEvent, const edm::EventSetup &iSetup, const Charge ch, const Point &vtx, const LorentzVector &lv) const
double lambda() const
Lambda angle.
void analyze(const edm::Event &, const edm::EventSetup &)
Method called before the event loop.
unsigned short numberOfValidHits() const
number of valid hits found
T const * get() const
Returns C++ pointer to the item.
double qoverpError() const
error on signed transverse curvature
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
double dzError() const
error on dz
void setCurrentFolder(const std::string &fullpath)
T const * product() const
MonitorElement * book2D(Args &&...args)
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
double qoverpModeError() const
error on signed transverse curvature from mode
Point vertex() const
Parent vertex position.
ParameterVector parameters() const
Track parameters with one-to-one correspondence to the covariance matrix.
std::vector< std::vector< double > > tmp
double lambdaError() const
error on lambda
std::unique_ptr< ParametersDefinerForTP > clone() const override
int numberOfValidMuonGEMHits() const
auto dxy(const T_Vertex &vertex, const T_Momentum &momentum, const T_Point &point)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
int numberOfValidMuonME0Hits() const
unsigned short found() const
Number of valid hits on track.
int numberOfValidMuonDTHits() const
double phiMode() const
azimuthal angle of momentum vector from mode
Monte Carlo truth information used for tracking validation.
int charge() const
track electric charge
const Point & position() const
position
double lambdaModeError() const
error on lambda from mode
math::XYZVectorD Vector
point in the space
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
double ptMode() const
track transverse momentum from mode
virtual TrackingParticle::Point vertex(const edm::Event &iEvent, const edm::EventSetup &iSetup, const Charge ch, const Point &vtx, const LorentzVector &lv) const
void endRun(edm::Run const &, edm::EventSetup const &)
Method called at the end of the event loop.