CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

GEMCSCPadDigiProducer Class Reference

#include <GEMCSCPadDigiProducer.h>

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

List of all members.

Public Member Functions

virtual void beginRun (edm::Run &, const edm::EventSetup &)
virtual void endRun (edm::Run &, const edm::EventSetup &)
 GEMCSCPadDigiProducer (const edm::ParameterSet &ps)
virtual void produce (edm::Event &e, const edm::EventSetup &c)
virtual ~GEMCSCPadDigiProducer ()

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.
int maxDeltaBX_

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_.

: geometry_(nullptr)
{
  produces<GEMCSCPadDigiCollection>();
  produces<GEMCSCPadDigiCollection>("Coincidence");

  input_ = ps.getParameter<edm::InputTag>("InputCollection");
  maxDeltaBX_ = ps.getParameter<int>("maxDeltaBX");
}
GEMCSCPadDigiProducer::~GEMCSCPadDigiProducer ( ) [virtual]

Definition at line 27 of file GEMCSCPadDigiProducer.cc.

{}

Member Function Documentation

void GEMCSCPadDigiProducer::beginRun ( edm::Run r,
const edm::EventSetup eventSetup 
) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 31 of file GEMCSCPadDigiProducer.cc.

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

{
  edm::ESHandle<GEMGeometry> hGeom;
  eventSetup.get<MuonGeometryRecord>().get( hGeom );
  geometry_ = &*hGeom;
}
void GEMCSCPadDigiProducer::buildPads ( const GEMDigiCollection digis,
GEMCSCPadDigiCollection out_pads,
GEMCSCPadDigiCollection out_co_pads 
) [private]

Definition at line 57 of file GEMCSCPadDigiProducer.cc.

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

Referenced by produce().

{
  auto etaPartitions = geometry_->etaPartitions();
  for(auto p: etaPartitions)
  {
    // set of <pad, bx> pairs, sorted first by pad then by bx
    std::set<std::pair<int, int> > proto_pads;
  
    // walk over digis in this partition, 
    // and stuff them into a set of unique pads (equivalent of OR operation)
    auto digis = det_digis.get(p->id());
    for (auto d = digis.first; d != digis.second; ++d)
    {
      int pad_num = 1 + static_cast<int>( p->padOfStrip(d->strip()) );
      auto pad = std::make_pair(pad_num, d->bx());
      proto_pads.insert(pad);
    }
  
    // in the future, do some dead-time handling
    // emulateDeadTime(proto_pads)
  
    // fill the output collections
    for (auto & d: proto_pads)
    {
      GEMCSCPadDigi pad_digi(d.first, d.second);
      out_pads.insertDigi(p->id(), pad_digi);
    }
  }

  // build coincidences
  for (auto det_range = out_pads.begin(); det_range != out_pads.end(); ++det_range)
  {
    const GEMDetId& id = (*det_range).first;

    // all coincidences detIDs will have layer=1
    if (id.layer() != 1) continue;

    // find the corresponding id with layer=2
    GEMDetId co_id(id.region(), id.ring(), id.station(), 2, id.chamber(), id.roll());

    auto co_pads_range = out_pads.get(co_id);
    // empty range = no possible coincidence pads
    if (co_pads_range.first == co_pads_range.second) continue;

    // now let's correlate the pads in two layers of this partition
    const auto& pads_range = (*det_range).second;
    for (auto p = pads_range.first; p != pads_range.second; ++p)
    {
      for (auto co_p = co_pads_range.first; co_p != co_pads_range.second; ++co_p)
      {
        // check the match!
        if (p->pad() != co_p->pad() || std::abs(p->bx() - co_p->bx()) > maxDeltaBX_ ) continue;

        // always use layer1 pad's BX as a copad's BX
        GEMCSCPadDigi co_pad_digi(p->pad(), p->bx());
        out_co_pads.insertDigi(id, co_pad_digi);
      }
    }
  }
}
virtual void GEMCSCPadDigiProducer::endRun ( edm::Run ,
const edm::EventSetup  
) [inline, virtual]

Reimplemented from edm::EDProducer.

Definition at line 28 of file GEMCSCPadDigiProducer.h.

{}
void GEMCSCPadDigiProducer::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

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().

{
  edm::Handle<GEMDigiCollection> hdigis;
  e.getByLabel(input_, hdigis);

  // Create empty output
  std::auto_ptr<GEMCSCPadDigiCollection> pPads(new GEMCSCPadDigiCollection());
  std::auto_ptr<GEMCSCPadDigiCollection> pCoPads(new GEMCSCPadDigiCollection());

  // build the pads
  buildPads(*(hdigis.product()), *pPads, *pCoPads);

  // store them in the event
  e.put(pPads);
  e.put(pCoPads, "Coincidence");
}

Member Data Documentation

Definition at line 44 of file GEMCSCPadDigiProducer.h.

Referenced by beginRun(), and buildPads().

Name of input digi Collection.

Definition at line 38 of file GEMCSCPadDigiProducer.h.

Referenced by GEMCSCPadDigiProducer(), and produce().

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

Definition at line 42 of file GEMCSCPadDigiProducer.h.

Referenced by buildPads(), and GEMCSCPadDigiProducer().