CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
cms::METProducer Class Reference

#include <METProducer.h>

Inheritance diagram for cms::METProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Types

typedef edm::OwnVector
< reco::Candidate
CandidateCollection
 
typedef math::XYZTLorentzVector LorentzVector
 
typedef math::XYZPoint Point
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

 METProducer (const edm::ParameterSet &)
 
 METProducer ()
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
virtual ~METProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

METAlgo alg_
 
std::string alias
 
bool calculateSignificance_
 
double globalThreshold
 
edm::InputTag inputLabel
 
std::string inputType
 
edm::InputTag jetsLabel_
 
std::string METtype
 
int myResponseFunctionType
 
bool noHF
 
bool onlyFiducial
 
metsig::SignAlgoResolutionsresolutions_
 
TCMETAlgotcmetalgorithm
 
bool usePt
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 45 of file METProducer.h.

Member Typedef Documentation

Definition at line 50 of file METProducer.h.

Definition at line 48 of file METProducer.h.

Definition at line 49 of file METProducer.h.

Constructor & Destructor Documentation

METProducer::METProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 52 of file METProducer.cc.

References alias, calculateSignificance_, TCMETAlgo::configure(), funct::false, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), globalThreshold, inputLabel, inputType, jetsLabel_, METtype, myResponseFunctionType, noHF, onlyFiducial, resolutions_, tcmetalgorithm, and usePt.

52  : alg_() , resolutions_(0), tcmetalgorithm(0)
53  {
54  inputLabel = iConfig.getParameter<edm::InputTag>("src");
55  inputType = iConfig.getParameter<std::string>("InputType");
56  METtype = iConfig.getParameter<std::string>("METType");
57  alias = iConfig.getParameter<std::string>("alias");
58  globalThreshold = iConfig.getParameter<double>("globalThreshold");
60 
61  if( METtype == "CaloMET" )
62  {
63  noHF = iConfig.getParameter<bool>("noHF");
64  produces<CaloMETCollection>().setBranchAlias(alias.c_str());
65  calculateSignificance_ = iConfig.getParameter<bool>("calculateSignificance");
66  }
67  else if( METtype == "GenMET" )
68  {
69  onlyFiducial = iConfig.getParameter<bool>("onlyFiducialParticles");
70  usePt = iConfig.getUntrackedParameter<bool>("usePt",false);
71  produces<GenMETCollection>().setBranchAlias(alias.c_str());
72  }
73  else if( METtype == "PFMET" )
74  {
75  produces<PFMETCollection>().setBranchAlias(alias.c_str());
76 
77  calculateSignificance_ = iConfig.getParameter<bool>("calculateSignificance");
78 
79  if(calculateSignificance_){
80  jetsLabel_ = iConfig.getParameter<edm::InputTag>("jets");
81  }
82 
83  }
84  else if( METtype == "PFClusterMET" )
85  {
86  produces<PFClusterMETCollection>().setBranchAlias(alias.c_str());
87  }
88  else if (METtype == "TCMET" )
89  {
90  produces<METCollection>().setBranchAlias(alias.c_str());
91 
92  int rfType_ = iConfig.getParameter<int>("rf_type");
93  bool correctShowerTracks_ = iConfig.getParameter<bool>("correctShowerTracks");
94 
95  if(correctShowerTracks_){
96  // use 'shower' and 'noshower' response functions
98  }else{
99 
100  if( rfType_ == 1 ){
101  // use response function 'fit'
103  }
104  else if( rfType_ == 2 ){
105  // use response function 'mode'
107  }
108  }
109  tcmetalgorithm = new TCMETAlgo();
111  }
112  else
113  produces<METCollection>().setBranchAlias(alias.c_str());
114 
115  if (calculateSignificance_ && ( METtype == "CaloMET" || METtype == "PFMET")){
117 
118  }
119  }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag inputLabel
Definition: METProducer.h:59
bool calculateSignificance_
Definition: METProducer.h:65
std::string alias
Definition: METProducer.h:62
std::string inputType
Definition: METProducer.h:60
void configure(const edm::ParameterSet &iConfig, int myResponseFunctionType)
Definition: TCMETAlgo.cc:65
TCMETAlgo * tcmetalgorithm
Definition: METProducer.h:81
int myResponseFunctionType
Definition: METProducer.h:82
double globalThreshold
Definition: METProducer.h:73
edm::InputTag jetsLabel_
Definition: METProducer.h:67
metsig::SignAlgoResolutions * resolutions_
Definition: METProducer.h:66
std::string METtype
Definition: METProducer.h:61
METProducer::METProducer ( )
explicit

Definition at line 125 of file METProducer.cc.

References tcmetalgorithm.

125  : alg_()
126  {
127  tcmetalgorithm = 0; // why does this constructor exist?
128  produces<METCollection>();
129  }
TCMETAlgo * tcmetalgorithm
Definition: METProducer.h:81
METProducer::~METProducer ( )
virtual

Definition at line 135 of file METProducer.cc.

References tcmetalgorithm.

