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 
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
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 
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:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
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:48
reference find_or_insert(det_id_type id)
Definition: DetSetVector.h:234
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
int buildClusters(unsigned int detId, const std::vector< TotemRPDigi > &digi, std::vector< TotemRPCluster > &clusters)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
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:81
HLT enums.