34 for (
unsigned int ww=0;ww<associators.size();ww++){
35 for (
unsigned int www=0;www<
label.size();www++){
43 dirName+=algo.
label()+
"_";
46 if (dirName.find(
"Tracks")<dirName.length()){
47 dirName.replace(dirName.find(
"Tracks"),6,
"");
49 string assoc= associators[ww];
50 if (assoc.find(
"Track")<assoc.length()){
51 assoc.replace(assoc.find(
"Track"),5,
"");
60 string subDirName = dirName +
"/simulation";
62 h_ptSIM.push_back(
dbe_->
book1D(
"ptSIM",
"generated p_{t}", 5500, 0, 110 ) );
63 h_etaSIM.push_back(
dbe_->
book1D(
"etaSIM",
"generated pseudorapidity", 500, -2.5, 2.5 ) );
64 h_tracksSIM.push_back(
dbe_->
book1D(
"tracksSIM",
"number of simulated tracks",200,-0.5,99.5) );
65 h_vertposSIM.push_back(
dbe_->
book1D(
"vertposSIM",
"Transverse position of sim vertices",100,0.,120.) );
69 h_tracks.push_back(
dbe_->
book1D(
"tracks",
"number of reconstructed tracks",200,-0.5,19.5) );
70 h_fakes.push_back(
dbe_->
book1D(
"fakes",
"number of fake reco tracks",20,-0.5,19.5) );
71 h_charge.push_back(
dbe_->
book1D(
"charge",
"charge",3,-1.5,1.5) );
72 h_hits.push_back(
dbe_->
book1D(
"hits",
"number of hits per track", nintHit,minHit,maxHit ) );
73 h_losthits.push_back(
dbe_->
book1D(
"losthits",
"number of lost hits per track", nintHit,minHit,maxHit) );
74 h_nchi2.push_back(
dbe_->
book1D(
"chi2",
"normalized #chi^{2}", 200, 0, 20 ) );
75 h_nchi2_prob.push_back(
dbe_->
book1D(
"chi2_prob",
"normalized #chi^{2} probability",100,0,1));
79 h_assoceta.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_eta",
"N of associated tracks (simToReco) vs eta",
nint,
min,
max) );
80 h_assoc2eta.push_back(
dbe_->
book1D(
"num_assoc(recoToSim)_eta",
"N of associated (recoToSim) tracks vs eta",
nint,
min,
max) );
81 h_simuleta.push_back(
dbe_->
book1D(
"num_simul_eta",
"N of simulated tracks vs eta",
nint,
min,
max) );
82 h_recopT.push_back(
dbe_->
book1D(
"num_reco_pT",
"N of reco track vs pT",nintpT,minpT,maxpT) );
83 h_assocpT.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_pT",
"N of associated tracks (simToReco) vs pT",nintpT,minpT,maxpT) );
84 h_assoc2pT.push_back(
dbe_->
book1D(
"num_assoc(recoToSim)_pT",
"N of associated (recoToSim) tracks vs pT",nintpT,minpT,maxpT) );
85 h_simulpT.push_back(
dbe_->
book1D(
"num_simul_pT",
"N of simulated tracks vs pT",nintpT,minpT,maxpT) );
87 h_recohit.push_back(
dbe_->
book1D(
"num_reco_hit",
"N of reco track vs hit",nintHit,minHit,maxHit) );
88 h_assochit.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_hit",
"N of associated tracks (simToReco) vs hit",nintHit,minHit,maxHit) );
89 h_assoc2hit.push_back(
dbe_->
book1D(
"num_assoc(recoToSim)_hit",
"N of associated (recoToSim) tracks vs hit",nintHit,minHit,maxHit) );
90 h_simulhit.push_back(
dbe_->
book1D(
"num_simul_hit",
"N of simulated tracks vs hit",nintHit,minHit,maxHit) );
92 h_recophi.push_back(
dbe_->
book1D(
"num_reco_phi",
"N of reco track vs phi",nintPhi,minPhi,maxPhi) );
93 h_assocphi.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_phi",
"N of associated tracks (simToReco) vs phi",nintPhi,minPhi,maxPhi) );
94 h_assoc2phi.push_back(
dbe_->
book1D(
"num_assoc(recoToSim)_phi",
"N of associated (recoToSim) tracks vs phi",nintPhi,minPhi,maxPhi) );
95 h_simulphi.push_back(
dbe_->
book1D(
"num_simul_phi",
"N of simulated tracks vs phi",nintPhi,minPhi,maxPhi) );
97 h_recodxy.push_back(
dbe_->
book1D(
"num_reco_dxy",
"N of reco track vs dxy",nintDxy,minDxy,
maxDxy) );
98 h_assocdxy.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_dxy",
"N of associated tracks (simToReco) vs dxy",nintDxy,minDxy,
maxDxy) );
99 h_assoc2dxy.push_back(
dbe_->
book1D(
"num_assoc(recoToSim)_dxy",
"N of associated (recoToSim) tracks vs dxy",nintDxy,minDxy,
maxDxy) );
100 h_simuldxy.push_back(
dbe_->
book1D(
"num_simul_dxy",
"N of simulated tracks vs dxy",nintDxy,minDxy,
maxDxy) );
102 h_recodz.push_back(
dbe_->
book1D(
"num_reco_dz",
"N of reco track vs dz",nintDz,minDz,maxDz) );
103 h_assocdz.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_dz",
"N of associated tracks (simToReco) vs dz",nintDz,minDz,maxDz) );
104 h_assoc2dz.push_back(
dbe_->
book1D(
"num_assoc(recoToSim)_dz",
"N of associated (recoToSim) tracks vs dz",nintDz,minDz,maxDz) );
105 h_simuldz.push_back(
dbe_->
book1D(
"num_simul_dz",
"N of simulated tracks vs dz",nintDz,minDz,maxDz) );
107 h_assocvertpos.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_vertpos",
"N of associated tracks (simToReco) vs transverse vert position",nintVertpos,minVertpos,maxVertpos) );
108 h_simulvertpos.push_back(
dbe_->
book1D(
"num_simul_vertpos",
"N of simulated tracks vs transverse vert position",nintVertpos,minVertpos,maxVertpos) );
110 h_assoczpos.push_back(
dbe_->
book1D(
"num_assoc(simToReco)_zpos",
"N of associated tracks (simToReco) vs z vert position",nintZpos,minZpos,maxZpos) );
111 h_simulzpos.push_back(
dbe_->
book1D(
"num_simul_zpos",
"N of simulated tracks vs z vert position",nintZpos,minZpos,maxZpos) );
116 h_eta.push_back(
dbe_->
book1D(
"eta",
"pseudorapidity residue", 1000, -0.1, 0.1 ) );
117 h_pt.push_back(
dbe_->
book1D(
"pullPt",
"pull of p_{t}", 100, -10, 10 ) );
118 h_pullTheta.push_back(
dbe_->
book1D(
"pullTheta",
"pull of #theta parameter",250,-25,25) );
119 h_pullPhi.push_back(
dbe_->
book1D(
"pullPhi",
"pull of #phi parameter",250,-25,25) );
120 h_pullDxy.push_back(
dbe_->
book1D(
"pullDxy",
"pull of dxy parameter",250,-25,25) );
121 h_pullDz.push_back(
dbe_->
book1D(
"pullDz",
"pull of dz parameter",250,-25,25) );
122 h_pullQoverp.push_back(
dbe_->
book1D(
"pullQoverp",
"pull of qoverp parameter",250,-25,25) );
124 if (associators[ww]==
"TrackAssociatorByChi2"){
125 h_assochi2.push_back(
dbe_->
book1D(
"assocChi2",
"track association #chi^{2}",1000000,0,100000) );
126 h_assochi2_prob.push_back(
dbe_->
book1D(
"assocChi2_prob",
"probability of association #chi^{2}",100,0,1));
127 }
else if (associators[ww]==
"TrackAssociatorByHits"){
128 h_assocFraction.push_back(
dbe_->
book1D(
"assocFraction",
"fraction of shared hits",200,0,2) );
129 h_assocSharedHit.push_back(
dbe_->
book1D(
"assocSharedHit",
"number of shared hits",20,0,20));
132 chi2_vs_nhits.push_back(
dbe_->
book2D(
"chi2_vs_nhits",
"#chi^{2} vs nhits",25,0,25,100,0,10) );
133 h_chi2meanhitsh.push_back(
dbe_->
bookProfile(
"chi2mean_vs_nhits",
"mean #chi^{2} vs nhits",25,0,25,100,0,10) );
135 etares_vs_eta.push_back(
dbe_->
book2D(
"etares_vs_eta",
"etaresidue vs eta",
nint,
min,
max,200,-0.1,0.1) );
136 nrec_vs_nsim.push_back(
dbe_->
book2D(
"nrec_vs_nsim",
"nrec vs nsim",20,-0.5,19.5,20,-0.5,19.5) );
140 chi2_vs_phi.push_back(
dbe_->
book2D(
"chi2_vs_phi",
"#chi^{2} vs #phi",nintPhi,minPhi,maxPhi, 200, 0, 20 ) );
141 h_chi2mean_vs_phi.push_back(
dbe_->
bookProfile(
"chi2mean_vs_phi",
"mean of #chi^{2} vs #phi",nintPhi,minPhi,maxPhi, 200, 0, 20) );
143 nhits_vs_eta.push_back(
dbe_->
book2D(
"nhits_vs_eta",
"nhits vs eta",
nint,
min,
max,nintHit,minHit,maxHit) );
144 nDThits_vs_eta.push_back(
dbe_->
book2D(
"nDThits_vs_eta",
"# DT hits vs eta",
nint,
min,
max,nintHit,minHit,maxHit) );
145 nCSChits_vs_eta.push_back(
dbe_->
book2D(
"nCSChits_vs_eta",
"# CSC hits vs eta",
nint,
min,
max,nintHit,minHit,maxHit) );
146 nRPChits_vs_eta.push_back(
dbe_->
book2D(
"nRPChits_vs_eta",
"# RPC hits vs eta",
nint,
min,
max,nintHit,minHit,maxHit) );
152 nhits_vs_phi.push_back(
dbe_->
book2D(
"nhits_vs_phi",
"#hits vs #phi",nintPhi,minPhi,maxPhi,nintHit,minHit,maxHit) );
153 h_hits_phi.push_back(
dbe_->
bookProfile(
"hits_phi",
"mean #hits vs #phi",nintPhi,minPhi,maxPhi, nintHit,minHit,maxHit) );
155 nlosthits_vs_eta.push_back(
dbe_->
book2D(
"nlosthits_vs_eta",
"nlosthits vs eta",
nint,
min,
max,nintHit,minHit,maxHit) );
158 ptres_vs_eta.push_back(
dbe_->
book2D(
"ptres_vs_eta",
"ptres_vs_eta",
nint,
min,
max, ptRes_nbin, ptRes_rangeMin, ptRes_rangeMax));
159 ptres_vs_phi.push_back(
dbe_->
book2D(
"ptres_vs_phi",
"p_{t} res vs #phi",nintPhi,minPhi,maxPhi, ptRes_nbin, ptRes_rangeMin, ptRes_rangeMax));
160 ptres_vs_pt.push_back(
dbe_->
book2D(
"ptres_vs_pt",
"ptres_vs_pt",nintpT,minpT,maxpT, ptRes_nbin, ptRes_rangeMin, ptRes_rangeMax));
162 cotThetares_vs_eta.push_back(
dbe_->
book2D(
"cotThetares_vs_eta",
"cotThetares_vs_eta",
nint,
min,
max,cotThetaRes_nbin, cotThetaRes_rangeMin, cotThetaRes_rangeMax));
163 cotThetares_vs_pt.push_back(
dbe_->
book2D(
"cotThetares_vs_pt",
"cotThetares_vs_pt",nintpT,minpT,maxpT, cotThetaRes_nbin, cotThetaRes_rangeMin, cotThetaRes_rangeMax));
165 phires_vs_eta.push_back(
dbe_->
book2D(
"phires_vs_eta",
"phires_vs_eta",
nint,
min,
max, phiRes_nbin, phiRes_rangeMin, phiRes_rangeMax));
166 phires_vs_pt.push_back(
dbe_->
book2D(
"phires_vs_pt",
"phires_vs_pt",nintpT,minpT,maxpT, phiRes_nbin, phiRes_rangeMin, phiRes_rangeMax));
167 phires_vs_phi.push_back(
dbe_->
book2D(
"phires_vs_phi",
"#phi res vs #phi",nintPhi,minPhi,maxPhi,phiRes_nbin, phiRes_rangeMin, phiRes_rangeMax));
169 dxyres_vs_eta.push_back(
dbe_->
book2D(
"dxyres_vs_eta",
"dxyres_vs_eta",
nint,
min,
max,dxyRes_nbin, dxyRes_rangeMin, dxyRes_rangeMax));
170 dxyres_vs_pt.push_back(
dbe_->
book2D(
"dxyres_vs_pt",
"dxyres_vs_pt",nintpT,minpT,maxpT,dxyRes_nbin, dxyRes_rangeMin, dxyRes_rangeMax));
172 dzres_vs_eta.push_back(
dbe_->
book2D(
"dzres_vs_eta",
"dzres_vs_eta",
nint,
min,
max,dzRes_nbin, dzRes_rangeMin, dzRes_rangeMax));
173 dzres_vs_pt.push_back(
dbe_->
book2D(
"dzres_vs_pt",
"dzres_vs_pt",nintpT,minpT,maxpT,dzRes_nbin, dzRes_rangeMin, dzRes_rangeMax));
175 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));
176 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));
179 dxypull_vs_eta.push_back(
dbe_->
book2D(
"dxypull_vs_eta",
"dxypull_vs_eta",
nint,
min,
max,100,-10,10));
182 phipull_vs_eta.push_back(
dbe_->
book2D(
"phipull_vs_eta",
"phipull_vs_eta",
nint,
min,
max,100,-10,10));
183 thetapull_vs_eta.push_back(
dbe_->
book2D(
"thetapull_vs_eta",
"thetapull_vs_eta",
nint,
min,
max,100,-10,10));
186 ptpull_vs_phi.push_back(
dbe_->
book2D(
"ptpull_vs_phi",
"p_{t} pull vs #phi",nintPhi,minPhi,maxPhi,100,-10,10));
187 phipull_vs_phi.push_back(
dbe_->
book2D(
"phipull_vs_phi",
"#phi pull vs #phi",nintPhi,minPhi,maxPhi,100,-10,10));
188 thetapull_vs_phi.push_back(
dbe_->
book2D(
"thetapull_vs_phi",
"#theta pull vs #phi",nintPhi,minPhi,maxPhi,100,-10,10));
190 nrecHit_vs_nsimHit_sim2rec.push_back(
dbe_->
book2D(
"nrecHit_vs_nsimHit_sim2rec",
"nrecHit vs nsimHit (Sim2RecAssoc)",nintHit,minHit,maxHit, nintHit,minHit,maxHit ));
191 nrecHit_vs_nsimHit_rec2sim.push_back(
dbe_->
book2D(
"nrecHit_vs_nsimHit_rec2sim",
"nrecHit vs nsimHit (Rec2simAssoc)",nintHit,minHit,maxHit, nintHit,minHit,maxHit ));
194 h_PurityVsQuality.push_back(
dbe_->
book2D(
"PurityVsQuality",
"Purity vs Quality (MABH)",20,0.01,1.01,20,0.01,1.01) );
195 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) );
196 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) );
197 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) );
198 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) );
199 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) );
200 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) );
204 BinLogX(dzres_vs_pt[j]->
getTH2F());
205 BinLogX(dxyres_vs_pt[j]->
getTH2F());
206 BinLogX(phires_vs_pt[j]->
getTH2F());
207 BinLogX(cotThetares_vs_pt[j]->
getTH2F());
208 BinLogX(ptres_vs_pt[j]->
getTH2F());
209 BinLogX(h_recopT[j]->
getTH1F());
210 BinLogX(h_assocpT[j]->
getTH1F());
211 BinLogX(h_assoc2pT[j]->
getTH1F());
212 BinLogX(h_simulpT[j]->
getTH1F());
214 BinLogX(h_assocpT_Quality05[j]->
getTH1F());
215 BinLogX(h_assocpT_Quality075[j]->
getTH1F());
222 if (UseAssociators) {
224 for (
unsigned int w=0;
w<associators.size();
w++) {
226 associator.push_back( theAssociator.
product() );
232 using namespace reco;
234 edm::LogInfo(
"MuonTrackValidator") <<
"\n====================================================" <<
"\n"
235 <<
"Analyzing new event" <<
"\n"
236 <<
"====================================================\n" <<
"\n";
241 event.getByLabel(label_tp_effic,TPCollectionHeff);
245 event.getByLabel(label_tp_fake,TPCollectionHfake);
249 event.getByLabel(bsSrc,recoBeamSpotHandle);
253 for (
unsigned int ww=0;ww<associators.size();ww++){
254 for (
unsigned int www=0;www<
label.size();www++){
262 unsigned int trackCollectionSize = 0;
265 if(!event.
getByLabel(
label[www], trackCollection)&&ignoremissingtkcollection_) {
274 trackCollectionSize = trackCollection->size();
278 <<
label[www].process()<<
":"
279 <<
label[www].label()<<
":"
280 <<
label[www].instance()<<
" with "
281 << associators[ww].c_str() <<
"\n";
283 LogTrace(
"MuonTrackValidator") <<
"Calling associateRecoToSim method" <<
"\n";
284 recSimColl=associator[ww]->associateRecoToSim(trackCollection,
287 LogTrace(
"MuonTrackValidator") <<
"Calling associateSimToReco method" <<
"\n";
288 simRecColl=associator[ww]->associateSimToReco(trackCollection,
294 <<
label[www].process()<<
":"
295 <<
label[www].label()<<
":"
296 <<
label[www].instance()<<
" with "
297 << associatormap.process()<<
":"
298 << associatormap.label()<<
":"
299 << associatormap.instance()<<
"\n";
302 event.getByLabel(associatormap,simtorecoCollectionH);
303 simRecColl= *(simtorecoCollectionH.
product());
306 event.getByLabel(associatormap,recotosimCollectionH);
307 recSimColl= *(recotosimCollectionH.
product());
317 edm::LogVerbatim(
"MuonTrackValidator") <<
"\n# of TrackingParticles: " << tPCeff.size() <<
"\n";
321 bool TP_is_matched =
false;
323 bool Quality05 =
false;
324 bool Quality075 =
false;
334 if(parametersDefiner==
"LhcParametersDefinerForTP")
336 if(! tpSelector(*tp))
continue;
342 dxySim = (-vertex.x()*
sin(momentum.phi())+vertex.y()*
cos(momentum.phi()));
343 dzSim = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/
sqrt(momentum.perp2()) * momentum.z()/
sqrt(momentum.perp2());
346 if(parametersDefiner==
"CosmicParametersDefinerForTP")
348 if(! cosmictpSelector(tpr,&bs,event,setup))
continue;
349 momentumTP = parametersDefinerTP->momentum(event,setup,tpr);
350 vertexTP = parametersDefinerTP->vertex(event,setup,tpr);
351 dxySim = (-vertexTP.x()*
sin(momentumTP.phi())+vertexTP.y()*
cos(momentumTP.phi()));
352 dzSim = vertexTP.z() - (vertexTP.x()*momentumTP.x()+vertexTP.y()*momentumTP.y())/
sqrt(momentumTP.perp2()) * momentumTP.z()/
sqrt(momentumTP.perp2());
354 edm::LogVerbatim(
"MuonTrackValidator") <<
"--------------------Selected TrackingParticle #"<<tpr.
key();
357 h_ptSIM[
w]->Fill(
sqrt(momentumTP.perp2()));
358 h_etaSIM[
w]->Fill(momentumTP.eta());
359 h_vertposSIM[
w]->Fill(
sqrt(vertexTP.perp2()));
361 std::vector<std::pair<RefToBase<Track>,
double> > rt;
362 if(simRecColl.
find(tpr) != simRecColl.
end()){
363 rt = (std::vector<std::pair<RefToBase<Track>,
double> >) simRecColl[tpr];
366 edm::LogVerbatim(
"MuonTrackValidator")<<
"-----------------------------associated Track #"<<assoc_recoTrack.
key();
367 TP_is_matched =
true;
369 quality = rt.begin()->second;
371 <<
" with pt=" <<
sqrt(momentumTP.perp2())
372 <<
" associated with quality:" << quality <<
"\n";
374 if (quality > 0.75) {
378 else if (quality > 0.5) {
385 <<
"TrackingParticle #" << tpr.
key()
386 <<
" with pt,eta,phi: "
387 <<
sqrt(momentumTP.perp2()) <<
" , "
388 << momentumTP.eta() <<
" , "
389 << momentumTP.phi() <<
" , "
390 <<
" NOT associated to any reco::Track" <<
"\n";
393 for (
unsigned int f=0;
f<etaintervals[
w].size()-1;
f++){
394 if (getEta(momentumTP.eta())>etaintervals[
w][
f]&&
395 getEta(momentumTP.eta())<etaintervals[
w][
f+1]) {
402 totASSeta_Quality075[
w][
f]++;
403 totASSeta_Quality05[
w][
f]++;
405 else if (Quality05) {
406 totASSeta_Quality05[
w][
f]++;
413 for (
unsigned int f=0;
f<phiintervals[
w].size()-1;
f++){
414 if (momentumTP.phi() > phiintervals[
w][
f]&&
415 momentumTP.phi() <phiintervals[
w][
f+1]) {
422 totASS_phi_Quality075[
w][
f]++;
423 totASS_phi_Quality05[
w][
f]++;
425 else if (Quality05) {
426 totASS_phi_Quality05[
w][
f]++;
434 for (
unsigned int f=0;
f<pTintervals[
w].size()-1;
f++){
435 if (getPt(
sqrt(momentumTP.perp2()))>pTintervals[
w][
f]&&
436 getPt(
sqrt(momentumTP.perp2()))<pTintervals[
w][
f+1]) {
443 totASSpT_Quality075[
w][
f]++;
444 totASSpT_Quality05[
w][
f]++;
446 else if (Quality05) {
447 totASSpT_Quality05[
w][
f]++;
454 for (
unsigned int f=0;
f<dxyintervals[
w].size()-1;
f++){
455 if (dxySim>dxyintervals[
w][
f]&&
456 dxySim<dxyintervals[
w][
f+1]) {
464 for (
unsigned int f=0;
f<dzintervals[
w].size()-1;
f++){
465 if (dzSim>dzintervals[
w][
f]&&
466 dzSim<dzintervals[
w][
f+1]) {
474 for (
unsigned int f=0;
f<vertposintervals[
w].size()-1;
f++){
475 if (
sqrt(vertexTP.perp2())>vertposintervals[
w][
f]&&
476 sqrt(vertexTP.perp2())<vertposintervals[
w][
f+1]) {
477 totSIM_vertpos[
w][
f]++;
479 totASS_vertpos[
w][
f]++;
484 for (
unsigned int f=0;
f<zposintervals[
w].size()-1;
f++){
485 if (vertexTP.z()>zposintervals[
w][
f]&&
486 vertexTP.z()<zposintervals[
w][
f+1]) {
495 if (usetracker && usemuon) {
496 nSimHits= tpr.
get()->numberOfHits();
498 else if (!usetracker && usemuon) {
499 nSimHits= tpr.
get()->numberOfHits() - tpr.
get()->numberOfTrackerHits();
501 else if (usetracker && !usemuon) {
502 nSimHits=tpr.
get()->numberOfTrackerHits();
507 edm::LogVerbatim(
"MuonTrackValidator") <<
"\t N simhits = "<< nSimHits<<
"\n";
509 totSIM_hit[
w][
tmp]++;
510 if (TP_is_matched) totASS_hit[
w][
tmp]++;
518 if (st!=0) h_tracksSIM[
w]->Fill(st);
525 <<
label[www].process()<<
":"
526 <<
label[www].label()<<
":"
527 <<
label[www].instance()
528 <<
": " << trackCollectionSize <<
"\n";
532 bool Track_is_matched =
false;
536 std::vector<std::pair<TrackingParticleRef, double> > tp;
540 if (BiDirectional_RecoToSim_association) {
541 edm::LogVerbatim(
"MuonTrackValidator")<<
"----------------------------------------Track #"<< track.
key();
543 if(recSimColl.
find(track) != recSimColl.
end()) {
544 tp = recSimColl[track];
545 if (tp.size() != 0) {
546 tpr = tp.begin()->first;
548 if(simRecColl.
find(tpr) != simRecColl.
end()) {
549 std::vector<std::pair<RefToBase<Track>,
double> > track_checkback = simRecColl[tpr];
551 assoc_track_checkback = track_checkback.begin()->first;
553 if ( assoc_track_checkback.
key() == track.
key() ) {
554 edm::LogVerbatim(
"MuonTrackValidator")<<
"------------------associated TrackingParticle #"<<tpr.
key();
555 Track_is_matched =
true;
557 double Purity = tp.begin()->second;
558 double Quality = track_checkback.begin()->second;
559 edm::LogVerbatim(
"MuonTrackValidator") <<
"reco::Track #" << track.
key() <<
" with pt=" << track->
pt()
560 <<
" associated with quality:" << Purity <<
"\n";
561 if (MABH) h_PurityVsQuality[
w]->Fill(Quality,Purity);
568 <<
"reco::Track #" << track.
key() <<
" with pt=" << track->
pt() <<
" NOT associated to any TrackingParticle" <<
"\n";
572 if(recSimColl.
find(track) != recSimColl.
end()){
573 tp = recSimColl[track];
575 Track_is_matched =
true;
576 tpr = tp.begin()->first;
578 edm::LogVerbatim(
"MuonTrackValidator") <<
"reco::Track #" << track.
key() <<
" with pt=" << track->
pt()
579 <<
" associated with quality:" << tp.begin()->second <<
"\n";
582 edm::LogVerbatim(
"MuonTrackValidator") <<
"reco::Track #" << track.
key() <<
" with pt=" << track->
pt()
583 <<
" NOT associated to any TrackingParticle" <<
"\n";
588 for (
unsigned int f=0;
f<etaintervals[
w].size()-1;
f++){
589 if (getEta(track->
momentum().eta())>etaintervals[
w][
f]&&
590 getEta(track->
momentum().eta())<etaintervals[
w][
f+1]) {
592 if (Track_is_matched) {
598 for (
unsigned int f=0;
f<phiintervals[
w].size()-1;
f++){
599 if (track->
momentum().phi()>phiintervals[
w][
f]&&
600 track->
momentum().phi()<phiintervals[
w][
f+1]) {
602 if (Track_is_matched) {
609 for (
unsigned int f=0;
f<pTintervals[
w].size()-1;
f++){
613 if (Track_is_matched) {
619 for (
unsigned int f=0;
f<dxyintervals[
w].size()-1;
f++){
620 if (track->
dxy(bs.position())>dxyintervals[
w][
f]&&
621 track->
dxy(bs.position())<dxyintervals[
w][
f+1]) {
623 if (Track_is_matched) {
629 for (
unsigned int f=0;
f<dzintervals[
w].size()-1;
f++){
630 if (track->
dz(bs.position())>dzintervals[
w][
f]&&
631 track->
dz(bs.position())<dzintervals[
w][
f+1]) {
633 if (Track_is_matched) {
640 totREC_hit[
w][
tmp]++;
641 if (Track_is_matched) totASS2_hit[
w][
tmp]++;
647 if (!Track_is_matched)
continue;
649 if (associators[ww]==
"TrackAssociatorByChi2"){
651 double assocChi2 = -tp.begin()->second;
652 h_assochi2[www]->Fill(assocChi2);
653 h_assochi2_prob[www]->Fill(TMath::Prob((assocChi2)*5,5));
655 else if (associators[ww]==
"TrackAssociatorByHits"){
656 double fraction = tp.begin()->second;
657 h_assocFraction[www]->Fill(fraction);
663 h_nchi2_prob[
w]->Fill(TMath::Prob(track->
chi2(),(int)track->
ndof()));
667 h_charge[
w]->Fill( track->
charge() );
672 double ptSim =
sqrt(momentumTP.perp2());
673 double qoverpSim = tpr->charge()/
sqrt(momentumTP.x()*momentumTP.x()+momentumTP.y()*momentumTP.y()+momentumTP.z()*momentumTP.z());
674 double thetaSim = momentumTP.theta();
675 double lambdaSim =
M_PI/2-momentumTP.theta();
676 double phiSim = momentumTP.phi();
677 double dxySim = (-vertexTP.x()*
sin(momentumTP.phi())+vertexTP.y()*
cos(momentumTP.phi()));
678 double dzSim = vertexTP.z() - (vertexTP.x()*momentumTP.x()+vertexTP.y()*momentumTP.y())/
sqrt(momentumTP.perp2()) * momentumTP.z()/
sqrt(momentumTP.perp2());
684 double qoverpErrorRec(0);
686 double ptErrorRec(0);
688 double lambdaErrorRec(0);
690 double phiErrorRec(0);
696 gsfTrack =
dynamic_cast<const GsfTrack*
>(&(*track));
697 if (gsfTrack==0)
edm::LogInfo(
"MuonTrackValidator") <<
"Trying to access mode for a non-GsfTrack";
702 getRecoMomentum(*gsfTrack, ptRec, ptErrorRec, qoverpRec, qoverpErrorRec,
703 lambdaRec,lambdaErrorRec, phiRec, phiErrorRec);
708 getRecoMomentum(*track, ptRec, ptErrorRec, qoverpRec, qoverpErrorRec,
709 lambdaRec,lambdaErrorRec, phiRec, phiErrorRec);
712 double thetaRec = track->
theta();
713 double ptError = ptErrorRec;
714 double ptres = ptRec - ptSim;
715 double etares = track->
eta()-momentumTP.Eta();
716 double dxyRec = track->
dxy(bs.position());
717 double dzRec = track->
dz(bs.position());
719 double qoverpPull=(qoverpRec-qoverpSim)/qoverpErrorRec;
720 double thetaPull=(lambdaRec-lambdaSim)/lambdaErrorRec;
721 double phiDiff = phiRec - phiSim;
723 if (phiDiff >0.) phiDiff = phiDiff - 2.*
M_PI;
724 else phiDiff = phiDiff + 2.*
M_PI;
726 double phiPull=phiDiff/phiErrorRec;
727 double dxyPull=(dxyRec-dxySim)/track->
dxyError();
728 double dzPull=(dzRec-dzSim)/track->
dzError();
730 double contrib_Qoverp = ((qoverpRec-qoverpSim)/qoverpErrorRec)*
731 ((qoverpRec-qoverpSim)/qoverpErrorRec)/5;
732 double contrib_dxy = ((dxyRec-dxySim)/track->
dxyError())*((dxyRec-dxySim)/track->
dxyError())/5;
733 double contrib_dz = ((dzRec-dzSim)/track->
dzError())*((dzRec-dzSim)/track->
dzError())/5;
734 double contrib_theta = ((lambdaRec-lambdaSim)/lambdaErrorRec)*
735 ((lambdaRec-lambdaSim)/lambdaErrorRec)/5;
736 double contrib_phi = (phiDiff/phiErrorRec)*(phiDiff/phiErrorRec)/5;
738 LogTrace(
"MuonTrackValidator") <<
"assocChi2=" << tp.begin()->second <<
"\n"
740 <<
"ptREC=" << ptRec <<
"\n"
741 <<
"etaREC=" << track->
eta() <<
"\n"
742 <<
"qoverpREC=" << qoverpRec <<
"\n"
743 <<
"dxyREC=" << dxyRec <<
"\n"
744 <<
"dzREC=" << dzRec <<
"\n"
745 <<
"thetaREC=" << track->
theta() <<
"\n"
746 <<
"phiREC=" << phiRec <<
"\n"
748 <<
"qoverpError()=" << qoverpErrorRec <<
"\n"
749 <<
"dxyError()=" << track->
dxyError() <<
"\n"
750 <<
"dzError()=" << track->
dzError() <<
"\n"
751 <<
"thetaError()=" << lambdaErrorRec <<
"\n"
752 <<
"phiError()=" << phiErrorRec <<
"\n"
754 <<
"ptSIM=" << ptSim <<
"\n"
755 <<
"etaSIM=" << momentumTP.Eta() <<
"\n"
756 <<
"qoverpSIM=" << qoverpSim <<
"\n"
757 <<
"dxySIM=" << dxySim <<
"\n"
758 <<
"dzSIM=" << dzSim <<
"\n"
759 <<
"thetaSIM=" <<
M_PI/2-lambdaSim <<
"\n"
760 <<
"phiSIM=" << phiSim <<
"\n"
762 <<
"contrib_Qoverp=" << contrib_Qoverp <<
"\n"
763 <<
"contrib_dxy=" << contrib_dxy <<
"\n"
764 <<
"contrib_dz=" << contrib_dz <<
"\n"
765 <<
"contrib_theta=" << contrib_theta <<
"\n"
766 <<
"contrib_phi=" << contrib_phi <<
"\n"
768 <<
"chi2PULL="<<contrib_Qoverp+contrib_dxy+contrib_dz+contrib_theta+contrib_phi<<
"\n";
770 h_pullQoverp[
w]->Fill(qoverpPull);
771 h_pullTheta[
w]->Fill(thetaPull);
772 h_pullPhi[
w]->Fill(phiPull);
773 h_pullDxy[
w]->Fill(dxyPull);
774 h_pullDz[
w]->Fill(dzPull);
777 h_pt[
w]->Fill(ptres/ptError);
778 h_eta[
w]->Fill(etares);
779 etares_vs_eta[
w]->Fill(getEta(track->
eta()),etares);
792 dxyres_vs_eta[
w]->Fill(getEta(track->
eta()),dxyRec-dxySim);
793 ptres_vs_eta[
w]->Fill(getEta(track->
eta()),(ptRec-ptSim)/ptRec);
794 dzres_vs_eta[
w]->Fill(getEta(track->
eta()),dzRec-dzSim);
795 phires_vs_eta[
w]->Fill(getEta(track->
eta()),phiDiff);
796 cotThetares_vs_eta[
w]->Fill(getEta(track->
eta()),
cos(thetaRec)/
sin(thetaRec) -
cos(thetaSim)/
sin(thetaSim));
799 dxyres_vs_pt[
w]->Fill(getPt(ptRec),dxyRec-dxySim);
800 ptres_vs_pt[
w]->Fill(getPt(ptRec),(ptRec-ptSim)/ptRec);
801 dzres_vs_pt[
w]->Fill(getPt(ptRec),dzRec-dzSim);
802 phires_vs_pt[
w]->Fill(getPt(ptRec),phiDiff);
803 cotThetares_vs_pt[
w]->Fill(getPt(ptRec),
cos(thetaRec)/
sin(thetaRec) -
cos(thetaSim)/
sin(thetaSim));
806 dxypull_vs_eta[
w]->Fill(getEta(track->
eta()),dxyPull);
807 ptpull_vs_eta[
w]->Fill(getEta(track->
eta()),ptres/ptError);
808 dzpull_vs_eta[
w]->Fill(getEta(track->
eta()),dzPull);
809 phipull_vs_eta[
w]->Fill(getEta(track->
eta()),phiPull);
810 thetapull_vs_eta[
w]->Fill(getEta(track->
eta()),thetaPull);
815 ptmean_vs_eta_phi[
w]->Fill(phiRec,getEta(track->
eta()),ptRec);
816 phimean_vs_eta_phi[
w]->Fill(phiRec,getEta(track->
eta()),phiRec);
817 ptres_vs_phi[
w]->Fill(phiRec,(ptRec-ptSim)/ptRec);
818 phires_vs_phi[
w]->Fill(phiRec,phiDiff);
819 ptpull_vs_phi[
w]->Fill(phiRec,ptres/ptError);
820 phipull_vs_phi[
w]->Fill(phiRec,phiPull);
821 thetapull_vs_phi[
w]->Fill(phiRec,thetaPull);
824 if (usetracker && usemuon) {
825 nSimHits= tpr.
get()->numberOfHits();
827 else if (!usetracker && usemuon) {
828 nSimHits= tpr.
get()->numberOfHits() - tpr.
get()->numberOfTrackerHits();
830 else if (usetracker && !usemuon) {
831 nSimHits=tpr.
get()->numberOfTrackerHits();
838 LogTrace(
"MuonTrackValidator") <<
"exception found: " << e.
what() <<
"\n";
841 if (at!=0) h_tracks[
w]->Fill(at);
842 h_fakes[
w]->Fill(rT-at);
844 <<
"Total Associated (simToReco): " << ats <<
"\n"
845 <<
"Total Reconstructed: " << rT <<
"\n"
846 <<
"Total Associated (recoToSim): " << at <<
"\n"
847 <<
"Total Fakes: " << rT-at <<
"\n";
848 nrec_vs_nsim[
w]->Fill(rT,st);
857 for (
unsigned int ww=0;ww<associators.size();ww++){
858 for (
unsigned int www=0;www<
label.size();www++){
861 doProfileX(chi2_vs_eta[w],h_chi2meanh[w]);
862 doProfileX(nhits_vs_eta[w],h_hits_eta[w]);
863 doProfileX(nDThits_vs_eta[w],h_DThits_eta[w]);
864 doProfileX(nCSChits_vs_eta[w],h_CSChits_eta[w]);
865 doProfileX(nRPChits_vs_eta[w],h_RPChits_eta[w]);
867 doProfileX(nlosthits_vs_eta[w],h_losthits_eta[w]);
869 doProfileX(chi2_vs_nhits[w],h_chi2meanhitsh[w]);
870 doProfileX(chi2_vs_phi[w],h_chi2mean_vs_phi[w]);
871 doProfileX(nhits_vs_phi[w],h_hits_phi[w]);
873 fillPlotFromVector(h_recoeta[w],totRECeta[w]);
874 fillPlotFromVector(h_simuleta[w],totSIMeta[w]);
875 fillPlotFromVector(h_assoceta[w],totASSeta[w]);
876 fillPlotFromVector(h_assoc2eta[w],totASS2eta[w]);
878 fillPlotFromVector(h_recopT[w],totRECpT[w]);
879 fillPlotFromVector(h_simulpT[w],totSIMpT[w]);
880 fillPlotFromVector(h_assocpT[w],totASSpT[w]);
881 fillPlotFromVector(h_assoc2pT[w],totASS2pT[w]);
883 fillPlotFromVector(h_recohit[w],totREC_hit[w]);
884 fillPlotFromVector(h_simulhit[w],totSIM_hit[w]);
885 fillPlotFromVector(h_assochit[w],totASS_hit[w]);
886 fillPlotFromVector(h_assoc2hit[w],totASS2_hit[w]);
888 fillPlotFromVector(h_recophi[w],totREC_phi[w]);
889 fillPlotFromVector(h_simulphi[w],totSIM_phi[w]);
890 fillPlotFromVector(h_assocphi[w],totASS_phi[w]);
891 fillPlotFromVector(h_assoc2phi[w],totASS2_phi[w]);
893 fillPlotFromVector(h_recodxy[w],totREC_dxy[w]);
894 fillPlotFromVector(h_simuldxy[w],totSIM_dxy[w]);
895 fillPlotFromVector(h_assocdxy[w],totASS_dxy[w]);
896 fillPlotFromVector(h_assoc2dxy[w],totASS2_dxy[w]);
898 fillPlotFromVector(h_recodz[w],totREC_dz[w]);
899 fillPlotFromVector(h_simuldz[w],totSIM_dz[w]);
900 fillPlotFromVector(h_assocdz[w],totASS_dz[w]);
901 fillPlotFromVector(h_assoc2dz[w],totASS2_dz[w]);
903 fillPlotFromVector(h_simulvertpos[w],totSIM_vertpos[w]);
904 fillPlotFromVector(h_assocvertpos[w],totASS_vertpos[w]);
906 fillPlotFromVector(h_simulzpos[w],totSIM_zpos[w]);
907 fillPlotFromVector(h_assoczpos[w],totASS_zpos[w]);
910 fillPlotFromVector(h_assoceta_Quality05[w] ,totASSeta_Quality05[w]);
911 fillPlotFromVector(h_assoceta_Quality075[w],totASSeta_Quality075[w]);
912 fillPlotFromVector(h_assocpT_Quality05[w] ,totASSpT_Quality05[w]);
913 fillPlotFromVector(h_assocpT_Quality075[w],totASSpT_Quality075[w]);
914 fillPlotFromVector(h_assocphi_Quality05[w] ,totASS_phi_Quality05[w]);
915 fillPlotFromVector(h_assocphi_Quality075[w],totASS_phi_Quality075[w]);
928 double& qoverp,
double& qoverpError,
double& lambda,
double& lambdaError,
double&
phi,
double& phiError )
const {
942 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)
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.
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)
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
double lambda() const
Lambda angle.
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
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
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")