CMS 3D CMS Logo

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

Public Member Functions

 RechitClusterProducerT (const edm::ParameterSet &)
 
 ~RechitClusterProducerT () 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
 
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
 
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 Types

typedef std::vector< reco::MuonRecHitClusterRecHitClusterCollection
 
typedef Trait::RecHitRef RechitRef
 
typedef Trait::RecHitRefVector RecHitRefVector
 

Private Member Functions

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

Private Attributes

const edm::ESGetToken< typename Trait::GeometryType, MuonGeometryRecordgeometryToken_
 
edm::EDGetTokenT< typename Trait::InputType > inputToken_
 
const int nRechitMin_
 
const int nStationThres_
 
const double rParam_
 

Additional Inherited Members

- 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
 
- 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 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 ()
 
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

template<typename Trait>
class RechitClusterProducerT< Trait >

Definition at line 45 of file RechitClusterProducer.cc.

Member Typedef Documentation

◆ RecHitClusterCollection

template<typename Trait >
typedef std::vector<reco::MuonRecHitCluster> RechitClusterProducerT< Trait >::RecHitClusterCollection
private

Definition at line 59 of file RechitClusterProducer.cc.

◆ RechitRef

template<typename Trait >
typedef Trait::RecHitRef RechitClusterProducerT< Trait >::RechitRef
private

Definition at line 46 of file RechitClusterProducer.cc.

◆ RecHitRefVector

template<typename Trait >
typedef Trait::RecHitRefVector RechitClusterProducerT< Trait >::RecHitRefVector
private

Definition at line 47 of file RechitClusterProducer.cc.

Constructor & Destructor Documentation

◆ RechitClusterProducerT()

template<typename Trait >
RechitClusterProducerT< Trait >::RechitClusterProducerT ( const edm::ParameterSet iConfig)
explicit

Definition at line 67 of file RechitClusterProducer.cc.

