CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TotemRPRecHitProducer.cc
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * This is a part of TOTEM offline software.
4 * Authors:
5 * Hubert Niewiadomski
6 * Jan Kašpar (jan.kaspar@gmail.com)
7 *
8 ****************************************************************************/
9 
11 
16 
21 
23 
24 //----------------------------------------------------------------------------------------------------
25 
27 public:
28  explicit TotemRPRecHitProducer(const edm::ParameterSet& conf);
29 
30  ~TotemRPRecHitProducer() override {}
31 
32  void produce(edm::Event& e, const edm::EventSetup& c) override;
34 
35 private:
38 
40 
43 };
44 
45 //----------------------------------------------------------------------------------------------------
46 //----------------------------------------------------------------------------------------------------
47 
48 using namespace std;
49 using namespace edm;
50 
51 //----------------------------------------------------------------------------------------------------
52 
53 TotemRPRecHitProducer::TotemRPRecHitProducer(const edm::ParameterSet& conf) : conf_(conf), algorithm_(conf) {
54  verbosity_ = conf.getParameter<int>("verbosity");
55 
56  tagCluster_ = conf.getParameter<edm::InputTag>("tagCluster");
57  tokenCluster_ = consumes<edm::DetSetVector<TotemRPCluster>>(tagCluster_);
58 
59  produces<edm::DetSetVector<TotemRPRecHit>>();
60 }
61 
62 //----------------------------------------------------------------------------------------------------
63 
65  // get input
67  e.getByToken(tokenCluster_, input);
68 
69  // prepare output
71 
72  // build reco hits
73  for (auto& ids : *input) {
74  DetSet<TotemRPRecHit>& ods = output.find_or_insert(ids.detId());
75  algorithm_.buildRecoHits(ids, ods);
76  }
77 
78  // save output
79  e.put(make_unique<DetSetVector<TotemRPRecHit>>(output));
80 }
81 
82 //----------------------------------------------------------------------------------------------------
83 
86 
87  desc.add<edm::InputTag>("tagCluster", edm::InputTag("totemRPClusterProducer"))
88  ->setComment("input clusters collection to retrieve");
89  desc.add<int>("verbosity", 0);
90 
91  descr.add("totemRPRecHitProducer", desc);
92 }
93 
94 //----------------------------------------------------------------------------------------------------
95 
static void fillDescriptions(edm::ConfigurationDescriptions &)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
const edm::EventSetup & c
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void buildRecoHits(const edm::DetSet< TotemRPCluster > &input, edm::DetSet< TotemRPRecHit > &output)
TotemRPRecHitProducer(const edm::ParameterSet &conf)
static std::string const input
Definition: EdmProvDump.cc:47
reference find_or_insert(det_id_type id)
Definition: DetSetVector.h:234
const edm::ParameterSet conf_
TotemRPRecHitProducerAlgorithm algorithm_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void produce(edm::Event &e, const edm::EventSetup &c) override
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< edm::DetSetVector< TotemRPCluster > > tokenCluster_