CMS 3D CMS Logo

HITRegionalPixelSeedGenerator.h
Go to the documentation of this file.
1 #ifndef HITRegionalPixelSeedGenerator_h
2 #define HITRegionalPixelSeedGenerator_h
3 
4 //
5 // Class: HITRegionalPixelSeedGenerator
6 
25 
26 // Math
27 #include "Math/GenVector/VectorUtil.h"
28 #include "Math/GenVector/PxPyPzE4D.h"
29 
31 
34 
36 public:
38  edm::LogInfo("HITRegionalPixelSeedGenerator") << "Enter the HITRegionalPixelSeedGenerator";
39 
40  edm::ParameterSet regionPSet = conf_.getParameter<edm::ParameterSet>("RegionPSet");
41 
42  ptmin = regionPSet.getParameter<double>("ptMin");
43  originradius = regionPSet.getParameter<double>("originRadius");
44  halflength = regionPSet.getParameter<double>("originHalfLength");
45  etaCenter_ = regionPSet.getParameter<double>("etaCenter");
46  phiCenter_ = regionPSet.getParameter<double>("phiCenter");
47  deltaTrackEta = regionPSet.getParameter<double>("deltaEtaTrackRegion");
48  deltaTrackPhi = regionPSet.getParameter<double>("deltaPhiTrackRegion");
49  deltaL1JetEta = regionPSet.getParameter<double>("deltaEtaL1JetRegion");
50  deltaL1JetPhi = regionPSet.getParameter<double>("deltaPhiL1JetRegion");
51  usejets_ = regionPSet.getParameter<bool>("useL1Jets");
52  usetracks_ = regionPSet.getParameter<bool>("useTracks");
53  useIsoTracks_ = regionPSet.getParameter<bool>("useIsoTracks");
54  fixedReg_ = regionPSet.getParameter<bool>("fixedReg");
55 
56  if (usetracks_)
57  token_trks = iC.consumes<reco::TrackCollection>(regionPSet.getParameter<edm::InputTag>("trackSrc"));
58  if (usetracks_ || useIsoTracks_ || fixedReg_ || usejets_)
59  token_vertex = iC.consumes<reco::VertexCollection>(regionPSet.getParameter<edm::InputTag>("vertexSrc"));
60  if (useIsoTracks_)
62  iC.consumes<trigger::TriggerFilterObjectWithRefs>(regionPSet.getParameter<edm::InputTag>("isoTrackSrc"));
63  if (usejets_)
64  token_l1jet = iC.consumes<l1extra::L1JetParticleCollection>(regionPSet.getParameter<edm::InputTag>("l1tjetSrc"));
65  }
66 
68 
69  std::vector<std::unique_ptr<TrackingRegion> > regions(const edm::Event& e, const edm::EventSetup& es) const override {
70  std::vector<std::unique_ptr<TrackingRegion> > result;
71  float originz = 0.;
72 
73  double deltaZVertex = halflength;
74 
75  if (usetracks_) {
77  e.getByToken(token_trks, tracks);
78 
80  e.getByToken(token_vertex, vertices);
81  const reco::VertexCollection vertCollection = *(vertices.product());
82  reco::VertexCollection::const_iterator ci = vertCollection.begin();
83 
84  if (!vertCollection.empty()) {
85  originz = ci->z();
86  } else {
87  deltaZVertex = 15.;
88  }
89 
90  GlobalVector globalVector(0, 0, 1);
91  if (tracks->empty())
92  return result;
93 
94  reco::TrackCollection::const_iterator itr = tracks->begin();
95  for (; itr != tracks->end(); itr++) {
96  GlobalVector ptrVec((itr)->px(), (itr)->py(), (itr)->pz());
97  globalVector = ptrVec;
98 
99  result.push_back(std::make_unique<RectangularEtaPhiTrackingRegion>(
100  globalVector, GlobalPoint(0, 0, originz), ptmin, originradius, deltaZVertex, deltaTrackEta, deltaTrackPhi));
101  }
102  }
103 
104  if (useIsoTracks_) {
106  e.getByToken(token_isoTrack, isotracks);
107 
108  std::vector<edm::Ref<reco::IsolatedPixelTrackCandidateCollection> > isoPixTrackRefs;
109 
110  isotracks->getObjects(trigger::TriggerTrack, isoPixTrackRefs);
111 
113  e.getByToken(token_vertex, vertices);
114  const reco::VertexCollection vertCollection = *(vertices.product());
115  reco::VertexCollection::const_iterator ci = vertCollection.begin();
116 
117  if (!vertCollection.empty()) {
118  originz = ci->z();
119  } else {
120  deltaZVertex = 15.;
121  }
122 
123  GlobalVector globalVector(0, 0, 1);
124  if (isoPixTrackRefs.empty())
125  return result;
126 
127  for (uint32_t p = 0; p < isoPixTrackRefs.size(); p++) {
128  GlobalVector ptrVec((isoPixTrackRefs[p]->track())->px(),
129  (isoPixTrackRefs[p]->track())->py(),
130  (isoPixTrackRefs[p]->track())->pz());
131  globalVector = ptrVec;
132 
133  result.push_back(std::make_unique<RectangularEtaPhiTrackingRegion>(
134  globalVector, GlobalPoint(0, 0, originz), ptmin, originradius, deltaZVertex, deltaTrackEta, deltaTrackPhi));
135  }
136  }
137 
138  if (usejets_) {
140  e.getByToken(token_l1jet, jets);
141 
143  e.getByToken(token_vertex, vertices);
144  const reco::VertexCollection vertCollection = *(vertices.product());
145  reco::VertexCollection::const_iterator ci = vertCollection.begin();
146  if (!vertCollection.empty()) {
147  originz = ci->z();
148  } else {
149  deltaZVertex = 15.;
150  }
151 
152  GlobalVector globalVector(0, 0, 1);
153  if (jets->empty())
154  return result;
155 
156  for (l1extra::L1JetParticleCollection::const_iterator iJet = jets->begin(); iJet != jets->end(); iJet++) {
157  GlobalVector jetVector(iJet->p4().x(), iJet->p4().y(), iJet->p4().z());
158  GlobalPoint vertex(0, 0, originz);
159 
160  result.push_back(std::make_unique<RectangularEtaPhiTrackingRegion>(
161  jetVector, vertex, ptmin, originradius, deltaZVertex, deltaL1JetEta, deltaL1JetPhi));
162  }
163  }
164  if (fixedReg_) {
165  GlobalVector fixedVector(cos(phiCenter_) * sin(2 * atan(exp(-etaCenter_))),
166  sin(phiCenter_) * sin(2 * atan(exp(-etaCenter_))),
167  cos(2 * atan(exp(-etaCenter_))));
168  GlobalPoint vertex(0, 0, originz);
169 
171  e.getByToken(token_vertex, vertices);
172  const reco::VertexCollection vertCollection = *(vertices.product());
173  reco::VertexCollection::const_iterator ci = vertCollection.begin();
174  if (!vertCollection.empty()) {
175  originz = ci->z();
176  } else {
177  deltaZVertex = 15.;
178  }
179 
180  result.push_back(std::make_unique<RectangularEtaPhiTrackingRegion>(
181  fixedVector, vertex, ptmin, originradius, deltaZVertex, deltaL1JetEta, deltaL1JetPhi));
182  }
183 
184  return result;
185  }
186 
187 private:
189 
190  float ptmin;
192  float halflength;
193  double etaCenter_;
194  double phiCenter_;
199  bool usejets_;
201  bool fixedReg_;
207 };
208 
209 #endif
T getParameter(std::string const &) const
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
std::vector< std::unique_ptr< TrackingRegion > > regions(const edm::Event &e, const edm::EventSetup &es) const override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
edm::EDGetTokenT< reco::VertexCollection > token_vertex
edm::EDGetTokenT< l1extra::L1JetParticleCollection > token_l1jet
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > token_isoTrack
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::vector< L1JetParticle > L1JetParticleCollection
T const * product() const
Definition: Handle.h:69
HITRegionalPixelSeedGenerator(const edm::ParameterSet &conf_, edm::ConsumesCollector &&iC)
edm::EDGetTokenT< reco::TrackCollection > token_trks