CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HITRegionalPixelSeedGenerator.h
Go to the documentation of this file.
1 #ifndef HITRegionalPixelSeedGenerator_h
2 #define HITRegionalPixelSeedGenerator_h
3 
4 //
5 // Class: HITRegionalPixelSeedGenerator
6 
7 
24 
25 // Math
26 #include "Math/GenVector/VectorUtil.h"
27 #include "Math/GenVector/PxPyPzE4D.h"
28 
30 
33 
35  public:
36 
38  {
39  edm::LogInfo ("HITRegionalPixelSeedGenerator")<<"Enter the HITRegionalPixelSeedGenerator";
40 
41  edm::ParameterSet regionPSet = conf_.getParameter<edm::ParameterSet>("RegionPSet");
42 
43  ptmin=regionPSet.getParameter<double>("ptMin");
44  originradius=regionPSet.getParameter<double>("originRadius");
45  halflength=regionPSet.getParameter<double>("originHalfLength");
46  vertexSrc=regionPSet.getParameter<std::string>("vertexSrc");
47  etaCenter_=regionPSet.getParameter<double>("etaCenter");
48  phiCenter_=regionPSet.getParameter<double>("phiCenter");
49  deltaTrackEta = regionPSet.getParameter<double>("deltaEtaTrackRegion");
50  deltaTrackPhi = regionPSet.getParameter<double>("deltaPhiTrackRegion");
51  deltaL1JetEta = regionPSet.getParameter<double>("deltaEtaL1JetRegion");
52  deltaL1JetPhi = regionPSet.getParameter<double>("deltaPhiL1JetRegion");
53  tracksrc_ = regionPSet.getParameter<edm::InputTag>("trackSrc");
54  isoTracksrc_ = regionPSet.getParameter<edm::InputTag>("isoTrackSrc");
55  l1jetsrc_ = regionPSet.getParameter<edm::InputTag>("l1tjetSrc");
56  usejets_ = regionPSet.getParameter<bool>("useL1Jets");
57  usetracks_ = regionPSet.getParameter<bool>("useTracks");
58  useIsoTracks_ = regionPSet.getParameter<bool>("useIsoTracks");
59  fixedReg_ = regionPSet.getParameter<bool>("fixedReg");
60  }
61 
63 
64 
65  virtual std::vector<TrackingRegion* > regions(const edm::Event& e, const edm::EventSetup& es) const
66  {
67  std::vector<TrackingRegion* > result;
68  float originz =0.;
69 
70  double deltaZVertex = halflength;
71 
72 
73 
74  if (usetracks_)
75  {
77  e.getByLabel(tracksrc_, tracks);
78 
80  e.getByLabel(vertexSrc,vertices);
81  const reco::VertexCollection vertCollection = *(vertices.product());
82  reco::VertexCollection::const_iterator ci = vertCollection.begin();
83 
84  if(vertCollection.size() > 0)
85  {
86  originz = ci->z();
87  }
88  else
89  {
90  deltaZVertex = 15.;
91  }
92 
93  GlobalVector globalVector(0,0,1);
94  if(tracks->size() == 0) return result;
95 
96  reco::TrackCollection::const_iterator itr = tracks->begin();
97  for(;itr != tracks->end();itr++)
98  {
99 
100  GlobalVector ptrVec((itr)->px(),(itr)->py(),(itr)->pz());
101  globalVector = ptrVec;
102 
103 
104  RectangularEtaPhiTrackingRegion* etaphiRegion = new RectangularEtaPhiTrackingRegion(globalVector,
105  GlobalPoint(0,0,originz),
106  ptmin,
107  originradius,
108  deltaZVertex,
110  deltaTrackPhi);
111  result.push_back(etaphiRegion);
112 
113  }
114  }
115 
116  if (useIsoTracks_)
117  {
119  e.getByLabel(isoTracksrc_, isotracks);
120 
121  std::vector< edm::Ref<reco::IsolatedPixelTrackCandidateCollection> > isoPixTrackRefs;
122 
123  isotracks->getObjects(trigger::TriggerTrack, isoPixTrackRefs);
124 
126  e.getByLabel(vertexSrc,vertices);
127  const reco::VertexCollection vertCollection = *(vertices.product());
128  reco::VertexCollection::const_iterator ci = vertCollection.begin();
129 
130  if(vertCollection.size() > 0)
131  {
132  originz = ci->z();
133  }
134  else
135  {
136  deltaZVertex = 15.;
137  }
138 
139  GlobalVector globalVector(0,0,1);
140  if(isoPixTrackRefs.size() == 0) return result;
141 
142  for(uint32_t p=0; p<isoPixTrackRefs.size(); p++)
143  {
144  GlobalVector ptrVec((isoPixTrackRefs[p]->track())->px(),(isoPixTrackRefs[p]->track())->py(),(isoPixTrackRefs[p]->track())->pz());
145  globalVector = ptrVec;
146 
147  RectangularEtaPhiTrackingRegion* etaphiRegion = new RectangularEtaPhiTrackingRegion(globalVector,
148  GlobalPoint(0,0,originz),
149  ptmin,
150  originradius,
151  deltaZVertex,
153  deltaTrackPhi);
154  result.push_back(etaphiRegion);
155  }
156  }
157 
158  if (usejets_)
159  {
161  e.getByLabel(l1jetsrc_, jets);
162 
164  e.getByLabel(vertexSrc,vertices);
165  const reco::VertexCollection vertCollection = *(vertices.product());
166  reco::VertexCollection::const_iterator ci = vertCollection.begin();
167  if(vertCollection.size() > 0)
168  {
169  originz = ci->z();
170  }
171  else
172  {
173  deltaZVertex = 15.;
174  }
175 
176  GlobalVector globalVector(0,0,1);
177  if(jets->size() == 0) return result;
178 
179  for (l1extra::L1JetParticleCollection::const_iterator iJet = jets->begin(); iJet != jets->end(); iJet++)
180  {
181  GlobalVector jetVector(iJet->p4().x(), iJet->p4().y(), iJet->p4().z());
182  GlobalPoint vertex(0, 0, originz);
183 
185  vertex,
186  ptmin,
187  originradius,
188  deltaZVertex,
190  deltaL1JetPhi );
191  result.push_back(etaphiRegion);
192  }
193  }
194  if (fixedReg_)
195  {
196  GlobalVector fixedVector(cos(phiCenter_)*sin(2*atan(exp(-etaCenter_))), sin(phiCenter_)*sin(2*atan(exp(-etaCenter_))), cos(2*atan(exp(-etaCenter_))));
197  GlobalPoint vertex(0, 0, originz);
198 
200  e.getByLabel(vertexSrc,vertices);
201  const reco::VertexCollection vertCollection = *(vertices.product());
202  reco::VertexCollection::const_iterator ci = vertCollection.begin();
203  if(vertCollection.size() > 0)
204  {
205  originz = ci->z();
206  }
207  else
208  {
209  deltaZVertex = 15.;
210  }
211 
212  RectangularEtaPhiTrackingRegion* etaphiRegion = new RectangularEtaPhiTrackingRegion( fixedVector,
213  vertex,
214  ptmin,
215  originradius,
216  deltaZVertex,
218  deltaL1JetPhi );
219  result.push_back(etaphiRegion);
220  }
221 
222  return result;
223  }
224 
225 
226  private:
228 
229  float ptmin;
231  float halflength;
232  double etaCenter_;
233  double phiCenter_;
240  std::string vertexSrc;
242  bool usejets_;
244  bool fixedReg_;
246 
247 };
248 
249 #endif
250 
251 
252 
T getParameter(std::string const &) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
vector< PseudoJet > jets
tuple result
Definition: query.py:137
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
virtual std::vector< TrackingRegion * > regions(const edm::Event &e, const edm::EventSetup &es) const
tuple tracks
Definition: testEve_cfg.py:39
HITRegionalPixelSeedGenerator(const edm::ParameterSet &conf_)
T const * product() const
Definition: Handle.h:74