Skip to content

Commit

Permalink
Merge pull request #11587 from Martin-Grunewald/PFMETinTriggerDataFor…
Browse files Browse the repository at this point in the history
…mats76X

Addition of PFMET to Trigger Data Formats (76X)
  • Loading branch information
cmsbuild committed Oct 2, 2015
2 parents b02db47 + befde1b commit 5d70168
Show file tree
Hide file tree
Showing 10 changed files with 165 additions and 10 deletions.
27 changes: 23 additions & 4 deletions DataFormats/HLTReco/interface/TriggerEventWithRefs.h
Expand Up @@ -52,17 +52,18 @@ namespace trigger
size_type l1hfrings_;
size_type pfjets_;
size_type pftaus_;
size_type pfmets_;

/// constructor
TriggerFilterObject() :
filterTag_(),
photons_(0), electrons_(0), muons_(0), jets_(0), composites_(0), basemets_(0), calomets_(0), pixtracks_(0), l1em_(0), l1muon_(0), l1jet_(0), l1etmiss_(0), l1hfrings_(0), pfjets_(0), pftaus_(0) {
photons_(0), electrons_(0), muons_(0), jets_(0), composites_(0), basemets_(0), calomets_(0), pixtracks_(0), l1em_(0), l1muon_(0), l1jet_(0), l1etmiss_(0), l1hfrings_(0), pfjets_(0), pftaus_(0), pfmets_(0) {
filterTag_=edm::InputTag().encode();
}
TriggerFilterObject(const edm::InputTag& filterTag,
size_type np, size_type ne, size_type nm, size_type nj, size_type nc, size_type nB, size_type nC, size_type nt, size_type l1em, size_type l1muon, size_type l1jet, size_type l1etmiss, size_type l1hfrings, size_type pfjets, size_type pftaus) :
size_type np, size_type ne, size_type nm, size_type nj, size_type nc, size_type nB, size_type nC, size_type nt, size_type l1em, size_type l1muon, size_type l1jet, size_type l1etmiss, size_type l1hfrings, size_type pfjets, size_type pftaus, size_type pfmets) :
filterTag_(filterTag.encode()),
photons_(np), electrons_(ne), muons_(nm), jets_(nj), composites_(nc), basemets_(nB), calomets_(nC), pixtracks_(nt), l1em_(l1em), l1muon_(l1muon), l1jet_(l1jet), l1etmiss_(l1etmiss), l1hfrings_(l1hfrings), pfjets_(pfjets), pftaus_(pftaus) { }
photons_(np), electrons_(ne), muons_(nm), jets_(nj), composites_(nc), basemets_(nB), calomets_(nC), pixtracks_(nt), l1em_(l1em), l1muon_(l1muon), l1jet_(l1jet), l1etmiss_(l1etmiss), l1hfrings_(l1hfrings), pfjets_(pfjets), pftaus_(pftaus), pfmets_(pfmets) { }
};

/// data members
Expand Down Expand Up @@ -102,7 +103,8 @@ namespace trigger
addObjects(tfowr.l1etmissIds(),tfowr.l1etmissRefs()),
addObjects(tfowr.l1hfringsIds(),tfowr.l1hfringsRefs()),
addObjects(tfowr.pfjetIds(),tfowr.pfjetRefs()),
addObjects(tfowr.pftauIds(),tfowr.pftauRefs())
addObjects(tfowr.pftauIds(),tfowr.pftauRefs()),
addObjects(tfowr.pfmetIds(),tfowr.pfmetRefs())
)
);
}
Expand Down Expand Up @@ -220,6 +222,12 @@ namespace trigger
return std::pair<size_type,size_type>(begin,end);
}

std::pair<size_type,size_type> pfmetSlice(size_type filter) const {
const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).pfmets_);
const size_type end(filterObjects_.at(filter).pfmets_);
return std::pair<size_type,size_type>(begin,end);
}


/// extract Ref<C>s for a specific filter and of specific physics type

Expand Down Expand Up @@ -388,6 +396,17 @@ namespace trigger
TriggerRefsCollections::getObjects(id,pftaus,begin,end);
}

void getObjects(size_type filter, Vids& ids, VRpfmet& pfmets) const {
const size_type begin(pfmetSlice(filter).first);
const size_type end(pfmetSlice(filter).second);
TriggerRefsCollections::getObjects(ids,pfmets,begin,end);
}
void getObjects(size_type filter, int id, VRpfmet& pfmets) const {
const size_type begin(pfmetSlice(filter).first);
const size_type end(pfmetSlice(filter).second);
TriggerRefsCollections::getObjects(id,pfmets,begin,end);
}

};

}
Expand Down
55 changes: 54 additions & 1 deletion DataFormats/HLTReco/interface/TriggerRefsCollections.h
Expand Up @@ -29,6 +29,7 @@
#include "DataFormats/Candidate/interface/CompositeCandidateFwd.h"
#include "DataFormats/METReco/interface/METFwd.h"
#include "DataFormats/METReco/interface/CaloMETFwd.h"
#include "DataFormats/METReco/interface/PFMETFwd.h"
#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidateFwd.h"

