44 desc.
add<
int>(
"nrRequiredFirstLeg",0);
45 desc.
add<
int>(
"nrRequiredSecondLeg",0);
46 desc.
add<
int>(
"nrRequiredUniqueLeg",0);
47 desc.
add<
double>(
"maxMatchDR",0.01);
48 descriptions.
add(
"hltEgammaDoubleLegCombFilter",desc);
60 std::vector<math::XYZPoint> firstLegP3s;
63 std::vector<math::XYZPoint> secondLegP3s;
68 std::vector<std::pair<int,int> > matchedCands;
69 matchCands(firstLegP3s,secondLegP3s,matchedCands);
76 for(
auto & matchedCand : matchedCands){
77 if(matchedCand.first>=0){
78 if(matchedCand.second>=0) nrBoth++;
80 }
else if(matchedCand.second>=0) nr2ndLegOnly++;
91 if(nrBoth >= nrNeededFirstLeg + nrNeededSecondLeg) accept =
true;
101 std::vector<size_t> matched2ndLegs;
102 for(
size_t firstLegNr=0;firstLegNr<firstLegP3s.size();firstLegNr++){
104 for(
size_t secondLegNr=0;secondLegNr<secondLegP3s.size() && matchedNr==-1;secondLegNr++){
107 matchedCands.push_back(std::make_pair(firstLegNr,matchedNr));
108 if(matchedNr>=0) matched2ndLegs.push_back(static_cast<size_t>(matchedNr));
110 std::sort(matched2ndLegs.begin(),matched2ndLegs.end());
112 for(
size_t secondLegNr=0;secondLegNr<secondLegP3s.size();secondLegNr++){
113 if(!std::binary_search(matched2ndLegs.begin(),matched2ndLegs.end(),secondLegNr)){
114 matchedCands.push_back(std::make_pair<int,int>(-1, static_cast<int>(secondLegNr)));
126 std::vector<edm::Ref<reco::RecoEcalCandidateCollection> > phoCands;
128 std::vector<edm::Ref<reco::RecoEcalCandidateCollection> > clusCands;
130 std::vector<edm::Ref<reco::ElectronCollection> > eleCands;
132 std::vector<edm::Ref<reco::CaloJetCollection> > jetCands;
135 if(!phoCands.empty()){
136 for(
auto & phoCand : phoCands){
137 p3s.push_back(phoCand->superCluster()->position());
139 }
else if(!clusCands.empty()){
140 for(
auto & clusCand : clusCands){
141 p3s.push_back(clusCand->superCluster()->position());
143 }
else if(!eleCands.empty()){
144 for(
auto & eleCand : eleCands){
145 p3s.push_back(eleCand->superCluster()->position());
147 }
else if(!jetCands.empty()){
148 for(
auto & jetCand : jetCands){
150 p3.SetX(jetCand->p4().x());
151 p3.SetY(jetCand->p4().y());
152 p3.SetZ(jetCand->p4().z());
T getParameter(std::string const &) const
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
edm::InputTag firstLegLastFilterTag_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
~HLTEgammaDoubleLegCombFilter() override
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > firstLegLastFilterToken_
edm::InputTag secondLegLastFilterTag_
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) const override
HLTEgammaDoubleLegCombFilter(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
static void getP3OfLegCands(const edm::Event &iEvent, const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > &filterToken, std::vector< math::XYZPoint > &p3s)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void matchCands(const std::vector< math::XYZPoint > &firstLegP3s, const std::vector< math::XYZPoint > &secondLegP3s, std::vector< std::pair< int, int > > &matchedCands) const
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
static void makeHLTFilterDescription(edm::ParameterSetDescription &desc)
XYZPointD XYZPoint
point in space with cartesian internal representation
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > secondLegLastFilterToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)