19 : hltElectronTag(iConfig.getParameter<
edm::
InputTag>(
"HltElectronTag")),
20 sourceJetTag(iConfig.getParameter<
edm::
InputTag>(
"SourceJetTag")),
21 minJetPt_(iConfig.getParameter<double>(
"MinJetPt")),
22 maxAbsJetEta_(iConfig.getParameter<double>(
"MaxAbsJetEta")),
23 minNJets_(iConfig.getParameter<unsigned
int>(
"MinNJets")),
25 minDeltaR2_(iConfig.getParameter<double>(
"minDeltaR") *
std::
abs(iConfig.getParameter<double>(
"minDeltaR"))),
27 minSoftJetPt_(iConfig.getParameter<double>(
"MinSoftJetPt")),
28 minDeltaEta_(iConfig.getParameter<double>(
"MinDeltaEta")) {
29 typedef std::vector<T> TCollection;
32 produces<TCollection>();
40 desc.add<
double>(
"MinJetPt", 30.);
41 desc.add<
double>(
"MaxAbsJetEta", 2.6);
42 desc.add<
unsigned int>(
"MinNJets", 1);
43 desc.add<
double>(
"minDeltaR", 0.5);
45 desc.add<
double>(
"MinSoftJetPt", 25.);
46 desc.add<
double>(
"MinDeltaEta", -1.);
60 typedef vector<T> TCollection;
67 iEvent.getByToken(m_theElectronToken, PrevFilterOutput);
71 std::vector<edm::Ref<reco::RecoEcalCandidateCollection>> clusCands;
74 std::vector<edm::Ref<reco::ElectronCollection>> eleCands;
81 std::vector<TVector3> ElePs;
83 if (!clusCands.empty()) {
84 for (
auto& clusCand : clusCands) {
85 TVector3 positionVector(clusCand->superCluster()->position().x(),
86 clusCand->superCluster()->position().y(),
87 clusCand->superCluster()->position().z());
88 ElePs.push_back(positionVector);
90 }
else if (!eleCands.empty()) {
91 for (
auto& eleCand : eleCands) {
92 TVector3 positionVector(eleCand->superCluster()->position().x(),
93 eleCand->superCluster()->position().y(),
94 eleCand->superCluster()->position().z());
95 ElePs.push_back(positionVector);
97 }
else if (!photonCands.empty()) {
98 for (
auto& photonCand : photonCands) {
99 TVector3 positionVector(photonCand->superCluster()->position().x(),
100 photonCand->superCluster()->position().y(),
101 photonCand->superCluster()->position().z());
102 ElePs.push_back(positionVector);
107 iEvent.getByToken(m_theJetToken, theJetCollectionHandle);
109 const TCollection& theJetCollection = *theJetCollectionHandle;
111 std::unique_ptr<TCollection> theFilteredJetCollection(
new TCollection);
113 std::unique_ptr<TCollectionVector> allSelections(
new TCollectionVector());
115 bool foundSolution(
false);
117 for (
auto const& EleP : ElePs) {
118 bool VBFJetPair =
false;
119 std::vector<int> store_jet;
120 TRefVector refVector;
122 for (
unsigned int j = 0;
j < theJetCollection.size();
j++) {
123 TVector3 JetP(theJetCollection[
j].
px(), theJetCollection[
j].
py(), theJetCollection[
j].pz());
125 double const Deta = EleP.Eta() - JetP.Eta();
126 double const Dphi = EleP.DeltaPhi(JetP);
127 double const DR2 = Deta * Deta + Dphi * Dphi;
129 if (JetP.Pt() > minJetPt_ &&
std::abs(JetP.Eta()) < maxAbsJetEta_ && DR2 > minDeltaR2_) {
130 store_jet.push_back(
j);
132 if (minDeltaEta_ > 0) {
133 for (
unsigned int k =
j + 1;
k < theJetCollection.size();
k++) {
134 TVector3 SoftJetP(theJetCollection[
k].
px(), theJetCollection[
k].
py(), theJetCollection[
k].pz());
136 if (
std::abs(SoftJetP.Eta() - JetP.Eta()) <= minDeltaEta_) {
140 double const softDeta = EleP.Eta() - SoftJetP.Eta();
141 double const softDphi = EleP.DeltaPhi(SoftJetP);
142 double const softDR2 = softDeta * softDeta + softDphi * softDphi;
144 if (SoftJetP.Pt() > minSoftJetPt_ &&
std::abs(SoftJetP.Eta()) < maxAbsJetEta_ && softDR2 > minDeltaR2_) {
145 store_jet.push_back(
k);
154 std::sort(store_jet.begin(), store_jet.end());
155 store_jet.erase(
unique(store_jet.begin(), store_jet.end()), store_jet.end());
158 for (
int& ijet : store_jet) {
160 refVector.push_back(TRef(theJetCollectionHandle, ijet));
163 theFilteredJetCollection->push_back(theJetCollection[ijet]);
166 allSelections->push_back(refVector);
168 if (theFilteredJetCollection->size() >= minNJets_ && minDeltaEta_ < 0)
169 foundSolution =
true;
170 else if (VBFJetPair && minDeltaEta_ > 0)
171 foundSolution =
true;
172 else if (!foundSolution)
173 theFilteredJetCollection->clear();
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > m_theElectronToken
edm::EDGetTokenT< std::vector< T > > m_theJetToken
std::string defaultModuleLabel()
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
def unique(seq, keepstr=True)
Abs< T >::type abs(const T &t)
HLTJetCollForElePlusJets(const edm::ParameterSet &)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void produce(edm::Event &, const edm::EventSetup &) override
edm::InputTag hltElectronTag
edm::InputTag sourceJetTag
std::vector< reco::RecoEcalCandidateRef > VRphoton