CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/PhysicsTools/PatAlgos/plugins/PATTauProducer.cc

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