CMS 3D CMS Logo

CSCOverlapsBeamSplashCut.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: CSCOverlapsBeamSplashCut
4 // Class: CSCOverlapsBeamSplashCut
5 //
13 //
14 // Original Author: Jim Pivarski
15 // Created: Sat Nov 21 21:18:04 CET 2009
16 //
17 
18 // system include files
19 #include <memory>
20 
21 // user include files
29 
30 // references
34 #include "TH1F.h"
35 
36 //
37 // class decleration
38 //
39 
40 class CSCOverlapsBeamSplashCut : public edm::one::EDFilter<edm::one::SharedResources> {
41 public:
43  ~CSCOverlapsBeamSplashCut() override = default;
44 
45 private:
46  bool filter(edm::Event&, const edm::EventSetup&) override;
47  // ----------member data ---------------------------
51 };
52 
53 //
54 // constructors and destructor
55 //
57  : m_src(iConfig.getParameter<edm::InputTag>("src")), m_maxSegments(iConfig.getParameter<int>("maxSegments")) {
58  usesResource(TFileService::kSharedResource);
59  edm::Service<TFileService> tFileService;
60  m_numSegments = tFileService->make<TH1F>("numSegments", "", 201, -0.5, 200.5);
61 }
62 
63 //
64 // member functions
65 //
66 
67 // ------------ method called to produce the data ------------
70  iEvent.getByLabel(m_src, cscSegments);
71 
72  m_numSegments->Fill(cscSegments->size());
73 
74  if (m_maxSegments < 0)
75  return true;
76 
77  else if (int(cscSegments->size()) <= m_maxSegments)
78  return true;
79 
80  else
81  return false;
82 }
83 
84 //define this as a plug-in
static const std::string kSharedResource
Definition: TFileService.h:76
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
CSCOverlapsBeamSplashCut(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:224
~CSCOverlapsBeamSplashCut() override=default
bool filter(edm::Event &, const edm::EventSetup &) override
HLT enums.
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64