CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FTSLuminosityFromVertices.cc
Go to the documentation of this file.
1 // C++ headers
2 #include <string>
3 #include <cstring>
4 
5 // CMSSW headers
19 
21 public:
24 
25  static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
26 
27 private:
29  unsigned int m_lumi_id;
30 
31  void analyze(edm::StreamID sid, edm::Event const & event, const edm::EventSetup & setup) const override;
32 };
33 
35  m_token(consumes<reco::VertexCollection>(config.getParameter<edm::InputTag>("source"))),
36  m_lumi_id((unsigned int) -1)
37 {
38  if (not edm::Service<FastTimerService>().isAvailable())
39  return;
40 
41  std::string const & name = config.getParameter<std::string>("name");
42  std::string const & title = config.getParameter<std::string>("title");
43  std::string const & label = config.getParameter<std::string>("label");
44  double range = config.getParameter<double>("range");
45  double resolution = config.getParameter<double>("resolution");
46 
47  m_lumi_id = edm::Service<FastTimerService>()->reserveLuminosityPlots(name, title, label, range, resolution);
48 }
49 
51 {
52 }
53 
54 void
56 {
57  if (not edm::Service<FastTimerService>().isAvailable())
58  return;
59 
60  double value = 0.;
62  if (event.getByToken(m_token, collection))
63  value = collection->size();
64 
65  edm::Service<FastTimerService>()->setLuminosity(sid, m_lumi_id, value);
66 }
67 
68 void
71  desc.add<edm::InputTag>("source", edm::InputTag("siPixelClusters"));
72  desc.add<std::string>("name", "vertices");
73  desc.add<std::string>("title", "reconstructed vertices");
74  desc.add<std::string>("label", "reconstructed vertices");
75  desc.add<double>("range", 40);
76  desc.add<double>("resolution", 1);
77  descriptions.add("ftsLuminosityFromVertices", desc);
78 }
79 
80 //define this as a plug-in
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
ParameterDescriptionBase * add(U const &iLabel, T const &value)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
edm::EDGetTokenT< reco::VertexCollection > m_token
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void analyze(edm::StreamID sid, edm::Event const &event, const edm::EventSetup &setup) const override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
FTSLuminosityFromVertices(edm::ParameterSet const &)