CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LumiblockFilter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: LumiblockFilter
4 // Class: LumiblockFilter
5 //
13 //
14 // Original Author: Jeff Temple
15 // Created: Mon May 12 15:38:09 CEST 2008
16 //
17 //
18 
19 
20 // system include files
21 #include <iostream>
22 #include <memory>
23 
24 // user include files
27 
30 
32 
33 
34 #include "TH1.h"
35 
36 //
37 // class declaration
38 //
39 
41  public:
42  explicit LumiblockFilter(const edm::ParameterSet&);
44 
45  private:
46  virtual void beginJob() override ;
47  virtual bool filter(edm::Event&, const edm::EventSetup&) override;
48  virtual void endJob() override ;
49 
50  // ----------member data ---------------------------
51 
52  /* Set values of start, end lum'y
53  each event's lum'y block X must be >=startblock and <endblock
54  if startblock, endblock values are <= 0, then
55  they are not used in the lum'y block checking.
56  */
57 
59  int endblock;
60  bool debug;
61 
62  /*
63  // don't bother with histograms yet
64  TH1F* alllumis;
65  TH1F* lumihist;
66  */
67 };
68 
69 //
70 // constants, enums and typedefs
71 //
72 
73 //
74 // static data member definitions
75 //
76 
77 //
78 // constructors and destructor
79 //
81 {
82  //now do what ever initialization is needed
83  startblock=iConfig.getUntrackedParameter <int> ("startblock",0);
84  endblock=iConfig.getUntrackedParameter <int> ("endblock",0);
85  debug = iConfig.getUntrackedParameter <bool> ("debug",false);
86 
87  /*
88  if (debug)
89  {
90  alllumis = new TH1F("allLumiBlocks", "All luminosity blocks found in run",500,0,500);
91  lumihist = new TH1F("lumiBlockRange","selected luminosity block range",500,0,500);
92  }
93  */
94 }
95 
96 
98 {
99 
100  // do anything here that needs to be done at desctruction time
101  // (e.g. close files, deallocate resources etc.)
102 
103 }
104 
105 
106 //
107 // member functions
108 //
109 
110 // ------------ method called on each new Event ------------
111 bool
113 {
114  int lumi = iEvent.luminosityBlock();
115  /*
116  if (debug)
117  alllumis->Fill(lumi);
118  */
119  if (debug) std::cout <<" LUMI BLOCK = "<<lumi<<std::endl;
120  if (startblock>0 and lumi<startblock)
121  return false;
122  if (endblock>0 and lumi>=endblock)
123  return false;
124  /*
125  if (debug)
126  lumihist->Fill(lumi);
127  */
128  if (debug) std::cout <<" LUMI BLOCK WITHIN RANGE "<<startblock<<" - "<<endblock<<std::endl;
129  return true;
130 }
131 
132 // ------------ method called once each job just before starting event loop ------------
133 void
135 {
136 }
137 
138 // ------------ method called once each job just after ending the event loop ------------
139 void
141 }
142 
143 //define this as a plug-in
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
tuple lumi
Definition: fjr2json.py:35
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:63
int iEvent
Definition: GenABIO.cc:230
virtual void beginJob() override
virtual void endJob() override
virtual bool filter(edm::Event &, const edm::EventSetup &) override
tuple cout
Definition: gather_cfg.py:121
LumiblockFilter(const edm::ParameterSet &)