CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/PhysicsTools/PatAlgos/plugins/PATTauProducer.cc

Go to the documentation of this file.
00001 //
00002 // $Id: PATTauProducer.cc,v 1.37 2012/05/20 20:12:25 rwolf Exp $
00003 //
00004 
00005 #include "PhysicsTools/PatAlgos/plugins/PATTauProducer.h"
00006 
00007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00008 #include "FWCore/ParameterSet/interface/FileInPath.h"
00009 #include "DataFormats/Common/interface/View.h"
00010 #include "DataFormats/Common/interface/Association.h"
00011 #include "DataFormats/Common/interface/Ref.h"
00012 
00013 #include "DataFormats/TauReco/interface/PFTau.h"
00014 #include "DataFormats/TauReco/interface/PFTauDiscriminator.h"
00015 #include "DataFormats/TauReco/interface/CaloTau.h"
00016 #include "DataFormats/TauReco/interface/CaloTauDiscriminator.h"
00017 #include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h"
00018 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
00019 #include "DataFormats/JetReco/interface/GenJetCollection.h"
00020 
00021 #include "DataFormats/PatCandidates/interface/TauJetCorrFactors.h"
00022 
00023 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
00024 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
00025 
00026 #include <vector>
00027 #include <memory>
00028 
00029 using namespace pat;
00030 
00031 PATTauProducer::PATTauProducer(const edm::ParameterSet & iConfig):
00032   isolator_(iConfig.exists("userIsolation") ? iConfig.getParameter<edm::ParameterSet>("userIsolation") : edm::ParameterSet(), false) ,
00033   useUserData_(iConfig.exists("userData"))
00034 {
00035   // initialize the configurables
00036   tauSrc_ = iConfig.getParameter<edm::InputTag>( "tauSource" );
00037   embedIsolationTracks_ = iConfig.getParameter<bool>( "embedIsolationTracks" );
00038   embedLeadTrack_ = iConfig.getParameter<bool>( "embedLeadTrack" );
00039   embedSignalTracks_ = iConfig.getParameter<bool>( "embedSignalTracks" );
00040   embedLeadPFCand_ = iConfig.getParameter<bool>( "embedLeadPFCand" );
00041   embedLeadPFChargedHadrCand_ = iConfig.getParameter<bool>( "embedLeadPFChargedHadrCand" );
00042   embedLeadPFNeutralCand_ = iConfig.getParameter<bool>( "embedLeadPFNeutralCand" );
00043   embedSignalPFCands_ = iConfig.getParameter<bool>( "embedSignalPFCands" );
00044   embedSignalPFChargedHadrCands_ = iConfig.getParameter<bool>( "embedSignalPFChargedHadrCands" );
00045   embedSignalPFNeutralHadrCands_ = iConfig.getParameter<bool>( "embedSignalPFNeutralHadrCands" );
00046   embedSignalPFGammaCands_ = iConfig.getParameter<bool>( "embedSignalPFGammaCands" );
00047   embedIsolationPFCands_ = iConfig.getParameter<bool>( "embedIsolationPFCands" );
00048   embedIsolationPFChargedHadrCands_ = iConfig.getParameter<bool>( "embedIsolationPFChargedHadrCands" );
00049   embedIsolationPFNeutralHadrCands_ = iConfig.getParameter<bool>( "embedIsolationPFNeutralHadrCands" );
00050   embedIsolationPFGammaCands_ = iConfig.getParameter<bool>( "embedIsolationPFGammaCands" );
00051   addGenMatch_ = iConfig.getParameter<bool>( "addGenMatch" );
00052   if (addGenMatch_) {
00053     embedGenMatch_ = iConfig.getParameter<bool>( "embedGenMatch" );
00054     if (iConfig.existsAs<edm::InputTag>("genParticleMatch")) {
00055       genMatchSrc_.push_back(iConfig.getParameter<edm::InputTag>( "genParticleMatch" ));
00056     } 
00057     else {
00058       genMatchSrc_ = iConfig.getParameter<std::vector<edm::InputTag> >( "genParticleMatch" );
00059     }
00060   }
00061   addGenJetMatch_ = iConfig.getParameter<bool>( "addGenJetMatch" );
00062   if(addGenJetMatch_) {
00063     embedGenJetMatch_ = iConfig.getParameter<bool>( "embedGenJetMatch" );
00064     genJetMatchSrc_ = iConfig.getParameter<edm::InputTag>( "genJetMatch" );
00065   }
00066   addTauJetCorrFactors_ = iConfig.getParameter<bool>( "addTauJetCorrFactors" );
00067   tauJetCorrFactorsSrc_ = iConfig.getParameter<std::vector<edm::InputTag> >( "tauJetCorrFactorsSource" );
00068   // tau ID configurables
00069   addTauID_ = iConfig.getParameter<bool>( "addTauID" );
00070   if ( addTauID_ ) {
00071     // it might be a single tau ID
00072     if (iConfig.existsAs<edm::InputTag>("tauIDSource")) {
00073       tauIDSrcs_.push_back(NameTag("", iConfig.getParameter<edm::InputTag>("tauIDSource")));
00074     }
00075     // or there might be many of them
00076     if (iConfig.existsAs<edm::ParameterSet>("tauIDSources")) {
00077       // please don't configure me twice
00078       if (!tauIDSrcs_.empty()){
00079         throw cms::Exception("Configuration") << "PATTauProducer: you can't specify both 'tauIDSource' and 'tauIDSources'\n";
00080       }
00081       // read the different tau ID names
00082       edm::ParameterSet idps = iConfig.getParameter<edm::ParameterSet>("tauIDSources");
00083       std::vector<std::string> names = idps.getParameterNamesForType<edm::InputTag>();
00084       for (std::vector<std::string>::const_iterator it = names.begin(), ed = names.end(); it != ed; ++it) {
00085         tauIDSrcs_.push_back(NameTag(*it, idps.getParameter<edm::InputTag>(*it)));
00086       }
00087     }
00088     // but in any case at least once
00089     if (tauIDSrcs_.empty()) throw cms::Exception("Configuration") <<
00090       "PATTauProducer: id addTauID is true, you must specify either:\n" <<
00091       "\tInputTag tauIDSource = <someTag>\n" << "or\n" <<
00092       "\tPSet tauIDSources = { \n" <<
00093       "\t\tInputTag <someName> = <someTag>   // as many as you want \n " <<
00094       "\t}\n";
00095   }
00096   // IsoDeposit configurables
00097   if (iConfig.exists("isoDeposits")) {
00098     edm::ParameterSet depconf = iConfig.getParameter<edm::ParameterSet>("isoDeposits");
00099     if ( depconf.exists("tracker")         ) isoDepositLabels_.push_back(std::make_pair(pat::TrackIso, depconf.getParameter<edm::InputTag>("tracker")));
00100     if ( depconf.exists("ecal")            ) isoDepositLabels_.push_back(std::make_pair(pat::EcalIso, depconf.getParameter<edm::InputTag>("ecal")));
00101     if ( depconf.exists("hcal")            ) isoDepositLabels_.push_back(std::make_pair(pat::HcalIso, depconf.getParameter<edm::InputTag>("hcal")));
00102     if ( depconf.exists("pfAllParticles")  ) isoDepositLabels_.push_back(std::make_pair(pat::PfAllParticleIso, depconf.getParameter<edm::InputTag>("pfAllParticles")));
00103     if ( depconf.exists("pfChargedHadron") ) isoDepositLabels_.push_back(std::make_pair(pat::PfChargedHadronIso, depconf.getParameter<edm::InputTag>("pfChargedHadron")));
00104     if ( depconf.exists("pfNeutralHadron") ) isoDepositLabels_.push_back(std::make_pair(pat::PfNeutralHadronIso,depconf.getParameter<edm::InputTag>("pfNeutralHadron")));
00105     if ( depconf.exists("pfGamma")         ) isoDepositLabels_.push_back(std::make_pair(pat::PfGammaIso, depconf.getParameter<edm::InputTag>("pfGamma")));
00106     
00107     if ( depconf.exists("user") ) {
00108       std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag> >("user");
00109       std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
00110       int key = UserBaseIso;
00111       for ( ; it != ed; ++it, ++key) {
00112         isoDepositLabels_.push_back(std::make_pair(IsolationKeys(key), *it));
00113       }
00114     }
00115   }
00116   // Efficiency configurables
00117   addEfficiencies_ = iConfig.getParameter<bool>("addEfficiencies");
00118   if (addEfficiencies_) {
00119      efficiencyLoader_ = pat::helper::EfficiencyLoader(iConfig.getParameter<edm::ParameterSet>("efficiencies"));
00120   }
00121   // Resolution configurables
00122   addResolutions_ = iConfig.getParameter<bool>("addResolutions");
00123   if (addResolutions_) {
00124      resolutionLoader_ = pat::helper::KinResolutionsLoader(iConfig.getParameter<edm::ParameterSet>("resolutions"));
00125   }
00126   // Check to see if the user wants to add user data
00127   if ( useUserData_ ) {
00128     userDataHelper_ = PATUserDataHelper<Tau>(iConfig.getParameter<edm::ParameterSet>("userData"));
00129   }
00130   // produces vector of taus
00131   produces<std::vector<Tau> >();
00132 }
00133 
00134 PATTauProducer::~PATTauProducer() 
00135 {
00136 }
00137 
00138 void PATTauProducer::produce(edm::Event & iEvent, const edm::EventSetup & iSetup) 
00139 { 
00140   // switch off embedding (in unschedules mode)
00141   if (iEvent.isRealData()){
00142     addGenMatch_    = false;
00143     embedGenMatch_  = false;
00144     addGenJetMatch_ = false;
00145   }
00146 
00147   // Get the collection of taus from the event
00148   edm::Handle<edm::View<reco::BaseTau> > anyTaus;
00149   try {
00150     iEvent.getByLabel(tauSrc_, anyTaus);
00151   } catch (const edm::Exception &e) {
00152     edm::LogWarning("DataSource") << "WARNING! No Tau collection found. This missing input will not block the job. Instead, an empty tau collection is being be produced.";
00153     std::auto_ptr<std::vector<Tau> > patTaus(new std::vector<Tau>()); 
00154     iEvent.put(patTaus);
00155     return;
00156   }
00157 
00158   if (isolator_.enabled()) isolator_.beginEvent(iEvent,iSetup);
00159 
00160   if (efficiencyLoader_.enabled()) efficiencyLoader_.newEvent(iEvent);
00161   if (resolutionLoader_.enabled()) resolutionLoader_.newEvent(iEvent, iSetup);
00162    
00163   std::vector<edm::Handle<edm::ValueMap<IsoDeposit> > > deposits(isoDepositLabels_.size());
00164   for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
00165     iEvent.getByLabel(isoDepositLabels_[j].second, deposits[j]);
00166   }
00167 
00168   // prepare the MC matching
00169   std::vector<edm::Handle<edm::Association<reco::GenParticleCollection> > > genMatches(genMatchSrc_.size());
00170   if (addGenMatch_) {
00171     for (size_t j = 0, nd = genMatchSrc_.size(); j < nd; ++j) {
00172       iEvent.getByLabel(genMatchSrc_[j], genMatches[j]);
00173     }
00174   }
00175 
00176   edm::Handle<edm::Association<reco::GenJetCollection> > genJetMatch;  
00177   if (addGenJetMatch_) iEvent.getByLabel(genJetMatchSrc_, genJetMatch); 
00178 
00179   // read in the jet correction factors ValueMap
00180   std::vector<edm::ValueMap<TauJetCorrFactors> > tauJetCorrs;
00181   if (addTauJetCorrFactors_) {
00182     for ( size_t i = 0; i < tauJetCorrFactorsSrc_.size(); ++i ) {
00183       edm::Handle<edm::ValueMap<TauJetCorrFactors> > tauJetCorr;
00184       iEvent.getByLabel(tauJetCorrFactorsSrc_[i], tauJetCorr);
00185       tauJetCorrs.push_back( *tauJetCorr );
00186     }
00187   }  
00188 
00189   std::auto_ptr<std::vector<Tau> > patTaus(new std::vector<Tau>()); 
00190 
00191   bool first=true; // this is introduced to issue warnings only for the first tau-jet
00192   for (size_t idx = 0, ntaus = anyTaus->size(); idx < ntaus; ++idx) {
00193     edm::RefToBase<reco::BaseTau> tausRef = anyTaus->refAt(idx);
00194     edm::Ptr<reco::BaseTau> tausPtr = anyTaus->ptrAt(idx);
00195     
00196     Tau aTau(tausRef);
00197     if (embedLeadTrack_)       aTau.embedLeadTrack();
00198     if (embedSignalTracks_)    aTau.embedSignalTracks();
00199     if (embedIsolationTracks_) aTau.embedIsolationTracks();    
00200     if (embedLeadPFCand_) {
00201       if (aTau.isPFTau() )
00202         aTau.embedLeadPFCand();
00203       else 
00204         edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made from a reco::PFTau is impossible.\n";
00205     }
00206     if (embedLeadPFChargedHadrCand_) {
00207       if (aTau.isPFTau() )
00208         aTau.embedLeadPFChargedHadrCand();
00209       else 
00210         edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made from a reco::PFTau is impossible.\n";
00211     }
00212     if (embedLeadPFNeutralCand_) {
00213       if (aTau.isPFTau() )
00214         aTau.embedLeadPFNeutralCand();
00215       else 
00216         edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made from a reco::PFTau is impossible.\n";
00217     }
00218     if (embedSignalPFCands_) {
00219       if (aTau.isPFTau() )
00220         aTau.embedSignalPFCands();
00221       else 
00222         edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made from a reco::PFTau is impossible.\n";
00223     }
00224     if (embedSignalPFChargedHadrCands_) {
00225       if (aTau.isPFTau() )
00226         aTau.embedSignalPFChargedHadrCands();
00227       else 
00228         edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made from a reco::PFTau is impossible.\n";
00229     }
00230     if (embedSignalPFNeutralHadrCands_) {
00231       if (aTau.isPFTau() )
00232         aTau.embedSignalPFNeutralHadrCands();
00233       else 
00234         edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made from a reco::PFTau is impossible.\n";
00235     }
00236     if (embedSignalPFGammaCands_) {
00237       if (aTau.isPFTau() )
00238         aTau.embedSignalPFGammaCands();
00239       else 
00240         edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made from a reco::PFTau is impossible.\n";
00241     }
00242     if (embedIsolationPFCands_) {
00243       if (aTau.isPFTau() )
00244         aTau.embedIsolationPFCands();
00245       else 
00246         edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made from a reco::PFTau is impossible.\n";
00247     }
00248     if (embedIsolationPFChargedHadrCands_) {
00249       if (aTau.isPFTau() )
00250         aTau.embedIsolationPFChargedHadrCands();
00251       else 
00252         edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made from a reco::PFTau is impossible.\n";
00253     }
00254     if (embedIsolationPFNeutralHadrCands_) {
00255       if (aTau.isPFTau() )
00256         aTau.embedIsolationPFNeutralHadrCands();
00257       else 
00258         edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made from a reco::PFTau is impossible.\n";
00259     }
00260     if (embedIsolationPFGammaCands_) {
00261       if (aTau.isPFTau() )
00262         aTau.embedIsolationPFGammaCands();
00263       else 
00264         edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made from a reco::PFTau is impossible.\n";
00265     }
00266     
00267     if (addTauJetCorrFactors_) {
00268       // add additional JetCorrs to the jet 
00269       for ( unsigned int i=0; i<tauJetCorrFactorsSrc_.size(); ++i ) {
00270         const TauJetCorrFactors& tauJetCorr = tauJetCorrs[i][tausRef];
00271         // uncomment for debugging
00272         // tauJetCorr.print();
00273         aTau.addJECFactors(tauJetCorr);
00274       }
00275       std::vector<std::string> levels = tauJetCorrs[0][tausRef].correctionLabels();
00276       if(std::find(levels.begin(), levels.end(), "L2L3Residual")!=levels.end()){
00277         aTau.initializeJEC(tauJetCorrs[0][tausRef].jecLevel("L2L3Residual"));
00278       }
00279       else if(std::find(levels.begin(), levels.end(), "L3Absolute")!=levels.end()){
00280         aTau.initializeJEC(tauJetCorrs[0][tausRef].jecLevel("L3Absolute"));
00281       }
00282       else{
00283         aTau.initializeJEC(tauJetCorrs[0][tausRef].jecLevel("Uncorrected"));
00284         if(first){        
00285           edm::LogWarning("L3Absolute not found") 
00286             << "L2L3Residual and L3Absolute are not part of the correction applied jetCorrFactors \n"
00287             << "of module " <<  tauJetCorrs[0][tausRef].jecSet() << " jets will remain"
00288             << " uncorrected."; 
00289           first=false;
00290         }
00291       }
00292     }
00293 
00294     // store the match to the generated final state muons
00295     if (addGenMatch_) {
00296       for(size_t i = 0, n = genMatches.size(); i < n; ++i) {
00297           reco::GenParticleRef genTau = (*genMatches[i])[tausRef];
00298           aTau.addGenParticleRef(genTau);
00299       }
00300       if (embedGenMatch_) aTau.embedGenParticle();
00301     }
00302     
00303     // store the match to the visible part of the generated tau
00304     if (addGenJetMatch_) {
00305       reco::GenJetRef genJetTau = (*genJetMatch)[tausRef];
00306       if (genJetTau.isNonnull() && genJetTau.isAvailable() ) {
00307         aTau.setGenJet( genJetTau );
00308       } // leave empty if no match found
00309     }
00310 
00311     // prepare ID extraction 
00312     if ( addTauID_ ) {
00313       std::vector<pat::Tau::IdPair> ids(tauIDSrcs_.size());
00314       for ( size_t i = 0; i < tauIDSrcs_.size(); ++i ) {
00315         edm::Handle<reco::CaloTauDiscriminator> caloTauIdDiscr;
00316         iEvent.getByLabel(tauIDSrcs_[i].second, caloTauIdDiscr);
00317 
00318         edm::Handle<reco::PFTauDiscriminator> pfTauIdDiscr;
00319         iEvent.getByLabel(tauIDSrcs_[i].second, pfTauIdDiscr);
00320         
00321         if ( typeid(*tausRef) == typeid(reco::PFTau) ) {
00322           //std::cout << "filling PFTauDiscriminator '" << tauIDSrcs_[i].first << "' into pat::Tau object..." << std::endl;
00323           edm::Handle<reco::PFTauCollection> pfTauCollection; 
00324           iEvent.getByLabel(tauSrc_, pfTauCollection);
00325 
00326           edm::Handle<reco::PFTauDiscriminator> pfTauIdDiscr;
00327           iEvent.getByLabel(tauIDSrcs_[i].second, pfTauIdDiscr);
00328 
00329           ids[i].first = tauIDSrcs_[i].first;
00330           ids[i].second = getTauIdDiscriminator(pfTauCollection, idx, pfTauIdDiscr);
00331         } else if ( typeid(*tausRef) == typeid(reco::CaloTau) ) {
00332           //std::cout << "filling CaloTauDiscriminator '" << tauIDSrcs_[i].first << "' into pat::Tau object..." << std::endl;
00333           edm::Handle<reco::CaloTauCollection> caloTauCollection; 
00334           iEvent.getByLabel(tauSrc_, caloTauCollection);
00335 
00336           edm::Handle<reco::CaloTauDiscriminator> caloTauIdDiscr;
00337           iEvent.getByLabel(tauIDSrcs_[i].second, caloTauIdDiscr);
00338 
00339           ids[i].first = tauIDSrcs_[i].first;
00340           ids[i].second = getTauIdDiscriminator(caloTauCollection, idx, caloTauIdDiscr);
00341         } else {
00342           throw cms::Exception("Type Mismatch") <<
00343             "PATTauProducer: unsupported datatype '" << typeid(*tausRef).name() << "' for tauSource\n";
00344         }
00345       }
00346 
00347       aTau.setTauIDs(ids);
00348     }
00349 
00350     // extraction of reconstructed tau decay mode 
00351     // (only available for PFTaus)
00352     if ( aTau.isPFTau() ) {
00353       edm::Handle<reco::PFTauCollection> pfTaus;
00354       iEvent.getByLabel(tauSrc_, pfTaus);
00355       reco::PFTauRef pfTauRef(pfTaus, idx);
00356 
00357       aTau.setDecayMode(pfTauRef->decayMode());
00358     }
00359 
00360     // Isolation
00361     if (isolator_.enabled()) {
00362       isolator_.fill(*anyTaus, idx, isolatorTmpStorage_);
00363       typedef pat::helper::MultiIsolator::IsolationValuePairs IsolationValuePairs;
00364       // better to loop backwards, so the vector is resized less times
00365       for ( IsolationValuePairs::const_reverse_iterator it = isolatorTmpStorage_.rbegin(), 
00366               ed = isolatorTmpStorage_.rend(); it != ed; ++it) {
00367         aTau.setIsolation(it->first, it->second);
00368       }
00369     }
00370     
00371     for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
00372       aTau.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[tausRef]);
00373     }
00374 
00375     if (efficiencyLoader_.enabled()) {
00376       efficiencyLoader_.setEfficiencies( aTau, tausRef );
00377     }
00378 
00379     if (resolutionLoader_.enabled()) {
00380       resolutionLoader_.setResolutions(aTau);
00381     }
00382 
00383     if ( useUserData_ ) {
00384       userDataHelper_.add( aTau, iEvent, iSetup );
00385     }
00386 
00387     patTaus->push_back(aTau);
00388   }
00389 
00390   // sort taus in pT
00391   std::sort(patTaus->begin(), patTaus->end(), pTTauComparator_);
00392 
00393   // put genEvt object in Event
00394   iEvent.put(patTaus);
00395 
00396   // clean up
00397   if (isolator_.enabled()) isolator_.endEvent();
00398 }
00399 
00400 template <typename TauCollectionType, typename TauDiscrType>
00401 float PATTauProducer::getTauIdDiscriminator(const edm::Handle<TauCollectionType>& tauCollection, size_t tauIdx, const edm::Handle<TauDiscrType>& tauIdDiscr)
00402 {
00403   edm::Ref<TauCollectionType> tauRef(tauCollection, tauIdx);
00404   return (*tauIdDiscr)[tauRef];
00405 }     
00406 
00407 // ParameterSet description for module
00408 void PATTauProducer::fillDescriptions(edm::ConfigurationDescriptions & descriptions)
00409 {
00410   edm::ParameterSetDescription iDesc;
00411   iDesc.setComment("PAT tau producer module");
00412 
00413   // input source 
00414   iDesc.add<edm::InputTag>("tauSource", edm::InputTag())->setComment("input collection");
00415 
00416   // embedding
00417   iDesc.add<bool>("embedIsolationTracks", false)->setComment("embed external isolation tracks");
00418   iDesc.add<bool>("embedLeadTrack", false)->setComment("embed external leading track");
00419   iDesc.add<bool>("embedLeadTracks", false)->setComment("embed external signal tracks");
00420 
00421   // MC matching configurables
00422   iDesc.add<bool>("addGenMatch", true)->setComment("add MC matching");
00423   iDesc.add<bool>("embedGenMatch", false)->setComment("embed MC matched MC information");
00424   std::vector<edm::InputTag> emptySourceVector;
00425   iDesc.addNode( edm::ParameterDescription<edm::InputTag>("genParticleMatch", edm::InputTag(), true) xor 
00426                  edm::ParameterDescription<std::vector<edm::InputTag> >("genParticleMatch", emptySourceVector, true)
00427                  )->setComment("input with MC match information");
00428 
00429   // MC jet matching variables
00430   iDesc.add<bool>("addGenJetMatch", true)->setComment("add MC jet matching");
00431   iDesc.add<bool>("embedGenJetMatch", false)->setComment("embed MC jet matched jet information");
00432   iDesc.add<edm::InputTag>("genJetMatch", edm::InputTag("tauGenJetMatch"));
00433 
00434 
00435   pat::helper::KinResolutionsLoader::fillDescription(iDesc);
00436 
00437   // tau ID configurables
00438   iDesc.add<bool>("addTauID", true)->setComment("add tau ID variables");
00439   edm::ParameterSetDescription tauIDSourcesPSet;
00440   tauIDSourcesPSet.setAllowAnything(); 
00441   iDesc.addNode( edm::ParameterDescription<edm::InputTag>("tauIDSource", edm::InputTag(), true) xor
00442                  edm::ParameterDescription<edm::ParameterSetDescription>("tauIDSources", tauIDSourcesPSet, true)
00443                )->setComment("input with electron ID variables");
00444 
00445   // IsoDeposit configurables
00446   edm::ParameterSetDescription isoDepositsPSet;
00447   isoDepositsPSet.addOptional<edm::InputTag>("tracker"); 
00448   isoDepositsPSet.addOptional<edm::InputTag>("ecal");
00449   isoDepositsPSet.addOptional<edm::InputTag>("hcal");
00450   isoDepositsPSet.addOptional<edm::InputTag>("pfAllParticles");
00451   isoDepositsPSet.addOptional<edm::InputTag>("pfChargedHadron");
00452   isoDepositsPSet.addOptional<edm::InputTag>("pfNeutralHadron");
00453   isoDepositsPSet.addOptional<edm::InputTag>("pfGamma");
00454   isoDepositsPSet.addOptional<std::vector<edm::InputTag> >("user");
00455   iDesc.addOptional("isoDeposits", isoDepositsPSet);
00456 
00457   // Efficiency configurables
00458   edm::ParameterSetDescription efficienciesPSet;
00459   efficienciesPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
00460   iDesc.add("efficiencies", efficienciesPSet);
00461   iDesc.add<bool>("addEfficiencies", false);
00462 
00463   // Check to see if the user wants to add user data
00464   edm::ParameterSetDescription userDataPSet;
00465   PATUserDataHelper<Tau>::fillDescription(userDataPSet);
00466   iDesc.addOptional("userData", userDataPSet);
00467 
00468   edm::ParameterSetDescription isolationPSet;
00469   isolationPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
00470   iDesc.add("userIsolation", isolationPSet);
00471 
00472 }
00473 
00474 #include "FWCore/Framework/interface/MakerMacros.h"
00475 
00476 DEFINE_FWK_MODULE(PATTauProducer);
00477 
00478