CMS 3D CMS Logo

L3MumuTrackingRegion.h
Go to the documentation of this file.
1 #ifndef HLTrigger_btau_L3MumuTrackingRegion_H
2 #define HLTrigger_btau_L3MumuTrackingRegion_H
3 
6 
16 
18 
19 public:
20 
22 
23  edm::ParameterSet regionPSet = cfg.getParameter<edm::ParameterSet>("RegionPSet");
24 
25  theVertexTag = regionPSet.getParameter<edm::InputTag>("vertexSrc");
26  theVertex = (theVertexTag.label().length()>1);
27  theInputTrkTag = regionPSet.getParameter<edm::InputTag>("TrkSrc");
28  useVtxTks = regionPSet.getParameter<bool>("UseVtxTks");
29 
30  if (theVertex) theVertexToken = iC.consumes<reco::VertexCollection>(theVertexTag);
31  if (!(theVertex && useVtxTks)) theInputTrkToken= iC.consumes<reco::TrackCollection>(theInputTrkTag);
32 
33  thePtMin = regionPSet.getParameter<double>("ptMin");
34  theOriginRadius = regionPSet.getParameter<double>("originRadius");
35  theOriginHalfLength = regionPSet.getParameter<double>("originHalfLength");
36  theOriginZPos = regionPSet.getParameter<double>("vertexZDefault");
37 
38  theDeltaEta = regionPSet.getParameter<double>("deltaEtaRegion");
39  theDeltaPhi = regionPSet.getParameter<double>("deltaPhiRegion");
40  if (regionPSet.exists("searchOpt")){
41  m_searchOpt = regionPSet.getParameter<bool>("searchOpt");
42  }
43  else{
44  m_searchOpt = false;
45  }
48  theMeasurementTrackerToken = iC.consumes<MeasurementTrackerEvent>(regionPSet.getParameter<edm::InputTag>("measurementTrackerName"));
49  }
50  }
51 
52  ~L3MumuTrackingRegion() override{}
53 
54  std::vector<std::unique_ptr<TrackingRegion> > regions(const edm::Event& ev,
55  const edm::EventSetup& es) const override {
56 
57  std::vector<std::unique_ptr<TrackingRegion> > result;
58 
59  const MeasurementTrackerEvent *measurementTracker = nullptr;
63  measurementTracker = hmte.product();
64  }
65 
66  // optional constraint for vertex
67  // get highest Pt pixel vertex (if existing)
68  double deltaZVertex = theOriginHalfLength;
69  double originz = theOriginZPos;
70  if (theVertex) {
72  ev.getByToken(theVertexToken,vertices);
73  const reco::VertexCollection vertCollection = *(vertices.product());
74  reco::VertexCollection::const_iterator ci = vertCollection.begin();
75  if (!vertCollection.empty()) {
76  originz = ci->z();
77  } else {
78  originz = theOriginZPos;
79  deltaZVertex = 15.;
80  }
81  if (useVtxTks) {
82  for(ci=vertCollection.begin();ci!=vertCollection.end();ci++)
83  for (reco::Vertex::trackRef_iterator trackIt = ci->tracks_begin();trackIt != ci->tracks_end();trackIt++){
84  reco::TrackRef iTrk = (*trackIt).castTo<reco::TrackRef>() ;
85  GlobalVector dirVector((iTrk)->px(),(iTrk)->py(),(iTrk)->pz());
86  result.push_back(
87  std::make_unique<RectangularEtaPhiTrackingRegion>( dirVector, GlobalPoint(0,0,float(ci->z())),
90  true,
91  measurementTracker,
92  m_searchOpt) );
93  }
94  return result;
95  }
96  }
97 
100  for(reco::TrackCollection::const_iterator iTrk = trks->begin();iTrk != trks->end();iTrk++) {
101  GlobalVector dirVector((iTrk)->px(),(iTrk)->py(),(iTrk)->pz());
102  result.push_back(
103  std::make_unique<RectangularEtaPhiTrackingRegion>( dirVector, GlobalPoint(0,0,float(originz)),
106  true,
107  measurementTracker,
108  m_searchOpt) );
109  }
110  return result;
111  }
112 
113 private:
114 
116  bool theVertex;
120 
121  bool useVtxTks;
122 
123  double thePtMin;
127 
128  double theDeltaEta;
129  double theDeltaPhi;
133 };
134 
135 #endif
136 
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
edm::EDGetTokenT< reco::TrackCollection > theInputTrkToken
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:15
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
bool ev
static UseMeasurementTracker stringToUseMeasurementTracker(const std::string &name)
edm::EDGetTokenT< reco::VertexCollection > theVertexToken
T const * product() const
Definition: Handle.h:81
edm::EDGetTokenT< MeasurementTrackerEvent > theMeasurementTrackerToken
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:37
RectangularEtaPhiTrackingRegion::UseMeasurementTracker m_howToUseMeasurementTracker
bool isUninitialized() const
Definition: EDGetToken.h:73
L3MumuTrackingRegion(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
std::vector< std::unique_ptr< TrackingRegion > > regions(const edm::Event &ev, const edm::EventSetup &es) const override