#include "DataFormats/L1Trigger/interface/L1HFRingsFwd.h"
Expand Down Expand Up @@ -65,6 +66,7 @@ namespace trigger

typedef std::vector<reco::PFJetRef> VRpfjet;
typedef std::vector<reco::PFTauRef> VRpftau;
typedef std::vector<reco::PFMETRef> VRpfmet;

class TriggerRefsCollections {

Expand Down Expand Up @@ -103,6 +105,8 @@ namespace trigger
VRpfjet pfjetRefs_;
Vids pftauIds_;
VRpftau pftauRefs_;
Vids pfmetIds_;
VRpfmet pfmetRefs_;

/// methods
public:
Expand All @@ -124,7 +128,8 @@ namespace trigger
l1hfringsIds_(), l1hfringsRefs_(),

pfjetIds_(), pfjetRefs_(),
pftauIds_(), pftauRefs_()
pftauIds_(), pftauRefs_(),
pfmetIds_(), pfmetRefs_()
{ }

/// utility
Expand Down Expand Up @@ -161,6 +166,8 @@ namespace trigger
std::swap(pfjetRefs_, other.pfjetRefs_);
std::swap(pftauIds_, other.pftauIds_);
std::swap(pftauRefs_, other.pftauRefs_);
std::swap(pfmetIds_, other.pfmetIds_);
std::swap(pfmetRefs_, other.pfmetRefs_);
}

/// setters for L3 collections: (id=physics type, and Ref<C>)
Expand Down Expand Up @@ -226,6 +233,10 @@ namespace trigger
pftauIds_.push_back(id);
pftauRefs_.push_back(ref);
}
void addObject(int id, const reco::PFMETRef& ref) {
pfmetIds_.push_back(id);
pfmetRefs_.push_back(ref);
}

///
size_type addObjects (const Vids& ids, const VRphoton& refs) {
Expand Down Expand Up @@ -320,6 +331,12 @@ namespace trigger
pftauRefs_.insert(pftauRefs_.end(),refs.begin(),refs.end());
return pftauIds_.size();
}
size_type addObjects (const Vids& ids, const VRpfmet& refs) {
assert(ids.size()==refs.size());
pfmetIds_.insert(pfmetIds_.end(),ids.begin(),ids.end());
pfmetRefs_.insert(pfmetRefs_.end(),refs.begin(),refs.end());
return pfmetIds_.size();
}

/// various physics-level getters:
void getObjects(Vids& ids, VRphoton& refs) const {
Expand Down Expand Up @@ -802,6 +819,38 @@ namespace trigger
return;
}

void getObjects(Vids& ids, VRpfmet& refs) const {
getObjects(ids,refs,0,pfmetIds_.size());
}
void getObjects(Vids& ids, VRpfmet& refs, size_type begin, size_type end) const {
assert (begin<=end);
assert (end<=pfmetIds_.size());
const size_type n(end-begin);
ids.resize(n);
refs.resize(n);
size_type j(0);
for (size_type i=begin; i!=end; ++i) {
ids[j]=pfmetIds_[i];
refs[j]=pfmetRefs_[i];
++j;
}
}
void getObjects(int id, VRpfmet& refs) const {
getObjects(id,refs,0,pfmetIds_.size());
}
void getObjects(int id, VRpfmet& refs, size_type begin, size_type end) const {
assert (begin<=end);
assert (end<=pfmetIds_.size());
size_type n(0);
for (size_type i=begin; i!=end; ++i) {if (id==pfmetIds_[i]) {++n;}}
refs.resize(n);
size_type j(0);
for (size_type i=begin; i!=end; ++i) {
if (id==pfmetIds_[i]) {refs[j]=pfmetRefs_[i]; ++j;}
}
return;
}

/// low-level getters for data members
size_type photonSize() const {return photonIds_.size();}
const Vids& photonIds() const {return photonIds_;}
Expand Down Expand Up @@ -863,6 +912,10 @@ namespace trigger
const Vids& pftauIds() const {return pftauIds_;}
const VRpftau& pftauRefs() const {return pftauRefs_;}

size_type pfmetSize() const {return pfmetIds_.size();}
const Vids& pfmetIds() const {return pfmetIds_;}
const VRpfmet& pfmetRefs() const {return pfmetRefs_;}

};

