CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CaloMETProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: METProducers
4 // Class: CaloMETProducer
5 //
6 //
7 
8 //____________________________________________________________________________||
10 
12 
14 
16 
21 
26 
27 #include <cstring>
28 
29 //____________________________________________________________________________||
30 namespace cms {
31 
32  //____________________________________________________________________________||
34  : inputToken_(consumes<edm::View<reco::Candidate> >(iConfig.getParameter<edm::InputTag>("src"))),
35  calculateSignificance_(iConfig.getParameter<bool>("calculateSignificance")),
36  resolutions_(nullptr),
37  globalThreshold_(iConfig.getParameter<double>("globalThreshold")) {
38  noHF_ = iConfig.getParameter<bool>("noHF");
39 
40  std::string alias = iConfig.exists("alias") ? iConfig.getParameter<std::string>("alias") : "";
41 
42  produces<reco::CaloMETCollection>().setBranchAlias(alias);
43 
46  }
47 
48  //____________________________________________________________________________||
50  if (resolutions_)
51  delete resolutions_;
52  }
53 
54  //____________________________________________________________________________||
57  event.getByToken(inputToken_, input);
58 
59  METAlgo algo;
60  CommonMETData commonMETdata = algo.run(*input.product(), globalThreshold_);
61 
62  CaloSpecificAlgo calospecalgo;
63  reco::CaloMET calomet = calospecalgo.addInfo(input, commonMETdata, noHF_, globalThreshold_);
64 
65  /*
66  if( calculateSignificance_ )
67  {
68  SignCaloSpecificAlgo signcalospecalgo;
69  signcalospecalgo.calculateBaseCaloMET(input, commonMETdata, *resolutions_, noHF_, globalThreshold_);
70  calomet.SetMetSignificance(signcalospecalgo.getSignificance());
71  calomet.setSignificanceMatrix(signcalospecalgo.getSignificanceMatrix());
72  }
73 */
74  auto calometcoll = std::make_unique<reco::CaloMETCollection>();
75  calometcoll->push_back(calomet);
76  event.put(std::move(calometcoll));
77  }
78 
79  //____________________________________________________________________________||
81 } // namespace cms
82 
83 //____________________________________________________________________________||
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool exists(std::string const &parameterName) const
checks if a parameter exists
static std::string const input
Definition: EdmProvDump.cc:47
def move
Definition: eostools.py:511
Structure containing data common to all types of MET.
Definition: CommonMETData.h:12
CaloMETProducer(const edm::ParameterSet &)
edm::EDGetTokenT< edm::View< reco::Candidate > > inputToken_
T const * product() const
Definition: Handle.h:70
reco::CaloMET addInfo(edm::Handle< edm::View< reco::Candidate > > towers, const CommonMETData &met, bool noHF, double globalThreshold)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void produce(edm::Event &, const edm::EventSetup &) override
CommonMETData run(const edm::View< reco::Candidate > &candidates, double globalThreshold=0.0, edm::ValueMap< float > const *weights=nullptr)
Definition: METAlgo.cc:16
metsig::SignAlgoResolutions * resolutions_