CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
LSTPixelSeedInputProducer Class Reference
Inheritance diagram for LSTPixelSeedInputProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 LSTPixelSeedInputProducer (edm::ParameterSet const &iConfig)
 
 ~LSTPixelSeedInputProducer () override=default
 
- Public Member Functions inherited from edm::global::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
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void produce (edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
 

Private Attributes

const edm::EDGetTokenT< reco::BeamSpotbeamSpotToken_
 
const edm::EDPutTokenT< LSTPixelSeedInputlstPixelSeedInputPutToken_
 
const edm::EDPutTokenT< TrajectorySeedCollectionlstPixelSeedsPutToken_
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmfToken_
 
std::vector< edm::EDGetTokenT< edm::View< reco::Track > > > seedTokens_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 23 of file LSTPixelSeedInputProducer.cc.

Constructor & Destructor Documentation

◆ LSTPixelSeedInputProducer()

LSTPixelSeedInputProducer::LSTPixelSeedInputProducer ( edm::ParameterSet const &  iConfig)
explicit

Definition at line 40 of file LSTPixelSeedInputProducer.cc.

References edm::ParameterSet::getParameter(), seedTokens_, makeGlobalPositionRcd_cfg::tag, and edm::vector_transform().

41  : mfToken_(esConsumes()),
42  beamSpotToken_(consumes(iConfig.getParameter<edm::InputTag>("beamSpot"))),
45  seedTokens_ = edm::vector_transform(iConfig.getParameter<std::vector<edm::InputTag>>("seedTracks"),
46  [&](const edm::InputTag& tag) { return consumes<edm::View<reco::Track>>(tag); });
47 }
const edm::EDPutTokenT< LSTPixelSeedInput > lstPixelSeedInputPutToken_
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDPutTokenT< TrajectorySeedCollection > lstPixelSeedsPutToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > mfToken_
const edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
std::vector< edm::EDGetTokenT< edm::View< reco::Track > > > seedTokens_

◆ ~LSTPixelSeedInputProducer()

LSTPixelSeedInputProducer::~LSTPixelSeedInputProducer ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

void LSTPixelSeedInputProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 49 of file LSTPixelSeedInputProducer.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

