CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes

pat::HLTL1MuonMatcher Class Reference

Inheritance diagram for pat::HLTL1MuonMatcher:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void beginRun (const edm::Run &iRun, const edm::EventSetup &iSetup) override
 HLTL1MuonMatcher (const edm::ParameterSet &iConfig)
bool operator() (const pat::TriggerObjectStandAlone &l1) const
 select L1s with patName_ and filterLabel_ (public, so it can be used by L1MuonMatcherAlgo)
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
virtual ~HLTL1MuonMatcher ()

Private Types

typedef
pat::TriggerObjectStandAlone 
PATPrimitive
typedef
pat::TriggerObjectStandAloneCollection 
PATPrimitiveCollection
typedef
pat::TriggerObjectStandAloneMatch 
PATTriggerAssociation

Private Member Functions

template<typename Hand , typename T >
void storeExtraInfo (edm::Event &iEvent, const Hand &handle, const std::vector< T > &values, const std::string &label) const
 Store extra information in a ValueMap.

Private Attributes

edm::InputTag l1_
std::string labelProp_
 Labels to set as filter names in the output.
std::vector< const
pat::TriggerObjectStandAlone * > 
lockedItems_
L1MuonMatcherAlgo matcher_
edm::InputTag reco_
 Labels for input collections.
bool resolveAmbiguities_
pat::PATTriggerMatchSelector
< bool, PATPrimitive
selector_
bool writeExtraInfo_
 Write out additional info as ValueMaps.

Detailed Description

Definition at line 35 of file HLTL1MuonMatcher.cc.


Member Typedef Documentation

Definition at line 51 of file HLTL1MuonMatcher.cc.

Definition at line 52 of file HLTL1MuonMatcher.cc.

Definition at line 53 of file HLTL1MuonMatcher.cc.


Constructor & Destructor Documentation

pat::HLTL1MuonMatcher::HLTL1MuonMatcher ( const edm::ParameterSet iConfig) [explicit]

Definition at line 84 of file HLTL1MuonMatcher.cc.

References writeExtraInfo_.

                                                                     :
    matcher_(iConfig),
    reco_(iConfig.getParameter<edm::InputTag>("src")),
    l1_(iConfig.getParameter<edm::InputTag>("matched")),
    selector_(iConfig),
    resolveAmbiguities_(iConfig.getParameter<bool>("resolveAmbiguities")),
    labelProp_(iConfig.getParameter<std::string>("setPropLabel")),
    writeExtraInfo_(iConfig.existsAs<bool>("writeExtraInfo") ? iConfig.getParameter<bool>("writeExtraInfo") : false)
{
    produces<PATPrimitiveCollection>("propagatedReco"); // reco to muon station 2
    produces<PATTriggerAssociation>("propagatedReco");  // asso reco to propagated reco
    produces<PATTriggerAssociation>();                  // asso reco to l1
    if (writeExtraInfo_) {
        produces<edm::ValueMap<float> >("deltaR");
        produces<edm::ValueMap<float> >("deltaPhi");
    }
}
virtual pat::HLTL1MuonMatcher::~HLTL1MuonMatcher ( ) [inline, virtual]

Definition at line 38 of file HLTL1MuonMatcher.cc.

{ }

Member Function Documentation

void pat::HLTL1MuonMatcher::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
) [override, virtual]

Reimplemented from edm::EDProducer.

Definition at line 172 of file HLTL1MuonMatcher.cc.

                                                                               {
    matcher_.init(iSetup);
}
bool pat::HLTL1MuonMatcher::operator() ( const pat::TriggerObjectStandAlone l1) const [inline]

select L1s with patName_ and filterLabel_ (public, so it can be used by L1MuonMatcherAlgo)

Definition at line 46 of file HLTL1MuonMatcher.cc.

References spr::find(), lockedItems_, resolveAmbiguities_, and selector_.

                                                                  {
          if (resolveAmbiguities_ && (std::find(lockedItems_.begin(), lockedItems_.end(), &l1) != lockedItems_.end())) return false;
          return selector_(0,l1);
      }
void pat::HLTL1MuonMatcher::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [override, virtual]

Implements edm::EDProducer.

Definition at line 103 of file HLTL1MuonMatcher.cc.

