CMS 3D CMS Logo

MTVHistoProducerAlgoForTracker.h
Go to the documentation of this file.
1 #ifndef Validation_RecoTrack_MTVHistoProducerAlgoForTracker_h
2 #define Validation_RecoTrack_MTVHistoProducerAlgoForTracker_h
3 
4 /* \author B.Mangano, UCSD
5  *
6  * Concrete class implementing the MTVHistoProducerAlgo interface.
7  * To be used within the MTV to fill histograms for Tracker tracks.
8  */
9 
12 
20 
22 
26 
28 
30  //sim
33 
34  //1D
58 
70  std::vector<METype> h_con_eta, h_con_vertcount, h_con_zpos;
71 
76 
82 
85 
86  std::vector<std::vector<METype>> h_reco_mva, h_assoc2_mva;
87  std::vector<std::vector<METype>> h_reco_mvacut, h_assoc_mvacut, h_assoc2_mvacut, h_simul2_mvacut;
88  std::vector<std::vector<METype>> h_reco_mva_hp, h_assoc2_mva_hp;
90 
93 
94  // dE/dx
95  // in the future these might become an array
96  std::vector<std::vector<METype>> h_dedx_estim;
97  std::vector<std::vector<METype>> h_dedx_nom;
98  std::vector<std::vector<METype>> h_dedx_sat;
99 
100  //2D
101  std::vector<METype> nrec_vs_nsim;
102  std::vector<METype> nrecHit_vs_nsimHit_sim2rec;
103  std::vector<METype> nrecHit_vs_nsimHit_rec2sim;
104  std::vector<METype> h_duplicates_oriAlgo_vs_oriAlgo;
105 
106  //assoc hits
107  std::vector<METype> h_assocFraction, h_assocSharedHit;
108 
109  //#hit vs eta: to be used with doProfileX
114 
115  //---- second set of histograms (originally not used by the SeedGenerator)
116  //1D
118 
119  //2D
120  std::vector<METype> chi2_vs_nhits, etares_vs_eta;
121  std::vector<METype> h_ptshifteta;
123 
124  //Profile2D
125  std::vector<METype> ptmean_vs_eta_phi, phimean_vs_eta_phi;
126 
127  //assoc chi2
128  std::vector<METype> h_assochi2, h_assochi2_prob;
129 
130  //chi2 and # lost hits vs eta: to be used with doProfileX
131  std::vector<METype> chi2_vs_eta, chi2_vs_pt, nlosthits_vs_eta;
133 
134  //resolution of track params: to be used with fitslicesytool
137 
138  //pulls of track params vs eta: to be used with fitslicesytool
141 };
142 
144 public:
146 
149 
150  static std::unique_ptr<RecoTrackSelectorBase> makeRecoTrackSelectorFromTPSelectorParameters(
151  const edm::ParameterSet& pset);
152 
154  void bookSimHistos(DQMStore::IBooker& ibook, Histograms& histograms);
155  void bookSimTrackHistos(DQMStore::IBooker& ibook, Histograms& histograms, bool doResolutionPlots);
156  void bookSimTrackPVAssociationHistos(DQMStore::IBooker& ibook, Histograms& histograms);
157  void bookRecoHistos(DQMStore::IBooker& ibook, Histograms& histograms, bool doResolutionPlots);
158  void bookRecoPVAssociationHistos(DQMStore::IBooker& ibook, Histograms& histograms);
159  void bookRecodEdxHistos(DQMStore::IBooker& ibook, Histograms& histograms);
160  void bookSeedHistos(DQMStore::IBooker& ibook, Histograms& histograms);
161  void bookMVAHistos(DQMStore::IBooker& ibook, Histograms& histograms, size_t nMVAs);
162 
163  void fill_generic_simTrack_histos(const Histograms& histograms,
166  int bx) const;
167  void fill_simTrackBased_histos(const Histograms& histograms, int numSimTracks) const;
168 
169  void fill_recoAssociated_simTrack_histos(const Histograms& histograms,
170  int count,
171  const TrackingParticle& tp,
172  const TrackingParticle::Vector& momentumTP,
173  const TrackingParticle::Point& vertexTP,
174  double dxy,
175  double dz,
176  double dxyPV,
177  double dzPV,
178  int nSimHits,
179  int nSimLayers,
180  int nSimPixelLayers,
181  int nSimStripMonoAndStereoLayers,
182  const reco::Track* track,
183  int numVertices,
184  double dR,
185  double dR_jet,
186  const math::XYZPoint* pvPosition,
187  const TrackingVertex::LorentzVector* simPVPosition,
188  const math::XYZPoint& bsPosition,
189  const std::vector<float>& mvas,
190  unsigned int selectsLoose,
191  unsigned int selectsHP) const;
192 
193  void fill_recoAssociated_simTrack_histos(const Histograms& histograms,
194  int count,
195  const reco::GenParticle& tp,
196  const TrackingParticle::Vector& momentumTP,
197  const TrackingParticle::Point& vertexTP,
198  double dxy,
199  double dz,
200  int nSimHits,
201  const reco::Track* track,
202  int numVertices) const;
203 
204  void fill_duplicate_histos(const Histograms& histograms,
205  int count,
206  const reco::Track& track1,
207  const reco::Track& track2) const;
208 
209  void fill_generic_recoTrack_histos(const Histograms& histograms,
210  int count,
211  const reco::Track& track,
212  const TrackerTopology& ttopo,
213  const math::XYZPoint& bsPosition,
214  const math::XYZPoint* pvPosition,
215  const TrackingVertex::LorentzVector* simPVPosition,
216  bool isMatched,
217  bool isSigMatched,
218  bool isChargeMatched,
219  int numAssocRecoTracks,
220  int numVertices,
221  int nSimHits,
222  double sharedFraction,
223  double dR,
224  double dR_jet,
225  const std::vector<float>& mvas,
226  unsigned int selectsLoose,
227  unsigned int selectsHP) const;
228 
229  void fill_dedx_recoTrack_histos(const Histograms& histograms,
230  int count,
231  const edm::RefToBase<reco::Track>& trackref,
232  const std::vector<const edm::ValueMap<reco::DeDxData>*>& v_dEdx) const;
233 
234  void fill_simAssociated_recoTrack_histos(const Histograms& histograms, int count, const reco::Track& track) const;
235 
236  void fill_trackBased_histos(const Histograms& histograms,
237  int count,
238  int assTracks,
239  int numRecoTracks,
240  int numRecoTracksSelected,
241  int numSimTracksSelected) const;
242 
243  void fill_ResoAndPull_recoTrack_histos(const Histograms& histograms,
244  int count,
245  const TrackingParticle::Vector& momentumTP,
246  const TrackingParticle::Point& vertexTP,
247  int chargeTP,
248  const reco::Track& track,
249  const math::XYZPoint& bsPosition) const;
250 
251  void fill_seed_histos(const Histograms& histograms, int count, int seedsFitFailed, int seedsTotal) const;
252 
253 private:
255  void getRecoMomentum(const reco::Track& track,
256  double& pt,
257  double& ptError,
258  double& qoverp,
259  double& qoverpError,
260  double& lambda,
261  double& lambdaError,
262  double& phi,
263  double& phiError) const;
265  void getRecoMomentum(const reco::GsfTrack& gsfTrack,
266  double& pt,
267  double& ptError,
268  double& qoverp,
269  double& qoverpError,
270  double& lambda,
271  double& lambdaError,
272  double& phi,
273  double& phiError) const;
274 
275  double getEta(double eta) const;
276 
277  double getPt(double pt) const;
278 
279  unsigned int getSeedingLayerSetBin(const reco::Track& track, const TrackerTopology& ttopo) const;
280 
281  //private data members
282  std::unique_ptr<TrackingParticleSelector> generalTpSelector;
283  std::unique_ptr<TrackingParticleSelector> TpSelectorForEfficiencyVsEta;
284  std::unique_ptr<TrackingParticleSelector> TpSelectorForEfficiencyVsPhi;
285  std::unique_ptr<TrackingParticleSelector> TpSelectorForEfficiencyVsPt;
286  std::unique_ptr<TrackingParticleSelector> TpSelectorForEfficiencyVsVTXR;
287  std::unique_ptr<TrackingParticleSelector> TpSelectorForEfficiencyVsVTXZ;
288 
289  std::unique_ptr<RecoTrackSelectorBase> trackSelectorVsEta;
290  std::unique_ptr<RecoTrackSelectorBase> trackSelectorVsPhi;
291  std::unique_ptr<RecoTrackSelectorBase> trackSelectorVsPt;
292 
293  std::unique_ptr<GenParticleCustomSelector> generalGpSelector;
294  std::unique_ptr<GenParticleCustomSelector> GpSelectorForEfficiencyVsEta;
295  std::unique_ptr<GenParticleCustomSelector> GpSelectorForEfficiencyVsPhi;
296  std::unique_ptr<GenParticleCustomSelector> GpSelectorForEfficiencyVsPt;
297  std::unique_ptr<GenParticleCustomSelector> GpSelectorForEfficiencyVsVTXR;
298  std::unique_ptr<GenParticleCustomSelector> GpSelectorForEfficiencyVsVTXZ;
299 
300  double minEta, maxEta;
301  int nintEta;
303  double minPt, maxPt;
304  int nintPt;
305  bool useInvPt;
306  bool useLogPt;
307  double minHit, maxHit;
308  int nintHit;
309  double minPu, maxPu;
310  int nintPu;
313  double minPhi, maxPhi;
314  int nintPhi;
315  double minDxy, maxDxy;
316  int nintDxy;
317  double minDz, maxDz;
318  int nintDz;
319  double dxyDzZoom;
323  double minZpos, maxZpos;
324  int nintZpos;
325  double mindr, maxdr;
326  int nintdr;
327  double mindrj, maxdrj;
328  int nintdrj;
329  double minChi2, maxChi2;
330  int nintChi2;
331  double minDeDx, maxDeDx;
332  int nintDeDx;
337  double minPVz, maxPVz;
338  int nintPVz;
339  double minMVA, maxMVA;
340  int nintMVA;
341 
342  const bool doSeedPlots_;
343  const bool doMTDPlots_;
344 
345  //
356 
357  double maxDzpvCum;
361 
362  std::vector<std::string> seedingLayerSetNames;
363  using SeedingLayerId =
364  std::tuple<SeedingLayerSetsBuilder::SeedingLayerId, bool>; // last bool for strip mono (true) or not (false)
365  using SeedingLayerSetId = std::array<SeedingLayerId, 4>;
366  std::map<SeedingLayerSetId, unsigned int> seedingLayerSetToBin;
367 };
368 
369 #endif
std::vector< std::vector< METype > > h_assoc2_mva_vs_eta_hp
std::vector< std::vector< METype > > h_assoc_mvacut
std::unique_ptr< TrackingParticleSelector > TpSelectorForEfficiencyVsPt
std::vector< std::vector< METype > > h_fake_mva_vs_pt_hp
std::unique_ptr< TrackingParticleSelector > TpSelectorForEfficiencyVsEta
std::vector< std::vector< METype > > h_assoc2_mva_vs_pt
std::unique_ptr< GenParticleCustomSelector > GpSelectorForEfficiencyVsVTXR
std::vector< std::vector< METype > > h_assoc2_mva_hp
std::unique_ptr< TrackingParticleSelector > TpSelectorForEfficiencyVsVTXR
std::map< SeedingLayerSetId, unsigned int > seedingLayerSetToBin
std::vector< std::vector< METype > > h_assoc2_mva_vs_eta
std::vector< std::vector< METype > > h_reco_mva
std::unique_ptr< GenParticleCustomSelector > GpSelectorForEfficiencyVsVTXZ
std::vector< std::vector< METype > > h_assoc2_mva_vs_pt_hp
double maxEta
std::vector< std::vector< METype > > h_dedx_estim
std::unique_ptr< GenParticleCustomSelector > GpSelectorForEfficiencyVsPt
std::vector< std::vector< METype > > h_simul2_mvacut_hp
std::unique_ptr< RecoTrackSelectorBase > trackSelectorVsPhi
std::vector< std::vector< METype > > h_reco_mva_hp
std::vector< std::vector< METype > > h_fake_mva_vs_pt
std::unique_ptr< GenParticleCustomSelector > GpSelectorForEfficiencyVsPhi
math::XYZPointD Point
point in the space
math::XYZTLorentzVectorD LorentzVector
std::tuple< SeedingLayerSetsBuilder::SeedingLayerId, bool > SeedingLayerId
std::vector< std::vector< METype > > h_assoc_mvacut_hp
std::unique_ptr< GenParticleCustomSelector > GpSelectorForEfficiencyVsEta
std::unique_ptr< TrackingParticleSelector > generalTpSelector
std::unique_ptr< RecoTrackSelectorBase > trackSelectorVsPt
bool isMatched(TrackingRecHit const &hit)
std::array< SeedingLayerId, 4 > SeedingLayerSetId
std::vector< std::vector< METype > > h_fake_mva_vs_eta_hp
std::unique_ptr< TrackingParticleSelector > TpSelectorForEfficiencyVsPhi
std::vector< std::vector< METype > > h_fake_mva_vs_eta
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
std::vector< std::vector< METype > > h_assoc2_mva
std::unique_ptr< TrackingParticleSelector > TpSelectorForEfficiencyVsVTXZ
std::vector< std::string > seedingLayerSetNames
Monte Carlo truth information used for tracking validation.
std::vector< std::vector< METype > > h_dedx_nom
std::vector< std::vector< METype > > h_reco_mvacut
std::unique_ptr< GenParticleCustomSelector > generalGpSelector
std::vector< std::vector< METype > > h_dedx_sat
math::XYZVectorD Vector
point in the space
std::unique_ptr< RecoTrackSelectorBase > trackSelectorVsEta
std::vector< std::vector< METype > > h_assoc2_mvacut
std::vector< std::vector< METype > > h_simul2_mvacut
std::vector< std::vector< METype > > h_reco_mvacut_hp
std::vector< std::vector< METype > > h_assoc2_mvacut_hp