Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-18 00:40:20

0001 #ifndef SimDataMixingEMDigiWorker_h
0002 #define SimDataMixingEMDigiWorker_h
0003 
0004 /** \class DataMixingEMDigiWorker
0005  *
0006  * DataMixingModule is the EDProducer subclass
0007  * that overlays rawdata events on top of MC,
0008  * using real data for pileup simulation
0009  * This class takes care of the EM information at the Digi level
0010  *
0011  * \author Mike Hildreth, University of Notre Dame
0012  *
0013  * \version   1st Version October 2007
0014  *
0015  ************************************************************/
0016 
0017 #include "FWCore/Framework/interface/ConsumesCollector.h"
0018 #include "FWCore/Framework/interface/Event.h"
0019 #include "FWCore/Framework/interface/EventPrincipal.h"
0020 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0021 
0022 #include "DataFormats/Common/interface/Handle.h"
0023 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0024 #include "DataFormats/EcalDetId/interface/EEDetId.h"
0025 #include "DataFormats/EcalDetId/interface/ESDetId.h"
0026 #include "DataFormats/Provenance/interface/ProductID.h"
0027 
0028 #include "DataFormats/EcalDigi/interface/EBDataFrame.h"
0029 #include "DataFormats/EcalDigi/interface/EEDataFrame.h"
0030 #include "DataFormats/EcalDigi/interface/ESDataFrame.h"
0031 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
0032 
0033 #include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h"
0034 #include "CondFormats/EcalObjects/interface/EcalPedestals.h"
0035 #include "CondFormats/DataRecord/interface/EcalGainRatiosRcd.h"
0036 #include "CondFormats/EcalObjects/interface/EcalGainRatios.h"
0037 
0038 #include <map>
0039 #include <string>
0040 #include <vector>
0041 
0042 namespace edm {
0043   class ModuleCallingContext;
0044 
0045   class DataMixingEMDigiWorker {
0046   public:
0047     DataMixingEMDigiWorker();
0048 
0049     /** standard constructor*/
0050     explicit DataMixingEMDigiWorker(const edm::ParameterSet &ps, edm::ConsumesCollector &&iC);
0051 
0052     /**Default destructor*/
0053     virtual ~DataMixingEMDigiWorker();
0054 
0055     void putEM(edm::Event &e, const edm::EventSetup &ES);
0056     void addEMSignals(const edm::Event &e, const edm::EventSetup &ES);
0057     void addEMPileups(const int bcr,
0058                       const edm::EventPrincipal *,
0059                       unsigned int EventId,
0060                       const edm::EventSetup &ES,
0061                       ModuleCallingContext const *);
0062 
0063   private:
0064     /// retrieve pedestals for that detid [0]=g12, [1]=g6, [2]=g12
0065     const std::vector<float> GetPedestals(const edm::EventSetup &ES, const DetId &detid);
0066 
0067     /// retrieve gain ratios for that detid [0]=g12, [1]=g6, [2]=g12
0068     const std::vector<float> GetGainRatios(const edm::EventSetup &ES, const DetId &detid);
0069 
0070     // data specifiers
0071 
0072     edm::InputTag EBProducerSig_;  // primary? name given to collection of EB calib digis
0073     edm::InputTag EEProducerSig_;  // primary? name given to collection of EE calib digis
0074     edm::InputTag ESProducerSig_;  // primary? name given to collection of ES calib digis
0075 
0076     edm::InputTag EBdigiCollectionSig_;  // secondary name given to collection of
0077                                          // EB calib digis
0078     edm::InputTag EEdigiCollectionSig_;  // secondary name given to collection of
0079                                          // EE calib digis
0080     edm::InputTag ESdigiCollectionSig_;  // secondary name given to collection of
0081                                          // ES calib digis
0082 
0083     edm::InputTag EBPileInputTag_;  // complete input tag for EB pileup digis
0084     edm::InputTag EEPileInputTag_;  // complete input tag for EE pileup digis
0085     edm::InputTag ESPileInputTag_;  // complete input tag for ES pileup digis
0086 
0087     edm::EDGetTokenT<EBDigiCollection> EBDigiToken_;  // Token to retrieve information
0088     edm::EDGetTokenT<EEDigiCollection> EEDigiToken_;  // Token to retrieve information
0089     edm::EDGetTokenT<ESDigiCollection> ESDigiToken_;  // Token to retrieve information
0090 
0091     edm::EDGetTokenT<EBDigiCollection> EBDigiPileToken_;  // Token to retrieve information
0092     edm::EDGetTokenT<EEDigiCollection> EEDigiPileToken_;  // Token to retrieve information
0093     edm::EDGetTokenT<ESDigiCollection> ESDigiPileToken_;  // Token to retrieve information
0094 
0095     std::string EBDigiCollectionDM_;  // secondary name to be given to EB
0096                                       // collection of hits
0097     std::string EEDigiCollectionDM_;  // secondary name to be given to EE
0098                                       // collection of hits
0099     std::string ESDigiCollectionDM_;  // secondary name to be given to ES
0100                                       // collection of hits
0101 
0102     typedef std::multimap<DetId, EBDataFrame> EBDigiMap;
0103     typedef std::multimap<DetId, EEDataFrame> EEDigiMap;
0104     typedef std::multimap<DetId, ESDataFrame> ESDigiMap;
0105 
0106     EBDigiMap EBDigiStorage_;
0107     EEDigiMap EEDigiStorage_;
0108     ESDigiMap ESDigiStorage_;
0109 
0110     //      unsigned int eventId_; //=0 for signal, from 1-n for pileup events
0111 
0112     std::string label_;
0113 
0114     edm::ESGetToken<EcalPedestals, EcalPedestalsRcd> pedToken_;
0115     edm::ESGetToken<EcalGainRatios, EcalGainRatiosRcd> grToken_;
0116   };
0117 }  // namespace edm
0118 
0119 #endif  // SimDataMixingEMDigiWorker_h