File indexing completed on 2024-10-14 22:39:50
0001 #include "RecoLocalCalo/HGCalRecProducers/plugins/HGCalUncalibRecHitProducer.h"
0002
0003 #include "DataFormats/HGCDigi/interface/HGCDigiCollections.h"
0004 #include "DataFormats/Common/interface/Handle.h"
0005
0006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0007
0008 #include "RecoLocalCalo/HGCalRecProducers/interface/HGCalUncalibRecHitWorkerFactory.h"
0009
0010 #include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h"
0011
0012 HGCalUncalibRecHitProducer::HGCalUncalibRecHitProducer(const edm::ParameterSet& ps)
0013 : eeDigiCollection_(consumes<HGCalDigiCollection>(ps.getParameter<edm::InputTag>("HGCEEdigiCollection"))),
0014 hefDigiCollection_(consumes<HGCalDigiCollection>(ps.getParameter<edm::InputTag>("HGCHEFdigiCollection"))),
0015 hebDigiCollection_(consumes<HGCalDigiCollection>(ps.getParameter<edm::InputTag>("HGCHEBdigiCollection"))),
0016 hfnoseDigiCollection_(consumes<HGCalDigiCollection>(ps.getParameter<edm::InputTag>("HGCHFNosedigiCollection"))),
0017 ee_geometry_token_(esConsumes(edm::ESInputTag("", "HGCalEESensitive"))),
0018 hef_geometry_token_(esConsumes(edm::ESInputTag("", "HGCalHESiliconSensitive"))),
0019 heb_geometry_token_(esConsumes(edm::ESInputTag("", "HGCalHEScintillatorSensitive"))),
0020 hfnose_geometry_token_(esConsumes(edm::ESInputTag("", "HGCalHFNoseSensitive"))),
0021 eeHitCollection_(ps.getParameter<std::string>("HGCEEhitCollection")),
0022 hefHitCollection_(ps.getParameter<std::string>("HGCHEFhitCollection")),
0023 hebHitCollection_(ps.getParameter<std::string>("HGCHEBhitCollection")),
0024 hfnoseHitCollection_(ps.getParameter<std::string>("HGCHFNosehitCollection")),
0025 worker_{HGCalUncalibRecHitWorkerFactory::get()->create(
0026 ps.getParameter<std::string>("algo"), ps, consumesCollector(), ps.getParameter<bool>("computeLocalTime"))} {
0027 produces<HGCeeUncalibratedRecHitCollection>(eeHitCollection_);
0028 produces<HGChefUncalibratedRecHitCollection>(hefHitCollection_);
0029 produces<HGChebUncalibratedRecHitCollection>(hebHitCollection_);
0030 produces<HGChfnoseUncalibratedRecHitCollection>(hfnoseHitCollection_);
0031 }
0032
0033 HGCalUncalibRecHitProducer::~HGCalUncalibRecHitProducer() {}
0034
0035 void HGCalUncalibRecHitProducer::produce(edm::Event& evt, const edm::EventSetup& es) {
0036 using namespace edm;
0037
0038
0039 auto eeUncalibRechits = std::make_unique<HGCeeUncalibratedRecHitCollection>();
0040 auto hefUncalibRechits = std::make_unique<HGChefUncalibratedRecHitCollection>();
0041 auto hebUncalibRechits = std::make_unique<HGChebUncalibratedRecHitCollection>();
0042 auto hfnoseUncalibRechits = std::make_unique<HGChfnoseUncalibratedRecHitCollection>();
0043
0044
0045 const auto& pHGCEEDigis = evt.getHandle(eeDigiCollection_);
0046 if (pHGCEEDigis.isValid()) {
0047 worker_->runHGCEE(es.getHandle(ee_geometry_token_), *pHGCEEDigis, *eeUncalibRechits);
0048 evt.put(std::move(eeUncalibRechits), eeHitCollection_);
0049 }
0050
0051 const auto& pHGCHEFDigis = evt.getHandle(hefDigiCollection_);
0052 if (pHGCHEFDigis.isValid()) {
0053 worker_->runHGCHEsil(es.getHandle(hef_geometry_token_), *pHGCHEFDigis, *hefUncalibRechits);
0054 evt.put(std::move(hefUncalibRechits), hefHitCollection_);
0055 }
0056
0057 const auto& pHGCHEBDigis = evt.getHandle(hebDigiCollection_);
0058 if (pHGCHEBDigis.isValid()) {
0059 worker_->runHGCHEscint(es.getHandle(heb_geometry_token_), *pHGCHEBDigis, *hebUncalibRechits);
0060 evt.put(std::move(hebUncalibRechits), hebHitCollection_);
0061 }
0062
0063 const auto& pHGCHFNoseDigis = evt.getHandle(hfnoseDigiCollection_);
0064 if (pHGCHFNoseDigis.isValid()) {
0065 worker_->runHGCHFNose(es.getHandle(hfnose_geometry_token_), *pHGCHFNoseDigis, *hfnoseUncalibRechits);
0066 evt.put(std::move(hfnoseUncalibRechits), hfnoseHitCollection_);
0067 }
0068 }
0069
0070 void HGCalUncalibRecHitProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0071
0072 edm::ParameterSetDescription desc;
0073 desc.add<edm::InputTag>("HGCEEdigiCollection", edm::InputTag("hgcalDigis", "EE"));
0074 desc.add<std::string>("HGCEEhitCollection", "HGCEEUncalibRecHits");
0075 desc.add<edm::InputTag>("HGCHEFdigiCollection", edm::InputTag("hgcalDigis", "HEfront"));
0076 desc.add<std::string>("HGCHEFhitCollection", "HGCHEFUncalibRecHits");
0077 desc.add<edm::InputTag>("HGCHEBdigiCollection", edm::InputTag("hgcalDigis", "HEback"));
0078 desc.add<std::string>("HGCHEBhitCollection", "HGCHEBUncalibRecHits");
0079 desc.add<edm::InputTag>("HGCHFNosedigiCollection", edm::InputTag("hfnoseDigis", "HFNose"));
0080 desc.add<std::string>("HGCHFNosehitCollection", "HGCHFNoseUncalibRecHits");
0081 edm::ParameterSetDescription HGCEEConfigPSet;
0082 HGCEEConfigPSet.add<bool>("isSiFE", true);
0083 HGCEEConfigPSet.add<unsigned int>("adcNbits", 10);
0084 HGCEEConfigPSet.add<double>("adcSaturation", 100);
0085 HGCEEConfigPSet.add<unsigned int>("tdcNbits", 12);
0086 HGCEEConfigPSet.add<double>("tdcSaturation", 10000);
0087 HGCEEConfigPSet.add<double>("tdcOnset", 60);
0088 HGCEEConfigPSet.add<double>("toaLSB_ns", 0.0244);
0089 HGCEEConfigPSet.add<double>("tofDelay", -9);
0090 HGCEEConfigPSet.add<std::vector<double>>("fCPerMIP",
0091 {
0092 1.25,
0093 2.57,
0094 3.88,
0095 });
0096 desc.add<edm::ParameterSetDescription>("HGCEEConfig", HGCEEConfigPSet);
0097 edm::ParameterSetDescription HGCHEFConfigPSet;
0098 HGCHEFConfigPSet.add<bool>("isSiFE", true);
0099 HGCHEFConfigPSet.add<unsigned int>("adcNbits", 10);
0100 HGCHEFConfigPSet.add<double>("adcSaturation", 100);
0101 HGCHEFConfigPSet.add<unsigned int>("tdcNbits", 12);
0102 HGCHEFConfigPSet.add<double>("tdcSaturation", 10000);
0103 HGCHEFConfigPSet.add<double>("tdcOnset", 60);
0104 HGCHEFConfigPSet.add<double>("toaLSB_ns", 0.0244);
0105 HGCHEFConfigPSet.add<double>("tofDelay", -11);
0106 HGCHEFConfigPSet.add<std::vector<double>>("fCPerMIP",
0107 {
0108 1.25,
0109 2.57,
0110 3.88,
0111 });
0112 desc.add<edm::ParameterSetDescription>("HGCHEFConfig", HGCHEFConfigPSet);
0113 edm::ParameterSetDescription HGCHEBConfigPSet;
0114 HGCHEBConfigPSet.add<bool>("isSiFE", true);
0115 HGCHEBConfigPSet.add<unsigned int>("adcNbits", 10);
0116 HGCHEBConfigPSet.add<double>("adcSaturation", 68.75);
0117 HGCHEBConfigPSet.add<unsigned int>("tdcNbits", 12);
0118 HGCHEBConfigPSet.add<double>("tdcSaturation", 1000);
0119 HGCHEBConfigPSet.add<double>("tdcOnset", 55);
0120 HGCHEBConfigPSet.add<double>("toaLSB_ns", 0.0244);
0121 HGCHEBConfigPSet.add<double>("tofDelay", -14);
0122 HGCHEBConfigPSet.add<std::vector<double>>("fCPerMIP",
0123 {
0124 1.0,
0125 1.0,
0126 1.0,
0127 });
0128 desc.add<edm::ParameterSetDescription>("HGCHEBConfig", HGCHEBConfigPSet);
0129 edm::ParameterSetDescription HGCHFNoseConfigPSet;
0130 HGCHFNoseConfigPSet.add<bool>("isSiFE", false);
0131 HGCHFNoseConfigPSet.add<unsigned int>("adcNbits", 10);
0132 HGCHFNoseConfigPSet.add<double>("adcSaturation", 100);
0133 HGCHFNoseConfigPSet.add<unsigned int>("tdcNbits", 12);
0134 HGCHFNoseConfigPSet.add<double>("tdcSaturation", 10000);
0135 HGCHFNoseConfigPSet.add<double>("tdcOnset", 60);
0136 HGCHFNoseConfigPSet.add<double>("toaLSB_ns", 0.0244);
0137 HGCHFNoseConfigPSet.add<double>("tofDelay", -33);
0138 HGCHFNoseConfigPSet.add<std::vector<double>>("fCPerMIP",
0139 {
0140 1.25,
0141 2.57,
0142 3.88,
0143 });
0144 desc.add<edm::ParameterSetDescription>("HGCHFNoseConfig", HGCHFNoseConfigPSet);
0145 desc.add<std::string>("algo", "HGCalUncalibRecHitWorkerWeights");
0146 desc.add<bool>("computeLocalTime", false);
0147 descriptions.add("HGCalUncalibRecHitProducer", desc);
0148 }
0149
0150 #include "FWCore/Framework/interface/MakerMacros.h"
0151
0152 DEFINE_FWK_MODULE(HGCalUncalibRecHitProducer);