// picked up via argument dependent lookup, e-g- by boost::swap()
Expand Down
12 changes: 8 additions & 4 deletions DataFormats/HLTReco/src/classes_def.xml
Expand Up @@ -42,10 +42,12 @@
<version ClassVersion="10" checksum="2923979599"/>
</class>
<class name="trigger::TriggerObjectCollection"/>
<class name="trigger::TriggerRefsCollections" ClassVersion="12">
<class name="trigger::TriggerRefsCollections" ClassVersion="13">
<version ClassVersion="13" checksum="3831523881"/>
<version ClassVersion="12" checksum="4231679693"/>
</class>
<class name="trigger::TriggerFilterObjectWithRefs" ClassVersion="11">
<class name="trigger::TriggerFilterObjectWithRefs" ClassVersion="12">
<version ClassVersion="12" checksum="2645314434"/>
<version ClassVersion="11" checksum="1437602318"/>
<version ClassVersion="10" checksum="1741228815"/>
</class>
Expand All @@ -58,11 +60,13 @@
<version ClassVersion="11" checksum="3351458717"/>
<version ClassVersion="10" checksum="1112210423"/>
</class>
<class name="trigger::TriggerEventWithRefs::TriggerFilterObject" ClassVersion="12">
<class name="trigger::TriggerEventWithRefs::TriggerFilterObject" ClassVersion="13">
<version ClassVersion="13" checksum="1672519577"/>
<version ClassVersion="12" checksum="2301242282"/>
</class>
<class name="std::vector<trigger::TriggerEventWithRefs::TriggerFilterObject>"/>
<class name="trigger::TriggerEventWithRefs" ClassVersion="11">
<class name="trigger::TriggerEventWithRefs" ClassVersion="12">
<version ClassVersion="12" checksum="3347721344"/>
<version ClassVersion="11" checksum="2025606788"/>
<version ClassVersion="10" checksum="4075310205"/>
</class>
Expand Down
2 changes: 2 additions & 0 deletions HLTrigger/HLTcore/interface/HLTEventAnalyzerRAW.h
Expand Up @@ -85,6 +85,8 @@ class HLTEventAnalyzerRAW : public edm::stream::EDAnalyzer< > {
trigger::VRpfjet pfjetRefs_;
trigger::Vids pftauIds_;
trigger::VRpftau pftauRefs_;
trigger::Vids pfmetIds_;
trigger::VRpfmet pfmetRefs_;

};
#endif
5 changes: 5 additions & 0 deletions HLTrigger/HLTcore/interface/TriggerSummaryProducerAOD.h
Expand Up @@ -27,6 +27,7 @@
#include "DataFormats/L1Trigger/interface/L1EtMissParticleFwd.h"
#include "DataFormats/METReco/interface/METFwd.h"
#include "DataFormats/METReco/interface/CaloMETFwd.h"
#include "DataFormats/METReco/interface/PFMETFwd.h"

#include "DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h"
#include "DataFormats/EgammaCandidates/interface/ElectronFwd.h"
Expand All @@ -35,6 +36,7 @@
#include "DataFormats/Candidate/interface/CompositeCandidateFwd.h"
#include "DataFormats/METReco/interface/METCollection.h"
#include "DataFormats/METReco/interface/CaloMETCollection.h"
#include "DataFormats/METReco/interface/PFMETCollection.h"
#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidateFwd.h"
#include "DataFormats/L1Trigger/interface/L1EmParticleFwd.h"
#include "DataFormats/L1Trigger/interface/L1MuonParticleFwd.h"
Expand Down Expand Up @@ -100,6 +102,7 @@ class TriggerSummaryProducerAOD : public edm::stream::EDProducer<edm::GlobalCach
void fillTriggerObject(const T& );
void fillTriggerObject(const l1extra::L1HFRings& );
void fillTriggerObject(const l1extra::L1EtMissParticle& );
void fillTriggerObject(const reco::PFMET& );
void fillTriggerObject(const reco::CaloMET& );
void fillTriggerObject(const reco::MET& );

Expand All @@ -110,6 +113,7 @@ class TriggerSummaryProducerAOD : public edm::stream::EDProducer<edm::GlobalCach
void fillFilterObjectMember(const int&, const int&, const edm::Ref<C>&);
void fillFilterObjectMember(const int&, const int&, const edm::Ref<l1extra::L1HFRingsCollection>&);
void fillFilterObjectMember(const int&, const int&, const edm::Ref<l1extra::L1EtMissParticleCollection>&);
void fillFilterObjectMember(const int&, const int&, const edm::Ref<reco::PFMETCollection>&);
void fillFilterObjectMember(const int&, const int&, const edm::Ref<reco::CaloMETCollection>&);
void fillFilterObjectMember(const int&, const int&, const edm::Ref<reco::METCollection>&);

