CMS 3D CMS Logo

PFDisplacedVertexProducer.cc
Go to the documentation of this file.
1 
27 
29 public:
31 
32  ~PFDisplacedVertexProducer() override;
33 
34  void produce(edm::Event&, const edm::EventSetup&) override;
35  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
36 
37 private:
41 
43 
46 
51 
53  bool verbose_;
54 
57 };
58 
61 
64  desc.add<edm::InputTag>("vertexCandidatesLabel", {"particleFlowDisplacedVertexCandidate"});
65  // verbosity
66  desc.addUntracked<bool>("verbose", false);
67  // Debug flag
68  desc.addUntracked<bool>("debug", false);
69  // maximum transverse distance between two points to be used in Seed
70  desc.add<double>("transvSize", 1.0);
71  // maximum longitudinal distance between two points to be used in Seed
72  desc.add<double>("longSize", 5);
73  // minimal radius below which we do not reconstruct interactions
74  // typically the position of the first Pixel layer or beam pipe
75  desc.add<double>("primaryVertexCut", 1.8);
76  // radius below which we don't want to reconstruct displaced
77  // vertices
78  desc.add<double>("tobCut", 100);
79  // z below which we don't want to reconstruct displaced
80  // vertices
81  desc.add<double>("tecCut", 220);
82  // the minimal accepted weight for the tracks calculated in the
83  // adaptive vertex fitter to be associated to the displaced vertex
84  // this correspond to the sigmacut of 6
85  desc.add<double>("minAdaptWeight", 0.5);
86  // this flag is designed to reduce the timing of the algorithm in the high pile-up conditions. 2 tracks
87  // vertices are the most sensitives to the pile-ups.
88  desc.addUntracked<bool>("switchOff2TrackVertex", true);
89  // ------------ Paramemeters for the track selection ------------
90  // Primary vertex information used for dxy calculation
91  desc.add<edm::InputTag>("mainVertexLabel", {"offlinePrimaryVertices", ""});
92  desc.add<edm::InputTag>("offlineBeamSpotLabel", {"offlineBeamSpot", ""});
93  // Parameters used to apply cuts
94  {
96  pset.add<bool>("bSelectTracks", true);
97  // If a track is high purity it is always kept
98  pset.add<std::string>("quality", "HighPurity");
99  // Following cuts are applyed to non high purity tracks
100  // nChi2_max and pt_min cuts are applyed to the primary and secondary tracks
101  pset.add<double>("nChi2_max", 5.);
102  pset.add<double>("pt_min", 0.2);
103  // nChi2_min applyed only to primary tracks which may be short
104  // remove fake pixel triplets
105  pset.add<double>("nChi2_min", 0.5);
106  // Cuts applyed to the secondary tracks long and displaced
107  pset.add<double>("dxy_min", 0.2);
108  pset.add<int>("nHits_min", 6);
109  pset.add<int>("nOuterHits_max", 9);
110  desc.add<edm::ParameterSetDescription>("tracksSelectorParameters", pset);
111  }
112  // ------------ Paramemeters for the vertex identification ------------
113  {
115  pset.add<bool>("bIdentifyVertices", true);
116  // Minimal sum pt of secondary tracks for displaced vertices.
117  // Below this value we find either loopers splitted in two parts eiter
118  // fake vertices in forward direction
119  pset.add<double>("pt_min", 0.5);
120  // Minimal pT and log10(P_primary/P_secondary) for primary track in kinks (Primary+Secondary)
121  // which are not identifier as K-+ decays
122  pset.add<double>("pt_kink_min", 3.0);
123  pset.add<double>("logPrimSec_min", 0.0);
124  // maximum absoluta value of eta for loopers
125  pset.add<double>("looper_eta_max", 0.1);
126  // Masses cuts for selections
127  // CVmin K0min K0max K-min K-max Ldmin Ldmax Nuclmin_ee
128  pset.add<std::vector<double>>("masses", {0.050, 0.485, 0.515, 0.480, 0.520, 1.107, 1.125, 0.200});
129  // Angle between the primaryVertex-secondaryVertex direction and secondary tracks direction
130  // this angle means that the final system shall propagate in the same direction than initial system
131  // all_max, CV and V0 max
132  pset.add<std::vector<double>>("angles", {15, 15});
133  desc.add<edm::ParameterSetDescription>("vertexIdentifierParameters", pset);
134  }
135  // Adaptive Vertex Fitter parameters identical to the default ones except sigmacut.
136  // The default value is sigmacut = 3 too tight for displaced vertices
137  // see CMS NOTE-2008/033 for more details
138  {
140  pset.add<double>("sigmacut", 6.);
141  pset.add<double>("Tini", 256.);
142  pset.add<double>("ratio", 0.25);
143  desc.add<edm::ParameterSetDescription>("avfParameters", pset);
144  }
145  descriptions.add("particleFlowDisplacedVertex", desc);
146 }
147 
148 using namespace std;
149 using namespace edm;
150 
152  : inputTagVertexCandidates_(consumes<reco::PFDisplacedVertexCandidateCollection>(
153  iConfig.getParameter<InputTag>("vertexCandidatesLabel"))),
154  inputTagMainVertex_(consumes<reco::VertexCollection>(iConfig.getParameter<InputTag>("mainVertexLabel"))),
155  inputTagBeamSpot_(consumes<reco::BeamSpot>(iConfig.getParameter<InputTag>("offlineBeamSpotLabel"))),
156  magFieldToken_(esConsumes()),
157  globTkGeomToken_(esConsumes()),
158  tkerTopoToken_(esConsumes()),
159  tkerGeomToken_(esConsumes()) {
160  // --- Setup input collection names --- //
161 
162  verbose_ = iConfig.getUntrackedParameter<bool>("verbose");
163 
164  bool debug = iConfig.getUntrackedParameter<bool>("debug");
165 
166  // ------ Algo Parameters ------ //
167 
168  // Maximal transverse distance between two minimal
169  // approach points to be used together
170  double transvSize = iConfig.getParameter<double>("transvSize");
171 
172  // Maximal longitudinal distance between two minimal
173  // approach points to be used together
174  double longSize = iConfig.getParameter<double>("longSize");
175 
176  // Minimal radius below which we do not reconstruct interactions
177  // Typically the position of the first Pixel layer
178  double primaryVertexCut = iConfig.getParameter<double>("primaryVertexCut");
179 
180  // Radius at which no secondary tracks are availables
181  // in the barrel.For the moment we exclude the TOB barrel
182  // since 5-th track step starts the latest at first TOB
183  // layer.
184  double tobCut = iConfig.getParameter<double>("tobCut");
185 
186  // Radius at which no secondary tracks are availables
187  // in the endcaps.For the moment we exclude the TEC wheel.
188  double tecCut = iConfig.getParameter<double>("tecCut");
189 
190  // The minimal accepted weight for the tracks calculated in the
191  // adaptive vertex fitter to be associated to the displaced vertex
192  double minAdaptWeight = iConfig.getParameter<double>("minAdaptWeight");
193 
194  bool switchOff2TrackVertex = iConfig.getUntrackedParameter<bool>("switchOff2TrackVertex");
195 
196  edm::ParameterSet ps_trk = iConfig.getParameter<edm::ParameterSet>("tracksSelectorParameters");
197  edm::ParameterSet ps_vtx = iConfig.getParameter<edm::ParameterSet>("vertexIdentifierParameters");
198  edm::ParameterSet ps_avf = iConfig.getParameter<edm::ParameterSet>("avfParameters");
199 
200  produces<reco::PFDisplacedVertexCollection>();
201 
202  // Vertex Finder parameters -----------------------------------
205  transvSize, longSize, primaryVertexCut, tobCut, tecCut, minAdaptWeight, switchOff2TrackVertex);
209 }
210 
212 
214  LogDebug("PFDisplacedVertexProducer") << "START event: " << iEvent.id().event() << " in run " << iEvent.id().run();
215 
216  // Prepare useful information for the Finder
217 
218  auto const& theMagField = &iSetup.getData(magFieldToken_);
219  auto const& globTkGeom = &iSetup.getData(globTkGeomToken_);
220  auto const& tkerTopo = &iSetup.getData(tkerTopoToken_);
221  auto const& tkerGeom = &iSetup.getData(tkerGeomToken_);
222 
223  auto const& vertexCandidates = iEvent.getHandle(inputTagVertexCandidates_);
224  auto const& mainVertexHandle = iEvent.getHandle(inputTagMainVertex_);
225  auto const& beamSpotHandle = iEvent.getHandle(inputTagBeamSpot_);
226 
227  // Fill useful event information for the Finder
228  pfDisplacedVertexFinder_.setEdmParameters(theMagField, globTkGeom, tkerTopo, tkerGeom);
229  pfDisplacedVertexFinder_.setPrimaryVertex(mainVertexHandle, beamSpotHandle);
230  pfDisplacedVertexFinder_.setInput(vertexCandidates);
231 
232  // Run the finder
234 
235  if (verbose_) {
236  ostringstream str;
238  edm::LogInfo("PFDisplacedVertexProducer") << str.str();
239  }
240 
241  std::unique_ptr<reco::PFDisplacedVertexCollection> pOutputDisplacedVertexCollection(
243 
244  iEvent.put(std::move(pOutputDisplacedVertexCollection));
245 
246  LogDebug("PFDisplacedVertexProducer") << "STOP event: " << iEvent.id().event() << " in run " << iEvent.id().run();
247 }
const edm::EDGetTokenT< reco::BeamSpot > inputTagBeamSpot_
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > globTkGeomToken_
void setEdmParameters(const MagneticField *magField, edm::ESHandle< GlobalTrackingGeometry > globTkGeomHandle, const TrackerTopology *tkerTopo, const TrackerGeometry *tkerGeom)
Sets parameters for track extrapolation and hits study.
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
PFDisplacedVertexFinder pfDisplacedVertexFinder_
Displaced Vertices finder.
std::vector< PFDisplacedVertexCandidate > PFDisplacedVertexCandidateCollection
collection of PFDisplacedVertexCandidate objects
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::EDGetTokenT< reco::PFDisplacedVertexCandidateCollection > inputTagVertexCandidates_
std::unique_ptr< reco::PFDisplacedVertexCollection > transferDisplacedVertices()
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkerGeomToken_
void findDisplacedVertices()
-----— Main function which find vertices -----— ///
std::vector< Vertex > VertexCollection
Definition: Vertex.h:31
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tkerTopoToken_
PFDisplacedVertexProducer(const edm::ParameterSet &)
T getUntrackedParameter(std::string const &, T const &) const
const edm::EDGetTokenT< reco::VertexCollection > inputTagMainVertex_
Input tag for main vertex to cut of dxy of secondary tracks.
int iEvent
Definition: GenABIO.cc:224
void setTracksSelector(const edm::ParameterSet &ps)
void setDebug(bool debug)
Sets debug printout flag.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Producer for DisplacedVertices.
void setAVFParameters(const edm::ParameterSet &ps)
void setInput(const edm::Handle< reco::PFDisplacedVertexCandidateCollection > &)
Set input collections of tracks.
Log< level::Info, false > LogInfo
#define debug
Definition: HDRShower.cc:19
void setPrimaryVertex(edm::Handle< reco::VertexCollection > mainVertexHandle, edm::Handle< reco::BeamSpot > beamSpotHandle)
void setParameters(double transvSize, double longSize, double primaryVertexCut, double tobCut, double tecCut, double minAdaptWeight, bool switchOff2TrackVertex)
--—— Set different algo parameters --—— ///
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void produce(edm::Event &, const edm::EventSetup &) override
fixed size matrix
HLT enums.
void setVertexIdentifier(const edm::ParameterSet &ps)
#define str(s)
def move(src, dest)
Definition: eostools.py:511
#define LogDebug(id)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)