File indexing completed on 2024-04-06 12:29:32
0001
0002 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0003 #include "FWCore/Framework/interface/MakerMacros.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005
0006 #include "SimCalorimetry/HcalSimAlgos/interface/HcalSignalGenerator.h"
0007
0008 class HcalSignalGeneratorTest : public edm::one::EDAnalyzer<> {
0009 public:
0010 explicit HcalSignalGeneratorTest(const edm::ParameterSet&);
0011 ~HcalSignalGeneratorTest() override {}
0012
0013 private:
0014 void beginJob() override {}
0015 void analyze(const edm::Event&, const edm::EventSetup&) override;
0016 void endJob() override {}
0017
0018 void dump(CaloVNoiseSignalGenerator* signalGenerator) const;
0019
0020
0021 HcalSimParameterMap theMap;
0022 HBHESignalGenerator theHBHESignalGenerator;
0023 HOSignalGenerator theHOSignalGenerator;
0024 HFSignalGenerator theHFSignalGenerator;
0025 ZDCSignalGenerator theZDCSignalGenerator;
0026 QIE10SignalGenerator theQIE10SignalGenerator;
0027 QIE11SignalGenerator theQIE11SignalGenerator;
0028
0029 edm::EDGetTokenT<HBHEDigitizerTraits::DigiCollection> tok_hbhe_;
0030 edm::EDGetTokenT<HODigitizerTraits::DigiCollection> tok_ho_;
0031 edm::EDGetTokenT<HFDigitizerTraits::DigiCollection> tok_hf_;
0032 edm::EDGetTokenT<ZDCDigitizerTraits::DigiCollection> tok_zdc_;
0033 edm::EDGetTokenT<HcalQIE10DigitizerTraits::DigiCollection> tok_qie10_;
0034 edm::EDGetTokenT<HcalQIE11DigitizerTraits::DigiCollection> tok_qie11_;
0035
0036 edm::InputTag theHBHETag_, theHOTag_, theHFTag_, theZDCTag_, theQIE10Tag_, theQIE11Tag_;
0037 const edm::ESGetToken<HcalDbService, HcalDbRecord> tokDB_;
0038 };
0039
0040 HcalSignalGeneratorTest::HcalSignalGeneratorTest(const edm::ParameterSet& iConfig)
0041 : theMap(),
0042 theHBHETag_(iConfig.getParameter<edm::InputTag>("HBHEdigiCollectionPile")),
0043 theHOTag_(iConfig.getParameter<edm::InputTag>("HOdigiCollectionPile")),
0044 theHFTag_(iConfig.getParameter<edm::InputTag>("HFdigiCollectionPile")),
0045 theZDCTag_(iConfig.getParameter<edm::InputTag>("ZDCdigiCollectionPile")),
0046 theQIE10Tag_(iConfig.getParameter<edm::InputTag>("QIE10digiCollectionPile")),
0047 theQIE11Tag_(iConfig.getParameter<edm::InputTag>("QIE11digiCollectionPile")),
0048 tokDB_(esConsumes<HcalDbService, HcalDbRecord>()) {
0049 tok_hbhe_ = consumes<HBHEDigitizerTraits::DigiCollection>(theHBHETag_);
0050 tok_ho_ = consumes<HODigitizerTraits::DigiCollection>(theHOTag_);
0051 tok_hf_ = consumes<HFDigitizerTraits::DigiCollection>(theHFTag_);
0052 tok_zdc_ = consumes<ZDCDigitizerTraits::DigiCollection>(theZDCTag_);
0053 tok_qie10_ = consumes<HcalQIE10DigitizerTraits::DigiCollection>(theQIE10Tag_);
0054 tok_qie11_ = consumes<HcalQIE11DigitizerTraits::DigiCollection>(theQIE11Tag_);
0055
0056 theHBHESignalGenerator = HBHESignalGenerator(theHBHETag_, tok_hbhe_);
0057 theHOSignalGenerator = HOSignalGenerator(theHOTag_, tok_ho_);
0058 theHFSignalGenerator = HFSignalGenerator(theHFTag_, tok_hf_);
0059 theZDCSignalGenerator = ZDCSignalGenerator(theZDCTag_, tok_zdc_);
0060 theQIE10SignalGenerator = QIE10SignalGenerator(theQIE10Tag_, tok_qie10_);
0061 theQIE11SignalGenerator = QIE11SignalGenerator(theQIE11Tag_, tok_qie11_);
0062
0063 theHBHESignalGenerator.setParameterMap(&theMap);
0064 theHOSignalGenerator.setParameterMap(&theMap);
0065 theHFSignalGenerator.setParameterMap(&theMap);
0066 theZDCSignalGenerator.setParameterMap(&theMap);
0067 theQIE10SignalGenerator.setParameterMap(&theMap);
0068 theQIE11SignalGenerator.setParameterMap(&theMap);
0069 }
0070
0071 void HcalSignalGeneratorTest::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0072 theHBHESignalGenerator.initializeEvent(&iEvent, &iSetup, tokDB_);
0073 theHOSignalGenerator.initializeEvent(&iEvent, &iSetup, tokDB_);
0074 theHFSignalGenerator.initializeEvent(&iEvent, &iSetup, tokDB_);
0075 theZDCSignalGenerator.initializeEvent(&iEvent, &iSetup, tokDB_);
0076 theQIE10SignalGenerator.initializeEvent(&iEvent, &iSetup, tokDB_);
0077 theQIE11SignalGenerator.initializeEvent(&iEvent, &iSetup, tokDB_);
0078
0079 theHBHESignalGenerator.fill(nullptr);
0080 theHOSignalGenerator.fill(nullptr);
0081 theHFSignalGenerator.fill(nullptr);
0082 theZDCSignalGenerator.fill(nullptr);
0083 theQIE10SignalGenerator.fill(nullptr);
0084 theQIE11SignalGenerator.fill(nullptr);
0085 }
0086
0087 void HcalSignalGeneratorTest::dump(CaloVNoiseSignalGenerator* signalGenerator) const {
0088 std::vector<CaloSamples> samples;
0089 signalGenerator->getNoiseSignals(samples);
0090 for (std::vector<CaloSamples>::const_iterator sampleItr = samples.begin(); sampleItr != samples.end(); ++sampleItr) {
0091 std::cout << *sampleItr << std::endl;
0092 }
0093 }
0094
0095
0096 DEFINE_FWK_MODULE(HcalSignalGeneratorTest);