CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/PhysicsTools/PatAlgos/plugins/PATJetProducer.cc

Go to the documentation of this file.
00001 //
00002 // $Id: PATJetProducer.cc,v 1.53 2010/12/01 18:36:57 rwolf Exp $
00003 
00004 
00005 #include "PhysicsTools/PatAlgos/plugins/PATJetProducer.h"
00006 
00007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00008 #include "FWCore/ParameterSet/interface/FileInPath.h"
00009 
00010 #include "DataFormats/Common/interface/ValueMap.h"
00011 #include "DataFormats/Common/interface/Association.h"
00012 #include "DataFormats/Candidate/interface/CandAssociation.h"
00013 
00014 #include "DataFormats/JetReco/interface/JetTracksAssociation.h"
00015 #include "DataFormats/BTauReco/interface/JetTag.h"
00016 #include "DataFormats/BTauReco/interface/TrackProbabilityTagInfo.h"
00017 #include "DataFormats/BTauReco/interface/TrackIPTagInfo.h"
00018 #include "DataFormats/BTauReco/interface/TrackCountingTagInfo.h"
00019 #include "DataFormats/BTauReco/interface/SecondaryVertexTagInfo.h"
00020 #include "DataFormats/BTauReco/interface/SoftLeptonTagInfo.h"
00021 
00022 #include "DataFormats/Candidate/interface/CandMatchMap.h"
00023 #include "SimDataFormats/JetMatching/interface/JetFlavourMatching.h"
00024 
00025 #include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h"
00026 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
00027 
00028 #include "DataFormats/Math/interface/deltaR.h"
00029 
00030 #include "DataFormats/PatCandidates/interface/JetCorrFactors.h"
00031 
00032 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
00033 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
00034 
00035 #include "FWCore/Framework/interface/Selector.h"
00036 
00037 #include <vector>
00038 #include <memory>
00039 #include <algorithm>
00040 
00041 
00042 using namespace pat;
00043 
00044 
00045 PATJetProducer::PATJetProducer(const edm::ParameterSet& iConfig)  :
00046   useUserData_(iConfig.exists("userData"))
00047 {
00048   // initialize the configurables
00049   jetsSrc_                 = iConfig.getParameter<edm::InputTag>              ( "jetSource" );
00050   embedCaloTowers_         = iConfig.getParameter<bool>                       ( "embedCaloTowers" );
00051   embedPFCandidates_       = iConfig.getParameter<bool>                       ( "embedPFCandidates" );
00052   getJetMCFlavour_         = iConfig.getParameter<bool>                       ( "getJetMCFlavour" );
00053   jetPartonMapSource_      = iConfig.getParameter<edm::InputTag>              ( "JetPartonMapSource" );
00054   addGenPartonMatch_       = iConfig.getParameter<bool>                       ( "addGenPartonMatch" );
00055   embedGenPartonMatch_     = iConfig.getParameter<bool>                       ( "embedGenPartonMatch" );
00056   genPartonSrc_            = iConfig.getParameter<edm::InputTag>              ( "genPartonMatch" );
00057   addGenJetMatch_          = iConfig.getParameter<bool>                       ( "addGenJetMatch" );
00058   embedGenJetMatch_        = iConfig.getParameter<bool>                       ( "embedGenJetMatch" );
00059   genJetSrc_               = iConfig.getParameter<edm::InputTag>              ( "genJetMatch" );
00060   addPartonJetMatch_       = iConfig.getParameter<bool>                       ( "addPartonJetMatch" );
00061   partonJetSrc_            = iConfig.getParameter<edm::InputTag>              ( "partonJetSource" );
00062   addJetCorrFactors_       = iConfig.getParameter<bool>                       ( "addJetCorrFactors" );
00063   jetCorrFactorsSrc_       = iConfig.getParameter<std::vector<edm::InputTag> >( "jetCorrFactorsSource" );
00064   addBTagInfo_             = iConfig.getParameter<bool>                       ( "addBTagInfo" );
00065   addDiscriminators_       = iConfig.getParameter<bool>                       ( "addDiscriminators" );
00066   discriminatorTags_       = iConfig.getParameter<std::vector<edm::InputTag> >( "discriminatorSources" );
00067   addTagInfos_             = iConfig.getParameter<bool>                       ( "addTagInfos" );
00068   tagInfoTags_             = iConfig.getParameter<std::vector<edm::InputTag> >( "tagInfoSources" );
00069   addAssociatedTracks_     = iConfig.getParameter<bool>                       ( "addAssociatedTracks" ); 
00070   trackAssociation_        = iConfig.getParameter<edm::InputTag>              ( "trackAssociationSource" );
00071   addJetCharge_            = iConfig.getParameter<bool>                       ( "addJetCharge" ); 
00072   jetCharge_               = iConfig.getParameter<edm::InputTag>              ( "jetChargeSource" );
00073   addJetID_                = iConfig.getParameter<bool>                       ( "addJetID");
00074   jetIDMapLabel_           = iConfig.getParameter<edm::InputTag>              ( "jetIDMap");
00075 
00076   // Efficiency configurables
00077   addEfficiencies_ = iConfig.getParameter<bool>("addEfficiencies");
00078   if (addEfficiencies_) {
00079      efficiencyLoader_ = pat::helper::EfficiencyLoader(iConfig.getParameter<edm::ParameterSet>("efficiencies"));
00080   }
00081 
00082   // Resolution configurables
00083   addResolutions_ = iConfig.getParameter<bool>("addResolutions");
00084   if (addResolutions_) {
00085      resolutionLoader_ = pat::helper::KinResolutionsLoader(iConfig.getParameter<edm::ParameterSet>("resolutions"));
00086   }
00087 
00088 
00089   if (discriminatorTags_.empty()) { 
00090     addDiscriminators_ = false; 
00091   } else {
00092     for (std::vector<edm::InputTag>::const_iterator it = discriminatorTags_.begin(), ed = discriminatorTags_.end(); it != ed; ++it) {
00093         std::string label = it->label();
00094         std::string::size_type pos = label.find("JetTags");
00095         if ((pos !=  std::string::npos) && (pos != label.length() - 7)) {
00096             label.erase(pos+7); // trim a tail after "JetTags"
00097         }
00098         discriminatorLabels_.push_back(label);
00099     }
00100   }
00101   if (tagInfoTags_.empty()) { 
00102     addTagInfos_ = false; 
00103   } else {
00104     for (std::vector<edm::InputTag>::const_iterator it = tagInfoTags_.begin(), ed = tagInfoTags_.end(); it != ed; ++it) {
00105         std::string label = it->label();
00106         std::string::size_type pos = label.find("TagInfos");
00107         if ((pos !=  std::string::npos) && (pos != label.length() - 8)) {
00108             label.erase(pos+8); // trim a tail after "TagInfos"
00109         }
00110         tagInfoLabels_.push_back(label);
00111     }
00112   }
00113 
00114   if (!addBTagInfo_) { addDiscriminators_ = false; addTagInfos_ = false; }
00115 
00116   // Check to see if the user wants to add user data
00117   if ( useUserData_ ) {
00118     userDataHelper_ = PATUserDataHelper<Jet>(iConfig.getParameter<edm::ParameterSet>("userData"));
00119   }
00120 
00121   // produces vector of jets
00122   produces<std::vector<Jet> >();
00123   produces<reco::GenJetCollection> ("genJets");
00124   produces<std::vector<CaloTower>  > ("caloTowers");
00125   produces<reco::PFCandidateCollection > ("pfCandidates");
00126   produces<edm::OwnVector<reco::BaseTagInfo> > ("tagInfos");
00127 }
00128 
00129 
00130 PATJetProducer::~PATJetProducer() {
00131 
00132 }
00133 
00134 
00135 void PATJetProducer::produce(edm::Event & iEvent, const edm::EventSetup & iSetup) {
00136 
00137   // check whether dealing with MC or real data
00138   if (iEvent.isRealData()){
00139     getJetMCFlavour_ = false;
00140     addGenPartonMatch_ = false;
00141     addGenJetMatch_ = false;
00142     addPartonJetMatch_ = false;
00143   }
00144 
00145   // Get the vector of jets
00146   edm::Handle<edm::View<reco::Jet> > jets;
00147   iEvent.getByLabel(jetsSrc_, jets);
00148 
00149   if (efficiencyLoader_.enabled()) efficiencyLoader_.newEvent(iEvent);
00150   if (resolutionLoader_.enabled()) resolutionLoader_.newEvent(iEvent, iSetup);
00151 
00152   // for jet flavour
00153   edm::Handle<reco::JetFlavourMatchingCollection> jetFlavMatch;
00154   if (getJetMCFlavour_) iEvent.getByLabel (jetPartonMapSource_, jetFlavMatch);
00155 
00156   // Get the vector of generated particles from the event if needed
00157   edm::Handle<edm::Association<reco::GenParticleCollection> > partonMatch;
00158   if (addGenPartonMatch_) iEvent.getByLabel(genPartonSrc_,  partonMatch);
00159   // Get the vector of GenJets from the event if needed
00160   edm::Handle<edm::Association<reco::GenJetCollection> > genJetMatch;
00161   if (addGenJetMatch_) iEvent.getByLabel(genJetSrc_, genJetMatch);
00162 /* TO BE IMPLEMENTED FOR >= 1_5_X
00163   // Get the vector of PartonJets from the event if needed
00164   edm::Handle<edm::View<reco::SomePartonJetType> > partonJets;
00165   if (addPartonJetMatch_) iEvent.getByLabel(partonJetSrc_, partonJets);
00166 */
00167 
00168   // read in the jet correction factors ValueMap
00169   std::vector<edm::ValueMap<JetCorrFactors> > jetCorrs;
00170   if (addJetCorrFactors_) {
00171     for ( size_t i = 0; i < jetCorrFactorsSrc_.size(); ++i ) {
00172       edm::Handle<edm::ValueMap<JetCorrFactors> > jetCorr;
00173       iEvent.getByLabel(jetCorrFactorsSrc_[i], jetCorr);
00174       jetCorrs.push_back( *jetCorr );
00175     }
00176   }  
00177 
00178   // Get the vector of jet tags with b-tagging info
00179   std::vector<edm::Handle<reco::JetFloatAssociation::Container> > jetDiscriminators;
00180   if (addBTagInfo_ && addDiscriminators_) {
00181     jetDiscriminators.resize(discriminatorTags_.size());
00182     for (size_t i = 0; i < discriminatorTags_.size(); ++i) {
00183         iEvent.getByLabel(discriminatorTags_[i], jetDiscriminators[i]);
00184     }
00185   }
00186   std::vector<edm::Handle<edm::View<reco::BaseTagInfo> > > jetTagInfos;
00187   if (addBTagInfo_ && addTagInfos_) {
00188     jetTagInfos.resize(tagInfoTags_.size());
00189     for (size_t i = 0; i < tagInfoTags_.size(); ++i) {
00190       iEvent.getByLabel(tagInfoTags_[i], jetTagInfos[i]);
00191     }
00192   }
00193  
00194   // tracks Jet Track Association
00195   edm::Handle<reco::JetTracksAssociation::Container > hTrackAss;
00196   if (addAssociatedTracks_) iEvent.getByLabel(trackAssociation_, hTrackAss);
00197   edm::Handle<reco::JetFloatAssociation::Container > hJetChargeAss;
00198   if (addJetCharge_) iEvent.getByLabel(jetCharge_, hJetChargeAss);
00199 
00200   // jet ID handle
00201   edm::Handle<reco::JetIDValueMap> hJetIDMap;
00202   if ( addJetID_ ) iEvent.getByLabel( jetIDMapLabel_, hJetIDMap );
00203 
00204   // loop over jets
00205   std::auto_ptr< std::vector<Jet> > patJets ( new std::vector<Jet>() ); 
00206 
00207   std::auto_ptr<reco::GenJetCollection > genJetsOut ( new reco::GenJetCollection() );
00208   std::auto_ptr<std::vector<CaloTower>  >  caloTowersOut( new std::vector<CaloTower> () );
00209   std::auto_ptr<reco::PFCandidateCollection > pfCandidatesOut( new reco::PFCandidateCollection() );
00210   std::auto_ptr<edm::OwnVector<reco::BaseTagInfo> > tagInfosOut ( new edm::OwnVector<reco::BaseTagInfo>() );  
00211 
00212 
00213   edm::RefProd<reco::GenJetCollection > h_genJetsOut = iEvent.getRefBeforePut<reco::GenJetCollection >( "genJets" );
00214   edm::RefProd<std::vector<CaloTower>  >  h_caloTowersOut = iEvent.getRefBeforePut<std::vector<CaloTower>  > ( "caloTowers" );
00215   edm::RefProd<reco::PFCandidateCollection > h_pfCandidatesOut = iEvent.getRefBeforePut<reco::PFCandidateCollection > ( "pfCandidates" );
00216   edm::RefProd<edm::OwnVector<reco::BaseTagInfo> > h_tagInfosOut = iEvent.getRefBeforePut<edm::OwnVector<reco::BaseTagInfo> > ( "tagInfos" );
00217 
00218 
00219   
00220 
00221   bool first=true; // this is introduced to issue warnings only for the first jet
00222   for (edm::View<reco::Jet>::const_iterator itJet = jets->begin(); itJet != jets->end(); itJet++) {
00223 
00224     // construct the Jet from the ref -> save ref to original object
00225     unsigned int idx = itJet - jets->begin();
00226     edm::RefToBase<reco::Jet> jetRef = jets->refAt(idx);
00227     edm::Ptr<reco::Jet> jetPtr = jets->ptrAt(idx); 
00228     Jet ajet(jetRef);
00229 
00230     // add the FwdPtrs to the CaloTowers
00231     if ( (ajet.isCaloJet() || ajet.isJPTJet() ) && embedCaloTowers_) {
00232       const reco::CaloJet *cj = 0;
00233       const reco::JPTJet * jptj = 0;
00234       if ( ajet.isCaloJet()) cj = dynamic_cast<const reco::CaloJet *>(jetRef.get());      
00235       else { 
00236         jptj = dynamic_cast<const reco::JPTJet *>(jetRef.get() );
00237         cj = dynamic_cast<const reco::CaloJet *>(jptj->getCaloJetRef().get() );
00238       }
00239       pat::CaloTowerFwdPtrCollection itowersRef;
00240       std::vector< CaloTowerPtr > itowers = cj->getCaloConstituents();
00241       for ( std::vector<CaloTowerPtr>::const_iterator towBegin = itowers.begin(),
00242               towEnd = itowers.end(), itow = towBegin;
00243             itow != towEnd; ++itow ) {
00244         caloTowersOut->push_back( **itow );
00245         // set the "forward" ref to the thinned collection
00246         edm::Ref<std::vector<CaloTower> > caloTowerRef( h_caloTowersOut, caloTowersOut->size() - 1);
00247         edm::Ptr<CaloTower> caloForwardRef ( h_caloTowersOut.id(), caloTowerRef.key(), h_caloTowersOut.productGetter() );
00248         // set the "backward" ref to the original collection for association
00249         edm::Ptr<CaloTower> caloBackRef ( *itow );      
00250         // add to the list of FwdPtr's
00251         itowersRef.push_back( pat::CaloTowerFwdPtrCollection::value_type ( caloForwardRef, caloBackRef ) );
00252         
00253       }
00254       ajet.setCaloTowers( itowersRef );
00255     }
00256 
00257     // add the FwdPtrs to the PFCandidates
00258     if (ajet.isPFJet() && embedPFCandidates_) {
00259       const reco::PFJet *cj = dynamic_cast<const reco::PFJet *>(jetRef.get());
00260       pat::PFCandidateFwdPtrCollection iparticlesRef;
00261       std::vector< reco::PFCandidatePtr > iparticles = cj->getPFConstituents();
00262       for ( std::vector<reco::PFCandidatePtr>::const_iterator partBegin = iparticles.begin(),
00263               partEnd = iparticles.end(), ipart = partBegin;
00264             ipart != partEnd; ++ipart ) {
00265         pfCandidatesOut->push_back( **ipart );
00266         // set the "forward" ref to the thinned collection
00267         edm::Ref<reco::PFCandidateCollection> pfCollectionRef( h_pfCandidatesOut, pfCandidatesOut->size() - 1);
00268         edm::Ptr<reco::PFCandidate> pfForwardRef ( h_pfCandidatesOut.id(), pfCollectionRef.key(),  h_pfCandidatesOut.productGetter() );
00269         // set the "backward" ref to the original collection for association
00270         edm::Ptr<reco::PFCandidate> pfBackRef ( *ipart );
00271         // add to the list of FwdPtr's
00272         iparticlesRef.push_back( pat::PFCandidateFwdPtrCollection::value_type ( pfForwardRef, pfBackRef ) );
00273       }
00274       ajet.setPFCandidates( iparticlesRef );
00275     }
00276 
00277     if (addJetCorrFactors_) {
00278       // add additional JetCorrs to the jet 
00279       for ( unsigned int i=0; i<jetCorrFactorsSrc_.size(); ++i ) {
00280         const JetCorrFactors& jcf = jetCorrs[i][jetRef];
00281         // uncomment for debugging
00282         // jcf.print();
00283         ajet.addJECFactors(jcf);
00284       }
00285       std::vector<std::string> levels = jetCorrs[0][jetRef].correctionLabels();
00286       if(std::find(levels.begin(), levels.end(), "L2L3Residual")!=levels.end()){
00287         ajet.initializeJEC(jetCorrs[0][jetRef].jecLevel("L2L3Residual"));
00288       }
00289       else if(std::find(levels.begin(), levels.end(), "L3Absolute")!=levels.end()){
00290         ajet.initializeJEC(jetCorrs[0][jetRef].jecLevel("L3Absolute"));
00291       }
00292       else{
00293         ajet.initializeJEC(jetCorrs[0][jetRef].jecLevel("Uncorrected"));
00294         if(first){        
00295           edm::LogWarning("L3Absolute not found") << "L2L3Residual and L3Absolute are not part of the correction applied jetCorrFactors \n"
00296                                                   << "of module " <<  jetCorrs[0][jetRef].jecSet() << " jets will remain"
00297                                                   << " uncorrected."; first=false;
00298         }
00299       }
00300     }
00301 
00302     // get the MC flavour information for this jet
00303     if (getJetMCFlavour_) {
00304         ajet.setPartonFlavour( (*jetFlavMatch)[edm::RefToBase<reco::Jet>(jetRef)].getFlavour() );
00305     }
00306     // store the match to the generated partons
00307     if (addGenPartonMatch_) {
00308       reco::GenParticleRef parton = (*partonMatch)[jetRef];
00309       if (parton.isNonnull() && parton.isAvailable()) {
00310           ajet.setGenParton(parton, embedGenPartonMatch_);
00311       } // leave empty if no match found
00312     }
00313     // store the match to the GenJets
00314     if (addGenJetMatch_) {
00315       reco::GenJetRef genjet = (*genJetMatch)[jetRef];
00316       if (genjet.isNonnull() && genjet.isAvailable()) {
00317         genJetsOut->push_back( *genjet );
00318         // set the "forward" ref to the thinned collection
00319         edm::Ref<reco::GenJetCollection > genForwardRef ( h_genJetsOut, genJetsOut->size() - 1 );
00320         // set the "backward" ref to the original collection
00321         edm::Ref<reco::GenJetCollection > genBackRef ( genjet );
00322         // make the FwdPtr
00323         edm::FwdRef<reco::GenJetCollection > genjetFwdRef ( genForwardRef, genBackRef );
00324         ajet.setGenJetRef(genjetFwdRef );
00325       } // leave empty if no match found
00326     }
00327 
00328     if (efficiencyLoader_.enabled()) {
00329         efficiencyLoader_.setEfficiencies( ajet, jetRef );
00330     }
00331 
00332     // IMPORTANT: DO THIS AFTER JES CORRECTIONS
00333     if (resolutionLoader_.enabled()) {
00334         resolutionLoader_.setResolutions(ajet);
00335     }
00336 
00337     // TO BE IMPLEMENTED FOR >=1_5_X: do the PartonJet matching
00338     if (addPartonJetMatch_) {
00339     }
00340 
00341     // add b-tag info if available & required
00342     if (addBTagInfo_) {
00343         if (addDiscriminators_) {
00344             for (size_t k=0; k<jetDiscriminators.size(); ++k) {
00345                 float value = (*jetDiscriminators[k])[jetRef];
00346                 ajet.addBDiscriminatorPair(std::make_pair(discriminatorLabels_[k], value));
00347             }
00348         }    
00349         if (addTagInfos_) {
00350           for (size_t k=0; k<jetTagInfos.size(); ++k) {
00351             const edm::View<reco::BaseTagInfo> & taginfos = *jetTagInfos[k];
00352             // This is not associative, so we have to search the jet
00353             edm::Ptr<reco::BaseTagInfo> match;
00354             // Try first by 'same index'
00355             if ((idx < taginfos.size()) && (taginfos[idx].jet() == jetRef)) {
00356               match = taginfos.ptrAt(idx);
00357             } else {
00358               // otherwise fail back to a simple search
00359               for (edm::View<reco::BaseTagInfo>::const_iterator itTI = taginfos.begin(), edTI = taginfos.end(); itTI != edTI; ++itTI) {
00360                 if (itTI->jet() == jetRef) { match = taginfos.ptrAt( itTI - taginfos.begin() ); break; }
00361               }
00362             }
00363             if (match.isNonnull()) {
00364               tagInfosOut->push_back( match->clone() );
00365               // set the "forward" ptr to the thinned collection
00366               edm::Ptr<reco::BaseTagInfo> tagInfoForwardPtr ( h_tagInfosOut.id(), &tagInfosOut->back(), tagInfosOut->size() - 1 );
00367               // set the "backward" ptr to the original collection for association
00368               edm::Ptr<reco::BaseTagInfo> tagInfoBackPtr ( match );
00369               // make FwdPtr
00370               TagInfoFwdPtrCollection::value_type tagInfoFwdPtr( tagInfoForwardPtr, tagInfoBackPtr ) ;
00371               ajet.addTagInfo(tagInfoLabels_[k], tagInfoFwdPtr );
00372             }
00373           }
00374         }    
00375     }
00376     
00377     if (addAssociatedTracks_) ajet.setAssociatedTracks( (*hTrackAss)[jetRef] );
00378 
00379     if (addJetCharge_) ajet.setJetCharge( (*hJetChargeAss)[jetRef] );
00380 
00381     // add jet ID for calo jets
00382     if (addJetID_ && ajet.isCaloJet() ) {
00383       reco::JetID jetId = (*hJetIDMap)[ jetRef ];
00384       ajet.setJetID( jetId );
00385     }
00386     // add jet ID jpt jets
00387     else if ( addJetID_ && ajet.isJPTJet() ){
00388       const reco::JPTJet *jptj = dynamic_cast<const reco::JPTJet *>(jetRef.get());
00389       reco::JetID jetId = (*hJetIDMap)[ jptj->getCaloJetRef() ];
00390       ajet.setJetID( jetId );
00391     } 
00392     if ( useUserData_ ) {
00393       userDataHelper_.add( ajet, iEvent, iSetup );
00394     }
00395     patJets->push_back(ajet);
00396   }
00397 
00398   // sort jets in pt
00399   std::sort(patJets->begin(), patJets->end(), pTComparator_);
00400 
00401   // put genEvt  in Event
00402   iEvent.put(patJets);
00403 
00404   iEvent.put( genJetsOut, "genJets" );
00405   iEvent.put( caloTowersOut, "caloTowers" );
00406   iEvent.put( pfCandidatesOut, "pfCandidates" );
00407   iEvent.put( tagInfosOut, "tagInfos" );
00408   
00409 
00410 }
00411 
00412 // ParameterSet description for module
00413 void PATJetProducer::fillDescriptions(edm::ConfigurationDescriptions & descriptions)
00414 {
00415   edm::ParameterSetDescription iDesc;
00416   iDesc.setComment("PAT jet producer module");
00417 
00418   // input source 
00419   iDesc.add<edm::InputTag>("jetSource", edm::InputTag("no default"))->setComment("input collection");
00420 
00421   // embedding
00422   iDesc.add<bool>("embedCaloTowers", true)->setComment("embed external calo towers");
00423   iDesc.add<bool>("embedPFCandidates", true)->setComment("embed external PFCandidates");
00424 
00425   // MC matching configurables
00426   iDesc.add<bool>("addGenPartonMatch", true)->setComment("add MC matching");
00427   iDesc.add<bool>("embedGenPartonMatch", false)->setComment("embed MC matched MC information");
00428   iDesc.add<edm::InputTag>("genPartonMatch", edm::InputTag())->setComment("input with MC match information");
00429 
00430   iDesc.add<bool>("addGenJetMatch", true)->setComment("add MC matching");
00431   iDesc.add<bool>("embedGenJetMatch", false)->setComment("embed MC matched MC information");
00432   iDesc.add<edm::InputTag>("genJetMatch", edm::InputTag())->setComment("input with MC match information");
00433 
00434   iDesc.add<bool>("addJetCharge", true);
00435   iDesc.add<edm::InputTag>("jetChargeSource", edm::InputTag("patJetCharge"));
00436   
00437   // jet id
00438   iDesc.add<bool>("addJetID", true)->setComment("Add jet ID information");
00439   iDesc.add<edm::InputTag>("jetIDMap", edm::InputTag())->setComment("jet id map");
00440 
00441   iDesc.add<bool>("addPartonJetMatch", false);
00442   iDesc.add<edm::InputTag>("partonJetSource", edm::InputTag("NOT IMPLEMENTED"));
00443 
00444   // track association
00445   iDesc.add<bool>("addAssociatedTracks", true);
00446   iDesc.add<edm::InputTag>("trackAssociationSource", edm::InputTag("ic5JetTracksAssociatorAtVertex"));
00447 
00448   // tag info
00449   iDesc.add<bool>("addTagInfos", true);
00450   std::vector<edm::InputTag> emptyVInputTags;
00451   iDesc.add<std::vector<edm::InputTag> >("tagInfoSources", emptyVInputTags);
00452 
00453   // jet energy corrections
00454   iDesc.add<bool>("addJetCorrFactors", true);
00455   iDesc.add<std::vector<edm::InputTag> >("jetCorrFactorsSource", emptyVInputTags);
00456 
00457   // btag discriminator tags
00458   iDesc.add<bool>("addBTagInfo",true);
00459   iDesc.add<bool>("addDiscriminators", true);
00460   iDesc.add<std::vector<edm::InputTag> >("discriminatorSources", emptyVInputTags);
00461 
00462   // jet flavour idetification configurables
00463   iDesc.add<bool>("getJetMCFlavour", true);
00464   iDesc.add<edm::InputTag>("JetPartonMapSource", edm::InputTag("jetFlavourAssociation"));
00465 
00466   pat::helper::KinResolutionsLoader::fillDescription(iDesc);
00467 
00468   // Efficiency configurables
00469   edm::ParameterSetDescription efficienciesPSet;
00470   efficienciesPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
00471   iDesc.add("efficiencies", efficienciesPSet);
00472   iDesc.add<bool>("addEfficiencies", false);
00473 
00474   // Check to see if the user wants to add user data
00475   edm::ParameterSetDescription userDataPSet;
00476   PATUserDataHelper<Jet>::fillDescription(userDataPSet);
00477   iDesc.addOptional("userData", userDataPSet);
00478 
00479   descriptions.add("PATJetProducer", iDesc);
00480 }
00481 
00482 #include "FWCore/Framework/interface/MakerMacros.h"
00483 
00484 DEFINE_FWK_MODULE(PATJetProducer);
00485