CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

cms::METProducer Class Reference

#include <METProducer.h>

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

List of all members.

Public Member Functions

 METProducer (const edm::ParameterSet &)
virtual void produce (edm::Event &, const edm::EventSetup &)
virtual ~METProducer ()

Private Member Functions

void produce_CaloMET (edm::Event &event)
void produce_else (edm::Event &event)
void produce_GenMET (edm::Event &event)
void produce_PFClusterMET (edm::Event &event)
void produce_PFMET (edm::Event &event)
void produce_TCMET (edm::Event &event, const edm::EventSetup &setup)

Private Attributes

std::string alias
bool calculateSignificance_
double globalThreshold
edm::InputTag inputLabel
std::string inputType
edm::InputTag jetsLabel_
std::string METtype
bool noHF
bool onlyFiducial
metsig::SignAlgoResolutionsresolutions_
TCMETAlgo tcMetAlgo_
bool usePt

Detailed Description

Definition at line 42 of file METProducer.h.


Constructor & Destructor Documentation

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

Definition at line 55 of file METProducer.cc.

References alias, calculateSignificance_, TCMETAlgo::configure(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), jetsLabel_, METtype, noHF, onlyFiducial, resolutions_, tcMetAlgo_, and usePt.

    : inputLabel(iConfig.getParameter<edm::InputTag>("src"))
    , inputType(iConfig.getParameter<std::string>("InputType"))
    , METtype(iConfig.getParameter<std::string>("METType"))
    , alias(iConfig.getParameter<std::string>("alias"))
    , calculateSignificance_(false)
    , resolutions_(0)
    , globalThreshold(iConfig.getParameter<double>("globalThreshold"))
  {
    if( METtype == "CaloMET" ) 
      {
        noHF = iConfig.getParameter<bool>("noHF");
        produces<reco::CaloMETCollection>().setBranchAlias(alias.c_str()); 
        calculateSignificance_ = iConfig.getParameter<bool>("calculateSignificance");
      }
    else if( METtype == "GenMET" )  
      {
        onlyFiducial = iConfig.getParameter<bool>("onlyFiducialParticles");
        usePt = iConfig.getUntrackedParameter<bool>("usePt", false);
        produces<reco::GenMETCollection>().setBranchAlias(alias.c_str());
      }
    else if( METtype == "PFMET" )
      {
        produces<reco::PFMETCollection>().setBranchAlias(alias.c_str()); 

        calculateSignificance_ = iConfig.getParameter<bool>("calculateSignificance");

        if(calculateSignificance_)
          {
            jetsLabel_ = iConfig.getParameter<edm::InputTag>("jets");
          }

      }
    else if( METtype == "PFClusterMET" )
      {
        produces<reco::PFClusterMETCollection>().setBranchAlias(alias.c_str()); 
      }
    else if (METtype == "TCMET" )
      {
        produces<reco::METCollection>().setBranchAlias(alias.c_str());

        int rfType_               = iConfig.getParameter<int>("rf_type");
        bool correctShowerTracks_ = iConfig.getParameter<bool>("correctShowerTracks"); 

        int responseFunctionType = 0;
        if(! correctShowerTracks_)
          {
            if( rfType_ == 1 ) responseFunctionType = 1; // 'fit'
            else if( rfType_ == 2 ) responseFunctionType = 2; // 'mode'
            else { /* probably error */ }
          }
        tcMetAlgo_.configure(iConfig, responseFunctionType );
      }
    else                            
      produces<reco::METCollection>().setBranchAlias(alias.c_str()); 

    if (calculateSignificance_ && ( METtype == "CaloMET" || METtype == "PFMET")){
        resolutions_ = new metsig::SignAlgoResolutions(iConfig);
        
    }
  }
virtual cms::METProducer::~METProducer ( ) [inline, virtual]

Definition at line 46 of file METProducer.h.

{ }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 118 of file METProducer.cc.

