CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes

pat::PATElectronProducer Class Reference

Produces pat::Electron's. More...

#include <PhysicsTools/PatAlgos/interface/PATElectronProducer.h>

Inheritance diagram for pat::PATElectronProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 PATElectronProducer (const edm::ParameterSet &iConfig)
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 ~PATElectronProducer ()

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)

Private Types

typedef edm::RefToBase
< reco::GsfElectron
ElectronBaseRef
typedef std::vector
< edm::Handle
< edm::Association
< reco::GenParticleCollection > > > 
GenAssociations
typedef std::vector
< edm::Handle< edm::ValueMap
< IsoDeposit > > > 
IsoDepositMaps
typedef std::pair
< pat::IsolationKeys,
edm::InputTag
IsolationLabel
typedef std::vector
< IsolationLabel
IsolationLabels
typedef std::vector
< edm::Handle< edm::ValueMap
< double > > > 
IsolationValueMaps
typedef std::pair< std::string,
edm::InputTag
NameTag

Private Member Functions

void embedHighLevel (pat::Electron &anElectron, reco::GsfTrackRef track, reco::TransientTrack &tt, reco::Vertex &primaryVertex, bool primaryVertexIsValid, reco::BeamSpot &beamspot, bool beamspotIsValid)
void fillElectron (Electron &aElectron, const ElectronBaseRef &electronRef, const reco::CandidateBaseRef &baseRef, const GenAssociations &genMatches, const IsoDepositMaps &deposits, const bool pfId, const IsolationValueMaps &isolationValues, const IsolationValueMaps &isolationValuesNoPFId) const
 common electron filling, for both the standard and PF2PAT case
void fillElectron2 (Electron &anElectron, const reco::CandidatePtr &candPtrForIsolation, const reco::CandidatePtr &candPtrForGenMatch, const reco::CandidatePtr &candPtrForLoader, const GenAssociations &genMatches, const IsoDepositMaps &deposits, const IsolationValueMaps &isolationValues) const
void readIsolationLabels (const edm::ParameterSet &iConfig, const char *psetName, IsolationLabels &labels)

Private Attributes

bool addEfficiencies_
bool addElecID_
bool addGenMatch_
bool addResolutions_
edm::InputTag beamLineSrc_
pat::helper::EfficiencyLoader efficiencyLoader_
std::vector< NameTagelecIDSrcs_
edm::InputTag electronSrc_
bool embedGenMatch_
bool embedGsfElectronCore_
bool embedGsfTrack_
bool embedHighLevelSelection_
 embed high level selection variables?
bool embedPFCandidate_
bool embedSuperCluster_
bool embedTrack_
std::vector< edm::InputTaggenMatchSrc_
IsolationLabels isoDepositLabels_
IsolationLabels isolationValueLabels_
IsolationLabels isolationValueLabelsNoPFId_
pat::helper::MultiIsolator isolator_
pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_
edm::InputTag pfCandidateMap_
edm::InputTag pfElecSrc_
GreaterByPt< ElectronpTComparator_
edm::InputTag pvSrc_
pat::helper::KinResolutionsLoader resolutionLoader_
bool useParticleFlow_
 pflow specific
bool usePV_
pat::PATUserDataHelper
< pat::Electron
userDataHelper_
bool useUserData_

Detailed Description

Produces pat::Electron's.

The PATElectronProducer produces analysis-level pat::Electron's starting from a collection of objects of reco::GsfElectron.

Author:
Steven Lowette, James Lamb\
Version:
Id:
PATElectronProducer.h,v 1.26 2012/03/29 16:43:55 tjkim Exp

Definition at line 55 of file PATElectronProducer.h.


Member Typedef Documentation

Definition at line 91 of file PATElectronProducer.h.

Definition at line 90 of file PATElectronProducer.h.

Definition at line 92 of file PATElectronProducer.h.

Definition at line 124 of file PATElectronProducer.h.

Definition at line 125 of file PATElectronProducer.h.

typedef std::vector< edm::Handle< edm::ValueMap<double> > > pat::PATElectronProducer::IsolationValueMaps [private]

Definition at line 93 of file PATElectronProducer.h.

typedef std::pair<std::string, edm::InputTag> pat::PATElectronProducer::NameTag [private]

Definition at line 134 of file PATElectronProducer.h.


Constructor & Destructor Documentation

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

Definition at line 46 of file PATElectronProducer.cc.

