CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CTPPSLocalTrackLiteProducer.cc
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * This is a part of TOTEM offline software.
4 * Authors:
5 * Jan Kašpar (jan.kaspar@gmail.com)
6 *
7 ****************************************************************************/
8 
14 
18 
19 //----------------------------------------------------------------------------------------------------
20 
25 {
26  public:
27  explicit CTPPSLocalTrackLiteProducer(const edm::ParameterSet& conf);
28 
30 
31  virtual void produce(edm::Event& e, const edm::EventSetup& c) override;
32 
33  private:
35 
38  bool doNothing;
39 };
40 
41 //----------------------------------------------------------------------------------------------------
42 //----------------------------------------------------------------------------------------------------
43 
44 using namespace std;
45 using namespace edm;
46 
47 //----------------------------------------------------------------------------------------------------
48 
50  doNothing(conf.getParameter<bool>("doNothing"))
51 {
52  if (doNothing)
53  return;
54 
55  siStripTrackToken = consumes<DetSetVector<TotemRPLocalTrack>>(conf.getParameter<edm::InputTag>("tagSiStripTrack"));
56 
57  produces<vector<CTPPSLocalTrackLite>>();
58 }
59 
60 //----------------------------------------------------------------------------------------------------
61 
63 {
64  if (doNothing)
65  return;
66 
67  // get input from Si strips
69  e.getByToken(siStripTrackToken, inputSiStripTracks);
70 
71  // prepare output
72  vector<CTPPSLocalTrackLite> output;
73 
74  // process tracks from Si strips
75  for (const auto rpv : *inputSiStripTracks)
76  {
77  const uint32_t rpId = rpv.detId();
78 
79  for (const auto t : rpv)
80  {
81  if (t.isValid())
82  output.push_back(CTPPSLocalTrackLite(rpId, t.getX0(), t.getX0Sigma(), t.getY0(), t.getY0Sigma()));
83  }
84  }
85 
86  // save output to event
87  e.put(make_unique<vector<CTPPSLocalTrackLite>>(output));
88 }
89 
90 //----------------------------------------------------------------------------------------------------
91 
T getParameter(std::string const &) const
CTPPSLocalTrackLiteProducer(const edm::ParameterSet &conf)
Local (=single RP) track with essential information only.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > siStripTrackToken
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
Distills the essential track data from all RPs.
virtual void produce(edm::Event &e, const edm::EventSetup &c) override