CMS 3D CMS Logo

TauRegionalPixelSeedGenerator.h
Go to the documentation of this file.
1 #ifndef TauRegionalPixelSeedGenerator_h
2 #define TauRegionalPixelSeedGenerator_h
3 
4 //
5 // Class: TauRegionalPixelSeedGenerator
6 
7 
23 // Math
24 #include "Math/GenVector/VectorUtil.h"
25 #include "Math/GenVector/PxPyPzE4D.h"
26 
28 
31 
32 
34  public:
35 
38  edm::LogInfo ("TauRegionalPixelSeedGenerator") << "Enter the TauRegionalPixelSeedGenerator";
39 
40  edm::ParameterSet regionPSet = conf_.getParameter<edm::ParameterSet>("RegionPSet");
41 
42  m_ptMin = regionPSet.getParameter<double>("ptMin");
43  m_originRadius = regionPSet.getParameter<double>("originRadius");
44  m_halfLength = regionPSet.getParameter<double>("originHalfLength");
45  m_deltaEta = regionPSet.getParameter<double>("deltaEtaRegion");
46  m_deltaPhi = regionPSet.getParameter<double>("deltaPhiRegion");
47  token_jet = iC.consumes<reco::CandidateView>(regionPSet.getParameter<edm::InputTag>("JetSrc"));
48  token_vertex = iC.consumes<reco::VertexCollection>(regionPSet.getParameter<edm::InputTag>("vertexSrc"));
49  if (regionPSet.exists("searchOpt")){
50  m_searchOpt = regionPSet.getParameter<bool>("searchOpt");
51  }
52  else{
53  m_searchOpt = false;
54  }
57  // temporary until everything migrated to InputTag
59  if(regionPSet.existsAs<edm::InputTag>("measurementTrackerName")) {
60  tag = regionPSet.getParameter<edm::InputTag>("measurementTrackerName");
61  }
62  else {
63  tag = edm::InputTag(regionPSet.getParameter<std::string>("measurementTrackerName"));
64  }
65 
67  }
68  }
69 
71 
72  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
74 
75  desc.add<double>("ptMin", 5.0);
76  desc.add<double>("originHalfLength", 0.2);
77  desc.add<double>("originRadius", 0.2);
78  desc.add<double>("deltaEtaRegion", 0.1);
79  desc.add<double>("deltaPhiRegion", 0.1);
80  desc.add<edm::InputTag>("JetSrc", edm::InputTag("icone5Tau1"));
81  desc.add<edm::InputTag>("vertexSrc", edm::InputTag("pixelVertices"));
82  desc.add<bool>("searchOpt", false);
83 
84  desc.add<std::string>("howToUseMeasurementTracker", "ForSiStrips");
85 
86  // allow both InputTag and string for the moment, use InputTag as the default
87  desc.addNode(edm::ParameterDescription<edm::InputTag>("measurementTrackerName", edm::InputTag("MeasurementTrackerEvent"), true) xor
88  edm::ParameterDescription<std::string>("measurementTrackerName", "MeasurementTrackerEvent", true));
89 
90  // Only for backwards-compatibility
92  descRegion.add<edm::ParameterSetDescription>("RegionPSet", desc);
93 
94  descriptions.add("tauRegionalPixelSeedTrackingRegions", descRegion);
95  }
96 
97 
98  virtual std::vector<std::unique_ptr<TrackingRegion> > regions(const edm::Event& e, const edm::EventSetup& es) const override {
99  std::vector<std::unique_ptr<TrackingRegion> > result;
100 
101  // double originZ;
102  double deltaZVertex, deltaRho;
103  GlobalPoint vertex;
104  // get the primary vertex
106  e.getByToken(token_vertex, h_vertices);
107  const reco::VertexCollection & vertices = * h_vertices;
108  if (not vertices.empty()) {
109 // originZ = vertices.front().z();
110  GlobalPoint myTmp(vertices.at(0).position().x(),vertices.at(0).position().y(), vertices.at(0).position().z());
111  vertex = myTmp;
112  deltaZVertex = m_halfLength;
113  deltaRho = m_originRadius;
114  } else {
115  // originZ = 0.;
116  GlobalPoint myTmp(0.,0.,0.);
117  vertex = myTmp;
118  deltaRho = 1.;
119  deltaZVertex = 15.;
120  }
121 
122  // get the jet direction
124  e.getByToken(token_jet, h_jets);
125 
130  measurementTracker = hmte.product();
131  }
132 
133  for(const reco::Candidate& myJet: *h_jets)
134  {
135  GlobalVector jetVector(myJet.momentum().x(),myJet.momentum().y(),myJet.momentum().z());
136 // GlobalPoint vertex(0, 0, originZ);
137  result.push_back(std::make_unique<RectangularEtaPhiTrackingRegion>( jetVector,
138  vertex,
139  m_ptMin,
140  deltaRho,
141  deltaZVertex,
142  m_deltaEta,
143  m_deltaPhi,
145  true,
146  measurementTracker,
147  m_searchOpt));
148  }
149 
150  return result;
151  }
152 
153  private:
155 
156  float m_ptMin;
159  float m_deltaEta;
160  float m_deltaPhi;
166 };
167 
168 #endif
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
bool exists(std::string const &parameterName) const
checks if a parameter exists
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
static UseMeasurementTracker stringToUseMeasurementTracker(const std::string &name)
edm::EDGetTokenT< MeasurementTrackerEvent > token_measurementTracker
virtual std::vector< std::unique_ptr< TrackingRegion > > regions(const edm::Event &e, const edm::EventSetup &es) const override
TauRegionalPixelSeedGenerator(const edm::ParameterSet &conf_, edm::ConsumesCollector &&iC)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< reco::VertexCollection > token_vertex
T const * product() const
Definition: Handle.h:81
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
RectangularEtaPhiTrackingRegion::UseMeasurementTracker m_howToUseMeasurementTracker
bool isUninitialized() const
Definition: EDGetToken.h:73
edm::EDGetTokenT< reco::CandidateView > token_jet