CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L3MumuTrackingRegion.h
Go to the documentation of this file.
1 #ifndef HLTrigger_btau_L3MumuTrackingRegion_H
2 #define HLTrigger_btau_L3MumuTrackingRegion_H
3 
6 
15 
17 
18 public:
19 
21 
22  edm::ParameterSet regionPSet = cfg.getParameter<edm::ParameterSet>("RegionPSet");
23 
24  theVertexTag = regionPSet.getParameter<edm::InputTag>("vertexSrc");
25  theVertex = (theVertexTag.label().length()>1);
26  theInputTrkTag = regionPSet.getParameter<edm::InputTag>("TrkSrc");
27  useVtxTks = regionPSet.getParameter<bool>("UseVtxTks");
28 
29  if (theVertex) theVertexToken = iC.consumes<reco::VertexCollection>(theVertexTag);
30  if (!(theVertex && useVtxTks)) theInputTrkToken= iC.consumes<reco::TrackCollection>(theInputTrkTag);
31 
32  thePtMin = regionPSet.getParameter<double>("ptMin");
33  theOriginRadius = regionPSet.getParameter<double>("originRadius");
34  theOriginHalfLength = regionPSet.getParameter<double>("originHalfLength");
35  theOriginZPos = regionPSet.getParameter<double>("vertexZDefault");
36 
37  theDeltaEta = regionPSet.getParameter<double>("deltaEtaRegion");
38  theDeltaPhi = regionPSet.getParameter<double>("deltaPhiRegion");
39  if (regionPSet.exists("searchOpt")){
40  m_searchOpt = regionPSet.getParameter<bool>("searchOpt");
41  }
42  else{
43  m_searchOpt = false;
44  }
47  if (regionPSet.exists("measurementTrackerName")){
48  m_measurementTracker = regionPSet.getParameter<std::string>("measurementTrackerName");
49  if (regionPSet.exists("howToUseMeasurementTracker")){
50  m_howToUseMeasurementTracker = regionPSet.getParameter<double>("howToUseMeasurementTracker");
51  }
52  }
53  }
54 
56 
57  virtual std::vector<TrackingRegion* > regions(const edm::Event& ev,
58  const edm::EventSetup& es) const {
59 
60  std::vector<TrackingRegion* > result;
61 
62  // optional constraint for vertex
63  // get highest Pt pixel vertex (if existing)
64  double deltaZVertex = theOriginHalfLength;
65  double originz = theOriginZPos;
66  if (theVertex) {
68  ev.getByToken(theVertexToken,vertices);
69  const reco::VertexCollection vertCollection = *(vertices.product());
70  reco::VertexCollection::const_iterator ci = vertCollection.begin();
71  if (vertCollection.size()>0) {
72  originz = ci->z();
73  } else {
74  originz = theOriginZPos;
75  deltaZVertex = 15.;
76  }
77  if (useVtxTks) {
78  for(ci=vertCollection.begin();ci!=vertCollection.end();ci++)
79  for (reco::Vertex::trackRef_iterator trackIt = ci->tracks_begin();trackIt != ci->tracks_end();trackIt++){
80  reco::TrackRef iTrk = (*trackIt).castTo<reco::TrackRef>() ;
81  GlobalVector dirVector((iTrk)->px(),(iTrk)->py(),(iTrk)->pz());
82  result.push_back(
83  new RectangularEtaPhiTrackingRegion( dirVector, GlobalPoint(0,0,float(ci->z())),
86  true,
88  m_searchOpt) );
89  }
90  return result;
91  }
92  }
93 
96  for(reco::TrackCollection::const_iterator iTrk = trks->begin();iTrk != trks->end();iTrk++) {
97  GlobalVector dirVector((iTrk)->px(),(iTrk)->py(),(iTrk)->pz());
98  result.push_back(
99  new RectangularEtaPhiTrackingRegion( dirVector, GlobalPoint(0,0,float(originz)),
102  true,
104  m_searchOpt) );
105  }
106  return result;
107  }
108 
109 private:
110 
112  bool theVertex;
116 
117  bool useVtxTks;
118 
119  double thePtMin;
123 
124  double theDeltaEta;
125  double theDeltaPhi;
129 };
130 
131 #endif
132 
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::EDGetTokenT< reco::TrackCollection > theInputTrkToken
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
edm::EDGetTokenT< reco::VertexCollection > theVertexToken
virtual std::vector< TrackingRegion * > regions(const edm::Event &ev, const edm::EventSetup &es) const
tuple result
Definition: query.py:137
T const * product() const
Definition: Handle.h:81
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector&lt;TrackRef&gt;
Definition: Vertex.h:37
bool isUninitialized() const
Definition: EDGetToken.h:71
L3MumuTrackingRegion(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)