23 hltElectronTag(iConfig.getParameter< edm::InputTag > (
"HltElectronTag")),
24 sourceJetTag(iConfig.getParameter< edm::InputTag > (
"SourceJetTag")),
25 minJetPt_(iConfig.getParameter<double> (
"MinJetPt")),
26 maxAbsJetEta_(iConfig.getParameter<double> (
"MaxAbsJetEta")),
27 minNJets_(iConfig.getParameter<unsigned int> (
"MinNJets")),
28 minDeltaR_(iConfig.getParameter< double > (
"minDeltaR")),
30 minSoftJetPt_(iConfig.getParameter< double > (
"MinSoftJetPt")),
31 minDeltaEta_(iConfig.getParameter< double > (
"MinDeltaEta"))
33 typedef std::vector<T> TCollection;
34 produces<TCollection>();
51 desc.
add<
double> (
"MinJetPt", 30.);
52 desc.
add<
double> (
"MaxAbsJetEta", 2.6);
53 desc.
add<
unsigned int> (
"MinNJets", 1);
54 desc.
add<
double> (
"minDeltaR", 0.5);
56 desc.
add<
double> (
"MinSoftJetPt", 25.);
57 desc.
add<
double> (
"MinDeltaEta", -1.);
74 typedef vector<T> TCollection;
80 iEvent.
getByLabel(hltElectronTag,PrevFilterOutput);
83 std::vector<edm::Ref<reco::RecoEcalCandidateCollection> > clusCands;
86 std::vector<edm::Ref<reco::ElectronCollection> > eleCands;
90 std::vector<TVector3> ElePs;
92 if(!clusCands.empty()){
93 for(
size_t candNr=0;candNr<clusCands.size();candNr++){
94 TVector3 positionVector(
95 clusCands[candNr]->superCluster()->
position().
x(),
96 clusCands[candNr]->superCluster()->
position().
y(),
97 clusCands[candNr]->superCluster()->
position().
z());
98 ElePs.push_back(positionVector);
100 }
else if(!eleCands.empty()){
101 for(
size_t candNr=0;candNr<eleCands.size();candNr++){
102 TVector3 positionVector(
103 eleCands[candNr]->superCluster()->
position().
x(),
104 eleCands[candNr]->superCluster()->
position().
y(),
105 eleCands[candNr]->superCluster()->
position().
z());
106 ElePs.push_back(positionVector);
111 iEvent.
getByLabel(sourceJetTag, theJetCollectionHandle);
113 const TCollection & theJetCollection = *theJetCollectionHandle;
115 std::auto_ptr< TCollection > theFilteredJetCollection(
new TCollection);
117 std::auto_ptr < TCollectionVector > allSelections(
new TCollectionVector());
119 bool foundSolution(
false);
121 for (
unsigned int i = 0;
i < ElePs.size();
i++) {
123 bool VBFJetPair =
false;
124 std::vector<int> store_jet;
125 TRefVector refVector;
127 for (
unsigned int j = 0;
j < theJetCollection.size();
j++) {
128 TVector3 JetP(theJetCollection[
j].px(), theJetCollection[
j].py(),
129 theJetCollection[
j].pz());
130 double DR = ElePs[
i].DeltaR(JetP);
132 if (JetP.Pt() > minJetPt_ &&
std::abs(JetP.Eta()) < maxAbsJetEta_ && DR > minDeltaR_) {
133 store_jet.push_back(
j);
135 if ( minDeltaEta_ > 0 ) {
136 for (
unsigned int k =
j+1;
k < theJetCollection.size();
k++ ) {
137 TVector3 SoftJetP(theJetCollection[
k].px(), theJetCollection[
k].py(),
138 theJetCollection[
k].pz());
139 double softDR = ElePs[
i].DeltaR(SoftJetP);
141 if (SoftJetP.Pt() > minSoftJetPt_ &&
std::abs(SoftJetP.Eta()) < maxAbsJetEta_ && softDR > minDeltaR_)
142 if (
std::abs(SoftJetP.Eta() - JetP.Eta()) > minDeltaEta_ ) {
143 store_jet.push_back(
k);
153 std::sort( store_jet.begin(), store_jet.end() );
154 store_jet.erase( unique( store_jet.begin(), store_jet.end() ), store_jet.end() );
157 for (
unsigned int ijet = 0; ijet < store_jet.size(); ijet++ )
160 refVector.push_back(TRef(theJetCollectionHandle, store_jet.at(ijet)));
163 theFilteredJetCollection->push_back(theJetCollection[store_jet.at(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();
178 iEvent.
put(theFilteredJetCollection);
~HLTJetCollForElePlusJets()
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static int position[TOTALCHAMBERS][3]
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
HLTJetCollForElePlusJets(const edm::ParameterSet &)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
virtual void produce(edm::Event &, const edm::EventSetup &)