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
 
typedef std::map< GEMDetId, std::vector< std::vector< std::pair< GEMDetId, GEMPadDigiClusters > > > > GEMPadDigiClusterSortedContainer
 
- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void buildClusters (const GEMPadDigiCollection &pads, GEMPadDigiClusterContainer &out_clusters) const
 
void selectClusters (const GEMPadDigiClusterSortedContainer &in, GEMPadDigiClusterCollection &out) const
 
void sortClusters (const GEMPadDigiClusterContainer &in_clusters, GEMPadDigiClusterSortedContainer &out_clusters) const
 

Private Attributes

const GEMGeometrygeometry_
 
unsigned int maxClusterSize_
 
unsigned int maxClustersOHGE11_
 
unsigned int maxClustersOHGE21_
 
unsigned int nOHGE11_
 
unsigned int nOHGE21_
 
edm::EDGetTokenT< GEMPadDigiCollectionpad_token_
 Name of input digi Collection. More...
 
edm::InputTag pads_
 

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)

Definition at line 38 of file GEMPadDigiClusterProducer.cc.

Member Typedef Documentation

Definition at line 42 of file GEMPadDigiClusterProducer.cc.

Definition at line 41 of file GEMPadDigiClusterProducer.cc.

typedef std::map<GEMDetId, std::vector<std::vector<std::pair<GEMDetId, GEMPadDigiClusters> > > > GEMPadDigiClusterProducer::GEMPadDigiClusterSortedContainer

Definition at line 46 of file GEMPadDigiClusterProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 115 of file GEMPadDigiClusterProducer.cc.

References edm::ParameterSet::getParameter(), maxClusterSize_, maxClustersOHGE11_, maxClustersOHGE21_, nOHGE11_, nOHGE21_, pad_token_, and pads_.

115  : geometry_(nullptr) {
116  pads_ = ps.getParameter<edm::InputTag>("InputCollection");
117  maxClustersOHGE11_ = ps.getParameter<unsigned int>("maxClustersOHGE11");
118  maxClustersOHGE21_ = ps.getParameter<unsigned int>("maxClustersOHGE21");
119  nOHGE11_ = ps.getParameter<unsigned int>("nOHGE11");
120  nOHGE21_ = ps.getParameter<unsigned int>("nOHGE21");
121  maxClusterSize_ = ps.getParameter<unsigned int>("maxClusterSize");
122 
123  pad_token_ = consumes<GEMPadDigiCollection>(pads_);
124 
125  produces<GEMPadDigiClusterCollection>();
126  consumes<GEMPadDigiCollection>(pads_);
127 }
T getParameter(std::string const &) const
edm::EDGetTokenT< GEMPadDigiCollection > pad_token_
Name of input digi Collection.
GEMPadDigiClusterProducer::~GEMPadDigiClusterProducer ( )
override

Definition at line 129 of file GEMPadDigiClusterProducer.cc.

129 {}

Member Function Documentation

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

Definition at line 143 of file GEMPadDigiClusterProducer.cc.

References geometry_, and edm::EventSetup::get().

143  {
145  eventSetup.get<MuonGeometryRecord>().get(hGeom);
146  geometry_ = &*hGeom;
147 }
T get() const
Definition: EventSetup.h:73
void GEMPadDigiClusterProducer::buildClusters ( const GEMPadDigiCollection pads,
GEMPadDigiClusterContainer out_clusters 
) const
private

Light Cluster Packing Algorithm **

Based on: https://github.com/cms-gem-daq-project/OptoHybridv3/raw/master/doc/OH_modules.docx (Andrew Peck, Thomas Lenzi, Evaldas Juska)

In the current version of the algorithm, cluster finding is segmented into two separate halves of the GE1/1 chambers. Thus, each one of the trigger fibers can transmit clusters only from the half of the chamber that it corresponds to. For GE2/1, there are four separate quarts of the GE2/1 chamber.

This has the downside of being unable to transmit more than 4 clusters when they occur within that side of the chamber, so there will be a slightly higher rate of cluster overflow. For GE2/1 each OH can transmit up to 5 clusters.

The benefit, however, is in terms of (1) latency and (2) resource usage.

The burden of finding clusters on of the chamber is significantly less, and allows the cluster packer to operate in a simple, pipelined architecture which returns up to 4 (or 5) clusters per half-chamber per bunch crossing.

This faster architecture allows the mechanism to operate with only a single copy of the cluster finding priority encoder and cluster truncator (instead of two multiplexed copies), so the total resource usage of these stages is approximately half.

Further, a second step of cluster merging that is required in the full algorithm is avoided, which reduces latency by an additional bunch crossing and significantly reduces resource usage as well.

