CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
trackerTFP::ProducerTT Class Reference

Converts KF output into TTTracks. More...

Inheritance diagram for trackerTFP::ProducerTT:
edm::stream::EDProducer<>

Public Member Functions

 ProducerTT (const ParameterSet &)
 
 ~ProducerTT () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

void beginRun (const Run &, const EventSetup &) override
 
void endJob ()
 
void produce (Event &, const EventSetup &) override
 

Private Attributes

const DataFormatsdataFormats_ = nullptr
 
EDGetTokenT< StreamsStubedGetTokenStubs_
 
EDGetTokenT< StreamsTrackedGetTokenTracks_
 
EDPutTokenT< TTTracksedPutToken_
 
ESGetToken< DataFormats, DataFormatsRcdesGetTokenDataFormats_
 
ESGetToken< Setup, SetupRcdesGetTokenSetup_
 
ParameterSet iConfig_
 
const Setupsetup_ = nullptr
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Converts KF output into TTTracks.

Author
Thomas Schuh
Date
2020, Oct

Definition at line 31 of file ProducerTT.cc.

Constructor & Destructor Documentation

◆ ProducerTT()

trackerTFP::ProducerTT::ProducerTT ( const ParameterSet iConfig)
explicit

Definition at line 59 of file ProducerTT.cc.

References edGetTokenStubs_, edGetTokenTracks_, edPutToken_, esGetTokenDataFormats_, esGetTokenSetup_, edm::ParameterSet::getParameter(), HLT_2022v15_cff::InputTag, and label.

59  : iConfig_(iConfig) {
60  const string& label = iConfig.getParameter<string>("LabelKF");
61  const string& branchStubs = iConfig.getParameter<string>("BranchAcceptedStubs");
62  const string& branchTracks = iConfig.getParameter<string>("BranchAcceptedTracks");
63  // book in- and output ED products
64  edGetTokenStubs_ = consumes<StreamsStub>(InputTag(label, branchStubs));
65  edGetTokenTracks_ = consumes<StreamsTrack>(InputTag(label, branchTracks));
66  edPutToken_ = produces<TTTracks>(branchTracks);
67  // book ES products
68  esGetTokenSetup_ = esConsumes<Setup, SetupRcd, Transition::BeginRun>();
69  esGetTokenDataFormats_ = esConsumes<DataFormats, DataFormatsRcd, Transition::BeginRun>();
70  }
EDPutTokenT< TTTracks > edPutToken_
Definition: ProducerTT.cc:46
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EDGetTokenT< StreamsTrack > edGetTokenTracks_
Definition: ProducerTT.cc:44
char const * label
ESGetToken< Setup, SetupRcd > esGetTokenSetup_
Definition: ProducerTT.cc:48
EDGetTokenT< StreamsStub > edGetTokenStubs_
Definition: ProducerTT.cc:42
ParameterSet iConfig_
Definition: ProducerTT.cc:52
ESGetToken< DataFormats, DataFormatsRcd > esGetTokenDataFormats_
Definition: ProducerTT.cc:50

◆ ~ProducerTT()

trackerTFP::ProducerTT::~ProducerTT ( )
inlineoverride

Definition at line 34 of file ProducerTT.cc.

34 {}

Member Function Documentation

◆ beginRun()

void trackerTFP::ProducerTT::beginRun ( const Run iRun,
const EventSetup iSetup 
)
overrideprivate

Definition at line 72 of file ProducerTT.cc.

References tt::Setup::checkHistory(), tt::Setup::configurationSupported(), dataFormats_, esGetTokenDataFormats_, esGetTokenSetup_, edm::EventSetup::getData(), edm::ParameterSet::getParameter(), iConfig_, edm::Run::processHistory(), and setup_.