References METtype, produce_CaloMET(), produce_else(), produce_GenMET(), produce_PFClusterMET(), produce_PFMET(), and produce_TCMET().

  {
    if( METtype == "CaloMET" ) 
      {
        produce_CaloMET(event);
        return;
      }

    if( METtype == "TCMET" )
      {
        produce_TCMET(event, setup);
        return;
      }

    if( METtype == "PFMET" )
      {
        produce_PFMET(event);
        return;
      }

    if( METtype == "PFClusterMET" )
      {
        produce_PFClusterMET(event);
        return;
      }

    if( METtype == "GenMET" ) 
      {
        produce_GenMET(event);
        return;
      }

    produce_else(event);
  }
void METProducer::produce_CaloMET ( edm::Event event) [private]

Definition at line 153 of file METProducer.cc.

References CaloSpecificAlgo::addInfo(), SignCaloSpecificAlgo::calculateBaseCaloMET(), calculateSignificance_, SignCaloSpecificAlgo::getSignificance(), SignCaloSpecificAlgo::getSignificanceMatrix(), globalThreshold, LaserDQM_cfg::input, inputLabel, noHF, resolutions_, METAlgo::run(), reco::CaloMET::SetMetSignificance(), and reco::MET::setSignificanceMatrix().

Referenced by produce().

  {
    edm::Handle<edm::View<reco::Candidate> > input;
    event.getByLabel(inputLabel, input);

    METAlgo algo;
    CommonMETData commonMETdata = algo.run(input, globalThreshold);

    CaloSpecificAlgo calospecalgo;
    reco::CaloMET calomet = calospecalgo.addInfo(input, commonMETdata, noHF, globalThreshold);

    if( calculateSignificance_ ) 
      {
        SignCaloSpecificAlgo signcalospecalgo;
        signcalospecalgo.calculateBaseCaloMET(input, commonMETdata, *resolutions_, noHF, globalThreshold);
        calomet.SetMetSignificance(signcalospecalgo.getSignificance() );
        calomet.setSignificanceMatrix(signcalospecalgo.getSignificanceMatrix());
      }

    std::auto_ptr<reco::CaloMETCollection> calometcoll;
    calometcoll.reset(new reco::CaloMETCollection);
    calometcoll->push_back( calomet ) ;
    event.put( calometcoll );  
  }
void METProducer::produce_else ( edm::Event event) [private]

Definition at line 239 of file METProducer.cc.

References globalThreshold, LaserDQM_cfg::input, inputLabel, CaloMET_cfi::met, CommonMETData::met, CommonMETData::mex, CommonMETData::mey, p4, METAlgo::run(), and CommonMETData::sumet.

Referenced by produce().

  {
    edm::Handle<edm::View<reco::Candidate> > input;
    event.getByLabel(inputLabel, input);

    CommonMETData commonMETdata;

    METAlgo algo;
    algo.run(input, &commonMETdata, globalThreshold); 

    math::XYZTLorentzVector p4( commonMETdata.mex, commonMETdata.mey, 0.0, commonMETdata.met);
    math::XYZPoint vtx(0,0,0);
    reco::MET met( commonMETdata.sumet, p4, vtx );
    std::auto_ptr<reco::METCollection> metcoll;
    metcoll.reset(new reco::METCollection);
    metcoll->push_back( met );
    event.put( metcoll );
  }
void METProducer::produce_GenMET ( edm::Event event) [private]

Definition at line 225 of file METProducer.cc.

References GenSpecificAlgo::addInfo(), cmsDownloadME::gen, globalThreshold, LaserDQM_cfg::input, inputLabel, onlyFiducial, and usePt.

Referenced by produce().

  {
    edm::Handle<edm::View<reco::Candidate> > input;
    event.getByLabel(inputLabel, input);

    CommonMETData commonMETdata;

    GenSpecificAlgo gen;
    std::auto_ptr<reco::GenMETCollection> genmetcoll;
    genmetcoll.reset (new reco::GenMETCollection);
    genmetcoll->push_back( gen.addInfo(input, &commonMETdata, globalThreshold, onlyFiducial, usePt) );
    event.put( genmetcoll );
  }
