CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
IsoTracks Class Reference
Inheritance diagram for IsoTracks:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 IsoTracks (edm::ParameterSet const &)
 
void produce (edm::StreamID, edm::Event &, edm::EventSetup const &) const override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

double coneRadius_
 
double threshold_
 
edm::EDGetTokenT< std::vector< reco::Track > > v_recoTrackToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase 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::global::EDProducerBase
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 16 of file IsoTracks.cc.

Constructor & Destructor Documentation

IsoTracks::IsoTracks ( edm::ParameterSet const &  iConfig)
explicit

Definition at line 33 of file IsoTracks.cc.

References edm::ParameterSet::getParameter(), threshold_, and v_recoTrackToken_.

34  : coneRadius_{iConfig.getParameter<double>("radius")}
35  , threshold_{iConfig.getParameter<double>("SumPtFraction")}
36  , v_recoTrackToken_{consumes<std::vector<reco::Track>>(iConfig.getParameter<edm::InputTag>("src"))}
37 {
38  produces<std::vector<reco::Track>>();
39 }
double coneRadius_
Definition: IsoTracks.cc:24
edm::EDGetTokenT< std::vector< reco::Track > > v_recoTrackToken_
Definition: IsoTracks.cc:26
double threshold_
Definition: IsoTracks.cc:25

Member Function Documentation

void IsoTracks::produce ( edm::StreamID  ,
edm::Event iEvent,
edm::EventSetup const &   
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 46 of file IsoTracks.cc.

References coneRadius_, DEFINE_FWK_MODULE, deltaR(), edm::Event::getByToken(), eostools::move(), EnergyCorrector::pt, edm::Event::put(), and v_recoTrackToken_.

47 {
48  auto isoTracks = std::make_unique<std::vector<reco::Track>>();
49 
51  iEvent.getByToken(v_recoTrackToken_, dirtyTracks);
52 
53  if (dirtyTracks->empty()) {
54  iEvent.put(std::move(isoTracks));
55  return;
56  }
57 
58  double sumPtInCone {};
59  for (auto it1 = dirtyTracks->begin(); it1 != dirtyTracks->end(); ++it1) {
60  for (auto it2 = dirtyTracks->begin(); it2 != dirtyTracks->end(); ++it2) {
61  if (it1 == it2) continue;
62  if (deltaR(it1->eta(), it1->phi(), it2->eta(), it2->phi()) < coneRadius_) {
63  sumPtInCone += it2->pt();
64  }
65  }
66  if (sumPtInCone <= threshold_*it1->pt()) {
67  isoTracks->push_back(*it1);
68  }
69  }
70 
71  iEvent.put(std::move(isoTracks));
72 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
double coneRadius_
Definition: IsoTracks.cc:24
edm::EDGetTokenT< std::vector< reco::Track > > v_recoTrackToken_
Definition: IsoTracks.cc:26
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

double IsoTracks::coneRadius_
private

Definition at line 24 of file IsoTracks.cc.

Referenced by produce().

double IsoTracks::threshold_
private

Definition at line 25 of file IsoTracks.cc.

Referenced by IsoTracks().

edm::EDGetTokenT<std::vector<reco::Track> > IsoTracks::v_recoTrackToken_
private

Definition at line 26 of file IsoTracks.cc.

Referenced by IsoTracks(), and produce().