Expand Down Expand Up @@ -167,6 +171,7 @@ class TriggerSummaryProducerAOD : public edm::stream::EDProducer<edm::GlobalCach
edm::GetterOfProducts<reco::CompositeCandidateCollection> getCompositeCandidateCollection_;
edm::GetterOfProducts<reco::METCollection> getMETCollection_;
edm::GetterOfProducts<reco::CaloMETCollection> getCaloMETCollection_;
edm::GetterOfProducts<reco::PFMETCollection> getPFMETCollection_;
edm::GetterOfProducts<reco::IsolatedPixelTrackCandidateCollection> getIsolatedPixelTrackCandidateCollection_;
edm::GetterOfProducts<l1extra::L1EmParticleCollection> getL1EmParticleCollection_;
edm::GetterOfProducts<l1extra::L1MuonParticleCollection> getL1MuonParticleCollection_;
Expand Down
14 changes: 14 additions & 0 deletions HLTrigger/HLTcore/plugins/HLTEventAnalyzerRAW.cc
Expand Up @@ -21,6 +21,7 @@
#include "DataFormats/Candidate/interface/CompositeCandidate.h"
#include "DataFormats/METReco/interface/MET.h"
#include "DataFormats/METReco/interface/CaloMET.h"
#include "DataFormats/METReco/interface/PFMET.h"
#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h"
#include "DataFormats/L1Trigger/interface/L1HFRings.h"
#include "DataFormats/L1Trigger/interface/L1EmParticle.h"
Expand Down Expand Up @@ -211,6 +212,8 @@ void HLTEventAnalyzerRAW::analyzeTrigger(const edm::Event& iEvent, const edm::Ev
pfjetRefs_.clear();
pftauIds_.clear();
pftauRefs_.clear();
pfmetIds_.clear();
pfmetRefs_.clear();

// Attention: must look only for modules actually run in this path
// for this event!
Expand Down Expand Up @@ -396,6 +399,17 @@ void HLTEventAnalyzerRAW::analyzeTrigger(const edm::Event& iEvent, const edm::Ev
}
}

triggerEventWithRefsHandle_->getObjects(filterIndex,pfmetIds_,pfmetRefs_);
const unsigned int nPfMETs(pfmetIds_.size());
if (nPfMETs>0) {
LogVerbatim("HLTEventAnalyzerRAW") << " PfMETs: " << nPfMETs << " - the objects: # id pt" << endl;
for (unsigned int i=0; i!=nPfMETs; ++i) {
LogVerbatim("HLTEventAnalyzerRAW") << " " << i << " " << pfmetIds_[i]
<< " " << pfmetRefs_[i]->pt()
<< endl;
}
}

}
}

Expand Down
5 changes: 5 additions & 0 deletions HLTrigger/HLTcore/plugins/TriggerSummaryAnalyzerRAW.cc
Expand Up @@ -117,6 +117,10 @@ TriggerSummaryAnalyzerRAW::analyze(const edm::Event& iEvent, const edm::EventSet
handle->pftauSlice(iFO).first);
if (nPFTaus>0) LogVerbatim("TriggerSummaryAnalyzerRAW") << " PFTaus: " << nPFTaus;

const unsigned int nPFMETs(handle->pfmetSlice(iFO).second-
handle->pfmetSlice(iFO).first);
if (nPFMETs>0) LogVerbatim("TriggerSummaryAnalyzerRAW") << " PFMETs: " << nPFMETs;

LogVerbatim("TriggerSummaryAnalyzerRAW") << endl;
}
LogVerbatim("TriggerSummaryAnalyzerRAW") << "Elements in linearised collections of Refs: " << endl;
Expand All @@ -135,6 +139,7 @@ TriggerSummaryAnalyzerRAW::analyze(const edm::Event& iEvent, const edm::EventSet
LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1HfRings: " << handle->l1hfringsSize() << endl;
LogVerbatim("TriggerSummaryAnalyzerRAW") << " PFJets: " << handle->pfjetSize() << endl;
LogVerbatim("TriggerSummaryAnalyzerRAW") << " PFTaus: " << handle->pftauSize() << endl;
LogVerbatim("TriggerSummaryAnalyzerRAW") << " PFMETs: " << handle->pfmetSize() << endl;
} else {
LogVerbatim("TriggerSummaryAnalyzerRAW") << "Handle invalid! Check InputTag provided." << endl;
}
Expand Down

0 comments on commit 5d70168

Please sign in to comment.