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 Member Functions | Private Attributes
PixelTrackProducer Class Reference

#include <PixelTrackProducer.h>

Inheritance diagram for PixelTrackProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (const edm::Run &run, const edm::EventSetup &es) override
 
virtual void endRun (const edm::Run &run, const edm::EventSetup &es) override
 
 PixelTrackProducer (const edm::ParameterSet &conf)
 
virtual void produce (edm::Event &ev, const edm::EventSetup &es) override
 
 ~PixelTrackProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void store (edm::Event &ev, const pixeltrackfitting::TracksWithTTRHs &selectedTracks)
 

Private Attributes

PixelTrackReconstruction theReconstruction
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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 10 of file PixelTrackProducer.h.

Constructor & Destructor Documentation

PixelTrackProducer::PixelTrackProducer ( const edm::ParameterSet conf)
explicit

Definition at line 18 of file PixelTrackProducer.cc.

19  : theReconstruction(cfg)
20 {
21  edm::LogInfo("PixelTrackProducer")<<" construction...";
22  produces<reco::TrackCollection>();
23  produces<TrackingRecHitCollection>();
24  produces<reco::TrackExtraCollection>();
25 }
PixelTrackReconstruction theReconstruction
PixelTrackProducer::~PixelTrackProducer ( )

Definition at line 27 of file PixelTrackProducer.cc.

27 { }

Member Function Documentation

void PixelTrackProducer::beginRun ( const edm::Run run,
const edm::EventSetup es 
)
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 34 of file PixelTrackProducer.cc.

References PixelTrackReconstruction::init(), and theReconstruction.

35 {
37 }
void init(const edm::EventSetup &es)
PixelTrackReconstruction theReconstruction
void PixelTrackProducer::endRun ( const edm::Run run,
const edm::EventSetup es 
)
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 29 of file PixelTrackProducer.cc.

References PixelTrackReconstruction::halt(), and theReconstruction.

30 {
32 }
PixelTrackReconstruction theReconstruction
void PixelTrackProducer::produce ( edm::Event ev,
const edm::EventSetup es 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 39 of file PixelTrackProducer.cc.

References edm::EventBase::id(), LogDebug, PixelTrackReconstruction::run(), store(), theReconstruction, and testEve_cfg::tracks.

40 {
41  LogDebug("PixelTrackProducer, produce")<<"event# :"<<ev.id();
42 
44  theReconstruction.run(tracks,ev,es);
45 
46  // store tracks
47  store(ev, tracks);
48 }
#define LogDebug(id)
std::vector< TrackWithTTRHs > TracksWithTTRHs
void run(pixeltrackfitting::TracksWithTTRHs &tah, edm::Event &ev, const edm::EventSetup &es)
tuple tracks
Definition: testEve_cfg.py:39
PixelTrackReconstruction theReconstruction
edm::EventID id() const
Definition: EventBase.h:56
void store(edm::Event &ev, const pixeltrackfitting::TracksWithTTRHs &selectedTracks)
void PixelTrackProducer::store ( edm::Event ev,
const pixeltrackfitting::TracksWithTTRHs selectedTracks 
)
private

Definition at line 50 of file PixelTrackProducer.cc.

References reco::TrackExtraBase::add(), i, gen::k, LogDebug, edm::Event::put(), reco::TrackBase::setHitPattern(), SeedingHitSet::size(), and testEve_cfg::tracks.

Referenced by produce().

51 {
52  std::auto_ptr<reco::TrackCollection> tracks(new reco::TrackCollection());
53  std::auto_ptr<TrackingRecHitCollection> recHits(new TrackingRecHitCollection());
54  std::auto_ptr<reco::TrackExtraCollection> trackExtras(new reco::TrackExtraCollection());
55 
56  int cc = 0, nTracks = tracksWithHits.size();
57 
58  for (int i = 0; i < nTracks; i++)
59  {
60  reco::Track* track = tracksWithHits.at(i).first;
61  const SeedingHitSet& hits = tracksWithHits.at(i).second;
62 
63  for (unsigned int k = 0; k < hits.size(); k++)
64  {
65  TrackingRecHit *hit = hits[k]->hit()->clone();
66 
67  track->setHitPattern(*hit, k);
68  recHits->push_back(hit);
69  }
70  tracks->push_back(*track);
71  delete track;
72 
73  }
74 
75  LogDebug("TrackProducer") << "put the collection of TrackingRecHit in the event" << "\n";
77 
78 
79  for (int k = 0; k < nTracks; k++)
80  {
81  reco::TrackExtra* theTrackExtra = new reco::TrackExtra();
82 
83  //fill the TrackExtra with TrackingRecHitRef
84  unsigned int nHits = tracks->at(k).numberOfValidHits();
85  for(unsigned int i = 0; i < nHits; ++i) {
86  theTrackExtra->add(TrackingRecHitRef(ohRH,cc));
87  cc++;
88  }
89 
90  trackExtras->push_back(*theTrackExtra);
91  delete theTrackExtra;
92  }
93 
94  LogDebug("TrackProducer") << "put the collection of TrackExtra in the event" << "\n";
96 
97  for (int k = 0; k < nTracks; k++)
98  {
99  const reco::TrackExtraRef theTrackExtraRef(ohTE,k);
100  (tracks->at(k)).setExtra(theTrackExtraRef);
101  }
102 
103  ev.put(tracks);
104 
105 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
edm::Ref< TrackingRecHitCollection > TrackingRecHitRef
persistent reference to a TrackingRecHit
int k[5][pyjets_maxn]
void setHitPattern(const C &c)
set hit patterns from vector of hit references
Definition: TrackBase.h:246
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:9
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
tuple tracks
Definition: testEve_cfg.py:39
void add(const TrackingRecHitRef &r)
add a reference to a RecHit
unsigned int size() const
Definition: SeedingHitSet.h:40

Member Data Documentation

PixelTrackReconstruction PixelTrackProducer::theReconstruction
private

Definition at line 23 of file PixelTrackProducer.h.

Referenced by beginRun(), endRun(), and produce().