References addEfficiencies_, addElecID_, addGenMatch_, addResolutions_, beamLineSrc_, efficiencyLoader_, elecIDSrcs_, electronSrc_, embedGenMatch_, embedGsfElectronCore_, embedGsfTrack_, embedHighLevelSelection_, embedPFCandidate_, embedSuperCluster_, embedTrack_, edm::ParameterSet::existsAs(), genMatchSrc_, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), isoDepositLabels_, isolationValueLabels_, isolationValueLabelsNoPFId_, h::names, pfCandidateMap_, pfElecSrc_, pvSrc_, readIsolationLabels(), resolutionLoader_, useParticleFlow_, usePV_, userDataHelper_, and useUserData_.

                                                                        :
  isolator_(iConfig.exists("userIsolation") ? iConfig.getParameter<edm::ParameterSet>("userIsolation") : edm::ParameterSet(), false) ,
  useUserData_(iConfig.exists("userData"))
{

  // general configurables
  electronSrc_      = iConfig.getParameter<edm::InputTag>( "electronSource" );
  embedGsfElectronCore_    = iConfig.getParameter<bool>         ( "embedGsfElectronCore" );
  embedGsfTrack_    = iConfig.getParameter<bool>         ( "embedGsfTrack" );
  embedSuperCluster_= iConfig.getParameter<bool>         ( "embedSuperCluster" );
  embedTrack_       = iConfig.getParameter<bool>         ( "embedTrack" );

  // pflow specific
  pfElecSrc_           = iConfig.getParameter<edm::InputTag>( "pfElectronSource" );
  pfCandidateMap_   = iConfig.getParameter<edm::InputTag>( "pfCandidateMap" );
  useParticleFlow_        = iConfig.getParameter<bool>( "useParticleFlow" );
  embedPFCandidate_   = iConfig.getParameter<bool>( "embedPFCandidate" );

  // MC matching configurables
  addGenMatch_      = iConfig.getParameter<bool>          ( "addGenMatch" );
  if (addGenMatch_) {
    embedGenMatch_ = iConfig.getParameter<bool>         ( "embedGenMatch" );
    if (iConfig.existsAs<edm::InputTag>("genParticleMatch")) {
      genMatchSrc_.push_back(iConfig.getParameter<edm::InputTag>( "genParticleMatch" ));
    } else {
      genMatchSrc_ = iConfig.getParameter<std::vector<edm::InputTag> >( "genParticleMatch" );
    }
  }

  // resolution configurables
  addResolutions_   = iConfig.getParameter<bool>         ( "addResolutions" );
  if (addResolutions_) {
    resolutionLoader_ = pat::helper::KinResolutionsLoader(iConfig.getParameter<edm::ParameterSet>("resolutions"));
  }


  // electron ID configurables
  addElecID_        = iConfig.getParameter<bool>         ( "addElectronID" );
  if (addElecID_) {
    // it might be a single electron ID
    if (iConfig.existsAs<edm::InputTag>("electronIDSource")) {
      elecIDSrcs_.push_back(NameTag("", iConfig.getParameter<edm::InputTag>("electronIDSource")));
    }
    // or there might be many of them
    if (iConfig.existsAs<edm::ParameterSet>("electronIDSources")) {
      // please don't configure me twice
      if (!elecIDSrcs_.empty()) throw cms::Exception("Configuration") <<
                                  "PATElectronProducer: you can't specify both 'electronIDSource' and 'electronIDSources'\n";
      // read the different electron ID names
      edm::ParameterSet idps = iConfig.getParameter<edm::ParameterSet>("electronIDSources");
      std::vector<std::string> names = idps.getParameterNamesForType<edm::InputTag>();
      for (std::vector<std::string>::const_iterator it = names.begin(), ed = names.end(); it != ed; ++it) {
        elecIDSrcs_.push_back(NameTag(*it, idps.getParameter<edm::InputTag>(*it)));
      }
    }
    // but in any case at least once
    if (elecIDSrcs_.empty()) throw cms::Exception("Configuration") <<
                               "PATElectronProducer: id addElectronID is true, you must specify either:\n" <<
                               "\tInputTag electronIDSource = <someTag>\n" << "or\n" <<
                               "\tPSet electronIDSources = { \n" <<
                               "\t\tInputTag <someName> = <someTag>   // as many as you want \n " <<
                               "\t}\n";
  }

  // construct resolution calculator

  //   // IsoDeposit configurables
  //   if (iConfig.exists("isoDeposits")) {
  //      edm::ParameterSet depconf = iConfig.getParameter<edm::ParameterSet>("isoDeposits");
  //      if (depconf.exists("tracker")) isoDepositLabels_.push_back(std::make_pair(TrackerIso, depconf.getParameter<edm::InputTag>("tracker")));
  //      if (depconf.exists("ecal"))    isoDepositLabels_.push_back(std::make_pair(ECalIso, depconf.getParameter<edm::InputTag>("ecal")));
  //      if (depconf.exists("hcal"))    isoDepositLabels_.push_back(std::make_pair(HCalIso, depconf.getParameter<edm::InputTag>("hcal")));


  //      if (depconf.exists("user")) {
  //         std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag> >("user");
  //         std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
  //         int key = UserBaseIso;
  //         for ( ; it != ed; ++it, ++key) {
  //             isoDepositLabels_.push_back(std::make_pair(IsolationKeys(key), *it));
  //         }
  //      }
  //   }

  // read isoDeposit labels, for direct embedding
  readIsolationLabels(iConfig, "isoDeposits", isoDepositLabels_);

  // read isolation value labels, for direct embedding
  readIsolationLabels(iConfig, "isolationValues", isolationValueLabels_);

  // read isolation value labels for non PF identified electron, for direct embedding
  readIsolationLabels(iConfig, "isolationValuesNoPFId", isolationValueLabelsNoPFId_);

  // Efficiency configurables
  addEfficiencies_ = iConfig.getParameter<bool>("addEfficiencies");
  if (addEfficiencies_) {
    efficiencyLoader_ = pat::helper::EfficiencyLoader(iConfig.getParameter<edm::ParameterSet>("efficiencies"));
  }

  // Check to see if the user wants to add user data
  if ( useUserData_ ) {
    userDataHelper_ = PATUserDataHelper<Electron>(iConfig.getParameter<edm::ParameterSet>("userData"));
  }

  // embed high level selection variables?
  embedHighLevelSelection_ = iConfig.getParameter<bool>("embedHighLevelSelection");
  if ( embedHighLevelSelection_ ) {
    beamLineSrc_ = iConfig.getParameter<edm::InputTag>("beamLineSrc");
    usePV_ = iConfig.getParameter<bool>("usePV");
    pvSrc_ = iConfig.getParameter<edm::InputTag>("pvSrc");
  }


  // produces vector of muons
  produces<std::vector<Electron> >();

}
PATElectronProducer::~PATElectronProducer ( )

Definition at line 165 of file PATElectronProducer.cc.

                                          {
}

Member Function Documentation

void PATElectronProducer::embedHighLevel ( pat::Electron anElectron,
reco::GsfTrackRef  track,
reco::TransientTrack tt,
reco::Vertex primaryVertex,
bool  primaryVertexIsValid,
reco::BeamSpot beamspot,
bool  beamspotIsValid 
) [private]

Definition at line 901 of file PATElectronProducer.cc.

References pat::Electron::BS2D, pat::Electron::BS3D, reco::BeamSpot::covariance3D(), reco::BeamSpot::position(), pat::Electron::PV2D, pat::Electron::PV3D, query::result, pat::Electron::setDB(), IPTools::signedImpactParameter3D(), and IPTools::signedTransverseImpactParameter().

Referenced by produce().

{
  // Correct to PV

  // PV2D
  std::pair<bool,Measurement1D> result =
    IPTools::signedTransverseImpactParameter(tt,
                                             GlobalVector(track->px(),
                                                          track->py(),
                                                          track->pz()),
                                             primaryVertex);
  double d0_corr = result.second.value();
  double d0_err = primaryVertexIsValid ? result.second.error() : -1.0;
  anElectron.setDB( d0_corr, d0_err, pat::Electron::PV2D);


  // PV3D
  result =
    IPTools::signedImpactParameter3D(tt,
                                     GlobalVector(track->px(),
                                                  track->py(),
                                                  track->pz()),
                                     primaryVertex);
  d0_corr = result.second.value();
  d0_err = primaryVertexIsValid ? result.second.error() : -1.0;
  anElectron.setDB( d0_corr, d0_err, pat::Electron::PV3D);


  // Correct to beam spot
  // make a fake vertex out of beam spot
  reco::Vertex vBeamspot(beamspot.position(), beamspot.covariance3D());

  // BS2D
  result =
    IPTools::signedTransverseImpactParameter(tt,
                                             GlobalVector(track->px(),
                                                          track->py(),
                                                          track->pz()),
                                             vBeamspot);
  d0_corr = result.second.value();
  d0_err = beamspotIsValid ? result.second.error() : -1.0;
  anElectron.setDB( d0_corr, d0_err, pat::Electron::BS2D);

  // BS3D
  result =
    IPTools::signedImpactParameter3D(tt,
                                     GlobalVector(track->px(),
                                                  track->py(),
                                                  track->pz()),
                                     vBeamspot);
  d0_corr = result.second.value();
  d0_err = beamspotIsValid ? result.second.error() : -1.0;
  anElectron.setDB( d0_corr, d0_err, pat::Electron::BS3D);
}
void PATElectronProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions) [static]

