test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Attributes
BoostedTauSeedsProducer Class Reference
Inheritance diagram for BoostedTauSeedsProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 BoostedTauSeedsProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~BoostedTauSeedsProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef edm::AssociationMap
< edm::OneToMany< std::vector
< reco::PFJet >, std::vector
< reco::PFCandidate >
, unsigned int > > 
JetToPFCandidateAssociation
 
typedef edm::View< reco::JetJetView
 

Private Attributes

std::string moduleLabel_
 
edm::EDGetTokenT
< reco::PFCandidateCollection
srcPFCandidates_
 
edm::EDGetTokenT< JetViewsrcSubjets_
 
int verbosity_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 45 of file BoostedTauSeedsProducer.cc.

Member Typedef Documentation

Definition at line 53 of file BoostedTauSeedsProducer.cc.

Definition at line 57 of file BoostedTauSeedsProducer.cc.

Constructor & Destructor Documentation

BoostedTauSeedsProducer::BoostedTauSeedsProducer ( const edm::ParameterSet cfg)
explicit

Definition at line 64 of file BoostedTauSeedsProducer.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), srcPFCandidates_, srcSubjets_, and verbosity_.

65  : moduleLabel_(cfg.getParameter<std::string>("@module_label"))
66 {
67  srcSubjets_ = consumes<JetView>(cfg.getParameter<edm::InputTag>("subjetSrc"));
68  srcPFCandidates_ = consumes<reco::PFCandidateCollection>(cfg.getParameter<edm::InputTag>("pfCandidateSrc"));
69 
70  verbosity_ = ( cfg.exists("verbosity") ) ?
71  cfg.getParameter<int>("verbosity") : 0;
72 
73  produces<reco::PFJetCollection>();
74  produces<JetToPFCandidateAssociation>("pfCandAssocMapForIsolation");
75  produces<JetToPFCandidateAssociation>("pfCandAssocMapForIsoDepositVetos");
76 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidates_
edm::EDGetTokenT< JetView > srcSubjets_
BoostedTauSeedsProducer::~BoostedTauSeedsProducer ( )
inline

Definition at line 49 of file BoostedTauSeedsProducer.cc.

49 {}

Member Function Documentation

void BoostedTauSeedsProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 196 of file BoostedTauSeedsProducer.cc.

References assert(), gather_cfg::cout, alignCSCRings::e, reco::LeafCandidate::eta(), edm::Event::getByToken(), edm::Event::getRefBeforePut(), customizeTrackingMonitorSeedNumber::idx, reco::Jet::jetArea(), reco::LeafCandidate::mass(), moduleLabel_, reco::Jet::nConstituents(), reco::tau::pfCandidates(), reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), edm::Event::put(), srcPFCandidates_, srcSubjets_, and verbosity_.