49  {
51 
52  desc.add<edm::InputTag>("beamSpot", edm::InputTag("offlineBeamSpot"));
53 
54  desc.add<std::vector<edm::InputTag>>("seedTracks",
55  std::vector<edm::InputTag>{edm::InputTag("lstInitialStepSeedTracks"),
56  edm::InputTag("lstHighPtTripletStepSeedTracks")});
57 
58  descriptions.addWithDefaultLabel(desc);
59 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ produce()

void LSTPixelSeedInputProducer::produce ( edm::StreamID  iID,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 61 of file LSTPixelSeedInputProducer.cc.

References beamSpotToken_, cms::cuda::bs, OmniClusterRef::cluster_pixel(), Exception, BaseTrackerRecHit::firstClusterRef(), edm::EventSetup::getData(), TrajectoryStateOnSurface::globalParameters(), mps_fire::i, EcalPhiSymFlatTableProducers_cfi::id, iEvent, edm::Ref< C, T, F >::key(), lstPixelSeedInputPutToken_, lstPixelSeedsPutToken_, mfToken_, eostools::move(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, edm::RefToBaseVector< T >::push_back(), tas::see_dxy(), tas::see_dz(), tas::see_etaErr(), tas::see_hitIdx(), tas::see_ptErr(), tas::see_px(), tas::see_py(), tas::see_pz(), tas::see_q(), tas::see_stateTrajGlbPx(), tas::see_stateTrajGlbPy(), tas::see_stateTrajGlbPz(), tas::see_stateTrajGlbX(), tas::see_stateTrajGlbY(), tas::see_stateTrajGlbZ(), fileCollector::seed, seedTokens_, trackingNtuple_cff::seedTracks, edm::RefToBaseVector< T >::size(), TrackingRecHit::surface(), trackFromSeedFitFailed(), and trajectoryStateTransform::transientState().

61  {
62  // Setup
63  auto const& mf = iSetup.getData(mfToken_);
64  auto const& bs = iEvent.get(beamSpotToken_);
65 
66  // Vector definitions
67  std::vector<float> see_px;
68  std::vector<float> see_py;
69  std::vector<float> see_pz;
70  std::vector<float> see_dxy;
71  std::vector<float> see_dz;
72  std::vector<float> see_ptErr;
73  std::vector<float> see_etaErr;
74  std::vector<float> see_stateTrajGlbX;
75  std::vector<float> see_stateTrajGlbY;
76  std::vector<float> see_stateTrajGlbZ;
77  std::vector<float> see_stateTrajGlbPx;
78  std::vector<float> see_stateTrajGlbPy;
79  std::vector<float> see_stateTrajGlbPz;
80  std::vector<int> see_q;
81  std::vector<std::vector<int>> see_hitIdx;
82  TrajectorySeedCollection see_seeds;
83 
84  for (size_t iColl = 0; iColl < seedTokens_.size(); ++iColl) {
85  // Get seed tokens
86  auto const& seedToken = seedTokens_[iColl];
87  auto const& seedTracks = iEvent.get(seedToken);
88 
89  if (seedTracks.empty())
90  continue;
91 
92  // Get seed track refs
94  for (edm::View<reco::Track>::size_type i = 0; i < seedTracks.size(); ++i) {
95  seedTrackRefs.push_back(seedTracks.refAt(i));
96  }
97 
98  edm::ProductID id = seedTracks[0].seedRef().id();
99 
100  for (size_t iSeed = 0; iSeed < seedTrackRefs.size(); ++iSeed) {
101  auto const& seedTrackRef = seedTrackRefs[iSeed];
102  auto const& seedTrack = *seedTrackRef;
103  auto const& seedRef = seedTrack.seedRef();
104  auto const& seed = *seedRef;
105 
106  if (seedRef.id() != id)
107  throw cms::Exception("LogicError")
108  << "All tracks in 'TracksFromSeeds' collection should point to seeds in the same collection. Now the "
109  "element 0 had ProductID "
110  << id << " while the element " << seedTrackRef.key() << " had " << seedTrackRef.id() << ".";
111 
112  const bool seedFitOk = !trackFromSeedFitFailed(seedTrack);
113 
114  const TrackingRecHit* lastRecHit = &*(seed.recHits().end() - 1);
116  trajectoryStateTransform::transientState(seed.startingState(), lastRecHit->surface(), &mf);
117  auto const& stateGlobal = tsos.globalParameters();
118 
119  std::vector<int> hitIdx;
120  for (auto const& hit : seed.recHits()) {
121  int subid = hit.geographicalId().subdetId();
122  if (subid == (int)PixelSubdetector::PixelBarrel || subid == (int)PixelSubdetector::PixelEndcap) {
123  const BaseTrackerRecHit* bhit = dynamic_cast<const BaseTrackerRecHit*>(&hit);
124  const auto& clusterRef = bhit->firstClusterRef();
125  const auto clusterKey = clusterRef.cluster_pixel().key();
126  hitIdx.push_back(clusterKey);
127  } else {
128  throw cms::Exception("LSTPixelSeedInputProducer") << "Not pixel hits found!";
129  }
130  }
131 
132  // Fill output
133  see_px.push_back(seedFitOk ? seedTrack.px() : 0);
134  see_py.push_back(seedFitOk ? seedTrack.py() : 0);
135  see_pz.push_back(seedFitOk ? seedTrack.pz() : 0);
136  see_dxy.push_back(seedFitOk ? seedTrack.dxy(bs.position()) : 0);
137  see_dz.push_back(seedFitOk ? seedTrack.dz(bs.position()) : 0);
138  see_ptErr.push_back(seedFitOk ? seedTrack.ptError() : 0);
139  see_etaErr.push_back(seedFitOk ? seedTrack.etaError() : 0);
140  see_stateTrajGlbX.push_back(stateGlobal.position().x());
141  see_stateTrajGlbY.push_back(stateGlobal.position().y());
142  see_stateTrajGlbZ.push_back(stateGlobal.position().z());
143  see_stateTrajGlbPx.push_back(stateGlobal.momentum().x());
144  see_stateTrajGlbPy.push_back(stateGlobal.momentum().y());
145  see_stateTrajGlbPz.push_back(stateGlobal.momentum().z());
146  see_q.push_back(seedTrack.charge());
147  see_hitIdx.push_back(hitIdx);
148  see_seeds.push_back(seed);
149  }
150  }
151 
152  LSTPixelSeedInput pixelSeedInput(std::move(see_px),
153  std::move(see_py),
154  std::move(see_pz),
156  std::move(see_dz),
165  std::move(see_q),
167  iEvent.emplace(lstPixelSeedInputPutToken_, std::move(pixelSeedInput));
168  iEvent.emplace(lstPixelSeedsPutToken_, std::move(see_seeds));
169 }
const edm::EDPutTokenT< LSTPixelSeedInput > lstPixelSeedInputPutToken_
unsigned int size_type
Definition: View.h:92
const std::vector< int > & see_q()
Definition: Trktree.cc:6752
const std::vector< float > & see_py()
Definition: Trktree.cc:6727
bool trackFromSeedFitFailed(const reco::Track &track)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const std::vector< float > & see_stateTrajGlbX()
Definition: Trktree.cc:6809
const std::vector< float > & see_stateTrajGlbY()
Definition: Trktree.cc:6810
const std::vector< float > & see_ptErr()
Definition: Trktree.cc:6880
const GlobalTrajectoryParameters & globalParameters() const
size_type size() const
const std::vector< float > & see_stateTrajGlbPz()
Definition: Trktree.cc:6721
const std::vector< float > & see_stateTrajGlbPy()
Definition: Trktree.cc:7008
key_type key() const
Accessor for product key.
Definition: Ref.h:244
ClusterPixelRef cluster_pixel() const
int iEvent
Definition: GenABIO.cc:224
std::vector< TrajectorySeed > TrajectorySeedCollection
virtual const Surface * surface() const
const edm::EDPutTokenT< TrajectorySeedCollection > lstPixelSeedsPutToken_
const std::vector< float > & see_stateTrajGlbPx()
Definition: Trktree.cc:6881
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > mfToken_
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
virtual OmniClusterRef const & firstClusterRef() const =0
const std::vector< float > & see_dz()
Definition: Trktree.cc:6911
const std::vector< float > & see_etaErr()
Definition: Trktree.cc:6829
const std::vector< float > & see_px()
Definition: Trktree.cc:6899
const std::vector< float > & see_dxy()
Definition: Trktree.cc:6779
void push_back(const RefToBase< T > &)
const edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
std::vector< edm::EDGetTokenT< edm::View< reco::Track > > > seedTokens_
const std::vector< float > & see_pz()
Definition: Trktree.cc:6900
def move(src, dest)
Definition: eostools.py:511
const std::vector< float > & see_stateTrajGlbZ()
Definition: Trktree.cc:6808
const std::vector< std::vector< int > > & see_hitIdx()
Definition: Trktree.cc:6734

Member Data Documentation

◆ beamSpotToken_

const edm::EDGetTokenT<reco::BeamSpot> LSTPixelSeedInputProducer::beamSpotToken_
private

Definition at line 34 of file LSTPixelSeedInputProducer.cc.

Referenced by produce().

◆ lstPixelSeedInputPutToken_

const edm::EDPutTokenT<LSTPixelSeedInput> LSTPixelSeedInputProducer::lstPixelSeedInputPutToken_
private

Definition at line 36 of file LSTPixelSeedInputProducer.cc.

Referenced by produce().

◆ lstPixelSeedsPutToken_

const edm::EDPutTokenT<TrajectorySeedCollection> LSTPixelSeedInputProducer::lstPixelSeedsPutToken_
private

Definition at line 37 of file LSTPixelSeedInputProducer.cc.

Referenced by produce().

◆ mfToken_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> LSTPixelSeedInputProducer::mfToken_
private

Definition at line 33 of file LSTPixelSeedInputProducer.cc.

Referenced by produce().

◆ seedTokens_

std::vector<edm::EDGetTokenT<edm::View<reco::Track> > > LSTPixelSeedInputProducer::seedTokens_
private

Definition at line 35 of file LSTPixelSeedInputProducer.cc.

Referenced by LSTPixelSeedInputProducer(), and produce().