Reimplemented from edm::EDProducer.

Definition at line 736 of file PATElectronProducer.cc.

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addNode(), edm::ParameterSetDescription::addOptional(), pat::helper::KinResolutionsLoader::fillDescription(), edm::ParameterSetDescription::setAllowAnything(), and edm::ParameterSetDescription::setComment().

{
  edm::ParameterSetDescription iDesc;
  iDesc.setComment("PAT electron producer module");

  // input source
  iDesc.add<edm::InputTag>("pfCandidateMap", edm::InputTag("no default"))->setComment("input collection");
  iDesc.add<edm::InputTag>("electronSource", edm::InputTag("no default"))->setComment("input collection");

  // embedding
  iDesc.add<bool>("embedGsfElectronCore", true)->setComment("embed external gsf electron core");
  iDesc.add<bool>("embedGsfTrack", true)->setComment("embed external gsf track");
  iDesc.add<bool>("embedSuperCluster", true)->setComment("embed external super cluster");
  iDesc.add<bool>("embedTrack", false)->setComment("embed external track");

  // pf specific parameters
  iDesc.add<edm::InputTag>("pfElectronSource", edm::InputTag("pfElectrons"))->setComment("particle flow input collection");
  iDesc.add<bool>("useParticleFlow", false)->setComment("whether to use particle flow or not");
  iDesc.add<bool>("embedPFCandidate", false)->setComment("embed external particle flow object");

  // MC matching configurables
  iDesc.add<bool>("addGenMatch", true)->setComment("add MC matching");
  iDesc.add<bool>("embedGenMatch", false)->setComment("embed MC matched MC information");
  std::vector<edm::InputTag> emptySourceVector;
  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("genParticleMatch", edm::InputTag(), true) xor
                 edm::ParameterDescription<std::vector<edm::InputTag> >("genParticleMatch", emptySourceVector, true)
                 )->setComment("input with MC match information");

  // electron ID configurables
  iDesc.add<bool>("addElectronID",true)->setComment("add electron ID variables");
  edm::ParameterSetDescription electronIDSourcesPSet;
  electronIDSourcesPSet.setAllowAnything();
  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("electronIDSource", edm::InputTag(), true) xor
                 edm::ParameterDescription<edm::ParameterSetDescription>("electronIDSources", electronIDSourcesPSet, true)
                 )->setComment("input with electron ID variables");


  // IsoDeposit configurables
  edm::ParameterSetDescription isoDepositsPSet;
  isoDepositsPSet.addOptional<edm::InputTag>("tracker");
  isoDepositsPSet.addOptional<edm::InputTag>("ecal");
  isoDepositsPSet.addOptional<edm::InputTag>("hcal");
  isoDepositsPSet.addOptional<edm::InputTag>("pfAllParticles");
  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedHadrons");
  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedAll");
  isoDepositsPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
  isoDepositsPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
  isoDepositsPSet.addOptional<edm::InputTag>("pfPhotons");
  isoDepositsPSet.addOptional<std::vector<edm::InputTag> >("user");
  iDesc.addOptional("isoDeposits", isoDepositsPSet);

  // isolation values configurables
  edm::ParameterSetDescription isolationValuesPSet;
  isolationValuesPSet.addOptional<edm::InputTag>("tracker");
  isolationValuesPSet.addOptional<edm::InputTag>("ecal");
  isolationValuesPSet.addOptional<edm::InputTag>("hcal");
  isolationValuesPSet.addOptional<edm::InputTag>("pfAllParticles");
  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedHadrons");
  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedAll");
  isolationValuesPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
  isolationValuesPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
  isolationValuesPSet.addOptional<edm::InputTag>("pfPhotons");
  isolationValuesPSet.addOptional<std::vector<edm::InputTag> >("user");
  iDesc.addOptional("isolationValues", isolationValuesPSet);

  // isolation values configurables
  edm::ParameterSetDescription isolationValuesNoPFIdPSet;
  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("tracker");
  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("ecal");
  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("hcal");
  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfAllParticles");
  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfChargedHadrons");
  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfChargedAll");
  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfPhotons");
  isolationValuesNoPFIdPSet.addOptional<std::vector<edm::InputTag> >("user");
  iDesc.addOptional("isolationValuesNoPFId", isolationValuesNoPFIdPSet);

  // Efficiency configurables
  edm::ParameterSetDescription efficienciesPSet;
  efficienciesPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
  iDesc.add("efficiencies", efficienciesPSet);
  iDesc.add<bool>("addEfficiencies", false);

  // Check to see if the user wants to add user data
  edm::ParameterSetDescription userDataPSet;
  PATUserDataHelper<Electron>::fillDescription(userDataPSet);
  iDesc.addOptional("userData", userDataPSet);

  // electron shapes
  iDesc.add<bool>("addElectronShapes", true);
  iDesc.add<edm::InputTag>("reducedBarrelRecHitCollection", edm::InputTag("reducedEcalRecHitsEB"));
  iDesc.add<edm::InputTag>("reducedEndcapRecHitCollection", edm::InputTag("reducedEcalRecHitsEE"));

  edm::ParameterSetDescription isolationPSet;
  isolationPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
  iDesc.add("userIsolation", isolationPSet);

  // Resolution configurables
  pat::helper::KinResolutionsLoader::fillDescription(iDesc);

  iDesc.add<bool>("embedHighLevelSelection", true)->setComment("embed high level selection");
  edm::ParameterSetDescription highLevelPSet;
  highLevelPSet.setAllowAnything();
  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("beamLineSrc", edm::InputTag(), true)
                 )->setComment("input with high level selection");
  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("pvSrc", edm::InputTag(), true)
                 )->setComment("input with high level selection");
  iDesc.addNode( edm::ParameterDescription<bool>("usePV", bool(), true)
                 )->setComment("input with high level selection, use primary vertex (true) or beam line (false)");

  descriptions.add("PATElectronProducer", iDesc);

}
void PATElectronProducer::fillElectron ( Electron aElectron,
const ElectronBaseRef electronRef,
const reco::CandidateBaseRef baseRef,
const GenAssociations genMatches,
const IsoDepositMaps deposits,
const bool  pfId,
const IsolationValueMaps isolationValues,
const IsolationValueMaps isolationValuesNoPFId 
) const [private]

