70 typedef vector<T> TCollection;
80 std::vector<edm::Ref<reco::RecoEcalCandidateCollection> > clusCands;
83 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);
109 else if(!photonCands.empty()){
110 for(
size_t candNr=0;candNr<photonCands.size();candNr++){
111 TVector3 positionVector(
112 photonCands[candNr]->superCluster()->
position().
x(),
113 photonCands[candNr]->superCluster()->
position().
y(),
114 photonCands[candNr]->superCluster()->
position().
z());
115 ElePs.push_back(positionVector);
122 const TCollection & theJetCollection = *theJetCollectionHandle;
124 std::auto_ptr< TCollection > theFilteredJetCollection(
new TCollection);
126 std::auto_ptr < TCollectionVector > allSelections(
new TCollectionVector());
128 bool foundSolution(
false);
130 for (
unsigned int i = 0;
i < ElePs.size();
i++) {
132 bool VBFJetPair =
false;
133 std::vector<int> store_jet;
134 TRefVector refVector;
136 for (
unsigned int j = 0;
j < theJetCollection.size();
j++) {
137 TVector3 JetP(theJetCollection[
j].px(), theJetCollection[
j].py(),
138 theJetCollection[
j].pz());
139 double DR = ElePs[
i].DeltaR(JetP);
142 store_jet.push_back(
j);
145 for (
unsigned int k =
j+1;
k < theJetCollection.size();
k++ ) {
146 TVector3 SoftJetP(theJetCollection[
k].px(), theJetCollection[
k].py(),
147 theJetCollection[
k].pz());
148 double softDR = ElePs[
i].DeltaR(SoftJetP);
152 store_jet.push_back(
k);
162 std::sort( store_jet.begin(), store_jet.end() );
163 store_jet.erase( unique( store_jet.begin(), store_jet.end() ), store_jet.end() );
166 for (
unsigned int ijet = 0; ijet < store_jet.size(); ijet++ )
169 refVector.push_back(TRef(theJetCollectionHandle, store_jet.at(ijet)));
172 theFilteredJetCollection->push_back(theJetCollection[store_jet.at(ijet)]);
175 allSelections->push_back(refVector);
178 foundSolution =
true;
180 foundSolution =
true;
181 else if (!foundSolution)
182 theFilteredJetCollection->clear();
187 iEvent.
put(theFilteredJetCollection);
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > m_theElectronToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< std::vector< T > > m_theJetToken
static int position[TOTALCHAMBERS][3]
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Abs< T >::type abs(const T &t)
std::vector< reco::RecoEcalCandidateRef > VRphoton