33 for (
unsigned int ww=0;ww<associators.size();ww++){
34 for (
unsigned int www=0;www<
label.size();www++){
42 dirName+=algo.
label()+
"_";
45 if (dirName.find(
"Tracks")<dirName.length()){
46 dirName.replace(dirName.find(
"Tracks"),6,
"");
48 string assoc= associators[ww];
49 if (assoc.find(
"Track")<assoc.length()){
50 assoc.replace(assoc.find(
"Track"),5,
"");
59 string subDirName = dirName +
"/simulation";
61 h_ptSIM.push_back(
dbe_->
book1D(
"ptSIM",
"generated p_{t}", 5500, 0, 110 ) );
62 h_etaSIM.push_back(
dbe_->
book1D(
"etaSIM",
"generated pseudorapidity", 500, -2.5, 2.5 ) );
63 h_tracksSIM.push_back(
dbe_->
book1D(
"tracksSIM",
"number of simulated tracks",200,-0.5,99.5) );
64 h_vertposSIM.push_back(
dbe_->
book1D(
"vertposSIM",
"Transverse position of sim vertices",100,0.,120.) );
68 h_tracks.push_back(
dbe_->
book1D(
"tracks",
"number of reconstructed tracks",200,-0.5,19.5) );
69 h_fakes.push_back(
dbe_->
book1D(
"fakes",
"number of fake reco tracks",20,-0.5,19.5) );
70 h_charge.push_back(
dbe_->
book1D(
"charge",
"charge",3,-1.5,1.5) );
71 h_hits.push_back(
dbe_->
book1D(
"hits",
"number of hits per track", nintHit,minHit,maxHit ) );
72 h_losthits.push_back(
dbe_->
book1D(
"losthits",
"number of lost hits per track", nintHit,minHit,maxHit) );
73 h_nchi2.push_back(
dbe_->
book1D(
"chi2",
"normalized #chi^{2}", 200, 0, 20 ) );
74 h_nchi2_prob.push_back(
dbe_->
book1D(
"chi2_prob",
"normalized #chi^{2} probability",100,0,1));
78 h_assoceta.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_eta",
"N of associated tracks (simToReco) vs eta",
nint,
min,
max) );
79 h_assoc2eta.push_back(
dbe_->
book1D(
"num_assoc(recoToSim)_eta",
"N of associated (recoToSim) tracks vs eta",
nint,
min,
max) );
80 h_simuleta.push_back(
dbe_->
book1D(
"num_simul_eta",
"N of simulated tracks vs eta",
nint,
min,
max) );
81 h_recopT.push_back(
dbe_->
book1D(
"num_reco_pT",
"N of reco track vs pT",nintpT,minpT,maxpT) );
82 h_assocpT.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_pT",
"N of associated tracks (simToReco) vs pT",nintpT,minpT,maxpT) );
83 h_assoc2pT.push_back(
dbe_->
book1D(
"num_assoc(recoToSim)_pT",
"N of associated (recoToSim) tracks vs pT",nintpT,minpT,maxpT) );
84 h_simulpT.push_back(
dbe_->
book1D(
"num_simul_pT",
"N of simulated tracks vs pT",nintpT,minpT,maxpT) );
86 h_recohit.push_back(
dbe_->
book1D(
"num_reco_hit",
"N of reco track vs hit",nintHit,minHit,maxHit) );
87 h_assochit.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_hit",
"N of associated tracks (simToReco) vs hit",nintHit,minHit,maxHit) );
88 h_assoc2hit.push_back(
dbe_->
book1D(
"num_assoc(recoToSim)_hit",
"N of associated (recoToSim) tracks vs hit",nintHit,minHit,maxHit) );
89 h_simulhit.push_back(
dbe_->
book1D(
"num_simul_hit",
"N of simulated tracks vs hit",nintHit,minHit,maxHit) );
91 h_recophi.push_back(
dbe_->
book1D(
"num_reco_phi",
"N of reco track vs phi",nintPhi,minPhi,maxPhi) );
92 h_assocphi.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_phi",
"N of associated tracks (simToReco) vs phi",nintPhi,minPhi,maxPhi) );
93 h_assoc2phi.push_back(
dbe_->
book1D(
"num_assoc(recoToSim)_phi",
"N of associated (recoToSim) tracks vs phi",nintPhi,minPhi,maxPhi) );
94 h_simulphi.push_back(
dbe_->
book1D(
"num_simul_phi",
"N of simulated tracks vs phi",nintPhi,minPhi,maxPhi) );
96 h_recodxy.push_back(
dbe_->
book1D(
"num_reco_dxy",
"N of reco track vs dxy",nintDxy,minDxy,
maxDxy) );
97 h_assocdxy.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_dxy",
"N of associated tracks (simToReco) vs dxy",nintDxy,minDxy,
maxDxy) );
98 h_assoc2dxy.push_back(
dbe_->
book1D(
"num_assoc(recoToSim)_dxy",
"N of associated (recoToSim) tracks vs dxy",nintDxy,minDxy,
maxDxy) );
99 h_simuldxy.push_back(
dbe_->
book1D(
"num_simul_dxy",
"N of simulated tracks vs dxy",nintDxy,minDxy,
maxDxy) );
101 h_recodz.push_back(
dbe_->
book1D(
"num_reco_dz",
"N of reco track vs dz",nintDz,minDz,maxDz) );
102 h_assocdz.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_dz",
"N of associated tracks (simToReco) vs dz",nintDz,minDz,maxDz) );
103 h_assoc2dz.push_back(
dbe_->
book1D(
"num_assoc(recoToSim)_dz",
"N of associated (recoToSim) tracks vs dz",nintDz,minDz,maxDz) );
104 h_simuldz.push_back(
dbe_->
book1D(
"num_simul_dz",
"N of simulated tracks vs dz",nintDz,minDz,maxDz) );
106 h_assocvertpos.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_vertpos",
"N of associated tracks (simToReco) vs transverse vert position",nintVertpos,minVertpos,maxVertpos) );
107 h_simulvertpos.push_back(
dbe_->
book1D(
"num_simul_vertpos",
"N of simulated tracks vs transverse vert position",nintVertpos,minVertpos,maxVertpos) );
109 h_assoczpos.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_zpos",
"N of associated tracks (simToReco) vs z vert position",nintZpos,minZpos,maxZpos) );
110 h_simulzpos.push_back(
dbe_->
book1D(
"num_simul_zpos",
"N of simulated tracks vs z vert position",nintZpos,minZpos,maxZpos) );
115 h_eta.push_back(
dbe_->
book1D(
"eta",
"pseudorapidity residue", 1000, -0.1, 0.1 ) );
116 h_pt.push_back(
dbe_->
book1D(
"pullPt",
"pull of p_{t}", 100, -10, 10 ) );
117 h_pullTheta.push_back(
dbe_->
book1D(
"pullTheta",
"pull of #theta parameter",250,-25,25) );
118 h_pullPhi.push_back(
dbe_->
book1D(
"pullPhi",
"pull of #phi parameter",250,-25,25) );
119 h_pullDxy.push_back(
dbe_->
book1D(
"pullDxy",
"pull of dxy parameter",250,-25,25) );
120 h_pullDz.push_back(
dbe_->
book1D(
"pullDz",
"pull of dz parameter",250,-25,25) );
121 h_pullQoverp.push_back(
dbe_->
book1D(
"pullQoverp",
"pull of qoverp parameter",250,-25,25) );
123 if (associators[ww]==
"TrackAssociatorByChi2"){
124 h_assochi2.push_back(
dbe_->
book1D(
"assocChi2",
"track association #chi^{2}",1000000,0,100000) );
125 h_assochi2_prob.push_back(
dbe_->
book1D(
"assocChi2_prob",
"probability of association #chi^{2}",100,0,1));
126 }
else if (associators[ww]==
"TrackAssociatorByHits"){
127 h_assocFraction.push_back(
dbe_->
book1D(
"assocFraction",
"fraction of shared hits",200,0,2) );
128 h_assocSharedHit.push_back(
dbe_->
book1D(
"assocSharedHit",
"number of shared hits",20,0,20));
131 chi2_vs_nhits.push_back(
dbe_->
book2D(
"chi2_vs_nhits",
"#chi^{2} vs nhits",25,0,25,100,0,10) );
132 h_chi2meanhitsh.push_back(
dbe_->
bookProfile(
"chi2mean_vs_nhits",
"mean #chi^{2} vs nhits",25,0,25,100,0,10) );
134 etares_vs_eta.push_back(
dbe_->
book2D(
"etares_vs_eta",
"etaresidue vs eta",
nint,
min,
max,200,-0.1,0.1) );
135 nrec_vs_nsim.push_back(
dbe_->
book2D(
"nrec_vs_nsim",
"nrec vs nsim",20,-0.5,19.5,20,-0.5,19.5) );
139 chi2_vs_phi.push_back(
dbe_->
book2D(
"chi2_vs_phi",
"#chi^{2} vs #phi",nintPhi,minPhi,maxPhi, 200, 0, 20 ) );
140 h_chi2mean_vs_phi.push_back(
dbe_->
bookProfile(
"chi2mean_vs_phi",
"mean of #chi^{2} vs #phi",nintPhi,minPhi,maxPhi, 200, 0, 20) );
142 nhits_vs_eta.push_back(
dbe_->
book2D(
"nhits_vs_eta",
"nhits vs eta",
nint,
min,
max,nintHit,minHit,maxHit) );
143 nDThits_vs_eta.push_back(
dbe_->
book2D(
"nDThits_vs_eta",
"# DT hits vs eta",
nint,
min,
max,nintHit,minHit,maxHit) );
144 nCSChits_vs_eta.push_back(
dbe_->
book2D(
"nCSChits_vs_eta",
"# CSC hits vs eta",
nint,
min,
max,nintHit,minHit,maxHit) );
145 nRPChits_vs_eta.push_back(
dbe_->
book2D(
"nRPChits_vs_eta",
"# RPC hits vs eta",
nint,
min,
max,nintHit,minHit,maxHit) );
151 nhits_vs_phi.push_back(
dbe_->
book2D(
"nhits_vs_phi",
"#hits vs #phi",nintPhi,minPhi,maxPhi,nintHit,minHit,maxHit) );
152 h_hits_phi.push_back(
dbe_->
bookProfile(
"hits_phi",
"mean #hits vs #phi",nintPhi,minPhi,maxPhi, nintHit,minHit,maxHit) );
154 nlosthits_vs_eta.push_back(
dbe_->
book2D(
"nlosthits_vs_eta",
"nlosthits vs eta",
nint,
min,
max,nintHit,minHit,maxHit) );
157 ptres_vs_eta.push_back(
dbe_->
book2D(
"ptres_vs_eta",
"ptres_vs_eta",
nint,
min,
max, ptRes_nbin, ptRes_rangeMin, ptRes_rangeMax));
158 ptres_vs_phi.push_back(
dbe_->
book2D(
"ptres_vs_phi",
"p_{t} res vs #phi",nintPhi,minPhi,maxPhi, ptRes_nbin, ptRes_rangeMin, ptRes_rangeMax));
159 ptres_vs_pt.push_back(
dbe_->
book2D(
"ptres_vs_pt",
"ptres_vs_pt",nintpT,minpT,maxpT, ptRes_nbin, ptRes_rangeMin, ptRes_rangeMax));
161 cotThetares_vs_eta.push_back(
dbe_->
book2D(
"cotThetares_vs_eta",
"cotThetares_vs_eta",
nint,
min,
max,cotThetaRes_nbin, cotThetaRes_rangeMin, cotThetaRes_rangeMax));
162 cotThetares_vs_pt.push_back(
dbe_->
book2D(
"cotThetares_vs_pt",
"cotThetares_vs_pt",nintpT,minpT,maxpT, cotThetaRes_nbin, cotThetaRes_rangeMin, cotThetaRes_rangeMax));
164 phires_vs_eta.push_back(
dbe_->
book2D(
"phires_vs_eta",
"phires_vs_eta",
nint,
min,
max, phiRes_nbin, phiRes_rangeMin, phiRes_rangeMax));
165 phires_vs_pt.push_back(
dbe_->
book2D(
"phires_vs_pt",
"phires_vs_pt",nintpT,minpT,maxpT, phiRes_nbin, phiRes_rangeMin, phiRes_rangeMax));
166 phires_vs_phi.push_back(
dbe_->
book2D(
"phires_vs_phi",
"#phi res vs #phi",nintPhi,minPhi,maxPhi,phiRes_nbin, phiRes_rangeMin, phiRes_rangeMax));
168 dxyres_vs_eta.push_back(
dbe_->
book2D(
"dxyres_vs_eta",
"dxyres_vs_eta",
nint,
min,
max,dxyRes_nbin, dxyRes_rangeMin, dxyRes_rangeMax));
169 dxyres_vs_pt.push_back(
dbe_->
book2D(
"dxyres_vs_pt",
"dxyres_vs_pt",nintpT,minpT,maxpT,dxyRes_nbin, dxyRes_rangeMin, dxyRes_rangeMax));
171 dzres_vs_eta.push_back(
dbe_->
book2D(
"dzres_vs_eta",
"dzres_vs_eta",
nint,
min,
max,dzRes_nbin, dzRes_rangeMin, dzRes_rangeMax));
172 dzres_vs_pt.push_back(
dbe_->
book2D(
"dzres_vs_pt",
"dzres_vs_pt",nintpT,minpT,maxpT,dzRes_nbin, dzRes_rangeMin, dzRes_rangeMax));
174 ptmean_vs_eta_phi.push_back(
dbe_->
bookProfile2D(
"ptmean_vs_eta_phi",
"mean p_{t} vs #eta and #phi",nintPhi,minPhi,maxPhi,
nint,
min,
max,1000,0,1000));
175 phimean_vs_eta_phi.push_back(
dbe_->
bookProfile2D(
"phimean_vs_eta_phi",
"mean #phi vs #eta and #phi",nintPhi,minPhi,maxPhi,
nint,
min,
max,nintPhi,minPhi,maxPhi));
178 dxypull_vs_eta.push_back(
dbe_->
book2D(
"dxypull_vs_eta",
"dxypull_vs_eta",
nint,
min,
max,100,-10,10));
181 phipull_vs_eta.push_back(
dbe_->
book2D(
"phipull_vs_eta",
"phipull_vs_eta",
nint,
min,
max,100,-10,10));
182 thetapull_vs_eta.push_back(
dbe_->
book2D(
"thetapull_vs_eta",
"thetapull_vs_eta",
nint,
min,
max,100,-10,10));
185 ptpull_vs_phi.push_back(
dbe_->
book2D(
"ptpull_vs_phi",
"p_{t} pull vs #phi",nintPhi,minPhi,maxPhi,100,-10,10));
186 phipull_vs_phi.push_back(
dbe_->
book2D(
"phipull_vs_phi",
"#phi pull vs #phi",nintPhi,minPhi,maxPhi,100,-10,10));
187 thetapull_vs_phi.push_back(
dbe_->
book2D(
"thetapull_vs_phi",
"#theta pull vs #phi",nintPhi,minPhi,maxPhi,100,-10,10));
189 nrecHit_vs_nsimHit_sim2rec.push_back(
dbe_->
book2D(
"nrecHit_vs_nsimHit_sim2rec",
"nrecHit vs nsimHit (Sim2RecAssoc)",nintHit,minHit,maxHit, nintHit,minHit,maxHit ));
190 nrecHit_vs_nsimHit_rec2sim.push_back(
dbe_->
book2D(
"nrecHit_vs_nsimHit_rec2sim",
"nrecHit vs nsimHit (Rec2simAssoc)",nintHit,minHit,maxHit, nintHit,minHit,maxHit ));
193 h_PurityVsQuality.push_back(
dbe_->
book2D(
"PurityVsQuality",
"Purity vs Quality (MABH)",20,0.01,1.01,20,0.01,1.01) );
194 h_assoceta_Quality05.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_eta_Q05",
"N of associated tracks (simToReco) vs eta (Quality>0.5)",
nint,
min,
max) );
195 h_assoceta_Quality075.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_eta_Q075",
"N of associated tracks (simToReco) vs eta (Quality>0.75)",
nint,
min,
max) );
196 h_assocpT_Quality05.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_pT_Q05",
"N of associated tracks (simToReco) vs pT (Quality>0.5)",nintpT,minpT,maxpT) );
197 h_assocpT_Quality075.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_pT_Q075",
"N of associated tracks (simToReco) vs pT (Quality>0.75)",nintpT,minpT,maxpT) );
198 h_assocphi_Quality05.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_phi_Q05",
"N of associated tracks (simToReco) vs phi (Quality>0.5)",nintPhi,minPhi,maxPhi) );
199 h_assocphi_Quality075.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_phi_Q075",
"N of associated tracks (simToReco) vs phi (Quality>0.75)",nintPhi,minPhi,maxPhi) );
203 BinLogX(dzres_vs_pt[j]->
getTH2F());
204 BinLogX(dxyres_vs_pt[j]->
getTH2F());
205 BinLogX(phires_vs_pt[j]->
getTH2F());
206 BinLogX(cotThetares_vs_pt[j]->
getTH2F());
207 BinLogX(ptres_vs_pt[j]->
getTH2F());
208 BinLogX(h_recopT[j]->
getTH1F());
209 BinLogX(h_assocpT[j]->
getTH1F());
210 BinLogX(h_assoc2pT[j]->
getTH1F());
211 BinLogX(h_simulpT[j]->
getTH1F());
213 BinLogX(h_assocpT_Quality05[j]->
getTH1F());
214 BinLogX(h_assocpT_Quality075[j]->
getTH1F());
221 if (UseAssociators) {
223 for (
unsigned int w=0;
w<associators.size();
w++) {
225 associator.push_back( theAssociator.
product() );
231 using namespace reco;
233 edm::LogInfo(
"MuonTrackValidator") <<
"\n====================================================" <<
"\n"
234 <<
"Analyzing new event" <<
"\n"
235 <<
"====================================================\n" <<
"\n";
240 event.getByToken(tp_effic_Token,TPCollectionHeff);
244 event.getByToken(tp_fake_Token,TPCollectionHfake);
248 event.getByToken(bsSrc_Token,recoBeamSpotHandle);
252 for (
unsigned int ww=0;ww<associators.size();ww++){
253 for (
unsigned int www=0;www<
label.size();www++){
261 unsigned int trackCollectionSize = 0;
263 if(!event.
getByToken(track_Collection_Token[www], trackCollection)&&ignoremissingtkcollection_) {
272 trackCollectionSize = trackCollection->size();
276 <<
label[www].process()<<
":"
277 <<
label[www].label()<<
":"
278 <<
label[www].instance()<<
" with "
279 << associators[ww].c_str() <<
"\n";
281 LogTrace(
"MuonTrackValidator") <<
"Calling associateRecoToSim method" <<
"\n";
282 recSimColl=associator[ww]->associateRecoToSim(trackCollection,
285 LogTrace(
"MuonTrackValidator") <<
"Calling associateSimToReco method" <<
"\n";
286 simRecColl=associator[ww]->associateSimToReco(trackCollection,
292 <<
label[www].process()<<
":"
293 <<
label[www].label()<<
":"
294 <<
label[www].instance()<<
" with "
295 << associatormap.process()<<
":"
296 << associatormap.label()<<
":"
297 << associatormap.instance()<<
"\n";
300 event.getByToken(simToRecoCollection_Token,simtorecoCollectionH);
301 simRecColl= *(simtorecoCollectionH.
product());
304 event.getByToken(recoToSimCollection_Token,recotosimCollectionH);
305 recSimColl= *(recotosimCollectionH.
product());
315 edm::LogVerbatim(
"MuonTrackValidator") <<
"\n# of TrackingParticles: " << tPCeff.size() <<
"\n";
319 bool TP_is_matched =
false;
321 bool Quality05 =
false;
322 bool Quality075 =
false;
332 if(parametersDefiner==
"LhcParametersDefinerForTP")
334 if(! tpSelector(*tp))
continue;
340 dxySim = (-vertex.x()*
sin(momentum.phi())+vertex.y()*
cos(momentum.phi()));
341 dzSim = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/
sqrt(momentum.perp2()) * momentum.z()/
sqrt(momentum.perp2());
344 if(parametersDefiner==
"CosmicParametersDefinerForTP")
346 if(! cosmictpSelector(tpr,&bs,event,setup))
continue;
347 momentumTP = parametersDefinerTP->momentum(event,setup,tpr);
348 vertexTP = parametersDefinerTP->vertex(event,setup,tpr);
349 dxySim = (-vertexTP.x()*
sin(momentumTP.phi())+vertexTP.y()*
cos(momentumTP.phi()));
350 dzSim = vertexTP.z() - (vertexTP.x()*momentumTP.x()+vertexTP.y()*momentumTP.y())/
sqrt(momentumTP.perp2()) * momentumTP.z()/
sqrt(momentumTP.perp2());
352 edm::LogVerbatim(
"MuonTrackValidator") <<
"--------------------Selected TrackingParticle #"<<tpr.
key();
355 h_ptSIM[
w]->Fill(
sqrt(momentumTP.perp2()));
356 h_etaSIM[
w]->Fill(momentumTP.eta());
357 h_vertposSIM[
w]->Fill(
sqrt(vertexTP.perp2()));
359 std::vector<std::pair<RefToBase<Track>,
double> > rt;
360 if(simRecColl.
find(tpr) != simRecColl.
end()){
361 rt = (std::vector<std::pair<RefToBase<Track>,
double> >) simRecColl[tpr];
364 edm::LogVerbatim(
"MuonTrackValidator")<<
"-----------------------------associated Track #"<<assoc_recoTrack.
key();
365 TP_is_matched =
true;
367 quality = rt.begin()->second;
369 <<
" with pt=" <<
sqrt(momentumTP.perp2())
370 <<
" associated with quality:" << quality <<
"\n";
372 if (quality > 0.75) {
376 else if (quality > 0.5) {
383 <<
"TrackingParticle #" << tpr.
key()
384 <<
" with pt,eta,phi: "
385 <<
sqrt(momentumTP.perp2()) <<
" , "
386 << momentumTP.eta() <<
" , "
387 << momentumTP.phi() <<
" , "
388 <<
" NOT associated to any reco::Track" <<
"\n";
391 for (
unsigned int f=0;
f<etaintervals[
w].size()-1;
f++){
392 if (getEta(momentumTP.eta())>etaintervals[
w][
f]&&
393 getEta(momentumTP.eta())<etaintervals[
w][
f+1]) {
400 totASSeta_Quality075[
w][
f]++;
401 totASSeta_Quality05[
w][
f]++;
403 else if (Quality05) {
404 totASSeta_Quality05[
w][
f]++;
411 for (
unsigned int f=0;
f<phiintervals[
w].size()-1;
f++){
412 if (momentumTP.phi() > phiintervals[
w][
f]&&
413 momentumTP.phi() <phiintervals[
w][
f+1]) {
420 totASS_phi_Quality075[
w][
f]++;
421 totASS_phi_Quality05[
w][
f]++;
423 else if (Quality05) {
424 totASS_phi_Quality05[
w][
f]++;
432 for (
unsigned int f=0;
f<pTintervals[
w].size()-1;
f++){
433 if (getPt(
sqrt(momentumTP.perp2()))>pTintervals[
w][
f]&&
434 getPt(
sqrt(momentumTP.perp2()))<pTintervals[
w][
f+1]) {
441 totASSpT_Quality075[
w][
f]++;
442 totASSpT_Quality05[
w][
f]++;
444 else if (Quality05) {
445 totASSpT_Quality05[
w][
f]++;
452 for (
unsigned int f=0;
f<dxyintervals[
w].size()-1;
f++){
453 if (dxySim>dxyintervals[
w][
f]&&
454 dxySim<dxyintervals[
w][
f+1]) {
462 for (
unsigned int f=0;
f<dzintervals[
w].size()-1;
f++){
463 if (dzSim>dzintervals[
w][
f]&&
464 dzSim<dzintervals[
w][
f+1]) {
472 for (
unsigned int f=0;
f<vertposintervals[
w].size()-1;
f++){
473 if (
sqrt(vertexTP.perp2())>vertposintervals[
w][
f]&&
474 sqrt(vertexTP.perp2())<vertposintervals[
w][
f+1]) {
475 totSIM_vertpos[
w][
f]++;
477 totASS_vertpos[
w][
f]++;
482 for (
unsigned int f=0;
f<zposintervals[
w].size()-1;
f++){
483 if (vertexTP.z()>zposintervals[
w][
f]&&
484 vertexTP.z()<zposintervals[
w][
f+1]) {
493 if (usetracker && usemuon) {
494 nSimHits= tpr.
get()->numberOfHits();
496 else if (!usetracker && usemuon) {
497 nSimHits= tpr.
get()->numberOfHits() - tpr.
get()->numberOfTrackerHits();
499 else if (usetracker && !usemuon) {
500 nSimHits=tpr.
get()->numberOfTrackerHits();
505 edm::LogVerbatim(
"MuonTrackValidator") <<
"\t N simhits = "<< nSimHits<<
"\n";
507 totSIM_hit[
w][
tmp]++;
508 if (TP_is_matched) totASS_hit[
w][
tmp]++;
516 if (st!=0) h_tracksSIM[
w]->Fill(st);
523 <<
label[www].process()<<
":"
524 <<
label[www].label()<<
":"
525 <<
label[www].instance()
526 <<
": " << trackCollectionSize <<
"\n";
530 bool Track_is_matched =
false;
534 std::vector<std::pair<TrackingParticleRef, double> > tp;
538 if (BiDirectional_RecoToSim_association) {
539 edm::LogVerbatim(
"MuonTrackValidator")<<
"----------------------------------------Track #"<< track.
key();
541 if(recSimColl.
find(track) != recSimColl.
end()) {
542 tp = recSimColl[track];
543 if (tp.size() != 0) {
544 tpr = tp.begin()->first;
546 if(simRecColl.
find(tpr) != simRecColl.
end()) {
547 std::vector<std::pair<RefToBase<Track>,
double> > track_checkback = simRecColl[tpr];
549 assoc_track_checkback = track_checkback.begin()->first;
551 if ( assoc_track_checkback.
key() == track.
key() ) {
552 edm::LogVerbatim(
"MuonTrackValidator")<<
"------------------associated TrackingParticle #"<<tpr.
key();
553 Track_is_matched =
true;
555 double Purity = tp.begin()->second;
556 double Quality = track_checkback.begin()->second;
557 edm::LogVerbatim(
"MuonTrackValidator") <<
"reco::Track #" << track.
key() <<
" with pt=" << track->
pt()
558 <<
" associated with quality:" << Purity <<
"\n";
559 if (MABH) h_PurityVsQuality[
w]->Fill(Quality,Purity);
566 <<
"reco::Track #" << track.
key() <<
" with pt=" << track->
pt() <<
" NOT associated to any TrackingParticle" <<
"\n";
570 if(recSimColl.
find(track) != recSimColl.
end()){
571 tp = recSimColl[track];
573 Track_is_matched =
true;
574 tpr = tp.begin()->first;
576 edm::LogVerbatim(
"MuonTrackValidator") <<
"reco::Track #" << track.
key() <<
" with pt=" << track->
pt()
577 <<
" associated with quality:" << tp.begin()->second <<
"\n";
580 edm::LogVerbatim(
"MuonTrackValidator") <<
"reco::Track #" << track.
key() <<
" with pt=" << track->
pt()
581 <<
" NOT associated to any TrackingParticle" <<
"\n";
586 for (
unsigned int f=0;
f<etaintervals[
w].size()-1;
f++){
587 if (getEta(track->
momentum().eta())>etaintervals[
w][
f]&&
588 getEta(track->
momentum().eta())<etaintervals[
w][
f+1]) {
590 if (Track_is_matched) {
596 for (
unsigned int f=0;
f<phiintervals[
w].size()-1;
f++){
597 if (track->
momentum().phi()>phiintervals[
w][
f]&&
598 track->
momentum().phi()<phiintervals[
w][
f+1]) {
600 if (Track_is_matched) {
607 for (
unsigned int f=0;
f<pTintervals[
w].size()-1;
f++){
611 if (Track_is_matched) {
617 for (
unsigned int f=0;
f<dxyintervals[
w].size()-1;
f++){
618 if (track->
dxy(bs.position())>dxyintervals[
w][
f]&&
619 track->
dxy(bs.position())<dxyintervals[
w][
f+1]) {
621 if (Track_is_matched) {
627 for (
unsigned int f=0;
f<dzintervals[
w].size()-1;
f++){
628 if (track->
dz(bs.position())>dzintervals[
w][
f]&&
629 track->
dz(bs.position())<dzintervals[
w][
f+1]) {
631 if (Track_is_matched) {
638 totREC_hit[
w][
tmp]++;
639 if (Track_is_matched) totASS2_hit[
w][
tmp]++;
645 if (!Track_is_matched)
continue;
647 if (associators[ww]==
"TrackAssociatorByChi2"){
649 double assocChi2 = -tp.begin()->second;
650 h_assochi2[www]->Fill(assocChi2);
651 h_assochi2_prob[www]->Fill(TMath::Prob((assocChi2)*5,5));
653 else if (associators[ww]==
"TrackAssociatorByHits"){
654 double fraction = tp.begin()->second;
655 h_assocFraction[www]->Fill(fraction);
661 h_nchi2_prob[
w]->Fill(TMath::Prob(track->
chi2(),(int)track->
ndof()));
665 h_charge[
w]->Fill( track->
charge() );
670 double ptSim =
sqrt(momentumTP.perp2());
671 double qoverpSim = tpr->charge()/
sqrt(momentumTP.x()*momentumTP.x()+momentumTP.y()*momentumTP.y()+momentumTP.z()*momentumTP.z());
672 double thetaSim = momentumTP.theta();
673 double lambdaSim =
M_PI/2-momentumTP.theta();
674 double phiSim = momentumTP.phi();
675 double dxySim = (-vertexTP.x()*
sin(momentumTP.phi())+vertexTP.y()*
cos(momentumTP.phi()));
676 double dzSim = vertexTP.z() - (vertexTP.x()*momentumTP.x()+vertexTP.y()*momentumTP.y())/
sqrt(momentumTP.perp2()) * momentumTP.z()/
sqrt(momentumTP.perp2());
682 double qoverpErrorRec(0);
684 double ptErrorRec(0);
686 double lambdaErrorRec(0);
688 double phiErrorRec(0);
694 gsfTrack =
dynamic_cast<const GsfTrack*
>(&(*track));
695 if (gsfTrack==0)
edm::LogInfo(
"MuonTrackValidator") <<
"Trying to access mode for a non-GsfTrack";
700 getRecoMomentum(*gsfTrack, ptRec, ptErrorRec, qoverpRec, qoverpErrorRec,
701 lambdaRec,lambdaErrorRec, phiRec, phiErrorRec);
706 getRecoMomentum(*track, ptRec, ptErrorRec, qoverpRec, qoverpErrorRec,
707 lambdaRec,lambdaErrorRec, phiRec, phiErrorRec);
710 double thetaRec = track->
theta();
711 double ptError = ptErrorRec;
712 double ptres = ptRec - ptSim;
713 double etares = track->
eta()-momentumTP.Eta();
714 double dxyRec = track->
dxy(bs.position());
715 double dzRec = track->
dz(bs.position());
717 double qoverpPull=(qoverpRec-qoverpSim)/qoverpErrorRec;
718 double thetaPull=(lambdaRec-lambdaSim)/lambdaErrorRec;
719 double phiDiff = phiRec - phiSim;
721 if (phiDiff >0.) phiDiff = phiDiff - 2.*
M_PI;
722 else phiDiff = phiDiff + 2.*
M_PI;
724 double phiPull=phiDiff/phiErrorRec;
725 double dxyPull=(dxyRec-dxySim)/track->
dxyError();
726 double dzPull=(dzRec-dzSim)/track->
dzError();
728 double contrib_Qoverp = ((qoverpRec-qoverpSim)/qoverpErrorRec)*
729 ((qoverpRec-qoverpSim)/qoverpErrorRec)/5;
730 double contrib_dxy = ((dxyRec-dxySim)/track->
dxyError())*((dxyRec-dxySim)/track->
dxyError())/5;
731 double contrib_dz = ((dzRec-dzSim)/track->
dzError())*((dzRec-dzSim)/track->
dzError())/5;
732 double contrib_theta = ((lambdaRec-lambdaSim)/lambdaErrorRec)*
733 ((lambdaRec-lambdaSim)/lambdaErrorRec)/5;
734 double contrib_phi = (phiDiff/phiErrorRec)*(phiDiff/phiErrorRec)/5;
736 LogTrace(
"MuonTrackValidator") <<
"assocChi2=" << tp.begin()->second <<
"\n"
738 <<
"ptREC=" << ptRec <<
"\n"
739 <<
"etaREC=" << track->
eta() <<
"\n"
740 <<
"qoverpREC=" << qoverpRec <<
"\n"
741 <<
"dxyREC=" << dxyRec <<
"\n"
742 <<
"dzREC=" << dzRec <<
"\n"
743 <<
"thetaREC=" << track->
theta() <<
"\n"
744 <<
"phiREC=" << phiRec <<
"\n"
746 <<
"qoverpError()=" << qoverpErrorRec <<
"\n"
747 <<
"dxyError()=" << track->
dxyError() <<
"\n"
748 <<
"dzError()=" << track->
dzError() <<
"\n"
749 <<
"thetaError()=" << lambdaErrorRec <<
"\n"
750 <<
"phiError()=" << phiErrorRec <<
"\n"
752 <<
"ptSIM=" << ptSim <<
"\n"
753 <<
"etaSIM=" << momentumTP.Eta() <<
"\n"
754 <<
"qoverpSIM=" << qoverpSim <<
"\n"
755 <<
"dxySIM=" << dxySim <<
"\n"
756 <<
"dzSIM=" << dzSim <<
"\n"
757 <<
"thetaSIM=" <<
M_PI/2-lambdaSim <<
"\n"
758 <<
"phiSIM=" << phiSim <<
"\n"
760 <<
"contrib_Qoverp=" << contrib_Qoverp <<
"\n"
761 <<
"contrib_dxy=" << contrib_dxy <<
"\n"
762 <<
"contrib_dz=" << contrib_dz <<
"\n"
763 <<
"contrib_theta=" << contrib_theta <<
"\n"
764 <<
"contrib_phi=" << contrib_phi <<
"\n"
766 <<
"chi2PULL="<<contrib_Qoverp+contrib_dxy+contrib_dz+contrib_theta+contrib_phi<<
"\n";
768 h_pullQoverp[
w]->Fill(qoverpPull);
769 h_pullTheta[
w]->Fill(thetaPull);
770 h_pullPhi[
w]->Fill(phiPull);
771 h_pullDxy[
w]->Fill(dxyPull);
772 h_pullDz[
w]->Fill(dzPull);
775 h_pt[
w]->Fill(ptres/ptError);
776 h_eta[
w]->Fill(etares);
777 etares_vs_eta[
w]->Fill(getEta(track->
eta()),etares);
790 dxyres_vs_eta[
w]->Fill(getEta(track->
eta()),dxyRec-dxySim);
791 ptres_vs_eta[
w]->Fill(getEta(track->
eta()),(ptRec-ptSim)/ptRec);
792 dzres_vs_eta[
w]->Fill(getEta(track->
eta()),dzRec-dzSim);
793 phires_vs_eta[
w]->Fill(getEta(track->
eta()),phiDiff);
794 cotThetares_vs_eta[
w]->Fill(getEta(track->
eta()),
cos(thetaRec)/
sin(thetaRec) -
cos(thetaSim)/
sin(thetaSim));
797 dxyres_vs_pt[
w]->Fill(getPt(ptRec),dxyRec-dxySim);
798 ptres_vs_pt[
w]->Fill(getPt(ptRec),(ptRec-ptSim)/ptRec);
799 dzres_vs_pt[
w]->Fill(getPt(ptRec),dzRec-dzSim);
800 phires_vs_pt[
w]->Fill(getPt(ptRec),phiDiff);
801 cotThetares_vs_pt[
w]->Fill(getPt(ptRec),
cos(thetaRec)/
sin(thetaRec) -
cos(thetaSim)/
sin(thetaSim));
804 dxypull_vs_eta[
w]->Fill(getEta(track->
eta()),dxyPull);
805 ptpull_vs_eta[
w]->Fill(getEta(track->
eta()),ptres/ptError);
806 dzpull_vs_eta[
w]->Fill(getEta(track->
eta()),dzPull);
807 phipull_vs_eta[
w]->Fill(getEta(track->
eta()),phiPull);
808 thetapull_vs_eta[
w]->Fill(getEta(track->
eta()),thetaPull);
813 ptmean_vs_eta_phi[
w]->Fill(phiRec,getEta(track->
eta()),ptRec);
814 phimean_vs_eta_phi[
w]->Fill(phiRec,getEta(track->
eta()),phiRec);
815 ptres_vs_phi[
w]->Fill(phiRec,(ptRec-ptSim)/ptRec);
816 phires_vs_phi[
w]->Fill(phiRec,phiDiff);
817 ptpull_vs_phi[
w]->Fill(phiRec,ptres/ptError);
818 phipull_vs_phi[
w]->Fill(phiRec,phiPull);
819 thetapull_vs_phi[
w]->Fill(phiRec,thetaPull);
822 if (usetracker && usemuon) {
823 nSimHits= tpr.
get()->numberOfHits();
825 else if (!usetracker && usemuon) {
826 nSimHits= tpr.
get()->numberOfHits() - tpr.
get()->numberOfTrackerHits();
828 else if (usetracker && !usemuon) {
829 nSimHits=tpr.
get()->numberOfTrackerHits();
836 LogTrace(
"MuonTrackValidator") <<
"exception found: " << e.
what() <<
"\n";
839 if (at!=0) h_tracks[
w]->Fill(at);
840 h_fakes[
w]->Fill(rT-at);
842 <<
"Total Associated (simToReco): " << ats <<
"\n"
843 <<
"Total Reconstructed: " << rT <<
"\n"
844 <<
"Total Associated (recoToSim): " << at <<
"\n"
845 <<
"Total Fakes: " << rT-at <<
"\n";
846 nrec_vs_nsim[
w]->Fill(rT,st);
855 for (
unsigned int ww=0;ww<associators.size();ww++){
856 for (
unsigned int www=0;www<
label.size();www++){
859 doProfileX(chi2_vs_eta[w],h_chi2meanh[w]);
860 doProfileX(nhits_vs_eta[w],h_hits_eta[w]);
861 doProfileX(nDThits_vs_eta[w],h_DThits_eta[w]);
862 doProfileX(nCSChits_vs_eta[w],h_CSChits_eta[w]);
863 doProfileX(nRPChits_vs_eta[w],h_RPChits_eta[w]);
865 doProfileX(nlosthits_vs_eta[w],h_losthits_eta[w]);
867 doProfileX(chi2_vs_nhits[w],h_chi2meanhitsh[w]);
868 doProfileX(chi2_vs_phi[w],h_chi2mean_vs_phi[w]);
869 doProfileX(nhits_vs_phi[w],h_hits_phi[w]);
871 fillPlotFromVector(h_recoeta[w],totRECeta[w]);
872 fillPlotFromVector(h_simuleta[w],totSIMeta[w]);
873 fillPlotFromVector(h_assoceta[w],totASSeta[w]);
874 fillPlotFromVector(h_assoc2eta[w],totASS2eta[w]);
876 fillPlotFromVector(h_recopT[w],totRECpT[w]);
877 fillPlotFromVector(h_simulpT[w],totSIMpT[w]);
878 fillPlotFromVector(h_assocpT[w],totASSpT[w]);
879 fillPlotFromVector(h_assoc2pT[w],totASS2pT[w]);
881 fillPlotFromVector(h_recohit[w],totREC_hit[w]);
882 fillPlotFromVector(h_simulhit[w],totSIM_hit[w]);
883 fillPlotFromVector(h_assochit[w],totASS_hit[w]);
884 fillPlotFromVector(h_assoc2hit[w],totASS2_hit[w]);
886 fillPlotFromVector(h_recophi[w],totREC_phi[w]);
887 fillPlotFromVector(h_simulphi[w],totSIM_phi[w]);
888 fillPlotFromVector(h_assocphi[w],totASS_phi[w]);
889 fillPlotFromVector(h_assoc2phi[w],totASS2_phi[w]);
891 fillPlotFromVector(h_recodxy[w],totREC_dxy[w]);
892 fillPlotFromVector(h_simuldxy[w],totSIM_dxy[w]);
893 fillPlotFromVector(h_assocdxy[w],totASS_dxy[w]);
894 fillPlotFromVector(h_assoc2dxy[w],totASS2_dxy[w]);
896 fillPlotFromVector(h_recodz[w],totREC_dz[w]);
897 fillPlotFromVector(h_simuldz[w],totSIM_dz[w]);
898 fillPlotFromVector(h_assocdz[w],totASS_dz[w]);
899 fillPlotFromVector(h_assoc2dz[w],totASS2_dz[w]);
901 fillPlotFromVector(h_simulvertpos[w],totSIM_vertpos[w]);
902 fillPlotFromVector(h_assocvertpos[w],totASS_vertpos[w]);
904 fillPlotFromVector(h_simulzpos[w],totSIM_zpos[w]);
905 fillPlotFromVector(h_assoczpos[w],totASS_zpos[w]);
908 fillPlotFromVector(h_assoceta_Quality05[w] ,totASSeta_Quality05[w]);
909 fillPlotFromVector(h_assoceta_Quality075[w],totASSeta_Quality075[w]);
910 fillPlotFromVector(h_assocpT_Quality05[w] ,totASSpT_Quality05[w]);
911 fillPlotFromVector(h_assocpT_Quality075[w],totASSpT_Quality075[w]);
912 fillPlotFromVector(h_assocphi_Quality05[w] ,totASS_phi_Quality05[w]);
913 fillPlotFromVector(h_assocphi_Quality075[w],totASS_phi_Quality075[w]);
926 double& qoverp,
double& qoverpError,
double& lambda,
double& lambdaError,
double&
phi,
double& phiError )
const {
940 double& qoverp,
double& qoverpError,
double& lambda,
double& lambdaError,
double&
phi,
double& phiError )
const {
double qoverp() const
q/p
virtual char const * what() const
double phiModeError() const
error on phi from mode
const Vector & momentum() const
track momentum vector
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
std::vector< TrackingParticle > TrackingParticleCollection
double lambdaMode() const
Lambda angle from mode.
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)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double theta() const
polar angle
double dxyError() const
error on dxy
void cd(void)
go to top directory (ie. root)
Point vertex() const
Parent vertex position.
Sin< T >::type sin(const T &t)
const_iterator find(const key_type &k) const
find element with specified reference key
double phi() const
azimuthal angle of momentum vector
unsigned short numberOfLostHits() const
number of cases where track crossed a layer without getting a hit.
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
double eta() const
pseudorapidity of momentum vector
const T & max(const T &a, const T &b)
double chi2() const
chi-squared of the fit
ParameterVector parameters() const
Track parameters with one-to-one correspondence to the covariance matrix.
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
Abs< T >::type abs(const T &t)
double lambda() const
Lambda angle.
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")
TH1F * getTH1F(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
void analyze(const edm::Event &, const edm::EventSetup &)
Method called once per event.
unsigned short numberOfValidHits() const
number of valid hits found
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
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
int nint(float a)
Return the nearest integer - analogous to the FORTRAN intrinsic NINT.
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
double qoverpModeError() const
error on signed transverse curvature from mode
key_type key() const
Accessor for product key.
T const * product() const
void beginRun(edm::Run const &, edm::EventSetup const &)
Method called before the event loop.
T const * product() const
std::vector< std::vector< double > > tmp
double lambdaError() const
error on lambda
unsigned short found() const
Number of valid hits on track.
int numberOfValidMuonDTHits() const
Vector momentum() const
spatial momentum vector
TH2F * getTH2F(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
void goUp(void)
equivalent to "cd .."
double phiMode() const
azimuthal angle of momentum vector from mode
Monte Carlo truth information used for tracking validation.
int charge() const
track electric charge
double lambdaModeError() const
error on lambda from mode
math::XYZVectorD Vector
point in the space
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.
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
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void setCurrentFolder(const std::string &fullpath)
void endRun(edm::Run const &, edm::EventSetup const &)
Method called at the end of the event loop.
MonitorElement * bookProfile2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, const char *option="s")