CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes
JetCoreMCtruthSeedGenerator Class Reference

#include <trackJet/JetCoreMCtruthSeedGenerator/plugins/JetCoreMCtruthSeedGenerator.cc>

Inheritance diagram for JetCoreMCtruthSeedGenerator:
edm::one::EDProducer< edm::one::SharedResources > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 JetCoreMCtruthSeedGenerator (const edm::ParameterSet &)
 
 ~JetCoreMCtruthSeedGenerator () override
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::SharedResources >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
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
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Public Attributes

bool inclusiveConeSeed_
 
double jetEta_
 
double jetPt_
 
double pitchX_ = 0.01
 
double pitchY_ = 0.015
 

Static Public Attributes

static constexpr int jetDimX = 30
 
static constexpr int jetDimY = 30
 

Private Member Functions

void beginJob () override
 
std::vector< PSimHitcoreHitsFilling (std::vector< PSimHit >, const GeomDet *, GlobalVector, const reco::Vertex &)
 
std::pair< std::vector< SimTrack >, std::vector< SimVertex > > coreTracksFilling (std::vector< PSimHit >, const std::vector< SimTrack >, const std::vector< SimVertex >)
 
std::pair< std::vector< SimTrack >, std::vector< SimVertex > > coreTracksFillingDeltaR (const std::vector< SimTrack >, const std::vector< SimVertex >, const GeomDet *, const reco::Candidate &, const reco::Vertex &)
 
const GeomDetDetectorSelector (int, const reco::Candidate &, GlobalVector, const reco::Vertex &, const TrackerTopology *const, const edmNew::DetSetVector< SiPixelCluster > &)
 
void endJob () override
 
std::pair< bool, Basic3DVector< float > > findIntersection (const GlobalVector &, const reco::Candidate::Point &, const GeomDet *)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
std::vector< std::array< double, 5 > > seedParFilling (std::pair< std::vector< SimTrack >, std::vector< SimVertex >>, const GeomDet *, const reco::Candidate &)
 
std::vector< GlobalVectorsplittedClusterDirections (const reco::Candidate &, const TrackerTopology *const, const PixelClusterParameterEstimator *, const reco::Vertex &, int, const edmNew::DetSetVector< SiPixelCluster > &)
 

Private Attributes

double centralMIPCharge_
 
double chargeFracMin_
 
edm::EDGetTokenT< edm::View< reco::Candidate > > cores_
 
double deltaR_
 
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecordgeomEsToken_
 
edm::ESHandle< GlobalTrackingGeometrygeometry_
 
edm::Handle< edmNew::DetSetVector< SiPixelCluster > > inputPixelClusters_
 
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
 
const edm::ESGetToken< PixelClusterParameterEstimator, TkPixelCPERecordpixelCPEEsToken_
 
edm::EDGetTokenT< std::vector< PSimHit > > PSimHitToken_
 
double ptMin_
 
edm::Handle< std::vector< PSimHit > > simhits_
 
edm::EDGetTokenT< std::vector< SimTrack > > simtracksToken_
 
edm::EDGetTokenT< std::vector< SimVertex > > simvertexToken_
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoEsToken_
 
edm::EDGetTokenT< std::vector< reco::Vertex > > vertices_
 

Additional Inherited Members

- Public Types inherited from edm::one::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

Description: [one line class summary] Implementation: [Notes on implementation]

Definition at line 77 of file JetCoreMCtruthSeedGenerator.cc.

Constructor & Destructor Documentation

◆ JetCoreMCtruthSeedGenerator()

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

Definition at line 159 of file JetCoreMCtruthSeedGenerator.cc.