197 {
198  if ( verbosity_ >= 1 ) {
199  std::cout << "<BoostedTauSeedsProducer::produce (moduleLabel = " << moduleLabel_ << ")>:" << std::endl;
200  }
201 
202  edm::Handle<JetView> subjets;
203  evt.getByToken(srcSubjets_, subjets);
204  if ( verbosity_ >= 1 ) {
205  std::cout << "#subjets = " << subjets->size() << std::endl;
206  }
207  assert((subjets->size() % 2) == 0); // CV: ensure that subjets come in pairs
208 
210  evt.getByToken(srcPFCandidates_, pfCandidates);
211  if ( verbosity_ >= 1 ) {
212  std::cout << "#pfCandidates = " << pfCandidates->size() << std::endl;
213  }
214 
215  std::auto_ptr<reco::PFJetCollection> selectedSubjets(new reco::PFJetCollection());
217 
218  std::auto_ptr<JetToPFCandidateAssociation> selectedSubjetPFCandidateAssociationForIsolation(new JetToPFCandidateAssociation());
219  std::auto_ptr<JetToPFCandidateAssociation> selectedSubjetPFCandidateAssociationForIsoDepositVetos(new JetToPFCandidateAssociation());
220 
221  for ( size_t idx = 0; idx < (subjets->size() / 2); ++idx ) {
222  const reco::Jet* subjet1 = &subjets->at(2*idx);
223  const reco::Jet* subjet2 = &subjets->at(2*idx + 1);
224  assert(subjet1 && subjet2);
225  if ( verbosity_ >= 1 ) {
226  std::cout << "processing jet #" << idx << ":" << std::endl;
227  std::cout << " subjet1: Pt = " << subjet1->pt() << ", eta = " << subjet1->eta() << ", phi = " << subjet1->phi() << ", mass = " << subjet1->mass()
228  << " (#constituents = " << subjet1->nConstituents() << ", area = " << subjet1->jetArea() << ")" << std::endl;
229  std::cout << " subjet2: Pt = " << subjet2->pt() << ", eta = " << subjet2->eta() << ", phi = " << subjet2->phi() << ", mass = " << subjet2->mass()
230  << " (#constituents = " << subjet2->nConstituents() << ", area = " << subjet2->jetArea() << ")" << std::endl;
231  }
232 
233  if ( !(subjet1->nConstituents() >= 1 && subjet1->pt() > 1. &&
234  subjet2->nConstituents() >= 1 && subjet2->pt() > 1.) ) continue; // CV: skip pathological cases
235 
236  // find PFCandidate constituents of each subjet
237  reco::Jet::Constituents subjetConstituents1;
238  getJetConstituents(*subjet1, subjetConstituents1);
239  reco::Jet::Constituents subjetConstituents2;
240  getJetConstituents(*subjet2, subjetConstituents2);
241  if ( verbosity_ >= 1 ) {
242  printJetConstituents("subjetConstituents1", subjetConstituents1);
243  printJetConstituents("subjetConstituents2", subjetConstituents2);
244  }
245 
246  selectedSubjets->push_back(convertToPFJet(*subjet1, subjetConstituents1));
247  edm::Ref<reco::PFJetCollection> subjetRef1(selectedSubjetRefProd, selectedSubjets->size() - 1);
248  selectedSubjets->push_back(convertToPFJet(*subjet2, subjetConstituents2));
249  edm::Ref<reco::PFJetCollection> subjetRef2(selectedSubjetRefProd, selectedSubjets->size() - 1);
250 
251  // find all PFCandidates that are not constituents of the **other** subjet
252  std::vector<reco::PFCandidateRef> pfCandidatesNotInSubjet1 = getPFCandidates_exclJetConstituents(pfCandidates, subjetConstituents2, 1.e-4, false);
253  std::vector<reco::PFCandidateRef> pfCandidatesNotInSubjet2 = getPFCandidates_exclJetConstituents(pfCandidates, subjetConstituents1, 1.e-4, false);
254  if ( verbosity_ >= 1 ) {
255  std::cout << "#pfCandidatesNotInSubjet1 = " << pfCandidatesNotInSubjet1.size() << std::endl;
256  std::cout << "#pfCandidatesNotInSubjet2 = " << pfCandidatesNotInSubjet2.size() << std::endl;
257  }
258 
259  // build JetToPFCandidateAssociation
260  // (key = subjet, value = collection of PFCandidates that are not constituents of subjet)
261  BOOST_FOREACH( const reco::PFCandidateRef& pfCandidate, pfCandidatesNotInSubjet1 ) {
262  selectedSubjetPFCandidateAssociationForIsolation->insert(subjetRef1, pfCandidate);
263  }
264  BOOST_FOREACH( const reco::PFCandidateRef& pfCandidate, pfCandidatesNotInSubjet2 ) {
265  selectedSubjetPFCandidateAssociationForIsolation->insert(subjetRef2, pfCandidate);
266  }
267 
268  // find all PFCandidates that are constituents of the **other** subjet
269  std::vector<reco::PFCandidateRef> pfCandidatesInSubjet1 = getPFCandidates_exclJetConstituents(pfCandidates, subjetConstituents2, 1.e-4, true);
270  std::vector<reco::PFCandidateRef> pfCandidatesInSubjet2 = getPFCandidates_exclJetConstituents(pfCandidates, subjetConstituents1, 1.e-4, true);
271  if ( verbosity_ >= 1 ) {
272  std::cout << "#pfCandidatesInSubjet1 = " << pfCandidatesInSubjet1.size() << std::endl;
273  std::cout << "#pfCandidatesInSubjet2 = " << pfCandidatesInSubjet2.size() << std::endl;
274  }
275 
276  BOOST_FOREACH( const reco::PFCandidateRef& pfCandidate, pfCandidatesInSubjet1 ) {
277  selectedSubjetPFCandidateAssociationForIsoDepositVetos->insert(subjetRef1, pfCandidate);
278  }
279  BOOST_FOREACH( const reco::PFCandidateRef& pfCandidate, pfCandidatesInSubjet2 ) {
280  selectedSubjetPFCandidateAssociationForIsoDepositVetos->insert(subjetRef2, pfCandidate);
281  }
282  }
283 
284  evt.put(selectedSubjets);
285  evt.put(selectedSubjetPFCandidateAssociationForIsolation, "pfCandAssocMapForIsolation");
286  evt.put(selectedSubjetPFCandidateAssociationForIsoDepositVetos, "pfCandAssocMapForIsoDepositVetos");
287 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
Base class for all types of Jets.
Definition: Jet.h:20
assert(m_qm.get())
std::vector< Constituent > Constituents
Definition: Jet.h:23
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
virtual double mass() const
mass
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidates_
RefProd< PROD > getRefBeforePut()
Definition: Event.h:140
edm::AssociationMap< edm::OneToMany< std::vector< reco::PFJet >, std::vector< reco::PFCandidate >, unsigned int > > JetToPFCandidateAssociation
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
std::vector< PFJet > PFJetCollection
collection of PFJet objects
virtual float jetArea() const
get jet area
Definition: Jet.h:105
virtual int nConstituents() const
of constituents
Definition: Jet.h:65
edm::EDGetTokenT< JetView > srcSubjets_
tuple cout
Definition: gather_cfg.py:121
virtual double phi() const
momentum azimuthal angle

Member Data Documentation

std::string BoostedTauSeedsProducer::moduleLabel_
private
edm::EDGetTokenT<reco::PFCandidateCollection> BoostedTauSeedsProducer::srcPFCandidates_
private

Definition at line 59 of file BoostedTauSeedsProducer.cc.

Referenced by BoostedTauSeedsProducer(), and produce().

edm::EDGetTokenT<JetView> BoostedTauSeedsProducer::srcSubjets_
private

Definition at line 58 of file BoostedTauSeedsProducer.cc.

Referenced by BoostedTauSeedsProducer(), and produce().

int BoostedTauSeedsProducer::verbosity_
private

Definition at line 61 of file BoostedTauSeedsProducer.cc.

Referenced by BoostedTauSeedsProducer(), and produce().