common electron filling, for both the standard and PF2PAT case

Definition at line 572 of file PATElectronProducer.cc.

References addGenMatch_, pat::PATObject< ObjectType >::addGenParticleRef(), efficiencyLoader_, embedGenMatch_, pat::PATObject< ObjectType >::embedGenParticle(), pat::Electron::embedGsfElectronCore(), embedGsfElectronCore_, pat::Electron::embedGsfTrack(), embedGsfTrack_, pat::Electron::embedSuperCluster(), embedSuperCluster_, pat::Electron::embedTrack(), embedTrack_, pat::helper::KinResolutionsLoader::enabled(), pat::helper::EfficiencyLoader::enabled(), first, i, edm::Ref< C, T, F >::isNull(), isoDepositLabels_, isolationValueLabels_, isolationValueLabelsNoPFId_, j, n, pat::Electron::pfCandidateRef(), resolutionLoader_, pat::helper::EfficiencyLoader::setEfficiencies(), pat::Lepton< LeptonType >::setIsoDeposit(), pat::Lepton< LeptonType >::setIsolation(), pat::helper::KinResolutionsLoader::setResolutions(), LaserTracksInput_cfi::source, and useParticleFlow_.

Referenced by produce().

                                               {

  //COLIN: might want to use the PFCandidate 4-mom. Which one is in use now?
  //   if (useParticleFlow_)
  //     aMuon.setP4( aMuon.pfCandidateRef()->p4() );

  //COLIN:
  //In the embedding case, the reference cannot be used to look into a value map.
  //therefore, one has to had the PFCandidateRef to this function, which becomes a bit
  //too much specific.

  // in fact, this function needs a baseref or ptr for genmatch
  // and a baseref or ptr for isodeposits and isolationvalues.
  // baseref is not needed
  // the ptrForIsolation and ptrForMatching should be defined upstream.

  // is the concrete elecRef needed for the efficiency loader? what is this loader?
  // how can we make it compatible with the particle flow electrons?

  if (embedGsfElectronCore_) anElectron.embedGsfElectronCore();
  if (embedGsfTrack_) anElectron.embedGsfTrack();
  if (embedSuperCluster_) anElectron.embedSuperCluster();
  if (embedTrack_) anElectron.embedTrack();

  // store the match to the generated final state muons
  if (addGenMatch_) {
    for(size_t i = 0, n = genMatches.size(); i < n; ++i) {
      if(useParticleFlow_) {
        reco::GenParticleRef genElectron = (*genMatches[i])[anElectron.pfCandidateRef()];
        anElectron.addGenParticleRef(genElectron);
      }
      else {
        reco::GenParticleRef genElectron = (*genMatches[i])[elecRef];
        anElectron.addGenParticleRef(genElectron);
      }
    }
    if (embedGenMatch_) anElectron.embedGenParticle();
  }

  if (efficiencyLoader_.enabled()) {
    efficiencyLoader_.setEfficiencies( anElectron, elecRef );
  }

  if (resolutionLoader_.enabled()) {
    resolutionLoader_.setResolutions(anElectron);
  }

  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
    if(useParticleFlow_) {

      reco::PFCandidateRef pfcandref =  anElectron.pfCandidateRef();
      assert(!pfcandref.isNull());
      reco::CandidatePtr source = pfcandref->sourceCandidatePtr(0);
      anElectron.setIsoDeposit(isoDepositLabels_[j].first,
                          (*deposits[j])[source]);
    }
    else
      anElectron.setIsoDeposit(isoDepositLabels_[j].first,
                          (*deposits[j])[elecRef]);
  }

  for (size_t j = 0; j<isolationValues.size(); ++j) {
    if(useParticleFlow_) {
      reco::CandidatePtr source = anElectron.pfCandidateRef()->sourceCandidatePtr(0);
      anElectron.setIsolation(isolationValueLabels_[j].first,
                         (*isolationValues[j])[source]);
    }
    else
      if(pfId){
        anElectron.setIsolation(isolationValueLabels_[j].first,(*isolationValues[j])[elecRef]);
      }else{
        anElectron.setIsolation(isolationValueLabelsNoPFId_[j].first,(*isolationValuesNoPFId[j])[elecRef]);
      }
  }

}
void PATElectronProducer::fillElectron2 ( Electron anElectron,
const reco::CandidatePtr candPtrForIsolation,
const reco::CandidatePtr candPtrForGenMatch,
const reco::CandidatePtr candPtrForLoader,
const GenAssociations genMatches,
const IsoDepositMaps deposits,
const IsolationValueMaps isolationValues 
) const [private]

Definition at line 657 of file PATElectronProducer.cc.

References addGenMatch_, pat::PATObject< ObjectType >::addGenParticleRef(), edm::contains(), pat::EcalIso, efficiencyLoader_, embedGenMatch_, pat::PATObject< ObjectType >::embedGenParticle(), pat::Electron::embedGsfElectronCore(), embedGsfElectronCore_, pat::Electron::embedGsfTrack(), embedGsfTrack_, pat::Electron::embedSuperCluster(), embedSuperCluster_, pat::Electron::embedTrack(), embedTrack_, pat::helper::KinResolutionsLoader::enabled(), pat::helper::EfficiencyLoader::enabled(), first, pat::HcalIso, i, edm::Ptr< T >::id(), isoDepositLabels_, isolationValueLabels_, j, n, reco::GsfElectron::p4(), pat::Electron::pfCandidateRef(), resolutionLoader_, pat::Electron::setEcalDrivenMomentum(), pat::helper::EfficiencyLoader::setEfficiencies(), pat::Lepton< LeptonType >::setIsoDeposit(), pat::Lepton< LeptonType >::setIsolation(), reco::GsfElectron::setP4(), pat::helper::KinResolutionsLoader::setResolutions(), and pat::TrackIso.

