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 hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () 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
 
template<class T >
void checkValid (const T &cluster, const GEMDetId &id) const
 
void selectClusters (const GEMPadDigiClusterSortedContainer &in, GEMPadDigiClusterCollection &out) const
 
void sortClusters (const GEMPadDigiClusterContainer &in_clusters, GEMPadDigiClusterSortedContainer &out_clusters) const
 

Private Attributes

edm::ESGetToken< GEMGeometry, MuonGeometryRecordgeom_token_
 
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_
 
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)

Definition at line 39 of file GEMPadDigiClusterProducer.cc.

Member Typedef Documentation

◆ GEMPadDigiClusterContainer

Definition at line 43 of file GEMPadDigiClusterProducer.cc.

◆ GEMPadDigiClusters

Definition at line 42 of file GEMPadDigiClusterProducer.cc.

◆ GEMPadDigiClusterSortedContainer

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

Definition at line 47 of file GEMPadDigiClusterProducer.cc.

Constructor & Destructor Documentation

◆ GEMPadDigiClusterProducer()

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

Definition at line 120 of file GEMPadDigiClusterProducer.cc.

120  : geometry_(nullptr) {
121  pads_ = ps.getParameter<edm::InputTag>("InputCollection");
122  maxClustersOHGE11_ = ps.getParameter<unsigned int>("maxClustersOHGE11");
123  maxClustersOHGE21_ = ps.getParameter<unsigned int>("maxClustersOHGE21");
124  nOHGE11_ = ps.getParameter<unsigned int>("nOHGE11");
125  nOHGE21_ = ps.getParameter<unsigned int>("nOHGE21");
126  maxClusterSize_ = ps.getParameter<unsigned int>("maxClusterSize");
127  sendOverflowClusters_ = ps.getParameter<bool>("sendOverflowClusters");
128 
129  if (sendOverflowClusters_) {
130  maxClustersOHGE11_ *= 2;
131  maxClustersOHGE21_ *= 2;
132  }
133 
134  pad_token_ = consumes<GEMPadDigiCollection>(pads_);
135  geom_token_ = esConsumes<GEMGeometry, MuonGeometryRecord, edm::Transition::BeginRun>();
136 
137  produces<GEMPadDigiClusterCollection>();
138  consumes<GEMPadDigiCollection>(pads_);
139 }

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

◆ ~GEMPadDigiClusterProducer()

GEMPadDigiClusterProducer::~GEMPadDigiClusterProducer ( )
override

Definition at line 141 of file GEMPadDigiClusterProducer.cc.

141 {}

Member Function Documentation

◆ beginRun()

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

Definition at line 156 of file GEMPadDigiClusterProducer.cc.

156  {
158  geometry_ = &*hGeom;
159 }

References geom_token_, geometry_, and edm::EventSetup::getHandle().

◆ buildClusters()

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 183 of file GEMPadDigiClusterProducer.cc.

184  {
185  // clear the container
186  proto_clusters.clear();
187 
188  // construct clusters
189  for (const auto& part : geometry_->etaPartitions()) {
190  // clusters are not build for ME0
191  // -> ignore hits from station 0
192  if (part->isME0())
193  continue;
194 
195  GEMPadDigiClusters all_pad_clusters;
196 
197  auto pads = det_pads.get(part->id());
198  std::vector<uint16_t> cl;
199  int startBX = 99;
200 
201  for (auto d = pads.first; d != pads.second; ++d) {
202  // check if the input pad is valid
203  checkValid(*d, part->id());
204 
205  // number of eta partitions
206  unsigned nPart = d->nPartitions();
207 
208  if (cl.empty()) {
209  cl.push_back((*d).pad());
210  } else {
211  if ((*d).bx() == startBX and // same bunch crossing
212  (*d).pad() == cl.back() + 1 // pad difference is 1
213  and cl.size() < maxClusterSize_) { // max 8 in cluster
214  cl.push_back((*d).pad());
215  } else {
216  // put the current cluster in the proto collection
217  GEMPadDigiCluster pad_cluster(cl, startBX, part->subsystem(), nPart);
218 
219  // check if the output cluster is valid
220  checkValid(pad_cluster, part->id());
221 
222  all_pad_clusters.emplace_back(pad_cluster);
223 
224  // start a new cluster
225  cl.clear();
226  cl.push_back((*d).pad());
227  }
228  }
229  startBX = (*d).bx();
230  }
231 
232  // put the last cluster in the proto collection
233  if (pads.first != pads.second) {
234  // number of eta partitions
235  unsigned nPart = (pads.first)->nPartitions();
236 
237  GEMPadDigiCluster pad_cluster(cl, startBX, part->subsystem(), nPart);
238 
239  // check if the output cluster is valid
240  checkValid(pad_cluster, part->id());
241 
242  all_pad_clusters.emplace_back(pad_cluster);
243  }
244  proto_clusters.emplace(part->id(), all_pad_clusters);
245 
246  } // end of partition loop
247 }

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

