CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
PixelTrackProducerFromSoA Class Reference
Inheritance diagram for PixelTrackProducerFromSoA:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

using HMSstorage = HostProduct< uint32_t[]>
 
using IndToEdm = std::vector< uint16_t >
 
- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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
 

Public Member Functions

 PixelTrackProducerFromSoA (const edm::ParameterSet &iConfig)
 
 ~PixelTrackProducerFromSoA () 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 final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const 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
 
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)
 
 ~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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices 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 streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
 

Private Attributes

const edm::EDGetTokenT
< SiPixelRecHitCollectionNew
cpuHits_
 
const edm::EDGetTokenT
< HMSstorage
hmsToken_
 
const edm::ESGetToken
< MagneticField,
IdealMagneticFieldRecord
idealMagneticFieldToken_
 
int32_t const minNumberOfHits_
 
pixelTrack::Quality const minQuality_
 
const edm::EDGetTokenT
< reco::BeamSpot
tBeamSpot_
 
const edm::EDGetTokenT
< PixelTrackHeterogeneous
tokenTrack_
 
const edm::ESGetToken
< TrackerTopology,
TrackerTopologyRcd
ttTopoToken_
 

Additional Inherited Members

- Protected Member Functions inherited from edm::ProducerBase
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< B > consumes (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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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 () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
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

This class creates "leagcy" reco::Track objects from the output of SoA CA.

Definition at line 40 of file PixelTrackProducerFromSoA.cc.

Member Typedef Documentation

Definition at line 50 of file PixelTrackProducerFromSoA.cc.

using PixelTrackProducerFromSoA::IndToEdm = std::vector<uint16_t>

Definition at line 42 of file PixelTrackProducerFromSoA.cc.

Constructor & Destructor Documentation

PixelTrackProducerFromSoA::PixelTrackProducerFromSoA ( const edm::ParameterSet iConfig)
explicit

Definition at line 68 of file PixelTrackProducerFromSoA.cc.

References pixelTrack::dup, Exception, edm::ParameterSet::getParameter(), minQuality_, pixelTrack::notQuality, and AlCaHLTBitMon_QueryRunRegistry::string.

69  : tBeamSpot_(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpot"))),
70  tokenTrack_(consumes<PixelTrackHeterogeneous>(iConfig.getParameter<edm::InputTag>("trackSrc"))),
71  cpuHits_(consumes<SiPixelRecHitCollectionNew>(iConfig.getParameter<edm::InputTag>("pixelRecHitLegacySrc"))),
72  hmsToken_(consumes<HMSstorage>(iConfig.getParameter<edm::InputTag>("pixelRecHitLegacySrc"))),
75  minNumberOfHits_(iConfig.getParameter<int>("minNumberOfHits")),
78  throw cms::Exception("PixelTrackConfiguration")
79  << iConfig.getParameter<std::string>("minQuality") + " is not a pixelTrack::Quality";
80  }
82  throw cms::Exception("PixelTrackConfiguration")
83  << iConfig.getParameter<std::string>("minQuality") + " not supported";
84  }
85  produces<reco::TrackCollection>();
86  produces<TrackingRecHitCollection>();
87  produces<reco::TrackExtraCollection>();
88  produces<IndToEdm>();
89 }
Quality qualityByName(std::string const &name)
const edm::EDGetTokenT< SiPixelRecHitCollectionNew > cpuHits_
const edm::EDGetTokenT< HMSstorage > hmsToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttTopoToken_
const edm::EDGetTokenT< reco::BeamSpot > tBeamSpot_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< PixelTrackHeterogeneous > tokenTrack_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > idealMagneticFieldToken_
pixelTrack::Quality const minQuality_
PixelTrackProducerFromSoA::~PixelTrackProducerFromSoA ( )
overridedefault

Member Function Documentation

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

Definition at line 91 of file PixelTrackProducerFromSoA.cc.

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, HLT_FULL_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