The sorting of the clusters favors lower eta partitions and lower pad numbers

Definition at line 171 of file GEMPadDigiClusterProducer.cc.

References GetRecoTauVFromDQM_MC_cff::cl, ztail::d, GEMGeometry::etaPartitions(), geometry_, and maxClusterSize_.

Referenced by produce().

172  {
173  // clear the container
174  proto_clusters.clear();
175 
176  // construct clusters
177  for (const auto& part : geometry_->etaPartitions()) {
178  GEMPadDigiClusters all_pad_clusters;
179 
180  auto pads = det_pads.get(part->id());
181  std::vector<uint16_t> cl;
182  int startBX = 99;
183 
184  for (auto d = pads.first; d != pads.second; ++d) {
185  if (cl.empty()) {
186  cl.push_back((*d).pad());
187  } else {
188  if ((*d).bx() == startBX and // same bunch crossing
189  (*d).pad() == cl.back() + 1 // pad difference is 1
190  and cl.size() < maxClusterSize_) { // max 8 in cluster
191  cl.push_back((*d).pad());
192  } else {
193  // put the current cluster in the proto collection
194  GEMPadDigiCluster pad_cluster(cl, startBX);
195 
196  all_pad_clusters.emplace_back(pad_cluster);
197 
198  // start a new cluster
199  cl.clear();
200  cl.push_back((*d).pad());
201  }
202  }
203  startBX = (*d).bx();
204  }
205 
206  // put the last cluster in the proto collection
207  if (pads.first != pads.second) {
208  GEMPadDigiCluster pad_cluster(cl, startBX);
209  all_pad_clusters.emplace_back(pad_cluster);
210  }
211  proto_clusters.emplace(part->id(), all_pad_clusters);
212 
213  } // end of partition loop
214 }
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.
Definition: GEMGeometry.cc:40
d
Definition: ztail.py:151
part
Definition: HCALResponse.h:20
std::vector< GEMPadDigiCluster > GEMPadDigiClusters
void GEMPadDigiClusterProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 131 of file GEMPadDigiClusterProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and HLT_2018_cff::InputTag.

