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 
41 public:
43  ~CSCOverlapsBeamSplashCut() override;
44 
45 private:
46  void beginJob() override;
47  bool filter(edm::Event&, const edm::EventSetup&) override;
48  void endJob() override;
49 
50  // ----------member data ---------------------------
54 };
55 
56 //
57 // constants, enums and typedefs
58 //
59 
60 //
61 // static data member definitions
62 //
63 
64 //
65 // constructors and destructor
66 //
68  : m_src(iConfig.getParameter<edm::InputTag>("src")), m_maxSegments(iConfig.getParameter<int>("maxSegments")) {
69  edm::Service<TFileService> tFileService;
70  m_numSegments = tFileService->make<TH1F>("numSegments", "", 201, -0.5, 200.5);
71 }
72 
74  // do anything here that needs to be done at desctruction time
75  // (e.g. close files, deallocate resources etc.)
76 }
77 
78 //
79 // member functions
80 //
81 
82 // ------------ method called to produce the data ------------
85  iEvent.getByLabel(m_src, cscSegments);
86 
87  m_numSegments->Fill(cscSegments->size());
88 
89  if (m_maxSegments < 0)
90  return true;
91 
92  else if (int(cscSegments->size()) <= m_maxSegments)
93  return true;
94 
95  else
96  return false;
97 }
98 
99 // ------------ method called once each job just before starting event loop ------------
101 
102 // ------------ method called once each job just after ending the event loop ------------
104 
105 //define this as a plug-in
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
CSCOverlapsBeamSplashCut(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:488
bool filter(edm::Event &, const edm::EventSetup &) override
HLT enums.