void METProducer::produce_PFClusterMET ( edm::Event event) [private]

Definition at line 209 of file METProducer.cc.

References PFClusterSpecificAlgo::addInfo(), globalThreshold, LaserDQM_cfg::input, inputLabel, and METAlgo::run().

Referenced by produce().

  {
    edm::Handle<edm::View<reco::Candidate> > input;
    event.getByLabel(inputLabel, input);

    METAlgo algo;
    CommonMETData commonMETdata = algo.run(input, globalThreshold);

    PFClusterSpecificAlgo pfcluster;
    std::auto_ptr<reco::PFClusterMETCollection> pfclustermetcoll;
    pfclustermetcoll.reset (new reco::PFClusterMETCollection);
        
    pfclustermetcoll->push_back( pfcluster.addInfo(input, commonMETdata) );
    event.put( pfclustermetcoll );
  }
void METProducer::produce_PFMET ( edm::Event event) [private]

Definition at line 186 of file METProducer.cc.

References PFSpecificAlgo::addInfo(), calculateSignificance_, globalThreshold, LaserDQM_cfg::input, inputLabel, analyzePatCleaning_cfg::jets, jetsLabel_, resolutions_, METAlgo::run(), and PFSpecificAlgo::runSignificance().

Referenced by produce().

  {
    edm::Handle<edm::View<reco::Candidate> > input;
    event.getByLabel(inputLabel, input);

    METAlgo algo;
    CommonMETData commonMETdata = algo.run(input, globalThreshold);

    PFSpecificAlgo pf;
        
    if( calculateSignificance_ )
      {
        edm::Handle<edm::View<reco::PFJet> > jets;
        event.getByLabel(jetsLabel_, jets);
        pf.runSignificance(*resolutions_, jets);
      }

    std::auto_ptr<reco::PFMETCollection> pfmetcoll;
    pfmetcoll.reset(new reco::PFMETCollection);
    pfmetcoll->push_back( pf.addInfo(input, commonMETdata) );
    event.put( pfmetcoll );
  }
void METProducer::produce_TCMET ( edm::Event event,
const edm::EventSetup setup 
) [private]

Definition at line 178 of file METProducer.cc.

References TCMETAlgo::CalculateTCMET(), and tcMetAlgo_.

Referenced by produce().

  {
    std::auto_ptr<reco::METCollection> tcmetcoll;
    tcmetcoll.reset(new reco::METCollection);
    tcmetcoll->push_back( tcMetAlgo_.CalculateTCMET(event, setup ) ) ;
    event.put( tcmetcoll );
  }

Member Data Documentation

std::string cms::METProducer::alias [private]

Definition at line 62 of file METProducer.h.

Referenced by METProducer().

Definition at line 65 of file METProducer.h.

Referenced by METProducer(), produce_CaloMET(), and produce_PFMET().

std::string cms::METProducer::inputType [private]

Definition at line 60 of file METProducer.h.

Definition at line 67 of file METProducer.h.

Referenced by METProducer(), and produce_PFMET().

std::string cms::METProducer::METtype [private]

Definition at line 61 of file METProducer.h.

Referenced by METProducer(), and produce().

bool cms::METProducer::noHF [private]

Definition at line 70 of file METProducer.h.

Referenced by METProducer(), and produce_CaloMET().

Definition at line 76 of file METProducer.h.

Referenced by METProducer(), and produce_GenMET().

Definition at line 66 of file METProducer.h.

Referenced by METProducer(), produce_CaloMET(), and produce_PFMET().

Definition at line 81 of file METProducer.h.

Referenced by METProducer(), and produce_TCMET().

bool cms::METProducer::usePt [private]

Definition at line 79 of file METProducer.h.

Referenced by METProducer(), and produce_GenMET().