CMS 3D CMS Logo

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

void accumulate (edm::Event const &e, edm::EventSetup const &c) override
 
void accumulate (PileUpEventPrincipal const &e, edm::EventSetup const &c, edm::StreamID const &) override
 
void finalizeEvent (edm::Event &e, edm::EventSetup const &c) override
 
void initializeEvent (edm::Event const &e, edm::EventSetup const &c) override
 
 RecoTrackAccumulator (const edm::ParameterSet &conf, edm::ProducesCollector, edm::ConsumesCollector &iC)
 
 ~RecoTrackAccumulator () override
 
- 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::unique_ptr< TrackingRecHitCollectionnewHits_
 
std::unique_ptr< reco::TrackExtraCollectionnewTrackExtras_
 
std::unique_ptr< reco::TrackCollectionnewTracks_
 
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 33 of file RecoTrackAccumulator.h.

Constructor & Destructor Documentation

◆ RecoTrackAccumulator()

RecoTrackAccumulator::RecoTrackAccumulator ( const edm::ParameterSet conf,
edm::ProducesCollector  producesCollector,
edm::ConsumesCollector iC 
)
explicit

◆ ~RecoTrackAccumulator()

RecoTrackAccumulator::~RecoTrackAccumulator ( )
override

Definition at line 25 of file RecoTrackAccumulator.cc.

25 {}

Member Function Documentation

◆ accumulate() [1/2]

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

Implements DigiAccumulatorMixMod.

Definition at line 38 of file RecoTrackAccumulator.cc.

38  {
40 }

References accumulateEvent(), MillePedeFileConverter_cfg::e, and signalTracksTag.

◆ accumulate() [2/2]

void RecoTrackAccumulator::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c,
edm::StreamID const &   
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 42 of file RecoTrackAccumulator.cc.

44  {
45  if (e.bunchCrossing() == 0) {
47  }
48 }

References accumulateEvent(), MillePedeFileConverter_cfg::e, and pileUpTracksTag.

◆ accumulateEvent()

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.

