CMS 3D CMS Logo

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

Transforms format of DR into that expected by KF input. More...

Inheritance diagram for trklet::ProducerKFin:
edm::stream::EDProducer<>

Public Member Functions

 ProducerKFin (const ParameterSet &)
 
 ~ProducerKFin () 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
 
virtual void endJob ()
 
void produce (Event &, const EventSetup &) override
 

Private Attributes

const ChannelAssignmentchannelAssignment_ = nullptr
 
const DataFormatsdataFormats_ = nullptr
 
EDGetTokenT< StreamsStubedGetTokenStubs_
 
EDGetTokenT< StreamsTrackedGetTokenTracks_
 
EDPutTokenT< StreamsStubedPutTokenAcceptedStubs_
 
EDPutTokenT< StreamsTrackedPutTokenAcceptedTracks_
 
EDPutTokenT< StreamsStubedPutTokenLostStubs_
 
EDPutTokenT< StreamsTrackedPutTokenLostTracks_
 
ESGetToken< ChannelAssignment, ChannelAssignmentRcdesGetTokenChannelAssignment_
 
ESGetToken< DataFormats, DataFormatsRcdesGetTokenDataFormats_
 
ESGetToken< LayerEncoding, LayerEncodingRcdesGetTokenLayerEncoding_
 
ESGetToken< Setup, SetupRcdesGetTokenSetup_
 
ParameterSet iConfig_
 
const LayerEncodinglayerEncoding_ = nullptr
 
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

Transforms format of DR into that expected by KF input.

Author
Thomas Schuh
Date
2023, Feb

Definition at line 38 of file ProducerKFin.cc.

Constructor & Destructor Documentation

◆ ProducerKFin()

trklet::ProducerKFin::ProducerKFin ( const ParameterSet iConfig)
explicit

Definition at line 77 of file ProducerKFin.cc.

References edGetTokenStubs_, edGetTokenTracks_, edPutTokenAcceptedStubs_, edPutTokenAcceptedTracks_, edPutTokenLostStubs_, edPutTokenLostTracks_, esGetTokenChannelAssignment_, esGetTokenDataFormats_, esGetTokenLayerEncoding_, esGetTokenSetup_, edm::ParameterSet::getParameter(), ProducerED_cfi::InputTag, and label.

77  : iConfig_(iConfig) {
78  const string& label = iConfig.getParameter<string>("LabelDR");
79  const string& branchAcceptedStubs = iConfig.getParameter<string>("BranchAcceptedStubs");
80  const string& branchAcceptedTracks = iConfig.getParameter<string>("BranchAcceptedTracks");
81  const string& branchLostStubs = iConfig.getParameter<string>("BranchLostStubs");
82  const string& branchLostTracks = iConfig.getParameter<string>("BranchLostTracks");
83  // book in- and output ED products
84  edGetTokenTracks_ = consumes<StreamsTrack>(InputTag(label, branchAcceptedTracks));
85  edGetTokenStubs_ = consumes<StreamsStub>(InputTag(label, branchAcceptedStubs));
86  edPutTokenAcceptedStubs_ = produces<StreamsStub>(branchAcceptedStubs);
87  edPutTokenAcceptedTracks_ = produces<StreamsTrack>(branchAcceptedTracks);
88  edPutTokenLostStubs_ = produces<StreamsStub>(branchLostStubs);
89  edPutTokenLostTracks_ = produces<StreamsTrack>(branchLostTracks);
90  // book ES products
91  esGetTokenSetup_ = esConsumes<Setup, SetupRcd, Transition::BeginRun>();
92  esGetTokenDataFormats_ = esConsumes<DataFormats, DataFormatsRcd, Transition::BeginRun>();
93  esGetTokenLayerEncoding_ = esConsumes<LayerEncoding, LayerEncodingRcd, Transition::BeginRun>();
94  esGetTokenChannelAssignment_ = esConsumes<ChannelAssignment, ChannelAssignmentRcd, Transition::BeginRun>();
95  }
ESGetToken< ChannelAssignment, ChannelAssignmentRcd > esGetTokenChannelAssignment_
Definition: ProducerKFin.cc:64
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
EDPutTokenT< StreamsStub > edPutTokenLostStubs_
Definition: ProducerKFin.cc:53
ESGetToken< LayerEncoding, LayerEncodingRcd > esGetTokenLayerEncoding_
Definition: ProducerKFin.cc:62
EDPutTokenT< StreamsTrack > edPutTokenAcceptedTracks_
Definition: ProducerKFin.cc:55
char const * label
EDGetTokenT< StreamsTrack > edGetTokenTracks_
Definition: ProducerKFin.cc:48
EDPutTokenT< StreamsStub > edPutTokenAcceptedStubs_
Definition: ProducerKFin.cc:52
ParameterSet iConfig_
Definition: ProducerKFin.cc:66
ESGetToken< DataFormats, DataFormatsRcd > esGetTokenDataFormats_
Definition: ProducerKFin.cc:60
ESGetToken< Setup, SetupRcd > esGetTokenSetup_
Definition: ProducerKFin.cc:58
EDPutTokenT< StreamsTrack > edPutTokenLostTracks_
Definition: ProducerKFin.cc:56
EDGetTokenT< StreamsStub > edGetTokenStubs_
Definition: ProducerKFin.cc:50