References reco::Candidate::charge(), PV3DBase< T, PVType, FrameType >::eta(), edm::helper::Filler< Map >::fill(), edm::Event::getByLabel(), TrajectoryStateOnSurface::globalPosition(), i, edm::helper::Filler< Map >::insert(), TrajectoryStateOnSurface::isValid(), L1Scalers_cfi::l1s, reco::Candidate::mass(), match(), RPCpg::mu, n, PV3DBase< T, PVType, FrameType >::phi(), pos, reco::Candidate::pt(), edm::Event::put(), and L1Trigger_dataformats::reco.

                                                                            {
    using namespace edm;
    using namespace std;

    Handle<View<reco::Candidate> > reco;
    Handle<PATPrimitiveCollection> l1s;

    iEvent.getByLabel(reco_, reco);
    iEvent.getByLabel(l1_, l1s);

    auto_ptr<PATPrimitiveCollection> propOut(new PATPrimitiveCollection());
    vector<int>   propMatches(reco->size(), -1);
    vector<int>   fullMatches(reco->size(), -1);
    vector<float> deltaRs(reco->size(), 999), deltaPhis(reco->size(), 999);
    lockedItems_.clear();
    for (int i = 0, n = reco->size(); i < n; ++i) {
        TrajectoryStateOnSurface propagated;
        const reco::Candidate &mu = (*reco)[i];
        int match = matcher_.matchGeneric(mu, *l1s, *this, deltaRs[i], deltaPhis[i], propagated);
        if (propagated.isValid()) {
            GlobalPoint pos = propagated.globalPosition();
            propMatches[i] = propOut->size();
            propOut->push_back(PATPrimitive(math::PtEtaPhiMLorentzVector(mu.pt(), pos.eta(), pos.phi(), mu.mass())));
            propOut->back().addFilterLabel(labelProp_);
            propOut->back().setCharge(mu.charge());
        }
        fullMatches[i] = match;
        if (match != -1) {
            lockedItems_.push_back(&(*l1s)[match]);
        }
    }
    lockedItems_.clear();

    OrphanHandle<PATPrimitiveCollection> propDone = iEvent.put(propOut, "propagatedReco");

    auto_ptr<PATTriggerAssociation> propAss(new PATTriggerAssociation(propDone));
    PATTriggerAssociation::Filler propFiller(*propAss);
    propFiller.insert(reco, propMatches.begin(), propMatches.end());
    propFiller.fill();
    iEvent.put(propAss, "propagatedReco");

    auto_ptr<PATTriggerAssociation> fullAss(new PATTriggerAssociation(l1s));
    PATTriggerAssociation::Filler fullFiller(*fullAss);
    fullFiller.insert(reco, fullMatches.begin(), fullMatches.end());
    fullFiller.fill();
    iEvent.put(fullAss);

    if (writeExtraInfo_) {
        storeExtraInfo(iEvent, reco, deltaRs,   "deltaR");
        storeExtraInfo(iEvent, reco, deltaPhis, "deltaPhi");
    }
}
template<typename Hand , typename T >
void pat::HLTL1MuonMatcher::storeExtraInfo ( edm::Event iEvent,
const Hand &  handle,
const std::vector< T > &  values,
const std::string &  label 
) const [private]

Store extra information in a ValueMap.

Definition at line 158 of file HLTL1MuonMatcher.cc.

References edm::helper::Filler< Map >::fill(), edm::helper::Filler< Map >::insert(), and edm::Event::put().

                                                       {
    using namespace edm; using namespace std;
    auto_ptr<ValueMap<T> > valMap(new ValueMap<T>());
    typename edm::ValueMap<T>::Filler filler(*valMap);
    filler.insert(handle, values.begin(), values.end());
    filler.fill();
    iEvent.put(valMap, label);
}

Member Data Documentation

Definition at line 58 of file HLTL1MuonMatcher.cc.

std::string pat::HLTL1MuonMatcher::labelProp_ [private]

Labels to set as filter names in the output.

Definition at line 66 of file HLTL1MuonMatcher.cc.

Definition at line 79 of file HLTL1MuonMatcher.cc.

Referenced by operator()().

Definition at line 55 of file HLTL1MuonMatcher.cc.

Labels for input collections.

Definition at line 58 of file HLTL1MuonMatcher.cc.

Definition at line 63 of file HLTL1MuonMatcher.cc.

Referenced by operator()().

Select HLT objects. First template argument is dummy and useless,

Definition at line 62 of file HLTL1MuonMatcher.cc.

Referenced by operator()().

Write out additional info as ValueMaps.

Definition at line 69 of file HLTL1MuonMatcher.cc.

Referenced by HLTL1MuonMatcher().