131  {
133  desc.add<edm::InputTag>("InputCollection", edm::InputTag("simMuonGEMPadDigis"));
134  desc.add<unsigned int>("maxClustersOHGE11", 4);
135  desc.add<unsigned int>("maxClustersOHGE21", 5);
136  desc.add<unsigned int>("nOHGE11", 2);
137  desc.add<unsigned int>("nOHGE21", 4);
138  desc.add<unsigned int>("maxClusterSize", 8);
139 
140  descriptions.add("simMuonGEMPadDigiClustersDef", desc);
141 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void GEMPadDigiClusterProducer::produce ( edm::Event e,
const edm::EventSetup eventSetup 
)
override

Definition at line 149 of file GEMPadDigiClusterProducer.cc.

References buildClusters(), edm::Event::getByToken(), eostools::move(), pad_token_, edm::Handle< T >::product(), edm::Event::put(), selectClusters(), and sortClusters().

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 clusters per chamber, per OH, per partition number and per pad number
161  GEMPadDigiClusterSortedContainer sorted_clusters;
162  sortClusters(proto_clusters, sorted_clusters);
163 
164  // select the clusters from sorted clusters
165  selectClusters(sorted_clusters, *pClusters);
166 
167  // store them in the event
168  e.put(std::move(pClusters));
169 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
void sortClusters(const GEMPadDigiClusterContainer &in_clusters, GEMPadDigiClusterSortedContainer &out_clusters) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
std::map< GEMDetId, std::vector< std::vector< std::pair< GEMDetId, GEMPadDigiClusters > > > > GEMPadDigiClusterSortedContainer
MuonDigiCollection< GEMDetId, GEMPadDigiCluster > GEMPadDigiClusterCollection
std::map< GEMDetId, GEMPadDigiClusters > GEMPadDigiClusterContainer
T const * product() const
Definition: Handle.h:69
void buildClusters(const GEMPadDigiCollection &pads, GEMPadDigiClusterContainer &out_clusters) const
void selectClusters(const GEMPadDigiClusterSortedContainer &in, GEMPadDigiClusterCollection &out) const
edm::EDGetTokenT< GEMPadDigiCollection > pad_token_
Name of input digi Collection.
def move(src, dest)
Definition: eostools.py:511
void GEMPadDigiClusterProducer::selectClusters ( const GEMPadDigiClusterSortedContainer in,
GEMPadDigiClusterCollection out 
) const
private

Definition at line 252 of file GEMPadDigiClusterProducer.cc.

References GEMGeometry::chambers(), bsc_activity_cfg::clusters, DEFINE_FWK_MODULE, geometry_, maxClustersOHGE11_, maxClustersOHGE21_, heavyionUCCDQM_cfi::nClusters, and relativeConstraints::station.

Referenced by produce().

253  {
254  // loop over chambers
255  for (const auto& ch : geometry_->chambers()) {
256  const int station = ch->id().station();
257  const bool isGE11 = (station == 1);
258  const unsigned maxClustersOH = isGE11 ? maxClustersOHGE11_ : maxClustersOHGE21_;
259 
260  // loop over the optohybrids
261  for (const auto& optohybrid : sorted_clusters.at(ch->id())) {
262  // at most maxClustersOH per OH!
263  unsigned nClusters = 0;
264 
265  // loop over the eta partitions for this OH
266  for (const auto& etapart : optohybrid) {
267  const auto& detid(etapart.first);
268  const auto& clusters(etapart.second);
269 
270  // pick the clusters with lowest pad number
271  for (const auto& clus : clusters) {
272  if (nClusters < maxClustersOH) {
273  out_clusters.insertDigi(detid, clus);
274  nClusters++;
275  }
276  } // end of cluster loop
277  } // end of eta partition loop
278  } // end of OH loop
279  } // end of chamber loop
280 }
const std::vector< const GEMChamber * > & chambers() const
Return a vector of all GEM chambers.
Definition: GEMGeometry.cc:38
void GEMPadDigiClusterProducer::sortClusters ( const GEMPadDigiClusterContainer in_clusters,
GEMPadDigiClusterSortedContainer out_clusters 
) const
private

Definition at line 216 of file GEMPadDigiClusterProducer.cc.

References GEMGeometry::chambers(), geometry_, nOHGE11_, nOHGE21_, and relativeConstraints::station.

Referenced by produce().

217  {
218  // The sorting of the clusters favors lower eta partitions and lower pad numbers
219  // By default the eta partitions are sorted by Id
220 
221  sorted_clusters.clear();
222 
223  for (const auto& ch : geometry_->chambers()) {
224  // check the station number
225  const int station = ch->id().station();
226  const bool isGE11 = (station == 1);
227  const unsigned nOH = isGE11 ? nOHGE11_ : nOHGE21_;
228  const unsigned nPartOH = ch->nEtaPartitions() / nOH;
229 
230  std::vector<std::vector<std::pair<GEMDetId, GEMPadDigiClusters> > > temp_clustersCH;
231 
232  for (unsigned int iOH = 0; iOH < nOH; iOH++) {
233  // all clusters for a set of eta partitions
234  std::vector<std::pair<GEMDetId, GEMPadDigiClusters> > temp_clustersOH;
235 
236  // loop over the 4 or 2 eta partitions for this optohybrid
237  for (unsigned iPart = 1; iPart <= nPartOH; iPart++) {
238  // get the clusters for this eta partition
239  const GEMDetId& partId = ch->etaPartition(iPart + iOH * nPartOH)->id();
240  if (proto_clusters.find(partId) != proto_clusters.end()) {
241  temp_clustersOH.emplace_back(partId, proto_clusters.at(partId));
242  }
243  } // end of eta partition loop
244 
245  temp_clustersCH.emplace_back(temp_clustersOH);
246  } // end of OH loop
247 
248  sorted_clusters.emplace(ch->id(), temp_clustersCH);
249  } // end of chamber loop
250 }
const std::vector< const GEMChamber * > & chambers() const
Return a vector of all GEM chambers.
Definition: GEMGeometry.cc:38

Member Data Documentation

const GEMGeometry* GEMPadDigiClusterProducer::geometry_
private
unsigned int GEMPadDigiClusterProducer::maxClusterSize_
private

Definition at line 110 of file GEMPadDigiClusterProducer.cc.

Referenced by buildClusters(), and GEMPadDigiClusterProducer().

unsigned int GEMPadDigiClusterProducer::maxClustersOHGE11_
private

Definition at line 106 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer(), and selectClusters().

unsigned int GEMPadDigiClusterProducer::maxClustersOHGE21_
private

Definition at line 107 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer(), and selectClusters().

unsigned int GEMPadDigiClusterProducer::nOHGE11_
private

Definition at line 108 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer(), and sortClusters().

unsigned int GEMPadDigiClusterProducer::nOHGE21_
private

Definition at line 109 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer(), and sortClusters().

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

Name of input digi Collection.

Definition at line 103 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer(), and produce().

edm::InputTag GEMPadDigiClusterProducer::pads_
private

Definition at line 104 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer().