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 public:
30  explicit TotemRPClusterProducer(const edm::ParameterSet& conf);
31 
33 
34  void produce(edm::Event& e, const edm::EventSetup& c) override;
36 
37 private:
42 
44 
46 };
47 
48 //----------------------------------------------------------------------------------------------------
49 //----------------------------------------------------------------------------------------------------
50 
51 using namespace std;
52 using namespace edm;
53 
54 //----------------------------------------------------------------------------------------------------
55 
56 TotemRPClusterProducer::TotemRPClusterProducer(edm::ParameterSet const& conf) : conf_(conf), algorithm_(conf) {
57  verbosity_ = conf.getParameter<int>("verbosity");
58 
59  digiInputTag_ = conf.getParameter<edm::InputTag>("tagDigi");
60  digiInputTagToken_ = consumes<edm::DetSetVector<TotemRPDigi>>(digiInputTag_);
61 
62  produces<edm::DetSetVector<TotemRPCluster>>();
63 }
64 
65 //----------------------------------------------------------------------------------------------------
66 
68  // get input
70  e.getByToken(digiInputTagToken_, input);
71 
72  // prepare output
74 
75  // run clusterisation
76  if (!input->empty())
77  run(*input, output);
78 
79  // save output to event
80  e.put(make_unique<DetSetVector<TotemRPCluster>>(output));
81 }
82 
83 //----------------------------------------------------------------------------------------------------
84 
87  for (const auto& ds_digi : input) {
88  edm::DetSet<TotemRPCluster>& ds_cluster = output.find_or_insert(ds_digi.id);
89 
90  algorithm_.buildClusters(ds_digi.id, ds_digi.data, ds_cluster.data);
91  }
92 }
93 
94 //----------------------------------------------------------------------------------------------------
95 
98 
99  desc.add<edm::InputTag>("tagDigi", edm::InputTag("totemRPRawToDigi", "TrackingStrip"))
100  ->setComment("input digis collection to retrieve");
101  desc.add<int>("verbosity", 0);
102 
103  descr.add("totemRPClusterProducer", desc);
104 }
105 
106 //----------------------------------------------------------------------------------------------------
107 
void run(const edm::DetSetVector< TotemRPDigi > &input, edm::DetSetVector< TotemRPCluster > &output)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< edm::DetSetVector< TotemRPDigi > > digiInputTagToken_
void produce(edm::Event &e, const edm::EventSetup &c) override
TotemRPClusterProducerAlgorithm algorithm_
static std::string const input
Definition: EdmProvDump.cc:50
int buildClusters(unsigned int detId, const std::vector< TotemRPDigi > &digi, std::vector< TotemRPCluster > &clusters)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
static void fillDescriptions(edm::ConfigurationDescriptions &)
TotemRPClusterProducer(const edm::ParameterSet &conf)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
collection_type data
Definition: DetSet.h:80
HLT enums.