◆ ~ProducerKFin()

trklet::ProducerKFin::~ProducerKFin ( )
inlineoverride

Definition at line 41 of file ProducerKFin.cc.

41 {}

Member Function Documentation

◆ beginRun()

void trklet::ProducerKFin::beginRun ( const Run iRun,
const EventSetup iSetup 
)
overrideprivate

Definition at line 97 of file ProducerKFin.cc.

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

97  {
98  // helper class to store configurations
99  setup_ = &iSetup.getData(esGetTokenSetup_);
101  return;
102  // check process history if desired
103  if (iConfig_.getParameter<bool>("CheckHistory"))
105  // helper class to extract structured data from tt::Frames
107  // helper class to encode layer
109  // helper class to assign tracks to channel
111  }
ESGetToken< ChannelAssignment, ChannelAssignmentRcd > esGetTokenChannelAssignment_
Definition: ProducerKFin.cc:64
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const Setup * setup_
Definition: ProducerKFin.cc:68
ESGetToken< LayerEncoding, LayerEncodingRcd > esGetTokenLayerEncoding_
Definition: ProducerKFin.cc:62
const DataFormats * dataFormats_
Definition: ProducerKFin.cc:70
const LayerEncoding * layerEncoding_
Definition: ProducerKFin.cc:72
const ChannelAssignment * channelAssignment_
Definition: ProducerKFin.cc:74
bool configurationSupported() const
Definition: Setup.h:60
ProcessHistory const & processHistory() const
Definition: Run.cc:115
ParameterSet iConfig_
Definition: ProducerKFin.cc:66
ESGetToken< DataFormats, DataFormatsRcd > esGetTokenDataFormats_
Definition: ProducerKFin.cc:60
void checkHistory(const edm::ProcessHistory &processHistory) const
Definition: Setup.cc:242
ESGetToken< Setup, SetupRcd > esGetTokenSetup_
Definition: ProducerKFin.cc:58

◆ endJob()

virtual void trklet::ProducerKFin::endJob ( void  )
inlineprivatevirtual

Definition at line 46 of file ProducerKFin.cc.

46 {}

◆ produce()

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

Definition at line 113 of file ProducerKFin.cc.

References channelAssignment_, tt::Setup::configurationSupported(), dataFormats_, edGetTokenStubs_, edGetTokenTracks_, edPutTokenAcceptedStubs_, edPutTokenAcceptedTracks_, edPutTokenLostStubs_, edPutTokenLostTracks_, iConfig_, iEvent, trackerTFP::kfin, tt::Setup::kfNumWorker(), layerEncoding_, isotracks_cff::lostTracks, eostools::move(), tt::Setup::numLayers(), tt::Setup::numRegions(), nano_mu_digi_cff::region, setup_, SimL1Emulator_cff::stubs, and DiMuonV_cfg::tracks.