91  {
93  desc.add<edm::InputTag>("beamSpot", edm::InputTag("offlineBeamSpot"));
94  desc.add<edm::InputTag>("trackSrc", edm::InputTag("pixelTracksSoA"));
95  desc.add<edm::InputTag>("pixelRecHitLegacySrc", edm::InputTag("siPixelRecHitsPreSplittingLegacy"));
96  desc.add<int>("minNumberOfHits", 0);
97  desc.add<std::string>("minQuality", "loose");
98  descriptions.addWithDefaultLabel(desc);
99 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void PixelTrackProducerFromSoA::produce ( edm::StreamID  streamID,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 101 of file PixelTrackProducerFromSoA.cc.

References cms::cuda::assert(), b, cms::cuda::bs, LocalTrajectoryParameters::charge(), HLT_FULL_cff::chi2, funct::cos(), CommonMethods::cp(), cpuHits_, TrackingRecHit::det(), reco::TrackBase::discarded, validate-o2o-wbm::f, gpuVertexFinder::fit, edm::Event::get(), edm::EventSetup::getData(), runTauDisplay::gp, h, pixelTrack::highPurity, reco::TrackBase::highPurity, hmsToken_, mps_fire::i, idealMagneticFieldToken_, GeomDet::index(), dqmiolumiharvest::j, reco::TrackBase::loose, visualization-live-secondInstance_cfg::m, HLT_FULL_cff::maxTracks, minNumberOfHits_, minQuality_, LocalTrajectoryParameters::momentum(), eostools::move(), ndof, nhits, nHits, nt, phi, LocalTrajectoryParameters::position(), createTree::pp, edm::Event::put(), submitPVResolutionJobs::q, quality, HI_PhotonSkim_cff::rechits, makeMuonMisalignmentScenario::rot, funct::sin(), storeTracks(), tBeamSpot_, reco::TrackBase::tight, Surface::toGlobal(), tokenTrack_, HLT_FULL_cff::track, tracks, riemannFit::transformToPerigeePlane(), ttTopoToken_, reco::TrackBase::undefQuality, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

103  {
104  // enum class Quality : uint8_t { bad = 0, edup, dup, loose, strict, tight, highPurity };
113 
114  // std::cout << "Converting gpu helix in reco tracks" << std::endl;
115 
116  auto indToEdmP = std::make_unique<IndToEdm>();
117  auto &indToEdm = *indToEdmP;
118 
119  auto const &idealField = iSetup.getData(idealMagneticFieldToken_);
120 
122 
123  auto const &httopo = iSetup.getData(ttTopoToken_);
124 
125  const auto &bsh = iEvent.get(tBeamSpot_);
126  GlobalPoint bs(bsh.x0(), bsh.y0(), bsh.z0());
127 
128  auto const &rechits = iEvent.get(cpuHits_);
129  std::vector<TrackingRecHit const *> hitmap;
130  auto const &rcs = rechits.data();
131  auto nhits = rcs.size();
132  hitmap.resize(nhits, nullptr);
133 
134  auto const *hitsModuleStart = iEvent.get(hmsToken_).get();
135  auto fc = hitsModuleStart;
136 
137  for (auto const &h : rcs) {
138  auto const &thit = static_cast<BaseTrackerRecHit const &>(h);
139  auto detI = thit.det()->index();
140  auto const &clus = thit.firstClusterRef();
141  assert(clus.isPixel());
142  auto i = fc[detI] + clus.pixelCluster().originalId();
143  if (i >= hitmap.size())
144  hitmap.resize(i + 256, nullptr); // only in case of hit overflow in one module
145  assert(nullptr == hitmap[i]);
146  hitmap[i] = &h;
147  }
148 
149  std::vector<const TrackingRecHit *> hits;
150  hits.reserve(5);
151 
152  const auto &tsoa = *iEvent.get(tokenTrack_);
153 
154  auto const *quality = tsoa.qualityData();
155  auto const &fit = tsoa.stateAtBS;
156  auto const &hitIndices = tsoa.hitIndices;
157  auto maxTracks = tsoa.stride();
158 
159  tracks.reserve(maxTracks);
160 
161  int32_t nt = 0;
162 
163  for (int32_t it = 0; it < maxTracks; ++it) {
164  auto nHits = tsoa.nHits(it);
165  if (nHits == 0)
166  break; // this is a guard: maybe we need to move to nTracks...
167  indToEdm.push_back(-1);
168  auto q = quality[it];
169  if (q < minQuality_)
170  continue;
171  if (nHits < minNumberOfHits_)
172  continue;
173  indToEdm.back() = nt;
174  ++nt;
175 
176  hits.resize(nHits);
177  auto b = hitIndices.begin(it);
178  for (int iHit = 0; iHit < nHits; ++iHit)
179  hits[iHit] = hitmap[*(b + iHit)];
180 
181  // mind: this values are respect the beamspot!
182 
183  float chi2 = tsoa.chi2(it);
184  float phi = tsoa.phi(it);
185 
186  riemannFit::Vector5d ipar, opar;
187  riemannFit::Matrix5d icov, ocov;
188  fit.copyToDense(ipar, icov, it);
189  riemannFit::transformToPerigeePlane(ipar, icov, opar, ocov);
190 
191  LocalTrajectoryParameters lpar(opar(0), opar(1), opar(2), opar(3), opar(4), 1.);
193  for (int i = 0; i < 5; ++i)
194  for (int j = i; j < 5; ++j)
195  m(i, j) = ocov(i, j);
196 
197  float sp = std::sin(phi);
198  float cp = std::cos(phi);
199  Surface::RotationType rot(sp, -cp, 0, 0, 0, -1.f, cp, sp, 0);
200 
201  Plane impPointPlane(bs, rot);
203  impPointPlane.toGlobal(lpar.position()), impPointPlane.toGlobal(lpar.momentum()), lpar.charge(), &idealField);
204  JacobianLocalToCurvilinear jl2c(impPointPlane, lpar, idealField);
205 
206  AlgebraicSymMatrix55 mo = ROOT::Math::Similarity(jl2c.jacobian(), m);
207 
208  int ndof = 2 * hits.size() - 5;
209  chi2 = chi2 * ndof;
210  GlobalPoint vv = gp.position();
211  math::XYZPoint pos(vv.x(), vv.y(), vv.z());
212  GlobalVector pp = gp.momentum();
213  math::XYZVector mom(pp.x(), pp.y(), pp.z());
214 
215  auto track = std::make_unique<reco::Track>(chi2, ndof, pos, mom, gp.charge(), CurvilinearTrajectoryError(mo));
216 
217  // bad and edup not supported as fit not present or not reliable
218  auto tkq = recoQuality[int(q)];
219  track->setQuality(tkq);
220  // loose,tight and HP are inclusive
221  if (reco::TrackBase::highPurity == tkq) {
222  track->setQuality(reco::TrackBase::tight);
223  track->setQuality(reco::TrackBase::loose);
224  } else if (reco::TrackBase::tight == tkq) {
225  track->setQuality(reco::TrackBase::loose);
226  }
227  track->setQuality(tkq);
228  // filter???
229  tracks.emplace_back(track.release(), hits);
230  }
231  // std::cout << "processed " << nt << " good tuples " << tracks.size() << "out of " << indToEdm.size() << std::endl;
232 
233  // store tracks
234  storeTracks(iEvent, tracks, httopo);
235  iEvent.put(std::move(indToEdmP));
236 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
tuple pp
Definition: createTree.py:17
void storeTracks(Ev &ev, const TWH &tracksWithHits, const TrackerTopology &ttopo)
Definition: storeTracks.h:19
TrackQuality
track quality
Definition: TrackBase.h:150
uint32_t const *__restrict__ Quality * quality
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T y() const
Definition: PV3DBase.h:60
auto const & tracks
cannot be loose
assert(be >=bs)
Definition: Plane.h:16
const edm::EDGetTokenT< SiPixelRecHitCollectionNew > cpuHits_
const edm::EDGetTokenT< HMSstorage > hmsToken_
bool getData(T &iHolder) const
Definition: EventSetup.h:128
Eigen::Matrix< double, 5, 1 > Vector5d
Definition: FitResult.h:16
__host__ __device__ void transformToPerigeePlane(VI5 const &ip, MI5 const &icov, VO5 &op, MO5 &ocov)
Definition: FitUtils.h:218
const GeomDet * det() const
auto const & fit
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttTopoToken_
T z() const
Definition: PV3DBase.h:61
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
def move
Definition: eostools.py:511
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
int index() const
Definition: GeomDet.h:83
int nt
Definition: AMPTWrapper.h:42
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
const edm::EDGetTokenT< reco::BeamSpot > tBeamSpot_
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
double b
Definition: hdecay.h:118
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits
Eigen::Matrix< double, 5, 5 > Matrix5d
Definition: FitResult.h:20
const edm::EDGetTokenT< PixelTrackHeterogeneous > tokenTrack_
std::vector< TrackWithRecHits > TracksWithRecHits
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > idealMagneticFieldToken_
pixelTrack::Quality const minQuality_
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
T x() const
Definition: PV3DBase.h:59

Member Data Documentation

const edm::EDGetTokenT<SiPixelRecHitCollectionNew> PixelTrackProducerFromSoA::cpuHits_
private

Definition at line 58 of file PixelTrackProducerFromSoA.cc.

Referenced by produce().

const edm::EDGetTokenT<HMSstorage> PixelTrackProducerFromSoA::hmsToken_
private

Definition at line 59 of file PixelTrackProducerFromSoA.cc.

Referenced by produce().

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> PixelTrackProducerFromSoA::idealMagneticFieldToken_
private

Definition at line 61 of file PixelTrackProducerFromSoA.cc.

Referenced by produce().

int32_t const PixelTrackProducerFromSoA::minNumberOfHits_
private

Definition at line 64 of file PixelTrackProducerFromSoA.cc.

Referenced by produce().

pixelTrack::Quality const PixelTrackProducerFromSoA::minQuality_
private

Definition at line 65 of file PixelTrackProducerFromSoA.cc.

Referenced by PixelTrackProducerFromSoA(), and produce().

const edm::EDGetTokenT<reco::BeamSpot> PixelTrackProducerFromSoA::tBeamSpot_
private

Definition at line 56 of file PixelTrackProducerFromSoA.cc.

Referenced by produce().

const edm::EDGetTokenT<PixelTrackHeterogeneous> PixelTrackProducerFromSoA::tokenTrack_
private

Definition at line 57 of file PixelTrackProducerFromSoA.cc.

Referenced by produce().

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> PixelTrackProducerFromSoA::ttTopoToken_
private

Definition at line 62 of file PixelTrackProducerFromSoA.cc.

Referenced by produce().