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 
11 
20 
22  SiPixelPhase1Base(iConfig),
23  validator(iConfig, consumesCollector())
24 {
25  offlinePrimaryVerticesToken_ = consumes<reco::VertexCollection>(std::string("offlinePrimaryVertices"));
26  ApplyVertexCut_=iConfig.getParameter<bool>("VertexCut");
27 }
28 
30 
32  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
33  assert(tracker.isValid());
34 
36  iEvent.getByToken(offlinePrimaryVerticesToken_, vertices);
37 
38  if (ApplyVertexCut_ && (!vertices.isValid() || vertices->size() == 0)) return;
39 
40  std::vector<TrackerValidationVariables::AVTrackStruct> vtracks;
41 
42  validator.fillTrackQuantities(iEvent, iSetup,
43  // tell the validator to only look at good tracks
44  [&](const reco::Track& track) -> bool {
45  return (!ApplyVertexCut_ || (track.pt() > 0.75
46  && std::abs( track.dxy(vertices->at(0).position()) ) < 5*track.dxyError())) ;
47  }, vtracks);
48 
49  for (auto& track : vtracks) {
50  for (auto& it : track.hits) {
51  auto id = DetId(it.rawDetId);
52  auto isPixel = id.subdetId() == 1 || id.subdetId() == 2;
53  if (!isPixel) continue;
54 
55  //TO BE UPDATED WITH VINCENZO STUFF
56  /*
57  const PixelGeomDetUnit* geomdetunit = dynamic_cast<const PixelGeomDetUnit*> ( tracker->idToDet(id) );
58  const PixelTopology& topol = geomdetunit->specificTopology();
59 
60  float lpx=it.localX;
61  float lpy=it.localY;
62  LocalPoint lp(lpx,lpy);
63 
64  MeasurementPoint mp = topol.measurementPosition(lp);
65  int row = (int) mp.x();
66  int col = (int) mp.y();
67  */
68 
69  histo[RESIDUAL_X].fill(it.resXprime, id, &iEvent);
70  histo[RESIDUAL_Y].fill(it.resYprime, id, &iEvent);
71  }
72  }
73 
74 }
75 
77 
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
double dxyError() const
error on dxy
Definition: TrackBase.h:791
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void analyze(const edm::Event &, const edm::EventSetup &)
int iEvent
Definition: GenABIO.cc:230
double pt() const
track transverse momentum
Definition: TrackBase.h:616
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
SiPixelPhase1TrackResiduals(const edm::ParameterSet &conf)
TrackerValidationVariables validator
Definition: DetId.h:18
void fillTrackQuantities(const edm::Event &, const edm::EventSetup &, std::vector< AVTrackStruct > &v_avtrackout)
edm::EDGetTokenT< reco::VertexCollection > offlinePrimaryVerticesToken_
const T & get() const
Definition: EventSetup.h:56
std::vector< HistogramManager > histo
bool isPixel(HitType hitType)
bool isValid() const
Definition: ESHandle.h:47
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:586