CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
LSTPhase2OTHitsInputProducer.cc
Go to the documentation of this file.
2 
6 
8 
10 public:
11  explicit LSTPhase2OTHitsInputProducer(edm::ParameterSet const& iConfig);
12  ~LSTPhase2OTHitsInputProducer() override = default;
13 
14  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
15 
16 private:
17  void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
18 
21 };
22 
24  : phase2OTRecHitToken_(consumes(iConfig.getParameter<edm::InputTag>("phase2OTRecHits"))),
25  lstPhase2OTHitsInputPutToken_(produces()) {}
26 
29 
30  desc.add<edm::InputTag>("phase2OTRecHits", edm::InputTag("siPhase2RecHits"));
31 
32  descriptions.addWithDefaultLabel(desc);
33 }
34 
36  // Setup
37  auto const& phase2OTHits = iEvent.get(phase2OTRecHitToken_);
38 
39  // Vector definitions
40  std::vector<unsigned int> ph2_detId;
41  ph2_detId.reserve(phase2OTHits.dataSize());
42  std::vector<float> ph2_x;
43  ph2_x.reserve(phase2OTHits.dataSize());
44  std::vector<float> ph2_y;
45  ph2_y.reserve(phase2OTHits.dataSize());
46  std::vector<float> ph2_z;
47  ph2_z.reserve(phase2OTHits.dataSize());
48  std::vector<TrackingRecHit const*> ph2_hits;
49  ph2_hits.reserve(phase2OTHits.dataSize());
50 
51  for (auto const& it : phase2OTHits) {
52  const DetId hitId = it.detId();
53  for (auto const& hit : it) {
54  ph2_detId.push_back(hitId.rawId());
55  ph2_x.push_back(hit.globalPosition().x());
56  ph2_y.push_back(hit.globalPosition().y());
57  ph2_z.push_back(hit.globalPosition().z());
58  ph2_hits.push_back(&hit);
59  }
60  }
61 
62  LSTPhase2OTHitsInput phase2OTHitsInput(
64  iEvent.emplace(lstPhase2OTHitsInputPutToken_, std::move(phase2OTHitsInput));
65 }
66 
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
~LSTPhase2OTHitsInputProducer() override=default
const std::vector< float > & ph2_z()
Definition: Trktree.cc:6860
const std::vector< float > & ph2_x()
Definition: Trktree.cc:6861
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
int iEvent
Definition: GenABIO.cc:224
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const edm::EDGetTokenT< Phase2TrackerRecHit1DCollectionNew > phase2OTRecHitToken_
Definition: DetId.h:17
const edm::EDPutTokenT< LSTPhase2OTHitsInput > lstPhase2OTHitsInputPutToken_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const std::vector< unsigned int > & ph2_detId()
Definition: Trktree.cc:6736
HLT enums.
def move(src, dest)
Definition: eostools.py:511
const std::vector< float > & ph2_y()
Definition: Trktree.cc:6862
LSTPhase2OTHitsInputProducer(edm::ParameterSet const &iConfig)