CMS 3D CMS Logo

VertexAssociatorByPositionAndTracksProducer.cc
Go to the documentation of this file.
10 
12 
15 
17 
19 public:
22 
23  static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
24 
25 private:
26  void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override;
27 
28  // ----------member data ---------------------------
29  const double absZ_;
30  const double sigmaZ_;
31  const double maxRecoZ_;
32  const double absT_;
33  const double sigmaT_;
34  const double maxRecoT_;
35  const double sharedTrackFraction_;
36 
39 };
40 
42  : absZ_(config.getParameter<double>("absZ")),
43  sigmaZ_(config.getParameter<double>("sigmaZ")),
44  maxRecoZ_(config.getParameter<double>("maxRecoZ")),
45  absT_(config.getParameter<double>("absT")),
46  sigmaT_(config.getParameter<double>("sigmaT")),
47  maxRecoT_(config.getParameter<double>("maxRecoT")),
48  sharedTrackFraction_(config.getParameter<double>("sharedTrackFraction")),
49  trackRecoToSimAssociationToken_(
50  consumes<reco::RecoToSimCollection>(config.getParameter<edm::InputTag>("trackAssociation"))),
51  trackSimToRecoAssociationToken_(
52  consumes<reco::SimToRecoCollection>(config.getParameter<edm::InputTag>("trackAssociation"))) {
53  produces<reco::VertexToTrackingVertexAssociator>();
54 }
55 
57 
60 
61  // Matching conditions
62  desc.add<double>("absZ", 0.1);
63  desc.add<double>("sigmaZ", 3.0);
64  desc.add<double>("maxRecoZ", 1000.0);
65  desc.add<double>("absT", -1.0);
66  desc.add<double>("sigmaT", -1.0);
67  desc.add<double>("maxRecoT", -1.0);
68  desc.add<double>("sharedTrackFraction", -1.0);
69 
70  // Track-TrackingParticle association
71  desc.add<edm::InputTag>("trackAssociation", edm::InputTag("trackingParticleRecoTrackAsssociation"));
72 
73  descriptions.add("VertexAssociatorByPositionAndTracks", desc);
74 }
75 
78  const edm::EventSetup &) const {
79  edm::Handle<reco::RecoToSimCollection> recotosimCollectionH;
80  iEvent.getByToken(trackRecoToSimAssociationToken_, recotosimCollectionH);
81 
82  edm::Handle<reco::SimToRecoCollection> simtorecoCollectionH;
83  iEvent.getByToken(trackSimToRecoAssociationToken_, simtorecoCollectionH);
84 
85  std::unique_ptr<VertexAssociatorByPositionAndTracks> impl;
86 
87  if (!recotosimCollectionH.isValid() || !simtorecoCollectionH.isValid()) {
88  if (!recotosimCollectionH.isValid())
89  edm::LogWarning("PrimaryVertexAnalyzer4PUSlimmed") << "trackRecoToSimAssociation is not available in the event";
90  if (!simtorecoCollectionH.isValid())
91  edm::LogWarning("PrimaryVertexAnalyzer4PUSlimmed") << "trackSimToRecoAssociation is not available in the event";
92  return;
93  }
94  if (sigmaT_ < 0.0) {
95  impl = std::make_unique<VertexAssociatorByPositionAndTracks>(&(iEvent.productGetter()),
96  absZ_,
97  sigmaZ_,
98  maxRecoZ_,
100  recotosimCollectionH.product(),
101  simtorecoCollectionH.product());
102  } else {
103  impl = std::make_unique<VertexAssociatorByPositionAndTracks>(&(iEvent.productGetter()),
104  absZ_,
105  sigmaZ_,
106  maxRecoZ_,
107  absT_,
108  sigmaT_,
109  maxRecoT_,
111  recotosimCollectionH.product(),
112  simtorecoCollectionH.product());
113  }
114 
115  auto toPut = std::make_unique<reco::VertexToTrackingVertexAssociator>(std::move(impl));
116  iEvent.put(std::move(toPut));
117 }
118 
ConfigurationDescriptions.h
VertexAssociatorByPositionAndTracksProducer
Definition: VertexAssociatorByPositionAndTracksProducer.cc:18
edm::StreamID
Definition: StreamID.h:30
Handle.h
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MessageLogger.h
VertexAssociatorByPositionAndTracksProducer::VertexAssociatorByPositionAndTracksProducer
VertexAssociatorByPositionAndTracksProducer(const edm::ParameterSet &)
Definition: VertexAssociatorByPositionAndTracksProducer.cc:41
edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
VertexAssociatorByPositionAndTracksProducer::~VertexAssociatorByPositionAndTracksProducer
~VertexAssociatorByPositionAndTracksProducer() override
Definition: VertexAssociatorByPositionAndTracksProducer.cc:56
TrackingParticleSelector.h
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
VertexAssociatorByPositionAndTracksProducer::maxRecoZ_
const double maxRecoZ_
Definition: VertexAssociatorByPositionAndTracksProducer.cc:31
VertexAssociatorByPositionAndTracksProducer::sharedTrackFraction_
const double sharedTrackFraction_
Definition: VertexAssociatorByPositionAndTracksProducer.cc:35
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
VertexAssociatorByPositionAndTracksProducer::absT_
const double absT_
Definition: VertexAssociatorByPositionAndTracksProducer.cc:32
edm::Handle
Definition: AssociativeIterator.h:50
config
Definition: config.py:1
MakerMacros.h
reco::SimToRecoCollection
edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > > SimToRecoCollection
Definition: TrackAssociation.h:16
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
VertexAssociatorByPositionAndTracksProducer::sigmaT_
const double sigmaT_
Definition: VertexAssociatorByPositionAndTracksProducer.cc:33
reco::RecoToSimCollection
edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, TrackingParticleCollection, double > > RecoToSimCollection
Definition: TrackAssociation.h:19
ParameterSetDescription.h
EDGetToken.h
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::LogWarning
Definition: MessageLogger.h:141
VertexAssociatorByPositionAndTracks.h
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
VertexAssociatorByPositionAndTracksProducer::sigmaZ_
const double sigmaZ_
Definition: VertexAssociatorByPositionAndTracksProducer.cc:30
edm::EventSetup
Definition: EventSetup.h:57
DBConfiguration_cff.toPut
toPut
Definition: DBConfiguration_cff.py:25
VertexAssociatorByPositionAndTracksProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: VertexAssociatorByPositionAndTracksProducer.cc:58
VertexAssociatorByPositionAndTracksProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: VertexAssociatorByPositionAndTracksProducer.cc:76
impl
Definition: trackAlgoPriorityOrder.h:18
eostools.move
def move(src, dest)
Definition: eostools.py:511
Frameworkfwd.h
VertexAssociatorByPositionAndTracksProducer::maxRecoT_
const double maxRecoT_
Definition: VertexAssociatorByPositionAndTracksProducer.cc:34
ParameterSet.h
EDProducer.h
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
VertexAssociatorByPositionAndTracksProducer::absZ_
const double absZ_
Definition: VertexAssociatorByPositionAndTracksProducer.cc:29
edm::Event
Definition: Event.h:73
VertexAssociatorByPositionAndTracksProducer::trackRecoToSimAssociationToken_
edm::EDGetTokenT< reco::RecoToSimCollection > trackRecoToSimAssociationToken_
Definition: VertexAssociatorByPositionAndTracksProducer.cc:37
edm::InputTag
Definition: InputTag.h:15
VertexToTrackingVertexAssociator.h
VertexAssociatorByPositionAndTracksProducer::trackSimToRecoAssociationToken_
edm::EDGetTokenT< reco::SimToRecoCollection > trackSimToRecoAssociationToken_
Definition: VertexAssociatorByPositionAndTracksProducer.cc:38