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 
29 
30 namespace edm { class Event; class EventSetup; }
31 
33  public:
35  MTVHistoProducerAlgoForTracker(pset, beamSpotTag, doSeedPlots, iC) {}
38 
39  static std::unique_ptr<RecoTrackSelectorBase> makeRecoTrackSelectorFromTPSelectorParameters(const edm::ParameterSet& pset, const edm::InputTag& beamSpotTag, edm::ConsumesCollector& iC);
40  static std::unique_ptr<RecoTrackSelectorBase> makeRecoTrackSelectorFromTPSelectorParameters(const edm::ParameterSet& pset, const edm::InputTag& beamSpotTag, edm::ConsumesCollector&& iC) { return makeRecoTrackSelectorFromTPSelectorParameters(pset, beamSpotTag, iC); }
41 
42  void init(const edm::Event& event, const edm::EventSetup& setup);
43 
44  void bookSimHistos(DQMStore::IBooker& ibook);
45  void bookSimTrackHistos(DQMStore::IBooker& ibook, bool doResolutionPlots);
46  void bookSimTrackPVAssociationHistos(DQMStore::IBooker& ibook);
47  void bookRecoHistos(DQMStore::IBooker& ibook, bool doResolutionPlots);
48  void bookRecoPVAssociationHistos(DQMStore::IBooker& ibook);
49  void bookRecodEdxHistos(DQMStore::IBooker& ibook);
50  void bookSeedHistos(DQMStore::IBooker& ibook);
51  void bookMVAHistos(DQMStore::IBooker& ibook, size_t nMVAs);
52 
53  void fill_generic_simTrack_histos(const TrackingParticle::Vector&,const TrackingParticle::Point& vertex, int bx);
54  void fill_simTrackBased_histos(int numSimTracks);
55 
56 
57  void fill_recoAssociated_simTrack_histos(int count,
58  const TrackingParticle& tp,
59  const TrackingParticle::Vector& momentumTP, const TrackingParticle::Point& vertexTP,
60  double dxy, double dz,
61  double dxyPV, double dzPV,
62  int nSimHits,
63  int nSimLayers, int nSimPixelLayers, int nSimStripMonoAndStereoLayers,
64  const reco::Track* track,
65  int numVertices,
66  double dR,
67  const math::XYZPoint *pvPosition,
68  const TrackingVertex::LorentzVector *simPVPosition,
69  const math::XYZPoint& bsPosition,
70  const std::vector<float>& mvas,
71  unsigned int selectsLoose, unsigned int selectsHP);
72 
73  void fill_recoAssociated_simTrack_histos(int count,
74  const reco::GenParticle& tp,
75  const TrackingParticle::Vector& momentumTP, const TrackingParticle::Point& vertexTP,
76  double dxy, double dz, int nSimHits,
77  const reco::Track* track,
78  int numVertices);
79 
80  void fill_duplicate_histos(int count,
81  const reco::Track& track1,
82  const reco::Track& track2);
83 
84  void fill_generic_recoTrack_histos(int count,
85  const reco::Track& track,
86  const TrackerTopology& ttopo,
87  const math::XYZPoint& bsPosition,
88  const math::XYZPoint *pvPosition,
89  const TrackingVertex::LorentzVector *simPVPosition,
90  bool isMatched,
91  bool isSigMatched,
92  bool isChargeMatched,
93  int numAssocRecoTracks,
94  int numVertices,
95  int nSimHits,
96  double sharedFraction,
97  double dR,
98  const std::vector<float>& mvas,
99  unsigned int selectsLoose, unsigned int selectsHP);
100 
101  void fill_dedx_recoTrack_histos(int count, const edm::RefToBase<reco::Track>& trackref, const std::vector< const edm::ValueMap<reco::DeDxData> *>& v_dEdx);
102 
103  void fill_simAssociated_recoTrack_histos(int count,
104  const reco::Track& track);
105 
106  void fill_trackBased_histos(int count,
107  int assTracks,
108  int numRecoTracks,
109  int numRecoTracksSelected,
110  int numSimTracksSelected);
111 
112 
113  void fill_ResoAndPull_recoTrack_histos(int count,
114  const TrackingParticle::Vector& momentumTP,
115  const TrackingParticle::Point& vertexTP,
116  int chargeTP,
117  const reco::Track& track,
118  const math::XYZPoint& bsPosition);
119 
120  void fill_seed_histos(int count, int seedsFitFailed, int seedsTotal);
121 
122  private:
123 
125  void getRecoMomentum (const reco::Track& track, double& pt, double& ptError,
126  double& qoverp, double& qoverpError, double& lambda, double& lambdaError,
127  double& phi, double& phiError ) const;
129  void getRecoMomentum (const reco::GsfTrack& gsfTrack, double& pt, double& ptError,
130  double& qoverp, double& qoverpError, double& lambda, double& lambdaError,
131  double& phi, double& phiError) const;
132 
133  double getEta(double eta);
134 
135  double getPt(double pt);
136 
137  unsigned int getSeedingLayerSetBin(const reco::Track& track, const TrackerTopology& ttopo);
138 
139  //private data members
140  std::unique_ptr<TrackingParticleSelector> generalTpSelector;
141  std::unique_ptr<TrackingParticleSelector> TpSelectorForEfficiencyVsEta;
142  std::unique_ptr<TrackingParticleSelector> TpSelectorForEfficiencyVsPhi;
143  std::unique_ptr<TrackingParticleSelector> TpSelectorForEfficiencyVsPt;
144  std::unique_ptr<TrackingParticleSelector> TpSelectorForEfficiencyVsVTXR;
145  std::unique_ptr<TrackingParticleSelector> TpSelectorForEfficiencyVsVTXZ;
146 
147  std::unique_ptr<RecoTrackSelectorBase> trackSelectorVsEta;
148  std::unique_ptr<RecoTrackSelectorBase> trackSelectorVsPhi;
149  std::unique_ptr<RecoTrackSelectorBase> trackSelectorVsPt;
150 
151  std::unique_ptr<GenParticleCustomSelector> generalGpSelector;
152  std::unique_ptr<GenParticleCustomSelector> GpSelectorForEfficiencyVsEta;
153  std::unique_ptr<GenParticleCustomSelector> GpSelectorForEfficiencyVsPhi;
154  std::unique_ptr<GenParticleCustomSelector> GpSelectorForEfficiencyVsPt;
155  std::unique_ptr<GenParticleCustomSelector> GpSelectorForEfficiencyVsVTXR;
156  std::unique_ptr<GenParticleCustomSelector> GpSelectorForEfficiencyVsVTXZ;
157 
158  double minEta, maxEta; int nintEta; bool useFabsEta;
159  double minPt, maxPt; int nintPt; bool useInvPt; bool useLogPt;
160  double minHit, maxHit; int nintHit;
161  double minPu, maxPu; int nintPu;
163  double minPhi, maxPhi; int nintPhi;
164  double minDxy, maxDxy; int nintDxy;
165  double minDz, maxDz; int nintDz;
166  double dxyDzZoom;
168  double minZpos, maxZpos; int nintZpos;
169  double mindr, maxdr; int nintdr;
170  double minChi2, maxChi2; int nintChi2;
171  double minDeDx, maxDeDx; int nintDeDx;
174  double minPVz, maxPVz; int nintPVz;
175  double minMVA, maxMVA; int nintMVA;
176 
177  const bool doSeedPlots_;
178 
179  //
185 
186  double maxDzpvCum; int nintDzpvCum;
187  double maxDzpvsigCum; int nintDzpvsigCum;
188 
189  std::vector<std::string> seedingLayerSetNames;
190  using SeedingLayerId = std::tuple<SeedingLayerSetsBuilder::SeedingLayerId, bool>; // last bool for strip mono (true) or not (false)
191  using SeedingLayerSetId = std::array<SeedingLayerId, 4>;
192  std::map<SeedingLayerSetId, unsigned int> seedingLayerSetToBin;
193 
194  //sim
195  MonitorElement *h_ptSIM, *h_etaSIM, *h_tracksSIM, *h_vertposSIM, *h_bunchxSIM;
196 
197  //1D
198  std::vector<MonitorElement*> h_tracks, h_fakes, h_hits, h_charge, h_algo, h_seedsFitFailed, h_seedsFitFailedFraction;
199  std::vector<MonitorElement*> h_recoeta, h_reco2eta, h_assoceta, h_assoc2eta, h_simuleta, h_loopereta, h_misideta, h_pileupeta;
200  std::vector<MonitorElement*> h_recopT, h_reco2pT, h_assocpT, h_assoc2pT, h_simulpT, h_looperpT, h_misidpT, h_pileuppT;
201  std::vector<MonitorElement*> h_recohit, h_assochit, h_assoc2hit, h_simulhit, h_looperhit, h_misidhit, h_pileuphit;
202  std::vector<MonitorElement*> h_recolayer, h_assoclayer, h_assoc2layer, h_simullayer, h_looperlayer, h_misidlayer, h_pileuplayer;
203  std::vector<MonitorElement*> h_recopixellayer, h_assocpixellayer, h_assoc2pixellayer, h_simulpixellayer, h_looperpixellayer, h_misidpixellayer, h_pileuppixellayer;
204  std::vector<MonitorElement*> h_reco3Dlayer, h_assoc3Dlayer, h_assoc23Dlayer, h_simul3Dlayer, h_looper3Dlayer, h_misid3Dlayer, h_pileup3Dlayer;
205  std::vector<MonitorElement*> h_recopu, h_reco2pu, h_assocpu, h_assoc2pu, h_simulpu, h_looperpu, h_misidpu, h_pileuppu;
206  std::vector<MonitorElement*> h_recophi, h_assocphi, h_assoc2phi, h_simulphi, h_looperphi, h_misidphi, h_pileupphi;
207  std::vector<MonitorElement*> h_recodxy, h_assocdxy, h_assoc2dxy, h_simuldxy, h_looperdxy, h_misiddxy, h_pileupdxy;
208  std::vector<MonitorElement*> h_recodz, h_assocdz, h_assoc2dz, h_simuldz, h_looperdz, h_misiddz, h_pileupdz;
209  std::vector<MonitorElement*> h_recodxypv, h_assocdxypv, h_assoc2dxypv, h_simuldxypv, h_looperdxypv, h_misiddxypv, h_pileupdxypv;
210  std::vector<MonitorElement*> h_recodzpv, h_assocdzpv, h_assoc2dzpv, h_simuldzpv, h_looperdzpv, h_misiddzpv, h_pileupdzpv;
211  std::vector<MonitorElement*> h_recodxypvzoomed, h_assocdxypvzoomed, h_assoc2dxypvzoomed, h_simuldxypvzoomed, h_looperdxypvzoomed, h_misiddxypvzoomed, h_pileupdxypvzoomed;
212  std::vector<MonitorElement*> h_recodzpvzoomed, h_assocdzpvzoomed, h_assoc2dzpvzoomed, h_simuldzpvzoomed, h_looperdzpvzoomed, h_misiddzpvzoomed, h_pileupdzpvzoomed;
213 
214  std::vector<MonitorElement*> h_recovertpos, h_assocvertpos, h_assoc2vertpos, h_simulvertpos, h_loopervertpos, h_pileupvertpos;
215  std::vector<MonitorElement*> h_recozpos, h_assoczpos, h_assoc2zpos, h_simulzpos, h_looperzpos, h_pileupzpos;
216  std::vector<MonitorElement*> h_assocdr, h_assoc2dr, h_simuldr, h_recodr, h_looperdr, h_pileupdr;
217  std::vector<MonitorElement*> h_recochi2, h_assoc2chi2, h_looperchi2, h_misidchi2, h_pileupchi2;
218  std::vector<MonitorElement*> h_pt, h_eta, h_pullTheta,h_pullPhi,h_pullDxy,h_pullDz,h_pullQoverp;
219  std::vector<MonitorElement*> h_assoc2_itpu_eta, h_assoc2_itpu_sig_eta, h_assoc2eta_sig;
220  std::vector<MonitorElement*> h_assoc2_itpu_vertcount, h_assoc2_itpu_sig_vertcount;
221  std::vector<MonitorElement*> h_assoc2_ootpu_eta, h_assoc2_ootpu_vertcount;
222  std::vector<MonitorElement*> h_reco_ootpu_eta, h_reco_ootpu_vertcount;
223  std::vector<MonitorElement*> h_con_eta, h_con_vertcount, h_con_zpos;
224 
225  std::vector<MonitorElement*> h_reco_dzpvcut, h_assoc_dzpvcut, h_assoc2_dzpvcut, h_simul_dzpvcut, h_simul2_dzpvcut, h_pileup_dzpvcut;
226  std::vector<MonitorElement*> h_reco_dzpvsigcut, h_assoc_dzpvsigcut, h_assoc2_dzpvsigcut, h_simul_dzpvsigcut, h_simul2_dzpvsigcut, h_pileup_dzpvsigcut;
227 
228  std::vector<MonitorElement*> h_reco_dzpvcut_pt, h_assoc_dzpvcut_pt, h_assoc2_dzpvcut_pt, h_simul_dzpvcut_pt, h_simul2_dzpvcut_pt, h_pileup_dzpvcut_pt;
229  std::vector<MonitorElement*> h_reco_dzpvsigcut_pt, h_assoc_dzpvsigcut_pt, h_assoc2_dzpvsigcut_pt, h_simul_dzpvsigcut_pt, h_simul2_dzpvsigcut_pt, h_pileup_dzpvsigcut_pt;
230  std::vector<MonitorElement*> h_reco_simpvz, h_assoc_simpvz, h_assoc2_simpvz, h_simul_simpvz, h_pileup_simpvz;
231 
232  std::vector<MonitorElement*> h_reco_seedingLayerSet, h_assoc2_seedingLayerSet, h_looper_seedingLayerSet, h_pileup_seedingLayerSet;
233 
234  std::vector<std::vector<MonitorElement*> > h_reco_mva, h_assoc2_mva;
235  std::vector<std::vector<MonitorElement*> > h_reco_mvacut, h_assoc_mvacut, h_assoc2_mvacut, h_simul2_mvacut;
236  std::vector<std::vector<MonitorElement*> > h_reco_mva_hp, h_assoc2_mva_hp;
237  std::vector<std::vector<MonitorElement*> > h_reco_mvacut_hp, h_assoc_mvacut_hp, h_assoc2_mvacut_hp, h_simul2_mvacut_hp;
238 
239  std::vector<std::vector<MonitorElement*> > h_assoc2_mva_vs_pt, h_fake_mva_vs_pt, h_assoc2_mva_vs_pt_hp, h_fake_mva_vs_pt_hp;
240  std::vector<std::vector<MonitorElement*> > h_assoc2_mva_vs_eta, h_fake_mva_vs_eta, h_assoc2_mva_vs_eta_hp, h_fake_mva_vs_eta_hp;
241 
242  // dE/dx
243  // in the future these might become an array
244  std::vector<std::vector<MonitorElement*>> h_dedx_estim;
245  std::vector<std::vector<MonitorElement*>> h_dedx_nom;
246  std::vector<std::vector<MonitorElement*>> h_dedx_sat;
247 
248  //2D
249  std::vector<MonitorElement*> nrec_vs_nsim;
250  std::vector<MonitorElement*> nrecHit_vs_nsimHit_sim2rec;
251  std::vector<MonitorElement*> nrecHit_vs_nsimHit_rec2sim;
252  std::vector<MonitorElement*> h_duplicates_oriAlgo_vs_oriAlgo;
253 
254  //assoc hits
255  std::vector<MonitorElement*> h_assocFraction, h_assocSharedHit;
256 
257  //#hit vs eta: to be used with doProfileX
258  std::vector<MonitorElement*> nhits_vs_eta,
259  nPXBhits_vs_eta, nPXFhits_vs_eta, nPXLhits_vs_eta,
260  nTIBhits_vs_eta,nTIDhits_vs_eta,
261  nTOBhits_vs_eta,nTEChits_vs_eta, nSTRIPhits_vs_eta,
262  nLayersWithMeas_vs_eta, nPXLlayersWithMeas_vs_eta,
263  nSTRIPlayersWithMeas_vs_eta, nSTRIPlayersWith1dMeas_vs_eta, nSTRIPlayersWith2dMeas_vs_eta;
264 
265 
266  //---- second set of histograms (originally not used by the SeedGenerator)
267  //1D
268  std::vector<MonitorElement*> h_nchi2, h_nchi2_prob, h_losthits, h_nmisslayers_inner, h_nmisslayers_outer;
269 
270  //2D
271  std::vector<MonitorElement*> chi2_vs_nhits, etares_vs_eta;
272  std::vector<MonitorElement*> h_ptshifteta;
273  std::vector<MonitorElement*> ptres_vs_phi, chi2_vs_phi, nhits_vs_phi, phires_vs_phi;
274 
275  //Profile2D
276  std::vector<MonitorElement*> ptmean_vs_eta_phi, phimean_vs_eta_phi;
277 
278  //assoc chi2
279  std::vector<MonitorElement*> h_assochi2, h_assochi2_prob;
280 
281  //chi2 and # lost hits vs eta: to be used with doProfileX
282  std::vector<MonitorElement*> chi2_vs_eta, nlosthits_vs_eta;
283 
284  //resolution of track params: to be used with fitslicesytool
285  std::vector<MonitorElement*> dxyres_vs_eta, ptres_vs_eta, dzres_vs_eta, phires_vs_eta, cotThetares_vs_eta;
286  std::vector<MonitorElement*> dxyres_vs_pt, ptres_vs_pt, dzres_vs_pt, phires_vs_pt, cotThetares_vs_pt;
287 
288  //pulls of track params vs eta: to be used with fitslicesytool
289  std::vector<MonitorElement*> dxypull_vs_eta, ptpull_vs_eta, dzpull_vs_eta, phipull_vs_eta, thetapull_vs_eta;
290  std::vector<MonitorElement*> ptpull_vs_phi, phipull_vs_phi, thetapull_vs_phi;
291 };
292 
293 #endif
std::unique_ptr< TrackingParticleSelector > TpSelectorForEfficiencyVsPt
std::unique_ptr< TrackingParticleSelector > TpSelectorForEfficiencyVsEta
std::vector< MonitorElement * > h_simuldxypvzoomed
std::vector< MonitorElement * > h_assoc2_ootpu_vertcount
std::unique_ptr< GenParticleCustomSelector > GpSelectorForEfficiencyVsVTXR
std::vector< MonitorElement * > h_simulzpos
std::vector< MonitorElement * > nrecHit_vs_nsimHit_rec2sim
std::vector< MonitorElement * > h_simulpT
std::vector< MonitorElement * > h_ptshifteta
std::vector< MonitorElement * > h_simul_dzpvsigcut
std::unique_ptr< TrackingParticleSelector > TpSelectorForEfficiencyVsVTXR
std::map< SeedingLayerSetId, unsigned int > seedingLayerSetToBin
std::vector< std::vector< MonitorElement * > > h_dedx_estim
std::vector< MonitorElement * > nrec_vs_nsim
int init
Definition: HydjetWrapper.h:67
std::vector< MonitorElement * > h_simul_dzpvcut_pt
static float getEta(float eta, int bits=5)
std::unique_ptr< GenParticleCustomSelector > GpSelectorForEfficiencyVsVTXZ
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
double maxEta
std::vector< MonitorElement * > h_simuleta
std::unique_ptr< GenParticleCustomSelector > GpSelectorForEfficiencyVsPt
std::unique_ptr< RecoTrackSelectorBase > trackSelectorVsPhi
static std::unique_ptr< RecoTrackSelectorBase > makeRecoTrackSelectorFromTPSelectorParameters(const edm::ParameterSet &pset, const edm::InputTag &beamSpotTag, edm::ConsumesCollector &&iC)
std::vector< MonitorElement * > h_assoc2_itpu_vertcount
std::vector< std::vector< MonitorElement * > > h_simul2_mvacut
std::unique_ptr< GenParticleCustomSelector > GpSelectorForEfficiencyVsPhi
std::vector< MonitorElement * > nlosthits_vs_eta
math::XYZPointD Point
point in the space
math::XYZTLorentzVectorD LorentzVector
std::vector< std::vector< MonitorElement * > > h_dedx_sat
std::vector< MonitorElement * > h_simulpu
std::vector< MonitorElement * > h_simuldzpv
std::tuple< SeedingLayerSetsBuilder::SeedingLayerId, bool > SeedingLayerId
std::vector< MonitorElement * > h_simuldr
std::vector< MonitorElement * > h_assoc2eta_sig
std::vector< MonitorElement * > nTOBhits_vs_eta
std::vector< MonitorElement * > etares_vs_eta
std::unique_ptr< GenParticleCustomSelector > GpSelectorForEfficiencyVsEta
std::unique_ptr< TrackingParticleSelector > generalTpSelector
std::vector< MonitorElement * > h_tracks
std::unique_ptr< RecoTrackSelectorBase > trackSelectorVsPt
std::vector< MonitorElement * > h_simul_simpvz
std::vector< std::vector< MonitorElement * > > h_reco_mva
std::vector< MonitorElement * > nrecHit_vs_nsimHit_sim2rec
bool isMatched(TrackingRecHit const &hit)
std::vector< MonitorElement * > h_duplicates_oriAlgo_vs_oriAlgo
std::vector< MonitorElement * > h_assochi2_prob
std::vector< MonitorElement * > h_simuldzpvzoomed
std::vector< MonitorElement * > h_simullayer
std::vector< MonitorElement * > h_simuldz
std::vector< MonitorElement * > thetapull_vs_phi
std::vector< MonitorElement * > h_simulvertpos
std::array< SeedingLayerId, 4 > SeedingLayerSetId
std::vector< std::vector< MonitorElement * > > h_simul2_mvacut_hp
std::vector< MonitorElement * > h_simuldxypv
std::vector< MonitorElement * > h_simulpixellayer
std::vector< MonitorElement * > h_simul_dzpvcut
std::vector< MonitorElement * > h_nmisslayers_outer
std::unique_ptr< TrackingParticleSelector > TpSelectorForEfficiencyVsPhi
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
std::vector< MonitorElement * > h_simul_dzpvsigcut_pt
std::vector< std::vector< MonitorElement * > > h_fake_mva_vs_eta_hp
std::vector< MonitorElement * > h_simulphi
std::vector< MonitorElement * > h_pullTheta
std::vector< MonitorElement * > ptmean_vs_eta_phi
std::unique_ptr< TrackingParticleSelector > TpSelectorForEfficiencyVsVTXZ
std::vector< std::string > seedingLayerSetNames
HLT enums.
std::vector< MonitorElement * > ptres_vs_eta
std::vector< MonitorElement * > h_simulhit
std::vector< MonitorElement * > h_con_zpos
Monte Carlo truth information used for tracking validation.
std::vector< std::vector< MonitorElement * > > h_fake_mva_vs_pt_hp
MTVHistoProducerAlgoForTracker(const edm::ParameterSet &pset, const edm::InputTag &beamSpotTag, const bool doSeedPlots, edm::ConsumesCollector &&iC)
std::unique_ptr< GenParticleCustomSelector > generalGpSelector
std::vector< MonitorElement * > ptres_vs_pt
math::XYZVectorD Vector
point in the space
std::vector< MonitorElement * > h_reco_ootpu_vertcount
std::vector< std::vector< MonitorElement * > > h_dedx_nom
std::vector< MonitorElement * > h_reco_seedingLayerSet
std::unique_ptr< RecoTrackSelectorBase > trackSelectorVsEta
std::vector< MonitorElement * > h_recochi2
std::vector< MonitorElement * > ptres_vs_phi
std::vector< MonitorElement * > h_assocSharedHit
std::vector< MonitorElement * > h_simul3Dlayer
std::vector< std::vector< MonitorElement * > > h_reco_mva_hp
std::vector< MonitorElement * > h_simuldxy
std::vector< MonitorElement * > thetapull_vs_eta
Definition: event.py:1