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"))
26 typedef std::vector<T> TCollection;
29 produces<TCollection>();
46 desc.
add<
double> (
"MinJetPt", 30.);
47 desc.
add<
double> (
"MaxAbsJetEta", 2.6);
48 desc.
add<
unsigned int> (
"MinNJets", 1);
49 desc.
add<
double> (
"minDeltaR", 0.5);
51 desc.
add<
double> (
"MinSoftJetPt", 25.);
52 desc.
add<
double> (
"MinDeltaEta", -1.);
69 typedef vector<T> TCollection;
75 iEvent.
getByToken(m_theElectronToken,PrevFilterOutput);
79 std::vector<edm::Ref<reco::RecoEcalCandidateCollection> > clusCands;
82 std::vector<edm::Ref<reco::ElectronCollection> > eleCands;
89 std::vector<TVector3> ElePs;
91 if(!clusCands.empty()){
92 for(
size_t candNr=0;candNr<clusCands.size();candNr++){
93 TVector3 positionVector(
94 clusCands[candNr]->superCluster()->
position().
x(),
95 clusCands[candNr]->superCluster()->
position().
y(),
96 clusCands[candNr]->superCluster()->
position().
z());
97 ElePs.push_back(positionVector);
99 }
else if(!eleCands.empty()){
100 for(
size_t candNr=0;candNr<eleCands.size();candNr++){
101 TVector3 positionVector(
102 eleCands[candNr]->superCluster()->
position().
x(),
103 eleCands[candNr]->superCluster()->
position().
y(),
104 eleCands[candNr]->superCluster()->
position().
z());
105 ElePs.push_back(positionVector);
108 else if(!photonCands.empty()){
109 for(
size_t candNr=0;candNr<photonCands.size();candNr++){
110 TVector3 positionVector(
111 photonCands[candNr]->superCluster()->
position().
x(),
112 photonCands[candNr]->superCluster()->
position().
y(),
113 photonCands[candNr]->superCluster()->
position().
z());
114 ElePs.push_back(positionVector);
119 iEvent.
getByToken(m_theJetToken, theJetCollectionHandle);
121 const TCollection & theJetCollection = *theJetCollectionHandle;
123 std::auto_ptr< TCollection > theFilteredJetCollection(
new TCollection);
125 std::auto_ptr < TCollectionVector > allSelections(
new TCollectionVector());
127 bool foundSolution(
false);
129 for (
unsigned int i = 0;
i < ElePs.size();
i++) {
131 bool VBFJetPair =
false;
132 std::vector<int> store_jet;
133 TRefVector refVector;
135 for (
unsigned int j = 0;
j < theJetCollection.size();
j++) {
136 TVector3 JetP(theJetCollection[
j].px(), theJetCollection[
j].py(),
137 theJetCollection[
j].pz());
138 double DR = ElePs[
i].DeltaR(JetP);
140 if (JetP.Pt() > minJetPt_ &&
std::abs(JetP.Eta()) < maxAbsJetEta_ && DR > minDeltaR_) {
141 store_jet.push_back(
j);
143 if ( minDeltaEta_ > 0 ) {
144 for (
unsigned int k =
j+1;
k < theJetCollection.size();
k++ ) {
145 TVector3 SoftJetP(theJetCollection[
k].px(), theJetCollection[
k].py(),
146 theJetCollection[
k].pz());
147 double softDR = ElePs[
i].DeltaR(SoftJetP);
149 if (SoftJetP.Pt() > minSoftJetPt_ &&
std::abs(SoftJetP.Eta()) < maxAbsJetEta_ && softDR > minDeltaR_)
150 if (
std::abs(SoftJetP.Eta() - JetP.Eta()) > minDeltaEta_ ) {
151 store_jet.push_back(
k);
161 std::sort( store_jet.begin(), store_jet.end() );
162 store_jet.erase( unique( store_jet.begin(), store_jet.end() ), store_jet.end() );
165 for (
unsigned int ijet = 0; ijet < store_jet.size(); ijet++ )
168 refVector.push_back(TRef(theJetCollectionHandle, store_jet.at(ijet)));
171 theFilteredJetCollection->push_back(theJetCollection[store_jet.at(ijet)]);
174 allSelections->push_back(refVector);
176 if (theFilteredJetCollection->size() >= minNJets_ && minDeltaEta_ < 0)
177 foundSolution =
true;
178 else if (VBFJetPair && minDeltaEta_ > 0)
179 foundSolution =
true;
180 else if (!foundSolution)
181 theFilteredJetCollection->clear();
186 iEvent.
put(theFilteredJetCollection);
std::string defaultModuleLabel()
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > m_theElectronToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
~HLTJetCollForElePlusJets()
edm::EDGetTokenT< std::vector< T > > m_theJetToken
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Abs< T >::type abs(const T &t)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
HLTJetCollForElePlusJets(const edm::ParameterSet &)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static int position[264][3]
virtual void produce(edm::Event &, const edm::EventSetup &)
edm::InputTag hltElectronTag
edm::InputTag sourceJetTag
std::vector< reco::RecoEcalCandidateRef > VRphoton