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  void produce(edm::Event& e, const edm::EventSetup& c) override;
38 
39  private:
44 
46 
48 };
49 
50 //----------------------------------------------------------------------------------------------------
51 //----------------------------------------------------------------------------------------------------
52 
53 using namespace std;
54 using namespace edm;
55 
56 //----------------------------------------------------------------------------------------------------
57 
59  conf_(conf), algorithm_(conf)
60 {
61  verbosity_ = conf.getParameter<int>("verbosity");
62 
63  digiInputTag_ = conf.getParameter<edm::InputTag>("tagDigi");
64  digiInputTagToken_ = consumes<edm::DetSetVector<TotemRPDigi> >(digiInputTag_);
65 
66  produces< edm::DetSetVector<TotemRPCluster> > ();
67 }
68 
69 //----------------------------------------------------------------------------------------------------
70 
72 {
73  // get input
76 
77  // prepare output
79 
80  // run clusterisation
81  if (!input->empty())
82  run(*input, output);
83 
84  // save output to event
85  e.put(make_unique<DetSetVector<TotemRPCluster>>(output));
86 }
87 
88 //----------------------------------------------------------------------------------------------------
89 
91 {
92  for (const auto &ds_digi : input)
93  {
94  edm::DetSet<TotemRPCluster> &ds_cluster = output.find_or_insert(ds_digi.id);
95 
96  algorithm_.buildClusters(ds_digi.id, ds_digi.data, ds_cluster.data);
97  }
98 }
99 
100 //----------------------------------------------------------------------------------------------------
101 
102 void
104 {
106 
107  desc.add<edm::InputTag>( "tagDigi", edm::InputTag( "totemRPRawToDigi", "TrackingStrip" ) )
108  ->setComment( "input digis collection to retrieve" );
109  desc.add<int>( "verbosity", 0 );
110 
111  descr.add( "totemRPClusterProducer", desc );
112 }
113 
114 //----------------------------------------------------------------------------------------------------
115 
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:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
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:254
#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:80
HLT enums.