Referenced by produce().

                                                                                          {

  //COLIN/Florian: use the PFCandidate 4-mom.
  anElectron.setEcalDrivenMomentum(anElectron.p4()) ;
  anElectron.setP4( anElectron.pfCandidateRef()->p4() );


  // is the concrete elecRef needed for the efficiency loader? what is this loader?
  // how can we make it compatible with the particle flow electrons?

  if (embedGsfElectronCore_) anElectron.embedGsfElectronCore();
  if (embedGsfTrack_) anElectron.embedGsfTrack();
  if (embedSuperCluster_) anElectron.embedSuperCluster();
  if (embedTrack_) anElectron.embedTrack();

  // store the match to the generated final state muons

  if (addGenMatch_) {
    for(size_t i = 0, n = genMatches.size(); i < n; ++i) {
      reco::GenParticleRef genElectron = (*genMatches[i])[candPtrForGenMatch];
      anElectron.addGenParticleRef(genElectron);
    }
    if (embedGenMatch_) anElectron.embedGenParticle();
  }

  //COLIN what's this? does it have to be GsfElectron specific?
  if (efficiencyLoader_.enabled()) {
    efficiencyLoader_.setEfficiencies( anElectron, candPtrForLoader );
  }

  if (resolutionLoader_.enabled()) {
    resolutionLoader_.setResolutions(anElectron);
  }

  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
    if( isoDepositLabels_[j].first==pat::TrackIso ||
        isoDepositLabels_[j].first==pat::EcalIso ||
        isoDepositLabels_[j].first==pat::HcalIso ||
        deposits[j]->contains(candPtrForGenMatch.id())) {
      anElectron.setIsoDeposit(isoDepositLabels_[j].first,
                               (*deposits[j])[candPtrForGenMatch]);
    }
    else if (deposits[j]->contains(candPtrForIsolation.id())) {
      anElectron.setIsoDeposit(isoDepositLabels_[j].first,
                               (*deposits[j])[candPtrForIsolation]);
    }
    else {
      anElectron.setIsoDeposit(isoDepositLabels_[j].first,
                               (*deposits[j])[candPtrForIsolation->sourceCandidatePtr(0)]);
    }
  }

  for (size_t j = 0; j<isolationValues.size(); ++j) {
    if( isolationValueLabels_[j].first==pat::TrackIso ||
        isolationValueLabels_[j].first==pat::EcalIso ||
        isolationValueLabels_[j].first==pat::HcalIso ||
        isolationValues[j]->contains(candPtrForGenMatch.id())) {
      anElectron.setIsolation(isolationValueLabels_[j].first,
                              (*isolationValues[j])[candPtrForGenMatch]);
    }
    else if (isolationValues[j]->contains(candPtrForIsolation.id())) {
      anElectron.setIsolation(isolationValueLabels_[j].first,
                              (*isolationValues[j])[candPtrForIsolation]);
    }
    else {
      anElectron.setIsolation(isolationValueLabels_[j].first,
                              (*isolationValues[j])[candPtrForIsolation->sourceCandidatePtr(0)]);
    }
  }
}
void PATElectronProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 169 of file PATElectronProducer.cc.

