CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
GEMPadDigiClusterProducer Class Reference
Inheritance diagram for GEMPadDigiClusterProducer:
edm::stream::EDProducer<>

Public Types

typedef std::map< GEMDetId, GEMPadDigiClustersGEMPadDigiClusterContainer
 
typedef std::vector< GEMPadDigiClusterGEMPadDigiClusters
 
- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Public Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
 GEMPadDigiClusterProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~GEMPadDigiClusterProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void buildClusters (const GEMPadDigiCollection &pads, GEMPadDigiClusterContainer &out_clusters) const
 
template<class T >
void checkValid (const T &cluster, const GEMDetId &id) const
 
void selectClusters (const GEMPadDigiClusterContainer &in_clusters, GEMPadDigiClusterCollection &out) const
 

Private Attributes

edm::ESGetToken< GEMGeometry, MuonGeometryRecordgeom_token_
 
const GEMGeometrygeometry_
 
unsigned int maxClusterSize_
 
unsigned int maxClustersOHGE11_
 
unsigned int maxClustersOHGE21_
 
unsigned int maxClustersPartitionGE11_
 
unsigned int maxClustersPartitionGE21_
 
unsigned int nOHGE11_
 
unsigned int nOHGE21_
 
unsigned int nPartitionsGE11_
 
unsigned int nPartitionsGE21_
 
edm::EDGetTokenT< GEMPadDigiCollectionpad_token_
 Name of input digi Collection. More...
 
edm::InputTag pads_
 
bool sendOverflowClusters_
 

Detailed Description

Produces GEM pad clusters from at most 8 adjacent GEM pads. Clusters are used downstream in the CSC local trigger to build GEM-CSC triggers and in the muon trigger to build EMTF tracks

Based on documentation provided by the GEM firmware architects

Author
Sven Dildick (TAMU), updated by Giovanni Mocellin (UCDavis)

** Notes on chambers and cluster packing algorithm **


Based on: https://gitlab.cern.ch/emu/0xbefe/-/tree/devel/gem/hdl/cluster_finding/README.org (Andrew Peck, 2020/06/26)

GE1/1 chamber has 8 iEta partitions and 1 OH GE2/1 chamber has 16 iEta partitions and 4 OH (one per module)

Both GE1/1 and GE2/1 have 384 strips = 192 pads per iEta partition

GE1/1 OH has 4 clustering partitions, each covering 2 iEta partitions GE2/1 OH has 4 clustering partitions, each covering 1 iEta partition

Each clustering partition finds up to 4 clusters per BX, which are then sent to the sorter. The sorting of the clusters favors lower eta partitions and lower pad numbers.

The first 8 clusters are selected and sent out through optical fibers.

Definition at line 60 of file GEMPadDigiClusterProducer.cc.

Member Typedef Documentation

◆ GEMPadDigiClusterContainer

Definition at line 63 of file GEMPadDigiClusterProducer.cc.

◆ GEMPadDigiClusters

Definition at line 62 of file GEMPadDigiClusterProducer.cc.

Constructor & Destructor Documentation

◆ GEMPadDigiClusterProducer()

GEMPadDigiClusterProducer::GEMPadDigiClusterProducer ( const edm::ParameterSet ps)
explicit

Definition at line 100 of file GEMPadDigiClusterProducer.cc.

References geom_token_, edm::ParameterSet::getParameter(), maxClusterSize_, maxClustersOHGE11_, maxClustersOHGE21_, maxClustersPartitionGE11_, maxClustersPartitionGE21_, nOHGE11_, nOHGE21_, nPartitionsGE11_, nPartitionsGE21_, pad_token_, pads_, and sendOverflowClusters_.

