CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
GEMCSCPadDigiProducer Class Reference

#include <GEMCSCPadDigiProducer.h>

Inheritance diagram for GEMCSCPadDigiProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
 
 GEMCSCPadDigiProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c) override
 
virtual ~GEMCSCPadDigiProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void buildPads (const GEMDigiCollection &digis, GEMCSCPadDigiCollection &out_pads, GEMCSCPadDigiCollection &out_co_pads)
 

Private Attributes

const GEMGeometrygeometry_
 
edm::InputTag input_
 Name of input digi Collection. More...
 
int maxDeltaBX_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Detailed Description

producer for GEM-CSC trigger pads

Definition at line 18 of file GEMCSCPadDigiProducer.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file GEMCSCPadDigiProducer.cc.

References edm::ParameterSet::getParameter(), input_, and maxDeltaBX_.

17 : geometry_(nullptr)
18 {
19  produces<GEMCSCPadDigiCollection>();
20  produces<GEMCSCPadDigiCollection>("Coincidence");
21 
22  input_ = ps.getParameter<edm::InputTag>("InputCollection");
23  maxDeltaBX_ = ps.getParameter<int>("maxDeltaBX");
24 }
T getParameter(std::string const &) const
const GEMGeometry * geometry_
edm::InputTag input_
Name of input digi Collection.
GEMCSCPadDigiProducer::~GEMCSCPadDigiProducer ( )
virtual

Definition at line 27 of file GEMCSCPadDigiProducer.cc.

28 {}

Member Function Documentation

void GEMCSCPadDigiProducer::beginRun ( const edm::Run r,
const edm::EventSetup eventSetup 
)
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 31 of file GEMCSCPadDigiProducer.cc.

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

32 {
34  eventSetup.get<MuonGeometryRecord>().get( hGeom );
35  geometry_ = &*hGeom;
36 }
const GEMGeometry * geometry_
const T & get() const
Definition: EventSetup.h:55
void GEMCSCPadDigiProducer::buildPads ( const GEMDigiCollection digis,
GEMCSCPadDigiCollection out_pads,
GEMCSCPadDigiCollection out_co_pads 
)
private

Definition at line 57 of file GEMCSCPadDigiProducer.cc.

References funct::abs(), GEMGeometry::etaPartitions(), geometry_, maxDeltaBX_, AlCaHLTBitMon_ParallelJobs::p, relativeConstraints::ring, and relativeConstraints::station.

Referenced by produce().

59 {
60  auto etaPartitions = geometry_->etaPartitions();
61  for(auto p: etaPartitions)
62  {
63  // set of <pad, bx> pairs, sorted first by pad then by bx
64  std::set<std::pair<int, int> > proto_pads;
65 
66  // walk over digis in this partition,
67  // and stuff them into a set of unique pads (equivalent of OR operation)
68  auto digis = det_digis.get(p->id());
69  for (auto d = digis.first; d != digis.second; ++d)
70  {
71  int pad_num = 1 + static_cast<int>( p->padOfStrip(d->strip()) );
72  auto pad = std::make_pair(pad_num, d->bx());
73  proto_pads.insert(pad);
74  }
75 
76  // in the future, do some dead-time handling
77  // emulateDeadTime(proto_pads)
78 
79  // fill the output collections
80  for (auto & d: proto_pads)
81  {
82  GEMCSCPadDigi pad_digi(d.first, d.second);
83  out_pads.insertDigi(p->id(), pad_digi);
84  }
85  }
86 
87  // build coincidences
88  for (auto det_range = out_pads.begin(); det_range != out_pads.end(); ++det_range)
89  {
90  const GEMDetId& id = (*det_range).first;
91 
92  // all coincidences detIDs will have layer=1
93  if (id.layer() != 1) continue;
94 
95  // find the corresponding id with layer=2
96  GEMDetId co_id(id.region(), id.ring(), id.station(), 2, id.chamber(), id.roll());
97 
98  auto co_pads_range = out_pads.get(co_id);
99  // empty range = no possible coincidence pads
100  if (co_pads_range.first == co_pads_range.second) continue;
101 
102  // now let's correlate the pads in two layers of this partition
103  const auto& pads_range = (*det_range).second;
104  for (auto p = pads_range.first; p != pads_range.second; ++p)
105  {
106  for (auto co_p = co_pads_range.first; co_p != co_pads_range.second; ++co_p)
107  {
108  // check the match!
109  if (p->pad() != co_p->pad() || std::abs(p->bx() - co_p->bx()) > maxDeltaBX_ ) continue;
110 
111  // always use layer1 pad's BX as a copad's BX
112  GEMCSCPadDigi co_pad_digi(p->pad(), p->bx());
113  out_co_pads.insertDigi(id, co_pad_digi);
114  }
115  }
116  }
117 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const GEMGeometry * geometry_
const std::vector< GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM chambers.
Definition: GEMGeometry.cc:57
void GEMCSCPadDigiProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Produces the EDM products

Implements edm::EDProducer.

Definition at line 39 of file GEMCSCPadDigiProducer.cc.

References buildPads(), edm::Event::getByLabel(), input_, edm::Handle< T >::product(), and edm::Event::put().

40 {
42  e.getByLabel(input_, hdigis);
43 
44  // Create empty output
45  std::auto_ptr<GEMCSCPadDigiCollection> pPads(new GEMCSCPadDigiCollection());
46  std::auto_ptr<GEMCSCPadDigiCollection> pCoPads(new GEMCSCPadDigiCollection());
47 
48  // build the pads
49  buildPads(*(hdigis.product()), *pPads, *pCoPads);
50 
51  // store them in the event
52  e.put(pPads);
53  e.put(pCoPads, "Coincidence");
54 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
MuonDigiCollection< GEMDetId, GEMCSCPadDigi > GEMCSCPadDigiCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
void buildPads(const GEMDigiCollection &digis, GEMCSCPadDigiCollection &out_pads, GEMCSCPadDigiCollection &out_co_pads)
edm::InputTag input_
Name of input digi Collection.
T const * product() const
Definition: Handle.h:81

Member Data Documentation

const GEMGeometry* GEMCSCPadDigiProducer::geometry_
private

Definition at line 43 of file GEMCSCPadDigiProducer.h.

Referenced by beginRun(), and buildPads().

edm::InputTag GEMCSCPadDigiProducer::input_
private

Name of input digi Collection.

Definition at line 37 of file GEMCSCPadDigiProducer.h.

Referenced by GEMCSCPadDigiProducer(), and produce().

int GEMCSCPadDigiProducer::maxDeltaBX_
private

max allowed BX differentce for pads in a copad; always use layer1 pad's BX as a copad's BX

Definition at line 41 of file GEMCSCPadDigiProducer.h.

Referenced by buildPads(), and GEMCSCPadDigiProducer().