CMS 3D CMS Logo

MomentumConstraintProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: MomentumConstraintProducer
4 // Class: MomentumConstraintProducer
5 //
13 //
14 // Original Author: Giuseppe Cerati
15 // Created: Tue Jul 10 15:05:02 CEST 2007
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
25 
33 
35 
36 //
37 // class declaration
38 //
39 
41 public:
43  ~MomentumConstraintProducer() override = default;
44 
45 private:
46  void produce(edm::StreamID streamid, edm::Event&, const edm::EventSetup&) const override;
47 
48  // ----------member data ---------------------------
50  const double fixedmom_;
51  const double fixedmomerr_;
53 };
54 
55 //
56 // constants, enums and typedefs
57 //
58 
59 //
60 // static data member definitions
61 //
62 
63 //
64 // constructors and destructor
65 //
67  : srcTag_(iConfig.getParameter<edm::InputTag>("src")),
68  fixedmom_(iConfig.getParameter<double>("fixedMomentum")),
69  fixedmomerr_(iConfig.getParameter<double>("fixedMomentumError"))
70 
71 {
72  //register your products
73  produces<std::vector<MomentumConstraint>>();
74  produces<TrackMomConstraintAssociationCollection>();
75 
76  //now do what ever other initialization is needed
79 }
80 
81 //
82 // member functions
83 //
84 
85 // ------------ method called to produce the data ------------
88  const edm::EventSetup& iSetup) const {
89  using namespace edm;
90 
91  Handle<reco::TrackCollection> theTCollection;
92  iEvent.getByToken(srcToken_, theTCollection);
93 
94  edm::RefProd<std::vector<MomentumConstraint>> rPairs = iEvent.getRefBeforePut<std::vector<MomentumConstraint>>();
95 
96  std::unique_ptr<std::vector<MomentumConstraint>> pairs(new std::vector<MomentumConstraint>);
97  std::unique_ptr<TrackMomConstraintAssociationCollection> output(
98  new TrackMomConstraintAssociationCollection(theTCollection, rPairs));
99 
100  int index = 0;
101  for (reco::TrackCollection::const_iterator i = theTCollection->begin(); i != theTCollection->end(); i++) {
102  // MomentumConstraint tmp(10.,0.01) ;
103 
105  if (fixedmom_ < 0.0) {
107  }
108  pairs->push_back(tmp);
109  output->insert(reco::TrackRef(theTCollection, index), edm::Ref<std::vector<MomentumConstraint>>(rPairs, index));
110  index++;
111  }
112 
113  iEvent.put(std::move(pairs));
114  iEvent.put(std::move(output));
115 }
116 
117 //define this as a plug-in
edm::RefProd
Definition: EDProductfwd.h:25
edm::StreamID
Definition: StreamID.h:30
MomentumConstraintProducer::fixedmomerr_
const double fixedmomerr_
Definition: MomentumConstraintProducer.cc:51
mps_fire.i
i
Definition: mps_fire.py:355
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
edm::EDGetTokenT< reco::TrackCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:71
MomentumConstraintProducer::fixedmom_
const double fixedmom_
Definition: MomentumConstraintProducer.cc:50
MomentumConstraintProducer::MomentumConstraintProducer
MomentumConstraintProducer(const edm::ParameterSet &)
Definition: MomentumConstraintProducer.cc:66
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
edm::Handle< reco::TrackCollection >
edm::Ref< TrackCollection >
MomentumConstraint
Definition: TrackConstraintAssociation.h:11
MakerMacros.h
Track.h
TrackFwd.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
MomentumConstraintProducer::~MomentumConstraintProducer
~MomentumConstraintProducer() override=default
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:49
edm::global::EDProducer
Definition: EDProducer.h:32
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
MomentumConstraintProducer
Definition: MomentumConstraintProducer.cc:40
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
MomentumConstraintProducer::produce
void produce(edm::StreamID streamid, edm::Event &, const edm::EventSetup &) const override
Definition: MomentumConstraintProducer.cc:86
edm::EventSetup
Definition: EventSetup.h:57
InputTag.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
Frameworkfwd.h
TrackMomConstraintAssociationCollection
edm::AssociationMap< edm::OneToOne< reco::TrackCollection, std::vector< MomentumConstraint > > > TrackMomConstraintAssociationCollection
Definition: TrackConstraintAssociation.h:24
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
ConsumesCollector.h
ParameterSet.h
EDProducer.h
TrackConstraintAssociation.h
edm::Event
Definition: Event.h:73
MomentumConstraintProducer::srcToken_
edm::EDGetTokenT< reco::TrackCollection > srcToken_
Definition: MomentumConstraintProducer.cc:52
edm::InputTag
Definition: InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
MomentumConstraintProducer::srcTag_
const edm::InputTag srcTag_
Definition: MomentumConstraintProducer.cc:49