CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/PhysicsTools/PatAlgos/plugins/PATJetProducer.cc

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