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

Public Member Functions

 PATLostTracks (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~PATLostTracks ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

edm::EDGetTokenT
< reco::PFCandidateCollection
Cands_
 
double minHits_
 
double minPixelHits_
 
double minPt_
 
edm::EDGetTokenT
< reco::TrackCollection
Tracks_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 25 of file PATLostTracks.cc.

Constructor & Destructor Documentation

pat::PATLostTracks::PATLostTracks ( const edm::ParameterSet iConfig)
explicit

Definition at line 41 of file PATLostTracks.cc.

41  :
42  Cands_(consumes<reco::PFCandidateCollection>(iConfig.getParameter<edm::InputTag>("inputCandidates"))),
43  Tracks_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("inputTracks"))),
44  minPt_(iConfig.getParameter<double>("minPt")),
45  minHits_(iConfig.getParameter<uint32_t>("minHits")),
46  minPixelHits_(iConfig.getParameter<uint32_t>("minPixelHits"))
47 
48 {
49  produces< std::vector<reco::Track> > ();
50 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::PFCandidateCollection > Cands_
edm::EDGetTokenT< reco::TrackCollection > Tracks_
pat::PATLostTracks::~PATLostTracks ( )

Definition at line 52 of file PATLostTracks.cc.

52 {}

Member Function Documentation

void pat::PATLostTracks::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 54 of file PATLostTracks.cc.

References reco::LeafCandidate::charge(), edm::Event::getByToken(), i, edm::HandleBase::id(), edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::key(), edm::Event::put(), and reco::PFCandidate::trackRef().

54  {
55 
57  iEvent.getByToken( Cands_, cands );
58  std::vector<reco::Candidate>::const_iterator cand;
59 
61  iEvent.getByToken( Tracks_, Tracks );
62 
63  std::auto_ptr< std::vector<reco::Track> > outPtrP( new std::vector<reco::Track> );
64  std::vector<bool> used(Tracks->size());
65 
66 
67  for(unsigned int ic=0, nc = cands->size(); ic < nc; ++ic) {
68  const reco::PFCandidate &cand=(*cands)[ic];
69  if (cand.charge()) {
70  if(cand.trackRef().isNonnull() && cand.trackRef().id() == Tracks.id())
71  {
72  used[cand.trackRef().key()]=true;
73  }
74  }
75  }
76 
77  for(unsigned int i=0; i < used.size(); i++)
78  {
79  if(!used[i] && (*Tracks)[i].pt() > minPt_ &&
80  (*Tracks)[i].numberOfValidHits() >= minHits_ &&
81  (*Tracks)[i].hitPattern().numberOfValidPixelHits() >= minPixelHits_ ) outPtrP->push_back((*Tracks)[i]);
82  }
83 
84  iEvent.put(outPtrP);
85 
86 }
int i
Definition: DBlmapReader.cc:9
ProductID id() const
Definition: HandleBase.cc:15
edm::EDGetTokenT< reco::PFCandidateCollection > Cands_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:429
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
virtual int charge() const GCC11_FINAL
electric charge
key_type key() const
Accessor for product key.
Definition: Ref.h:266
edm::EDGetTokenT< reco::TrackCollection > Tracks_
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:38
ProductID id() const
Accessor for product ID.
Definition: Ref.h:256

Member Data Documentation

edm::EDGetTokenT<reco::PFCandidateCollection> pat::PATLostTracks::Cands_
private

Definition at line 33 of file PATLostTracks.cc.

double pat::PATLostTracks::minHits_
private

Definition at line 36 of file PATLostTracks.cc.

double pat::PATLostTracks::minPixelHits_
private

Definition at line 37 of file PATLostTracks.cc.

double pat::PATLostTracks::minPt_
private

Definition at line 35 of file PATLostTracks.cc.

edm::EDGetTokenT<reco::TrackCollection> pat::PATLostTracks::Tracks_
private

Definition at line 34 of file PATLostTracks.cc.