References IPTools::absoluteImpactParameter3D(), IPTools::absoluteTransverseImpactParameter(), pat::PATUserDataHelper< ObjectType >::add(), addElecID_, addGenMatch_, beamLineSrc_, SiPixelRawToDigiRegional_cfi::beamSpot, pat::helper::MultiIsolator::beginEvent(), alignCSCRings::e, EcalClusterLazyTools::e3x3(), efficiencyLoader_, elecIDSrcs_, HI_PhotonSkim_cff::electrons, electronSrc_, embedGenMatch_, embedHighLevel(), embedHighLevelSelection_, pat::Electron::embedPFCandidate(), embedPFCandidate_, pat::helper::KinResolutionsLoader::enabled(), pat::helper::MultiIsolator::enabled(), pat::helper::EfficiencyLoader::enabled(), pat::helper::MultiIsolator::endEvent(), pat::helper::MultiIsolator::fill(), fillElectron(), fillElectron2(), first, genMatchSrc_, edm::EventSetup::get(), edm::Event::getByLabel(), ConversionTools::hasMatchedConversion(), i, UserOptions_cff::idx, getHLTprescales::index, edm::Ref< C, T, F >::isAvailable(), edm::detail::isnan(), edm::Ptr< T >::isNonnull(), edm::Ref< C, T, F >::isNonnull(), isoDepositLabels_, isolationValueLabels_, isolationValueLabelsNoPFId_, isolator_, isolatorTmpStorage_, edm::EventBase::isRealData(), edm::HandleBase::isValid(), j, EcalClusterLazyTools::localCovariances(), reco::Matched, pat::helper::EfficiencyLoader::newEvent(), pat::helper::KinResolutionsLoader::newEvent(), electronProducer_cfi::patElectrons, pfCandidateMap_, pfElecSrc_, pfElectrons_cff::pfElectrons, pTComparator_, edm::Event::put(), pvSrc_, resolutionLoader_, query::result, edm::second(), pat::Electron::setDB(), pat::Electron::setElectronIDs(), pat::Lepton< LeptonType >::setIsoDeposit(), pat::Lepton< LeptonType >::setIsolation(), pat::Electron::setMvaVariables(), pat::Electron::setPassConversionVeto(), pat::Electron::setPFCandidateRef(), python::multivaluedict::sort(), mathSSE::sqrt(), groupFilesInBlocks::tt, useParticleFlow_, usePV_, userDataHelper_, useUserData_, reco::BeamSpot::x0(), reco::BeamSpot::y0(), and reco::BeamSpot::z0().

                                                                                 {

  // Get the collection of electrons from the event
  edm::Handle<edm::View<reco::GsfElectron> > electrons;
  iEvent.getByLabel(electronSrc_, electrons);

  if (iEvent.isRealData()){
       addGenMatch_ = false;
       embedGenMatch_ = false;
   }

  // for additional mva variables
  edm::InputTag  reducedEBRecHitCollection(string("reducedEcalRecHitsEB"));
  edm::InputTag  reducedEERecHitCollection(string("reducedEcalRecHitsEE"));
  EcalClusterLazyTools lazyTools(iEvent, iSetup, reducedEBRecHitCollection, reducedEERecHitCollection);

  // for conversion veto selection
  edm::Handle<reco::ConversionCollection> hConversions;
  iEvent.getByLabel("allConversions", hConversions);

  // Get the ESHandle for the transient track builder, if needed for
  // high level selection embedding
  edm::ESHandle<TransientTrackBuilder> trackBuilder;

  if (isolator_.enabled()) isolator_.beginEvent(iEvent,iSetup);

  if (efficiencyLoader_.enabled()) efficiencyLoader_.newEvent(iEvent);
  if (resolutionLoader_.enabled()) resolutionLoader_.newEvent(iEvent, iSetup);

  IsoDepositMaps deposits(isoDepositLabels_.size());
  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
    iEvent.getByLabel(isoDepositLabels_[j].second, deposits[j]);
  }

  IsolationValueMaps isolationValues(isolationValueLabels_.size());
  for (size_t j = 0; j<isolationValueLabels_.size(); ++j) {
    iEvent.getByLabel(isolationValueLabels_[j].second, isolationValues[j]);
  }

  IsolationValueMaps isolationValuesNoPFId(isolationValueLabelsNoPFId_.size());
  for (size_t j = 0; j<isolationValueLabelsNoPFId_.size(); ++j) {
    iEvent.getByLabel(isolationValueLabelsNoPFId_[j].second, isolationValuesNoPFId[j]);
  }

  // prepare the MC matching
  GenAssociations  genMatches(genMatchSrc_.size());
  if (addGenMatch_) {
    for (size_t j = 0, nd = genMatchSrc_.size(); j < nd; ++j) {
      iEvent.getByLabel(genMatchSrc_[j], genMatches[j]);
    }
  }

  // prepare ID extraction
  std::vector<edm::Handle<edm::ValueMap<float> > > idhandles;
  std::vector<pat::Electron::IdPair>               ids;
  if (addElecID_) {
    idhandles.resize(elecIDSrcs_.size());
    ids.resize(elecIDSrcs_.size());
    for (size_t i = 0; i < elecIDSrcs_.size(); ++i) {
      iEvent.getByLabel(elecIDSrcs_[i].second, idhandles[i]);
      ids[i].first = elecIDSrcs_[i].first;
    }
  }


  // prepare the high level selection:
  // needs beamline
  reco::TrackBase::Point beamPoint(0,0,0);
  reco::Vertex primaryVertex;
  reco::BeamSpot beamSpot;
  bool beamSpotIsValid = false;
  bool primaryVertexIsValid = false;

  // Get the beamspot
  edm::Handle<reco::BeamSpot> beamSpotHandle;
  iEvent.getByLabel(beamLineSrc_, beamSpotHandle);

  // Get the primary vertex
  edm::Handle< std::vector<reco::Vertex> > pvHandle;
  iEvent.getByLabel( pvSrc_, pvHandle );


  if ( embedHighLevelSelection_ ) {

    // This is needed by the IPTools methods from the tracking group
    iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", trackBuilder);

    if ( ! usePV_ ) {

      if ( beamSpotHandle.isValid() ){
        beamSpot = *beamSpotHandle;
        beamSpotIsValid = true;
      } else{
        edm::LogError("DataNotAvailable")
          << "No beam spot available from EventSetup, not adding high level selection \n";
      }

      double x0 = beamSpot.x0();
      double y0 = beamSpot.y0();
      double z0 = beamSpot.z0();

      beamPoint = reco::TrackBase::Point ( x0, y0, z0 );
    } else {
      if ( pvHandle.isValid() && !pvHandle->empty() ) {
        primaryVertex = pvHandle->at(0);
        primaryVertexIsValid = true;
      } else {
        edm::LogError("DataNotAvailable")
          << "No primary vertex available from EventSetup, not adding high level selection \n";
      }
    }
  }

  std::vector<Electron> * patElectrons = new std::vector<Electron>();

  if( useParticleFlow_ ) {
    edm::Handle< reco::PFCandidateCollection >  pfElectrons;
    iEvent.getByLabel(pfElecSrc_, pfElectrons);
    unsigned index=0;

    for( reco::PFCandidateConstIterator i = pfElectrons->begin();
         i != pfElectrons->end(); ++i, ++index) {

      reco::PFCandidateRef pfRef(pfElectrons, index);
      reco::PFCandidatePtr ptrToPFElectron(pfElectrons,index);
//       reco::CandidateBaseRef pfBaseRef( pfRef );

      reco::GsfTrackRef PfTk= i->gsfTrackRef();

      bool Matched=false;
      bool MatchedToAmbiguousGsfTrack=false;
      for (edm::View<reco::GsfElectron>::const_iterator itElectron = electrons->begin(); itElectron != electrons->end(); ++itElectron) {
        unsigned int idx = itElectron - electrons->begin();
        if (Matched || MatchedToAmbiguousGsfTrack) continue;

        reco::GsfTrackRef EgTk= itElectron->gsfTrack();

        if (itElectron->gsfTrack()==i->gsfTrackRef()){
          Matched=true;
        }
        else {
          for( reco::GsfTrackRefVector::const_iterator it = itElectron->ambiguousGsfTracksBegin() ;
               it!=itElectron->ambiguousGsfTracksEnd(); it++ ){
            MatchedToAmbiguousGsfTrack |= (bool)(i->gsfTrackRef()==(*it));
          }
        }

        if (Matched || MatchedToAmbiguousGsfTrack){

          // ptr needed for finding the matched gen particle
          reco::CandidatePtr ptrToGsfElectron(electrons,idx);

          // ref to base needed for the construction of the pat object
          const edm::RefToBase<reco::GsfElectron>& elecsRef = electrons->refAt(idx);
          Electron anElectron(elecsRef);
          anElectron.setPFCandidateRef( pfRef  );

          if( embedPFCandidate_ ) anElectron.embedPFCandidate();

          if ( useUserData_ ) {
            userDataHelper_.add( anElectron, iEvent, iSetup );
          }

          double ip3d = -999; // for mva variable

          // embed high level selection
          if ( embedHighLevelSelection_ ) {
            // get the global track
            reco::GsfTrackRef track = PfTk;

            // Make sure the collection it points to is there
            if ( track.isNonnull() && track.isAvailable() ) {

              reco::TransientTrack tt = trackBuilder->build(track);
              embedHighLevel( anElectron,
                              track,
                              tt,
                              primaryVertex,
                              primaryVertexIsValid,
                              beamSpot,
                              beamSpotIsValid );

              std::pair<bool,Measurement1D> ip3dpv = IPTools::absoluteImpactParameter3D(tt, primaryVertex);
              ip3d = ip3dpv.second.value(); // for mva variable

              if ( !usePV_ ) {
                double corr_d0 = track->dxy( beamPoint );
                anElectron.setDB( corr_d0, -1.0 );
              } else {
                 std::pair<bool,Measurement1D> result = IPTools::absoluteTransverseImpactParameter(tt, primaryVertex);
                double d0_corr = result.second.value();
                double d0_err = result.second.error();
                anElectron.setDB( d0_corr, d0_err );
              }
            }
          }

          //Electron Id

          if (addElecID_) {
            //STANDARD EL ID
            for (size_t i = 0; i < elecIDSrcs_.size(); ++i) {
              ids[i].second = (*idhandles[i])[elecsRef];
            }
            //SPECIFIC PF ID
            ids.push_back(std::make_pair("pf_evspi",pfRef->mva_e_pi()));
            ids.push_back(std::make_pair("pf_evsmu",pfRef->mva_e_mu()));
            anElectron.setElectronIDs(ids);
          }

          // add missing mva variables
          double r9 = lazyTools.e3x3( *( itElectron->superCluster()->seed())) / itElectron->superCluster()->rawEnergy() ;
          double sigmaIphiIphi;
          double sigmaIetaIphi;
          std::vector<float> vCov = lazyTools.localCovariances(*( itElectron->superCluster()->seed()));
          if( !isnan(vCov[2])) sigmaIphiIphi = sqrt(vCov[2]);
          else sigmaIphiIphi = 0;
          sigmaIetaIphi = vCov[1];
          anElectron.setMvaVariables( r9, sigmaIphiIphi, sigmaIetaIphi, ip3d);

          // set conversion veto selection
          bool passconversionveto = false;
          if( hConversions.isValid()){
            // this is recommended method
            passconversionveto = !ConversionTools::hasMatchedConversion( *itElectron, hConversions, beamSpotHandle->position());
          }else{
            // use missing hits without vertex fit method
            passconversionveto = itElectron->gsfTrack()->trackerExpectedHitsInner().numberOfLostHits() < 1;
          }

          anElectron.setPassConversionVeto( passconversionveto );


//        fillElectron(anElectron,elecsRef,pfBaseRef,
//                     genMatches, deposits, isolationValues);

          //COLIN small warning !
          // we are currently choosing to take the 4-momentum of the PFCandidate;
          // the momentum of the GsfElectron is saved though
          // we must therefore match the GsfElectron.
          // because of this, we should not change the source of the electron matcher
          // to the collection of PFElectrons in the python configuration
          // I don't know what to do with the efficiencyLoader, since I don't know
          // what this class is for.
          fillElectron2( anElectron,
                         ptrToPFElectron,
                         ptrToGsfElectron,
                         ptrToGsfElectron,
                         genMatches, deposits, isolationValues );

          //COLIN need to use fillElectron2 in the non-pflow case as well, and to test it.

          patElectrons->push_back(anElectron);
        }
      }
      //if( !Matched && !MatchedToAmbiguousGsfTrack) std::cout << "!!!!A pf electron could not be matched to a gsf!!!!"  << std::endl;
    }
  }

  else{
    // Try to access PF electron collection
    edm::Handle<edm::ValueMap<reco::PFCandidatePtr> >ValMapH;
    bool valMapPresent = iEvent.getByLabel(pfCandidateMap_,ValMapH);
    // Try to access a PFCandidate collection, as supplied by the user
    edm::Handle< reco::PFCandidateCollection >  pfElectrons;
    bool pfCandsPresent = iEvent.getByLabel(pfElecSrc_, pfElectrons);

    for (edm::View<reco::GsfElectron>::const_iterator itElectron = electrons->begin(); itElectron != electrons->end(); ++itElectron) {
      // construct the Electron from the ref -> save ref to original object
      //FIXME: looks like a lot of instances could be turned into const refs
      unsigned int idx = itElectron - electrons->begin();
      edm::RefToBase<reco::GsfElectron> elecsRef = electrons->refAt(idx);
      reco::CandidateBaseRef elecBaseRef(elecsRef);
      Electron anElectron(elecsRef);

      // Is this GsfElectron also identified as an e- in the particle flow?
      bool pfId = false;

      if( valMapPresent ) {
        const edm::ValueMap<reco::PFCandidatePtr> & myValMap(*ValMapH);

        // Get the PFCandidate
        const reco::PFCandidatePtr& pfElePtr(myValMap[elecsRef]);
        pfId= pfElePtr.isNonnull();
      }
      else if ( pfCandsPresent ) {
        // PF electron collection not available.
        const reco::GsfTrackRef& trkRef = itElectron->gsfTrack();
        for( reco::PFCandidateConstIterator ie = pfElectrons->begin();
             ie != pfElectrons->end(); ++ie) {
          if(ie->particleId()!=reco::PFCandidate::e) continue;
          const reco::GsfTrackRef& pfTrkRef= ie->gsfTrackRef();
          if( trkRef == pfTrkRef ) {
            pfId = true;
            break;
          }
        }
      }

      // add resolution info

      // Isolation
      if (isolator_.enabled()) {
        isolator_.fill(*electrons, idx, isolatorTmpStorage_);
        typedef pat::helper::MultiIsolator::IsolationValuePairs IsolationValuePairs;
        // better to loop backwards, so the vector is resized less times
        for (IsolationValuePairs::const_reverse_iterator it = isolatorTmpStorage_.rbegin(), ed = isolatorTmpStorage_.rend(); it != ed; ++it) {
          anElectron.setIsolation(it->first, it->second);
        }
      }

      for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
        anElectron.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[elecsRef]);
      }

      // add electron ID info
      if (addElecID_) {
        for (size_t i = 0; i < elecIDSrcs_.size(); ++i) {
          ids[i].second = (*idhandles[i])[elecsRef];
        }
        anElectron.setElectronIDs(ids);
      }


      if ( useUserData_ ) {
        userDataHelper_.add( anElectron, iEvent, iSetup );
      }


      double ip3d = -999; //for mva variable

      // embed high level selection
      if ( embedHighLevelSelection_ ) {
        // get the global track
        reco::GsfTrackRef track = itElectron->gsfTrack();

        // Make sure the collection it points to is there
        if ( track.isNonnull() && track.isAvailable() ) {

          reco::TransientTrack tt = trackBuilder->build(track);
          embedHighLevel( anElectron,
                          track,
                          tt,
                          primaryVertex,
                          primaryVertexIsValid,
                          beamSpot,
                          beamSpotIsValid );

          std::pair<bool,Measurement1D> ip3dpv = IPTools::absoluteImpactParameter3D(tt, primaryVertex);
          ip3d = ip3dpv.second.value(); // for mva variable

          if ( !usePV_ ) {
            double corr_d0 = track->dxy( beamPoint );
            anElectron.setDB( corr_d0, -1.0 );
          } else {
            std::pair<bool,Measurement1D> result = IPTools::absoluteTransverseImpactParameter(tt, primaryVertex);
            double d0_corr = result.second.value();
            double d0_err = result.second.error();
            anElectron.setDB( d0_corr, d0_err );
          }
        }
      }

      // add mva variables
      double r9 = lazyTools.e3x3( *( itElectron->superCluster()->seed())) / itElectron->superCluster()->rawEnergy() ;
      double sigmaIphiIphi;
      double sigmaIetaIphi;
      std::vector<float> vCov = lazyTools.localCovariances(*( itElectron->superCluster()->seed()));
      if( !isnan(vCov[2])) sigmaIphiIphi = sqrt(vCov[2]);
      else sigmaIphiIphi = 0;
      sigmaIetaIphi = vCov[1];
      anElectron.setMvaVariables( r9, sigmaIphiIphi, sigmaIetaIphi, ip3d);

      // set conversion veto selection
      bool passconversionveto = false;
      if( hConversions.isValid()){
        // this is recommended method
        passconversionveto = !ConversionTools::hasMatchedConversion( *itElectron, hConversions, beamSpotHandle->position());
      }else{
        // use missing hits without vertex fit method
        passconversionveto = itElectron->gsfTrack()->trackerExpectedHitsInner().numberOfLostHits() < 1;
      }
      anElectron.setPassConversionVeto( passconversionveto );

      // add sel to selected
      fillElectron( anElectron, elecsRef,elecBaseRef,
                    genMatches, deposits, pfId, isolationValues, isolationValuesNoPFId);
      patElectrons->push_back(anElectron);
    }
  }

  // sort electrons in pt
  std::sort(patElectrons->begin(), patElectrons->end(), pTComparator_);

  // add the electrons to the event output
  std::auto_ptr<std::vector<Electron> > ptr(patElectrons);
  iEvent.put(ptr);

  // clean up
  if (isolator_.enabled()) isolator_.endEvent();

}
void PATElectronProducer::readIsolationLabels ( const edm::ParameterSet iConfig,
const char *  psetName,
IsolationLabels labels 
) [private]

