CMS 3D CMS Logo

BMixingModule.h
Go to the documentation of this file.
1 #ifndef BMixingModule_h
2 #define BMixingModule_h
3 
18 #include <vector>
19 #include <memory>
20 
26 
27 namespace edm {
28  namespace MixingCache {
29  struct Config {
30  Config(edm::ParameterSet const& pset, unsigned int maxNbSources);
32  int minBunch_;
33  int maxBunch_;
34  bool playback_;
35  std::vector<std::string> sourceNames_;
36  std::vector<std::shared_ptr<PileUpConfig>> inputConfigs_;
37  };
38  }
39 
40  class BMixingModule : public stream::EDProducer<GlobalCache<MixingCache::Config>> {
41  public:
43  explicit BMixingModule(const edm::ParameterSet& ps, MixingCache::Config const* globalConf);
44 
46  virtual ~BMixingModule();
47 
49  virtual void produce(edm::Event& e1, const edm::EventSetup& c) override;
50 
51  virtual void initializeEvent(const edm::Event& event, const edm::EventSetup& setup) {}
52 
53  // edm::Event is non-const because digitizers put their products into the Event.
55 
56  virtual void beginRun(const edm::Run& r, const edm::EventSetup& setup) override;
57  virtual void beginLuminosityBlock(const edm::LuminosityBlock& l, const edm::EventSetup& setup) override;
58 
59  virtual void endRun(const edm::Run& r, const edm::EventSetup& setup) override;
60  virtual void endLuminosityBlock(const edm::LuminosityBlock& l, const edm::EventSetup& setup) override;
61 
62  static std::unique_ptr<MixingCache::Config> initializeGlobalCache(edm::ParameterSet const&);
64 
65  // to be overloaded by dependent class
66  virtual void reload(const edm::EventSetup & setup){};
67 
68  // Should 'averageNumber' return 0 or 1 if there is no mixing? It is the average number of
69  // *crossings*, including the hard scatter, or the average number of overlapping events?
70  // We have guessed 'overlapping events'.
71  double averageNumber() const {return inputSources_[0] ? inputSources_[0]->averageNumber() : 0.0; }
72  // Should 'poisson' return 0 or 1 if there is no mixing? See also averageNumber above.
73  bool poisson() const {return inputSources_[0] ? inputSources_[0]->poisson() : 0.0 ;}
74 
75  virtual void createnewEDProduct();
76  virtual void checkSignal(const edm::Event &e);
77  virtual void addSignals(const edm::Event &e,const edm::EventSetup& c) {}
78  virtual void addPileups(const int bcr, EventPrincipal *ep, unsigned int eventId,unsigned int worker, const edm::EventSetup& c) {}
79  virtual void setBcrOffset ();
80  virtual void setSourceOffset (const unsigned int s);
81  virtual void put(edm::Event &e,const edm::EventSetup& c) {}
82  virtual void doPileUp(edm::Event &e, const edm::EventSetup& c);
83 
84  protected:
85  void setupPileUpEvent(const edm::EventSetup& setup);
86  void dropUnwantedBranches(std::vector<std::string> const& wantedBranches);
87  virtual void beginStream(edm::StreamID) override;
88  virtual void endStream() override;
89  // std::string type_;
92  bool checktof_;
93  int minBunch_;
94  int maxBunch_;
95  bool const mixProdStep1_;
96  bool const mixProdStep2_;
97 
98  bool readDB_;
99  bool playback_;
100  const static unsigned int maxNbSources_;
101  bool doit_[4];//FIXME
102  std::vector< float > TrueNumInteractions_;
103 
104  unsigned int eventId_;
105 
106  // input, cosmics, beamhalo_plus, beamhalo_minus
107  std::vector<std::shared_ptr<PileUp>> inputSources_;
108 
109  void update(edm::EventSetup const&);
111  };
112 
113 }//edm
114 
115 #endif
edm::ESWatcher< MixingRcd > parameterWatcher_
virtual void addPileups(const int bcr, EventPrincipal *ep, unsigned int eventId, unsigned int worker, const edm::EventSetup &c)
Definition: BMixingModule.h:78
virtual void addSignals(const edm::Event &e, const edm::EventSetup &c)
Definition: BMixingModule.h:77
bool const mixProdStep2_
Definition: BMixingModule.h:96
virtual void finalizeEvent(edm::Event &event, const edm::EventSetup &setup)
Definition: BMixingModule.h:54
std::vector< std::string > sourceNames_
Definition: BMixingModule.h:35
std::vector< float > TrueNumInteractions_
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
bool poisson() const
Definition: BMixingModule.h:73
virtual void put(edm::Event &e, const edm::EventSetup &c)
Definition: BMixingModule.h:81
virtual void initializeEvent(const edm::Event &event, const edm::EventSetup &setup)
Definition: BMixingModule.h:51
Config(edm::ParameterSet const &pset, unsigned int maxNbSources)
static const unsigned int maxNbSources_
virtual void reload(const edm::EventSetup &setup)
Definition: BMixingModule.h:66
double averageNumber() const
Definition: BMixingModule.h:71
Float e1
Definition: deltaR.h:20
bool const mixProdStep1_
Definition: BMixingModule.h:95
HLT enums.
#define update(a, b)
std::vector< std::shared_ptr< PileUp > > inputSources_
Definition: Config.py:1
std::vector< std::shared_ptr< PileUpConfig > > inputConfigs_
Definition: BMixingModule.h:36
static void globalEndJob(MixingCache::Config *)
Definition: BMixingModule.h:63
Definition: event.py:1
Definition: Run.h:42
unsigned int eventId_