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
RecoTrackAccumulator Class Reference

#include <RecoTrackAccumulator.h>

Inheritance diagram for RecoTrackAccumulator:
DigiAccumulatorMixMod

Public Member Functions

virtual void accumulate (edm::Event const &e, edm::EventSetup const &c)
 
virtual void accumulate (PileUpEventPrincipal const &e, edm::EventSetup const &c, edm::StreamID const &) override
 
virtual void finalizeEvent (edm::Event &e, edm::EventSetup const &c)
 
virtual void initializeEvent (edm::Event const &e, edm::EventSetup const &c)
 
 RecoTrackAccumulator (const edm::ParameterSet &conf, edm::one::EDProducerBase &mixMod, edm::ConsumesCollector &iC)
 
virtual ~RecoTrackAccumulator ()
 
- Public Member Functions inherited from DigiAccumulatorMixMod
virtual void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup)
 
virtual void beginRun (edm::Run const &run, edm::EventSetup const &setup)
 
 DigiAccumulatorMixMod ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup)
 
virtual void endRun (edm::Run const &run, edm::EventSetup const &setup)
 
virtual void finalizeBunchCrossing (edm::Event &event, edm::EventSetup const &setup, int bunchCrossing)
 
virtual PileupMixingContentgetEventPileupInfo ()
 
virtual void initializeBunchCrossing (edm::Event const &event, edm::EventSetup const &setup, int bunchCrossing)
 
virtual void StorePileupInformation (std::vector< int > &numInteractionList, std::vector< int > &bunchCrossingList, std::vector< float > &TrueInteractionList, std::vector< edm::EventID > &eventList, int bunchSpace)
 
virtual ~DigiAccumulatorMixMod ()
 

Private Member Functions

template<class T >
void accumulateEvent (const T &e, edm::EventSetup const &c)
 

Private Attributes

std::string GeneralTrackExtraOutput_
 
std::string GeneralTrackOutput_
 
std::string HitOutput_
 
edm::InputTag Input_
 
std::auto_ptr
< TrackingRecHitCollection
NewHitList_
 
std::auto_ptr
< reco::TrackExtraCollection
NewTrackExtraList_
 
std::auto_ptr
< reco::TrackCollection
NewTrackList_
 
TrackingRecHitRefProd rHits
 
reco::TrackExtraRefProd rTrackExtras
 

Detailed Description

RecoTrackAccumulator accumulates generalTracks from the hard and the pileup events

Author
Andrea Giammanco
Version
Mar 11 2013

Definition at line 37 of file RecoTrackAccumulator.h.

Constructor & Destructor Documentation

RecoTrackAccumulator::RecoTrackAccumulator ( const edm::ParameterSet conf,
edm::one::EDProducerBase mixMod,
edm::ConsumesCollector iC 
)
explicit

Definition at line 6 of file RecoTrackAccumulator.cc.

References edm::ConsumesCollector::consumes(), GeneralTrackExtraOutput_, GeneralTrackOutput_, HitOutput_, and Input_.

