Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 10:04:39

0001 #ifndef SimGeneral_DataMixingModule_DataMixingModule_h
0002 #define SimGeneral_DataMixingModule_DataMixingModule_h
0003 
0004 /** \class DataMixingModule
0005  *
0006  * DataMixingModule is the EDProducer subclass
0007  * that overlays rawdata events on top of MC,
0008  * using real data for pileup simulation
0009  *
0010  * \author Mike Hildreth, University of Notre Dame
0011  *
0012  * \version   1st Version October 2007
0013  *
0014  ************************************************************/
0015 #include "Mixing/Base/interface/BMixingModule.h"
0016 
0017 #include "FWCore/Framework/interface/Event.h"
0018 #include "FWCore/Framework/interface/EventPrincipal.h"
0019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0020 
0021 #include "DataFormats/Common/interface/Handle.h"
0022 #include "DataFormats/Provenance/interface/ProductID.h"
0023 
0024 #include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h"
0025 
0026 #include "SimGeneral/DataMixingModule/plugins/DataMixingEMDigiWorker.h"
0027 #include "SimGeneral/DataMixingModule/plugins/DataMixingEMWorker.h"
0028 #include "SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorker.h"
0029 #include "SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.h"
0030 #include "SimGeneral/DataMixingModule/plugins/DataMixingHcalWorker.h"
0031 #include "SimGeneral/DataMixingModule/plugins/DataMixingMuonWorker.h"
0032 #include "SimGeneral/DataMixingModule/plugins/DataMixingPileupCopy.h"
0033 #include "SimGeneral/DataMixingModule/plugins/DataMixingSiPixelWorker.h"
0034 #include "SimGeneral/DataMixingModule/plugins/DataMixingSiStripRawWorker.h"
0035 #include "SimGeneral/DataMixingModule/plugins/DataMixingSiStripWorker.h"
0036 
0037 #include <map>
0038 #include <string>
0039 #include <vector>
0040 
0041 namespace edm {
0042 
0043   class ModuleCallingContext;
0044 
0045   class DataMixingModule : public BMixingModule {
0046   public:
0047     /** standard constructor*/
0048     explicit DataMixingModule(const edm::ParameterSet &ps, MixingCache::Config const *globalConf);
0049 
0050     /**Default destructor*/
0051     ~DataMixingModule() override;
0052 
0053     // copies, with EventSetup
0054     void checkSignal(const edm::Event &e) override{};
0055     void createnewEDProduct() override {}
0056     void addSignals(const edm::Event &e, const edm::EventSetup &ES) override;
0057     void doPileUp(edm::Event &e, const edm::EventSetup &ES) override;
0058     void put(edm::Event &e, const edm::EventSetup &ES) override;
0059 
0060     void initializeEvent(edm::Event const &e, edm::EventSetup const &eventSetup) override;
0061     void beginRun(edm::Run const &run, edm::EventSetup const &eventSetup) override;
0062     bool pileWorker(
0063         const edm::EventPrincipal &, int bcr, int EventId, const edm::EventSetup &ES, ModuleCallingContext const *);
0064     // virtual void beginJob();
0065     // virtual void endJob();
0066     void beginLuminosityBlock(LuminosityBlock const &l1, EventSetup const &c) override;
0067     void endLuminosityBlock(LuminosityBlock const &l1, EventSetup const &c) override;
0068     void endRun(const edm::Run &r, const edm::EventSetup &setup) override;
0069 
0070   private:
0071     // data specifiers
0072 
0073     // Ecal
0074     // output:
0075     std::string EBRecHitCollectionDM_;  // secondary name to be given to EB
0076                                         // collection of hits
0077     std::string EERecHitCollectionDM_;  // secondary name to be given to EE
0078                                         // collection of hits
0079     std::string ESRecHitCollectionDM_;  // secondary name to be given to EE
0080                                         // collection of hits
0081     // Digis:
0082     // output
0083     std::string EBDigiCollectionDM_;  // secondary name to be given to EB
0084                                       // collection of hits
0085     std::string EEDigiCollectionDM_;  // secondary name to be given to EE
0086                                       // collection of hits
0087     std::string ESDigiCollectionDM_;  // secondary name to be given to EE
0088                                       // collection of hits
0089 
0090     // Hcal
0091     // Rechits:
0092     // output:
0093     std::string HBHERecHitCollectionDM_;  // secondary name to be given to HBHE
0094                                           // collection of hits
0095     std::string HORecHitCollectionDM_;    // secondary name to be given to HO
0096                                           // collection of hits
0097     std::string HFRecHitCollectionDM_;    // secondary name to be given to HF
0098                                           // collection of hits
0099     std::string ZDCRecHitCollectionDM_;   // secondary name to be given to ZDC
0100                                           // collection of hits
0101     // Digis:
0102     // output:
0103     std::string HBHEDigiCollectionDM_;   // secondary name to be given to HBHE
0104                                          // collection of hits
0105     std::string HODigiCollectionDM_;     // secondary name to be given to HO
0106                                          // collection of hits
0107     std::string HFDigiCollectionDM_;     // secondary name to be given to HF
0108                                          // collection of hits
0109     std::string ZDCDigiCollectionDM_;    // secondary name to be given to ZDC
0110                                          // collection of hits
0111     std::string QIE10DigiCollectionDM_;  // secondary name to be given to QIE10
0112                                          // collection of hits
0113     std::string QIE11DigiCollectionDM_;  // secondary name to be given to QIE11
0114                                          // collection of hits
0115 
0116     // Muons
0117     // output:
0118     std::string DTDigiCollectionDM_;             // secondary name to be given to new DT digis
0119     std::string RPCDigiCollectionDM_;            // secondary name to be given to new RPC digis
0120     std::string CSCStripDigiCollectionDM_;       // secondary name given to new
0121                                                  // collection of CSC Strip digis
0122     std::string CSCWireDigiCollectionDM_;        // secondary name given to new
0123                                                  // collection of CSC wire digis
0124     std::string CSCComparatorDigiCollectionDM_;  // "     " CSC Comparator digis
0125 
0126     // SiStrips
0127     std::string SiStripDigiCollectionDM_;  // secondary name to be given to new
0128                                            // SiStrip digis
0129 
0130     // SiPixels
0131     std::string PixelDigiCollectionDM_;  // secondary name to be given to new SiPixel digis
0132 
0133     // merge tracker digis or tracks?
0134     bool MergeTrackerDigis_;
0135 
0136     // Submodules to handle the individual detectors
0137 
0138     DataMixingPileupCopy *PUWorker_;
0139 
0140     DataMixingEMWorker *EMWorker_;
0141     DataMixingEMDigiWorker *EMDigiWorker_;
0142     bool MergeEMDigis_;
0143 
0144     // Hcal
0145 
0146     DataMixingHcalWorker *HcalWorker_;
0147     DataMixingHcalDigiWorker *HcalDigiWorker_;
0148     DataMixingHcalDigiWorkerProd *HcalDigiWorkerProd_;
0149 
0150     // tokens needed to DataMixingHcalDigiWorkerProd
0151     edm::InputTag EBPileInputTag_;     // InputTag for Pileup Digis collection
0152     edm::InputTag EEPileInputTag_;     // InputTag for Pileup Digis collection
0153     edm::InputTag ESPileInputTag_;     // InputTag for Pileup Digis collection
0154     edm::InputTag HBHEPileInputTag_;   // InputTag for Pileup Digis collection
0155     edm::InputTag HOPileInputTag_;     // InputTag for Pileup Digis collection
0156     edm::InputTag HFPileInputTag_;     // InputTag for Pileup Digis collection
0157     edm::InputTag ZDCPileInputTag_;    // InputTag for Pileup Digis collection
0158     edm::InputTag QIE10PileInputTag_;  // InputTag for Pileup Digis collection
0159     edm::InputTag QIE11PileInputTag_;  // InputTag for Pileup Digis collection
0160     edm::EDGetTokenT<HBHEDigitizerTraits::DigiCollection> tok_hbhe_;
0161     edm::EDGetTokenT<HODigitizerTraits::DigiCollection> tok_ho_;
0162     edm::EDGetTokenT<HFDigitizerTraits::DigiCollection> tok_hf_;
0163     edm::EDGetTokenT<ZDCDigitizerTraits::DigiCollection> tok_zdc_;
0164     edm::EDGetTokenT<HcalQIE10DigitizerTraits::DigiCollection> tok_qie10_;
0165     edm::EDGetTokenT<HcalQIE11DigitizerTraits::DigiCollection> tok_qie11_;
0166 
0167     const edm::ESGetToken<HcalDbService, HcalDbRecord> tokDB_;
0168 
0169     bool MergeHcalDigis_;
0170     bool MergeHcalDigisProd_;
0171 
0172     bool MergePileup_;
0173     bool AddedPileup_;
0174 
0175     // Muons
0176 
0177     DataMixingMuonWorker *MuonWorker_;
0178 
0179     // Si-Strips
0180 
0181     DataMixingSiStripWorker *SiStripWorker_;
0182     DataMixingSiStripRawWorker *SiStripRawWorker_;
0183     bool useSiStripRawDigi_;
0184     std::string siStripRawDigiSource_;
0185 
0186     // Pixels
0187 
0188     DataMixingSiPixelWorker *SiPixelWorker_;
0189 
0190     virtual void getSubdetectorNames();
0191 
0192     // internally used information : subdetectors present in input
0193     std::vector<std::string> Subdetectors_;
0194 
0195     //      unsigned int eventId_; //=0 for signal, from 1-n for pileup events
0196 
0197     std::string label_;
0198   };
0199 }  // namespace edm
0200 
0201 #endif