CMS 3D CMS Logo

SiPixelPhase1TrackResiduals.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiPixelPhase1TrackResiduals
4 // Class: SiPixelPhase1TrackResiduals
5 //
6 
7 // Original Author: Marcel Schneider
8 
13 
22 
23 namespace {
24 
25  class SiPixelPhase1TrackResiduals final : public SiPixelPhase1Base {
26  enum { RESIDUAL_X, RESIDUAL_Y, RESONEDGE_X, RESONEDGE_Y, RESOTHERBAD_X, RESOTHERBAD_Y };
27 
28  public:
29  explicit SiPixelPhase1TrackResiduals(const edm::ParameterSet& conf);
30  void analyze(const edm::Event&, const edm::EventSetup&) override;
31 
32  private:
34  edm::EDGetTokenT<reco::VertexCollection> offlinePrimaryVerticesToken_;
35 
36  bool applyVertexCut_;
37  };
38 
39  SiPixelPhase1TrackResiduals::SiPixelPhase1TrackResiduals(const edm::ParameterSet& iConfig)
40  : SiPixelPhase1Base(iConfig), validator(iConfig, consumesCollector()) {
41  applyVertexCut_ = iConfig.getUntrackedParameter<bool>("VertexCut", true);
42 
43  offlinePrimaryVerticesToken_ = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertices"));
44  }
45 
47  if (!checktrigger(iEvent, iSetup, DCS))
48  return;
49 
52  assert(tracker.isValid());
53 
55  if (applyVertexCut_) {
56  iEvent.getByToken(offlinePrimaryVerticesToken_, vertices);
57  if (!vertices.isValid() || vertices->empty())
58  return;
59  }
60 
61  std::vector<TrackerValidationVariables::AVTrackStruct> vtracks;
62 
63  validator.fillTrackQuantities(
64  iEvent,
65  iSetup,
66  // tell the validator to only look at good tracks
67  [&](const reco::Track& track) -> bool {
68  return (!applyVertexCut_ ||
69  (track.pt() > 0.75 && std::abs(track.dxy(vertices->at(0).position())) < 5 * track.dxyError()));
70  },
71  vtracks);
72 
73  for (auto& track : vtracks) {
74  for (auto& it : track.hits) {
75  auto id = DetId(it.rawDetId);
76  auto isPixel = id.subdetId() == 1 || id.subdetId() == 2;
77  if (!isPixel)
78  continue;
79 
80  histo[RESIDUAL_X].fill(it.resXprime, id, &iEvent);
81  histo[RESIDUAL_Y].fill(it.resYprime, id, &iEvent);
82 
83  if (it.isOnEdgePixel) {
84  histo[RESONEDGE_X].fill(it.resXprime, id, &iEvent);
85  histo[RESONEDGE_Y].fill(it.resYprime, id, &iEvent);
86  }
87 
88  if (it.isOtherBadPixel) {
89  histo[RESOTHERBAD_X].fill(it.resXprime, id, &iEvent);
90  histo[RESOTHERBAD_Y].fill(it.resYprime, id, &iEvent);
91  }
92  }
93  }
94  }
95 
96 } // namespace
97 
98 DEFINE_FWK_MODULE(SiPixelPhase1TrackResiduals);
TrackerValidationVariables.h
TrackerGeometry.h
PixelTopology.h
ESHandle.h
edm::EDGetTokenT< reco::VertexCollection >
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:279
cms::cuda::assert
assert(be >=bs)
TrackerValidationVariables
Definition: TrackerValidationVariables.h:22
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle< reco::VertexCollection >
SiPixelPhase1Base
Definition: SiPixelPhase1Base.h:46
DetId
Definition: DetId.h:17
MakerMacros.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
reco::Track
Definition: Track.h:27
edm::ESHandle< TrackerGeometry >
SiPixelRecHit.h
Vertex.h
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
TrackerDigiGeometryRecord.h
edm::ParameterSet
Definition: ParameterSet.h:36
fastTrackerRecHitType::isPixel
bool isPixel(HitType hitType)
Definition: FastTrackerRecHit.h:37
CertificationClient_cfi.DCS
DCS
Definition: CertificationClient_cfi.py:9
iEvent
int iEvent
Definition: GenABIO.cc:224
analyze
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
SiPixelPhase1Base::analyze
void analyze(edm::Event const &e, edm::EventSetup const &) override=0
VertexFwd.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
SiPixelPhase1Base.h
PixelGeomDetUnit.h
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7