CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonTrackValidator.cc
Go to the documentation of this file.
3 
6 
22 
23 #include "TMath.h"
24 #include <TF1.h>
25 
26 using namespace std;
27 using namespace edm;
28 
29 void MuonTrackValidator::beginRun(Run const&, EventSetup const& setup) {
30 
31  // dbe_->showDirStructure();
32 
33  int j=0;
34  for (unsigned int ww=0;ww<associators.size();ww++){
35  for (unsigned int www=0;www<label.size();www++){
36 
37  dbe_->cd();
38  InputTag algo = label[www];
39  string dirName=dirName_;
40  if (algo.process()!="")
41  dirName+=algo.process()+"_";
42  if(algo.label()!="")
43  dirName+=algo.label()+"_";
44  if(algo.instance()!="")
45  dirName+=algo.instance()+"_";
46  if (dirName.find("Tracks")<dirName.length()){
47  dirName.replace(dirName.find("Tracks"),6,"");
48  }
49  string assoc= associators[ww];
50  if (assoc.find("Track")<assoc.length()){
51  assoc.replace(assoc.find("Track"),5,"");
52  }
53  dirName+=assoc;
54  std::replace(dirName.begin(), dirName.end(), ':', '_');
55  dbe_->setCurrentFolder(dirName.c_str());
56 
57  setUpVectors();
58 
59  dbe_->goUp();
60  string subDirName = dirName + "/simulation";
61  dbe_->setCurrentFolder(subDirName.c_str());
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.) );
66 
67  dbe_->cd();
68  dbe_->setCurrentFolder(dirName.c_str());
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));
76 
77  h_effic.push_back( dbe_->book1D("effic","efficiency vs #eta",nint,min,max) );
78  h_efficPt.push_back( dbe_->book1D("efficPt","efficiency vs pT",nintpT,minpT,maxpT) );
79  h_effic_vs_hit.push_back( dbe_->book1D("effic_vs_hit","effic vs hit",nintHit,minHit,maxHit) );
80  h_effic_vs_phi.push_back( dbe_->book1D("effic_vs_phi","effic vs phi",nintPhi,minPhi,maxPhi) );
81  h_effic_vs_dxy.push_back( dbe_->book1D("effic_vs_dxy","effic vs dxy",nintDxy,minDxy,maxDxy) );
82  h_effic_vs_dz.push_back( dbe_->book1D("effic_vs_dz","effic vs dz",nintDz,minDz,maxDz) );
83  h_effic_vs_vertpos.push_back( dbe_->book1D("effic_vs_vertpos","effic vs vertpos",nintVertpos,minVertpos,maxVertpos) );
84  h_effic_vs_zpos.push_back( dbe_->book1D("effic_vs_zpos","effic vs zpos",nintZpos,minZpos,maxZpos) );
85 
86  h_fakerate.push_back( dbe_->book1D("fakerate","fake rate vs #eta",nint,min,max) );
87  h_fakeratePt.push_back( dbe_->book1D("fakeratePt","fake rate vs pT",nintpT,minpT,maxpT) );
88  h_fake_vs_hit.push_back( dbe_->book1D("fakerate_vs_hit","fake rate vs hit",nintHit,minHit,maxHit) );
89  h_fake_vs_phi.push_back( dbe_->book1D("fakerate_vs_phi","fake vs phi",nintPhi,minPhi,maxPhi) );
90  h_fake_vs_dxy.push_back( dbe_->book1D("fakerate_vs_dxy","fake rate vs dxy",nintDxy,minDxy,maxDxy) );
91  h_fake_vs_dz.push_back( dbe_->book1D("fakerate_vs_dz","fake vs dz",nintDz,minDz,maxDz) );
92 
93 
95  h_recoeta.push_back( dbe_->book1D("num_reco_eta","N of reco track vs eta",nint,min,max) );
96  h_assoceta.push_back( dbe_->book1D("num_assoc(simToReco)_eta","N of associated tracks (simToReco) vs eta",nint,min,max) );
97  h_assoc2eta.push_back( dbe_->book1D("num_assoc(recoToSim)_eta","N of associated (recoToSim) tracks vs eta",nint,min,max) );
98  h_simuleta.push_back( dbe_->book1D("num_simul_eta","N of simulated tracks vs eta",nint,min,max) );
99  h_recopT.push_back( dbe_->book1D("num_reco_pT","N of reco track vs pT",nintpT,minpT,maxpT) );
100  h_assocpT.push_back( dbe_->book1D("num_assoc(simToReco)_pT","N of associated tracks (simToReco) vs pT",nintpT,minpT,maxpT) );
101  h_assoc2pT.push_back( dbe_->book1D("num_assoc(recoToSim)_pT","N of associated (recoToSim) tracks vs pT",nintpT,minpT,maxpT) );
102  h_simulpT.push_back( dbe_->book1D("num_simul_pT","N of simulated tracks vs pT",nintpT,minpT,maxpT) );
103  //
104  h_recohit.push_back( dbe_->book1D("num_reco_hit","N of reco track vs hit",nintHit,minHit,maxHit) );
105  h_assochit.push_back( dbe_->book1D("num_assoc(simToReco)_hit","N of associated tracks (simToReco) vs hit",nintHit,minHit,maxHit) );
106  h_assoc2hit.push_back( dbe_->book1D("num_assoc(recoToSim)_hit","N of associated (recoToSim) tracks vs hit",nintHit,minHit,maxHit) );
107  h_simulhit.push_back( dbe_->book1D("num_simul_hit","N of simulated tracks vs hit",nintHit,minHit,maxHit) );
108  //
109  h_recophi.push_back( dbe_->book1D("num_reco_phi","N of reco track vs phi",nintPhi,minPhi,maxPhi) );
110  h_assocphi.push_back( dbe_->book1D("num_assoc(simToReco)_phi","N of associated tracks (simToReco) vs phi",nintPhi,minPhi,maxPhi) );
111  h_assoc2phi.push_back( dbe_->book1D("num_assoc(recoToSim)_phi","N of associated (recoToSim) tracks vs phi",nintPhi,minPhi,maxPhi) );
112  h_simulphi.push_back( dbe_->book1D("num_simul_phi","N of simulated tracks vs phi",nintPhi,minPhi,maxPhi) );
113 
114  h_recodxy.push_back( dbe_->book1D("num_reco_dxy","N of reco track vs dxy",nintDxy,minDxy,maxDxy) );
115  h_assocdxy.push_back( dbe_->book1D("num_assoc(simToReco)_dxy","N of associated tracks (simToReco) vs dxy",nintDxy,minDxy,maxDxy) );
116  h_assoc2dxy.push_back( dbe_->book1D("num_assoc(recoToSim)_dxy","N of associated (recoToSim) tracks vs dxy",nintDxy,minDxy,maxDxy) );
117  h_simuldxy.push_back( dbe_->book1D("num_simul_dxy","N of simulated tracks vs dxy",nintDxy,minDxy,maxDxy) );
118 
119  h_recodz.push_back( dbe_->book1D("num_reco_dz","N of reco track vs dz",nintDz,minDz,maxDz) );
120  h_assocdz.push_back( dbe_->book1D("num_assoc(simToReco)_dz","N of associated tracks (simToReco) vs dz",nintDz,minDz,maxDz) );
121  h_assoc2dz.push_back( dbe_->book1D("num_assoc(recoToSim)_dz","N of associated (recoToSim) tracks vs dz",nintDz,minDz,maxDz) );
122  h_simuldz.push_back( dbe_->book1D("num_simul_dz","N of simulated tracks vs dz",nintDz,minDz,maxDz) );
123 
124  h_assocvertpos.push_back( dbe_->book1D("num_assoc(simToReco)_vertpos","N of associated tracks (simToReco) vs transverse vert position",nintVertpos,minVertpos,maxVertpos) );
125  h_simulvertpos.push_back( dbe_->book1D("num_simul_vertpos","N of simulated tracks vs transverse vert position",nintVertpos,minVertpos,maxVertpos) );
126 
127  h_assoczpos.push_back( dbe_->book1D("num_assoc(simToReco)_zpos","N of associated tracks (simToReco) vs z vert position",nintZpos,minZpos,maxZpos) );
128  h_simulzpos.push_back( dbe_->book1D("num_simul_zpos","N of simulated tracks vs z vert position",nintZpos,minZpos,maxZpos) );
129 
130 
132 
133  h_eta.push_back( dbe_->book1D("eta", "pseudorapidity residue", 1000, -0.1, 0.1 ) );
134  h_pt.push_back( dbe_->book1D("pullPt", "pull of p_{t}", 100, -10, 10 ) );
135  h_pullTheta.push_back( dbe_->book1D("pullTheta","pull of #theta parameter",250,-25,25) );
136  h_pullPhi.push_back( dbe_->book1D("pullPhi","pull of #phi parameter",250,-25,25) );
137  h_pullDxy.push_back( dbe_->book1D("pullDxy","pull of dxy parameter",250,-25,25) );
138  h_pullDz.push_back( dbe_->book1D("pullDz","pull of dz parameter",250,-25,25) );
139  h_pullQoverp.push_back( dbe_->book1D("pullQoverp","pull of qoverp parameter",250,-25,25) );
140 
141  if (associators[ww]=="TrackAssociatorByChi2"){
142  h_assochi2.push_back( dbe_->book1D("assocChi2","track association #chi^{2}",1000000,0,100000) );
143  h_assochi2_prob.push_back(dbe_->book1D("assocChi2_prob","probability of association #chi^{2}",100,0,1));
144  } else if (associators[ww]=="TrackAssociatorByHits"){
145  h_assocFraction.push_back( dbe_->book1D("assocFraction","fraction of shared hits",200,0,2) );
146  h_assocSharedHit.push_back(dbe_->book1D("assocSharedHit","number of shared hits",20,0,20));
147  }
148 
149  chi2_vs_nhits.push_back( dbe_->book2D("chi2_vs_nhits","#chi^{2} vs nhits",25,0,25,100,0,10) );
150  h_chi2meanhitsh.push_back( dbe_->bookProfile("chi2mean_vs_nhits","mean #chi^{2} vs nhits",25,0,25,100,0,10) );
151 
152  etares_vs_eta.push_back( dbe_->book2D("etares_vs_eta","etaresidue vs eta",nint,min,max,200,-0.1,0.1) );
153  nrec_vs_nsim.push_back( dbe_->book2D("nrec_vs_nsim","nrec vs nsim",20,-0.5,19.5,20,-0.5,19.5) );
154 
155  chi2_vs_eta.push_back( dbe_->book2D("chi2_vs_eta","chi2_vs_eta",nint,min,max, 200, 0, 20 ));
156  h_chi2meanh.push_back( dbe_->bookProfile("chi2mean","mean #chi^{2} vs #eta",nint,min,max, 200, 0, 20) );
157  chi2_vs_phi.push_back( dbe_->book2D("chi2_vs_phi","#chi^{2} vs #phi",nintPhi,minPhi,maxPhi, 200, 0, 20 ) );
158  h_chi2mean_vs_phi.push_back( dbe_->bookProfile("chi2mean_vs_phi","mean of #chi^{2} vs #phi",nintPhi,minPhi,maxPhi, 200, 0, 20) );
159 
160  nhits_vs_eta.push_back( dbe_->book2D("nhits_vs_eta","nhits vs eta",nint,min,max,nintHit,minHit,maxHit) );
161  nDThits_vs_eta.push_back( dbe_->book2D("nDThits_vs_eta","# DT hits vs eta",nint,min,max,nintHit,minHit,maxHit) );
162  nCSChits_vs_eta.push_back( dbe_->book2D("nCSChits_vs_eta","# CSC hits vs eta",nint,min,max,nintHit,minHit,maxHit) );
163  nRPChits_vs_eta.push_back( dbe_->book2D("nRPChits_vs_eta","# RPC hits vs eta",nint,min,max,nintHit,minHit,maxHit) );
164 
165  h_DThits_eta.push_back( dbe_->bookProfile("DThits_eta","mean # DT hits vs eta",nint,min,max,nintHit,minHit,maxHit) );
166  h_CSChits_eta.push_back( dbe_->bookProfile("CSChits_eta","mean # CSC hits vs eta",nint,min,max,nintHit,minHit,maxHit) );
167  h_RPChits_eta.push_back( dbe_->bookProfile("RPChits_eta","mean # RPC hits vs eta",nint,min,max,nintHit,minHit,maxHit) );
168  h_hits_eta.push_back( dbe_->bookProfile("hits_eta","mean #hits vs eta",nint,min,max,nintHit,minHit,maxHit) );
169  nhits_vs_phi.push_back( dbe_->book2D("nhits_vs_phi","#hits vs #phi",nintPhi,minPhi,maxPhi,nintHit,minHit,maxHit) );
170  h_hits_phi.push_back( dbe_->bookProfile("hits_phi","mean #hits vs #phi",nintPhi,minPhi,maxPhi, nintHit,minHit,maxHit) );
171 
172  nlosthits_vs_eta.push_back( dbe_->book2D("nlosthits_vs_eta","nlosthits vs eta",nint,min,max,nintHit,minHit,maxHit) );
173  h_losthits_eta.push_back( dbe_->bookProfile("losthits_eta","losthits_eta",nint,min,max,nintHit,minHit,maxHit) );
174 
175  ptres_vs_eta.push_back(dbe_->book2D("ptres_vs_eta","ptres_vs_eta",nint,min,max, ptRes_nbin, ptRes_rangeMin, ptRes_rangeMax));
176  h_ptrmsh.push_back( dbe_->book1D("ptres_vs_eta_Sigma","#sigma(#deltap_{t}/p_{t}) vs #eta",nint,min,max) );
177 
178  ptres_vs_phi.push_back( dbe_->book2D("ptres_vs_phi","p_{t} res vs #phi",nintPhi,minPhi,maxPhi, ptRes_nbin, ptRes_rangeMin, ptRes_rangeMax));
179  h_ptmeanhPhi.push_back( dbe_->book1D("ptres_vs_phi_Mean","mean of p_{t} resolution vs #phi",nintPhi,minPhi,maxPhi));
180  h_ptrmshPhi.push_back( dbe_->book1D("ptres_vs_phi_Sigma","#sigma(#deltap_{t}/p_{t}) vs #phi",nintPhi,minPhi,maxPhi) );
181 
182  ptres_vs_pt.push_back(dbe_->book2D("ptres_vs_pt","ptres_vs_pt",nintpT,minpT,maxpT, ptRes_nbin, ptRes_rangeMin, ptRes_rangeMax));
183  h_ptmeanhPt.push_back( dbe_->book1D("ptres_vs_pt_Mean","mean of p_{t} resolution vs p_{t}",nintpT,minpT,maxpT));
184  h_ptrmshPt.push_back( dbe_->book1D("ptres_vs_pt_Sigma","#sigma(#deltap_{t}/p_{t}) vs pT",nintpT,minpT,maxpT) );
185 
186  cotThetares_vs_eta.push_back(dbe_->book2D("cotThetares_vs_eta","cotThetares_vs_eta",nint,min,max,cotThetaRes_nbin, cotThetaRes_rangeMin, cotThetaRes_rangeMax));
187  h_cotThetameanh.push_back( dbe_->book1D("cotThetares_vs_eta_Mean","#sigma(cot(#theta)) vs #eta Mean",nint,min,max) );
188  h_cotThetarmsh.push_back( dbe_->book1D("cotThetares_vs_eta_Sigma","#sigma(cot(#theta)) vs #eta Sigma",nint,min,max) );
189 
190 
191  cotThetares_vs_pt.push_back(dbe_->book2D("cotThetares_vs_pt","cotThetares_vs_pt",nintpT,minpT,maxpT, cotThetaRes_nbin, cotThetaRes_rangeMin, cotThetaRes_rangeMax));
192  h_cotThetameanhPt.push_back( dbe_->book1D("cotThetares_vs_pt_Mean","#sigma(cot(#theta)) vs pT Mean",nintpT,minpT,maxpT) );
193  h_cotThetarmshPt.push_back( dbe_->book1D("cotThetares_vs_pt_Sigma","#sigma(cot(#theta)) vs pT Sigma",nintpT,minpT,maxpT) );
194 
195 
196  phires_vs_eta.push_back(dbe_->book2D("phires_vs_eta","phires_vs_eta",nint,min,max, phiRes_nbin, phiRes_rangeMin, phiRes_rangeMax));
197  h_phimeanh.push_back(dbe_->book1D("phires_vs_eta_Mean","mean of #phi res vs #eta",nint,min,max));
198  h_phirmsh.push_back( dbe_->book1D("phires_vs_eta_Sigma","#sigma(#delta#phi) vs #eta",nint,min,max) );
199 
200  phires_vs_pt.push_back(dbe_->book2D("phires_vs_pt","phires_vs_pt",nintpT,minpT,maxpT, phiRes_nbin, phiRes_rangeMin, phiRes_rangeMax));
201  h_phimeanhPt.push_back(dbe_->book1D("phires_vs_pt_Mean","mean of #phi res vs pT",nintpT,minpT,maxpT));
202  h_phirmshPt.push_back( dbe_->book1D("phires_vs_pt_Sigma","#sigma(#delta#phi) vs pT",nintpT,minpT,maxpT) );
203 
204  phires_vs_phi.push_back(dbe_->book2D("phires_vs_phi","#phi res vs #phi",nintPhi,minPhi,maxPhi,phiRes_nbin, phiRes_rangeMin, phiRes_rangeMax));
205  h_phimeanhPhi.push_back(dbe_->book1D("phires_vs_phi_Mean","mean of #phi res vs #phi",nintPhi,minPhi,maxPhi));
206  h_phirmshPhi.push_back( dbe_->book1D("phires_vs_phi_Sigma","#sigma(#delta#phi) vs #phi",nintPhi,minPhi,maxPhi) );
207 
208  dxyres_vs_eta.push_back(dbe_->book2D("dxyres_vs_eta","dxyres_vs_eta",nint,min,max,dxyRes_nbin, dxyRes_rangeMin, dxyRes_rangeMax));
209  h_dxymeanh.push_back( dbe_->book1D("dxyres_vs_eta_Mean","mean of dxyres vs #eta",nint,min,max) );
210  h_dxyrmsh.push_back( dbe_->book1D("dxyres_vs_eta_Sigma","#sigma(#deltadxy) vs #eta",nint,min,max) );
211 
212  dxyres_vs_pt.push_back( dbe_->book2D("dxyres_vs_pt","dxyres_vs_pt",nintpT,minpT,maxpT,dxyRes_nbin, dxyRes_rangeMin, dxyRes_rangeMax));
213  h_dxymeanhPt.push_back( dbe_->book1D("dxyres_vs_pt_Mean","mean of dxyres vs pT",nintpT,minpT,maxpT) );
214  h_dxyrmshPt.push_back( dbe_->book1D("dxyres_vs_pt_Sigma","#sigmadxy vs pT",nintpT,minpT,maxpT) );
215 
216  dzres_vs_eta.push_back(dbe_->book2D("dzres_vs_eta","dzres_vs_eta",nint,min,max,dzRes_nbin, dzRes_rangeMin, dzRes_rangeMax));
217  h_dzmeanh.push_back( dbe_->book1D("dzres_vs_eta_Mean","mean of dzres vs #eta",nint,min,max) );
218  h_dzrmsh.push_back( dbe_->book1D("dzres_vs_eta_Sigma","#sigma(#deltadz) vs #eta",nint,min,max) );
219 
220  dzres_vs_pt.push_back(dbe_->book2D("dzres_vs_pt","dzres_vs_pt",nintpT,minpT,maxpT,dzRes_nbin, dzRes_rangeMin, dzRes_rangeMax));
221  h_dzmeanhPt.push_back( dbe_->book1D("dzres_vs_pt_Mean","mean of dzres vs pT",nintpT,minpT,maxpT) );
222  h_dzrmshPt.push_back( dbe_->book1D("dzres_vs_pt_Sigma","#sigma(#deltadz vs pT",nintpT,minpT,maxpT) );
223 
224  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));
225  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));
226 
227  //pulls of track params vs eta: to be used with fitslicesytool
228  dxypull_vs_eta.push_back(dbe_->book2D("dxypull_vs_eta","dxypull_vs_eta",nint,min,max,100,-10,10));
229  ptpull_vs_eta.push_back(dbe_->book2D("ptpull_vs_eta","ptpull_vs_eta",nint,min,max,100,-10,10));
230  dzpull_vs_eta.push_back(dbe_->book2D("dzpull_vs_eta","dzpull_vs_eta",nint,min,max,100,-10,10));
231  phipull_vs_eta.push_back(dbe_->book2D("phipull_vs_eta","phipull_vs_eta",nint,min,max,100,-10,10));
232  thetapull_vs_eta.push_back(dbe_->book2D("thetapull_vs_eta","thetapull_vs_eta",nint,min,max,100,-10,10));
233 
234  h_dxypulletamean.push_back( dbe_->book1D("h_dxypulleta_Mean","mean of dxy pull vs #eta",nint,min,max) );
235  h_ptpulletamean.push_back( dbe_->book1D("h_ptpulleta_Mean","mean of p_{t} pull vs #eta",nint,min,max) );
236  h_dzpulletamean.push_back( dbe_->book1D("h_dzpulleta_Mean","mean of dz pull vs #eta",nint,min,max) );
237  h_phipulletamean.push_back( dbe_->book1D("h_phipulleta_Mean","mean of #phi pull vs #eta",nint,min,max) );
238  h_thetapulletamean.push_back( dbe_->book1D("h_thetapulleta_Mean","mean of #theta pull vs #eta",nint,min,max) );
239  // h_ptshiftetamean.push_back( dbe_->book1D("h_ptshifteta_Mean","<#deltapT/pT>[%] vs #eta",nint,min,max) );
240 
241  h_dxypulleta.push_back( dbe_->book1D("h_dxypulleta_Sigma","#sigma of dxy pull vs #eta",nint,min,max) );
242  h_ptpulleta.push_back( dbe_->book1D("h_ptpulleta_Sigma","#sigma of p_{t} pull vs #eta",nint,min,max) );
243  h_dzpulleta.push_back( dbe_->book1D("h_dzpulleta_Sigma","#sigma of dz pull vs #eta",nint,min,max) );
244  h_phipulleta.push_back( dbe_->book1D("h_phipulleta_Sigma","#sigma of #phi pull vs #eta",nint,min,max) );
245  h_thetapulleta.push_back( dbe_->book1D("h_thetapulleta_Sigma","#sigma of #theta pull vs #eta",nint,min,max) );
246  h_ptshifteta.push_back( dbe_->book1D("ptres_vs_eta_Mean","<#deltapT/pT>[%] vs #eta",nint,min,max) );
247 
248  //pulls of track params vs phi
249  ptpull_vs_phi.push_back(dbe_->book2D("ptpull_vs_phi","p_{t} pull vs #phi",nintPhi,minPhi,maxPhi,100,-10,10));
250  phipull_vs_phi.push_back(dbe_->book2D("phipull_vs_phi","#phi pull vs #phi",nintPhi,minPhi,maxPhi,100,-10,10));
251  thetapull_vs_phi.push_back(dbe_->book2D("thetapull_vs_phi","#theta pull vs #phi",nintPhi,minPhi,maxPhi,100,-10,10));
252 
253  h_ptpullphimean.push_back( dbe_->book1D("h_ptpullphi_Mean","mean of p_{t} pull vs #phi",nintPhi,minPhi,maxPhi) );
254  h_phipullphimean.push_back( dbe_->book1D("h_phipullphi_Mean","mean of #phi pull vs #phi",nintPhi,minPhi,maxPhi) );
255  h_thetapullphimean.push_back( dbe_->book1D("h_thetapullphi_Mean","mean of #theta pull vs #phi",nintPhi,minPhi,maxPhi) );
256 
257  h_ptpullphi.push_back( dbe_->book1D("h_ptpullphi_Sigma","#sigma of p_{t} pull vs #phi",nintPhi,minPhi,maxPhi) );
258  h_phipullphi.push_back( dbe_->book1D("h_phipullphi_Sigma","#sigma of #phi pull vs #phi",nintPhi,minPhi,maxPhi) );
259  h_thetapullphi.push_back( dbe_->book1D("h_thetapullphi_Sigma","#sigma of #theta pull vs #phi",nintPhi,minPhi,maxPhi) );
260 
261 
262  nrecHit_vs_nsimHit_sim2rec.push_back( dbe_->book2D("nrecHit_vs_nsimHit_sim2rec","nrecHit vs nsimHit (Sim2RecAssoc)",nintHit,minHit,maxHit, nintHit,minHit,maxHit ));
263  nrecHit_vs_nsimHit_rec2sim.push_back( dbe_->book2D("nrecHit_vs_nsimHit_rec2sim","nrecHit vs nsimHit (Rec2simAssoc)",nintHit,minHit,maxHit, nintHit,minHit,maxHit ));
264 
265  if (MABH) {
266  h_PurityVsQuality.push_back( dbe_->book2D("PurityVsQuality","Purity vs Quality (MABH)",20,0.01,1.01,20,0.01,1.01) );
267  h_effic_Quality05.push_back( dbe_->book1D("effic_Q05","efficiency vs #eta (Quality>0.5)",nint,min,max) );
268  h_effic_Quality075.push_back( dbe_->book1D("effic_Q075","efficiency vs #eta (Quality>0.75)",nint,min,max) );
269  h_efficPt_Quality05.push_back( dbe_->book1D("efficPt_Q05","efficiency vs pT (Quality>0.5)",nintpT,minpT,maxpT) );
270  h_efficPt_Quality075.push_back( dbe_->book1D("efficPt_Q075","efficiency vs pT (Quality>0.75)",nintpT,minpT,maxpT) );
271  h_effic_vs_phi_Quality05.push_back( dbe_->book1D("effic_vs_phi_Q05","effic vs phi (Quality>0.5)",nintPhi,minPhi,maxPhi) );
272  h_effic_vs_phi_Quality075.push_back( dbe_->book1D("effic_vs_phi_Q075","effic vs phi (Quality>0.75)",nintPhi,minPhi,maxPhi) );
273  //
274  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) );
275  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) );
276  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) );
277  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) );
278  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) );
279  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) );
280  }
281 
282  if(useLogPt){
283  BinLogX(dzres_vs_pt[j]->getTH2F());
284  BinLogX(h_dzmeanhPt[j]->getTH1F());
285  BinLogX(h_dzrmshPt[j]->getTH1F());
286 
287  BinLogX(dxyres_vs_pt[j]->getTH2F());
288  BinLogX(h_dxymeanhPt[j]->getTH1F());
289  BinLogX(h_dxyrmshPt[j]->getTH1F());
290 
291  BinLogX(phires_vs_pt[j]->getTH2F());
292  BinLogX(h_phimeanhPt[j]->getTH1F());
293  BinLogX(h_phirmshPt[j]->getTH1F());
294 
295  BinLogX(cotThetares_vs_pt[j]->getTH2F());
296  BinLogX(h_cotThetameanhPt[j]->getTH1F());
297  BinLogX(h_cotThetarmshPt[j]->getTH1F());
298 
299  BinLogX(ptres_vs_pt[j]->getTH2F());
300  BinLogX(h_ptmeanhPt[j]->getTH1F());
301  BinLogX(h_ptrmshPt[j]->getTH1F());
302 
303  BinLogX(h_efficPt[j]->getTH1F());
304  BinLogX(h_fakeratePt[j]->getTH1F());
305  BinLogX(h_recopT[j]->getTH1F());
306  BinLogX(h_assocpT[j]->getTH1F());
307  BinLogX(h_assoc2pT[j]->getTH1F());
308  BinLogX(h_simulpT[j]->getTH1F());
309 
310  if (MABH)
311  {
312  BinLogX(h_efficPt_Quality05[j]->getTH1F());
313  BinLogX(h_efficPt_Quality075[j]->getTH1F());
314  //
315  BinLogX(h_assocpT_Quality05[j]->getTH1F());
316  BinLogX(h_assocpT_Quality075[j]->getTH1F());
317  }
318 
319  j++;
320  }
321  }
322  }
323  if (UseAssociators) {
325  for (unsigned int w=0;w<associators.size();w++) {
326  setup.get<TrackAssociatorRecord>().get(associators[w],theAssociator);
327  associator.push_back( theAssociator.product() );
328  }
329  }
330 }
331 
333  using namespace reco;
334 
335  edm::LogInfo("MuonTrackValidator") << "\n====================================================" << "\n"
336  << "Analyzing new event" << "\n"
337  << "====================================================\n" << "\n";
338  edm::ESHandle<ParametersDefinerForTP> parametersDefinerTP;
339  setup.get<TrackAssociatorRecord>().get(parametersDefiner,parametersDefinerTP);
340 
341  edm::Handle<TrackingParticleCollection> TPCollectionHeff ;
342  event.getByLabel(label_tp_effic,TPCollectionHeff);
343  const TrackingParticleCollection tPCeff = *(TPCollectionHeff.product());
344 
345  edm::Handle<TrackingParticleCollection> TPCollectionHfake ;
346  event.getByLabel(label_tp_fake,TPCollectionHfake);
347  const TrackingParticleCollection tPCfake = *(TPCollectionHfake.product());
348 
349  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
350  event.getByLabel(bsSrc,recoBeamSpotHandle);
351  reco::BeamSpot bs = *recoBeamSpotHandle;
352 
353  int w=0;
354  for (unsigned int ww=0;ww<associators.size();ww++){
355  for (unsigned int www=0;www<label.size();www++){
356  //
357  //get collections from the event
358  //
360 
361  reco::RecoToSimCollection recSimColl;
362  reco::SimToRecoCollection simRecColl;
363  unsigned int trackCollectionSize = 0;
364 
365  // if(!event.getByLabel(label[www], trackCollection)&&ignoremissingtkcollection_) continue;
366  if(!event.getByLabel(label[www], trackCollection)&&ignoremissingtkcollection_) {
367 
368  recSimColl.post_insert();
369  simRecColl.post_insert();
370 
371  }
372 
373  else {
374 
375  trackCollectionSize = trackCollection->size();
376  //associate tracks
377  if(UseAssociators){
378  edm::LogVerbatim("MuonTrackValidator") << "Analyzing "
379  << label[www].process()<<":"
380  << label[www].label()<<":"
381  << label[www].instance()<<" with "
382  << associators[ww].c_str() <<"\n";
383 
384  LogTrace("MuonTrackValidator") << "Calling associateRecoToSim method" << "\n";
385  recSimColl=associator[ww]->associateRecoToSim(trackCollection,
386  TPCollectionHfake,
387  &event);
388  LogTrace("MuonTrackValidator") << "Calling associateSimToReco method" << "\n";
389  simRecColl=associator[ww]->associateSimToReco(trackCollection,
390  TPCollectionHeff,
391  &event);
392  }
393  else{
394  edm::LogVerbatim("MuonTrackValidator") << "Analyzing "
395  << label[www].process()<<":"
396  << label[www].label()<<":"
397  << label[www].instance()<<" with "
398  << associatormap.process()<<":"
399  << associatormap.label()<<":"
400  << associatormap.instance()<<"\n";
401 
402  Handle<reco::SimToRecoCollection > simtorecoCollectionH;
403  event.getByLabel(associatormap,simtorecoCollectionH);
404  simRecColl= *(simtorecoCollectionH.product());
405 
406  Handle<reco::RecoToSimCollection > recotosimCollectionH;
407  event.getByLabel(associatormap,recotosimCollectionH);
408  recSimColl= *(recotosimCollectionH.product());
409  }
410 
411  }
412 
413 
414  //
415  //fill simulation histograms
416  //compute number of tracks per eta interval
417  //
418  edm::LogVerbatim("MuonTrackValidator") << "\n# of TrackingParticles: " << tPCeff.size() << "\n";
419  int ats = 0;
420  int st=0;
421  for (TrackingParticleCollection::size_type i=0; i<tPCeff.size(); i++){
422  bool TP_is_matched = false;
423  double quality = 0.;
424  bool Quality05 = false;
425  bool Quality075 = false;
426 
427  TrackingParticleRef tpr(TPCollectionHeff, i);
428  TrackingParticle* tp=const_cast<TrackingParticle*>(tpr.get());
429  ParticleBase::Vector momentumTP;
430  ParticleBase::Point vertexTP;
431  double dxySim = 0;
432  double dzSim = 0;
433 
434  //If the TrackingParticle is collison like, get the momentum and vertex at production state
435  if(parametersDefiner=="LhcParametersDefinerForTP")
436  {
437  if(! tpSelector(*tp)) continue;
438  momentumTP = tp->momentum();
439  vertexTP = tp->vertex();
440  //Calcualte the impact parameters w.r.t. PCA
441  ParticleBase::Vector momentum = parametersDefinerTP->momentum(event,setup,*tp);
442  ParticleBase::Point vertex = parametersDefinerTP->vertex(event,setup,*tp);
443  dxySim = (-vertex.x()*sin(momentum.phi())+vertex.y()*cos(momentum.phi()));
444  dzSim = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/sqrt(momentum.perp2()) * momentum.z()/sqrt(momentum.perp2());
445  }
446  //If the TrackingParticle is comics, get the momentum and vertex at PCA
447  if(parametersDefiner=="CosmicParametersDefinerForTP")
448  {
449  if(! cosmictpSelector(*tp,&bs,event,setup)) continue;
450  momentumTP = parametersDefinerTP->momentum(event,setup,*tp);
451  vertexTP = parametersDefinerTP->vertex(event,setup,*tp);
452  dxySim = (-vertexTP.x()*sin(momentumTP.phi())+vertexTP.y()*cos(momentumTP.phi()));
453  dzSim = vertexTP.z() - (vertexTP.x()*momentumTP.x()+vertexTP.y()*momentumTP.y())/sqrt(momentumTP.perp2()) * momentumTP.z()/sqrt(momentumTP.perp2());
454  }
455  edm::LogVerbatim("MuonTrackValidator") <<"--------------------Selected TrackingParticle #"<<tpr.key();
456  st++;
457 
458  h_ptSIM[w]->Fill(sqrt(momentumTP.perp2()));
459  h_etaSIM[w]->Fill(momentumTP.eta());
460  h_vertposSIM[w]->Fill(sqrt(vertexTP.perp2()));
461 
462  std::vector<std::pair<RefToBase<Track>, double> > rt;
463  if(simRecColl.find(tpr) != simRecColl.end()){
464  rt = (std::vector<std::pair<RefToBase<Track>, double> >) simRecColl[tpr];
465  if (rt.size()!=0) {
466  RefToBase<Track> assoc_recoTrack = rt.begin()->first;
467  edm::LogVerbatim("MuonTrackValidator")<<"-----------------------------associated Track #"<<assoc_recoTrack.key();
468  TP_is_matched = true;
469  ats++;
470  quality = rt.begin()->second;
471  edm::LogVerbatim("MuonTrackValidator") << "TrackingParticle #" <<tpr.key()
472  << " with pt=" << sqrt(momentumTP.perp2())
473  << " associated with quality:" << quality <<"\n";
474  if (MABH) {
475  if (quality > 0.75) {
476  Quality075 = true;
477  Quality05 = true;
478  }
479  else if (quality > 0.5) {
480  Quality05 = true;
481  }
482  }
483  }
484  }else{
485  edm::LogVerbatim("MuonTrackValidator")
486  << "TrackingParticle #" << tpr.key()
487  << " with pt,eta,phi: "
488  << sqrt(momentumTP.perp2()) << " , "
489  << momentumTP.eta() << " , "
490  << momentumTP.phi() << " , "
491  << " NOT associated to any reco::Track" << "\n";
492  }
493 
494  for (unsigned int f=0; f<etaintervals[w].size()-1; f++){
495  if (getEta(momentumTP.eta())>etaintervals[w][f]&&
496  getEta(momentumTP.eta())<etaintervals[w][f+1]) {
497  totSIMeta[w][f]++;
498  if (TP_is_matched) {
499  totASSeta[w][f]++;
500 
501  if (MABH) {
502  if (Quality075) {
503  totASSeta_Quality075[w][f]++;
504  totASSeta_Quality05[w][f]++;
505  }
506  else if (Quality05) {
507  totASSeta_Quality05[w][f]++;
508  }
509  }
510  }
511  }
512  } // END for (unsigned int f=0; f<etaintervals[w].size()-1; f++){
513 
514  for (unsigned int f=0; f<phiintervals[w].size()-1; f++){
515  if (momentumTP.phi() > phiintervals[w][f]&&
516  momentumTP.phi() <phiintervals[w][f+1]) {
517  totSIM_phi[w][f]++;
518  if (TP_is_matched) {
519  totASS_phi[w][f]++;
520 
521  if (MABH) {
522  if (Quality075) {
523  totASS_phi_Quality075[w][f]++;
524  totASS_phi_Quality05[w][f]++;
525  }
526  else if (Quality05) {
527  totASS_phi_Quality05[w][f]++;
528  }
529  }
530  }
531  }
532  } // END for (unsigned int f=0; f<phiintervals[w].size()-1; f++){
533 
534 
535  for (unsigned int f=0; f<pTintervals[w].size()-1; f++){
536  if (getPt(sqrt(momentumTP.perp2()))>pTintervals[w][f]&&
537  getPt(sqrt(momentumTP.perp2()))<pTintervals[w][f+1]) {
538  totSIMpT[w][f]++;
539  if (TP_is_matched) {
540  totASSpT[w][f]++;
541 
542  if (MABH) {
543  if (Quality075) {
544  totASSpT_Quality075[w][f]++;
545  totASSpT_Quality05[w][f]++;
546  }
547  else if (Quality05) {
548  totASSpT_Quality05[w][f]++;
549  }
550  }
551  }
552  }
553  } // END for (unsigned int f=0; f<pTintervals[w].size()-1; f++){
554 
555  for (unsigned int f=0; f<dxyintervals[w].size()-1; f++){
556  if (dxySim>dxyintervals[w][f]&&
557  dxySim<dxyintervals[w][f+1]) {
558  totSIM_dxy[w][f]++;
559  if (TP_is_matched) {
560  totASS_dxy[w][f]++;
561  }
562  }
563  } // END for (unsigned int f=0; f<dxyintervals[w].size()-1; f++){
564 
565  for (unsigned int f=0; f<dzintervals[w].size()-1; f++){
566  if (dzSim>dzintervals[w][f]&&
567  dzSim<dzintervals[w][f+1]) {
568  totSIM_dz[w][f]++;
569  if (TP_is_matched) {
570  totASS_dz[w][f]++;
571  }
572  }
573  } // END for (unsigned int f=0; f<dzintervals[w].size()-1; f++){
574 
575  for (unsigned int f=0; f<vertposintervals[w].size()-1; f++){
576  if (sqrt(vertexTP.perp2())>vertposintervals[w][f]&&
577  sqrt(vertexTP.perp2())<vertposintervals[w][f+1]) {
578  totSIM_vertpos[w][f]++;
579  if (TP_is_matched) {
580  totASS_vertpos[w][f]++;
581  }
582  }
583  } // END for (unsigned int f=0; f<vertposintervals[w].size()-1; f++){
584 
585  for (unsigned int f=0; f<zposintervals[w].size()-1; f++){
586  if (vertexTP.z()>zposintervals[w][f]&&
587  vertexTP.z()<zposintervals[w][f+1]) {
588  totSIM_zpos[w][f]++;
589  if (TP_is_matched) {
590  totASS_zpos[w][f]++;
591  }
592  }
593  } // END for (unsigned int f=0; f<zposintervals[w].size()-1; f++){
594 
595  std::vector<PSimHit> simhits;
596 
597  if (usetracker && usemuon) {
598  simhits=tp->trackPSimHit();
599  }
600  else if (!usetracker && usemuon) {
601  simhits=tp->trackPSimHit(DetId::Muon);
602  }
603  else if (usetracker && !usemuon) {
604  simhits=tp->trackPSimHit(DetId::Tracker);
605  }
606 
607  int tmp = std::min((int)(simhits.end()-simhits.begin()),int(maxHit-1));
608  edm::LogVerbatim("MuonTrackValidator") << "\t N simhits = "<< (int)(simhits.end()-simhits.begin())<<"\n";
609 
610  totSIM_hit[w][tmp]++;
611  if (TP_is_matched) totASS_hit[w][tmp]++;
612 
613  if (TP_is_matched)
614  {
615  RefToBase<Track> assoctrack = rt.begin()->first;
616  nrecHit_vs_nsimHit_sim2rec[w]->Fill( assoctrack->numberOfValidHits(),(int)(simhits.end()-simhits.begin() ));
617  }
618  } // End for (TrackingParticleCollection::size_type i=0; i<tPCeff.size(); i++){
619  if (st!=0) h_tracksSIM[w]->Fill(st);
620 
621 
622  //
623  //fill reconstructed track histograms
624  //
625  edm::LogVerbatim("MuonTrackValidator") << "\n# of reco::Tracks with "
626  << label[www].process()<<":"
627  << label[www].label()<<":"
628  << label[www].instance()
629  << ": " << trackCollectionSize << "\n";
630  int at=0;
631  int rT=0;
632  for(View<Track>::size_type i=0; i<trackCollectionSize; ++i){
633  bool Track_is_matched = false;
634  RefToBase<Track> track(trackCollection, i);
635  rT++;
636 
637  std::vector<std::pair<TrackingParticleRef, double> > tp;
639 
640  // new logic (bidirectional)
641  if (BiDirectional_RecoToSim_association) {
642  edm::LogVerbatim("MuonTrackValidator")<<"----------------------------------------Track #"<< track.key();
643 
644  if(recSimColl.find(track) != recSimColl.end()) {
645  tp = recSimColl[track];
646  if (tp.size() != 0) {
647  tpr = tp.begin()->first;
648  // RtS and StR must associate the same pair !
649  if(simRecColl.find(tpr) != simRecColl.end()) {
650  std::vector<std::pair<RefToBase<Track>, double> > track_checkback = simRecColl[tpr];
651  RefToBase<Track> assoc_track_checkback;
652  assoc_track_checkback = track_checkback.begin()->first;
653 
654  if ( assoc_track_checkback.key() == track.key() ) {
655  edm::LogVerbatim("MuonTrackValidator")<<"------------------associated TrackingParticle #"<<tpr.key();
656  Track_is_matched = true;
657  at++;
658  double Purity = tp.begin()->second;
659  double Quality = track_checkback.begin()->second;
660  edm::LogVerbatim("MuonTrackValidator") << "reco::Track #" << track.key() << " with pt=" << track->pt()
661  << " associated with quality:" << Purity <<"\n";
662  if (MABH) h_PurityVsQuality[w]->Fill(Quality,Purity);
663  }
664  }
665  }
666  }
667 
668  if (!Track_is_matched) edm::LogVerbatim("MuonTrackValidator")
669  << "reco::Track #" << track.key() << " with pt=" << track->pt() << " NOT associated to any TrackingParticle" << "\n";
670  }
671  // old logic (bugged)
672  else {
673  if(recSimColl.find(track) != recSimColl.end()){
674  tp = recSimColl[track];
675  if (tp.size()!=0) {
676  Track_is_matched = true;
677  tpr = tp.begin()->first;
678  at++;
679  edm::LogVerbatim("MuonTrackValidator") << "reco::Track #" << track.key() << " with pt=" << track->pt()
680  << " associated with quality:" << tp.begin()->second <<"\n";
681  }
682  } else {
683  edm::LogVerbatim("MuonTrackValidator") << "reco::Track #" << track.key() << " with pt=" << track->pt()
684  << " NOT associated to any TrackingParticle" << "\n";
685  }
686  }
687 
688  //Compute fake rate vs eta
689  for (unsigned int f=0; f<etaintervals[w].size()-1; f++){
690  if (getEta(track->momentum().eta())>etaintervals[w][f]&&
691  getEta(track->momentum().eta())<etaintervals[w][f+1]) {
692  totRECeta[w][f]++;
693  if (Track_is_matched) {
694  totASS2eta[w][f]++;
695  }
696  }
697  } // End for (unsigned int f=0; f<etaintervals[w].size()-1; f++){
698 
699  for (unsigned int f=0; f<phiintervals[w].size()-1; f++){
700  if (track->momentum().phi()>phiintervals[w][f]&&
701  track->momentum().phi()<phiintervals[w][f+1]) {
702  totREC_phi[w][f]++;
703  if (Track_is_matched) {
704  totASS2_phi[w][f]++;
705  }
706  }
707  } // End for (unsigned int f=0; f<phiintervals[w].size()-1; f++){
708 
709 
710  for (unsigned int f=0; f<pTintervals[w].size()-1; f++){
711  if (getPt(sqrt(track->momentum().perp2()))>pTintervals[w][f]&&
712  getPt(sqrt(track->momentum().perp2()))<pTintervals[w][f+1]) {
713  totRECpT[w][f]++;
714  if (Track_is_matched) {
715  totASS2pT[w][f]++;
716  }
717  }
718  } // End for (unsigned int f=0; f<pTintervals[w].size()-1; f++){
719 
720  for (unsigned int f=0; f<dxyintervals[w].size()-1; f++){
721  if (track->dxy(bs.position())>dxyintervals[w][f]&&
722  track->dxy(bs.position())<dxyintervals[w][f+1]) {
723  totREC_dxy[w][f]++;
724  if (Track_is_matched) {
725  totASS2_dxy[w][f]++;
726  }
727  }
728  } // End for (unsigned int f=0; f<dxyintervals[w].size()-1; f++){
729 
730  for (unsigned int f=0; f<dzintervals[w].size()-1; f++){
731  if (track->dz(bs.position())>dzintervals[w][f]&&
732  track->dz(bs.position())<dzintervals[w][f+1]) {
733  totREC_dz[w][f]++;
734  if (Track_is_matched) {
735  totASS2_dz[w][f]++;
736  }
737  }
738  } // End for (unsigned int f=0; f<dzintervals[w].size()-1; f++){
739 
740  int tmp = std::min((int)track->found(),int(maxHit-1));
741  totREC_hit[w][tmp]++;
742  if (Track_is_matched) totASS2_hit[w][tmp]++;
743 
744  edm::LogVerbatim("MuonTrackValidator") << "\t N valid rechits = "<< (int)track->found() <<"\n";
745 
746  //Fill other histos
747  try{
748  if (!Track_is_matched) continue;
749 
750  if (associators[ww]=="TrackAssociatorByChi2"){
751  //association chi2
752  double assocChi2 = -tp.begin()->second;//in association map is stored -chi2
753  h_assochi2[www]->Fill(assocChi2);
754  h_assochi2_prob[www]->Fill(TMath::Prob((assocChi2)*5,5));
755  }
756  else if (associators[ww]=="TrackAssociatorByHits"){
757  double fraction = tp.begin()->second;
758  h_assocFraction[www]->Fill(fraction);
759  h_assocSharedHit[www]->Fill(fraction*track->numberOfValidHits());
760  }
761 
762  //nchi2 and hits global distributions
763  h_nchi2[w]->Fill(track->normalizedChi2());
764  h_nchi2_prob[w]->Fill(TMath::Prob(track->chi2(),(int)track->ndof()));
765  h_hits[w]->Fill(track->numberOfValidHits());
766  h_losthits[w]->Fill(track->numberOfLostHits());
767  chi2_vs_nhits[w]->Fill(track->numberOfValidHits(),track->normalizedChi2());
768  h_charge[w]->Fill( track->charge() );
769 
770  //Get tracking particle parameters at point of closest approach to the beamline
771  ParticleBase::Vector momentumTP = parametersDefinerTP->momentum(event,setup,*(tpr.get()));
772  ParticleBase::Point vertexTP = parametersDefinerTP->vertex(event,setup,*(tpr.get()));
773  double ptSim = sqrt(momentumTP.perp2());
774  double qoverpSim = tpr->charge()/sqrt(momentumTP.x()*momentumTP.x()+momentumTP.y()*momentumTP.y()+momentumTP.z()*momentumTP.z());
775  double thetaSim = momentumTP.theta();
776  double lambdaSim = M_PI/2-momentumTP.theta();
777  double phiSim = momentumTP.phi();
778  double dxySim = (-vertexTP.x()*sin(momentumTP.phi())+vertexTP.y()*cos(momentumTP.phi()));
779  double dzSim = vertexTP.z() - (vertexTP.x()*momentumTP.x()+vertexTP.y()*momentumTP.y())/sqrt(momentumTP.perp2()) * momentumTP.z()/sqrt(momentumTP.perp2());
780 
781  TrackBase::ParameterVector rParameters = track->parameters();
782 
783  double qoverpRec(0);
784  double qoverpErrorRec(0);
785  double ptRec(0);
786  double ptErrorRec(0);
787  double lambdaRec(0);
788  double lambdaErrorRec(0);
789  double phiRec(0);
790  double phiErrorRec(0);
791 
792 
793  //loop to decide whether to take gsfTrack (utilisation of mode-function) or common track
794  const GsfTrack* gsfTrack(0);
795  if(useGsf){
796  gsfTrack = dynamic_cast<const GsfTrack*>(&(*track));
797  if (gsfTrack==0) edm::LogInfo("MuonTrackValidator") << "Trying to access mode for a non-GsfTrack";
798  }
799 
800  if (gsfTrack) {
801  // get values from mode
802  getRecoMomentum(*gsfTrack, ptRec, ptErrorRec, qoverpRec, qoverpErrorRec,
803  lambdaRec,lambdaErrorRec, phiRec, phiErrorRec);
804  }
805 
806  else {
807  // get values from track (without mode)
808  getRecoMomentum(*track, ptRec, ptErrorRec, qoverpRec, qoverpErrorRec,
809  lambdaRec,lambdaErrorRec, phiRec, phiErrorRec);
810  }
811 
812  double thetaRec = track->theta();
813  double ptError = ptErrorRec;
814  double ptres = ptRec - ptSim;
815  double etares = track->eta()-momentumTP.Eta();
816  double dxyRec = track->dxy(bs.position());
817  double dzRec = track->dz(bs.position());
818  // eta residue; pt, k, theta, phi, dxy, dz pulls
819  double qoverpPull=(qoverpRec-qoverpSim)/qoverpErrorRec;
820  double thetaPull=(lambdaRec-lambdaSim)/lambdaErrorRec;
821  double phiDiff = phiRec - phiSim;
822  if (abs(phiDiff) > M_PI) {
823  if (phiDiff >0.) phiDiff = phiDiff - 2.*M_PI;
824  else phiDiff = phiDiff + 2.*M_PI;
825  }
826  double phiPull=phiDiff/phiErrorRec;
827  double dxyPull=(dxyRec-dxySim)/track->dxyError();
828  double dzPull=(dzRec-dzSim)/track->dzError();
829 
830  double contrib_Qoverp = ((qoverpRec-qoverpSim)/qoverpErrorRec)*
831  ((qoverpRec-qoverpSim)/qoverpErrorRec)/5;
832  double contrib_dxy = ((dxyRec-dxySim)/track->dxyError())*((dxyRec-dxySim)/track->dxyError())/5;
833  double contrib_dz = ((dzRec-dzSim)/track->dzError())*((dzRec-dzSim)/track->dzError())/5;
834  double contrib_theta = ((lambdaRec-lambdaSim)/lambdaErrorRec)*
835  ((lambdaRec-lambdaSim)/lambdaErrorRec)/5;
836  double contrib_phi = (phiDiff/phiErrorRec)*(phiDiff/phiErrorRec)/5;
837 
838  LogTrace("MuonTrackValidator") << "assocChi2=" << tp.begin()->second << "\n"
839  << "" << "\n"
840  << "ptREC=" << ptRec << "\n"
841  << "etaREC=" << track->eta() << "\n"
842  << "qoverpREC=" << qoverpRec << "\n"
843  << "dxyREC=" << dxyRec << "\n"
844  << "dzREC=" << dzRec << "\n"
845  << "thetaREC=" << track->theta() << "\n"
846  << "phiREC=" << phiRec << "\n"
847  << "" << "\n"
848  << "qoverpError()=" << qoverpErrorRec << "\n"
849  << "dxyError()=" << track->dxyError() << "\n"
850  << "dzError()=" << track->dzError() << "\n"
851  << "thetaError()=" << lambdaErrorRec << "\n"
852  << "phiError()=" << phiErrorRec << "\n"
853  << "" << "\n"
854  << "ptSIM=" << ptSim << "\n"
855  << "etaSIM=" << momentumTP.Eta() << "\n"
856  << "qoverpSIM=" << qoverpSim << "\n"
857  << "dxySIM=" << dxySim << "\n"
858  << "dzSIM=" << dzSim << "\n"
859  << "thetaSIM=" << M_PI/2-lambdaSim << "\n"
860  << "phiSIM=" << phiSim << "\n"
861  << "" << "\n"
862  << "contrib_Qoverp=" << contrib_Qoverp << "\n"
863  << "contrib_dxy=" << contrib_dxy << "\n"
864  << "contrib_dz=" << contrib_dz << "\n"
865  << "contrib_theta=" << contrib_theta << "\n"
866  << "contrib_phi=" << contrib_phi << "\n"
867  << "" << "\n"
868  <<"chi2PULL="<<contrib_Qoverp+contrib_dxy+contrib_dz+contrib_theta+contrib_phi<<"\n";
869 
870  h_pullQoverp[w]->Fill(qoverpPull);
871  h_pullTheta[w]->Fill(thetaPull);
872  h_pullPhi[w]->Fill(phiPull);
873  h_pullDxy[w]->Fill(dxyPull);
874  h_pullDz[w]->Fill(dzPull);
875 
876 
877  h_pt[w]->Fill(ptres/ptError);
878  h_eta[w]->Fill(etares);
879  etares_vs_eta[w]->Fill(getEta(track->eta()),etares);
880 
881 
882  //chi2 and #hit vs eta: fill 2D histos
883  chi2_vs_eta[w]->Fill(getEta(track->eta()),track->normalizedChi2());
884  nhits_vs_eta[w]->Fill(getEta(track->eta()),track->numberOfValidHits());
885  nDThits_vs_eta[w]->Fill(getEta(track->eta()),track->hitPattern().numberOfValidMuonDTHits());
886  nCSChits_vs_eta[w]->Fill(getEta(track->eta()),track->hitPattern().numberOfValidMuonCSCHits());
887  nRPChits_vs_eta[w]->Fill(getEta(track->eta()),track->hitPattern().numberOfValidMuonRPCHits());
888 
889  nlosthits_vs_eta[w]->Fill(getEta(track->eta()),track->numberOfLostHits());
890 
891  //resolution of track params: fill 2D histos
892  dxyres_vs_eta[w]->Fill(getEta(track->eta()),dxyRec-dxySim);
893  ptres_vs_eta[w]->Fill(getEta(track->eta()),(ptRec-ptSim)/ptRec);
894  dzres_vs_eta[w]->Fill(getEta(track->eta()),dzRec-dzSim);
895  phires_vs_eta[w]->Fill(getEta(track->eta()),phiDiff);
896  cotThetares_vs_eta[w]->Fill(getEta(track->eta()), cos(thetaRec)/sin(thetaRec) - cos(thetaSim)/sin(thetaSim));
897 
898  //same as before but vs pT
899  dxyres_vs_pt[w]->Fill(getPt(ptRec),dxyRec-dxySim);
900  ptres_vs_pt[w]->Fill(getPt(ptRec),(ptRec-ptSim)/ptRec);
901  dzres_vs_pt[w]->Fill(getPt(ptRec),dzRec-dzSim);
902  phires_vs_pt[w]->Fill(getPt(ptRec),phiDiff);
903  cotThetares_vs_pt[w]->Fill(getPt(ptRec), cos(thetaRec)/sin(thetaRec) - cos(thetaSim)/sin(thetaSim));
904 
905  //pulls of track params vs eta: fill 2D histos
906  dxypull_vs_eta[w]->Fill(getEta(track->eta()),dxyPull);
907  ptpull_vs_eta[w]->Fill(getEta(track->eta()),ptres/ptError);
908  dzpull_vs_eta[w]->Fill(getEta(track->eta()),dzPull);
909  phipull_vs_eta[w]->Fill(getEta(track->eta()),phiPull);
910  thetapull_vs_eta[w]->Fill(getEta(track->eta()),thetaPull);
911 
912  //plots vs phi
913  nhits_vs_phi[w]->Fill(phiRec,track->numberOfValidHits());
914  chi2_vs_phi[w]->Fill(phiRec,track->normalizedChi2());
915  ptmean_vs_eta_phi[w]->Fill(phiRec,getEta(track->eta()),ptRec);
916  phimean_vs_eta_phi[w]->Fill(phiRec,getEta(track->eta()),phiRec);
917  ptres_vs_phi[w]->Fill(phiRec,(ptRec-ptSim)/ptRec);
918  phires_vs_phi[w]->Fill(phiRec,phiDiff);
919  ptpull_vs_phi[w]->Fill(phiRec,ptres/ptError);
920  phipull_vs_phi[w]->Fill(phiRec,phiPull);
921  thetapull_vs_phi[w]->Fill(phiRec,thetaPull);
922 
923  std::vector<PSimHit> simhits;
924 
925  if (usetracker && usemuon) {
926  simhits=tpr.get()->trackPSimHit();
927  }
928  else if (!usetracker && usemuon) {
929  simhits=tpr.get()->trackPSimHit(DetId::Muon);
930  }
931  else if (usetracker && !usemuon) {
932  simhits=tpr.get()->trackPSimHit(DetId::Tracker);
933  }
934 
935  nrecHit_vs_nsimHit_rec2sim[w]->Fill(track->numberOfValidHits(), (int)(simhits.end()-simhits.begin() ));
936 
937  } // End of try{
938  catch (cms::Exception e){
939  LogTrace("MuonTrackValidator") << "exception found: " << e.what() << "\n";
940  }
941  } // End of for(View<Track>::size_type i=0; i<trackCollectionSize; ++i){
942  if (at!=0) h_tracks[w]->Fill(at);
943  h_fakes[w]->Fill(rT-at);
944  edm::LogVerbatim("MuonTrackValidator") << "Total Simulated: " << st << "\n"
945  << "Total Associated (simToReco): " << ats << "\n"
946  << "Total Reconstructed: " << rT << "\n"
947  << "Total Associated (recoToSim): " << at << "\n"
948  << "Total Fakes: " << rT-at << "\n";
949  nrec_vs_nsim[w]->Fill(rT,st);
950  w++;
951  } // End of for (unsigned int www=0;www<label.size();www++){
952  } //END of for (unsigned int ww=0;ww<associators.size();ww++){
953 }
954 
956 
957  int w=0;
958  for (unsigned int ww=0;ww<associators.size();ww++){
959  for (unsigned int www=0;www<label.size();www++){
960 
961  //resolution of track params: get sigma from 2D histos
962  if(!skipHistoFit){
963  FitSlicesYTool fsyt_dxy(dxyres_vs_eta[w]);
964  fsyt_dxy.getFittedSigmaWithError(h_dxyrmsh[w]);
965  fsyt_dxy.getFittedMeanWithError(h_dxymeanh[w]);
966  FitSlicesYTool fsyt_dxyPt(dxyres_vs_pt[w]);
967  fsyt_dxyPt.getFittedSigmaWithError(h_dxyrmshPt[w]);
968  fsyt_dxyPt.getFittedMeanWithError(h_dxymeanhPt[w]);
969  FitSlicesYTool fsyt_pt(ptres_vs_eta[w]);
970  fsyt_pt.getFittedSigmaWithError(h_ptrmsh[w]);
971  fsyt_pt.getFittedMeanWithError(h_ptshifteta[w]);
972  FitSlicesYTool fsyt_ptPt(ptres_vs_pt[w]);
973  fsyt_ptPt.getFittedSigmaWithError(h_ptrmshPt[w]);
974  fsyt_ptPt.getFittedMeanWithError(h_ptmeanhPt[w]);
975  FitSlicesYTool fsyt_ptPhi(ptres_vs_phi[w]);
976  fsyt_ptPhi.getFittedSigmaWithError(h_ptrmshPhi[w]);
977  fsyt_ptPhi.getFittedMeanWithError(h_ptmeanhPhi[w]);
978  FitSlicesYTool fsyt_dz(dzres_vs_eta[w]);
979  fsyt_dz.getFittedSigmaWithError(h_dzrmsh[w]);
980  fsyt_dz.getFittedMeanWithError(h_dzmeanh[w]);
981  FitSlicesYTool fsyt_dzPt(dzres_vs_pt[w]);
982  fsyt_dzPt.getFittedSigmaWithError(h_dzrmshPt[w]);
983  fsyt_dzPt.getFittedMeanWithError(h_dzmeanhPt[w]);
984  FitSlicesYTool fsyt_phi(phires_vs_eta[w]);
985  fsyt_phi.getFittedSigmaWithError(h_phirmsh[w]);
986  fsyt_phi.getFittedMeanWithError(h_phimeanh[w]);
987  FitSlicesYTool fsyt_phiPt(phires_vs_pt[w]);
988  fsyt_phiPt.getFittedSigmaWithError(h_phirmshPt[w]);
989  fsyt_phiPt.getFittedMeanWithError(h_phimeanhPt[w]);
990  FitSlicesYTool fsyt_phiPhi(phires_vs_phi[w]);
991  fsyt_phiPhi.getFittedSigmaWithError(h_phirmshPhi[w]);
992  fsyt_phiPhi.getFittedMeanWithError(h_phimeanhPhi[w]);
993  FitSlicesYTool fsyt_cotTheta(cotThetares_vs_eta[w]);
994  fsyt_cotTheta.getFittedSigmaWithError(h_cotThetarmsh[w]);
995  fsyt_cotTheta.getFittedMeanWithError(h_cotThetameanh[w]);
996  FitSlicesYTool fsyt_cotThetaPt(cotThetares_vs_pt[w]);
997  fsyt_cotThetaPt.getFittedSigmaWithError(h_cotThetarmshPt[w]);
998  fsyt_cotThetaPt.getFittedMeanWithError(h_cotThetameanhPt[w]);
999  }
1000  //chi2 and #hit vs eta: get mean from 2D histos
1001  doProfileX(chi2_vs_eta[w],h_chi2meanh[w]);
1002  doProfileX(nhits_vs_eta[w],h_hits_eta[w]);
1003  doProfileX(nDThits_vs_eta[w],h_DThits_eta[w]);
1004  doProfileX(nCSChits_vs_eta[w],h_CSChits_eta[w]);
1005  doProfileX(nRPChits_vs_eta[w],h_RPChits_eta[w]);
1006 
1007  doProfileX(nlosthits_vs_eta[w],h_losthits_eta[w]);
1008  //vs phi
1009  doProfileX(chi2_vs_nhits[w],h_chi2meanhitsh[w]);
1010  // doProfileX(ptres_vs_eta[w],h_ptresmean_vs_eta[w]);
1011  // doProfileX(phires_vs_eta[w],h_phiresmean_vs_eta[w]);
1012  doProfileX(chi2_vs_phi[w],h_chi2mean_vs_phi[w]);
1013  doProfileX(nhits_vs_phi[w],h_hits_phi[w]);
1014  // doProfileX(ptres_vs_phi[w],h_ptresmean_vs_phi[w]);
1015  // doProfileX(phires_vs_phi[w],h_phiresmean_vs_phi[w]);
1016  if(!skipHistoFit){
1017  //pulls of track params vs eta: get sigma from 2D histos
1018  FitSlicesYTool fsyt_dxyp(dxypull_vs_eta[w]);
1019  fsyt_dxyp.getFittedSigmaWithError(h_dxypulleta[w]);
1020  fsyt_dxyp.getFittedMeanWithError(h_dxypulletamean[w]);
1021  FitSlicesYTool fsyt_ptp(ptpull_vs_eta[w]);
1022  fsyt_ptp.getFittedSigmaWithError(h_ptpulleta[w]);
1023  fsyt_ptp.getFittedMeanWithError(h_ptpulletamean[w]);
1024  FitSlicesYTool fsyt_dzp(dzpull_vs_eta[w]);
1025  fsyt_dzp.getFittedSigmaWithError(h_dzpulleta[w]);
1026  fsyt_dzp.getFittedMeanWithError(h_dzpulletamean[w]);
1027  FitSlicesYTool fsyt_phip(phipull_vs_eta[w]);
1028  fsyt_phip.getFittedSigmaWithError(h_phipulleta[w]);
1029  fsyt_phip.getFittedMeanWithError(h_phipulletamean[w]);
1030  FitSlicesYTool fsyt_thetap(thetapull_vs_eta[w]);
1031  fsyt_thetap.getFittedSigmaWithError(h_thetapulleta[w]);
1032  fsyt_thetap.getFittedMeanWithError(h_thetapulletamean[w]);
1033  //vs phi
1034  FitSlicesYTool fsyt_ptpPhi(ptpull_vs_phi[w]);
1035  fsyt_ptpPhi.getFittedSigmaWithError(h_ptpullphi[w]);
1036  fsyt_ptpPhi.getFittedMeanWithError(h_ptpullphimean[w]);
1037  FitSlicesYTool fsyt_phipPhi(phipull_vs_phi[w]);
1038  fsyt_phipPhi.getFittedSigmaWithError(h_phipullphi[w]);
1039  fsyt_phipPhi.getFittedMeanWithError(h_phipullphimean[w]);
1040  FitSlicesYTool fsyt_thetapPhi(thetapull_vs_phi[w]);
1041  fsyt_thetapPhi.getFittedSigmaWithError(h_thetapullphi[w]);
1042  fsyt_thetapPhi.getFittedMeanWithError(h_thetapullphimean[w]);
1043  //effic&fake
1044  fillPlotFromVectors(h_effic[w],totASSeta[w],totSIMeta[w],"effic");
1045  fillPlotFromVectors(h_fakerate[w],totASS2eta[w],totRECeta[w],"fakerate");
1046  fillPlotFromVectors(h_efficPt[w],totASSpT[w],totSIMpT[w],"effic");
1047  fillPlotFromVectors(h_fakeratePt[w],totASS2pT[w],totRECpT[w],"fakerate");
1048  fillPlotFromVectors(h_effic_vs_hit[w],totASS_hit[w],totSIM_hit[w],"effic");
1049  fillPlotFromVectors(h_fake_vs_hit[w],totASS2_hit[w],totREC_hit[w],"fakerate");
1050  fillPlotFromVectors(h_effic_vs_phi[w],totASS_phi[w],totSIM_phi[w],"effic");
1051  fillPlotFromVectors(h_fake_vs_phi[w],totASS2_phi[w],totREC_phi[w],"fakerate");
1052  fillPlotFromVectors(h_effic_vs_dxy[w],totASS_dxy[w],totSIM_dxy[w],"effic");
1053  fillPlotFromVectors(h_fake_vs_dxy[w],totASS2_dxy[w],totREC_dxy[w],"fakerate");
1054  fillPlotFromVectors(h_effic_vs_dz[w],totASS_dz[w],totSIM_dz[w],"effic");
1055  fillPlotFromVectors(h_fake_vs_dz[w],totASS2_dz[w],totREC_dz[w],"fakerate");
1056  fillPlotFromVectors(h_effic_vs_vertpos[w],totASS_vertpos[w],totSIM_vertpos[w],"effic");
1057  fillPlotFromVectors(h_effic_vs_zpos[w],totASS_zpos[w],totSIM_zpos[w],"effic");
1058 
1059  if (MABH)
1060  {
1061  fillPlotFromVectors(h_effic_Quality05[w] ,totASSeta_Quality05[w] ,totSIMeta[w],"effic");
1062  fillPlotFromVectors(h_effic_Quality075[w],totASSeta_Quality075[w],totSIMeta[w],"effic");
1063  fillPlotFromVectors(h_efficPt_Quality05[w] ,totASSpT_Quality05[w] ,totSIMpT[w],"effic");
1064  fillPlotFromVectors(h_efficPt_Quality075[w],totASSpT_Quality075[w],totSIMpT[w],"effic");
1065  fillPlotFromVectors(h_effic_vs_phi_Quality05[w] ,totASS_phi_Quality05[w],totSIM_phi[w],"effic");
1066  fillPlotFromVectors(h_effic_vs_phi_Quality075[w],totASS_phi_Quality075[w],totSIM_phi[w],"effic");
1067  }
1068  }
1069 
1070  fillPlotFromVector(h_recoeta[w],totRECeta[w]);
1071  fillPlotFromVector(h_simuleta[w],totSIMeta[w]);
1072  fillPlotFromVector(h_assoceta[w],totASSeta[w]);
1073  fillPlotFromVector(h_assoc2eta[w],totASS2eta[w]);
1074 
1075  fillPlotFromVector(h_recopT[w],totRECpT[w]);
1076  fillPlotFromVector(h_simulpT[w],totSIMpT[w]);
1077  fillPlotFromVector(h_assocpT[w],totASSpT[w]);
1078  fillPlotFromVector(h_assoc2pT[w],totASS2pT[w]);
1079 
1080  fillPlotFromVector(h_recohit[w],totREC_hit[w]);
1081  fillPlotFromVector(h_simulhit[w],totSIM_hit[w]);
1082  fillPlotFromVector(h_assochit[w],totASS_hit[w]);
1083  fillPlotFromVector(h_assoc2hit[w],totASS2_hit[w]);
1084 
1085  fillPlotFromVector(h_recophi[w],totREC_phi[w]);
1086  fillPlotFromVector(h_simulphi[w],totSIM_phi[w]);
1087  fillPlotFromVector(h_assocphi[w],totASS_phi[w]);
1088  fillPlotFromVector(h_assoc2phi[w],totASS2_phi[w]);
1089 
1090  fillPlotFromVector(h_recodxy[w],totREC_dxy[w]);
1091  fillPlotFromVector(h_simuldxy[w],totSIM_dxy[w]);
1092  fillPlotFromVector(h_assocdxy[w],totASS_dxy[w]);
1093  fillPlotFromVector(h_assoc2dxy[w],totASS2_dxy[w]);
1094 
1095  fillPlotFromVector(h_recodz[w],totREC_dz[w]);
1096  fillPlotFromVector(h_simuldz[w],totSIM_dz[w]);
1097  fillPlotFromVector(h_assocdz[w],totASS_dz[w]);
1098  fillPlotFromVector(h_assoc2dz[w],totASS2_dz[w]);
1099 
1100  fillPlotFromVector(h_simulvertpos[w],totSIM_vertpos[w]);
1101  fillPlotFromVector(h_assocvertpos[w],totASS_vertpos[w]);
1102 
1103  fillPlotFromVector(h_simulzpos[w],totSIM_zpos[w]);
1104  fillPlotFromVector(h_assoczpos[w],totASS_zpos[w]);
1105 
1106  if (MABH) {
1107  fillPlotFromVector(h_assoceta_Quality05[w] ,totASSeta_Quality05[w]);
1108  fillPlotFromVector(h_assoceta_Quality075[w],totASSeta_Quality075[w]);
1109  fillPlotFromVector(h_assocpT_Quality05[w] ,totASSpT_Quality05[w]);
1110  fillPlotFromVector(h_assocpT_Quality075[w],totASSpT_Quality075[w]);
1111  fillPlotFromVector(h_assocphi_Quality05[w] ,totASS_phi_Quality05[w]);
1112  fillPlotFromVector(h_assocphi_Quality075[w],totASS_phi_Quality075[w]);
1113  }
1114 
1115  w++;
1116  }
1117  }
1118 
1119  if ( out.size() != 0 && dbe_ ) dbe_->save(out);
1120 }
1121 
1122 
1123 void
1124 MuonTrackValidator::getRecoMomentum (const reco::Track& track, double& pt, double& ptError,
1125  double& qoverp, double& qoverpError, double& lambda,double& lambdaError, double& phi, double& phiError ) const {
1126  pt = track.pt();
1127  ptError = track.ptError();
1128  qoverp = track.qoverp();
1129  qoverpError = track.qoverpError();
1130  lambda = track.lambda();
1131  lambdaError = track.lambdaError();
1132  phi = track.phi();
1133  phiError = track.phiError();
1134 
1135 }
1136 
1137 void
1138 MuonTrackValidator::getRecoMomentum (const reco::GsfTrack& gsfTrack, double& pt, double& ptError,
1139  double& qoverp, double& qoverpError, double& lambda,double& lambdaError, double& phi, double& phiError ) const {
1140 
1141  pt = gsfTrack.ptMode();
1142  ptError = gsfTrack.ptModeError();
1143  qoverp = gsfTrack.qoverpMode();
1144  qoverpError = gsfTrack.qoverpModeError();
1145  lambda = gsfTrack.lambdaMode();
1146  lambdaError = gsfTrack.lambdaModeError();
1147  phi = gsfTrack.phiMode();
1148  phiError = gsfTrack.phiModeError();
1149 
1150 }
1151 
double qoverp() const
q/p
Definition: TrackBase.h:114
virtual char const * what() const
Definition: Exception.cc:97
double phiModeError() const
error on phi from mode
Definition: GsfTrack.h:93
int i
Definition: DBlmapReader.cc:9
void getFittedSigmaWithError(MonitorElement *)
Fill the ME with the sigma value (with error) of the gaussian fit in each slice.
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:149
const std::string & label
Definition: MVAComputer.cc:186
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:519
double lambdaMode() const
Lambda angle from mode.
Definition: GsfTrack.h:44
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)
Definition: TrackBase.h:110
const std::vector< PSimHit > & trackPSimHit() const
double theta() const
polar angle
Definition: TrackBase.h:116
double dxyError() const
error on dxy
Definition: TrackBase.h:202
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:214
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")
Definition: DQMStore.cc:1883
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const_iterator find(const key_type &k) const
find element with specified reference key
#define abs(x)
Definition: mlp_lapack.h:159
def replace
Definition: linker.py:10
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:138
unsigned short numberOfLostHits() const
number of cases where track crossed a layer without getting a hit.
Definition: TrackBase.h:227
#define min(a, b)
Definition: mlp_lapack.h:161
math::XYZVectorD Vector
point in the space
Definition: ParticleBase.h:31
math::Vector< dimension >::type ParameterVector
parameter vector
Definition: TrackBase.h:69
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) ...
uint16_t size_type
double qoverpMode() const
q/p from mode
Definition: GsfTrack.h:40
double ptModeError() const
error on Pt (set to 1000 TeV if charge==0 for safety) from mode
Definition: GsfTrack.h:80
math::XYZPointD Point
point in the space
Definition: ParticleBase.h:29
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:140
const T & max(const T &a, const T &b)
double chi2() const
chi-squared of the fit
Definition: TrackBase.h:106
ParameterVector parameters() const
Track parameters with one-to-one correspondence to the covariance matrix.
Definition: TrackBase.h:171
void post_insert()
post insert action
double ndof() const
number of degrees of freedom of the fit
Definition: TrackBase.h:108
T sqrt(T t)
Definition: SSEVec.h:28
double pt() const
track transverse momentum
Definition: TrackBase.h:130
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
Definition: TrackBase.h:187
double phiError() const
error on phi
Definition: TrackBase.h:200
unsigned int size_type
Definition: View.h:90
int j
Definition: DBlmapReader.cc:9
double lambda() const
Lambda angle.
Definition: TrackBase.h:118
double f[11][100]
int numberOfValidMuonRPCHits() const
Definition: HitPattern.cc:489
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
Definition: TrackBase.h:225
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:833
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:216
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
size_t key() const
Definition: RefToBase.h:223
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
#define LogTrace(id)
DQMStore * dbe_
int nint(float a)
Return the nearest integer - analogous to the FORTRAN intrinsic NINT.
Definition: nint.h:8
double qoverpError() const
error on signed transverse curvature
Definition: TrackBase.h:185
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...
Definition: TrackBase.h:126
double dzError() const
error on dz
Definition: TrackBase.h:208
tuple out
Definition: dbtoconf.py:99
int numberOfValidMuonDTHits() const
Definition: HitPattern.cc:463
#define M_PI
Definition: BFit3D.cc:3
double qoverpModeError() const
error on signed transverse curvature from mode
Definition: GsfTrack.h:78
const T & get() const
Definition: EventSetup.h:55
key_type key() const
Accessor for product key.
Definition: Ref.h:264
void getFittedMeanWithError(MonitorElement *)
Fill the ME with the mean value (with error) of the gaussian fit in each slice.
T const * product() const
Definition: ESHandle.h:62
void beginRun(edm::Run const &, edm::EventSetup const &)
Method called before the event loop.
Vector momentum() const
spatial momentum vector
Definition: ParticleBase.h:87
T const * product() const
Definition: Handle.h:74
std::string const & label() const
Definition: InputTag.h:25
std::string const & process() const
Definition: InputTag.h:29
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
double lambdaError() const
error on lambda
Definition: TrackBase.h:196
unsigned short found() const
Number of valid hits on track.
Definition: Track.h:100
int numberOfValidMuonCSCHits() const
Definition: HitPattern.cc:476
TH2F * getTH2F(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
void goUp(void)
equivalent to &quot;cd ..&quot;
Definition: DQMStore.cc:248
double phiMode() const
azimuthal angle of momentum vector from mode
Definition: GsfTrack.h:56
int charge() const
track electric charge
Definition: TrackBase.h:112
std::vector< TrackingParticle > TrackingParticleCollection
double lambdaModeError() const
error on lambda from mode
Definition: GsfTrack.h:89
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:647
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:239
const Point & vertex() const
vertex position
Definition: ParticleBase.h:229
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:120
double ptMode() const
track transverse momentum from mode
Definition: GsfTrack.h:48
std::string const & instance() const
Definition: InputTag.h:26
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237
Definition: Run.h:31
list at
Definition: asciidump.py:428
void endRun(edm::Run const &, edm::EventSetup const &)
Method called at the end of the event loop.
Definition: DDAxes.h:10
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")
Definition: DQMStore.cc:977