fill the labels vector from the contents of the parameter set, for the isodeposit or isolation values embedding

Definition at line 854 of file PATElectronProducer.cc.

References pat::EcalIso, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), pat::HcalIso, combine::key, pat::PfAllParticleIso, pat::PfChargedAllIso, pat::PfChargedHadronIso, pat::PfGammaIso, pat::PfNeutralHadronIso, pat::PfPUChargedHadronIso, pat::TrackIso, and pat::UserBaseIso.

Referenced by PATElectronProducer().

                                                                        {

  labels.clear();

  if (iConfig.exists( psetName )) {
    edm::ParameterSet depconf
      = iConfig.getParameter<edm::ParameterSet>(psetName);

    if (depconf.exists("tracker")) labels.push_back(std::make_pair(pat::TrackIso, depconf.getParameter<edm::InputTag>("tracker")));
    if (depconf.exists("ecal"))    labels.push_back(std::make_pair(pat::EcalIso, depconf.getParameter<edm::InputTag>("ecal")));
    if (depconf.exists("hcal"))    labels.push_back(std::make_pair(pat::HcalIso, depconf.getParameter<edm::InputTag>("hcal")));
    if (depconf.exists("pfAllParticles"))  {
      labels.push_back(std::make_pair(pat::PfAllParticleIso, depconf.getParameter<edm::InputTag>("pfAllParticles")));
    }
    if (depconf.exists("pfChargedHadrons"))  {
      labels.push_back(std::make_pair(pat::PfChargedHadronIso, depconf.getParameter<edm::InputTag>("pfChargedHadrons")));
    }
    if (depconf.exists("pfChargedAll"))  {
      labels.push_back(std::make_pair(pat::PfChargedAllIso, depconf.getParameter<edm::InputTag>("pfChargedAll")));
    }
    if (depconf.exists("pfPUChargedHadrons"))  {
      labels.push_back(std::make_pair(pat::PfPUChargedHadronIso, depconf.getParameter<edm::InputTag>("pfPUChargedHadrons")));
    }
    if (depconf.exists("pfNeutralHadrons"))  {
      labels.push_back(std::make_pair(pat::PfNeutralHadronIso, depconf.getParameter<edm::InputTag>("pfNeutralHadrons")));
    }
    if (depconf.exists("pfPhotons")) {
      labels.push_back(std::make_pair(pat::PfGammaIso, depconf.getParameter<edm::InputTag>("pfPhotons")));
    }
    if (depconf.exists("user")) {
      std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag> >("user");
      std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
      int key = UserBaseIso;
      for ( ; it != ed; ++it, ++key) {
        labels.push_back(std::make_pair(IsolationKeys(key), *it));
      }
    }
  }


}

