test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 {
28  public:
29 
30  explicit TotemRPRecHitProducer(const edm::ParameterSet& conf);
31 
33 
34  virtual void produce(edm::Event& e, const edm::EventSetup& c) override;
35 
36  private:
39 
41 
44 };
45 
46 //----------------------------------------------------------------------------------------------------
47 //----------------------------------------------------------------------------------------------------
48 
49 using namespace std;
50 using namespace edm;
51 
52 //----------------------------------------------------------------------------------------------------
53 
55  conf_(conf), algorithm_(conf)
56 {
57  verbosity_ = conf.getParameter<int>("verbosity");
58 
59  tagCluster_ = conf.getParameter<edm::InputTag>("tagCluster");
60  tokenCluster_ = consumes<edm::DetSetVector<TotemRPCluster> >(tagCluster_);
61 
62  produces<edm::DetSetVector<TotemRPRecHit>>();
63 }
64 
65 //----------------------------------------------------------------------------------------------------
66 
68 {
69  // get input
71  e.getByToken(tokenCluster_, input);
72 
73  // prepare output
75 
76  // build reco hits
77  for (auto &ids : *input)
78  {
79  DetSet<TotemRPRecHit> &ods = output.find_or_insert(ids.detId());
80  algorithm_.buildRecoHits(ids, ods);
81  }
82 
83  // save output
84  e.put(make_unique<DetSetVector<TotemRPRecHit>>(output));
85 }
86 
87 //----------------------------------------------------------------------------------------------------
88 
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void buildRecoHits(const edm::DetSet< TotemRPCluster > &input, edm::DetSet< TotemRPRecHit > &output)
TotemRPRecHitProducer(const edm::ParameterSet &conf)
static std::string const input
Definition: EdmProvDump.cc:44
reference find_or_insert(det_id_type id)
Definition: DetSetVector.h:254
const edm::ParameterSet conf_
TotemRPRecHitProducerAlgorithm algorithm_
virtual void produce(edm::Event &e, const edm::EventSetup &c) override
edm::EDGetTokenT< edm::DetSetVector< TotemRPCluster > > tokenCluster_