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

Public Member Functions

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

typedef std::vector
< edm::InputTag
VInputTag
 

Private Attributes

edm::EDGetTokenT
< reco::TrackCollection
AdditionalTracks_
 
edm::EDGetTokenT< std::vector
< pat::PackedCandidate > > 
Cands_
 
edm::EDGetTokenT
< reco::VertexCollection
PVs_
 

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 27 of file TrackAndVertexUnpacker.cc.

Member Typedef Documentation

Definition at line 38 of file TrackAndVertexUnpacker.cc.

Constructor & Destructor Documentation

PATTrackAndVertexUnpacker::PATTrackAndVertexUnpacker ( const edm::ParameterSet iConfig)
explicit

Definition at line 51 of file TrackAndVertexUnpacker.cc.

51  :
52  Cands_(consumes< std::vector<pat::PackedCandidate> >(iConfig.getParameter<edm::InputTag>("packedCandidates"))),
53  PVs_(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("slimmedVertices"))),
54  AdditionalTracks_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("additionalTracks")))
55 {
56  produces<reco::TrackCollection>();
57  produces<reco::VertexCollection>();
58 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::TrackCollection > AdditionalTracks_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< std::vector< pat::PackedCandidate > > Cands_
edm::EDGetTokenT< reco::VertexCollection > PVs_
PATTrackAndVertexUnpacker::~PATTrackAndVertexUnpacker ( )

Definition at line 61 of file TrackAndVertexUnpacker.cc.

61  {
62 }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 65 of file TrackAndVertexUnpacker.cc.

References AdditionalTracks_, trackerHits::c, Cands_, pat::PackedCandidate::charge(), pat::PackedCandidate::fromPV(), edm::Event::getByToken(), i, j, pat::PackedCandidate::pseudoTrack(), pat::PackedCandidate::pt(), edm::Event::put(), PVs_, pat::PackedCandidate::PVUsedInFit, alignCSCRings::r, dt_dqm_sourceclient_common_cff::reco, and findQualityFiles::rr.

65  {
66  using namespace edm; using namespace std; using namespace reco;
68  iEvent.getByToken(Cands_, cands);
70  iEvent.getByToken(PVs_, pvs);
71  Handle<TrackCollection> addTracks;
72  iEvent.getByToken(AdditionalTracks_, addTracks);
73 
74  std::auto_ptr< std::vector<reco::Track> > outTks( new std::vector<reco::Track> );
75  std::vector<unsigned int> asso;
76  unsigned int j=0;
77  for(unsigned int i=0;i<cands->size();i++) {
78  const pat::PackedCandidate & c = (*cands)[i];
79  if(c.charge() != 0 && c.pt() > 0.95){
80  outTks->push_back(c.pseudoTrack());
82  {
83  asso.push_back(j);
84  }
85  j++;
86  }
87  }
88  reco::Vertex pv = (*pvs)[0];
89  std::auto_ptr< std::vector<reco::Vertex> > outPv( new std::vector<reco::Vertex> );
90  for(unsigned int i = 0; i < addTracks->size(); i++) {
91  outTks->push_back((*addTracks)[i]);
92  }
93  edm::OrphanHandle< std::vector<reco::Track> > oh = iEvent.put( outTks );
94  for(unsigned int i=0;i<asso.size();i++)
95  {
96  TrackRef r(oh,asso[i]);
97  TrackBaseRef rr(r);
98  pv.add(rr);
99  }
100  outPv->push_back(pv);
101  iEvent.put(outPv);
102 }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::EDGetTokenT< reco::TrackCollection > AdditionalTracks_
virtual float pt() const
transverse momentum
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
int j
Definition: DBlmapReader.cc:9
virtual int charge() const
electric charge
edm::EDGetTokenT< std::vector< pat::PackedCandidate > > Cands_
edm::EDGetTokenT< reco::VertexCollection > PVs_
const PVAssoc fromPV() const
virtual reco::Track pseudoTrack() const
Return by value (no caching heavy function) a pseudo track made with candidate kinematics, parameterized error for eta,phi,pt and full IP covariance.

Member Data Documentation

edm::EDGetTokenT<reco::TrackCollection> pat::PATTrackAndVertexUnpacker::AdditionalTracks_
private

Definition at line 42 of file TrackAndVertexUnpacker.cc.

Referenced by produce().

edm::EDGetTokenT< std::vector<pat::PackedCandidate> > pat::PATTrackAndVertexUnpacker::Cands_
private

Definition at line 40 of file TrackAndVertexUnpacker.cc.

Referenced by produce().

edm::EDGetTokenT<reco::VertexCollection> pat::PATTrackAndVertexUnpacker::PVs_
private

Definition at line 41 of file TrackAndVertexUnpacker.cc.

Referenced by produce().