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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 198 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(), edm::Event::productGetter(), reco::LeafCandidate::pt(), edm::Event::put(), srcPFCandidates_, srcSubjets_, and verbosity_.

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

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().