CMS 3D CMS Logo

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

#include <ME0PadDigiClusterProducer.h>

Inheritance diagram for ME0PadDigiClusterProducer:
edm::stream::EDProducer<>

Public Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
 ME0PadDigiClusterProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~ME0PadDigiClusterProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Member Functions

void buildClusters (const ME0PadDigiCollection &pads, ME0PadDigiClusterCollection &out_clusters)
 

Private Attributes

const ME0Geometrygeometry_
 
unsigned int maxClusters_
 
unsigned int maxClusterSize_
 
edm::EDGetTokenT< ME0PadDigiCollectionpad_token_
 Name of input digi Collection. More...
 
edm::InputTag pads_
 

Additional Inherited Members

- 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
 

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

Author
Sven Dildick (TAMU)

Produces ME0 pad clusters from at most 8 adjacent ME0 pads. Clusters are used downstream to build triggers.

Author
Sven Dildick (TAMU)

Definition at line 25 of file ME0PadDigiClusterProducer.h.

Constructor & Destructor Documentation

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

Definition at line 14 of file ME0PadDigiClusterProducer.cc.

References edm::ParameterSet::getParameter(), maxClusters_, maxClusterSize_, pad_token_, and pads_.

15 : geometry_(nullptr)
16 {
17  pads_ = ps.getParameter<edm::InputTag>("InputCollection");
18  maxClusters_ = ps.getParameter<unsigned int>("maxClusters");
19  maxClusterSize_ = ps.getParameter<unsigned int>("maxClusterSize");
20 
21  pad_token_ = consumes<ME0PadDigiCollection>(pads_);
22 
23  produces<ME0PadDigiClusterCollection>();
24  consumes<ME0PadDigiCollection>(pads_);
25 }
T getParameter(std::string const &) const
edm::EDGetTokenT< ME0PadDigiCollection > pad_token_
Name of input digi Collection.
ME0PadDigiClusterProducer::~ME0PadDigiClusterProducer ( )
override

Definition at line 28 of file ME0PadDigiClusterProducer.cc.

29 {}

Member Function Documentation

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

Definition at line 32 of file ME0PadDigiClusterProducer.cc.

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

33 {
35  eventSetup.get<MuonGeometryRecord>().get(hGeom);
36  geometry_ = &*hGeom;
37 }
T get() const
Definition: EventSetup.h:71
void ME0PadDigiClusterProducer::buildClusters ( const ME0PadDigiCollection pads,
ME0PadDigiClusterCollection out_clusters 
)
private

Definition at line 56 of file ME0PadDigiClusterProducer.cc.

References GetRecoTauVFromDQM_MC_cff::cl, edmIntegrityCheck::d, plotBeamSpotDB::first, geometry_, mps_fire::i, ME0Geometry::layers(), maxClusters_, maxClusterSize_, min(), and edm::second().

Referenced by produce().

58 {
59  // construct clusters
60  for (const auto& ch: geometry_->layers()) {
61 
62  // proto collection
63  std::vector<std::pair<ME0DetId, ME0PadDigiCluster> > proto_clusters;
64 
65  for (const auto& part: ch->etaPartitions()) {
66  auto pads = det_pads.get(part->id());
67  std::vector<uint16_t> cl;
68  int startBX = 99;
69  for (auto d = pads.first; d != pads.second; ++d) {
70  if (cl.empty()) {
71  cl.push_back((*d).pad());
72  }
73  else {
74  if ((*d).bx() == startBX and // same bunch crossing
75  (*d).pad() == cl.back() + 1 // pad difference is 1
76  and cl.size()<maxClusterSize_) { // max 8 in cluster
77  cl.push_back((*d).pad());
78  }
79  else {
80  // put the current cluster in the proto collection
81  ME0PadDigiCluster pad_cluster(cl, startBX);
82  proto_clusters.emplace_back(part->id(), pad_cluster);
83 
84  // start a new cluster
85  cl.clear();
86  cl.push_back((*d).pad());
87  }
88  }
89  startBX = (*d).bx();
90  }
91  // put the last cluster in the proto collection
92  if (pads.first != pads.second){
93  ME0PadDigiCluster pad_cluster(cl, startBX);
94  proto_clusters.emplace_back(part->id(), pad_cluster);
95  }
96  } // end of partition loop
97 
98  // cluster selection: pick first maxClusters_ for now
99  unsigned loopMax=std::min(maxClusters_,unsigned(proto_clusters.size()));
100  for ( unsigned int i=0; i<loopMax; i++) {
101  const auto& detid(proto_clusters[i].first);
102  const auto& cluster(proto_clusters[i].second);
103  out_clusters.insertDigi(detid, cluster);
104  }
105  } // end of chamber loop
106 }
U second(std::pair< T, U > const &p)
T min(T a, T b)
Definition: MathUtil.h:58
part
Definition: HCALResponse.h:20
const std::vector< const ME0Layer * > & layers() const
Return a vector of all ME0 layers.
Definition: ME0Geometry.cc:54
void ME0PadDigiClusterProducer::produce ( edm::Event e,
const edm::EventSetup eventSetup 
)
override

Definition at line 40 of file ME0PadDigiClusterProducer.cc.

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

41 {
43  e.getByToken(pad_token_, hpads);
44 
45  // Create empty output
46  std::unique_ptr<ME0PadDigiClusterCollection> pClusters(new ME0PadDigiClusterCollection());
47 
48  // build the clusters
49  buildClusters(*(hpads.product()), *pClusters);
50 
51  // store them in the event
52  e.put(std::move(pClusters));
53 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
void buildClusters(const ME0PadDigiCollection &pads, ME0PadDigiClusterCollection &out_clusters)
T const * product() const
Definition: Handle.h:74
edm::EDGetTokenT< ME0PadDigiCollection > pad_token_
Name of input digi Collection.
MuonDigiCollection< ME0DetId, ME0PadDigiCluster > ME0PadDigiClusterCollection
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

const ME0Geometry* ME0PadDigiClusterProducer::geometry_
private

Definition at line 48 of file ME0PadDigiClusterProducer.h.

Referenced by beginRun(), and buildClusters().

unsigned int ME0PadDigiClusterProducer::maxClusters_
private

Definition at line 45 of file ME0PadDigiClusterProducer.h.

Referenced by buildClusters(), and ME0PadDigiClusterProducer().

unsigned int ME0PadDigiClusterProducer::maxClusterSize_
private

Definition at line 46 of file ME0PadDigiClusterProducer.h.

Referenced by buildClusters(), and ME0PadDigiClusterProducer().

edm::EDGetTokenT<ME0PadDigiCollection> ME0PadDigiClusterProducer::pad_token_
private

Name of input digi Collection.

Definition at line 42 of file ME0PadDigiClusterProducer.h.

Referenced by ME0PadDigiClusterProducer(), and produce().

edm::InputTag ME0PadDigiClusterProducer::pads_
private

Definition at line 43 of file ME0PadDigiClusterProducer.h.

Referenced by ME0PadDigiClusterProducer().