Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-02 03:46:12

0001 #ifndef MixingModule_h
0002 #define MixingModule_h
0003 
0004 /** \class MixingModule
0005  *
0006  * MixingModule is the EDProducer subclass 
0007  * which fills the CrossingFrame object to allow to add
0008  * pileup events in digitisations
0009  *
0010  * \author Ursula Berthon, LLR Palaiseau
0011  *
0012  * \version   1st Version June 2005
0013  * \version   2nd Version Sep 2005
0014 
0015  *
0016  ************************************************************/
0017 #include "Mixing/Base/interface/BMixingModule.h"
0018 
0019 #include "FWCore/Framework/interface/Event.h"
0020 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0021 #include "FWCore/Utilities/interface/InputTag.h"
0022 
0023 #include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h"
0024 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
0025 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
0026 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0027 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
0028 #include "DataFormats/TrackReco/interface/Track.h"
0029 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0030 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
0031 #include "SimDataFormats/PileupSummaryInfo/interface/PileupMixingContent.h"
0032 
0033 #include "DataFormats/Provenance/interface/ProductID.h"
0034 #include "DataFormats/Common/interface/Handle.h"
0035 #include <vector>
0036 #include <string>
0037 
0038 class CrossingFramePlaybackInfoNew;
0039 class DigiAccumulatorMixMod;
0040 class PileUpEventPrincipal;
0041 
0042 namespace edm {
0043   class AdjusterBase;
0044   class ConsumesCollector;
0045   class MixingWorkerBase;
0046   class ModuleCallingContext;
0047   class StreamID;
0048 
0049   class MixingModule : public BMixingModule {
0050   public:
0051     typedef std::vector<DigiAccumulatorMixMod*> Accumulators;
0052 
0053     /** standard constructor*/
0054     explicit MixingModule(const edm::ParameterSet& ps, MixingCache::Config const* globalConf);
0055 
0056     /**Default destructor*/
0057     ~MixingModule() override;
0058 
0059     virtual void beginJob() {}
0060 
0061     void beginRun(Run const& r1, EventSetup const& c) override;
0062 
0063     void endRun(Run const& r1, EventSetup const& c) override;
0064 
0065     void beginLuminosityBlock(LuminosityBlock const& l1, EventSetup const& c) override;
0066 
0067     void endLuminosityBlock(LuminosityBlock const& l1, EventSetup const& c) override;
0068 
0069     void initializeEvent(Event const& event, EventSetup const& setup) override;
0070 
0071     void accumulateEvent(Event const& event, EventSetup const& setup);
0072 
0073     void accumulateEvent(PileUpEventPrincipal const& event, EventSetup const& setup, edm::StreamID const&);
0074 
0075     void finalizeEvent(Event& event, EventSetup const& setup) override;
0076 
0077     void reload(const edm::EventSetup&) override;
0078 
0079   private:
0080     virtual void branchesActivate(const std::string& friendlyName,
0081                                   const std::string& subdet,
0082                                   InputTag& tag,
0083                                   std::string& label);
0084     void put(edm::Event& e, const edm::EventSetup& es) override;
0085     void createnewEDProduct() override;
0086     void checkSignal(const edm::Event& e) override;
0087     void addSignals(const edm::Event& e, const edm::EventSetup& es) override;
0088     void doPileUp(edm::Event& e, const edm::EventSetup& es) override;
0089     bool pileAllWorkers(EventPrincipal const& ep,
0090                         ModuleCallingContext const*,
0091                         int bcr,
0092                         int id,
0093                         int& offset,
0094                         const edm::EventSetup& setup,
0095                         edm::StreamID const&);
0096     void createDigiAccumulators(const edm::ParameterSet& mixingPSet, edm::ConsumesCollector& iC);
0097 
0098     InputTag inputTagPlayback_;
0099     bool mixProdStep2_;
0100     bool mixProdStep1_;
0101     CrossingFramePlaybackInfoNew* playbackInfo_;
0102 
0103     edm::ESGetToken<MixingModuleConfig, MixingRcd> configToken_;
0104     std::vector<AdjusterBase*> adjusters_;
0105     std::vector<AdjusterBase*> adjustersObjects_;
0106     std::vector<MixingWorkerBase*> workers_;
0107     std::vector<MixingWorkerBase*> workersObjects_;
0108     std::vector<std::string> wantedBranches_;
0109     bool useCurrentProcessOnly_;
0110     bool wrapLongTimes_;
0111     bool skipSignal_;
0112 
0113     // Digi-producing algorithms
0114     Accumulators digiAccumulators_;
0115   };
0116 }  // namespace edm
0117 
0118 #endif