Referenced by produce().

◆ checkValid()

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

Definition at line 315 of file GEMPadDigiClusterProducer.cc.

315  {
316  // check if the pad/cluster is valid
317  // in principle, invalid pads/clusters can appear in the CMS raw data
318  if (!tp.isValid()) {
319  edm::LogWarning("GEMPadDigiClusterProducer") << "Invalid " << tp << " in " << id;
320  }
321 }

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

Referenced by buildClusters(), and selectClusters().

◆ fillDescriptions()

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

Definition at line 143 of file GEMPadDigiClusterProducer.cc.

143  {
145  desc.add<edm::InputTag>("InputCollection", edm::InputTag("simMuonGEMPadDigis"));
146  desc.add<unsigned int>("maxClustersOHGE11", 4);
147  desc.add<unsigned int>("maxClustersOHGE21", 5);
148  desc.add<unsigned int>("nOHGE11", 2);
149  desc.add<unsigned int>("nOHGE21", 4);
150  desc.add<unsigned int>("maxClusterSize", 8);
151  desc.add<bool>("sendOverflowClusters", false);
152 
153  descriptions.add("simMuonGEMPadDigiClustersDef", desc);
154 }

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

◆ produce()

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

Definition at line 161 of file GEMPadDigiClusterProducer.cc.

161  {
163  e.getByToken(pad_token_, hpads);
164 
165  // Create empty output
166  std::unique_ptr<GEMPadDigiClusterCollection> pClusters(new GEMPadDigiClusterCollection());
167 
168  // build the proto clusters (per partition)
169  GEMPadDigiClusterContainer proto_clusters;
170  buildClusters(*(hpads.product()), proto_clusters);
171 
172  // // sort clusters per chamber, per OH, per partition number and per pad number
173  GEMPadDigiClusterSortedContainer sorted_clusters;
174  sortClusters(proto_clusters, sorted_clusters);
175 
176  // select the clusters from sorted clusters
177  selectClusters(sorted_clusters, *pClusters);
178 
179  // store them in the event
180  e.put(std::move(pClusters));
181 }

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

◆ selectClusters()

void GEMPadDigiClusterProducer::selectClusters ( const GEMPadDigiClusterSortedContainer in,
GEMPadDigiClusterCollection out 
) const
private

Definition at line 283 of file GEMPadDigiClusterProducer.cc.

284  {
285  // loop over chambers
286  for (const auto& ch : geometry_->chambers()) {
287  const unsigned maxClustersOH = ch->id().isGE11() ? maxClustersOHGE11_ : maxClustersOHGE21_;
288 
289  // loop over the optohybrids
290  for (const auto& optohybrid : sorted_clusters.at(ch->id())) {
291  // at most maxClustersOH per OH!
292  unsigned nClusters = 0;
293 
294  // loop over the eta partitions for this OH
295  for (const auto& etapart : optohybrid) {
296  const auto& detid(etapart.first);
297  const auto& clusters(etapart.second);
298 
299  // pick the clusters with lowest pad number
300  for (const auto& clus : clusters) {
301  if (nClusters < maxClustersOH) {
302  // check if the output cluster is valid
303  checkValid(clus, detid);
304 
305  out_clusters.insertDigi(detid, clus);
306  nClusters++;
307  }
308  } // end of cluster loop
309  } // end of eta partition loop
310  } // end of OH loop
311  } // end of chamber loop
312 }

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

