CMS 3D CMS Logo

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

Converts KF output into TTTracks. More...

Inheritance diagram for trklet::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
2021, Aug

Definition at line 31 of file ProducerTT.cc.

Constructor & Destructor Documentation

◆ ProducerTT()

trklet::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  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ParameterSet iConfig_
Definition: ProducerTT.cc:52
EDPutTokenT< TTTracks > edPutToken_
Definition: ProducerTT.cc:46
EDGetTokenT< StreamsTrack > edGetTokenTracks_
Definition: ProducerTT.cc:44
char const * label
ESGetToken< Setup, SetupRcd > esGetTokenSetup_
Definition: ProducerTT.cc:48
ESGetToken< DataFormats, DataFormatsRcd > esGetTokenDataFormats_
Definition: ProducerTT.cc:50
EDGetTokenT< StreamsStub > edGetTokenStubs_
Definition: ProducerTT.cc:42

◆ ~ProducerTT()

trklet::ProducerTT::~ProducerTT ( )
inlineoverride

Definition at line 34 of file ProducerTT.cc.

34 {}

Member Function Documentation

◆ beginRun()

void trklet::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
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
ParameterSet iConfig_
Definition: ProducerTT.cc:52
ESGetToken< Setup, SetupRcd > esGetTokenSetup_
Definition: ProducerTT.cc:48
ESGetToken< DataFormats, DataFormatsRcd > esGetTokenDataFormats_
Definition: ProducerTT.cc:50
bool configurationSupported() const
Definition: Setup.h:60
ProcessHistory const & processHistory() const
Definition: Run.cc:115
void checkHistory(const edm::ProcessHistory &processHistory) const
Definition: Setup.cc:238
const Setup * setup_
Definition: ProducerTT.cc:54
const DataFormats * dataFormats_
Definition: ProducerTT.cc:56

◆ endJob()

void trklet::ProducerTT::endJob ( void  )
inlineprivate

Definition at line 39 of file ProducerTT.cc.

39 {}

◆ produce()

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

Definition at line 84 of file ProducerTT.cc.

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

84  {
85  // empty KFout product
86  TTTracks ttTracks;
87  // read in KF Product and produce KFout product
89  Handle<StreamsStub> handleStubs;
90  iEvent.getByToken<StreamsStub>(edGetTokenStubs_, handleStubs);
91  const StreamsStub& streamsStubs = *handleStubs.product();
92  Handle<StreamsTrack> handleTracks;
93  iEvent.getByToken<StreamsTrack>(edGetTokenTracks_, handleTracks);
94  const StreamsTrack& streamsTracks = *handleTracks.product();
95  // count number of kf tracks
96  int nTracks(0);
97  for (const StreamTrack& stream : streamsTracks)
98  nTracks += accumulate(stream.begin(), stream.end(), 0, [](int& sum, const FrameTrack& frame) {
99  return sum += frame.first.isNonnull() ? 1 : 0;
100  });
101  ttTracks.reserve(nTracks);
102  // convert kf track frames per channel and stub frames per channel and layer to TTTracks
103  for (int channel = 0; channel < (int)streamsTracks.size(); channel++) {
104  const int offset = channel * setup_->numLayers();
105  int iTrk(0);
106  for (const FrameTrack& frameTrack : streamsTracks[channel]) {
107  if (frameTrack.first.isNull())
108  continue;
109  // convert stub frames to kf stubs
110  vector<StubKF> stubs;
111  stubs.reserve(setup_->numLayers());
112  for (int layer = 0; layer < setup_->numLayers(); layer++) {
113  const FrameStub& frameStub = streamsStubs[offset + layer][iTrk];
114  if (frameStub.first.isNonnull())
115  stubs.emplace_back(frameStub, dataFormats_, layer);
116  }
117  // convert track frame to kf track
118  TrackKF track(frameTrack, dataFormats_);
119  // convert kf track and kf stubs to TTTrack
120  ttTracks.emplace_back(track.ttTrack(stubs));
121  iTrk++;
122  }
123  }
124  }
125  // store products
126  iEvent.emplace(edPutToken_, move(ttTracks));
127  }
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
EDPutTokenT< TTTracks > edPutToken_
Definition: ProducerTT.cc:46
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
EDGetTokenT< StreamsTrack > edGetTokenTracks_
Definition: ProducerTT.cc:44
std::vector< FrameTrack > StreamTrack
Definition: TTTypes.h:64
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
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
EDGetTokenT< StreamsStub > edGetTokenStubs_
Definition: ProducerTT.cc:42
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* trklet::ProducerTT::dataFormats_ = nullptr
private

Definition at line 56 of file ProducerTT.cc.

Referenced by beginRun(), and produce().

◆ edGetTokenStubs_

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

Definition at line 42 of file ProducerTT.cc.

Referenced by produce(), and ProducerTT().

◆ edGetTokenTracks_

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

Definition at line 44 of file ProducerTT.cc.

Referenced by produce(), and ProducerTT().

◆ edPutToken_

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

Definition at line 46 of file ProducerTT.cc.

Referenced by produce(), and ProducerTT().

◆ esGetTokenDataFormats_

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

Definition at line 50 of file ProducerTT.cc.

Referenced by beginRun(), and ProducerTT().

◆ esGetTokenSetup_

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

Definition at line 48 of file ProducerTT.cc.

Referenced by beginRun(), and ProducerTT().

◆ iConfig_

ParameterSet trklet::ProducerTT::iConfig_
private

Definition at line 52 of file ProducerTT.cc.

Referenced by beginRun().

◆ setup_

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