17 hltElectronTag(iConfig.getParameter< edm::InputTag > (
"HltElectronTag")),
18 sourceJetTag(iConfig.getParameter< edm::InputTag > (
"SourceJetTag")),
19 minJetPt_(iConfig.getParameter<double> (
"MinJetPt")),
20 maxAbsJetEta_(iConfig.getParameter<double> (
"MaxAbsJetEta")),
21 minNJets_(iConfig.getParameter<unsigned int> (
"MinNJets")),
22 minDeltaR_(iConfig.getParameter< double > (
"minDeltaR")),
24 minSoftJetPt_(iConfig.getParameter< double > (
"MinSoftJetPt")),
25 minDeltaEta_(iConfig.getParameter< double > (
"MinDeltaEta"))
27 typedef std::vector<T> TCollection;
30 produces<TCollection>();
47 desc.
add<
double> (
"MinJetPt", 30.);
48 desc.
add<
double> (
"MaxAbsJetEta", 2.6);
49 desc.
add<
unsigned int> (
"MinNJets", 1);
50 desc.
add<
double> (
"minDeltaR", 0.5);
52 desc.
add<
double> (
"MinSoftJetPt", 25.);
53 desc.
add<
double> (
"MinDeltaEta", -1.);
70 typedef vector<T> TCollection;
76 iEvent.
getByToken(m_theElectronToken,PrevFilterOutput);
79 std::vector<edm::Ref<reco::RecoEcalCandidateCollection> > clusCands;
82 std::vector<edm::Ref<reco::ElectronCollection> > eleCands;
86 std::vector<TVector3> ElePs;
88 if(!clusCands.empty()){
89 for(
size_t candNr=0;candNr<clusCands.size();candNr++){
90 TVector3 positionVector(
91 clusCands[candNr]->superCluster()->
position().
x(),
92 clusCands[candNr]->superCluster()->
position().
y(),
93 clusCands[candNr]->superCluster()->
position().
z());
94 ElePs.push_back(positionVector);
96 }
else if(!eleCands.empty()){
97 for(
size_t candNr=0;candNr<eleCands.size();candNr++){
98 TVector3 positionVector(
99 eleCands[candNr]->superCluster()->
position().
x(),
100 eleCands[candNr]->superCluster()->
position().
y(),
101 eleCands[candNr]->superCluster()->
position().
z());
102 ElePs.push_back(positionVector);
107 iEvent.
getByToken(m_theJetToken, theJetCollectionHandle);
109 const TCollection & theJetCollection = *theJetCollectionHandle;
111 std::auto_ptr< TCollection > theFilteredJetCollection(
new TCollection);
113 std::auto_ptr < TCollectionVector > allSelections(
new TCollectionVector());
115 bool foundSolution(
false);
117 for (
unsigned int i = 0;
i < ElePs.size();
i++) {
119 bool VBFJetPair =
false;
120 std::vector<int> store_jet;
121 TRefVector refVector;
123 for (
unsigned int j = 0;
j < theJetCollection.size();
j++) {
124 TVector3 JetP(theJetCollection[
j].px(), theJetCollection[
j].py(),
125 theJetCollection[
j].pz());
126 double DR = ElePs[
i].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(),
134 theJetCollection[
k].pz());
135 double softDR = ElePs[
i].DeltaR(SoftJetP);
137 if (SoftJetP.Pt() > minSoftJetPt_ &&
std::abs(SoftJetP.Eta()) < maxAbsJetEta_ && softDR > minDeltaR_)
138 if (
std::abs(SoftJetP.Eta() - JetP.Eta()) > minDeltaEta_ ) {
139 store_jet.push_back(
k);
149 std::sort( store_jet.begin(), store_jet.end() );
150 store_jet.erase( unique( store_jet.begin(), store_jet.end() ), store_jet.end() );
153 for (
unsigned int ijet = 0; ijet < store_jet.size(); ijet++ )
156 refVector.push_back(TRef(theJetCollectionHandle, store_jet.at(ijet)));
159 theFilteredJetCollection->push_back(theJetCollection[store_jet.at(ijet)]);
162 allSelections->push_back(refVector);
164 if (theFilteredJetCollection->size() >= minNJets_ && minDeltaEta_ < 0)
165 foundSolution =
true;
166 else if (VBFJetPair && minDeltaEta_ > 0)
167 foundSolution =
true;
168 else if (!foundSolution)
169 theFilteredJetCollection->clear();
174 iEvent.
put(theFilteredJetCollection);
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)
static int position[TOTALCHAMBERS][3]
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)
virtual void produce(edm::Event &, const edm::EventSetup &)
edm::InputTag hltElectronTag
edm::InputTag sourceJetTag