163  vertices_(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertices"))),
167  simtracksToken_(consumes<std::vector<SimTrack>>(iConfig.getParameter<edm::InputTag>("simTracks"))),
168  simvertexToken_(consumes<std::vector<SimVertex>>(iConfig.getParameter<edm::InputTag>("simVertex"))),
169  PSimHitToken_(consumes<std::vector<PSimHit>>(iConfig.getParameter<edm::InputTag>("simHit"))),
170  ptMin_(iConfig.getParameter<double>("ptMin")),
171  deltaR_(iConfig.getParameter<double>("deltaR")),
172  chargeFracMin_(iConfig.getParameter<double>("chargeFractionMin")),
173  centralMIPCharge_(iConfig.getParameter<double>("centralMIPCharge")) {
174  produces<TrajectorySeedCollection>();
175  produces<reco::TrackCollection>();
176 }
edm::EDGetTokenT< std::vector< SimTrack > > simtracksToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
const edm::ESGetToken< PixelClusterParameterEstimator, TkPixelCPERecord > pixelCPEEsToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoEsToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< std::vector< PSimHit > > PSimHitToken_
edm::EDGetTokenT< edm::View< reco::Candidate > > cores_
edm::EDGetTokenT< std::vector< SimVertex > > simvertexToken_
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > geomEsToken_
edm::EDGetTokenT< std::vector< reco::Vertex > > vertices_

◆ ~JetCoreMCtruthSeedGenerator()

JetCoreMCtruthSeedGenerator::~JetCoreMCtruthSeedGenerator ( )
override

Definition at line 178 of file JetCoreMCtruthSeedGenerator.cc.

178 {}

Member Function Documentation

◆ beginJob()

void JetCoreMCtruthSeedGenerator::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 495 of file JetCoreMCtruthSeedGenerator.cc.

495 {}

◆ coreHitsFilling()

std::vector< PSimHit > JetCoreMCtruthSeedGenerator::coreHitsFilling ( std::vector< PSimHit simhits,
const GeomDet globDet,
GlobalVector  bigClustDir,
const reco::Vertex jetVertex 
)
private

Definition at line 380 of file JetCoreMCtruthSeedGenerator.cc.

References funct::abs(), findIntersection(), geometry_, GlobalTrackingGeometry::idToDet(), jetDimX, jetDimY, pitchX_, pitchY_, reco::Vertex::position(), HLTBitAnalyser_cfi::simhits, GeomDet::specificSurface(), GloballyPositioned< T >::toLocal(), x, and y.

Referenced by produce().

383  {
384  std::vector<PSimHit> goodSimHit;
385  for (const auto& sh : simhits) {
386  const GeomDet* det = geometry_->idToDet(sh.detUnitId());
387  if (det != globDet)
388  continue;
389  std::pair<bool, Basic3DVector<float>> interPair =
390  findIntersection(bigClustDir, (reco::Candidate::Point)jetVertex.position(), det);
391  if (interPair.first == false)
392  continue;
393  Basic3DVector<float> inter = interPair.second;
394  auto localInter = det->specificSurface().toLocal((GlobalPoint)inter);
395 
396  if (std::abs((sh.localPosition()).x() - localInter.x()) / pitchX_ <= jetDimX / 2 &&
397  std::abs((sh.localPosition()).y() - localInter.y()) / pitchY_ <= jetDimY / 2) {
398  goodSimHit.emplace_back(sh);
399  }
400  }
401  return goodSimHit;
402 }
const Point & position() const
position
Definition: Vertex.h:128
edm::ESHandle< GlobalTrackingGeometry > geometry_
LocalPoint toLocal(const GlobalPoint &gp) const
const GeomDet * idToDet(DetId) const override
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::pair< bool, Basic3DVector< float > > findIntersection(const GlobalVector &, const reco::Candidate::Point &, const GeomDet *)
math::XYZPoint Point
point in the space
Definition: Candidate.h:40
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:40

◆ coreTracksFilling()

std::pair< std::vector< SimTrack >, std::vector< SimVertex > > JetCoreMCtruthSeedGenerator::coreTracksFilling ( std::vector< PSimHit goodSimHit,
const std::vector< SimTrack simtracksVector,
const std::vector< SimVertex simvertexVector 
)
private

Definition at line 404 of file JetCoreMCtruthSeedGenerator.cc.

References createfilelist::int, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, dqmiolumiharvest::j, convertSQLitetoXML_cfg::output, pfDeepBoostedJetPreprocessParams_cfi::sv, CoreSimTrack::trackId(), parallelization::uint, findQualityFiles::v, and SimTrack::vertIndex().

Referenced by produce().

407  {
408  std::vector<SimTrack> goodSimTrk;
409  std::vector<SimVertex> goodSimVtx;
410 
411  for (uint j = 0; j < simtracksVector.size(); j++) {
412  for (std::vector<PSimHit>::const_iterator it = goodSimHit.begin(); it != goodSimHit.end(); ++it) {
413  SimTrack st = simtracksVector[j];
414  if (st.trackId() == (*it).trackId()) {
415  for (uint v = 0; v < simvertexVector.size(); v++) {
416  SimVertex sv = simvertexVector[v];
417  if ((int)sv.vertexId() == (int)st.vertIndex()) {
418  goodSimTrk.emplace_back(st);
419  goodSimVtx.emplace_back(sv);
420  }
421  }
422  }
423  }
424  }
425  std::pair<std::vector<SimTrack>, std::vector<SimVertex>> output(goodSimTrk, goodSimVtx);
426  return output;
427 }
int vertIndex() const
index of the vertex in the Event container (-1 if no vertex)
Definition: SimTrack.h:33
unsigned int trackId() const
Definition: CoreSimTrack.h:31

◆ coreTracksFillingDeltaR()

std::pair< std::vector< SimTrack >, std::vector< SimVertex > > JetCoreMCtruthSeedGenerator::coreTracksFillingDeltaR ( const std::vector< SimTrack simtracksVector,
const std::vector< SimVertex simvertexVector,
const GeomDet globDet,
const reco::Candidate jet,
const reco::Vertex jetVertex 
)
private

Definition at line 429 of file JetCoreMCtruthSeedGenerator.cc.

References CoreSimTrack::charge(), PbPb_ZMuSkimMuonDPG_cff::deltaR, deltaR_, createfilelist::int, dqmiolumiharvest::j, metsig::jet, CoreSimTrack::momentum(), convertSQLitetoXML_cfg::output, pfDeepBoostedJetPreprocessParams_cfi::sv, parallelization::uint, findQualityFiles::v, and SimTrack::vertIndex().

Referenced by produce().

434  {
435  std::vector<SimTrack> goodSimTrk;
436  std::vector<SimVertex> goodSimVtx;
437 
438  GlobalVector jetDir(jet.px(), jet.py(), jet.pz());
439 
440  for (uint j = 0; j < simtracksVector.size(); j++) {
441  SimTrack st = simtracksVector[j];
442  GlobalVector trkDir(st.momentum().Px(), st.momentum().Py(), st.momentum().Pz());
443  if (st.charge() == 0)
444  continue;
445  if (Geom::deltaR(jetDir, trkDir) < deltaR_) {
446  for (uint v = 0; v < simvertexVector.size(); v++) {
447  SimVertex sv = simvertexVector[v];
448  if ((int)sv.vertexId() == (int)st.vertIndex()) {
449  goodSimTrk.emplace_back(st);
450  goodSimVtx.emplace_back(sv);
451  }
452  }
453  }
454  }
455  std::pair<std::vector<SimTrack>, std::vector<SimVertex>> output(goodSimTrk, goodSimVtx);
456  return output;
457 }
float charge() const
charge
Definition: CoreSimTrack.cc:17
const math::XYZTLorentzVectorD & momentum() const
Definition: CoreSimTrack.h:19
int vertIndex() const
index of the vertex in the Event container (-1 if no vertex)
Definition: SimTrack.h:33

◆ DetectorSelector()

const GeomDet * JetCoreMCtruthSeedGenerator::DetectorSelector ( int  llay,
const reco::Candidate jet,
GlobalVector  jetDir,
const reco::Vertex jetVertex,
const TrackerTopology * const  tTopo,
const edmNew::DetSetVector< SiPixelCluster > &  clusters 
)
private

Definition at line 316 of file JetCoreMCtruthSeedGenerator.cc.

References funct::abs(), bsc_activity_cfg::clusters, findIntersection(), GeomDet::geographicalId(), geometry_, GlobalTrackingGeometry::idToDet(), TrackerTopology::layer(), convertSQLitetoXML_cfg::output, reco::Vertex::position(), GeomDet::specificSurface(), GloballyPositioned< T >::toLocal(), x, and y.

Referenced by produce().

321  {
322  struct trkNumCompare {
323  bool operator()(std::pair<int, const GeomDet*> x, std::pair<int, const GeomDet*> y) const {
324  return x.first > y.first;
325  }
326  };
327  std::set<std::pair<int, const GeomDet*>, trkNumCompare> track4detSet;
328 
329  double minDist = 0.0;
330  const GeomDet* output = nullptr;
331  for (const auto& detset : clusters) {
332  auto aClusterID = detset.id();
333  if (DetId(aClusterID).subdetId() != 1)
334  continue;
335  const GeomDet* det = geometry_->idToDet(aClusterID);
336  int lay = tTopo->layer(det->geographicalId());
337  if (lay != llay)
338  continue;
339  std::pair<bool, Basic3DVector<float>> interPair =
340  findIntersection(jetDir, (reco::Candidate::Point)jetVertex.position(), det);
341  if (interPair.first == false)
342  continue;
343  Basic3DVector<float> inter = interPair.second;
344  auto localInter = det->specificSurface().toLocal((GlobalPoint)inter);
345  if ((minDist == 0.0 || std::abs(localInter.x()) < minDist) && std::abs(localInter.y()) < 3.35) {
346  minDist = std::abs(localInter.x());
347  output = det;
348  }
349  } //detset
350  return output;
351 }
const Point & position() const
position
Definition: Vertex.h:128
edm::ESHandle< GlobalTrackingGeometry > geometry_
LocalPoint toLocal(const GlobalPoint &gp) const
const GeomDet * idToDet(DetId) const override
unsigned int layer(const DetId &id) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
std::pair< bool, Basic3DVector< float > > findIntersection(const GlobalVector &, const reco::Candidate::Point &, const GeomDet *)
Definition: DetId.h:17
math::XYZPoint Point
point in the space
Definition: Candidate.h:40
Definition: output.py:1
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:40

◆ endJob()

void JetCoreMCtruthSeedGenerator::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 498 of file JetCoreMCtruthSeedGenerator.cc.

498 {}

◆ fillDescriptions()

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

Definition at line 501 of file JetCoreMCtruthSeedGenerator.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

501  {
503  desc.add<edm::InputTag>("vertices", edm::InputTag("offlinePrimaryVertices"));
504  desc.add<edm::InputTag>("pixelClusters", edm::InputTag("siPixelClustersPreSplitting"));
505  desc.add<edm::InputTag>("cores", edm::InputTag("jetsForCoreTracking"));
506  desc.add<double>("ptMin", 300);
507  desc.add<double>("deltaR", 0.3);
508  desc.add<double>("chargeFractionMin", 18000.0);
509  desc.add<edm::InputTag>("simTracks", edm::InputTag("g4SimHits"));
510  desc.add<edm::InputTag>("simVertex", edm::InputTag("g4SimHits"));
511  desc.add<edm::InputTag>("simHit", edm::InputTag("g4SimHits", "TrackerHitsPixelBarrelLowTof"));
512  desc.add<double>("centralMIPCharge", 2.);
513  desc.add<std::string>("pixelCPE", "PixelCPEGeneric");
514  descriptions.add("JetCoreMCtruthSeedGenerator", desc);
515 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ findIntersection()

std::pair< bool, Basic3DVector< float > > JetCoreMCtruthSeedGenerator::findIntersection ( const GlobalVector dir,
const reco::Candidate::Point vertex,
const GeomDet det 
)
private

Definition at line 306 of file JetCoreMCtruthSeedGenerator.cc.

References DeadROC_duringRun::dir, StraightLinePlaneCrossing::position(), GeomDet::specificSurface(), and bphysicsOniaDQM_cfi::vertex.

Referenced by coreHitsFilling(), DetectorSelector(), and seedParFilling().

307  {
309  Basic3DVector<float>(dir.x(), dir.y(), dir.z()));
310 
311  std::pair<bool, Basic3DVector<float>> pos = vertexPlane.position(det->specificSurface());
312 
313  return pos;
314 }
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:40

◆ produce()

void JetCoreMCtruthSeedGenerator::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDProducerBase.

Definition at line 180 of file JetCoreMCtruthSeedGenerator.cc.

References alongMomentum, gpuPixelDoublets::cc, coreHitsFilling(), HLT_FULL_cff::cores, cores_, coreTracksFilling(), coreTracksFillingDeltaR(), DetectorSelector(), hcalRecHitTable_cff::detId, MillePedeFileConverter_cfg::e, PV3DBase< T, PVType, FrameType >::eta(), JetChargeProducer_cfi::exp, GeomDet::geographicalId(), geomEsToken_, geometry_, edm::EventSetup::getData(), edm::EventSetup::getHandle(), iEvent, inclusiveConeSeed_, inputPixelClusters_, createfilelist::int, metsig::jet, jetEta_, jetPt_, eostools::move(), PV3DBase< T, PVType, FrameType >::phi(), pixelClusters_, HLT_2024v14_cff::pixelCPE, pixelCPEEsToken_, createTree::pp, PSimHitToken_, DiDispStaMuonMonitor_cfi::pt, ptMin_, mps_fire::result, seedParFilling(), simhits_, simtracksToken_, simvertexToken_, funct::sin(), splittedClusterDirections(), GeomDet::surface(), Surface::toGlobal(), GloballyPositioned< T >::toLocal(), leptonTimeLifeInfo_common_cff::track_phi, tTopoEsToken_, parallelization::uint, AlignmentTracksFromVertexSelector_cfi::vertices, vertices_, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

180  {
181  auto result = std::make_unique<TrajectorySeedCollection>();
182  auto resultTracks = std::make_unique<reco::TrackCollection>();
183 
184  using namespace edm;
185  using namespace reco;
186 
187  geometry_ = iSetup.getHandle(geomEsToken_);
188 
189  const auto& inputPixelClusters_ = iEvent.get(pixelClusters_);
190  const auto& simtracksVector = iEvent.get(simtracksToken_);
191  const auto& simvertexVector = iEvent.get(simvertexToken_);
192  const auto& simhits_ = iEvent.get(PSimHitToken_);
193  const auto& vertices = iEvent.get(vertices_);
194  const auto& cores = iEvent.get(cores_);
195 
197  const TrackerTopology* const tTopo = &iSetup.getData(tTopoEsToken_);
198 
199  auto output = std::make_unique<edmNew::DetSetVector<SiPixelCluster>>();
200 
201  for (const auto& jet : cores) { //jet loop
202 
203  if (jet.pt() > ptMin_) {
204  std::set<long long int> ids;
205  const reco::Vertex& jetVertex = vertices[0];
206 
207  std::vector<GlobalVector> splitClustDirSet =
209  if (splitClustDirSet.empty()) { //if layer 1 is broken find direcitons on layer 2
210  splitClustDirSet = splittedClusterDirections(jet, tTopo, pixelCPE, jetVertex, 2, inputPixelClusters_);
211  }
212  if (inclusiveConeSeed_)
213  splitClustDirSet.clear();
214  splitClustDirSet.emplace_back(GlobalVector(jet.px(), jet.py(), jet.pz()));
215 
216  for (int cc = 0; cc < (int)splitClustDirSet.size(); cc++) {
217  GlobalVector bigClustDir = splitClustDirSet[cc];
218 
219  jetEta_ = jet.eta();
220  jetPt_ = jet.pt();
221 
222  const auto& jetVert = jetVertex; //trackInfo filling
223 
224  std::vector<PSimHit> goodSimHit;
225 
226  const GeomDet* globDet = DetectorSelector(
227  2, jet, bigClustDir, jetVertex, tTopo, inputPixelClusters_); //select detector mostly hitten by the jet
228 
229  if (globDet == nullptr)
230  continue;
231 
232  std::pair<std::vector<SimTrack>, std::vector<SimVertex>> goodSimTkVx;
233 
234  if (inclusiveConeSeed_) {
236  simtracksVector, simvertexVector, globDet, jet, jetVert);
237  } else {
238  std::vector<PSimHit> goodSimHit =
239  JetCoreMCtruthSeedGenerator::coreHitsFilling(simhits_, globDet, bigClustDir, jetVertex);
240  goodSimTkVx = JetCoreMCtruthSeedGenerator::coreTracksFilling(goodSimHit, simtracksVector, simvertexVector);
241  }
242  edm::LogInfo("PerfectSeeder") << "seed number in deltaR cone =" << goodSimTkVx.first.size();
243 
244  std::vector<std::array<double, 5>> seedVector =
245  JetCoreMCtruthSeedGenerator::seedParFilling(goodSimTkVx, globDet, jet);
246  edm::LogInfo("PerfectSeeder") << "seedVector.size()=" << seedVector.size();
247 
248  for (uint tk = 0; tk < seedVector.size(); tk++) {
249  for (int pp = 0; pp < 5; pp++) {
250  edm::LogInfo("PerfectSeeder")
251  << "seed " << tk << ", int par " << pp << "=" << seedVector[tk][pp] << std::endl;
252  }
253  LocalPoint localSeedPoint = LocalPoint(seedVector[tk][0], seedVector[tk][1], 0);
254  double track_theta = 2 * std::atan(std::exp(-seedVector[tk][2]));
255  double track_phi = seedVector[tk][3];
256  double pt = 1. / seedVector[tk][4];
257 
258  double normdirR = pt / sin(track_theta);
259  const GlobalVector globSeedDir(
261  LocalVector localSeedDir = globDet->surface().toLocal(globSeedDir);
262 
263  int64_t seedid = (int64_t(localSeedPoint.x() * 200.) << 0) + (int64_t(localSeedPoint.y() * 200.) << 16) +
264  (int64_t(seedVector[tk][2] * 400.) << 32) + (int64_t(track_phi * 400.) << 48);
265  if (ids.count(seedid) != 0) {
266  edm::LogInfo("PerfectSeeder") << "seed not removed with DeepCore cleaner";
267  }
268  ids.insert(seedid);
269 
270  //Covariance matrix, currently the hadrcoded variances = NN residuals width (see documentation of DeepCore)
271  //in general: if are not compared with DeepCore but another algo-->to state-of-the art errors
272  //The "perfect seeds" has no intrinsic error, but the CTF needs errors to propagate...
273  float em[15] = {
274  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // (see LocalTrajectoryError for details), order as follow:
275  em[0] = 0.15 * 0.15; // q/pt
276  em[2] = 0.5e-5; // dxdz
277  em[5] = 0.5e-5; // dydz
278  em[9] = 2e-5; // x
279  em[14] = 2e-5; // y
280  long int detId = globDet->geographicalId();
281  LocalTrajectoryParameters localParam(localSeedPoint, localSeedDir, TrackCharge(1));
282  result->emplace_back(TrajectorySeed(PTrajectoryStateOnDet(localParam, pt, em, detId, /*surfaceSide*/ 0),
285 
286  GlobalPoint globalSeedPoint = globDet->surface().toGlobal(localSeedPoint);
288  resultTracks->emplace_back(
289  reco::Track(1,
290  1,
291  reco::Track::Point(globalSeedPoint.x(), globalSeedPoint.y(), globalSeedPoint.z()),
292  reco::Track::Vector(globSeedDir.x(), globSeedDir.y(), globSeedDir.z()),
293  1,
294  mm));
295  edm::LogInfo("PerfectSeeder") << "seed " << tk << ", out, pt=" << pt << ", eta=" << globSeedDir.eta()
296  << ", phi=" << globSeedDir.phi() << std::endl;
297  }
298 
299  } //bigcluster
300  } //jet > pt
301  } //jet
302  iEvent.put(std::move(result));
303  iEvent.put(std::move(resultTracks));
304 }
edm::EDGetTokenT< std::vector< SimTrack > > simtracksToken_
std::vector< PSimHit > coreHitsFilling(std::vector< PSimHit >, const GeomDet *, GlobalVector, const reco::Vertex &)
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
edm::Handle< std::vector< PSimHit > > simhits_
const edm::ESGetToken< PixelClusterParameterEstimator, TkPixelCPERecord > pixelCPEEsToken_
T z() const
Definition: PV3DBase.h:61
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
edm::ESHandle< GlobalTrackingGeometry > geometry_
std::vector< GlobalVector > splittedClusterDirections(const reco::Candidate &, const TrackerTopology *const, const PixelClusterParameterEstimator *, const reco::Vertex &, int, const edmNew::DetSetVector< SiPixelCluster > &)
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoEsToken_
LocalPoint toLocal(const GlobalPoint &gp) const
edm::EDGetTokenT< std::vector< PSimHit > > PSimHitToken_
int TrackCharge
Definition: TrackCharge.h:4
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
int iEvent
Definition: GenABIO.cc:224
std::vector< std::array< double, 5 > > seedParFilling(std::pair< std::vector< SimTrack >, std::vector< SimVertex >>, const GeomDet *, const reco::Candidate &)
const GeomDet * DetectorSelector(int, const reco::Candidate &, GlobalVector, const reco::Vertex &, const TrackerTopology *const, const edmNew::DetSetVector< SiPixelCluster > &)
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
edm::EDGetTokenT< edm::View< reco::Candidate > > cores_
edm::EDGetTokenT< std::vector< SimVertex > > simvertexToken_
std::pair< std::vector< SimTrack >, std::vector< SimVertex > > coreTracksFillingDeltaR(const std::vector< SimTrack >, const std::vector< SimVertex >, const GeomDet *, const reco::Candidate &, const reco::Vertex &)
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
Log< level::Info, false > LogInfo
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > geomEsToken_
fixed size matrix
HLT enums.
Definition: output.py:1
std::pair< std::vector< SimTrack >, std::vector< SimVertex > > coreTracksFilling(std::vector< PSimHit >, const std::vector< SimTrack >, const std::vector< SimVertex >)
edm::EDGetTokenT< std::vector< reco::Vertex > > vertices_
edm::Handle< edmNew::DetSetVector< SiPixelCluster > > inputPixelClusters_
math::XYZVector Vector
spatial vector
Definition: TrackBase.h:77
Definition: Phi.h:52
def move(src, dest)
Definition: eostools.py:511
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:74
Global3DVector GlobalVector
Definition: GlobalVector.h:10

◆ seedParFilling()

std::vector< std::array< double, 5 > > JetCoreMCtruthSeedGenerator::seedParFilling ( std::pair< std::vector< SimTrack >, std::vector< SimVertex >>  goodSimTkVx,
const GeomDet globDet,
const reco::Candidate jet 
)
private

Definition at line 459 of file JetCoreMCtruthSeedGenerator.cc.

References findIntersection(), dqmiolumiharvest::j, metsig::jet, CoreSimTrack::momentum(), convertSQLitetoXML_cfg::output, GeomDet::specificSurface(), pfDeepBoostedJetPreprocessParams_cfi::sv, GloballyPositioned< T >::toLocal(), parallelization::uint, and PV3DBase< T, PVType, FrameType >::x().

Referenced by produce().

462  {
463  std::vector<std::array<double, 5>> output;
464  std::vector<SimTrack> goodSimTrk = goodSimTkVx.first;
465  std::vector<SimVertex> goodSimVtx = goodSimTkVx.second;
466 
467  edm::LogInfo("PerfectSeeder") << "goodSimTrk size" << goodSimTrk.size();
468  for (uint j = 0; j < goodSimTrk.size(); j++) {
469  SimTrack st = goodSimTrk[j];
470  SimVertex sv = goodSimVtx[j];
471  GlobalVector trkMom(st.momentum().x(), st.momentum().y(), st.momentum().z());
472  GlobalPoint trkPos(sv.position().x(), sv.position().y(), sv.position().z());
473  edm::LogInfo("PerfectSeeder") << "seed " << j << ", very int pt" << st.momentum().Pt()
474  << ", eta=" << st.momentum().Eta() << ", phi=" << st.momentum().Phi()
475  << "------ internal point=" << trkMom.x() << "," << trkMom.y() << "," << trkMom.z()
476  << "," << trkPos.x() << "," << trkPos.y() << "," << trkPos.z() << std::endl;
477 
478  std::pair<bool, Basic3DVector<float>> trkInterPair;
479  trkInterPair = findIntersection(trkMom, (reco::Candidate::Point)trkPos, globDet);
480  if (trkInterPair.first == false) {
481  GlobalVector jetDir(jet.px(), jet.py(), jet.pz());
482  continue;
483  }
484  Basic3DVector<float> trkInter = trkInterPair.second;
485 
486  auto localTrkInter = globDet->specificSurface().toLocal((GlobalPoint)trkInter); //trkInter->trkPos if par at vertex
487  std::array<double, 5> tkPar{
488  {localTrkInter.x(), localTrkInter.y(), st.momentum().Eta(), st.momentum().Phi(), 1 / st.momentum().Pt()}};
489  output.emplace_back(tkPar);
490  }
491  return output;
492 }
LocalPoint toLocal(const GlobalPoint &gp) const
const math::XYZTLorentzVectorD & momentum() const
Definition: CoreSimTrack.h:19
T x() const
Definition: PV3DBase.h:59
std::pair< bool, Basic3DVector< float > > findIntersection(const GlobalVector &, const reco::Candidate::Point &, const GeomDet *)
Log< level::Info, false > LogInfo
math::XYZPoint Point
point in the space
Definition: Candidate.h:40
Definition: output.py:1
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:40

◆ splittedClusterDirections()

std::vector< GlobalVector > JetCoreMCtruthSeedGenerator::splittedClusterDirections ( const reco::Candidate jet,
const TrackerTopology * const  tTopo,
const PixelClusterParameterEstimator pixelCPE,
const reco::Vertex jetVertex,
int  layer,
const edmNew::DetSetVector< SiPixelCluster > &  clusters 
)
private

Definition at line 353 of file JetCoreMCtruthSeedGenerator.cc.

References bsc_activity_cfg::clusters, PbPb_ZMuSkimMuonDPG_cff::deltaR, deltaR_, GeomDet::geographicalId(), geometry_, GlobalTrackingGeometry::idToDet(), GlobalTrackingGeometry::idToDetUnit(), metsig::jet, nano_mu_digi_cff::layer, TrackerTopology::layer(), HLT_2024v14_cff::pixelCPE, reco::Vertex::position(), GeomDet::surface(), and Surface::toGlobal().

Referenced by produce().

359  {
360  std::vector<GlobalVector> clustDirs;
361  for (const auto& detset_int : clusters) {
362  const GeomDet* det_int = geometry_->idToDet(detset_int.id());
363  int lay = tTopo->layer(det_int->geographicalId());
364  if (lay != layer)
365  continue; //NB: saved bigclusetr on all the layers!!
366  auto detUnit = *geometry_->idToDetUnit(detset_int.id());
367  for (const auto& aCluster : detset_int) {
368  GlobalPoint clustPos = det_int->surface().toGlobal(pixelCPE->localParametersV(aCluster, detUnit)[0].first);
369  GlobalPoint vertexPos(jetVertex.position().x(), jetVertex.position().y(), jetVertex.position().z());
370  GlobalVector clusterDir = clustPos - vertexPos;
371  GlobalVector jetDir(jet.px(), jet.py(), jet.pz());
372  if (Geom::deltaR(jetDir, clusterDir) < deltaR_) {
373  clustDirs.emplace_back(clusterDir);
374  }
375  }
376  }
377  return clustDirs;
378 }
const Point & position() const
position
Definition: Vertex.h:128
edm::ESHandle< GlobalTrackingGeometry > geometry_
const GeomDet * idToDet(DetId) const override
unsigned int layer(const DetId &id) const
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.

Member Data Documentation

◆ centralMIPCharge_

double JetCoreMCtruthSeedGenerator::centralMIPCharge_
private

Definition at line 116 of file JetCoreMCtruthSeedGenerator.cc.

◆ chargeFracMin_

double JetCoreMCtruthSeedGenerator::chargeFracMin_
private

Definition at line 115 of file JetCoreMCtruthSeedGenerator.cc.

◆ cores_

edm::EDGetTokenT<edm::View<reco::Candidate> > JetCoreMCtruthSeedGenerator::cores_
private

Definition at line 107 of file JetCoreMCtruthSeedGenerator.cc.

Referenced by produce().

◆ deltaR_

double JetCoreMCtruthSeedGenerator::deltaR_
private

◆ geomEsToken_

const edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> JetCoreMCtruthSeedGenerator::geomEsToken_
private

Definition at line 99 of file JetCoreMCtruthSeedGenerator.cc.

Referenced by produce().

◆ geometry_

edm::ESHandle<GlobalTrackingGeometry> JetCoreMCtruthSeedGenerator::geometry_
private

◆ inclusiveConeSeed_

bool JetCoreMCtruthSeedGenerator::inclusiveConeSeed_
Initial value:
=
true

Definition at line 90 of file JetCoreMCtruthSeedGenerator.cc.

Referenced by produce().

◆ inputPixelClusters_

edm::Handle<edmNew::DetSetVector<SiPixelCluster> > JetCoreMCtruthSeedGenerator::inputPixelClusters_
private

Definition at line 106 of file JetCoreMCtruthSeedGenerator.cc.

Referenced by produce().

◆ jetDimX

constexpr int JetCoreMCtruthSeedGenerator::jetDimX = 30
static

Definition at line 88 of file JetCoreMCtruthSeedGenerator.cc.

Referenced by coreHitsFilling().

◆ jetDimY

constexpr int JetCoreMCtruthSeedGenerator::jetDimY = 30
static

Definition at line 89 of file JetCoreMCtruthSeedGenerator.cc.

Referenced by coreHitsFilling().

◆ jetEta_

double JetCoreMCtruthSeedGenerator::jetEta_

Definition at line 85 of file JetCoreMCtruthSeedGenerator.cc.

Referenced by produce().

◆ jetPt_

double JetCoreMCtruthSeedGenerator::jetPt_

Definition at line 84 of file JetCoreMCtruthSeedGenerator.cc.

Referenced by produce().

◆ pitchX_

double JetCoreMCtruthSeedGenerator::pitchX_ = 0.01

Definition at line 86 of file JetCoreMCtruthSeedGenerator.cc.

Referenced by coreHitsFilling().

◆ pitchY_

double JetCoreMCtruthSeedGenerator::pitchY_ = 0.015

Definition at line 87 of file JetCoreMCtruthSeedGenerator.cc.

Referenced by coreHitsFilling().

◆ pixelClusters_

edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > JetCoreMCtruthSeedGenerator::pixelClusters_
private

Definition at line 105 of file JetCoreMCtruthSeedGenerator.cc.

Referenced by produce().

◆ pixelCPEEsToken_

const edm::ESGetToken<PixelClusterParameterEstimator, TkPixelCPERecord> JetCoreMCtruthSeedGenerator::pixelCPEEsToken_
private

Definition at line 100 of file JetCoreMCtruthSeedGenerator.cc.

Referenced by produce().

◆ PSimHitToken_

edm::EDGetTokenT<std::vector<PSimHit> > JetCoreMCtruthSeedGenerator::PSimHitToken_
private

Definition at line 110 of file JetCoreMCtruthSeedGenerator.cc.

Referenced by produce().

◆ ptMin_

double JetCoreMCtruthSeedGenerator::ptMin_
private

Definition at line 113 of file JetCoreMCtruthSeedGenerator.cc.

Referenced by produce().

◆ simhits_

edm::Handle<std::vector<PSimHit> > JetCoreMCtruthSeedGenerator::simhits_
private

Definition at line 111 of file JetCoreMCtruthSeedGenerator.cc.

Referenced by produce().

◆ simtracksToken_

edm::EDGetTokenT<std::vector<SimTrack> > JetCoreMCtruthSeedGenerator::simtracksToken_
private

Definition at line 108 of file JetCoreMCtruthSeedGenerator.cc.

Referenced by produce().

◆ simvertexToken_

edm::EDGetTokenT<std::vector<SimVertex> > JetCoreMCtruthSeedGenerator::simvertexToken_
private

Definition at line 109 of file JetCoreMCtruthSeedGenerator.cc.

Referenced by produce().

◆ tTopoEsToken_

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> JetCoreMCtruthSeedGenerator::tTopoEsToken_
private

Definition at line 101 of file JetCoreMCtruthSeedGenerator.cc.

Referenced by produce().

◆ vertices_

edm::EDGetTokenT<std::vector<reco::Vertex> > JetCoreMCtruthSeedGenerator::vertices_
private

Definition at line 104 of file JetCoreMCtruthSeedGenerator.cc.

Referenced by produce().