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 
25 
26 // Math
27 #include "Math/GenVector/VectorUtil.h"
28 #include "Math/GenVector/PxPyPzE4D.h"
29 
31 
34 
36  public:
37 
40  {
41  edm::LogInfo ("HITRegionalPixelSeedGenerator")<<"Enter the HITRegionalPixelSeedGenerator";
42 
43  edm::ParameterSet regionPSet = conf_.getParameter<edm::ParameterSet>("RegionPSet");
44 
45  ptmin=regionPSet.getParameter<double>("ptMin");
46  originradius=regionPSet.getParameter<double>("originRadius");
47  halflength=regionPSet.getParameter<double>("originHalfLength");
48  etaCenter_=regionPSet.getParameter<double>("etaCenter");
49  phiCenter_=regionPSet.getParameter<double>("phiCenter");
50  deltaTrackEta = regionPSet.getParameter<double>("deltaEtaTrackRegion");
51  deltaTrackPhi = regionPSet.getParameter<double>("deltaPhiTrackRegion");
52  deltaL1JetEta = regionPSet.getParameter<double>("deltaEtaL1JetRegion");
53  deltaL1JetPhi = regionPSet.getParameter<double>("deltaPhiL1JetRegion");
54  usejets_ = regionPSet.getParameter<bool>("useL1Jets");
55  usetracks_ = regionPSet.getParameter<bool>("useTracks");
56  useIsoTracks_ = regionPSet.getParameter<bool>("useIsoTracks");
57  fixedReg_ = regionPSet.getParameter<bool>("fixedReg");
58 
59  if (usetracks_) token_trks = iC.consumes<reco::TrackCollection>(regionPSet.getParameter<edm::InputTag>("trackSrc"));
60  if (usetracks_ || useIsoTracks_ || fixedReg_ || usejets_)
61  token_vertex = iC.consumes<reco::VertexCollection>(regionPSet.getParameter<edm::InputTag>("vertexSrc"));
62  if (useIsoTracks_) token_isoTrack = iC.consumes<trigger::TriggerFilterObjectWithRefs>(regionPSet.getParameter<edm::InputTag>("isoTrackSrc"));
63  if (usejets_) token_l1jet = iC.consumes<l1extra::L1JetParticleCollection>(regionPSet.getParameter<edm::InputTag>("l1tjetSrc"));
64  }
65 
67 
68 
69  virtual std::vector<TrackingRegion* > regions(const edm::Event& e, const edm::EventSetup& es) const
70  {
71  std::vector<TrackingRegion* > result;
72  float originz =0.;
73 
74  double deltaZVertex = halflength;
75 
76 
77 
78  if (usetracks_)
79  {
81  e.getByToken(token_trks, tracks);
82 
84  e.getByToken(token_vertex,vertices);
85  const reco::VertexCollection vertCollection = *(vertices.product());
86  reco::VertexCollection::const_iterator ci = vertCollection.begin();
87 
88  if(vertCollection.size() > 0)
89  {
90  originz = ci->z();
91  }
92  else
93  {
94  deltaZVertex = 15.;
95  }
96 
97  GlobalVector globalVector(0,0,1);
98  if(tracks->size() == 0) return result;
99 
100  reco::TrackCollection::const_iterator itr = tracks->begin();
101  for(;itr != tracks->end();itr++)
102  {
103 
104  GlobalVector ptrVec((itr)->px(),(itr)->py(),(itr)->pz());
105  globalVector = ptrVec;
106 
107 
108  RectangularEtaPhiTrackingRegion* etaphiRegion = new RectangularEtaPhiTrackingRegion(globalVector,
109  GlobalPoint(0,0,originz),
110  ptmin,
111  originradius,
112  deltaZVertex,
114  deltaTrackPhi);
115  result.push_back(etaphiRegion);
116 
117  }
118  }
119 
120  if (useIsoTracks_)
121  {
123  e.getByToken(token_isoTrack, isotracks);
124 
125  std::vector< edm::Ref<reco::IsolatedPixelTrackCandidateCollection> > isoPixTrackRefs;
126 
127  isotracks->getObjects(trigger::TriggerTrack, isoPixTrackRefs);
128 
130  e.getByToken(token_vertex,vertices);
131  const reco::VertexCollection vertCollection = *(vertices.product());
132  reco::VertexCollection::const_iterator ci = vertCollection.begin();
133 
134  if(vertCollection.size() > 0)
135  {
136  originz = ci->z();
137  }
138  else
139  {
140  deltaZVertex = 15.;
141  }
142 
143  GlobalVector globalVector(0,0,1);
144  if(isoPixTrackRefs.size() == 0) return result;
145 
146  for(uint32_t p=0; p<isoPixTrackRefs.size(); p++)
147  {
148  GlobalVector ptrVec((isoPixTrackRefs[p]->track())->px(),(isoPixTrackRefs[p]->track())->py(),(isoPixTrackRefs[p]->track())->pz());
149  globalVector = ptrVec;
150 
151  RectangularEtaPhiTrackingRegion* etaphiRegion = new RectangularEtaPhiTrackingRegion(globalVector,
152  GlobalPoint(0,0,originz),
153  ptmin,
154  originradius,
155  deltaZVertex,
157  deltaTrackPhi);
158  result.push_back(etaphiRegion);
159  }
160  }
161 
162  if (usejets_)
163  {
165  e.getByToken(token_l1jet, jets);
166 
168  e.getByToken(token_vertex, vertices);
169  const reco::VertexCollection vertCollection = *(vertices.product());
170  reco::VertexCollection::const_iterator ci = vertCollection.begin();
171  if(vertCollection.size() > 0)
172  {
173  originz = ci->z();
174  }
175  else
176  {
177  deltaZVertex = 15.;
178  }
179 
180  GlobalVector globalVector(0,0,1);
181  if(jets->size() == 0) return result;
182 
183  for (l1extra::L1JetParticleCollection::const_iterator iJet = jets->begin(); iJet != jets->end(); iJet++)
184  {
185  GlobalVector jetVector(iJet->p4().x(), iJet->p4().y(), iJet->p4().z());
186  GlobalPoint vertex(0, 0, originz);
187 
189  vertex,
190  ptmin,
191  originradius,
192  deltaZVertex,
194  deltaL1JetPhi );
195  result.push_back(etaphiRegion);
196  }
197  }
198  if (fixedReg_)
199  {
200  GlobalVector fixedVector(cos(phiCenter_)*sin(2*atan(exp(-etaCenter_))), sin(phiCenter_)*sin(2*atan(exp(-etaCenter_))), cos(2*atan(exp(-etaCenter_))));
201  GlobalPoint vertex(0, 0, originz);
202 
204  e.getByToken(token_vertex,vertices);
205  const reco::VertexCollection vertCollection = *(vertices.product());
206  reco::VertexCollection::const_iterator ci = vertCollection.begin();
207  if(vertCollection.size() > 0)
208  {
209  originz = ci->z();
210  }
211  else
212  {
213  deltaZVertex = 15.;
214  }
215 
216  RectangularEtaPhiTrackingRegion* etaphiRegion = new RectangularEtaPhiTrackingRegion( fixedVector,
217  vertex,
218  ptmin,
219  originradius,
220  deltaZVertex,
222  deltaL1JetPhi );
223  result.push_back(etaphiRegion);
224  }
225 
226  return result;
227  }
228 
229 
230  private:
232 
233  float ptmin;
235  float halflength;
236  double etaCenter_;
237  double phiCenter_;
242  bool usejets_;
244  bool fixedReg_;
250 
251 };
252 
253 #endif
254 
255 
256 
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::EDGetTokenT< reco::VertexCollection > token_vertex
edm::EDGetTokenT< l1extra::L1JetParticleCollection > token_l1jet
std::vector< L1JetParticle > L1JetParticleCollection
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:10
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > token_isoTrack
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
virtual std::vector< TrackingRegion * > regions(const edm::Event &e, const edm::EventSetup &es) const
tuple tracks
Definition: testEve_cfg.py:39
T const * product() const
Definition: Handle.h:81
HITRegionalPixelSeedGenerator(const edm::ParameterSet &conf_, edm::ConsumesCollector &&iC)
edm::EDGetTokenT< reco::TrackCollection > token_trks