135 { delete tcmetalgorithm;}
TCMETAlgo * tcmetalgorithm
Definition: METProducer.h:81

Member Function Documentation

void METProducer::produce ( edm::Event event,
const edm::EventSetup setup 
)
virtual

Implements edm::EDProducer.

Definition at line 141 of file METProducer.cc.

References CaloSpecificAlgo::addInfo(), GenSpecificAlgo::addInfo(), PFClusterSpecificAlgo::addInfo(), PFSpecificAlgo::addInfo(), alg_, SignCaloSpecificAlgo::calculateBaseCaloMET(), calculateSignificance_, TCMETAlgo::CalculateTCMET(), relval_steps::gen(), SignCaloSpecificAlgo::getSignificance(), SignCaloSpecificAlgo::getSignificanceMatrix(), globalThreshold, LaserDQM_cfg::input, inputLabel, fwrapper::jets, jetsLabel_, CaloMET_cfi::met, CommonMETData::met, METtype, CommonMETData::mex, CommonMETData::mey, noHF, onlyFiducial, convertSQLitetoXML_cfg::output, p4, resolutions_, METAlgo::run(), PFSpecificAlgo::runSignificance(), reco::CaloMET::SetMetSignificance(), reco::MET::setSignificanceMatrix(), CommonMETData::sumet, tcmetalgorithm, and usePt.

142  {
143 
144  //-----------------------------------
145  // Step A: Get Inputs. Create an empty collection of candidates
147  event.getByLabel(inputLabel,input);
148  //-----------------------------------
149  // Step B: Create an empty MET struct output.
151  /*
152  //-----------------------------------
153  // Step C: Convert input source to type CandidateCollection
154  const RefToBaseVector<Candidate> inputCol = inputHandle->refVector();
155  const CandidateCollection *input = (const CandidateCollection *)inputCol.product();
156  */
157  //-----------------------------------
158  // Step C2: Invoke the MET algorithm, which runs on any CandidateCollection input.
159 
160  // alg_.run(input, &output, globalThreshold); // No need to run this for all METTypes!
161 
162  //-----------------------------------
163  // Step D: Invoke the specific "afterburner", which adds information
164  // depending on the input type, given via the config parameter.
165  // Also, after the specific algorithm has been called, store
166  // the output into the Event.
167 
168  if( METtype == "CaloMET" )
169  {
170  //Run Basic MET Algorithm
171  alg_.run(input, &output, globalThreshold);
172 
173  // Run CaloSpecific Algorithm
174  CaloSpecificAlgo calospecalgo;
175  CaloMET calomet = calospecalgo.addInfo(input,output,noHF, globalThreshold);
176 
177  //Run algorithm to calculate CaloMET Significance and add to the MET Object
179  {
180  SignCaloSpecificAlgo signcalospecalgo;
181  //metsig::SignAlgoResolutions resolutions(conf_);
182 
183  signcalospecalgo.calculateBaseCaloMET(input,output,*resolutions_,noHF,globalThreshold);
184  calomet.SetMetSignificance( signcalospecalgo.getSignificance() );
185  calomet.setSignificanceMatrix(signcalospecalgo.getSignificanceMatrix());
186  }
187  //Store CaloMET object in CaloMET collection
188  std::auto_ptr<CaloMETCollection> calometcoll;
189  calometcoll.reset(new CaloMETCollection);
190  calometcoll->push_back( calomet ) ;
191  event.put( calometcoll );
192 
193  }
194  //-----------------------------------
195  else if( METtype == "TCMET" )
196  {
197  std::auto_ptr<METCollection> tcmetcoll;
198  tcmetcoll.reset(new METCollection);
199  tcmetcoll->push_back( tcmetalgorithm->CalculateTCMET(event, setup ) ) ;
200  event.put( tcmetcoll );
201  }
202  //----------------------------------
203  else if( METtype == "PFMET" )
204  {
205  alg_.run(input, &output, globalThreshold);
206  PFSpecificAlgo pf;
207  std::auto_ptr<PFMETCollection> pfmetcoll;
208  pfmetcoll.reset (new PFMETCollection);
209 
210  // add resolutions and calculate significance
212  {
213  //metsig::SignAlgoResolutions resolutions(conf_);
215  event.getByLabel(jetsLabel_,jets);
216  pf.runSignificance(*resolutions_, jets);
217  }
218  pfmetcoll->push_back( pf.addInfo(input, output) );
219  event.put( pfmetcoll );
220  }
221  //----------------------------------
222  else if( METtype == "PFClusterMET" )
223  {
224  alg_.run(input, &output, globalThreshold);
225  PFClusterSpecificAlgo pfcluster;
226  std::auto_ptr<PFClusterMETCollection> pfclustermetcoll;
227  pfclustermetcoll.reset (new PFClusterMETCollection);
228 
229  pfclustermetcoll->push_back( pfcluster.addInfo(input, output) );
230  event.put( pfclustermetcoll );
231  }
232  //-----------------------------------
233  else if( METtype == "GenMET" )
234  {
236  std::auto_ptr<GenMETCollection> genmetcoll;
237  genmetcoll.reset (new GenMETCollection);
238  genmetcoll->push_back( gen.addInfo(input, &output, globalThreshold, onlyFiducial, usePt) );
239  event.put( genmetcoll );
240  }
241  else
242  {
243  alg_.run(input, &output, globalThreshold);
244  LorentzVector p4( output.mex, output.mey, 0.0, output.met);
245  Point vtx(0,0,0);
246  MET met( output.sumet, p4, vtx );
247  std::auto_ptr<METCollection> metcoll;
248  metcoll.reset(new METCollection);
249  metcoll->push_back( met );
250  event.put( metcoll );
251  }
252  //-----------------------------------
253  }
Collection of Gen MET.
reco::MET CalculateTCMET(edm::Event &event, const edm::EventSetup &setup)
Definition: TCMETAlgo.cc:161
edm::InputTag inputLabel
Definition: METProducer.h:59
bool calculateSignificance_
Definition: METProducer.h:65
reco::PFClusterMET addInfo(edm::Handle< edm::View< reco::Candidate > > PFClusterCandidates, CommonMETData met)
math::XYZTLorentzVector LorentzVector
reco::GenMET addInfo(edm::Handle< edm::View< reco::Candidate > > particles, CommonMETData *met, double globalThreshold, bool onlyFiducial=false, bool usePt=false)
Make GenMET. Assumes MET is made from MCCandidates.
Collection of Calo MET.
virtual void run(edm::Handle< edm::View< reco::Candidate > >, CommonMETData *, double)
Definition: METAlgo.cc:41
Definition: MET.h:32
double p4[4]
Definition: TauolaWrapper.h:92
void calculateBaseCaloMET(edm::Handle< edm::View< reco::Candidate > > towers, CommonMETData met, const metsig::SignAlgoResolutions &resolutions, bool noHF, double globalthreshold)
vector< PseudoJet > jets
math::XYZPoint Point
Structure containing data common to all types of MET.
Definition: CommonMETData.h:22
void setSignificanceMatrix(const TMatrixD &matrix)
Definition: MET.cc:185
Collection of MET.
TCMETAlgo * tcmetalgorithm
Definition: METProducer.h:81
reco::CaloMET addInfo(edm::Handle< edm::View< reco::Candidate > > towers, CommonMETData met, bool noHF, double globalThreshold)
Make CaloMET. Assumes MET is made from CaloTowerCandidates.
TMatrixD getSignificanceMatrix() const
double globalThreshold
Definition: METProducer.h:73
Collection of PFCluster MET.
edm::InputTag jetsLabel_
Definition: METProducer.h:67
metsig::SignAlgoResolutions * resolutions_
Definition: METProducer.h:66
reco::PFMET addInfo(edm::Handle< edm::View< reco::Candidate > > PFCandidates, CommonMETData met)
void runSignificance(metsig::SignAlgoResolutions &resolutions, edm::Handle< edm::View< reco::PFJet > > jets)
std::string METtype
Definition: METProducer.h:61
void SetMetSignificance(double metsig)
Definition: CaloMET.h:76
Collection of PF MET.