68  : geometryToken_(esConsumes<typename Trait::GeometryType, MuonGeometryRecord>()),
69  inputToken_(consumes<typename Trait::InputType>(iConfig.getParameter<edm::InputTag>("recHitLabel"))),
70  rParam_(iConfig.getParameter<double>("rParam")),
71  nRechitMin_(iConfig.getParameter<int>("nRechitMin")),
72  nStationThres_(iConfig.getParameter<int>("nStationThres")) {
73  produces<RecHitClusterCollection>();
74 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::ESGetToken< typename Trait::GeometryType, MuonGeometryRecord > geometryToken_
edm::EDGetTokenT< typename Trait::InputType > inputToken_

◆ ~RechitClusterProducerT()

template<typename Trait >
RechitClusterProducerT< Trait >::~RechitClusterProducerT ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

template<typename Trait >
void RechitClusterProducerT< Trait >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 165 of file RechitClusterProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, HLT_2022v12_cff::InputTag, and dtEfficiencyTask_cfi::recHitLabel.

165  {
167  desc.add<int>("nRechitMin", 50);
168  desc.add<double>("rParam", 0.4);
169  desc.add<int>("nStationThres", 10);
170  desc.add<edm::InputTag>("recHitLabel", edm::InputTag(Trait::recHitLabel()));
171  descriptions.add(Trait::producerName(), desc);
172 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

template<typename Trait >
void RechitClusterProducerT< Trait >::produce ( edm::StreamID  ,
edm::Event ev,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 82 of file RechitClusterProducer.cc.

References bsc_activity_cfg::clusters, submitPVResolutionJobs::count, makeMEIFBenchmarkPlots::ev, edm::EventSetup::getData(), PixelMapPlotter::inputs, PV3DBase< T, PVType, FrameType >::mag(), eostools::move(), position, ptmin, HI_PhotonSkim_cff::rechits, mathSSE::sqrt(), relativeConstraints::station, x, PV3DBase< T, PVType, FrameType >::x(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

82  {
83  auto const& geo = iSetup.getData(geometryToken_);
84  auto const& rechits = ev.get(inputToken_);
85 
86  std::vector<fastjet::PseudoJet> fjInput;
88 
89  fastjet::JetDefinition jet_def(fastjet::cambridge_algorithm, rParam_);
90 
91  Trait recHitTrait;
92 
93  int recIt = 0;
94  for (auto const& rechit : rechits) {
95  LocalPoint recHitLocalPosition = rechit.localPosition();
96  auto detid = recHitTrait.detid(rechit);
97  auto thischamber = geo.chamber(detid);
98  if (thischamber) {
99  GlobalPoint globalPosition = thischamber->toGlobal(recHitLocalPosition);
100  float x = globalPosition.x();
101  float y = globalPosition.y();
102  float z = globalPosition.z();
103  RechitRef ref = RechitRef(&rechits, recIt);
104  inputs.push_back(ref);
105  fjInput.push_back(fastjet::PseudoJet(x, y, z, globalPosition.mag()));
106  fjInput.back().set_user_index(recIt);
107  }
108  recIt++;
109  }
110  fastjet::ClusterSequence clus_seq(fjInput, jet_def);
111 
112  //keep all the clusters
113  double ptmin = 0.0;
114  std::vector<fastjet::PseudoJet> fjJets = clus_seq.inclusive_jets(ptmin);
115 
116  auto clusters = std::make_unique<RecHitClusterCollection>();
117  for (auto const& fjJet : fjJets) {
118  // skip if the cluster has too few rechits
119  if (int(fjJet.constituents().size()) < nRechitMin_)
120  continue;
121  // get the constituents from fastjet
123  for (auto const& constituent : fjJet.constituents()) {
124  auto index = constituent.user_index();
125  if (index >= 0 && static_cast<unsigned int>(index) < inputs.size()) {
126  rechits.push_back(inputs[index]);
127  }
128  }
129 
130  //Derive cluster properties
131  int nStation = 0;
132  int totStation = 0;
133  float avgStation = 0.0;
134  std::map<int, int> station_count_map;
135  for (auto const& rechit : rechits) {
136  station_count_map[recHitTrait.station(*rechit)]++;
137  }
138  //station statistics
139  std::map<int, int>::iterator it;
140  for (auto const& [station, count] : station_count_map) {
141  if (count >= nStationThres_) {
142  nStation++;
143  avgStation += station * count;
144  totStation += count;
145  }
146  }
147  if (totStation != 0) {
148  avgStation = avgStation / totStation;
149  }
150  float invN = 1.f / rechits.size();
151  // cluster position is the average position of the constituent rechits
152  float jetX = fjJet.px() * invN;
153  float jetY = fjJet.py() * invN;
154  float jetZ = fjJet.pz() * invN;
155 
157  std::sqrt(jetX * jetX + jetY * jetY), etaFromXYZ(jetX, jetY, jetZ), std::atan2(jetY, jetX));
158  Trait::emplace_back(clusters.get(), position, nStation, avgStation, rechits);
159  }
160  ev.put(std::move(clusters));
161 }
const edm::ESGetToken< typename Trait::GeometryType, MuonGeometryRecord > geometryToken_
T z() const
Definition: PV3DBase.h:61
ROOT::Math::DisplacementVector3D< ROOT::Math::CylindricalEta3D< float > > RhoEtaPhiVectorF
spatial vector with cylindrical internal representation using pseudorapidity
Definition: Vector3D.h:18
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
T sqrt(T t)
Definition: SSEVec.h:19
T mag() const
Definition: PV3DBase.h:64
bool getData(T &iHolder) const
Definition: EventSetup.h:122
Trait::RecHitRefVector RecHitRefVector
double ptmin
Definition: HydjetWrapper.h:84
static int position[264][3]
Definition: ReadPGInfo.cc:289
edm::EDGetTokenT< typename Trait::InputType > inputToken_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ geometryToken_

template<typename Trait >
const edm::ESGetToken<typename Trait::GeometryType, MuonGeometryRecord> RechitClusterProducerT< Trait >::geometryToken_
private

Definition at line 57 of file RechitClusterProducer.cc.

◆ inputToken_

template<typename Trait >
edm::EDGetTokenT<typename Trait::InputType> RechitClusterProducerT< Trait >::inputToken_
private

Definition at line 58 of file RechitClusterProducer.cc.

◆ nRechitMin_

template<typename Trait >
const int RechitClusterProducerT< Trait >::nRechitMin_
private

Definition at line 62 of file RechitClusterProducer.cc.

◆ nStationThres_

template<typename Trait >
const int RechitClusterProducerT< Trait >::nStationThres_
private

Definition at line 63 of file RechitClusterProducer.cc.

◆ rParam_

template<typename Trait >
const double RechitClusterProducerT< Trait >::rParam_
private

Definition at line 61 of file RechitClusterProducer.cc.