16 : hltElectronTag(iConfig.getParameter<
edm::
InputTag>(
"HltElectronTag")),
17 sourceJetTag(iConfig.getParameter<
edm::
InputTag>(
"SourceJetTag")),
18 minJetPt_(iConfig.getParameter<double>(
"MinJetPt")),
19 maxAbsJetEta_(iConfig.getParameter<double>(
"MaxAbsJetEta")),
20 minNJets_(iConfig.getParameter<unsigned
int>(
"MinNJets")),
21 minDeltaR_(iConfig.getParameter<double>(
"minDeltaR")),
23 minSoftJetPt_(iConfig.getParameter<double>(
"MinSoftJetPt")),
24 minDeltaEta_(iConfig.getParameter<double>(
"MinDeltaEta")) {
25 typedef std::vector<T> TCollection;
28 produces<TCollection>();
42 desc.add<
double>(
"MinJetPt", 30.);
43 desc.add<
double>(
"MaxAbsJetEta", 2.6);
44 desc.add<
unsigned int>(
"MinNJets", 1);
45 desc.add<
double>(
"minDeltaR", 0.5);
47 desc.add<
double>(
"MinSoftJetPt", 25.);
48 desc.add<
double>(
"MinDeltaEta", -1.);
62 typedef vector<T> TCollection;
69 iEvent.getByToken(m_theElectronToken, PrevFilterOutput);
73 std::vector<edm::Ref<reco::RecoEcalCandidateCollection>> clusCands;
76 std::vector<edm::Ref<reco::ElectronCollection>> eleCands;
83 std::vector<TVector3> ElePs;
85 if (!clusCands.empty()) {
86 for (
auto& clusCand : clusCands) {
87 TVector3 positionVector(clusCand->superCluster()->position().x(),
88 clusCand->superCluster()->position().y(),
89 clusCand->superCluster()->position().z());
90 ElePs.push_back(positionVector);
92 }
else if (!eleCands.empty()) {
93 for (
auto& eleCand : eleCands) {
94 TVector3 positionVector(eleCand->superCluster()->position().x(),
95 eleCand->superCluster()->position().y(),
96 eleCand->superCluster()->position().z());
97 ElePs.push_back(positionVector);
99 }
else if (!photonCands.empty()) {
100 for (
auto& photonCand : photonCands) {
101 TVector3 positionVector(photonCand->superCluster()->position().x(),
102 photonCand->superCluster()->position().y(),
103 photonCand->superCluster()->position().z());
104 ElePs.push_back(positionVector);
109 iEvent.getByToken(m_theJetToken, theJetCollectionHandle);
111 const TCollection& theJetCollection = *theJetCollectionHandle;
113 std::unique_ptr<TCollection> theFilteredJetCollection(
new TCollection);
115 std::unique_ptr<TCollectionVector> allSelections(
new TCollectionVector());
117 bool foundSolution(
false);
119 for (
auto& EleP : ElePs) {
120 bool VBFJetPair =
false;
121 std::vector<int> store_jet;
122 TRefVector refVector;
124 for (
unsigned int j = 0;
j < theJetCollection.size();
j++) {
125 TVector3 JetP(theJetCollection[
j].
px(), theJetCollection[
j].
py(), theJetCollection[
j].pz());
126 double DR = EleP.DeltaR(JetP);
128 if (JetP.Pt() > minJetPt_ &&
std::abs(JetP.Eta()) < maxAbsJetEta_ && DR > minDeltaR_) {
129 store_jet.push_back(
j);
131 if (minDeltaEta_ > 0) {
132 for (
unsigned int k =
j + 1;
k < theJetCollection.size();
k++) {
133 TVector3 SoftJetP(theJetCollection[
k].
px(), theJetCollection[
k].
py(), theJetCollection[
k].pz());
134 double softDR = EleP.DeltaR(SoftJetP);
136 if (SoftJetP.Pt() > minSoftJetPt_ &&
std::abs(SoftJetP.Eta()) < maxAbsJetEta_ && softDR > minDeltaR_)
137 if (
std::abs(SoftJetP.Eta() - JetP.Eta()) > minDeltaEta_) {
138 store_jet.push_back(
k);
147 std::sort(store_jet.begin(), store_jet.end());
148 store_jet.erase(
unique(store_jet.begin(), store_jet.end()), store_jet.end());
151 for (
int& ijet : store_jet) {
153 refVector.push_back(TRef(theJetCollectionHandle, ijet));
156 theFilteredJetCollection->push_back(theJetCollection[ijet]);
159 allSelections->push_back(refVector);
161 if (theFilteredJetCollection->size() >= minNJets_ && minDeltaEta_ < 0)
162 foundSolution =
true;
163 else if (VBFJetPair && minDeltaEta_ > 0)
164 foundSolution =
true;
165 else if (!foundSolution)
166 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
~HLTJetCollForElePlusJets() override