Member Data Documentation

METAlgo cms::METProducer::alg_
private

Definition at line 58 of file METProducer.h.

Referenced by produce().

std::string cms::METProducer::alias
private

Definition at line 62 of file METProducer.h.

Referenced by METProducer().

bool cms::METProducer::calculateSignificance_
private

Definition at line 65 of file METProducer.h.

Referenced by METProducer(), and produce().

double cms::METProducer::globalThreshold
private

Definition at line 73 of file METProducer.h.

Referenced by METProducer(), and produce().

edm::InputTag cms::METProducer::inputLabel
private

Definition at line 59 of file METProducer.h.

Referenced by METProducer(), and produce().

std::string cms::METProducer::inputType
private

Definition at line 60 of file METProducer.h.

Referenced by METProducer().

edm::InputTag cms::METProducer::jetsLabel_
private

Definition at line 67 of file METProducer.h.

Referenced by METProducer(), and produce().

std::string cms::METProducer::METtype
private

Definition at line 61 of file METProducer.h.

Referenced by METProducer(), and produce().

int cms::METProducer::myResponseFunctionType
private

Definition at line 82 of file METProducer.h.

Referenced by METProducer().

bool cms::METProducer::noHF
private

Definition at line 70 of file METProducer.h.

Referenced by METProducer(), and produce().

bool cms::METProducer::onlyFiducial
private

Definition at line 76 of file METProducer.h.

Referenced by METProducer(), and produce().

metsig::SignAlgoResolutions* cms::METProducer::resolutions_
private

Definition at line 66 of file METProducer.h.

Referenced by METProducer(), and produce().

TCMETAlgo* cms::METProducer::tcmetalgorithm
private

Definition at line 81 of file METProducer.h.

Referenced by METProducer(), produce(), and ~METProducer().

bool cms::METProducer::usePt
private

Definition at line 79 of file METProducer.h.

Referenced by METProducer(), and produce().