57  {
61  e.getByLabel(label, tracks);
62  e.getByLabel(label, hits);
63  e.getByLabel(label, trackExtras);
64 
65  if (!tracks.isValid()) {
66  throw cms::Exception("RecoTrackAccumulator")
67  << "Failed to find track collections with inputTag " << label << std::endl;
68  }
69  if (!hits.isValid()) {
70  throw cms::Exception("RecoTrackAccumulator")
71  << "Failed to find hit collections with inputTag " << label << std::endl;
72  }
73  if (!trackExtras.isValid()) {
74  throw cms::Exception("RecoTrackAccumulator")
75  << "Failed to find trackExtra collections with inputTag " << label << std::endl;
76  }
77 
78  for (size_t t = 0; t < tracks->size(); ++t) {
79  const reco::Track& track = (*tracks)[t];
80  newTracks_->push_back(track);
81  // track extras:
82  auto const& extra = trackExtras->at(track.extra().key());
83  newTrackExtras_->emplace_back(extra.outerPosition(),
84  extra.outerMomentum(),
85  extra.outerOk(),
86  extra.innerPosition(),
87  extra.innerMomentum(),
88  extra.innerOk(),
89  extra.outerStateCovariance(),
90  extra.outerDetId(),
91  extra.innerStateCovariance(),
92  extra.innerDetId(),
93  extra.seedDirection(),
94  //If TrajectorySeeds are needed, then their list must be gotten from the
95  // secondary event directly and looked up similarly to TrackExtras.
96  //We can't use a default constructed RefToBase due to a bug in RefToBase
97  // which causes an seg fault when calling isAvailable on a default constructed one.
99  newTracks_->back().setExtra(reco::TrackExtraRef(rNewTrackExtras, newTracks_->size() - 1));
100  // rechits:
101  // note: extra.recHit(i) does not work for pileup events
102  // probably the Ref does not know its product id applies on a pileup event
103  auto& newExtra = newTrackExtras_->back();
104  auto const firstTrackIndex = newHits_->size();
105  for (unsigned int i = 0; i < extra.recHitsSize(); i++) {
106  newHits_->push_back((*hits)[extra.recHit(i).key()]);
107  }
108  newExtra.setHits(rNewHits, firstTrackIndex, newHits_->size() - firstTrackIndex);
109  newExtra.setTrajParams(extra.trajParams(), extra.chi2sX5());
110  assert(newExtra.recHitsSize() == newExtra.trajParams().size());
111  }
112 }

References cms::cuda::assert(), MillePedeFileConverter_cfg::e, Exception, hfClusterShapes_cfi::hits, mps_fire::i, edm::HandleBase::isValid(), label, newHits_, newTrackExtras_, newTracks_, rNewHits, rNewTrackExtras, submitPVValidationJobs::t, HLT_FULL_cff::track, and PDWG_EXOHSCP_cff::tracks.

Referenced by accumulate().

◆ finalizeEvent()

void RecoTrackAccumulator::finalizeEvent ( edm::Event e,
edm::EventSetup const &  c 
)
overridevirtual

◆ initializeEvent()

void RecoTrackAccumulator::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 27 of file RecoTrackAccumulator.cc.

27  {
28  newTracks_ = std::make_unique<reco::TrackCollection>();
29  newHits_ = std::make_unique<TrackingRecHitCollection>();
30  newTrackExtras_ = std::make_unique<reco::TrackExtraCollection>();
31 
32  // this is needed to get the ProductId of the TrackExtra and TrackingRecHit and Track collections
33  rNewTracks = const_cast<edm::Event&>(e).getRefBeforePut<reco::TrackCollection>(outputLabel);
34  rNewTrackExtras = const_cast<edm::Event&>(e).getRefBeforePut<reco::TrackExtraCollection>(outputLabel);
35  rNewHits = const_cast<edm::Event&>(e).getRefBeforePut<TrackingRecHitCollection>(outputLabel);
36 }

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

Member Data Documentation

◆ newHits_

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

Definition at line 49 of file RecoTrackAccumulator.h.

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

◆ newTrackExtras_

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

Definition at line 48 of file RecoTrackAccumulator.h.

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

◆ newTracks_

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

Definition at line 47 of file RecoTrackAccumulator.h.

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

◆ outputLabel

std::string RecoTrackAccumulator::outputLabel
private

Definition at line 58 of file RecoTrackAccumulator.h.

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

◆ pileUpTracksTag

edm::InputTag RecoTrackAccumulator::pileUpTracksTag
private

Definition at line 56 of file RecoTrackAccumulator.h.

Referenced by accumulate().

◆ rNewHits

TrackingRecHitRefProd RecoTrackAccumulator::rNewHits
private

Definition at line 53 of file RecoTrackAccumulator.h.

Referenced by accumulateEvent(), and initializeEvent().

◆ rNewTrackExtras

reco::TrackExtraRefProd RecoTrackAccumulator::rNewTrackExtras
private

Definition at line 52 of file RecoTrackAccumulator.h.

Referenced by accumulateEvent(), and initializeEvent().

◆ rNewTracks

reco::TrackRefProd RecoTrackAccumulator::rNewTracks
private

Definition at line 51 of file RecoTrackAccumulator.h.

Referenced by initializeEvent().

◆ signalTracksTag

edm::InputTag RecoTrackAccumulator::signalTracksTag
private

Definition at line 55 of file RecoTrackAccumulator.h.

Referenced by accumulate(), and RecoTrackAccumulator().

PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
RecoTrackAccumulator::pileUpTracksTag
edm::InputTag pileUpTracksTag
Definition: RecoTrackAccumulator.h:56
RecoTrackAccumulator::accumulateEvent
void accumulateEvent(const T &e, edm::EventSetup const &c, const edm::InputTag &label)
Definition: RecoTrackAccumulator.cc:57
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
RecoTrackAccumulator::rNewTrackExtras
reco::TrackExtraRefProd rNewTrackExtras
Definition: RecoTrackAccumulator.h:52
cms::cuda::assert
assert(be >=bs)
edm::Handle< reco::TrackCollection >
edm::Ref
Definition: AssociativeIterator.h:58
reco::Track
Definition: Track.h:27
reco::TrackExtraCollection
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
RecoTrackAccumulator::newTracks_
std::unique_ptr< reco::TrackCollection > newTracks_
Definition: RecoTrackAccumulator.h:47
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RecoTrackAccumulator::rNewTracks
reco::TrackRefProd rNewTracks
Definition: RecoTrackAccumulator.h:51
RecoTrackAccumulator::newHits_
std::unique_ptr< TrackingRecHitCollection > newHits_
Definition: RecoTrackAccumulator.h:49
edm::ProducesCollector::produces
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
Definition: ProducesCollector.h:52
RecoTrackAccumulator::rNewHits
TrackingRecHitRefProd rNewHits
Definition: RecoTrackAccumulator.h:53
eostools.move
def move(src, dest)
Definition: eostools.py:511
RecoTrackAccumulator::newTrackExtras_
std::unique_ptr< reco::TrackExtraCollection > newTrackExtras_
Definition: RecoTrackAccumulator.h:48
RecoTrackAccumulator::signalTracksTag
edm::InputTag signalTracksTag
Definition: RecoTrackAccumulator.h:55
Exception
Definition: hltDiff.cc:246
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::RefToBase< TrajectorySeed >
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
edm::InputTag
Definition: InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
label
const char * label
Definition: PFTauDecayModeTools.cc:11
edm::OwnVector< TrackingRecHit >
RecoTrackAccumulator::outputLabel
std::string outputLabel
Definition: RecoTrackAccumulator.h:58
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37