Referenced by produce().

◆ sortClusters()

void GEMPadDigiClusterProducer::sortClusters ( const GEMPadDigiClusterContainer in_clusters,
GEMPadDigiClusterSortedContainer out_clusters 
) const
private

Definition at line 249 of file GEMPadDigiClusterProducer.cc.

250  {
251  // The sorting of the clusters favors lower eta partitions and lower pad numbers
252  // By default the eta partitions are sorted by Id
253 
254  sorted_clusters.clear();
255 
256  for (const auto& ch : geometry_->chambers()) {
257  // check the station number
258  const unsigned nOH = ch->id().isGE11() ? nOHGE11_ : nOHGE21_;
259  const unsigned nPartOH = ch->nEtaPartitions() / nOH;
260 
261  std::vector<std::vector<std::pair<GEMDetId, GEMPadDigiClusters> > > temp_clustersCH;
262 
263  for (unsigned int iOH = 0; iOH < nOH; iOH++) {
264  // all clusters for a set of eta partitions
265  std::vector<std::pair<GEMDetId, GEMPadDigiClusters> > temp_clustersOH;
266 
267  // loop over the 4 or 2 eta partitions for this optohybrid
268  for (unsigned iPart = 1; iPart <= nPartOH; iPart++) {
269  // get the clusters for this eta partition
270  const GEMDetId& partId = ch->etaPartition(iPart + iOH * nPartOH)->id();
271  if (proto_clusters.find(partId) != proto_clusters.end()) {
272  temp_clustersOH.emplace_back(partId, proto_clusters.at(partId));
273  }
274  } // end of eta partition loop
275 
276  temp_clustersCH.emplace_back(temp_clustersOH);
277  } // end of OH loop
278 
279  sorted_clusters.emplace(ch->id(), temp_clustersCH);
280  } // end of chamber loop
281 }

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

Referenced by produce().

Member Data Documentation

◆ geom_token_

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

Definition at line 107 of file GEMPadDigiClusterProducer.cc.

Referenced by beginRun(), and GEMPadDigiClusterProducer().

◆ geometry_

const GEMGeometry* GEMPadDigiClusterProducer::geometry_
private

◆ maxClusterSize_

unsigned int GEMPadDigiClusterProducer::maxClusterSize_
private

Definition at line 114 of file GEMPadDigiClusterProducer.cc.

Referenced by buildClusters(), and GEMPadDigiClusterProducer().

◆ maxClustersOHGE11_

unsigned int GEMPadDigiClusterProducer::maxClustersOHGE11_
private

Definition at line 110 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer(), and selectClusters().

◆ maxClustersOHGE21_

unsigned int GEMPadDigiClusterProducer::maxClustersOHGE21_
private

Definition at line 111 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer(), and selectClusters().

◆ nOHGE11_

unsigned int GEMPadDigiClusterProducer::nOHGE11_
private

Definition at line 112 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer(), and sortClusters().

◆ nOHGE21_

unsigned int GEMPadDigiClusterProducer::nOHGE21_
private

Definition at line 113 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer(), and sortClusters().

◆ pad_token_

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

Name of input digi Collection.

Definition at line 106 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer(), and produce().

◆ pads_

edm::InputTag GEMPadDigiClusterProducer::pads_
private

Definition at line 108 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer().

◆ sendOverflowClusters_

bool GEMPadDigiClusterProducer::sendOverflowClusters_
private

Definition at line 115 of file GEMPadDigiClusterProducer.cc.

Referenced by GEMPadDigiClusterProducer().