Member Data Documentation

Definition at line 146 of file PATElectronProducer.h.

Referenced by PATElectronProducer().

Definition at line 133 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

Definition at line 74 of file PATElectronProducer.h.

Referenced by fillElectron(), fillElectron2(), PATElectronProducer(), and produce().

Definition at line 149 of file PATElectronProducer.h.

Referenced by PATElectronProducer().

Definition at line 86 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

Definition at line 147 of file PATElectronProducer.h.

Referenced by fillElectron(), fillElectron2(), PATElectronProducer(), and produce().

Definition at line 135 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

Definition at line 69 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

Definition at line 75 of file PATElectronProducer.h.

Referenced by fillElectron(), fillElectron2(), PATElectronProducer(), and produce().

Definition at line 70 of file PATElectronProducer.h.

Referenced by fillElectron(), fillElectron2(), and PATElectronProducer().

Definition at line 71 of file PATElectronProducer.h.

Referenced by fillElectron(), fillElectron2(), and PATElectronProducer().

embed high level selection variables?

Definition at line 85 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

Definition at line 82 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

Definition at line 72 of file PATElectronProducer.h.

Referenced by fillElectron(), fillElectron2(), and PATElectronProducer().

Definition at line 73 of file PATElectronProducer.h.

Referenced by fillElectron(), fillElectron2(), and PATElectronProducer().

Definition at line 76 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

Definition at line 142 of file PATElectronProducer.h.

Referenced by fillElectron(), fillElectron2(), PATElectronProducer(), and produce().

Definition at line 143 of file PATElectronProducer.h.

Referenced by fillElectron(), fillElectron2(), PATElectronProducer(), and produce().

Definition at line 144 of file PATElectronProducer.h.

Referenced by fillElectron(), PATElectronProducer(), and produce().

Definition at line 140 of file PATElectronProducer.h.

Referenced by produce().

Definition at line 141 of file PATElectronProducer.h.

Referenced by produce().

Definition at line 81 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

Definition at line 80 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

Definition at line 138 of file PATElectronProducer.h.

Referenced by produce().

Definition at line 88 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

Definition at line 150 of file PATElectronProducer.h.

Referenced by fillElectron(), fillElectron2(), PATElectronProducer(), and produce().

pflow specific

Definition at line 79 of file PATElectronProducer.h.

Referenced by fillElectron(), PATElectronProducer(), and produce().

Definition at line 87 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

Definition at line 153 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().

Definition at line 152 of file PATElectronProducer.h.

Referenced by PATElectronProducer(), and produce().