113  {
114  // empty KFin products
115  const int numStreamsTracks = setup_->kfNumWorker() * setup_->numRegions();
116  const int numStreamsStubs = numStreamsTracks * setup_->numLayers();
117  StreamsStub acceptedStubs(numStreamsStubs);
118  StreamsTrack acceptedTracks(numStreamsTracks);
119  StreamsStub lostStubs(numStreamsStubs);
120  StreamsTrack lostTracks(numStreamsTracks);
121  // read in TBout Product and produce KFin product
123  Handle<StreamsStub> handleStubs;
124  iEvent.getByToken<StreamsStub>(edGetTokenStubs_, handleStubs);
125  const StreamsStub& stubs = *handleStubs;
126  Handle<StreamsTrack> handleTracks;
127  iEvent.getByToken<StreamsTrack>(edGetTokenTracks_, handleTracks);
128  const StreamsTrack& tracks = *handleTracks;
129  for (int region = 0; region < setup_->numRegions(); region++) {
130  // object to reformat tracks from DR fromat to KF format in a processing region
132  // read in and organize input tracks and stubs
133  kfin.consume(tracks, stubs);
134  // fill output products
135  kfin.produce(acceptedStubs, acceptedTracks, lostStubs, lostTracks);
136  }
137  }
138  // store products
139  iEvent.emplace(edPutTokenAcceptedStubs_, std::move(acceptedStubs));
140  iEvent.emplace(edPutTokenAcceptedTracks_, std::move(acceptedTracks));
141  iEvent.emplace(edPutTokenLostStubs_, std::move(lostStubs));
143  }
std::vector< StreamTrack > StreamsTrack
Definition: TTTypes.h:67
EDPutTokenT< StreamsStub > edPutTokenLostStubs_
Definition: ProducerKFin.cc:53
const Setup * setup_
Definition: ProducerKFin.cc:68
std::vector< StreamStub > StreamsStub
Definition: TTTypes.h:66
EDPutTokenT< StreamsTrack > edPutTokenAcceptedTracks_
Definition: ProducerKFin.cc:55
const DataFormats * dataFormats_
Definition: ProducerKFin.cc:70
EDGetTokenT< StreamsTrack > edGetTokenTracks_
Definition: ProducerKFin.cc:48
int iEvent
Definition: GenABIO.cc:224
const LayerEncoding * layerEncoding_
Definition: ProducerKFin.cc:72
const ChannelAssignment * channelAssignment_
Definition: ProducerKFin.cc:74
EDPutTokenT< StreamsStub > edPutTokenAcceptedStubs_
Definition: ProducerKFin.cc:52
int kfNumWorker() const
Definition: Setup.h:491
bool configurationSupported() const
Definition: Setup.h:60
int numLayers() const
Definition: Setup.h:215
ParameterSet iConfig_
Definition: ProducerKFin.cc:66
int numRegions() const
Definition: Setup.h:349
EDPutTokenT< StreamsTrack > edPutTokenLostTracks_
Definition: ProducerKFin.cc:56
def move(src, dest)
Definition: eostools.py:511
EDGetTokenT< StreamsStub > edGetTokenStubs_
Definition: ProducerKFin.cc:50

Member Data Documentation

◆ channelAssignment_

const ChannelAssignment* trklet::ProducerKFin::channelAssignment_ = nullptr
private

Definition at line 74 of file ProducerKFin.cc.

Referenced by beginRun(), and produce().

◆ dataFormats_

const DataFormats* trklet::ProducerKFin::dataFormats_ = nullptr
private

Definition at line 70 of file ProducerKFin.cc.

Referenced by beginRun(), and produce().

◆ edGetTokenStubs_

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

Definition at line 50 of file ProducerKFin.cc.

Referenced by produce(), and ProducerKFin().

◆ edGetTokenTracks_

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

Definition at line 48 of file ProducerKFin.cc.

Referenced by produce(), and ProducerKFin().

◆ edPutTokenAcceptedStubs_

EDPutTokenT<StreamsStub> trklet::ProducerKFin::edPutTokenAcceptedStubs_
private

Definition at line 52 of file ProducerKFin.cc.

Referenced by produce(), and ProducerKFin().

◆ edPutTokenAcceptedTracks_

EDPutTokenT<StreamsTrack> trklet::ProducerKFin::edPutTokenAcceptedTracks_
private

Definition at line 55 of file ProducerKFin.cc.

Referenced by produce(), and ProducerKFin().

◆ edPutTokenLostStubs_

EDPutTokenT<StreamsStub> trklet::ProducerKFin::edPutTokenLostStubs_
private

Definition at line 53 of file ProducerKFin.cc.

Referenced by produce(), and ProducerKFin().

◆ edPutTokenLostTracks_

EDPutTokenT<StreamsTrack> trklet::ProducerKFin::edPutTokenLostTracks_
private

Definition at line 56 of file ProducerKFin.cc.

Referenced by produce(), and ProducerKFin().

◆ esGetTokenChannelAssignment_

ESGetToken<ChannelAssignment, ChannelAssignmentRcd> trklet::ProducerKFin::esGetTokenChannelAssignment_
private

Definition at line 64 of file ProducerKFin.cc.

Referenced by beginRun(), and ProducerKFin().

◆ esGetTokenDataFormats_

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

Definition at line 60 of file ProducerKFin.cc.

Referenced by beginRun(), and ProducerKFin().

◆ esGetTokenLayerEncoding_

ESGetToken<LayerEncoding, LayerEncodingRcd> trklet::ProducerKFin::esGetTokenLayerEncoding_
private

Definition at line 62 of file ProducerKFin.cc.

Referenced by beginRun(), and ProducerKFin().

◆ esGetTokenSetup_

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

Definition at line 58 of file ProducerKFin.cc.

Referenced by beginRun(), and ProducerKFin().

◆ iConfig_

ParameterSet trklet::ProducerKFin::iConfig_
private

Definition at line 66 of file ProducerKFin.cc.

Referenced by beginRun(), and produce().

◆ layerEncoding_

const LayerEncoding* trklet::ProducerKFin::layerEncoding_ = nullptr
private

Definition at line 72 of file ProducerKFin.cc.

Referenced by beginRun(), and produce().

◆ setup_

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