heavyionUCCDQM_cfi.nClusters
nClusters
Definition: heavyionUCCDQM_cfi.py:9
GEMPadDigiClusterProducer::GEMPadDigiClusters
std::vector< GEMPadDigiCluster > GEMPadDigiClusters
Definition: GEMPadDigiClusterProducer.cc:42
edm::Handle::product
T const * product() const
Definition: Handle.h:70
GEMPadDigiClusterProducer::geometry_
const GEMGeometry * geometry_
Definition: GEMPadDigiClusterProducer.cc:117
GEMPadDigiClusterProducer::pads_
edm::InputTag pads_
Definition: GEMPadDigiClusterProducer.cc:108
GEMPadDigiClusterProducer::sendOverflowClusters_
bool sendOverflowClusters_
Definition: GEMPadDigiClusterProducer.cc:115
GEMPadDigiCluster
Definition: GEMPadDigiCluster.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89353
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
GEMPadDigiClusterContainer
std::vector< GEMPadDigiCluster > GEMPadDigiClusterContainer
Definition: GEMDigiMatcher.h:28
GEMPadDigiClusterProducer::nOHGE11_
unsigned int nOHGE11_
Definition: GEMPadDigiClusterProducer.cc:112
edm::Handle< GEMPadDigiCollection >
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
GetRecoTauVFromDQM_MC_cff.cl
cl
Definition: GetRecoTauVFromDQM_MC_cff.py:38
part
part
Definition: HCALResponse.h:20
GEMPadDigiClusterCollection
MuonDigiCollection< GEMDetId, GEMPadDigiCluster > GEMPadDigiClusterCollection
Definition: GEMPadDigiClusterCollection.h:13
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
edm::ESHandle< GEMGeometry >
GEMPadDigiClusterProducer::maxClustersOHGE11_
unsigned int maxClustersOHGE11_
Definition: GEMPadDigiClusterProducer.cc:110
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
GEMPadDigiClusterProducer::sortClusters
void sortClusters(const GEMPadDigiClusterContainer &in_clusters, GEMPadDigiClusterSortedContainer &out_clusters) const
Definition: GEMPadDigiClusterProducer.cc:249
nPart
TString nPart(Int_t part, TString string, TString delimit=";", Bool_t removerest=true)
bsc_activity_cfg.clusters
clusters
Definition: bsc_activity_cfg.py:36
GEMGeometry::chambers
const std::vector< const GEMChamber * > & chambers() const
Return a vector of all GEM chambers.
Definition: GEMGeometry.cc:38
GEMPadDigiClusterProducer::maxClustersOHGE21_
unsigned int maxClustersOHGE21_
Definition: GEMPadDigiClusterProducer.cc:111
GEMPadDigiClusterProducer::GEMPadDigiClusterSortedContainer
std::map< GEMDetId, std::vector< std::vector< std::pair< GEMDetId, GEMPadDigiClusters > > > > GEMPadDigiClusterSortedContainer
Definition: GEMPadDigiClusterProducer.cc:47
GEMDetId
Definition: GEMDetId.h:18
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
GEMPadDigiClusterProducer::geom_token_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geom_token_
Definition: GEMPadDigiClusterProducer.cc:107
GEMPadDigiClusterProducer::selectClusters
void selectClusters(const GEMPadDigiClusterSortedContainer &in, GEMPadDigiClusterCollection &out) const
Definition: GEMPadDigiClusterProducer.cc:283
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
GEMPadDigiClusterProducer::nOHGE21_
unsigned int nOHGE21_
Definition: GEMPadDigiClusterProducer.cc:113
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
GEMGeometry::etaPartitions
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.
Definition: GEMGeometry.cc:40
ztail.d
d
Definition: ztail.py:151
GEMPadDigiClusterProducer::maxClusterSize_
unsigned int maxClusterSize_
Definition: GEMPadDigiClusterProducer.cc:114
GEMPadDigiClusterProducer::pad_token_
edm::EDGetTokenT< GEMPadDigiCollection > pad_token_
Name of input digi Collection.
Definition: GEMPadDigiClusterProducer.cc:106
edm::InputTag
Definition: InputTag.h:15
GEMPadDigiClusterProducer::checkValid
void checkValid(const T &cluster, const GEMDetId &id) const
Definition: GEMPadDigiClusterProducer.cc:315
GEMPadDigiClusterProducer::buildClusters
void buildClusters(const GEMPadDigiCollection &pads, GEMPadDigiClusterContainer &out_clusters) const
Definition: GEMPadDigiClusterProducer.cc:183
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37