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 Attributes
IsoTracks Class Reference
Inheritance diagram for IsoTracks:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 IsoTracks (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
virtual ~IsoTracks ()
 
- 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 Attributes

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

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 21 of file IsoTracks.cc.

Constructor & Destructor Documentation

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

Definition at line 45 of file IsoTracks.cc.

Referenced by produce().

46  : coneRadius_ ( iConfig.getParameter<double>( "radius" ) )
47  , threshold_ ( iConfig.getParameter<double>( "SumPtFraction" ) )
48  , v_recoTrackToken_( consumes< std::vector<reco::Track> >( iConfig.getParameter<edm::InputTag>( "src" ) ) )
49 {
50  produces<std::vector<reco::Track> >();
51 }
T getParameter(std::string const &) const
double coneRadius_
Definition: IsoTracks.cc:33
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< std::vector< reco::Track > > v_recoTrackToken_
Definition: IsoTracks.cc:35
double threshold_
Definition: IsoTracks.cc:34
IsoTracks::~IsoTracks ( )
virtual

Definition at line 54 of file IsoTracks.cc.

54 {}

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 61 of file IsoTracks.cc.

References coneRadius_, deltaR(), eta, edm::Event::getByToken(), IsoTracks(), phi, EnergyCorrector::pt, edm::Event::put(), reco::return(), threshold_, and v_recoTrackToken_.

62 {
63 
64  std::auto_ptr<std::vector<reco::Track> > IsoTracks(new std::vector<reco::Track >);
65 
67  iEvent.getByToken( v_recoTrackToken_, dirtyTracks );
68 
69  if( dirtyTracks->size() == 0 )
70  {
71  iEvent.put(IsoTracks);
72  return ;
73  }
74 
75  std::vector<reco::Track>::const_iterator dirtyTrackIt ;
76  std::vector<reco::Track>::const_iterator dirtyTrackIt2 ;
77 // typename std::vector<reco::Track>::const_iterator dirtyTrackIt ;
78 // typename std::vector<reco::Track>::const_iterator dirtyTrackIt2 ;
79  double sumPtInCone = 0 ;
80 
81  for ( dirtyTrackIt = dirtyTracks->begin(); dirtyTrackIt != dirtyTracks->end(); ++dirtyTrackIt ) {
82  for ( dirtyTrackIt2 = dirtyTracks->begin(); dirtyTrackIt2 != dirtyTracks->end(); ++dirtyTrackIt2 ) {
83  if ( dirtyTrackIt == dirtyTrackIt2) continue ;
84  if ( deltaR(dirtyTrackIt -> eta() ,
85  dirtyTrackIt -> phi() ,
86  dirtyTrackIt2 -> eta() ,
87  dirtyTrackIt2 -> phi() ) < coneRadius_ ){
88  sumPtInCone = sumPtInCone + dirtyTrackIt2 -> pt() ;
89  }
90  }
91  if ( sumPtInCone <= threshold_*(dirtyTrackIt->pt()) ){
92  IsoTracks -> push_back( *dirtyTrackIt ) ;
93  }
94  }
95  iEvent.put(IsoTracks);
96 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
IsoTracks(const edm::ParameterSet &iConfig)
Definition: IsoTracks.cc:45
double coneRadius_
Definition: IsoTracks.cc:33
edm::EDGetTokenT< std::vector< reco::Track > > v_recoTrackToken_
Definition: IsoTracks.cc:35
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
return(e1-e2)*(e1-e2)+dp *dp
double threshold_
Definition: IsoTracks.cc:34

Member Data Documentation

double IsoTracks::coneRadius_
private

Definition at line 33 of file IsoTracks.cc.

Referenced by produce().

double IsoTracks::threshold_
private

Definition at line 34 of file IsoTracks.cc.

Referenced by produce().

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

Definition at line 35 of file IsoTracks.cc.

Referenced by produce().