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, const edm::InputTag &label)
 

Private Attributes

std::auto_ptr
< TrackingRecHitCollection
newHits_
 
std::auto_ptr
< reco::TrackExtraCollection
newTrackExtras_
 
std::auto_ptr
< reco::TrackCollection
newTracks_
 
std::string outputLabel
 
edm::InputTag pileUpTracksTag
 
TrackingRecHitRefProd rNewHits
 
reco::TrackExtraRefProd rNewTrackExtras
 
reco::TrackRefProd rNewTracks
 
edm::InputTag signalTracksTag
 

Detailed Description

RecoTrackAccumulator accumulates generalTracks from the hard and the pileup events

Author
Andrea Giammanco
Version
Mar 11 2013

Definition at line 36 of file RecoTrackAccumulator.h.

Constructor & Destructor Documentation

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

Definition at line 9 of file RecoTrackAccumulator.cc.

References edm::ConsumesCollector::consumes(), outputLabel, and signalTracksTag.

9  :
10  signalTracksTag(conf.getParameter<edm::InputTag>("signalTracks")),
11  pileUpTracksTag(conf.getParameter<edm::InputTag>("pileUpTracks")),
12  outputLabel(conf.getParameter<std::string>("outputLabel"))
13 {
14  mixMod.produces<reco::TrackCollection>(outputLabel);
15  mixMod.produces<TrackingRecHitCollection>(outputLabel);
16  mixMod.produces<reco::TrackExtraCollection>(outputLabel);
17 
21 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
RecoTrackAccumulator::~RecoTrackAccumulator ( )
virtual

Definition at line 23 of file RecoTrackAccumulator.cc.

23  {
24 
25 }

Member Function Documentation

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

Implements DigiAccumulatorMixMod.

Definition at line 39 of file RecoTrackAccumulator.cc.

References accumulateEvent(), and signalTracksTag.

39  {
41 }
void accumulateEvent(const T &e, edm::EventSetup const &c, const edm::InputTag &label)
void RecoTrackAccumulator::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c,
edm::StreamID const &   
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 43 of file RecoTrackAccumulator.cc.

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

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

Definition at line 57 of file RecoTrackAccumulator.cc.

References cmsRelvalreport::exit, reco::Track::extra(), i, edm::Ref< C, T, F >::key(), diffTwoXMLs::label, newHits_, newTrackExtras_, newTracks_, rNewHits, rNewTrackExtras, lumiQTWidget::t, and testEve_cfg::tracks.

Referenced by accumulate().

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

Implements DigiAccumulatorMixMod.

Definition at line 49 of file RecoTrackAccumulator.cc.

References newHits_, newTrackExtras_, newTracks_, outputLabel, and edm::Event::put().

49  {
50 
52  e.put( newHits_, outputLabel );
54 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
std::auto_ptr< reco::TrackExtraCollection > newTrackExtras_
std::auto_ptr< TrackingRecHitCollection > newHits_
std::auto_ptr< reco::TrackCollection > newTracks_
void RecoTrackAccumulator::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
)
virtual

Implements DigiAccumulatorMixMod.

Definition at line 27 of file RecoTrackAccumulator.cc.

References alignCSCRings::e, newHits_, newTrackExtras_, newTracks_, outputLabel, rNewHits, rNewTrackExtras, and rNewTracks.

27  {
28 
29  newTracks_ = std::auto_ptr<reco::TrackCollection>(new reco::TrackCollection);
30  newHits_ = std::auto_ptr<TrackingRecHitCollection>(new TrackingRecHitCollection);
31  newTrackExtras_ = std::auto_ptr<reco::TrackExtraCollection>(new reco::TrackExtraCollection);
32 
33  // this is needed to get the ProductId of the TrackExtra and TrackingRecHit and Track collections
34  rNewTracks=const_cast<edm::Event&>( e ).getRefBeforePut<reco::TrackCollection>(outputLabel);
35  rNewTrackExtras=const_cast<edm::Event&>( e ).getRefBeforePut<reco::TrackExtraCollection>(outputLabel);
36  rNewHits=const_cast<edm::Event&>( e ).getRefBeforePut<TrackingRecHitCollection>(outputLabel);
37 }
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
TrackingRecHitRefProd rNewHits
reco::TrackRefProd rNewTracks
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
std::auto_ptr< reco::TrackExtraCollection > newTrackExtras_
std::auto_ptr< TrackingRecHitCollection > newHits_
std::auto_ptr< reco::TrackCollection > newTracks_
reco::TrackExtraRefProd rNewTrackExtras

Member Data Documentation

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

Definition at line 53 of file RecoTrackAccumulator.h.

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

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

Definition at line 52 of file RecoTrackAccumulator.h.

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

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

Definition at line 51 of file RecoTrackAccumulator.h.

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

std::string RecoTrackAccumulator::outputLabel
private

Definition at line 62 of file RecoTrackAccumulator.h.

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

edm::InputTag RecoTrackAccumulator::pileUpTracksTag
private

Definition at line 60 of file RecoTrackAccumulator.h.

Referenced by accumulate().

TrackingRecHitRefProd RecoTrackAccumulator::rNewHits
private

Definition at line 57 of file RecoTrackAccumulator.h.

Referenced by accumulateEvent(), and initializeEvent().

reco::TrackExtraRefProd RecoTrackAccumulator::rNewTrackExtras
private

Definition at line 56 of file RecoTrackAccumulator.h.

Referenced by accumulateEvent(), and initializeEvent().

reco::TrackRefProd RecoTrackAccumulator::rNewTracks
private

Definition at line 55 of file RecoTrackAccumulator.h.

Referenced by initializeEvent().

edm::InputTag RecoTrackAccumulator::signalTracksTag
private

Definition at line 59 of file RecoTrackAccumulator.h.

Referenced by accumulate(), and RecoTrackAccumulator().