Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-06-13 03:24:06

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   // prepare output
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   // loop over HGCEE digis
0045   const auto& pHGCEEDigis = evt.getHandle(eeDigiCollection_);
0046   if (pHGCEEDigis.isValid())
0047     worker_->runHGCEE(es.getHandle(ee_geometry_token_), *pHGCEEDigis, *eeUncalibRechits);
0048 
0049   // loop over HGCHEsil digis
0050   const auto& pHGCHEFDigis = evt.getHandle(hefDigiCollection_);
0051   if (pHGCHEFDigis.isValid())
0052     worker_->runHGCHEsil(es.getHandle(hef_geometry_token_), *pHGCHEFDigis, *hefUncalibRechits);
0053 
0054   // loop over HGCHEscint digis
0055   const auto& pHGCHEBDigis = evt.getHandle(hebDigiCollection_);
0056   if (pHGCHEBDigis.isValid())
0057     worker_->runHGCHEscint(es.getHandle(heb_geometry_token_), *pHGCHEBDigis, *hebUncalibRechits);
0058 
0059   // loop over HFNose digis
0060   const auto& pHGCHFNoseDigis = evt.getHandle(hfnoseDigiCollection_);
0061   if (pHGCHFNoseDigis.isValid())
0062     worker_->runHGCHFNose(es.getHandle(hfnose_geometry_token_), *pHGCHFNoseDigis, *hfnoseUncalibRechits);
0063 
0064   // put the collection of recunstructed hits in the event
0065   evt.put(std::move(eeUncalibRechits), eeHitCollection_);
0066   evt.put(std::move(hefUncalibRechits), hefHitCollection_);
0067   evt.put(std::move(hebUncalibRechits), hebHitCollection_);
0068   if (pHGCHFNoseDigis.isValid())
0069     evt.put(std::move(hfnoseUncalibRechits), hfnoseHitCollection_);
0070 }
0071 
0072 void HGCalUncalibRecHitProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0073   // HGCalUncalibRecHit
0074   edm::ParameterSetDescription desc;
0075   desc.add<edm::InputTag>("HGCEEdigiCollection", edm::InputTag("hgcalDigis", "EE"));
0076   desc.add<std::string>("HGCEEhitCollection", "HGCEEUncalibRecHits");
0077   desc.add<edm::InputTag>("HGCHEFdigiCollection", edm::InputTag("hgcalDigis", "HEfront"));
0078   desc.add<std::string>("HGCHEFhitCollection", "HGCHEFUncalibRecHits");
0079   desc.add<edm::InputTag>("HGCHEBdigiCollection", edm::InputTag("hgcalDigis", "HEback"));
0080   desc.add<std::string>("HGCHEBhitCollection", "HGCHEBUncalibRecHits");
0081   desc.add<edm::InputTag>("HGCHFNosedigiCollection", edm::InputTag("hfnoseDigis", "HFNose"));
0082   desc.add<std::string>("HGCHFNosehitCollection", "HGCHFNoseUncalibRecHits");
0083   edm::ParameterSetDescription HGCEEConfigPSet;
0084   HGCEEConfigPSet.add<bool>("isSiFE", true);
0085   HGCEEConfigPSet.add<unsigned int>("adcNbits", 10);
0086   HGCEEConfigPSet.add<double>("adcSaturation", 100);
0087   HGCEEConfigPSet.add<unsigned int>("tdcNbits", 12);
0088   HGCEEConfigPSet.add<double>("tdcSaturation", 10000);
0089   HGCEEConfigPSet.add<double>("tdcOnset", 60);
0090   HGCEEConfigPSet.add<double>("toaLSB_ns", 0.0244);
0091   HGCEEConfigPSet.add<double>("tofDelay", -9);
0092   HGCEEConfigPSet.add<std::vector<double>>("fCPerMIP",
0093                                            {
0094                                                1.25,
0095                                                2.57,
0096                                                3.88,
0097                                            });
0098   desc.add<edm::ParameterSetDescription>("HGCEEConfig", HGCEEConfigPSet);
0099   edm::ParameterSetDescription HGCHEFConfigPSet;
0100   HGCHEFConfigPSet.add<bool>("isSiFE", true);
0101   HGCHEFConfigPSet.add<unsigned int>("adcNbits", 10);
0102   HGCHEFConfigPSet.add<double>("adcSaturation", 100);
0103   HGCHEFConfigPSet.add<unsigned int>("tdcNbits", 12);
0104   HGCHEFConfigPSet.add<double>("tdcSaturation", 10000);
0105   HGCHEFConfigPSet.add<double>("tdcOnset", 60);
0106   HGCHEFConfigPSet.add<double>("toaLSB_ns", 0.0244);
0107   HGCHEFConfigPSet.add<double>("tofDelay", -11);
0108   HGCHEFConfigPSet.add<std::vector<double>>("fCPerMIP",
0109                                             {
0110                                                 1.25,
0111                                                 2.57,
0112                                                 3.88,
0113                                             });
0114   desc.add<edm::ParameterSetDescription>("HGCHEFConfig", HGCHEFConfigPSet);
0115   edm::ParameterSetDescription HGCHEBConfigPSet;
0116   HGCHEBConfigPSet.add<bool>("isSiFE", true);
0117   HGCHEBConfigPSet.add<unsigned int>("adcNbits", 10);
0118   HGCHEBConfigPSet.add<double>("adcSaturation", 68.75);
0119   HGCHEBConfigPSet.add<unsigned int>("tdcNbits", 12);
0120   HGCHEBConfigPSet.add<double>("tdcSaturation", 1000);
0121   HGCHEBConfigPSet.add<double>("tdcOnset", 55);
0122   HGCHEBConfigPSet.add<double>("toaLSB_ns", 0.0244);
0123   HGCHEBConfigPSet.add<double>("tofDelay", -14);
0124   HGCHEBConfigPSet.add<std::vector<double>>("fCPerMIP",
0125                                             {
0126                                                 1.0,
0127                                                 1.0,
0128                                                 1.0,
0129                                             });
0130   desc.add<edm::ParameterSetDescription>("HGCHEBConfig", HGCHEBConfigPSet);
0131   edm::ParameterSetDescription HGCHFNoseConfigPSet;
0132   HGCHFNoseConfigPSet.add<bool>("isSiFE", false);
0133   HGCHFNoseConfigPSet.add<unsigned int>("adcNbits", 10);
0134   HGCHFNoseConfigPSet.add<double>("adcSaturation", 100);
0135   HGCHFNoseConfigPSet.add<unsigned int>("tdcNbits", 12);
0136   HGCHFNoseConfigPSet.add<double>("tdcSaturation", 10000);
0137   HGCHFNoseConfigPSet.add<double>("tdcOnset", 60);
0138   HGCHFNoseConfigPSet.add<double>("toaLSB_ns", 0.0244);
0139   HGCHFNoseConfigPSet.add<double>("tofDelay", -33);
0140   HGCHFNoseConfigPSet.add<std::vector<double>>("fCPerMIP",
0141                                                {
0142                                                    1.25,
0143                                                    2.57,
0144                                                    3.88,
0145                                                });
0146   desc.add<edm::ParameterSetDescription>("HGCHFNoseConfig", HGCHFNoseConfigPSet);
0147   desc.add<std::string>("algo", "HGCalUncalibRecHitWorkerWeights");
0148   desc.add<bool>("computeLocalTime", false);
0149   descriptions.add("HGCalUncalibRecHitProducer", desc);
0150 }
0151 
0152 #include "FWCore/Framework/interface/MakerMacros.h"
0153 
0154 DEFINE_FWK_MODULE(HGCalUncalibRecHitProducer);