100  : geometry_(nullptr) {
101  pads_ = ps.getParameter<edm::InputTag>("InputCollection");
102  nPartitionsGE11_ = ps.getParameter<unsigned int>("nPartitionsGE11");
103  nPartitionsGE21_ = ps.getParameter<unsigned int>("nPartitionsGE21");
104  maxClustersPartitionGE11_ = ps.getParameter<unsigned int>("maxClustersPartitionGE11");
105  maxClustersPartitionGE21_ = ps.getParameter<unsigned int>("maxClustersPartitionGE21");
106  nOHGE11_ = ps.getParameter<unsigned int>("nOHGE11");
107  nOHGE21_ = ps.getParameter<unsigned int>("nOHGE21");
108  maxClustersOHGE11_ = ps.getParameter<unsigned int>("maxClustersOHGE11");
109  maxClustersOHGE21_ = ps.getParameter<unsigned int>("maxClustersOHGE21");
110  maxClusterSize_ = ps.getParameter<unsigned int>("maxClusterSize");
111  sendOverflowClusters_ = ps.getParameter<bool>("sendOverflowClusters");
112 
113  if (sendOverflowClusters_) {
114  maxClustersOHGE11_ *= 2;
115  maxClustersOHGE21_ *= 2;
116  }
117 
118  pad_token_ = consumes<GEMPadDigiCollection>(pads_);
119  geom_token_ = esConsumes<GEMGeometry, MuonGeometryRecord, edm::Transition::BeginRun>();
120 
121  produces<GEMPadDigiClusterCollection>();
122  consumes<GEMPadDigiCollection>(pads_);
123 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geom_token_
edm::EDGetTokenT< GEMPadDigiCollection > pad_token_
Name of input digi Collection.

◆ ~GEMPadDigiClusterProducer()

GEMPadDigiClusterProducer::~GEMPadDigiClusterProducer ( )
override

Definition at line 125 of file GEMPadDigiClusterProducer.cc.

125 {}

Member Function Documentation

◆ beginRun()

void GEMPadDigiClusterProducer::beginRun ( const edm::Run run,
const edm::EventSetup eventSetup 
)
override

Definition at line 144 of file GEMPadDigiClusterProducer.cc.

References options_cfi::eventSetup, geom_token_, and geometry_.

144  {
146  geometry_ = &*hGeom;
147 }
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geom_token_

◆ buildClusters()

void GEMPadDigiClusterProducer::buildClusters ( const GEMPadDigiCollection pads,
GEMPadDigiClusterContainer out_clusters 
) const
private

Definition at line 167 of file GEMPadDigiClusterProducer.cc.

References checkValid(), haddnano::cl, ztail::d, GEMGeometry::etaPartitions(), geometry_, maxClusterSize_, and nPart().

Referenced by produce().

168  {
169  // clear the container
170  proto_clusters.clear();
171 
172  // construct clusters
173  for (const auto& part : geometry_->etaPartitions()) {
174  // clusters are not build for ME0
175  // -> ignore hits from station 0
176  if (part->isME0())
177  continue;
178 
179  GEMPadDigiClusters all_pad_clusters;
180 
181  auto pads = det_pads.get(part->id());
182  std::vector<uint16_t> cl;
183  int startBX = 99;
184 
185  for (auto d = pads.first; d != pads.second; ++d) {
186  // check if the input pad is valid
187  checkValid(*d, part->id());
188 
189  // number of eta partitions
190  unsigned nPart = d->nPartitions();
191 
192  if (cl.empty()) {
193  cl.push_back((*d).pad());
194  } else {
195  if ((*d).bx() == startBX and // same bunch crossing
196  (*d).pad() == cl.back() + 1 // pad difference is 1
197  and cl.size() < maxClusterSize_) { // max 8 in cluster
198  cl.push_back((*d).pad());
199  } else {
200  // put the current cluster in the proto collection
201  GEMPadDigiCluster pad_cluster(cl, startBX, part->subsystem(), nPart);
202 
203  // check if the output cluster is valid
204  checkValid(pad_cluster, part->id());
205 
206  all_pad_clusters.emplace_back(pad_cluster);
207 
208  // start a new cluster
209  cl.clear();
210  cl.push_back((*d).pad());
211  }
212  }
213  startBX = (*d).bx();
214  }
215 
216  // put the last cluster in the proto collection
217  if (pads.first != pads.second) {
218  // number of eta partitions
219  unsigned nPart = (pads.first)->nPartitions();
220 
221  GEMPadDigiCluster pad_cluster(cl, startBX, part->subsystem(), nPart);
222 
223  // check if the output cluster is valid
224  checkValid(pad_cluster, part->id());
225 
226  all_pad_clusters.emplace_back(pad_cluster);
227  }
228  proto_clusters.emplace(part->id(), all_pad_clusters);
229 
230  } // end of partition loop
231 }
void checkValid(const T &cluster, const GEMDetId &id) const
d
Definition: ztail.py:151
TString nPart(Int_t part, TString string, TString delimit=";", Bool_t removerest=true)
part
Definition: HCALResponse.h:20
std::vector< GEMPadDigiCluster > GEMPadDigiClusters
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.
Definition: GEMGeometry.cc:40

◆ checkValid()

template<class T >
void GEMPadDigiClusterProducer::checkValid ( const T cluster,
const GEMDetId id 
) const
private

Definition at line 270 of file GEMPadDigiClusterProducer.cc.

References triggerObjects_cff::id, and cmsswSequenceInfo::tp.

Referenced by buildClusters(), and selectClusters().

270  {
271  // check if the pad/cluster is valid
272  // in principle, invalid pads/clusters can appear in the CMS raw data
273  if (!tp.isValid()) {
274  edm::LogWarning("GEMPadDigiClusterProducer") << "Invalid " << tp << " in " << id;
275  }
276 }
Log< level::Warning, false > LogWarning

◆ fillDescriptions()

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

Definition at line 127 of file GEMPadDigiClusterProducer.cc.

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

127  {
129  desc.add<edm::InputTag>("InputCollection", edm::InputTag("simMuonGEMPadDigis"));
130  desc.add<unsigned int>("nPartitionsGE11", 4); // Number of clusterizer partitions per OH
131  desc.add<unsigned int>("nPartitionsGE21", 4); // Number of clusterizer partitions per OH
132  desc.add<unsigned int>("maxClustersPartitionGE11", 4); // Maximum number of clusters per clusterizer partition
133  desc.add<unsigned int>("maxClustersPartitionGE21", 4); // Maximum number of clusters per clusterizer partition
134  desc.add<unsigned int>("nOHGE11", 1); // Number of OH boards per chamber
135  desc.add<unsigned int>("nOHGE21", 4); // Number of OH boards per chamber
136  desc.add<unsigned int>("maxClustersOHGE11", 8); // Maximum number of clusters per OH
137  desc.add<unsigned int>("maxClustersOHGE21", 8); // Maximum number of clusters per OH
138  desc.add<unsigned int>("maxClusterSize", 8); // Maximum cluster size (number of pads)
139  desc.add<bool>("sendOverflowClusters", false);
140 
141  descriptions.add("simMuonGEMPadDigiClustersDef", desc);
142 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void GEMPadDigiClusterProducer::produce ( edm::Event e,
const edm::EventSetup eventSetup 
)
override

Definition at line 149 of file GEMPadDigiClusterProducer.cc.

References buildClusters(), MillePedeFileConverter_cfg::e, eostools::move(), pad_token_, edm::Handle< T >::product(), and selectClusters().

149  {
151  e.getByToken(pad_token_, hpads);
152 
153  // Create empty output
154  std::unique_ptr<GEMPadDigiClusterCollection> pClusters(new GEMPadDigiClusterCollection());
155 
156  // build the proto clusters (per partition)
157  GEMPadDigiClusterContainer proto_clusters;
158  buildClusters(*(hpads.product()), proto_clusters);
159 
160  // sort and select clusters per chamber, per OH, per partition number and per pad number
161  selectClusters(proto_clusters, *pClusters);
162 
163  // store them in the event
164  e.put(std::move(pClusters));
165 }
T const * product() const
Definition: Handle.h:70
MuonDigiCollection< GEMDetId, GEMPadDigiCluster > GEMPadDigiClusterCollection
std::vector< GEMPadDigiCluster > GEMPadDigiClusterContainer
void buildClusters(const GEMPadDigiCollection &pads, GEMPadDigiClusterContainer &out_clusters) const
edm::EDGetTokenT< GEMPadDigiCollection > pad_token_
Name of input digi Collection.
void selectClusters(const GEMPadDigiClusterContainer &in_clusters, GEMPadDigiClusterCollection &out) const
def move(src, dest)
Definition: eostools.py:511

◆ selectClusters()

void GEMPadDigiClusterProducer::selectClusters ( const GEMPadDigiClusterContainer in_clusters,
GEMPadDigiClusterCollection out 
) const
private

Definition at line 233 of file GEMPadDigiClusterProducer.cc.

References GEMGeometry::chambers(), checkValid(), geometry_, L1TowerCalibrationProducer_cfi::iEta, maxClustersOHGE11_, maxClustersOHGE21_, maxClustersPartitionGE11_, maxClustersPartitionGE21_, nOHGE11_, nOHGE21_, nPartitionsGE11_, and nPartitionsGE21_.

Referenced by produce().

234  {
235  for (const auto& ch : geometry_->chambers()) {
236  const unsigned nOH = ch->id().isGE11() ? nOHGE11_ : nOHGE21_;
237  const unsigned nPartitions = ch->id().isGE11() ? nPartitionsGE11_ : nPartitionsGE21_;
238  const unsigned nEtaPerPartition = ch->nEtaPartitions() / (nPartitions * nOH);
239  const unsigned maxClustersPart = ch->id().isGE11() ? maxClustersPartitionGE11_ : maxClustersPartitionGE21_;
240  const unsigned maxClustersOH = ch->id().isGE11() ? maxClustersOHGE11_ : maxClustersOHGE21_;
241 
242  // loop over OH in this chamber
243  for (unsigned int iOH = 0; iOH < nOH; iOH++) {
244  unsigned int nClustersOH = 0; // Up to 8 clusters per OH
245  // loop over clusterizer partitions
246  for (unsigned int iPart = 0; iPart < nPartitions; iPart++) {
247  unsigned int nClustersPart = 0; // Up to 4 clusters per clustizer partition
248  // loop over the eta partitions for this clusterizer partition
249  for (unsigned iEta = 1; iEta <= nEtaPerPartition; iEta++) {
250  // get the clusters for this eta partition
251  const GEMDetId& iEtaId =
252  ch->etaPartition(iEta + iPart * nEtaPerPartition + iOH * nPartitions * nEtaPerPartition)->id();
253  if (proto_clusters.find(iEtaId) != proto_clusters.end()) {
254  for (const auto& cluster : proto_clusters.at(iEtaId)) {
255  if (nClustersPart < maxClustersPart and nClustersOH < maxClustersOH) {
256  checkValid(cluster, iEtaId);
257  out_clusters.insertDigi(iEtaId, cluster);
258  nClustersPart++;
259  nClustersOH++;
260  }
261  } // end of loop on clusters in eta
262  }
263  } // end of eta partition loop
264  } // end of clusterizer partition loop
265  } // end of OH loop
266  } // end of chamber loop
267 }
void checkValid(const T &cluster, const GEMDetId &id) const
const std::vector< const GEMChamber * > & chambers() const
Return a vector of all GEM chambers.
Definition: GEMGeometry.cc:38

Member Data Documentation

◆ geom_token_

edm::ESGetToken<GEMGeometry, MuonGeometryRecord> GEMPadDigiClusterProducer::geom_token_
private

Definition at line 83 of file GEMPadDigiClusterProducer.cc.

Referenced by beginRun(), and GEMPadDigiClusterProducer().

◆ geometry_

const GEMGeometry* GEMPadDigiClusterProducer::geometry_
private

Definition at line 97 of file GEMPadDigiClusterProducer.cc.

Referenced by beginRun(), buildClusters(), and selectClusters().

◆ maxClusterSize_

unsigned int GEMPadDigiClusterProducer::maxClusterSize_
private

Definition at line 94 of file GEMPadDigiClusterProducer.cc.

Referenced by buildClusters(), and GEMPadDigiClusterProducer().

◆ maxClustersOHGE11_

unsigned int GEMPadDigiClusterProducer::maxClustersOHGE11_
private

Definition at line 92 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer(), and selectClusters().

◆ maxClustersOHGE21_

unsigned int GEMPadDigiClusterProducer::maxClustersOHGE21_
private

Definition at line 93 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer(), and selectClusters().

◆ maxClustersPartitionGE11_

unsigned int GEMPadDigiClusterProducer::maxClustersPartitionGE11_
private

Definition at line 88 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer(), and selectClusters().

◆ maxClustersPartitionGE21_

unsigned int GEMPadDigiClusterProducer::maxClustersPartitionGE21_
private

Definition at line 89 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer(), and selectClusters().

◆ nOHGE11_

unsigned int GEMPadDigiClusterProducer::nOHGE11_
private

Definition at line 90 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer(), and selectClusters().

◆ nOHGE21_

unsigned int GEMPadDigiClusterProducer::nOHGE21_
private

Definition at line 91 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer(), and selectClusters().

◆ nPartitionsGE11_

unsigned int GEMPadDigiClusterProducer::nPartitionsGE11_
private

Definition at line 86 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer(), and selectClusters().

◆ nPartitionsGE21_

unsigned int GEMPadDigiClusterProducer::nPartitionsGE21_
private

Definition at line 87 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer(), and selectClusters().

◆ pad_token_

edm::EDGetTokenT<GEMPadDigiCollection> GEMPadDigiClusterProducer::pad_token_
private

Name of input digi Collection.

Definition at line 82 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer(), and produce().

◆ pads_

edm::InputTag GEMPadDigiClusterProducer::pads_
private

Definition at line 84 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer().

◆ sendOverflowClusters_

bool GEMPadDigiClusterProducer::sendOverflowClusters_
private

Definition at line 95 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer().