CMS 3D CMS Logo

TotemRPClusterProducer.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 
20 
22 
23 //----------------------------------------------------------------------------------------------------
24 
29 {
30  public:
31 
32  explicit TotemRPClusterProducer(const edm::ParameterSet& conf);
33 
35 
36  virtual void produce(edm::Event& e, const edm::EventSetup& c) override;
37 
38  private:
43 
45 
47 };
48 
49 //----------------------------------------------------------------------------------------------------
50 //----------------------------------------------------------------------------------------------------
51 
52 using namespace std;
53 using namespace edm;
54 
55 //----------------------------------------------------------------------------------------------------
56 
58  conf_(conf), algorithm_(conf)
59 {
60  verbosity_ = conf.getParameter<int>("verbosity");
61 
62  digiInputTag_ = conf.getParameter<edm::InputTag>("tagDigi");
63  digiInputTagToken_ = consumes<edm::DetSetVector<TotemRPDigi> >(digiInputTag_);
64 
65  produces< edm::DetSetVector<TotemRPCluster> > ();
66 }
67 
68 //----------------------------------------------------------------------------------------------------
69 
71 {
72  // get input
75 
76  // prepare output
78 
79  // run clusterisation
80  if (input->size())
81  run(*input, output);
82 
83  // save output to event
84  e.put(make_unique<DetSetVector<TotemRPCluster>>(output));
85 }
86 
87 //----------------------------------------------------------------------------------------------------
88 
90 {
91  for (const auto &ds_digi : input)
92  {
93  edm::DetSet<TotemRPCluster> &ds_cluster = output.find_or_insert(ds_digi.id);
94 
95  algorithm_.buildClusters(ds_digi.id, ds_digi.data, ds_cluster.data);
96  }
97 }
98 
99 //----------------------------------------------------------------------------------------------------
100 
T getParameter(std::string const &) const
void run(const edm::DetSetVector< TotemRPDigi > &input, edm::DetSetVector< TotemRPCluster > &output)
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
edm::EDGetTokenT< edm::DetSetVector< TotemRPDigi > > digiInputTagToken_
virtual void produce(edm::Event &e, const edm::EventSetup &c) override
TotemRPClusterProducerAlgorithm algorithm_
static std::string const input
Definition: EdmProvDump.cc:44
reference find_or_insert(det_id_type id)
Definition: DetSetVector.h:254
int buildClusters(unsigned int detId, const std::vector< TotemRPDigi > &digi, std::vector< TotemRPCluster > &clusters)
TotemRPClusterProducer(const edm::ParameterSet &conf)
collection_type data
Definition: DetSet.h:78
HLT enums.