Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:25:35

0001 // -*- C++ -*-
0002 //
0003 // Package:    METProducers
0004 // Class:      CaloMETProducer
0005 //
0006 //
0007 
0008 //____________________________________________________________________________||
0009 #include "RecoMET/METProducers/interface/CaloMETProducer.h"
0010 
0011 #include "FWCore/Framework/interface/ConsumesCollector.h"
0012 
0013 #include "FWCore/Utilities/interface/InputTag.h"
0014 
0015 #include "DataFormats/Common/interface/Handle.h"
0016 
0017 #include "DataFormats/METReco/interface/METFwd.h"
0018 #include "DataFormats/METReco/interface/CaloMETFwd.h"
0019 #include "DataFormats/METReco/interface/CaloMET.h"
0020 #include "DataFormats/METReco/interface/CommonMETData.h"
0021 
0022 #include "RecoMET/METAlgorithms/interface/METAlgo.h"
0023 #include "RecoMET/METAlgorithms/interface/SignAlgoResolutions.h"
0024 #include "RecoMET/METAlgorithms/interface/CaloSpecificAlgo.h"
0025 #include "RecoMET/METAlgorithms/interface/SignCaloSpecificAlgo.h"
0026 
0027 #include <cstring>
0028 
0029 //____________________________________________________________________________||
0030 namespace cms {
0031 
0032   //____________________________________________________________________________||
0033   CaloMETProducer::CaloMETProducer(const edm::ParameterSet& iConfig)
0034       : inputToken_(consumes<edm::View<reco::Candidate> >(iConfig.getParameter<edm::InputTag>("src"))),
0035         calculateSignificance_(iConfig.getParameter<bool>("calculateSignificance")),
0036         resolutions_(nullptr),
0037         globalThreshold_(iConfig.getParameter<double>("globalThreshold")) {
0038     noHF_ = iConfig.getParameter<bool>("noHF");
0039 
0040     std::string alias = iConfig.exists("alias") ? iConfig.getParameter<std::string>("alias") : "";
0041 
0042     produces<reco::CaloMETCollection>().setBranchAlias(alias);
0043 
0044     if (calculateSignificance_)
0045       resolutions_ = new metsig::SignAlgoResolutions(iConfig);
0046   }
0047 
0048   //____________________________________________________________________________||
0049   CaloMETProducer::~CaloMETProducer() {
0050     if (resolutions_)
0051       delete resolutions_;
0052   }
0053 
0054   //____________________________________________________________________________||
0055   void CaloMETProducer::produce(edm::Event& event, const edm::EventSetup& setup) {
0056     edm::Handle<edm::View<reco::Candidate> > input;
0057     event.getByToken(inputToken_, input);
0058 
0059     METAlgo algo;
0060     CommonMETData commonMETdata = algo.run(*input.product(), globalThreshold_);
0061 
0062     CaloSpecificAlgo calospecalgo;
0063     reco::CaloMET calomet = calospecalgo.addInfo(input, commonMETdata, noHF_, globalThreshold_);
0064 
0065     /*
0066     if( calculateSignificance_ )
0067       {
0068     SignCaloSpecificAlgo signcalospecalgo;
0069     signcalospecalgo.calculateBaseCaloMET(input, commonMETdata, *resolutions_, noHF_, globalThreshold_);
0070     calomet.SetMetSignificance(signcalospecalgo.getSignificance());
0071     calomet.setSignificanceMatrix(signcalospecalgo.getSignificanceMatrix());
0072       }
0073 */
0074     auto calometcoll = std::make_unique<reco::CaloMETCollection>();
0075     calometcoll->push_back(calomet);
0076     event.put(std::move(calometcoll));
0077   }
0078 
0079   //____________________________________________________________________________||
0080   DEFINE_FWK_MODULE(CaloMETProducer);
0081 }  // namespace cms
0082 
0083 //____________________________________________________________________________||