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