CMS 3D CMS Logo

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;
36 
37  private:
40 
42 
45 };
46 
47 //----------------------------------------------------------------------------------------------------
48 //----------------------------------------------------------------------------------------------------
49 
50 using namespace std;
51 using namespace edm;
52 
53 //----------------------------------------------------------------------------------------------------
54 
56  conf_(conf), algorithm_(conf)
57 {
58  verbosity_ = conf.getParameter<int>("verbosity");
59 
60  tagCluster_ = conf.getParameter<edm::InputTag>("tagCluster");
61  tokenCluster_ = consumes<edm::DetSetVector<TotemRPCluster> >(tagCluster_);
62 
63  produces<edm::DetSetVector<TotemRPRecHit>>();
64 }
65 
66 //----------------------------------------------------------------------------------------------------
67 
69 {
70  // get input
72  e.getByToken(tokenCluster_, input);
73 
74  // prepare output
76 
77  // build reco hits
78  for (auto &ids : *input)
79  {
80  DetSet<TotemRPRecHit> &ods = output.find_or_insert(ids.detId());
81  algorithm_.buildRecoHits(ids, ods);
82  }
83 
84  // save output
85  e.put(make_unique<DetSetVector<TotemRPRecHit>>(output));
86 }
87 
88 //----------------------------------------------------------------------------------------------------
89 
90 void
92 {
94 
95  desc.add<edm::InputTag>( "tagCluster", edm::InputTag( "totemRPClusterProducer" ) )
96  ->setComment( "input clusters collection to retrieve" );
97  desc.add<int>( "verbosity", 0 );
98 
99  descr.add( "totemRPRecHitProducer", desc );
100 }
101 
102 //----------------------------------------------------------------------------------------------------
103 
T getParameter(std::string const &) const
static void fillDescriptions(edm::ConfigurationDescriptions &)
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:460
#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_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
virtual void produce(edm::Event &e, const edm::EventSetup &c) override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
edm::EDGetTokenT< edm::DetSetVector< TotemRPCluster > > tokenCluster_