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
30 
31 // references
35 #include "TH1F.h"
36 
37 //
38 // class decleration
39 //
40 
41 class CSCOverlapsBeamSplashCut : public edm::one::EDFilter<edm::one::SharedResources> {
42 public:
44  ~CSCOverlapsBeamSplashCut() override = default;
45  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
46 
47 private:
48  bool filter(edm::Event&, const edm::EventSetup&) override;
49  // ----------member data ---------------------------
51  const int m_maxSegments;
54 };
55 
56 //
57 // constructors and destructor
58 //
60  : m_src(iConfig.getParameter<edm::InputTag>("src")),
61  m_maxSegments(iConfig.getParameter<int>("maxSegments")),
62  cscToken_(consumes<CSCSegmentCollection>(m_src)) {
63  usesResource(TFileService::kSharedResource);
64  edm::Service<TFileService> tFileService;
65  m_numSegments = tFileService->make<TH1F>("numSegments", "", 201, -0.5, 200.5);
66 }
67 
68 //
69 // member functions
70 //
73  desc.add<edm::InputTag>("src", edm::InputTag("ALCARECOMuAlBeamHaloOverlaps"));
74  desc.add<int>("maxSegments", 4);
75  descriptions.add("cscOverlapsBeamSplashCut", desc);
76 }
77 
78 // ------------ method called to produce the data ------------
81 
82  m_numSegments->Fill(cscSegments->size());
83 
84  if (m_maxSegments < 0)
85  return true;
86 
87  else if (static_cast<int>(cscSegments->size()) <= m_maxSegments)
88  return true;
89 
90  else
91  return false;
92 }
93 
94 //define this as a plug-in
static const std::string kSharedResource
Definition: TFileService.h:76
CSCOverlapsBeamSplashCut(const edm::ParameterSet &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
~CSCOverlapsBeamSplashCut() override=default
bool filter(edm::Event &, const edm::EventSetup &) override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
edm::EDGetTokenT< CSCSegmentCollection > cscToken_