CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

MuonCandProducerMon Class Reference

#include <MuonCandProducerMon.h>

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

List of all members.

Public Member Functions

 MuonCandProducerMon (const edm::ParameterSet &)
 ~MuonCandProducerMon ()

Private Member Functions

virtual void beginJob (void)
virtual void endJob ()
virtual void produce (edm::Event &, const edm::EventSetup &)
int verbose ()

Private Attributes

edm::InputTag CSCinput_
CSCTFPtLUTcscPtLUT_
edm::InputTag DTinput_
unsigned long long m_ptScaleCacheID
unsigned long long m_scalesCacheID
int verbose_

Detailed Description

Definition at line 32 of file MuonCandProducerMon.h.


Constructor & Destructor Documentation

MuonCandProducerMon::MuonCandProducerMon ( const edm::ParameterSet pset) [explicit]

Definition at line 10 of file MuonCandProducerMon.cc.

References CSCinput_, cscPtLUT_, DTinput_, edm::ParameterSet::getUntrackedParameter(), m_ptScaleCacheID, m_scalesCacheID, and verbose_.

                                                                    {

    verbose_ = pset.getUntrackedParameter<int>("VerboseFlag", 0);

    CSCinput_ = pset.getUntrackedParameter<edm::InputTag>("CSCinput",
            (edm::InputTag) ("csctfdigis"));
    DTinput_ = pset.getUntrackedParameter<edm::InputTag>("DTinput",
            (edm::InputTag) ("dttfdigis"));

    cscPtLUT_ = 0;
    m_scalesCacheID = 0;
    m_ptScaleCacheID = 0;

    produces<std::vector<L1MuRegionalCand> >("CSC");
    produces<std::vector<L1MuRegionalCand> >("DT");
}
MuonCandProducerMon::~MuonCandProducerMon ( )

Definition at line 27 of file MuonCandProducerMon.cc.

                                          {
}

Member Function Documentation

virtual void MuonCandProducerMon::beginJob ( void  ) [inline, private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 40 of file MuonCandProducerMon.h.

{};
void MuonCandProducerMon::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 30 of file MuonCandProducerMon.cc.

References cscPtLUT_.

                                 {
    if (cscPtLUT_)
        delete cscPtLUT_;
}
void MuonCandProducerMon::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 35 of file MuonCandProducerMon.cc.

References edm::ParameterSet::addParameter(), edm::ParameterSet::addUntrackedParameter(), edm::eventsetup::EventSetupRecord::cacheIdentifier(), CSCinput_, cscPtLUT_, csc::L1Track::decodeRank(), DTinput_, edm::EventSetup::get(), edm::Event::getByLabel(), edm::HandleBase::isValid(), m_ptScaleCacheID, m_scalesCacheID, edm::ESHandle< T >::product(), CSCTFPtLUT::Pt(), and edm::Event::put().

                                     {

    edm::Handle<L1CSCTrackCollection> CSCtracks;
    iEvent.getByLabel(CSCinput_, CSCtracks);

    edm::Handle<L1MuDTTrackContainer> DTtracks;
    iEvent.getByLabel(DTinput_, DTtracks);

    std::auto_ptr<std::vector<L1MuRegionalCand> > csc_product(
            new std::vector<L1MuRegionalCand>);

    std::auto_ptr<std::vector<L1MuRegionalCand> > dt_product(
            new std::vector<L1MuRegionalCand>);

    if (!CSCtracks.isValid()) {

        csc_product->push_back(L1MuRegionalCand());

    } else {

        typedef L1CSCTrackCollection::const_iterator ctcIt;

        for (ctcIt tcit = CSCtracks->begin(); tcit != CSCtracks->end(); tcit++) {

            L1MuRegionalCand cand(tcit->first.getDataWord(), tcit->first.bx());

            // set pt value

            // Update CSCTFTrackBuilder only if the scales have changed.  Use the
            // EventSetup cacheIdentifier to tell when this has happened.
            if (iSetup.get<L1MuTriggerScalesRcd>().cacheIdentifier()
                    != m_scalesCacheID
                    || iSetup.get<L1MuTriggerPtScaleRcd>().cacheIdentifier()
                            != m_ptScaleCacheID) {
                if (cscPtLUT_)
                    delete cscPtLUT_;
                edm::ESHandle<L1MuTriggerScales> scales;
                iSetup.get<L1MuTriggerScalesRcd>().get(scales);
                edm::ESHandle<L1MuTriggerPtScale> ptScale;
                iSetup.get<L1MuTriggerPtScaleRcd>().get(ptScale);
                // Create a dummy pset for CSC Pt LUTs

                edm::ParameterSet ptLUTset;
                ptLUTset.addParameter<bool>("ReadPtLUT", false);
                ptLUTset.addParameter<bool>("isBinary", false);
                ptLUTset.addUntrackedParameter<std::string>("LUTPath", "./");

                cscPtLUT_ = new CSCTFPtLUT(ptLUTset, scales.product(),
                        ptScale.product());
                m_scalesCacheID
                        = iSetup.get<L1MuTriggerScalesRcd>().cacheIdentifier();
                m_ptScaleCacheID
                        = iSetup.get<L1MuTriggerPtScaleRcd>().cacheIdentifier();
            }

            ptadd thePtAddress(tcit->first.ptLUTAddress());
            ptdat thePtData = cscPtLUT_->Pt(thePtAddress);
            const unsigned int rank =
                    (thePtAddress.track_fr ? thePtData.front_rank
                            : thePtData.rear_rank);
            unsigned int quality = 0;
            unsigned int pt = 0;
            csc::L1Track::decodeRank(rank, pt, quality);
            cand.setQualityPacked(quality & 0x3);
            cand.setPtPacked(pt & 0x1f);
            csc_product->push_back(cand);
        }
    }

    if (!DTtracks.isValid()) {

        dt_product->push_back(L1MuRegionalCand());

    } else {

        typedef std::vector<L1MuDTTrackCand>::const_iterator ctcIt;

        std::vector<L1MuDTTrackCand> *dttc = DTtracks->getContainer();

        for (ctcIt it = dttc->begin(); it != dttc->end(); it++) {
            dt_product->push_back(L1MuRegionalCand(*it));
        }
    }

    iEvent.put(csc_product, "CSC");
    iEvent.put(dt_product, "DT");
}
int MuonCandProducerMon::verbose ( ) [inline, private]

Definition at line 45 of file MuonCandProducerMon.h.

References verbose_.

{return verbose_;}

Member Data Documentation

Definition at line 50 of file MuonCandProducerMon.h.

Referenced by MuonCandProducerMon(), and produce().

Definition at line 52 of file MuonCandProducerMon.h.

Referenced by endJob(), MuonCandProducerMon(), and produce().

Definition at line 51 of file MuonCandProducerMon.h.

Referenced by MuonCandProducerMon(), and produce().

unsigned long long MuonCandProducerMon::m_ptScaleCacheID [private]

Definition at line 54 of file MuonCandProducerMon.h.

Referenced by MuonCandProducerMon(), and produce().

unsigned long long MuonCandProducerMon::m_scalesCacheID [private]

Definition at line 53 of file MuonCandProducerMon.h.

Referenced by MuonCandProducerMon(), and produce().

Definition at line 49 of file MuonCandProducerMon.h.

Referenced by MuonCandProducerMon(), and verbose().