6  :
7  Input_(conf.getParameter<edm::InputTag>("Input")),
8  GeneralTrackOutput_(conf.getParameter<std::string>("GeneralTrackOutput")),
9  HitOutput_(conf.getParameter<std::string>("HitOutput")),
10  GeneralTrackExtraOutput_(conf.getParameter<std::string>("GeneralTrackExtraOutput"))
11 {
12 
14  mixMod.produces<TrackingRecHitCollection>(HitOutput_);
16 
20 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:13
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
std::string GeneralTrackExtraOutput_
RecoTrackAccumulator::~RecoTrackAccumulator ( )
virtual

Definition at line 22 of file RecoTrackAccumulator.cc.

22  {
23 
24 }

Member Function Documentation

void RecoTrackAccumulator::accumulate ( edm::Event const &  e,
edm::EventSetup const &  c 
)
virtual

Implements DigiAccumulatorMixMod.

Definition at line 38 of file RecoTrackAccumulator.cc.

References accumulateEvent().

38  {
39  accumulateEvent( e, iSetup);
40 }
void accumulateEvent(const T &e, edm::EventSetup const &c)
void RecoTrackAccumulator::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c,
edm::StreamID const &   
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 42 of file RecoTrackAccumulator.cc.

References accumulateEvent(), and PileUpEventPrincipal::bunchCrossing().

42  {
43  if (e.bunchCrossing()==0) {
44  accumulateEvent( e, iSetup);
45  }
46 }
void accumulateEvent(const T &e, edm::EventSetup const &c)
template<class T >
void RecoTrackAccumulator::accumulateEvent ( const T e,
edm::EventSetup const &  c 
)
private

Definition at line 57 of file RecoTrackAccumulator.cc.

References cmsRelvalreport::exit, i, Input_, NewHitList_, NewTrackExtraList_, NewTrackList_, rHits, rTrackExtras, and testEve_cfg::tracks.

Referenced by accumulate().

57  {
58 
62  if(!(e.getByLabel(Input_, tracks) and e.getByLabel(Input_, hits) and e.getByLabel(Input_, trackExtras))){
63  edm::LogError ("Failed to find track, hit or trackExtra collections");
64  exit(1);
65  }
66  // check validaity here
67 
68  for (auto const& track : *tracks) {
69  NewTrackList_->push_back(track);
70  // track extras:
71  auto const& extra = trackExtras->at(track.extra().key());
72  NewTrackExtraList_->emplace_back(extra.outerPosition(), extra.outerMomentum(), extra.outerOk(),
73  extra.innerPosition(),extra.innerMomentum(), extra.innerOk(),
74  extra.outerStateCovariance(), extra.outerDetId(),
75  extra.innerStateCovariance(), extra.innerDetId(),
76  extra.seedDirection(),
77  //If TrajectorySeeds are needed, then their list must be gotten from the
78  // secondary event directly and looked up similarly to TrackExtras.
79  //We can't use a default constructed RefToBase due to a bug in RefToBase
80  // which causes an seg fault when calling isAvailable on a default constructed one.
82  NewTrackList_->back().setExtra( reco::TrackExtraRef( rTrackExtras, NewTrackExtraList_->size() - 1) );
83  // rechits:
84  // note: extra.recHit(i) does not work for pileup events
85  // probably the Ref does not know its product id applies on a pileup event
86  auto & newExtra = NewTrackExtraList_->back();
87  auto const firstTrackIndex = NewHitList_->size();
88  for(unsigned int i = 0;i<extra.recHitsSize();i++){
89  NewHitList_->push_back( (*hits)[extra.recHit(i).key()] );
90  }
91  newExtra.setHits( rHits, firstTrackIndex, NewHitList_->size() - firstTrackIndex);
92  }
93 
94 }
int i
Definition: DBlmapReader.cc:9
std::auto_ptr< TrackingRecHitCollection > NewHitList_
std::auto_ptr< reco::TrackCollection > NewTrackList_
TrackingRecHitRefProd rHits
std::auto_ptr< reco::TrackExtraCollection > NewTrackExtraList_
tuple tracks
Definition: testEve_cfg.py:39
reco::TrackExtraRefProd rTrackExtras
void RecoTrackAccumulator::finalizeEvent ( edm::Event e,
edm::EventSetup const &  c 
)
virtual

Implements DigiAccumulatorMixMod.

Definition at line 48 of file RecoTrackAccumulator.cc.

References GeneralTrackExtraOutput_, GeneralTrackOutput_, HitOutput_, NewHitList_, NewTrackExtraList_, NewTrackList_, and edm::Event::put().

48  {
49 
53 
54 }
std::auto_ptr< TrackingRecHitCollection > NewHitList_
std::auto_ptr< reco::TrackCollection > NewTrackList_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
std::auto_ptr< reco::TrackExtraCollection > NewTrackExtraList_
std::string GeneralTrackExtraOutput_
void RecoTrackAccumulator::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
)
virtual

Implements DigiAccumulatorMixMod.

Definition at line 26 of file RecoTrackAccumulator.cc.

References alignCSCRings::e, GeneralTrackExtraOutput_, HitOutput_, NewHitList_, NewTrackExtraList_, NewTrackList_, rHits, and rTrackExtras.

26  {
27 
28  NewTrackList_ = std::auto_ptr<reco::TrackCollection>(new reco::TrackCollection());
29  NewHitList_ = std::auto_ptr<TrackingRecHitCollection>(new TrackingRecHitCollection());
30  NewTrackExtraList_ = std::auto_ptr<reco::TrackExtraCollection>(new reco::TrackExtraCollection());
31 
32  // this is needed to get the ProductId of the TrackExtra and TrackingRecHit collections
33  rTrackExtras=const_cast<edm::Event&>( e ).getRefBeforePut<reco::TrackExtraCollection>(GeneralTrackExtraOutput_);
34  rHits=const_cast<edm::Event&>( e ).getRefBeforePut<TrackingRecHitCollection>(HitOutput_);
35 
36 }
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:13
std::auto_ptr< TrackingRecHitCollection > NewHitList_
std::auto_ptr< reco::TrackCollection > NewTrackList_
TrackingRecHitRefProd rHits
std::auto_ptr< reco::TrackExtraCollection > NewTrackExtraList_
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
reco::TrackExtraRefProd rTrackExtras
std::string GeneralTrackExtraOutput_

Member Data Documentation

std::string RecoTrackAccumulator::GeneralTrackExtraOutput_
private

Definition at line 62 of file RecoTrackAccumulator.h.

Referenced by finalizeEvent(), initializeEvent(), and RecoTrackAccumulator().

std::string RecoTrackAccumulator::GeneralTrackOutput_
private

Definition at line 60 of file RecoTrackAccumulator.h.

Referenced by finalizeEvent(), and RecoTrackAccumulator().

std::string RecoTrackAccumulator::HitOutput_
private

Definition at line 61 of file RecoTrackAccumulator.h.

Referenced by finalizeEvent(), initializeEvent(), and RecoTrackAccumulator().

edm::InputTag RecoTrackAccumulator::Input_
private

Definition at line 58 of file RecoTrackAccumulator.h.

Referenced by accumulateEvent(), and RecoTrackAccumulator().

std::auto_ptr<TrackingRecHitCollection> RecoTrackAccumulator::NewHitList_
private

Definition at line 53 of file RecoTrackAccumulator.h.

Referenced by accumulateEvent(), finalizeEvent(), and initializeEvent().

std::auto_ptr<reco::TrackExtraCollection> RecoTrackAccumulator::NewTrackExtraList_
private

Definition at line 52 of file RecoTrackAccumulator.h.

Referenced by accumulateEvent(), finalizeEvent(), and initializeEvent().

std::auto_ptr<reco::TrackCollection> RecoTrackAccumulator::NewTrackList_
private

Definition at line 51 of file RecoTrackAccumulator.h.

Referenced by accumulateEvent(), finalizeEvent(), and initializeEvent().

TrackingRecHitRefProd RecoTrackAccumulator::rHits
private

Definition at line 56 of file RecoTrackAccumulator.h.

Referenced by accumulateEvent(), and initializeEvent().

reco::TrackExtraRefProd RecoTrackAccumulator::rTrackExtras
private

Definition at line 55 of file RecoTrackAccumulator.h.

Referenced by accumulateEvent(), and initializeEvent().