72  {
73  // helper class to store configurations
74  setup_ = &iSetup.getData(esGetTokenSetup_);
76  return;
77  // check process history if desired
78  if (iConfig_.getParameter<bool>("CheckHistory"))
80  // helper class to extract structured data from tt::Frames
82  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ESGetToken< Setup, SetupRcd > esGetTokenSetup_
Definition: ProducerTT.cc:48
bool configurationSupported() const
Definition: Setup.h:60
ProcessHistory const & processHistory() const
Definition: Run.cc:115
bool getData(T &iHolder) const
Definition: EventSetup.h:122
void checkHistory(const edm::ProcessHistory &processHistory) const
Definition: Setup.cc:238
const Setup * setup_
Definition: ProducerTT.cc:54
ParameterSet iConfig_
Definition: ProducerTT.cc:52
const DataFormats * dataFormats_
Definition: ProducerTT.cc:56
ESGetToken< DataFormats, DataFormatsRcd > esGetTokenDataFormats_
Definition: ProducerTT.cc:50

◆ endJob()

void trackerTFP::ProducerTT::endJob ( void  )
inlineprivate

Definition at line 39 of file ProducerTT.cc.

39 {}

◆ produce()

void trackerTFP::ProducerTT::produce ( Event iEvent,
const EventSetup iSetup 
)
overrideprivate

Definition at line 84 of file ProducerTT.cc.

References tt::Setup::configurationSupported(), dataFormats_, edGetTokenTracks_, edPutToken_, amptDefault_cfi::frame, iEvent, trackerTFP::kf, trackerTFP::layer, eostools::move(), BeamSpotPI::nTracks, tt::Setup::numLayers(), trackerTFP::DataFormats::numStreamsTracks(), hltrates_dqm_sourceclient-live_cfg::offset, edm::Handle< T >::product(), setup_, cms::cuda::stream, and HLT_2022v15_cff::track.

84  {
85  // empty KFTTTrack product
86  TTTracks ttTracks;
87  // read in KF Product and produce KFTTTrack product
89  Handle<StreamsTrack> handleTracks;
90  iEvent.getByToken<StreamsTrack>(edGetTokenTracks_, handleTracks);
91  const StreamsTrack& streamsTracks = *handleTracks.product();
92  Handle<StreamsStub> handleStubs;
93  iEvent.getByToken<StreamsStub>(edGetTokenTracks_, handleStubs);
94  const StreamsStub& streamsStubs = *handleStubs.product();
95  int nTracks(0);
96  for (const StreamTrack& stream : streamsTracks)
97  nTracks += accumulate(stream.begin(), stream.end(), 0, [](int& sum, const FrameTrack& frame) {
98  return sum += frame.first.isNonnull() ? 1 : 0;
99  });
100  ttTracks.reserve(nTracks);
101  for (int channel = 0; channel < dataFormats_->numStreamsTracks(Process::kf); channel++) {
102  int iTrk(0);
103  const int offset = channel * setup_->numLayers();
104  for (const FrameTrack& frameTrack : streamsTracks[channel]) {
105  vector<StubKF> stubs;
106  stubs.reserve(setup_->numLayers());
107  for (int layer = 0; layer < setup_->numLayers(); layer++) {
108  const FrameStub& frameStub = streamsStubs[offset + layer][iTrk];
109  if (frameStub.first.isNonnull())
110  stubs.emplace_back(frameStub, dataFormats_, layer);
111  }
112  TrackKF track(frameTrack, dataFormats_);
113  ttTracks.emplace_back(track.ttTrack(stubs));
114  iTrk++;
115  }
116  }
117  }
118  // store products
119  iEvent.emplace(edPutToken_, move(ttTracks));
120  }
EDPutTokenT< TTTracks > edPutToken_
Definition: ProducerTT.cc:46
std::vector< StreamTrack > StreamsTrack
Definition: TTTypes.h:67
std::pair< TTStubRef, Frame > FrameStub
Definition: TTTypes.h:60
std::vector< StreamStub > StreamsStub
Definition: TTTypes.h:66
T const * product() const
Definition: Handle.h:70
EDGetTokenT< StreamsTrack > edGetTokenTracks_
Definition: ProducerTT.cc:44
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
std::vector< FrameTrack > StreamTrack
Definition: TTTypes.h:64
std::pair< TTTrackRef, Frame > FrameTrack
Definition: TTTypes.h:62
int iEvent
Definition: GenABIO.cc:224
bool configurationSupported() const
Definition: Setup.h:60
int numLayers() const
Definition: Setup.h:215
const Setup * setup_
Definition: ProducerTT.cc:54
int numStreamsTracks(Process p) const
Definition: DataFormats.h:504
std::vector< TTTrack< Ref_Phase2TrackerDigi_ > > TTTracks
Definition: TTTypes.h:70
const DataFormats * dataFormats_
Definition: ProducerTT.cc:56
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ dataFormats_

const DataFormats* trackerTFP::ProducerTT::dataFormats_ = nullptr
private

Definition at line 56 of file ProducerTT.cc.

Referenced by beginRun(), and produce().

◆ edGetTokenStubs_

EDGetTokenT<StreamsStub> trackerTFP::ProducerTT::edGetTokenStubs_
private

Definition at line 42 of file ProducerTT.cc.

Referenced by ProducerTT().

◆ edGetTokenTracks_

EDGetTokenT<StreamsTrack> trackerTFP::ProducerTT::edGetTokenTracks_
private

Definition at line 44 of file ProducerTT.cc.

Referenced by produce(), and ProducerTT().

◆ edPutToken_

EDPutTokenT<TTTracks> trackerTFP::ProducerTT::edPutToken_
private

Definition at line 46 of file ProducerTT.cc.

Referenced by produce(), and ProducerTT().

◆ esGetTokenDataFormats_

ESGetToken<DataFormats, DataFormatsRcd> trackerTFP::ProducerTT::esGetTokenDataFormats_
private

Definition at line 50 of file ProducerTT.cc.

Referenced by beginRun(), and ProducerTT().

◆ esGetTokenSetup_

ESGetToken<Setup, SetupRcd> trackerTFP::ProducerTT::esGetTokenSetup_
private

Definition at line 48 of file ProducerTT.cc.

Referenced by beginRun(), and ProducerTT().

◆ iConfig_

ParameterSet trackerTFP::ProducerTT::iConfig_
private

Definition at line 52 of file ProducerTT.cc.

Referenced by beginRun().

◆ setup_

const Setup* trackerTFP::ProducerTT::setup_ = nullptr
private